/* ぴったりカット v0.2.0「ようかん切り生放送」。外部フォント・画像なし。動かすのは transform と opacity。
   色の役割：世界＝水色の空／主役＝ようかん（えんじ）／操作・目標＝黄（はじめる・指の目印だけ）／
   盛り上がり＝赤紫（テロップ・ハンコ・れんぞく）／文字と縁＝濃紺。
   ロゴは前作（Gスイング）の「金の光沢・斜体」と分け、赤紫のテロップ板に白い直立の極太字。板ごと斜めに切れてずれる。 */
:root {
  --gothic: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --heavy: "Hiragino Sans", "Hiragino Kaku Gothic StdN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --num: "Arial Black", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sky1: #8FD8F2; --sky2: #E9F8FF;
  --navy: #1B2340; --sub: #3D4A72;
  --mag: #FF3D8B; --mag-d: #C2185B;
  --yellow: #FFD23A; --yellow-d: #C99A00;
  --white: #FFFFFF;
  --yk: #7A2335; --yk-gloss: #B4485F; --yk-rim: #3A0E18; --yk-cut: #E07A92;
  --wood1: #F3D9A8; --wood2: #E2BD7E;
  --r-kami: #FFB800; --r-pittari: #FF3D8B; --r-great: #1A6FE0; --r-good: #2E9E5B; --r-miss: #8A93A8;
  --k: 0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { background: var(--sky1); color: var(--navy); font-family: var(--gothic); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#frame { position: fixed; inset: 0; overflow: hidden; }
button { font-family: var(--gothic); cursor: pointer; }
.screen { position: absolute; inset: 0; margin: 0 auto; max-width: 480px; display: flex; flex-direction: column; align-items: stretch; padding: calc(var(--sat) + 8px) 16px calc(var(--sab) + 12px); }
.screen[hidden] { display: none; }

/* ---------- 背景：スタジオの空とスポットライト ---------- */
.bg { position: absolute; inset: 0; contain: strict; background: linear-gradient(180deg, var(--sky1) 0%, #C4ECFA 55%, var(--sky2) 100%); }
.studio { position: absolute; inset: 0; background: url(./art/studio-bg.webp) center 30% / cover no-repeat; opacity: .32; }
/* 軽量化（平均fpsが40未満）では背景の動きを止める */
html[data-lite] .spot { animation: none; }
.spot { position: absolute; left: 50%; top: 24%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; opacity: .55; will-change: transform;
  background: repeating-conic-gradient(from 0deg, #ffffff66 0 10deg, transparent 10deg 30deg); animation: spin 20s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* れんぞくの段で回転が速くなり、空が少し赤らむ */
html[data-streak="1"] .spot { animation-duration: 10s; }
html[data-streak="2"] .spot { animation-duration: 5s; opacity: .7; }
html[data-streak="3"] .spot { animation-duration: 2.5s; opacity: .8; }
html[data-streak="4"] .spot { animation-duration: 1.2s; opacity: .9; }
html[data-streak="2"] .bg, html[data-streak="3"] .bg { background: linear-gradient(180deg, #A9D9F5 0%, #F6D3EA 60%, #FFF1F8 100%); }
html[data-streak="4"] .bg { background: linear-gradient(180deg, #FFD6EC 0%, #FFE9A8 55%, #FFFFFF 100%); }

/* ---------- タイトル ---------- */
#title { overflow-y: auto; } /* 横向きなど背が低い時も「はじめる」まで届く */
.title-main { display: flex; flex-direction: column; align-items: center; margin: auto 0; padding-top: 56px; gap: 8px; }
.vol { position: absolute; right: 14px; top: calc(var(--sat) + 12px); display: flex; align-items: center; gap: 6px; padding: 10px 6px; color: var(--navy); cursor: pointer; z-index: 3; }
.vol-ico { width: 20px; height: 20px; }
.vol.mute .vol-ico { opacity: .4; }
.vol-dots { position: relative; display: flex; gap: 14px; align-items: center; }
.vol-dots i { position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: var(--navy); opacity: .4; }
.vol-dots b { position: relative; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--navy); background: var(--white); }
.vol-dots b.on { background: var(--yellow); }

.onair { display: flex; align-items: center; gap: 6px; background: var(--white); border: 3px solid var(--navy); border-radius: 999px; padding: 3px 12px 3px 8px; font-weight: 900; font-size: 15px; box-shadow: 0 3px 0 var(--navy); }
.onair i { width: 12px; height: 12px; border-radius: 50%; background: #FF2A2A; box-shadow: 0 0 6px #FF2A2A; animation: blink 1s steps(2, start) infinite; }
.onair span { font-size: 11px; font-weight: 700; color: var(--sub); margin-left: 4px; }
@keyframes blink { to { opacity: .25; } }

/* ロゴ：テロップ板。上下2枚に切って、下の板を右下へずらす（切れたテロップ） */
.logo { position: relative; margin: 6px 0 0; width: min(330px, 86vw); height: 158px; transform: rotate(-4deg); will-change: transform; animation: logoin .7s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes logoin { 0% { transform: translateY(-40vh) rotate(-14deg); } 60% { transform: translateY(0) rotate(-1deg); } 80% { transform: translateY(-8px) rotate(-5deg); } 100% { transform: rotate(-4deg); } }
.telop { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--mag); border: 5px solid var(--navy); border-radius: 22px;
  box-shadow: inset 0 0 0 4px #fff, 0 9px 0 var(--navy); }
.t-top { clip-path: polygon(-5% -10%, 105% -10%, 105% 40%, -5% 66%); }
.t-bot { clip-path: polygon(-5% 66%, 105% 40%, 105% 120%, -5% 120%); animation: slip .35s ease-out .75s both; }
@keyframes slip { from { transform: none; } to { transform: translate(7px, 9px) rotate(1.2deg); } }
.lg-cut { position: absolute; left: -6%; right: -6%; top: 53%; height: 4px; background: #fff; transform: rotate(-13.5deg) scaleX(0); transform-origin: left; box-shadow: 0 0 10px #fff; animation: cutin .25s ease-out .55s forwards; }
@keyframes cutin { 70% { transform: rotate(-13.5deg) scaleX(1); opacity: 1; } to { transform: rotate(-13.5deg) scaleX(1); opacity: 0; } }
.lg-sub { font-family: var(--heavy); font-weight: 900; font-size: 24px; letter-spacing: .25em; color: var(--white); margin: 0 0 -4px .25em;
  text-shadow: 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 2px 0 var(--navy), 0 -2px 0 var(--navy), 0 4px 0 var(--navy); }
.lg-main { font-family: var(--heavy); font-weight: 900; font-size: clamp(64px, 21vw, 92px); line-height: 1.02; letter-spacing: .02em; color: var(--white); white-space: nowrap;
  text-shadow: 4px 0 0 var(--navy), -4px 0 0 var(--navy), 0 4px 0 var(--navy), 0 -4px 0 var(--navy), 3px 3px 0 var(--navy), -3px -3px 0 var(--navy), 3px -3px 0 var(--navy), -3px 3px 0 var(--navy),
    0 8px 0 var(--navy), 2px 9px 0 var(--navy), -2px 9px 0 var(--navy); }

/* タイトルの場面：スタジオの調理台・まな板・ようかんと包丁 */
.counter { position: relative; width: 270px; height: 104px; margin: 22px 0 4px; }
.counter::after { content: ""; position: absolute; left: -40px; right: -40px; bottom: 0; height: 26px; background: repeating-linear-gradient(90deg, var(--navy) 0 26px, #2C3A66 26px 30px); border-radius: 6px 6px 0 0; }
.host { position: absolute; left: -52px; bottom: 18px; width: 112px; height: auto; z-index: 0; }
@media (max-width: 350px) { .host { left: -26px; width: 92px; } }
.counter > :not(.host) { z-index: 1; }
.counter::after { z-index: 2; }
.board-wood { position: absolute; left: 6px; right: 6px; bottom: 22px; height: 18px; border-radius: 6px; background: linear-gradient(180deg, var(--wood1), var(--wood2)); border: 3px solid var(--navy); }
.ty-l, .ty-r { position: absolute; bottom: 38px; height: 50px; background: linear-gradient(180deg, var(--yk-gloss) 0 8%, var(--yk) 32%, var(--yk-rim)); border: 3px solid var(--navy); }
.ty-l { left: 22px; width: 118px; border-radius: 9px 0 0 9px; border-right-color: var(--yk-cut); }
.ty-r { left: 146px; width: 100px; border-radius: 0 9px 9px 0; transform: rotate(9deg) translate(6px, -10px); transform-origin: left bottom; border-left-color: var(--yk-cut); }
.ty-knife { position: absolute; left: 128px; bottom: 54px; width: 28px; height: 80px; transform: rotate(-24deg); transform-origin: bottom; }
.ty-knife::before { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 58px; background: linear-gradient(90deg, #C9D3DC, #fff 45%, #AEB9C4); border: 3px solid var(--navy); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 82%); border-radius: 0 0 0 10px; }
.ty-knife i { position: absolute; left: 6px; top: 0; width: 16px; height: 26px; background: var(--navy); border-radius: 5px; }
.ty-cap { position: absolute; right: -30px; top: -34px; font-family: var(--heavy); font-weight: 900; font-size: 22px; color: var(--white); transform: rotate(10deg);
  text-shadow: 2px 0 0 var(--mag), -2px 0 0 var(--mag), 0 2px 0 var(--mag), 0 -2px 0 var(--mag), 0 4px 0 var(--navy); }

.lead { margin: 6px 0 0; text-align: center; line-height: 1.7; font-size: 16px; color: var(--sub); font-weight: 700; }
.lead b { color: var(--navy); font-size: 18px; }
.go { appearance: none; border: 4px solid var(--navy); border-radius: 999px; background: var(--yellow); color: var(--navy); font-weight: 900; font-size: 24px; letter-spacing: .1em; padding: 14px 0; width: min(280px, 80vw); margin-top: 8px; box-shadow: 0 6px 0 var(--navy); }
.go:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
.daily, .best { margin: 0; font-size: 14px; color: var(--sub); text-align: center; font-weight: 700; }
.version { position: absolute; right: 12px; bottom: calc(var(--sab) + 8px); margin: 0; font-size: 11px; color: var(--sub); }
.lab-record-status { margin: 4px 0 0; font-size: 12px; color: var(--sub); text-align: center; }
#title .lab-record-status { position: absolute; left: 0; right: 0; bottom: calc(var(--sab) + 26px); }

/* ---------- プレイ ---------- */
#play { padding-top: calc(var(--sat) + 8px); }
.hud { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 38px; padding: 0 10px; background: var(--navy); border-radius: 12px; color: var(--white); }
.dots { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dots li { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #8A93C0; }
.dots li.now { border-color: var(--yellow); box-shadow: 0 0 0 2px #FFD23A55; }
.dots li[class^="r-"] { border-color: transparent; }
.dots li.r-kami { background: var(--r-kami); box-shadow: 0 0 6px var(--r-kami); }
.dots li.r-pittari { background: var(--r-pittari); }
.dots li.r-great { background: #5AA0FF; }
.dots li.r-good { background: #5CCB86; }
.dots li.r-miss { background: #59617A; }
.rating { display: flex; align-items: baseline; gap: 4px; font-family: var(--num); font-weight: 900; font-size: 15px; color: var(--yellow); white-space: nowrap; }
.rating small { font-family: var(--gothic); font-size: 10px; color: #C9CFEA; font-weight: 700; }
.rating.up span { display: inline-block; animation: rate .35s ease-out; }
@keyframes rate { 0% { transform: scale(1.6); color: #fff; } 100% { transform: none; } }
.hud-score { font-family: var(--num); font-weight: 900; font-size: 22px; display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.hud-score small { font-family: var(--gothic); font-size: 11px; font-weight: 700; color: #C9CFEA; }
#modeTag:not(:empty) { background: var(--yellow); color: var(--navy); padding: 1px 5px; border-radius: 4px; margin-right: 4px; font-size: 10px; }

.fuda-wrap { position: relative; display: flex; justify-content: center; margin-top: 10px; }
.fuda { position: relative; width: 190px; min-height: 206px; background: var(--white); border: 4px solid var(--navy); border-radius: 18px; box-shadow: 0 6px 0 var(--navy); display: flex; flex-direction: column; align-items: stretch; overflow: visible; isolation: isolate; }
.fuda-ask { background: var(--mag); color: var(--white); font-weight: 900; font-size: 14px; text-align: center; padding: 5px 0 6px; border-radius: 13px 13px 0 0; letter-spacing: .05em; }
.fuda-ask span { font-size: 11px; background: var(--navy); border-radius: 999px; padding: 1px 7px; margin-right: 6px; vertical-align: 1px; }
.fuda-q { flex: 1; display: flex; align-items: center; justify-content: center; font-family: var(--heavy); font-weight: 900; color: var(--navy); line-height: 1; }
.fuda-q .num { font-size: 72px; letter-spacing: -.02em; }
.frac { display: inline-flex; flex-direction: column; align-items: center; font-size: 60px; line-height: 1; }
.frac span:first-child { border-bottom: 6px solid currentColor; padding: 0 14px 5px; }
.frac span:last-child { padding-top: 6px; }
/* 神ぴったりの放射線：独立した層で、透明度だけ切り替える（はみ出し描画の消し残りを防ぐ） */
.rays { position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; margin: -450px 0 0 -450px; pointer-events: none; opacity: 0; will-change: opacity;
  background: repeating-conic-gradient(from 0deg, #FFB80066 0 3deg, transparent 3deg 12deg); transition: opacity .15s; }
.rays.on { opacity: 1; }

.stampbox { position: absolute; left: 0; right: 0; top: calc(100% + 12px); display: flex; flex-direction: column; align-items: center; pointer-events: none; z-index: 2; }
.stamp { opacity: 0; display: flex; flex-direction: column; align-items: center; transform: rotate(-5deg); }
.stamp b { font-family: var(--heavy); font-weight: 900; font-size: clamp(30px, 10vw, 44px); color: var(--white); padding: 4px 22px 7px; border: 4px solid var(--navy); border-radius: 999px; background: var(--r-pittari); white-space: nowrap;
  text-shadow: 0 3px 0 var(--navy); box-shadow: 0 5px 0 var(--navy); }
.stamp small { margin-top: 8px; font-size: 13px; font-weight: 900; color: var(--white); background: var(--navy); padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.stamp.on { opacity: 1; animation: stampin .22s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes stampin { 0% { transform: rotate(-5deg) scale(2.2); opacity: 0; } 70% { transform: rotate(-5deg) scale(.92); opacity: 1; } 100% { transform: rotate(-5deg) scale(1); } }
.stamp.r-kami b { background: linear-gradient(180deg, #FFF3B0, #FFD23A 48%, #FFB800 52%, #FF9A00); color: var(--navy); text-shadow: 0 2px 0 #fff8; }
.stamp.r-great b { background: #1A6FE0; }
.stamp.r-good b { background: #2E9E5B; }
.stamp.r-miss b { background: #EEF1F7; color: var(--sub); text-shadow: none; font-size: 28px; }

/* れんぞくの帯：段が上がるほど太く派手に */
.streak { position: absolute; left: -20px; right: -20px; top: 13%; z-index: 4; pointer-events: none; text-align: center; font-family: var(--heavy); font-weight: 900; font-size: 34px; color: var(--white);
  background: var(--mag); border-top: 4px solid var(--navy); border-bottom: 4px solid var(--navy); padding: 4px 0 6px; transform: rotate(-6deg) scaleX(0); opacity: 0;
  text-shadow: 0 3px 0 var(--navy); letter-spacing: .06em; }
.streak.on { animation: band 1.1s ease-out forwards; }
.streak.s5 { font-size: 40px; background: linear-gradient(90deg, var(--mag), #FF7A3D, var(--mag)); }
.streak.s7 { font-size: 44px; background: linear-gradient(90deg, #FF7A3D, var(--mag), #8A3DFF); }
.streak.s10 { font-size: 48px; background: linear-gradient(90deg, #FF3D3D, #FFB800, #3DD6FF, #8A3DFF, #FF3D8B); }
@keyframes band { 0% { transform: rotate(-6deg) scaleX(0); opacity: 1; } 18% { transform: rotate(-6deg) scaleX(1.05); } 26% { transform: rotate(-6deg) scaleX(1); } 80% { opacity: 1; } 100% { transform: rotate(-6deg) translateY(-30px); opacity: 0; } }

.tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: auto 0 0; padding-top: 10px; min-height: 40px; }
.speed { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 900; color: var(--mag-d); }
.speed.off { color: var(--sub); }
.speed-bar { height: 8px; background: #1B234022; border-radius: 4px; overflow: hidden; border: 2px solid var(--navy); }
.speed-bar i { display: block; height: 100%; background: var(--mag); transform-origin: left; }
.hintbtn { appearance: none; border: 3px solid var(--navy); background: var(--white); color: var(--navy); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 900; white-space: nowrap; box-shadow: 0 3px 0 var(--navy); }
.hintbtn:disabled { opacity: .45; box-shadow: none; }

.stage { position: relative; margin: 26px 12px 0; height: 168px; touch-action: none; }
.yokan { position: absolute; left: 0; right: 0; top: 40px; height: 96px; will-change: transform; }
.piece { position: absolute; top: 0; bottom: 0; will-change: transform; background: linear-gradient(180deg, var(--yk-gloss) 0 6%, var(--yk) 26%, var(--yk) 70%, var(--yk-rim) 100%); border-top: 3px solid var(--navy); border-bottom: 3px solid var(--navy); overflow: hidden; }
.piece .gloss { position: absolute; left: 0; right: 0; top: 8px; height: 5px; background: #ffffff2a; border-radius: 3px; }
.piece.left { left: 0; width: calc(var(--k) * 100%); border-left: 3px solid var(--navy); border-radius: 12px 0 0 12px; }
.piece.right { left: calc(var(--k) * 100%); right: 0; border-right: 3px solid var(--navy); border-radius: 0 12px 12px 0; transform-origin: left bottom; }
.piece::after { content: ""; position: absolute; top: 0; bottom: 0; width: 6px; background: var(--yk-cut); opacity: 0; }
.piece.left::after { right: 0; }
.piece.right::after { left: 0; }
.yokan.fly .piece::after { opacity: 1; }
.yokan.wobble { animation: purun .25s ease-out; transform-origin: bottom; }
@keyframes purun { 0% { transform: scaleY(.94) scaleX(1.02); } 50% { transform: scaleY(1.03) scaleX(.99); } 100% { transform: none; } }
/* 切れた右の片が回りながら跳ねる */
.yokan.fly .piece.right { animation: fly .45s cubic-bezier(.3, .4, .6, 1) forwards; }
@keyframes fly { 0% { transform: none; } 45% { transform: translate(40px, -70px) rotate(30deg); } 100% { transform: translate(90px, 30px) rotate(70deg); opacity: 0; } }

.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks i { position: absolute; top: -8px; bottom: -8px; width: 2px; margin-left: -1px; background: #FFFFFFcc; }
.ticks i.fine { top: 20px; bottom: 20px; width: 1px; opacity: .6; }
.ticks i.guide { background: var(--yellow); top: -12px; bottom: -12px; width: 3px; box-shadow: 0 0 0 1px var(--navy); }
.ticks i b { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 900; white-space: nowrap; color: var(--navy); }
.ticks i.guide b { bottom: -30px; }
.ticks i.hit { background: var(--yellow); width: 5px; margin-left: -2.5px; box-shadow: 0 0 0 1px var(--navy), 0 0 8px var(--yellow); }
.answer { position: absolute; top: -30px; bottom: -30px; left: 0; width: 0; border-left: 3px dashed var(--navy); margin-left: -1.5px; animation: fadein .2s; }
.answer span { position: absolute; top: -24px; left: 0; transform: translateX(-50%); font-size: 13px; font-weight: 900; color: var(--white); background: var(--navy); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.cutline { position: absolute; top: -3px; bottom: -3px; left: calc(var(--k) * 100%); width: 3px; margin-left: -1.5px; background: #fff; opacity: 0; }
.cutline.on { opacity: .95; }
@keyframes fadein { from { opacity: 0; } }

/* 包丁（刃は銀、柄は濃紺） */
.blade { position: absolute; left: calc(var(--k) * 100%); top: -12px; width: 0; height: 170px; pointer-events: none; will-change: transform; transition: opacity .08s; }
.b-edge { position: absolute; left: -2px; top: 30px; width: 24px; height: 124px; background: linear-gradient(90deg, #C9D3DC, #fff 45%, #AEB9C4); border: 3px solid var(--navy); border-top: 0; clip-path: polygon(0 0, 100% 0, 100% 82%, 0 100%); }
.b-hilt { position: absolute; left: -4px; top: -8px; width: 16px; height: 40px; background: var(--navy); border-radius: 5px; }
.b-hilt::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--mag); box-shadow: 0 14px 0 var(--mag); }
.blade.gone { opacity: 0; }

.ends { position: absolute; left: 0; right: 0; top: 142px; display: flex; justify-content: space-between; font-family: var(--num); font-weight: 900; font-size: 16px; color: var(--navy); }
.ends span { width: 24px; margin: 0 -12px; text-align: center; }

.info { min-height: 58px; text-align: center; margin-top: 4px; opacity: 0; }
.info.on { opacity: 1; animation: fadein .2s; }
.info-err { font-size: 16px; font-weight: 900; color: var(--navy); }
.info-err.r-kami, .info-err.r-pittari { color: var(--mag-d); }
.info-why { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--sub); line-height: 1.5; }
.info-why .lm { color: var(--navy); font-weight: 900; }

/* 指の帯＝まな板 */
.pad { position: relative; margin: 6px 0 0; height: 112px; border-radius: 16px; touch-action: none; border: 4px solid var(--navy); box-shadow: 0 5px 0 var(--navy);
  background: repeating-linear-gradient(92deg, transparent 0 24px, #00000010 24px 25px, transparent 25px 57px, #ffffff40 57px 59px), linear-gradient(180deg, var(--wood1), var(--wood2)); }
.pad-mark { position: absolute; left: calc(8px + var(--k) * (100% - 16px)); top: -4px; width: 0; height: 0; border: 12px solid transparent; border-top: 16px solid var(--yellow); margin-left: -12px; filter: drop-shadow(0 2px 0 var(--navy)); }
.pad-text { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: 14px; font-weight: 900; color: #7A5A2A; pointer-events: none; }
.pad-hand { position: absolute; top: 26px; left: 12px; width: 34px; height: 46px; animation: demo 2.4s ease-in-out infinite; pointer-events: none; filter: drop-shadow(0 3px 2px #0006); }
@keyframes demo { 0% { transform: translateX(0); } 45% { transform: translateX(calc(min(480px, 100vw) * .42)); } 55% { transform: translateX(calc(min(480px, 100vw) * .42)) translateY(-10px); opacity: 0; } 70% { transform: translateX(0); opacity: 0; } 85% { opacity: 1; } }

/* 切った瞬間の字幕「スパーン!!」：白い極太字＋赤紫の縁＋濃紺の厚み。ハンコの前に消える */
.audience { position: absolute; left: -16px; right: -16px; bottom: 0; height: 104px; overflow: hidden; pointer-events: none; z-index: 3; transform: translateY(100%); transition: transform .25s ease-out; }
.audience.on { transform: none; }
.audience img { position: absolute; left: 0; top: 0; width: 100%; height: auto; }
.audience .a-clap { opacity: 0; }
.audience.clap .a-clap { opacity: 1; animation: clap .3s steps(2, start) infinite; }
.audience.clap .a-sit { opacity: 0; }
@keyframes clap { 50% { transform: translateY(-3px); } }
.caption { position: absolute; left: 0; right: 0; top: 33%; text-align: center; font-family: var(--heavy); font-weight: 900; font-size: clamp(44px, 14vw, 64px); color: var(--white); opacity: 0; pointer-events: none; z-index: 3;
  text-shadow: 4px 0 0 var(--mag), -4px 0 0 var(--mag), 0 4px 0 var(--mag), 0 -4px 0 var(--mag), 3px 3px 0 var(--mag), -3px -3px 0 var(--mag), 0 9px 0 var(--navy); transform: rotate(-6deg); }
.caption.on { animation: capt .48s ease-out forwards; }
.caption.big { font-size: clamp(52px, 17vw, 76px); }
@keyframes capt { 0% { opacity: 0; transform: rotate(-6deg) scale(1.8); } 20% { opacity: 1; transform: rotate(-6deg) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: rotate(-6deg) translateY(-20px); } }

#particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; }
.flash.on { animation: fl .14s ease-out forwards; }
@keyframes fl { 0% { opacity: .45; } 100% { opacity: 0; } }
#frame.shake { animation: sh .16s ease-out; }
@keyframes sh { 25% { transform: translate(var(--sh), calc(var(--sh) * -.5)); } 60% { transform: translate(calc(var(--sh) * -.5), calc(var(--sh) * .5)); } 100% { transform: none; } }
.edge { position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity .3s; box-shadow: inset 0 0 36px 6px var(--mag); }
html[data-streak="1"] .edge { opacity: .5; }
html[data-streak="2"] .edge { opacity: .75; box-shadow: inset 0 0 44px 8px #FF7A3D; }
html[data-streak="3"] .edge, html[data-streak="4"] .edge { opacity: .9; box-shadow: inset 0 0 50px 10px var(--mag), inset 0 0 90px 20px var(--yellow); animation: edgepulse .8s ease-in-out infinite; }
@keyframes edgepulse { 50% { opacity: .55; } }

/* ---------- 結果：本日の結果発表 ---------- */
#result { padding-bottom: 0; }
.panel { flex: 1; overflow-y: auto; margin: 52px 0 0; padding: 0 14px 16px; background: var(--white); color: var(--navy); border: 4px solid var(--navy); border-radius: 20px; box-shadow: 0 6px 0 var(--navy);
  animation: pop .35s cubic-bezier(.3, 1.5, .5, 1); -webkit-user-select: text; user-select: text; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.res-band { margin: 0 -14px; background: var(--mag); color: var(--white); text-align: center; font-weight: 900; font-size: 17px; letter-spacing: .12em; padding: 6px 0 7px; text-shadow: 0 2px 0 var(--navy); border-bottom: 4px solid var(--navy); }
.res-head { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--sub); text-align: center; }
.res-score { position: relative; text-align: center; font-family: var(--num); font-weight: 900; margin-top: 2px; }
.res-score span { font-size: 58px; line-height: 1.05; }
.res-score small { font-family: var(--gothic); font-size: 18px; margin-left: 4px; }
.rank { position: absolute; right: -2px; top: -2px; font-family: var(--heavy); font-weight: 900; font-size: 15px; color: var(--white); background: var(--mag); padding: 5px 12px; border: 3px solid var(--navy); border-radius: 999px; transform: rotate(8deg) scale(1.6); opacity: 0; box-shadow: 0 3px 0 var(--navy); white-space: nowrap; }
.rank.on { opacity: 1; transform: rotate(8deg); transition: transform .22s cubic-bezier(.2, 1.6, .5, 1), opacity .1s; }
/* 審査員の札：札を下げた絵 → 上げた絵に差し替え、点数を札の白い所に重ねる */
.judges { position: relative; width: min(330px, 100%); margin: 4px auto 0; aspect-ratio: 720 / 281; }
.judges img { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .12s; }
.judges .j-up { opacity: 0; }
.judges.up .j-up { opacity: 1; }
.judges.up .j-down { opacity: 0; }
.jn { position: absolute; display: grid; place-items: center; font-family: var(--num); font-weight: 900; font-size: clamp(22px, 7vw, 30px); color: var(--navy); opacity: 0; transform: scale(1.8); }
.jn.on { opacity: 1; transform: none; transition: transform .2s cubic-bezier(.2, 1.6, .5, 1), opacity .1s; }
.j1 { left: 9.1%; top: 58.5%; width: 15.6%; height: 28.4%; }
.j2 { left: 40.5%; top: 56.9%; width: 16.2%; height: 29.5%; }
.j3 { left: 82.4%; top: 52.6%; width: 13.1%; height: 26.6%; }
.j-labels { display: flex; justify-content: space-between; width: min(330px, 100%); margin: 0 auto 2px; font-size: 11px; font-weight: 900; color: var(--sub); }
.j-labels span { width: 33%; text-align: center; }
.j-labels span:first-child { text-align: left; padding-left: 2%; }
.j-labels span:last-child { text-align: right; padding-right: 1%; }
.res-best { text-align: center; font-size: 14px; font-weight: 900; color: var(--sub); margin-top: 2px; }
.res-best.new { color: var(--mag-d); font-size: 16px; }
.res-rating { text-align: center; font-size: 12px; font-weight: 700; color: var(--sub); }
.bestcut { margin: 8px 0 6px; padding: 8px 10px 10px; border: 3px solid var(--navy); border-radius: 12px; background: #FFF8E0; }
.bc-title { font-weight: 900; font-size: 15px; color: var(--mag-d); text-align: center; letter-spacing: .1em; }
.bc-yokan { position: relative; height: 30px; margin: 10px 4px 4px; }
.bc-l, .bc-r { position: absolute; top: 0; bottom: 0; background: linear-gradient(180deg, var(--yk-gloss) 0 8%, var(--yk) 35%, var(--yk-rim)); border: 2px solid var(--navy); }
.bc-l { left: 0; border-radius: 6px 0 0 6px; }
.bc-r { right: 0; border-radius: 0 6px 6px 0; transform: translate(3px, 3px) rotate(2deg); transform-origin: left bottom; }
.bc-ans { position: absolute; top: -8px; bottom: -8px; border-left: 2px dashed var(--navy); }
.bc-text { text-align: center; font-size: 15px; font-weight: 700; }
.bc-text b { font-family: var(--num); font-size: 20px; }
.res-stats { list-style: none; margin: 8px 0 6px; padding: 0; font-size: 14px; line-height: 1.75; font-weight: 700; }
.res-stats li { border-bottom: 1px dashed #1B234033; }
.slices { display: grid; gap: 3px; margin: 8px 0; }
.sl { display: grid; grid-template-columns: 52px 1fr 60px; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.sl-q { font-family: var(--num); text-align: right; }
.sl-bar { height: 9px; background: #1B234014; border-radius: 5px; overflow: hidden; }
.sl-bar i { display: block; height: 100%; border-radius: 5px; background: var(--r-miss); }
.sl.r-kami .sl-bar i { background: var(--r-kami); } .sl.r-pittari .sl-bar i { background: var(--r-pittari); } .sl.r-great .sl-bar i { background: var(--r-great); } .sl.r-good .sl-bar i { background: var(--r-good); }
.sl-e { color: var(--sub); }
.r-kami { color: #C98A00; } .r-pittari { color: var(--mag-d); }
.res-hint { margin: 8px 0; padding: 8px 10px; background: #E9F8FF; border: 2px solid var(--navy); border-radius: 10px; font-size: 14px; font-weight: 900; }
.card { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 10px; border: 2px dashed var(--navy); border-radius: 10px; }
.card-text { font-size: 13px; line-height: 1.5; word-break: break-all; font-weight: 700; }
.copy { align-self: flex-end; appearance: none; border: 3px solid var(--navy); background: var(--white); color: var(--navy); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 900; }
.res-note { font-size: 12px; color: var(--sub); margin: 8px 0 0; }
.res-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0 calc(var(--sab) + 10px); }
.res-foot .go { margin: 0; }
.again { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 6px 0 var(--navy), 0 0 0 8px #FFD23A66; } }
.totitle { appearance: none; border: 0; background: transparent; color: var(--navy); font-size: 13px; font-weight: 700; padding: 6px 12px; }

/* 背の低い画面：お題札・ようかん・まな板を詰める（重ならないように） */
@media (max-height: 740px) {
  .fuda { min-height: 160px; width: 166px; }
  .frac { font-size: 46px; }
  .fuda-q .num { font-size: 56px; }
  .stampbox { top: calc(100% + 6px); }
  .stage { margin-top: 20px; height: 150px; }
  .yokan { top: 34px; height: 84px; }
  .ends { top: 124px; }
  .blade { height: 150px; }
  .b-edge { height: 108px; }
  .pad { height: 92px; }
  .info { min-height: 52px; }
  .counter { margin-top: 12px; transform: scale(.9); }
}
@media (max-height: 600px) {
  .hud { height: 32px; }
  .dots { gap: 3px; }
  .dots li { width: 10px; height: 10px; }
  .rating { font-size: 13px; }
  .fuda { min-height: 118px; width: 140px; margin-top: -2px; }
  .fuda-ask { font-size: 12px; padding: 3px 0 4px; }
  .frac { font-size: 34px; }
  .frac span:first-child { border-bottom-width: 4px; padding: 0 8px 2px; }
  .fuda-q .num { font-size: 42px; }
  .stamp b { font-size: 26px; }
  .stampbox { top: calc(100% - 50px); } /* 札と道具の間が無いので、答えた後の札の下側に重ねる */
  .tools { min-height: 34px; }
  .hintbtn { padding: 5px 10px; font-size: 12px; }
  .stage { margin-top: 16px; height: 124px; }
  .yokan { top: 28px; height: 66px; }
  .ends { top: 98px; font-size: 14px; }
  .blade { height: 118px; top: -8px; }
  .b-edge { top: 22px; height: 86px; }
  .info { min-height: 46px; }
  .info-err { font-size: 14px; }
  .info-why { font-size: 12px; margin-top: 2px; }
  .pad { height: 74px; }
  .logo { height: 130px; }
  .lg-main { font-size: 62px; }
  .counter { margin: 4px 0 -6px; transform: scale(.78); }
}

/* 背の低い画面：観客は低く、横向き（高さ450以下）では出さない。タイトルは調理台の絵を省いて「はじめる」を画面に入れる */
@media (max-height: 600px) { .audience { height: 58px; } }
@media (max-height: 450px) {
  .audience { display: none; } .counter { display: none; } .title-main { padding-top: 48px; gap: 4px; }
  .logo { margin-bottom: 18px; }
  .res-score span { font-size: 40px; } .res-head { margin-top: 4px; }
  .judges, .j-labels { width: min(250px, 100%); }
  .lead { font-size: 14px; line-height: 1.5; margin-top: 0; } .lead b { font-size: 15px; }
  .go { padding: 9px 0; font-size: 20px; margin-top: 4px; }
  .fuda { min-height: 84px; width: 120px; } .fuda-q .num { font-size: 34px; } .frac { font-size: 28px; }
  .frac span:first-child { border-bottom-width: 3px; padding: 0 6px 1px; } .frac span:last-child { padding-top: 2px; }
  .tools { padding-top: 0; }
  .stage { margin-top: 12px; height: 100px; } .yokan { top: 22px; height: 50px; } .ends { top: 76px; }
  .blade { height: 96px; top: -6px; } .b-edge { top: 18px; height: 70px; }
  .info { min-height: 36px; margin-top: 0; } .info-why { margin-top: 0; }
  .pad { height: 52px; }
}

/* 動きを減らす：揺れ・光・大きな拡大・回る背景を止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spot, .edge, .flash, .rays, .streak { display: none; }
  .audience { transition: none; }
}
