:root { --ink: #f3f5f8; --dim: #9aa6b6; --accent: #4cc9ff; --warn: #ffcf3a; --bad: #ff5b4f; --panel: rgba(12, 17, 27, 0.86); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1320; color: var(--ink); font-family: "Zen Maru Gothic", system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; }

/* ---- 遊んでいる最中の画面（2026-11-16 磨き込み） ---- */
/* 上：暗いカプセルに載せて、昼・屋内の明るい背景でも読める。左上と右上の丸はタイトルの音・ベルと同じ形 */
body { --top: max(10px, env(safe-area-inset-top)); --bot: max(14px, env(safe-area-inset-bottom)); --cap: rgba(9,13,21,.7); --capLine: rgba(255,255,255,.11); --go: #5ad88c; }
#hud { position: fixed; top: var(--top); left: 12px; right: 12px; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; }
/* 上の端をうっすら暗く（カプセルの外の地面の明るさを抑える） */
#hud::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: calc(var(--top) + 84px); z-index: -1; background: linear-gradient(rgba(4,7,12,.55), rgba(4,7,12,0)); }
.hcap { background: var(--cap); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--capLine), 0 4px 14px rgba(0,0,0,.25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hud-left { flex: 0 1 auto; margin-right: auto; min-width: 0; padding: 6px 12px 7px; display: flex; flex-direction: column; gap: 3px; }
.hud-left b { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 15px; font-weight: 900; line-height: 1.2; letter-spacing: .03em; }
.hud-left b .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 何台目か：タイトルのタブと同じ点。済み＝黄、いま＝水色 */
.hud-left .pips { flex: none; display: flex; gap: 3px; margin-left: 3px; }
.hud-left .pips b { display: block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.2); }
.hud-left .pips b.past { background: var(--warn); }
.hud-left .pips b.on { background: var(--accent); box-shadow: 0 0 6px rgba(76,201,255,.8); }
.hud-left small { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 11.5px; font-weight: 700; line-height: 1.2; color: #c6d1de; white-space: nowrap; }
.hud-left small span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hud-left small svg { flex: none; width: 13px; height: 13px; color: var(--warn); }
.hud-left small svg.th-night, .hud-left small svg.th-rain { color: #9fc4ff; }
.hud-left small svg.th-indoor { color: #c6d1de; }
.hud-left small svg.th-evening { color: #ffa65c; }
/* 中央：切り返し（大きく）／目安、その下に秒 */
.hud-mid { flex: none; padding: 5px 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-variant-numeric: tabular-nums; }
.hm-sw { display: flex; align-items: center; gap: 4px; line-height: 1; transition: color .25s; }
.hm-sw svg { width: 17px; height: 17px; color: var(--accent); transition: color .25s; }
.hm-sw b { font-size: 23px; font-weight: 900; }
.hm-sw small { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.5); }
.hm-time { display: flex; align-items: baseline; gap: 1px; color: #c6d1de; line-height: 1.1; }
.hm-time b { font-size: 13px; font-weight: 700; } .hm-time small { font-size: 10px; }
/* 目安を超えた：数字と絵が赤、カプセルに赤い縁 */
.hud-mid:has(.hm-sw.over) { box-shadow: inset 0 0 0 1.5px rgba(255,91,79,.75), 0 4px 14px rgba(0,0,0,.25); }
.hm-sw.over, .hm-sw.over svg { color: var(--bad); }
.hm-sw.over small { color: rgba(255,140,130,.8); }
.hm-sw.kick b { animation: numKick .5s cubic-bezier(.2,1.8,.4,1); }
@keyframes numKick { 0% { transform: scale(1); } 35% { transform: scale(1.5); color: var(--warn); } 100% { transform: scale(1); } }
.hm-sw b { display: inline-block; }
/* 右：修理代。増えた瞬間に揺れて赤く光る */
.hud-right { flex: none; margin-left: auto; display: flex; align-items: center; gap: 5px; padding: 9px 11px; font-variant-numeric: tabular-nums; transition: background .3s; }
.hud-right svg { width: 14px; height: 14px; color: rgba(255,255,255,.5); }
.hud-right b { font-size: 18px; font-weight: 900; line-height: 1; white-space: nowrap; color: #e9eef4; }
.hud-right.hurt { background: rgba(48,10,10,.74); box-shadow: inset 0 0 0 1.5px rgba(255,91,79,.6), 0 4px 14px rgba(0,0,0,.25); }
.hud-right.hurt b, .hud-right.hurt svg { color: #ff7a6e; }
.hud-right.kick { animation: costHit .55s cubic-bezier(.3,.7,.3,1); }
@keyframes costHit { 0% { transform: translateX(0) scale(1); } 12% { transform: translateX(-6px) scale(1.14); background: rgba(255,91,79,.85); } 28% { transform: translateX(5px) scale(1.1); } 44% { transform: translateX(-3px) scale(1.04); } 60% { transform: translateX(2px); } 100% { transform: none; } }

/* 丸ボタン：左上＝やり直す・やめる、右上＝視点 */
.chip { position: fixed; font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 999px; background: var(--cap); box-shadow: inset 0 0 0 1px var(--capLine), 0 4px 12px rgba(0,0,0,.3); color: #e6edf5; transition: transform .12s, background .2s, opacity .2s; }
.chip:active { transform: scale(.92); background: rgba(76,201,255,.28); }
.chip.rnd { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.chip.rnd svg { width: 22px; height: 22px; pointer-events: none; }
.chip.rnd:active { transform: scale(.88); }
/* 押せる範囲は見た目より一回り広く（前のチップより狭くしない） */
.chip.rnd::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; }
#restartBtn { left: 12px; top: calc(var(--top) + 62px); }
#quitBtn { left: 12px; top: calc(var(--top) + 116px); color: #b9c4d1; }
#quitBtn svg { width: 18px; height: 18px; }
#viewBtn { right: 12px; top: calc(var(--top) + 62px); }
#viewBtn svg { display: none; margin-top: -5px; }
body[data-view="chase"] #viewBtn .v-chase, body[data-view="top"] #viewBtn .v-top, body[data-view="driver"] #viewBtn .v-driver { display: block; }
#viewBtn .vdots { position: absolute; left: 0; right: 0; bottom: 7px; display: flex; justify-content: center; gap: 3px; }
#viewBtn .vdots b { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.25); transition: background .2s; }
body[data-view="chase"] #viewBtn .vdots b:nth-child(1), body[data-view="top"] #viewBtn .vdots b:nth-child(2), body[data-view="driver"] #viewBtn .vdots b:nth-child(3) { background: var(--accent); box-shadow: 0 0 4px rgba(76,201,255,.8); }
body[data-phase="door"] #restartBtn, body[data-phase="door"] #quitBtn { display: none; }
body:not([data-screen="play"]) #hud, body:not([data-screen="play"]) #controls, body:not([data-screen="play"]) .chip:not(#closeBtn), body:not([data-screen="play"]) #hint, body:not([data-screen="play"]) #goalMark { display: none !important; }

/* ヒント：上から見た小さな図（2026-11-17 文章→図。src/tips.js）。左右の丸のあいだ、上の帯の下。押せない */
#hint { position: fixed; top: calc(var(--top) + 60px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 7px; border-radius: 16px; background: rgba(9,13,21,.84); box-shadow: inset 0 0 0 1px rgba(76,201,255,.3), 0 4px 14px rgba(0,0,0,.3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .6s, transform .6s; pointer-events: none; animation: hintIn .45s cubic-bezier(.2,.8,.3,1); }
#hint:empty { display: none; }
#hint.gone { opacity: 0; transform: translate(-50%, -8px); }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, -8px); } }
#hint .tipFig { display: block; width: 108px; height: 86px; overflow: visible; transition: transform .3s; }
/* 真上の視点は北が上：図を始めの向きに合わせて回す（--tipRot・--tipSc は main.js の start） */
body[data-view="top"] #hint .tipFig { transform: rotate(var(--tipRot, 0deg)) scale(var(--tipSc, 1)); }
/* 短い札（図にできない中身だけ） */
#hint .tag { font-size: 11.5px; font-weight: 900; line-height: 1; color: var(--warn); padding: 3px 9px 4px; border-radius: 99px; background: rgba(255,207,58,.13); white-space: nowrap; }
/* 図の部品：線は白の濃淡、停まっている車は灰、危ない所は赤、入れる所は水色の枠、出口は緑。前へ＝水色、後ろへ＝黄 */
.tipFig path, .tipFig rect, .tipFig circle { fill: none; stroke: none; }
.tipFig .walk { fill: rgba(255,255,255,.07); }
.tipFig .house { fill: rgba(255,255,255,.06); }
.tipFig .edge, .tipFig .sline { stroke: rgba(255,255,255,.42); stroke-width: 1.3; }
.tipFig .wall { stroke: rgba(222,230,240,.72); stroke-width: 2.6; stroke-linecap: square; }
.tipFig .fence { stroke: rgba(255,255,255,.32); stroke-width: 1.4; stroke-dasharray: 3 2; }
.tipFig .yline { stroke: rgba(232,185,35,.7); stroke-width: 1.6; }
.tipFig .dash { stroke: rgba(255,255,255,.28); stroke-width: 1.2; stroke-dasharray: 5 4; }
.tipFig .curb { stroke: rgba(255,255,255,.62); stroke-width: 2.2; }
.tipFig .hzl { stroke: var(--bad); stroke-width: 2.8; }
.tipFig .pallet { fill: rgba(255,255,255,.07); stroke: rgba(255,255,255,.28); stroke-width: 1; }
.tipFig .park rect { fill: rgba(150,162,178,.42); } .tipFig .park .ws { fill: rgba(16,22,32,.55); }
.tipFig .bad rect { fill: rgba(255,91,79,.3); stroke: var(--bad); stroke-width: 1.4; } .tipFig .bad .ws { fill: rgba(70,12,10,.6); stroke: none; }
.tipFig .hz { fill: var(--bad); stroke: rgba(255,210,205,.9); stroke-width: 1; }
.tipFig .prop { fill: rgba(205,212,222,.55); }
.tipFig .goal { fill: rgba(76,201,255,.13); stroke: var(--accent); stroke-width: 1.5; }
.tipFig .ghost rect { stroke: rgba(76,201,255,.85); stroke-width: 1.2; stroke-dasharray: 2.4 1.8; } .tipFig .ghost .ws { display: none; }
.tipFig .room { fill: rgba(90,216,140,.28); }
.tipFig .door { stroke: var(--go); stroke-width: 2.2; stroke-linecap: round; }
.tipFig .pf, .tipFig .pb { stroke-width: 2.3; stroke-linecap: round; opacity: .9; }
.tipFig .pf { stroke: var(--accent); } .tipFig .pb { stroke: var(--warn); }
.tipFig .pfh { fill: var(--accent); } .tipFig .pbh { fill: var(--warn); }
.tipFig .me0 rect { fill: rgba(238,243,248,.22); } .tipFig .me0 .ws { fill: rgba(16,22,32,.4); }
.tipFig .me rect { fill: #eef3f8; } .tipFig .me .ws { fill: #26303e; }
.tipFig .exitL { stroke: var(--go); stroke-width: 2; stroke-dasharray: 4 3; }
.tipFig .exitI { color: var(--go); } .tipFig .exitI path { stroke: currentColor; }
/* 目的地の向き：画面の端の丸。中に P（出庫は出口の印）、外側の三角が目的地を指す。位置と向きは main.js */
#goalMark { position: fixed; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); background: rgba(9,13,21,.74); box-shadow: inset 0 0 0 2px rgba(76,201,255,.85), 0 0 12px rgba(76,201,255,.3), 0 4px 12px rgba(0,0,0,.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); pointer-events: none; transition: opacity .3s; will-change: transform; animation: gmGlow 1.8s ease-in-out infinite; }
#goalMark[hidden] { display: none; }
#goalMark.off { opacity: 0; }
@keyframes gmGlow { 50% { box-shadow: inset 0 0 0 2px rgba(76,201,255,1), 0 0 20px rgba(76,201,255,.55), 0 4px 12px rgba(0,0,0,.35); } }
#goalMark .gmP { font: 900 21px/1 "Zen Maru Gothic", system-ui, sans-serif; margin-top: -1px; }
#goalMark .gmExit { display: none; width: 22px; height: 22px; }
#goalMark.exit { color: var(--go); box-shadow: inset 0 0 0 2px rgba(90,216,140,.85), 0 0 12px rgba(90,216,140,.3), 0 4px 12px rgba(0,0,0,.35); animation-name: gmGlowX; }
@keyframes gmGlowX { 50% { box-shadow: inset 0 0 0 2px rgba(90,216,140,1), 0 0 20px rgba(90,216,140,.55), 0 4px 12px rgba(0,0,0,.35); } }
#goalMark.exit .gmP { display: none; } #goalMark.exit .gmExit { display: block; }
#goalMark .gmRot { position: absolute; inset: 0; }
#goalMark .gmRot i { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -7px 0 0 21px; border-left: 10px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; filter: drop-shadow(0 0 3px rgba(0,0,0,.7)); animation: gmNudge 1.8s ease-in-out infinite; }
@keyframes gmNudge { 50% { transform: translateX(3px); } }
/* バックモニター：枠をつけて画面から浮かせる（位置と大きさは main.js が world.monRect から入れる） */
#monLabel { position: fixed; pointer-events: none; border-radius: 6px; box-shadow: 0 0 0 3px rgba(9,13,21,.9), 0 0 0 4px rgba(255,255,255,.22), 0 10px 24px rgba(0,0,0,.45); }
#monLabel[hidden] { display: none; }
#monLabel span { position: absolute; left: 6px; top: 6px; display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: #e6f4ff; background: rgba(0,0,0,.6); padding: 2px 8px 2px 6px; border-radius: 6px; }
#monLabel i { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); animation: rec 1.2s steps(2, jump-none) infinite; }
@keyframes rec { 50% { opacity: .25; } }
/* ぶつけたときの文字：長い明細は折り返して画面からはみ出さない */
#popups { position: fixed; inset: 0; pointer-events: none; }
.pop { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); text-align: center; font-size: 30px; font-weight: 900; color: var(--bad); text-shadow: 0 3px 0 #000, 0 0 12px rgba(0,0,0,.6); white-space: nowrap; animation: pop 1.6s ease-out forwards; }
.pop small { display: block; margin-top: 4px; font-size: 14px; line-height: 1.4; color: #fff; white-space: normal; background: rgba(9,13,21,.72); padding: 4px 12px; border-radius: 10px; text-shadow: none; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -24px); } }

/* ---- 操作：下の左にハンドル、右に前へ／後ろへ ---- */
#controls { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 12px var(--bot); display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none; }
.wheelCol { position: relative; flex: 1; max-width: 380px; }
#wheelPad { position: relative; height: 120px; pointer-events: auto; touch-action: none; --s: 0; }
#wheelPad .track { position: absolute; left: 0; right: 0; top: 50%; height: 12px; margin-top: -6px; border-radius: 99px; background: rgba(9,13,21,.62); box-shadow: inset 0 0 0 1px var(--capLine), 0 2px 8px rgba(0,0,0,.3); overflow: hidden; }
/* 切った向きへ水色が伸びる（s＞0 が左） */
#wheelPad .fill { position: absolute; top: 0; bottom: 0; width: 50%; }
#wheelPad .fill.l { right: 50%; transform-origin: 100% 50%; transform: scaleX(clamp(0, var(--s), 1)); background: linear-gradient(90deg, #8be0ff, rgba(76,201,255,.35)); }
#wheelPad .fill.r { left: 50%; transform-origin: 0 50%; transform: scaleX(clamp(0, calc(var(--s) * -1), 1)); background: linear-gradient(270deg, #8be0ff, rgba(76,201,255,.35)); }
#wheelPad.lock .fill { background: var(--warn); }
#wheelPad .tick { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(255,255,255,.55); }
#wheelPad .chev { position: absolute; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: rgba(255,255,255,.5); pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
#wheelPad .chev.l { left: 2px; } #wheelPad .chev.r { right: 2px; }
#knob { position: absolute; top: 50%; left: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; color: #eef2f7; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #2c3749, #121822 70%); box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 0 0 2px rgba(255,255,255,.14); transition: box-shadow .2s; }
#knob svg { width: 100%; height: 100%; padding: 7px; display: block; }
#knob .mark { stroke: var(--warn); }
#wheelPad.grab #knob { box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 0 0 2px var(--accent), 0 0 18px rgba(76,201,255,.45); }
#wheelPad.lock #knob .mark { stroke: var(--bad); }
/* ハンドルを戻す：ハンドルの真上。まっすぐのときは薄く */
#centerBtn { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 112px; min-height: 36px; padding: 6px 14px 6px 10px; font-size: 12.5px; pointer-events: auto; white-space: nowrap; }
#centerBtn svg { width: 15px; height: 15px; color: var(--accent); }
#centerBtn:active { transform: translateX(-50%) scale(.92); }
#centerBtn.idle { opacity: .5; }
/* 前へ＝水色・上向きの矢印、後ろへ＝黄・下向きの矢印。押している間は沈んで光る */
.pedals { display: flex; flex-direction: column; gap: 12px; pointer-events: auto; }
.pedal { position: relative; width: 104px; height: 76px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 16px; font-weight: 900; letter-spacing: .04em; touch-action: none; transition: transform .06s, box-shadow .06s, filter .1s; }
.pedal svg { width: 30px; height: 30px; pointer-events: none; }
.pedal span { pointer-events: none; line-height: 1.1; }
.pedal.fwd { color: #04121c; background: linear-gradient(#78dbff, #2ea9e6); box-shadow: 0 5px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55), 0 8px 18px rgba(0,0,0,.35); }
.pedal.back { color: #2a1700; background: linear-gradient(#ffe07a, #f0a92a); box-shadow: 0 5px 0 #8a5608, inset 0 1px 0 rgba(255,255,255,.55), 0 8px 18px rgba(0,0,0,.35); }
.pedal.on { transform: translateY(4px) scale(.97); filter: brightness(1.1); }
.pedal.fwd.on { box-shadow: 0 1px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55), 0 0 22px 2px rgba(76,201,255,.75); }
.pedal.back.on { box-shadow: 0 1px 0 #8a5608, inset 0 1px 0 rgba(255,255,255,.55), 0 0 22px 2px rgba(255,200,60,.75); }

/* ---- 停まったら：ドアを開ける ---- */
#doorBar { position: fixed; left: 50%; bottom: calc(var(--bot) + 172px); transform: translateX(-50%); animation: barIn .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes barIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.9); } }
.act { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; font-size: 18px; font-weight: 900; padding: 14px 22px; border-radius: 18px; background: linear-gradient(#3f7bbd, #25508a); box-shadow: 0 5px 0 #0f2a4f, inset 0 1px 0 rgba(255,255,255,.3); touch-action: none; transition: transform .06s, box-shadow .06s, filter .15s, opacity .2s; }
.act svg { width: 22px; height: 22px; flex: none; pointer-events: none; }
.act:active, .act.on { transform: translateY(4px); box-shadow: 0 1px 0 #0f2a4f, inset 0 1px 0 rgba(255,255,255,.3); }
.act.go { background: linear-gradient(#5ad88c, #279a57); color: #04170b; box-shadow: 0 5px 0 #0f4a26, inset 0 1px 0 rgba(255,255,255,.45); }
.act.go:active { box-shadow: 0 1px 0 #0f4a26; }
.act:disabled { opacity: .35; filter: saturate(.3); }
/* 「ドアを開ける」：次にやること。水色が息をする */
#doorOpenBtn { color: #04121c; background: linear-gradient(#78dbff, #2ea9e6); box-shadow: 0 5px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55); animation: doorGlow 1.4s ease-in-out infinite; padding: 15px 26px; }
#doorOpenBtn svg { color: #04121c; }
#doorOpenBtn:active { box-shadow: 0 1px 0 #0f5a85; }
@keyframes doorGlow { 50% { box-shadow: 0 5px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55), 0 0 0 6px rgba(76,201,255,.25), 0 0 26px rgba(76,201,255,.6); } }

/* ---- ドアのパネル：開いた幅を目盛りで見せる ---- */
#doorPanel { position: fixed; left: 50%; bottom: var(--bot); transform: translateX(-50%); width: min(480px, calc(100% - 24px)); padding: 12px 14px 12px; border-radius: 22px; background: rgba(9,13,21,.93); box-shadow: inset 0 0 0 1px var(--capLine), 0 10px 30px rgba(0,0,0,.45); text-align: center; animation: panelIn .35s cubic-bezier(.2,.9,.3,1); }
#doorPanel[hidden] { display: none; }
@keyframes panelIn { from { opacity: 0; transform: translate(-50%, 24px); } }
.gauge { --p35: 35%; --p60: 60%; --pw: 0%; --pg: 100%; display: flex; align-items: flex-end; gap: 12px; margin: 0 2px 14px; }
.gVal { flex: none; min-width: 80px; text-align: right; font-size: 32px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--bad); transition: color .2s; }
.gVal small { font-size: 13px; margin-left: 2px; color: rgba(255,255,255,.55); }
.gauge[data-st="yel"] .gVal { color: var(--warn); } .gauge[data-st="grn"] .gVal { color: var(--go); }
.gTrack { position: relative; flex: 1; padding-top: 30px; }
.gBar { position: relative; height: 16px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.gBar .z { position: absolute; top: 0; bottom: 0; }
.gBar .z1 { left: 0; width: var(--p35); background: rgba(255,91,79,.2); }
.gBar .z2 { left: var(--p35); width: calc(var(--p60) - var(--p35)); background: rgba(255,207,58,.2); }
.gBar .z3 { left: var(--p60); right: 0; background: rgba(90,216,140,.2); }
.gFill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pw); border-radius: 99px; background: var(--bad); box-shadow: 0 0 10px rgba(255,91,79,.6); transition: width .06s linear, background .2s; }
.gauge[data-st="yel"] .gFill { background: var(--warn); box-shadow: 0 0 10px rgba(255,207,58,.6); }
.gauge[data-st="grn"] .gFill { background: var(--go); box-shadow: 0 0 10px rgba(90,216,140,.6); }
/* 押す勢いが強すぎる（このままだと隣にドアパンチ）：赤く点滅 */
.gauge.fast .gFill { background: var(--bad); animation: fastBlink .18s steps(2, jump-none) infinite; }
@keyframes fastBlink { 50% { opacity: .45; } }
/* 斜線：そこから先は開かない。隣の車に当たるときは赤い縁 */
.gWall { position: absolute; top: 0; bottom: 0; left: var(--pg); right: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.3) 0 3px, rgba(255,255,255,0) 3px 7px); border-left: 3px solid rgba(220,228,238,.75); }
.gauge.hard .gWall { background: repeating-linear-gradient(135deg, rgba(255,91,79,.5) 0 3px, rgba(255,91,79,0) 3px 7px); border-left-color: var(--bad); }
/* 人の印：細い人＝体を細くすれば降りられる幅、ふつうの人＝ふつうに降りられる幅。届くと光る */
.gMark { position: absolute; top: 0; width: 24px; height: 26px; margin-left: -12px; color: rgba(255,255,255,.28); transition: color .2s, transform .25s cubic-bezier(.2,1.8,.4,1); }
.gMark::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 2px; height: 6px; margin-left: -1px; background: currentColor; }
.gMark svg { width: 24px; height: 24px; display: block; }
#gM35 { left: var(--p35); } #gM60 { left: var(--p60); }
#gM35.got { color: var(--warn); transform: scale(1.15); } #gM60.got { color: var(--go); transform: scale(1.15); }
#doorPanel .row { display: flex; gap: 10px; justify-content: center; }
#doorPanel .row .act { flex: 1; max-width: 210px; padding: 14px 10px; }
/* 降りるボタンも幅の色に合わせる */
#exitBtn.low { background: linear-gradient(#5b6676, #3b4452); color: #d6dde6; box-shadow: 0 5px 0 #1d232c; }
#exitBtn.sq { background: linear-gradient(#ffe07a, #f0a92a); color: #2a1700; box-shadow: 0 5px 0 #8a5608, inset 0 1px 0 rgba(255,255,255,.5); }
#closeBtn { position: static; display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; min-height: 36px; padding: 7px 14px 7px 11px; }
#closeBtn svg { width: 16px; height: 16px; }
/* 隣が近すぎて降りられない：閉めてやり直すを光らせる */
#doorPanel.stuck #closeBtn { color: #04121c; background: var(--accent); animation: doorGlow 1.4s ease-in-out infinite; }
body[data-screen="play"][data-phase="door"] #controls { display: none; }

/* 小さい画面（iPhone SE）：字と前へ／後ろへを少し詰める */
@media (max-width: 360px) {
  #hud { left: 8px; right: 8px; gap: 6px; }
  .hud-left { padding: 5px 10px 6px; } .hud-left b { font-size: 13.5px; gap: 5px; } .hud-left small { font-size: 10.5px; }
  .hud-mid { padding: 5px 10px; } .hm-sw b { font-size: 21px; }
  .hud-right { padding: 8px 10px; gap: 4px; } .hud-right b { font-size: 16px; } .hud-right svg { width: 13px; height: 13px; }
  #restartBtn, #quitBtn { left: 8px; } #viewBtn { right: 8px; }
  .pedal { width: 96px; height: 70px; }
  .gVal { min-width: 70px; font-size: 28px; }
  #doorPanel .row .act { font-size: 15px; gap: 5px; padding: 14px 8px; } #doorPanel .row .act svg { width: 18px; height: 18px; }
}
/* PC：上の帯を少し大きく */
@media (min-width: 720px) and (min-height: 600px) {
  #hud { left: 18px; right: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); } .hud-left { justify-self: start; max-width: 100%; } .hud-right { justify-self: end; }
  .hud-left { padding: 8px 16px 9px; } .hud-left b { font-size: 18px; } .hud-left small { font-size: 13px; } .hud-left small svg { width: 15px; height: 15px; }
  .hud-mid { padding: 6px 18px 7px; } .hm-sw b { font-size: 27px; } .hm-sw svg { width: 20px; height: 20px; } .hm-time b { font-size: 14px; }
  .hud-right { padding: 12px 18px; } .hud-right b { font-size: 23px; } .hud-right svg { width: 19px; height: 19px; }
  #restartBtn, #quitBtn { left: 18px; } #viewBtn { right: 18px; }
  #restartBtn, #viewBtn { top: calc(var(--top) + 74px); } #quitBtn { top: calc(var(--top) + 128px); }
  #hint { top: calc(var(--top) + 72px); } #hint .tipFig { width: 120px; height: 96px; } #hint .tag { font-size: 12.5px; }
}

/* ---- パネル ---- */
.panel { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; padding: 24px 16px; text-align: center; background: radial-gradient(ellipse at 50% 30%, rgba(13,19,32,.55), rgba(8,11,18,.92)); overflow-y: auto; }
.panel[hidden] { display: none; }
.kicker { margin: 0 0 6px; color: var(--accent); font-size: 14px; }
h1 { margin: 0; font-size: clamp(38px, 11vw, 64px); letter-spacing: .04em; text-shadow: 0 4px 0 #000; }
h1 span { font-size: .4em; color: var(--dim); }
.lead { max-width: 420px; color: #d8e0ea; font-size: 15px; line-height: 1.7; }
.opts { display: flex; gap: 8px; }
.opt { font-size: 14px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.note { color: var(--dim); font-size: 12px; margin-top: 14px; }


/* 運転席の視点：計器盤の帯 */
#dash { display: none; }
body[data-screen="play"][data-view="driver"] #dash { display: block; position: fixed; left: 0; right: 0; bottom: 0; height: 30%; pointer-events: none;
  background: linear-gradient(transparent, rgba(14,16,20,.92) 18%, #121418 60%); border-top-left-radius: 50% 40px; border-top-right-radius: 50% 40px; }

/* マウスとキーボードの端末では、タッチ用の操作を隠す */
@media (hover: hover) and (pointer: fine) {
  #controls, #centerBtn { display: none !important; }
}


.pop.good { color: #8ff0b0; }

/* ---- タイトル：ショールーム ---- */
/* 上から：題名 → 回転台（車）→ 車名・難しさ・寸法 → 車のタブ → ステージのカード。カードは指の届く下に寄せる */
#title { --gold: #ffd36a; --line: rgba(255,255,255,.12);
  background: linear-gradient(rgba(6,9,15,.7), rgba(6,9,15,0) 22%, rgba(6,9,15,0) 48%, rgba(6,9,15,.78) 64%, rgba(6,9,15,.96) 80%);
  justify-content: flex-start; padding: max(14px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); }
#title > * { flex-shrink: 0; }
#title > #carStage { flex-shrink: 1; }
.tHead { padding: 0 44px; }
.tHead .kicker { margin: 0 0 2px; font-size: clamp(10px, 3.1vw, 13px); letter-spacing: .08em; white-space: nowrap; color: rgba(140,214,255,.85); }
.tHead h1 { font-size: clamp(30px, 9vw, 50px); line-height: 1.1; letter-spacing: .08em; font-weight: 900;
  background: linear-gradient(#ffffff 30%, #c6dcf2); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.85)) drop-shadow(0 0 18px rgba(76,201,255,.25)); }
/* 左上の音・右上のベル：同じ丸 */
.tMute, .tBell { position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--line); color: #dfe8f2; transition: transform .12s, background .2s; }
.tMute { left: max(12px, env(safe-area-inset-left)); }
.tBell { right: max(12px, env(safe-area-inset-right)); }
.tMute svg { width: 22px; height: 22px; }
.tMute .x { display: none; } .tMute.off { color: var(--dim); } .tMute.off .w { display: none; } .tMute.off .x { display: inline; }
.tMute:active, .tBell:active { transform: scale(.9); }
/* 回転台：車はこの四角（矢印のぶんを除く）に収まるよう showroom.js がカメラを合わせる */
#carStage { position: relative; flex: 1; width: 100%; max-width: 640px; min-height: 130px; touch-action: none; cursor: grab; }
#carStage:active { cursor: grabbing; }
.navArrow { position: absolute; top: 50%; width: 40px; height: 40px; margin-top: -20px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px var(--line), 0 4px 12px rgba(0,0,0,.4); color: #dfe8f2; transition: transform .12s, background .2s; }
.navArrow svg { width: 22px; height: 22px; }
.navArrow:active { transform: scale(.88); background: rgba(76,201,255,.22); }
#prevCar { left: 0; } #nextCar { right: 0; }
/* 車名・難しさ・寸法 */
.carInfo { margin-top: 2px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.carInfo h2 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: .08em; font-weight: 900; text-shadow: 0 2px 0 #000, 0 0 14px rgba(0,0,0,.6); }
.carInfo .stars:empty { display: none; }
.carInfo .stars { display: flex; gap: 2px; font-size: 13px; line-height: 1; min-height: 13px; }
.carInfo .stars i { font-style: normal; color: rgba(255,255,255,.16); }
.carInfo .stars i.on { color: var(--warn); text-shadow: 0 0 8px rgba(255,207,58,.45); }
.carInfo p { margin: 1px 0 0; display: flex; gap: 6px; justify-content: center; align-items: center; color: var(--dim); font-size: 12px; min-height: 20px; }
.carInfo p span { padding: 2px 8px; border-radius: 8px; background: rgba(255,255,255,.06); color: #e6edf5; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.carInfo p span small { font-size: 10px; color: var(--dim); font-weight: 700; } .carInfo p span small:first-child { margin-right: 3px; }
.carInfo.swapR { animation: infoR .32s cubic-bezier(.2,.8,.3,1); } .carInfo.swapL { animation: infoL .32s cubic-bezier(.2,.8,.3,1); }
@keyframes infoR { from { opacity: 0; transform: translateX(28px); } } @keyframes infoL { from { opacity: 0; transform: translateX(-28px); } }
/* 車のタブ：4つずつ2段で全部見せる。下にクリアした数の点。全部クリアは金の縁と印 */
#tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 10px; width: 100%; max-width: 560px; }
#tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 38px; font-size: 12px; font-weight: 700; padding: 0 2px; border-radius: 11px;
  background: linear-gradient(rgba(255,255,255,.07), rgba(255,255,255,.03)); box-shadow: inset 0 0 0 1px var(--line); color: #b9c4d1; white-space: nowrap; transition: transform .12s, background .2s, color .2s; }
#tabs button span { line-height: 1; }
#tabs button:active { transform: scale(.94); }
#tabs .dots { display: flex; gap: 3px; }
#tabs .dots b { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.2); }
#tabs .dots b.got { background: var(--warn); box-shadow: 0 0 4px rgba(255,207,58,.6); }
#tabs button.on { background: linear-gradient(#6fd6ff, #33b4f0); color: #04121c; box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset, 0 4px 14px rgba(76,201,255,.35); font-weight: 900; }
#tabs button.on .dots b { background: rgba(4,18,28,.25); box-shadow: none; } #tabs button.on .dots b.got { background: #04121c; }
#tabs button.tech.on { background: linear-gradient(#ffe07a, #f5b929); box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset, 0 4px 14px rgba(255,200,60,.3); }
#tabs button.all:not(.on) { box-shadow: inset 0 0 0 1px rgba(255,211,106,.55); color: #f3e2b8; }
#tabs button.all::before { content: ''; position: absolute; top: -5px; left: -3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.3l2.6 2.5L12 5.4' fill='none' stroke='%23231705' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
  box-shadow: 0 0 0 2px #0a0e16, 0 0 8px rgba(255,211,106,.6); }
#tabs button.new::after { content: 'NEW'; position: absolute; top: -7px; right: -2px; font-size: 8px; font-weight: 900; line-height: 1; padding: 2px 4px; border-radius: 5px; background: var(--bad); color: #fff; box-shadow: 0 0 0 2px #0a0e16; }
/* ステージのカード：3列（5枚なら2段目を中央に）。写真の上に番号・点数・場所を重ねて背を低く */
#stageCards { --n: 5; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; max-width: 560px; }
.sCard { position: relative; flex: 0 0 calc((100% - 16px) / 3); padding: 0; border-radius: 12px; overflow: hidden; background: #141b27; text-align: left;
  box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.1); animation: cardIn .4s cubic-bezier(.2,.8,.3,1) both; transition: transform .12s, filter .2s; }
.sCard:nth-child(2) { animation-delay: .04s; } .sCard:nth-child(3) { animation-delay: .08s; } .sCard:nth-child(4) { animation-delay: .12s; } .sCard:nth-child(5) { animation-delay: .16s; } .sCard:nth-child(6) { animation-delay: .2s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.sCard .ph { aspect-ratio: 4 / 3; background: linear-gradient(110deg, #1a2232 30%, #263247 50%, #1a2232 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sCard .ph img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadeIn .4s; }
.sCard .ph.done { animation: none; }
@keyframes shimmer { to { background-position: -200% 0; } } @keyframes fadeIn { from { opacity: 0; } }
/* 写真の上下を暗くして、番号と場所の名前を重ねる */
.sCard::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,0) 30%, rgba(0,0,0,0) 45%, rgba(5,8,14,.92) 92%); }
.sCard .n { position: absolute; z-index: 1; left: 7px; top: 3px; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px #000; }
.sCard .n.stars { font-size: 11px; color: var(--warn); letter-spacing: -1px; top: 7px; }
.sCard .best { position: absolute; z-index: 1; right: 5px; top: 5px; font-size: 12px; font-weight: 900; line-height: 1; padding: 3px 6px 3px 7px; border-radius: 99px; font-variant-numeric: tabular-nums;
  color: #1d1505; background: var(--warn); box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.sCard .best small { font-size: 9px; margin-left: 1px; }
.sCard .best.gold { background: linear-gradient(#fff1b8, #ffc93a 60%, #e9a514); box-shadow: 0 2px 6px rgba(0,0,0,.5), 0 0 10px rgba(255,201,58,.6); }
.sCard .best.low { background: rgba(235,240,246,.88); color: #1a2230; }
.sCard .meta { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 0 6px 6px; }
.sCard .meta b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; line-height: 1.25; letter-spacing: -.01em; text-shadow: 0 1px 3px #000; }
.sCard .meta small { display: block; color: #a9b5c4; font-size: 9.5px; line-height: 1.2; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sCard:active { transform: scale(.95); filter: brightness(1.15); }
/* まだ先のカード：少し暗く（クリアしたもの・次に遊ぶものが目に入る） */
.sCard.later .ph { filter: brightness(.62) saturate(.7); }
.sCard.later .n { color: #c3ccd8; }
/* 次に遊ぶカード：水色の枠が息をして、真ん中に再生の印 */
.sCard.next { box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 2px var(--accent); animation: cardIn .4s cubic-bezier(.2,.8,.3,1) both, nextGlow 1.6s ease-in-out .5s infinite; }
@keyframes nextGlow { 50% { box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 2px var(--accent), 0 0 18px 3px rgba(76,201,255,.55); } }
.sCard .play { position: absolute; z-index: 1; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(76,201,255,.92); box-shadow: 0 0 0 4px rgba(76,201,255,.25), 0 4px 12px rgba(0,0,0,.5); animation: playPulse 1.6s ease-in-out .5s infinite; }
.sCard .play::before { content: ''; position: absolute; left: 10px; top: 7.5px; border-left: 9px solid #04121c; border-top: 5.5px solid transparent; border-bottom: 5.5px solid transparent; }
@keyframes playPulse { 50% { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(76,201,255,.12), 0 4px 12px rgba(0,0,0,.5); } }
/* PC の説明・リンク（PC の説明はマウスの端末だけ） */
#title .note { margin: 10px 0 0; font-size: 11px; }
#title .note + .note { margin-top: 6px; }
.pcOnly { display: none; }
@media (hover: hover) and (pointer: fine) { #title .pcOnly { display: block; } }
/* 横に広い画面（PC）：カードを1列に並べる */
@media (min-width: 720px) and (min-height: 640px) {
  #title { justify-content: safe center; }
  #title > #carStage { flex: 0 1 auto; height: min(48vh, 440px); }
  #tabs { max-width: 620px; }
  #tabs button { height: 42px; font-size: 13px; }
  #stageCards { max-width: min(900px, calc(var(--n) * 160px)); flex-wrap: nowrap; }
  .sCard { flex: 1 1 0; min-width: 0; }
  .sCard .meta b { font-size: 13px; } .sCard .meta small { font-size: 10.5px; }
  .carInfo h2 { font-size: 30px; }
}


/* ---- 結果（2026-11-16 磨き込み）：上に点数の札、その下に領収書。ボタンは下の帯に固定 ---- */
/* 遊んでいる最中の画面と同じ調子：暗いカプセル、押すと沈む、水色＝進む／黄＝注意／赤＝損。点数は90〜金・70〜黄・それ未満は白 */
#result { padding: 0; justify-content: flex-start; overflow: hidden; background: rgba(8,11,18,.8); --gold: #ffd36a; }
.rMain { flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  display: flex; flex-direction: column; align-items: center; padding: var(--top) 16px 22px; }

/* 点数の札 */
#rHero { position: relative; width: min(100%, 400px); flex: none; padding: 10px 14px 12px; border-radius: 22px; text-align: left;
  background: linear-gradient(rgba(16,22,34,.92), rgba(9,13,21,.92)); box-shadow: inset 0 0 0 1px var(--capLine), 0 10px 28px rgba(0,0,0,.45); }
#rHero.gold { box-shadow: inset 0 0 0 1px rgba(255,211,106,.45), 0 10px 28px rgba(0,0,0,.45), 0 0 28px rgba(255,201,58,.16); }
.rhTop { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; font-weight: 700; color: #c6d1de; white-space: nowrap; }
.rhTop > span { display: flex; align-items: center; gap: 4px; min-width: 0; }
.rhTop > span em { font-style: normal; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rhTop svg { flex: none; width: 13px; height: 13px; color: var(--warn); }
.rhTop svg.th-night, .rhTop svg.th-rain { color: #9fc4ff; } .rhTop svg.th-indoor { color: #c6d1de; } .rhTop svg.th-evening { color: #ffa65c; }
.rhTop .pips { flex: none; display: flex; gap: 3px; margin-left: 4px; }
.rhTop .pips b { display: block; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.2); transition: background .2s, box-shadow .2s, transform .2s; }
.rhTop .pips b.past { background: var(--warn); }
.rhTop .pips b.on { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 6px rgba(76,201,255,.6); }
.rhTop .pips b.got { background: var(--warn); animation: pipGot .45s cubic-bezier(.2,1.6,.4,1) both; animation-delay: var(--gd, .6s); }
.rhTop .pips.full b { background: var(--gold); box-shadow: 0 0 6px rgba(255,201,58,.8); animation: pipGot .4s cubic-bezier(.2,1.6,.4,1) both; animation-delay: calc(var(--gd, .6s) + var(--k) * 70ms); }
@keyframes pipGot { 0% { transform: scale(.4); } 60% { transform: scale(1.7); } 100% { transform: scale(1); } }
/* その車を全部終えた：点の後ろに金のチェック */
.rhDone { display: none; flex: none; width: 16px; height: 16px; margin-left: 2px; border-radius: 50%; background: var(--gold); color: #231705; box-shadow: 0 0 0 2px rgba(255,211,106,.25), 0 0 10px rgba(255,201,58,.6); }
.rhDone svg { width: 16px; height: 16px; display: block; stroke-width: 3; }
#rHero.carEnd .rhDone { display: block; animation: doneIn .5s cubic-bezier(.2,1.6,.4,1) both; animation-delay: var(--dd, 1s); }
@keyframes doneIn { 0% { opacity: 0; transform: scale(2.4) rotate(-25deg); } 100% { opacity: 1; transform: none; } }

.rhBody { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.rhScore { position: relative; flex: none; width: 37%; min-width: 108px; display: flex; align-items: baseline; justify-content: center; padding: 8px 0 4px; font-variant-numeric: tabular-nums; }
.rhScore b { font-size: 60px; font-weight: 900; line-height: .95; letter-spacing: -.02em; color: #f3f5f8; }
.rhScore > small { font-size: 13px; font-weight: 700; color: var(--dim); margin-left: 2px; }
.rhScore.mid b { color: var(--warn); text-shadow: 0 0 18px rgba(255,207,58,.35); }
.rhScore.gold b { background: linear-gradient(#fff4c4, #ffd36a 45%, #f0a91c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(255,201,58,.45)); }
.rhScore.land b { animation: ptsLand .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes ptsLand { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.rhOut { display: none; font-size: 40px; font-weight: 900; color: var(--bad); line-height: 1; padding: 8px 0; text-shadow: 0 0 16px rgba(255,91,79,.4); }
.rhScore.out b, .rhScore.out > small { display: none; } .rhScore.out .rhOut { display: block; animation: stampIn .4s cubic-bezier(.2,1.4,.4,1) both; }
/* ベスト更新：金の札が押される */
.rhBest { display: none; position: absolute; left: 50%; top: -8px; transform: translateX(-50%) rotate(-6deg); align-items: center; gap: 2px; padding: 2px 7px 2px 4px; border-radius: 6px;
  font-size: 11px; font-weight: 900; letter-spacing: .06em; line-height: 1.2; color: #231705; background: linear-gradient(#fff1b8, #ffc93a 60%, #e9a514); box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 12px rgba(255,201,58,.55); white-space: nowrap; }
.rhBest svg { width: 12px; height: 12px; }
.rhBest small { font-size: 10px; letter-spacing: 0; margin-left: 3px; opacity: .8; }
.rhScore.best .rhBest { display: inline-flex; animation: bestIn .45s cubic-bezier(.2,1.5,.4,1) both; animation-delay: var(--bd, .9s); }
@keyframes bestIn { 0% { opacity: 0; transform: translateX(-50%) rotate(-20deg) scale(2.2); } 100% { opacity: 1; transform: translateX(-50%) rotate(-6deg) scale(1); } }
@keyframes stampIn { 0% { opacity: 0; transform: scale(1.8) rotate(-12deg); } 100% { opacity: 1; transform: rotate(-4deg); } }

/* 内訳：絵＋棒＋小さな値。満点に近いほど水色、半分を切ると黄、ほとんど取れていないと赤 */
.rhBars { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.rhBar { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 7px; }
.rhBar svg { width: 18px; height: 18px; color: #c6d1de; }
.rhBar .bt { position: relative; height: 9px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }
.rhBar .bt i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0); transition: transform .5s cubic-bezier(.2,.8,.3,1); background: var(--accent); }
.rhBar.ok .bt i { background: linear-gradient(90deg, #4cc9ff, #8be0ff); box-shadow: 0 0 8px rgba(76,201,255,.6); }
.rhBar.mid .bt i { background: var(--warn); } .rhBar.bad .bt i { background: var(--bad); }
.rhBar.ok svg { color: var(--accent); } .rhBar.bad svg { color: var(--bad); }
.rhBar small { min-width: 38px; text-align: right; font-size: 11px; font-weight: 700; color: #aeb9c7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rhBar.bad small { color: #ff9a90; }

.rhTitle { margin-top: 8px; text-align: center; font-size: 18px; font-weight: 900; letter-spacing: .04em; line-height: 1.3; color: #f3f5f8; opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
#rHero.gold .rhTitle { color: var(--gold); text-shadow: 0 0 14px rgba(255,201,58,.35); }
#rHero.out .rhTitle { color: #ff9a90; }
.rhTitle.on { opacity: 1; transform: none; }
.rhTitle.long { font-size: 15px; }
.rhChips { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.rhChips:empty { display: none; }
.rhChips span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 7px; border-radius: 99px; font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--capLine); color: #dfe8f2; }
.rhChips svg { width: 15px; height: 15px; }
.rhChips .cost { background: rgba(255,91,79,.88); box-shadow: 0 0 14px rgba(255,91,79,.35); color: #fff; }
.rhChips .cost small { font-size: 11px; opacity: .85; margin-left: 2px; }
.rhChips .sq { color: var(--warn); box-shadow: inset 0 0 0 1px rgba(255,207,58,.45); }

/* 結果：タップで飛ばしたら、動きの残りはその場で終わらせる。枠外は内訳を暗く */
#rHero.skip *, #rHero.skip { transition: none !important; animation-delay: 0s !important; animation-duration: .01s !important; }
#rHero.out .rhBar { opacity: .45; }
/* 領収書：プリンタから刷り出す。刷っている間はランプが点滅 */
#receiptWrap { position: relative; width: min(100%, 400px); flex: none; padding-top: 18px; margin-top: 14px; }
.printer { position: absolute; left: -6px; right: -6px; top: 0; height: 26px; border-radius: 10px; background: linear-gradient(#3a4250, #1c222c); box-shadow: 0 6px 14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12); z-index: 2; }
.printer i { position: absolute; left: 14px; right: 14px; bottom: 6px; height: 4px; border-radius: 2px; background: #05070a; }
.printer .led { position: absolute; right: 12px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: #2a3a2f; }
#receiptWrap.printing .led { background: var(--go); box-shadow: 0 0 6px var(--go); animation: rec .35s steps(2, jump-none) infinite; }
#receipt { overflow: hidden; margin: 0 4px; }
#receipt canvas { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 20px rgba(0,0,0,.5)); }
#receipt.print canvas { animation: printOut 1.7s steps(34, end) both, paperIn 1.7s ease-out both; }
/* 上の行から順に刷られていく（刻みで止まりながら）。紙も少しずつ送り出される */
@keyframes printOut { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes paperIn { 0% { transform: translateY(-14px); } 94% { transform: translateY(0); } 97% { transform: translateY(3px); } 100% { transform: translateY(0); } }
#promo-slot { width: min(100%, 400px); margin-top: 14px; }
.note a { color: var(--dim); }

/* 下の帯：いちばん押してほしい「次へ」を大きく水色に。もう一度は隣、共有・動画・一覧は小さく下の段 */
.rActions { position: relative; flex: none; width: 100%; padding: 10px 16px var(--bot); background: rgba(8,11,18,.95); box-shadow: 0 -1px 0 var(--capLine); display: flex; flex-direction: column; align-items: center; gap: 9px; }
.rActions::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 26px; pointer-events: none; background: linear-gradient(rgba(8,11,18,0), rgba(8,11,18,.95)); }
.rMainRow { display: flex; gap: 10px; width: min(100%, 400px); }
.rSubRow { display: flex; gap: 6px; justify-content: center; width: min(100%, 400px); }
.rBtn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 60px; border-radius: 18px; font-weight: 900; white-space: nowrap; touch-action: manipulation; transition: transform .06s, box-shadow .06s, filter .15s, opacity .2s; }
.rBtn svg { flex: none; pointer-events: none; }
.rBtn[hidden] { display: none; }
/* もう一度：暗い四角に絵と短い言葉 */
.rRetry { flex: none; width: 76px; flex-direction: column; gap: 2px; font-size: 11px; color: #dfe8f2; background: linear-gradient(#2a3342, #1a212d); box-shadow: 0 5px 0 #0a0e16, inset 0 0 0 1px var(--capLine), inset 0 1px 0 rgba(255,255,255,.08); }
.rRetry svg { width: 24px; height: 24px; color: var(--warn); }
.rRetry:active { transform: translateY(4px); box-shadow: 0 1px 0 #0a0e16, inset 0 0 0 1px var(--capLine); }
/* 次へ：水色が息をする（ドアを開けると同じ） */
.rNext { flex: 1 1 auto; min-width: 0; justify-content: flex-start; padding: 7px 12px 7px 7px; color: #04121c; background: linear-gradient(#78dbff, #2ea9e6); box-shadow: 0 5px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55); animation: doorGlow 1.6s ease-in-out 1s infinite; }
.rNext:active { transform: translateY(4px); box-shadow: 0 1px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55); animation: none; }
.nxPh { position: relative; flex: none; width: 58px; height: 46px; border-radius: 11px; overflow: hidden; background: linear-gradient(#24324a, #111a28); box-shadow: inset 0 0 0 1.5px rgba(4,18,28,.35); display: flex; align-items: center; justify-content: center; }
.nxPh img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nxPh > svg { width: 24px; height: 24px; color: #ffcf3a; }
.nxPh > svg.th-night, .nxPh > svg.th-rain { color: #9fc4ff; } .nxPh > svg.th-indoor { color: #c6d1de; } .nxPh > svg.th-evening { color: #ffa65c; }
.nxPh .n { position: absolute; left: 4px; top: 1px; font-size: 14px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px #000; }
.nxTx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; }
.nxTx b { font-size: 21px; line-height: 1.05; letter-spacing: .06em; }
.nxTx small { display: flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; font-weight: 900; color: #0b3a55; overflow: hidden; }
.nxTx small em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.nxTx small .pips { flex: none; display: flex; gap: 3px; }
.nxTx small .pips b { display: block; width: 7px; height: 7px; border-radius: 50%; background: rgba(4,18,28,.25); }
.nxTx small .pips b.past { background: #0b3a55; }
.nxTx small .pips b.on { background: #fff; box-shadow: 0 0 0 1.5px #0b3a55; }
/* 車が変わる：車の名前を暗い札で（区切り） */
.nxTx small.car em { padding: 1px 8px; border-radius: 99px; background: #04121c; color: #8be0ff; }
.nxGo { width: 22px; height: 22px; }
/* 幅の狭いスマホ（SE）は場所の名前を出さず点だけ（写真で場所はわかる。途中で切れた名前は読みにくい） */
@media (max-width: 360px) { .nxTx small:not(.car) em { display: none; } }
.nxLock { display: none; }
/* 枠に入らなかった：次へは鍵がかかって小さく、もう一度が水色の大きいボタンに */
.rActions[data-mode="retry"] .rRetry, .rActions[data-mode="retryEnd"] .rRetry { order: 2; flex: 1 1 auto; width: auto; flex-direction: row; gap: 8px; font-size: 21px; letter-spacing: .06em; color: #04121c;
  background: linear-gradient(#78dbff, #2ea9e6); box-shadow: 0 5px 0 #0f5a85, inset 0 1px 0 rgba(255,255,255,.55); animation: doorGlow 1.6s ease-in-out 1s infinite; }
.rActions[data-mode="retry"] .rRetry svg, .rActions[data-mode="retryEnd"] .rRetry svg { color: #04121c; width: 26px; height: 26px; }
.rActions[data-mode="retry"] .rRetry:active, .rActions[data-mode="retryEnd"] .rRetry:active { box-shadow: 0 1px 0 #0f5a85; animation: none; }
.rActions[data-mode="retry"] .rNext { order: 1; flex: none; width: 76px; padding: 7px; justify-content: center; pointer-events: none; animation: none; background: linear-gradient(#2a3342, #1a212d); box-shadow: 0 5px 0 #0a0e16, inset 0 0 0 1px var(--capLine); }
.rActions[data-mode="retry"] .nxTx, .rActions[data-mode="retry"] .nxGo { display: none; }
.rActions[data-mode="retry"] .nxPh { width: 60px; filter: brightness(.45) saturate(.4); }
.rActions[data-mode="retry"] .nxLock { display: block; position: absolute; width: 22px; height: 22px; color: #dfe8f2; filter: drop-shadow(0 1px 3px #000); }
/* 全部終えた：一覧へが水色 */
.rMenuBig { justify-content: center; padding: 7px 16px; }
.rMenuBig svg { width: 24px; height: 24px; }
.rMenuBig .nxTx { flex: none; }
.rActions[data-mode="end"] #nextBtn, .rActions[data-mode="retryEnd"] #nextBtn, .rActions[data-mode="end"] #menuBtn { display: none; }
/* 小さい段：絵＋短い言葉 */
.rSub { flex: 1 1 0; min-width: 0; max-width: 96px; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 900; white-space: nowrap; color: #c6d1de;
  background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px var(--capLine); transition: transform .12s, background .2s; touch-action: manipulation; }
.rSub svg { flex: none; width: 18px; height: 18px; }
.rSub:active { transform: scale(.92); background: rgba(76,201,255,.25); }
.rSub.hot { color: var(--warn); box-shadow: inset 0 0 0 1px rgba(255,207,58,.5); }
.rSub[hidden] { display: none; }

/* PC（横に広い）：左に領収書、右に点数とボタン */
@media (min-width: 900px) {
  #result { display: grid; grid-template-columns: 400px 400px; grid-template-rows: 1fr auto auto auto 1fr; grid-template-areas: "paper ." "paper hero" "paper act" "paper promo" "paper ."; column-gap: 44px; justify-content: center; align-items: start; padding: 0 24px; }
  /* id の display: grid が .panel[hidden] に勝ち、タイトル・遊んでいる最中にも結果の画面が被って押せなかった（11/16 通しの確認） */
  #result[hidden] { display: none; }
  .rMain { display: contents; }
  #rHero { grid-area: hero; width: 100%; padding: 14px 18px 16px; }
  .rhScore b { font-size: 72px; }
  #receiptWrap { grid-area: paper; width: 100%; height: 100vh; margin: 0; padding: 42px 2px 30px; overflow-y: auto; scrollbar-width: none; }
  #receiptWrap::-webkit-scrollbar { display: none; }
  #receiptWrap .printer { top: 24px; }
  #promo-slot { grid-area: promo; width: 100%; }
  .rActions { grid-area: act; padding: 16px 0 0; background: none; box-shadow: none; }
  .rActions::before { display: none; }
  .rMainRow, .rSubRow { width: 100%; }
}

/* ---- リプレイ動画 ---- */
#videoBox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: calc(var(--top) + 50px) 16px var(--bot); background: rgba(5,7,12,.94); }
#videoBox[hidden] { display: none; }
.vbInner { position: relative; width: min(100%, 440px); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.vbFrame { position: relative; width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 1px var(--capLine), 0 14px 36px rgba(0,0,0,.6); }
#vbStage { width: 100%; height: 100%; }
#vbStage canvas, #vbStage video { width: 100%; height: 100%; display: block; object-fit: cover; }
/* 作っている間：枠の左上に REC（バックモニターと同じ赤い点） */
.vbRec { position: absolute; left: 2px; top: -42px; display: none; align-items: center; gap: 5px; padding: 4px 9px 4px 7px; border-radius: 99px; font-size: 11px; font-weight: 900; letter-spacing: .1em; background: rgba(9,13,21,.75); box-shadow: inset 0 0 0 1px var(--capLine); }
.vbRec i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px var(--bad); animation: rec 1s steps(2, jump-none) infinite; }
#videoBox[data-st="make"] .vbRec { display: inline-flex; }
/* 丸ボタン：音（枠の左上。動画をタップしても同じ）・閉じる（右上） */
.vbRnd { position: absolute; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #e6edf5; background: rgba(9,13,21,.72); box-shadow: inset 0 0 0 1px var(--capLine), 0 4px 12px rgba(0,0,0,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform .12s, background .2s; }
.vbRnd svg { width: 22px; height: 22px; pointer-events: none; }
.vbRnd:active { transform: scale(.88); background: rgba(76,201,255,.28); }
.vbRnd[hidden] { display: none; }
#vbMute { left: 0; top: -54px; }
#vbMute .x { display: none; } #vbMute.off .w { display: none; } #vbMute.off .x { display: inline; }
#vbMute.off { animation: muteHint 1.4s ease-in-out .6s 3; }
@keyframes muteHint { 50% { box-shadow: inset 0 0 0 1px var(--capLine), 0 0 0 6px rgba(76,201,255,.25), 0 0 18px rgba(76,201,255,.5); } }
.vbX { right: 0; top: -54px; background: rgba(255,255,255,.08); }
.vbFail { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #5a6676; background: #0b0f17; }
.vbFail svg { width: 72px; height: 72px; }
#videoBox[data-st="fail"] .vbFail { display: flex; }
/* 進み具合：水色の帯と％ */
.vbBar { position: relative; width: 100%; height: 8px; margin-bottom: 14px; border-radius: 99px; background: rgba(255,255,255,.1); box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }
.vbBar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #4cc9ff, #8be0ff); box-shadow: 0 0 10px rgba(76,201,255,.6); transition: width .2s linear; }
.vbBar b { position: absolute; right: 0; top: 13px; font-size: 12px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
#videoBox[data-st="done"] .vbBar, #videoBox[data-st="fail"] .vbBar { display: none; }
#vbMsg { margin: 0; font-size: 13px; color: #c9d3de; }
#vbMsg:empty { display: none; }
#vbSave { width: 100%; justify-content: center; padding: 7px 16px; }
#vbSave svg { width: 24px; height: 24px; }
#vbSave .nxTx { flex: none; }

/* ステージの準備の進み具合（11/19）：まん中に輪。水色の弧が時計回りに伸びる。文字は出さない */
#loading { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .18s; background: radial-gradient(circle at 50% 50%, rgba(9,13,21,.55) 0, rgba(9,13,21,0) 120px); }
#loading.on { opacity: 1; }
#loading svg { width: 64px; height: 64px; transform: rotate(-90deg); filter: drop-shadow(0 0 6px rgba(76,201,255,.45)); }
#loading circle { fill: none; stroke-width: 5; stroke-linecap: round; }
#loading .tr { stroke: rgba(255,255,255,.16); }
#loading .ar { stroke: #4cc9ff; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0) * 100); transition: stroke-dashoffset .12s linear; }

/* このゲームについて（2026-11-12。検索エンジン向けの説明。タイトルのいちばん下に閉じて置く） */
.about { width: 100%; max-width: 560px; margin: 6px auto 0; text-align: left; font-size: 13px; line-height: 1.8; color: rgba(255, 255, 255, .78); user-select: text; -webkit-user-select: text; }
.about > summary { display: block; text-align: center; cursor: pointer; list-style: none; font-size: 12px; opacity: .7; text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.about > summary::-webkit-details-marker { display: none; }
.about h2 { margin: 10px 0 6px; font-size: 17px; color: var(--ink); }
.about h3 { margin: 16px 0 4px; font-size: 14px; color: var(--ink); }
.about p { margin: 0 0 8px; }
.about dt { font-weight: 700; margin-top: 6px; color: var(--ink); }
.about dd { margin: 0 0 4px; }
