/* 車両HUD（レース .vh-race・街 .vh-town 共用）: アナログ速度計+水温計+小さな計器（ブースト・油温） .vh-meter / 簡易損傷 .vh-dmg。js/vehicleHud.js が描画。style.css の後に読む（同じ詳しさなら後勝ち）。
   --vh-ms = メーターの一辺(px)。JS が .vh-meter/.vh-dmg に設定（隣に並べる時の逃がし幅に使う） */
.vh-off { display: none !important; }
/* ---- 右下の縦並び（PC標準）: ミニマップ → ライバル → メーター。タッチ・狭い画面は個別に絶対配置 ---- */
#r-rcol { display: contents; }
body:not(.touch) #hud:not(.rc) #r-rcol { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
body:not(.touch) #hud:not(.rc) #r-rcol > * { position: static; margin: 0; }
body:not(.touch) #hud:not(.rc) #r-rcol .vh-meter { position: relative; right: auto; bottom: auto; margin: 0; } /* 流れに乗せつつ、小さな計器（絶対位置）の基準にする */
body:not(.touch) #hud:not(.rc) #r-rcol .vh-meter.vh-sub { margin-top: calc(var(--vh-ms, 190px) * .1); } /* ブースト計が速度計の上へ約 .14×S はみ出す分、上のライバル枠との間（8px）を足す */
.vh-meter { position: absolute; right: 12px; bottom: 12px; line-height: 0; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .55)); }
.vh-meter canvas { display: block; }
/* 小さな計器（フラグ induction・ブースト計 .vh-sub-boost と油温計 .vh-sub-oil。JS が .vh-meter の中に作る）: 速度計と同じ描き方。位置と大きさは JS が left/top/canvas で設定
   （速度計の左上と左へはみ出す。速度計の一辺 S に対し、左へ最大 .42×S・上へ .14×S・下は速度計の下端の内側。タッチは速度計の上の左右へ 0.6×S・0.52×S）。傾けない。.vh-meter 側が position を持つこと（相対 or 絶対） */
.vh-sub { position: absolute; line-height: 0; pointer-events: none; }
body:not(.touch) #hud.rc .vh-meter { right: 6px; bottom: 6px; }
/* タッチ: ペダル(右下)とスティック(左下)の間（レース・街とも同じ）。レースのログ/操作説明はメーターの左へ寄せる */
body.touch .vh-meter { right: calc(var(--sr) + 196px); bottom: calc(var(--sb) + 16px); }
body.touch .r-bl { left: calc(var(--sl) + 166px); right: calc(var(--sr) + 196px + 96px + 8px); transform: none; width: auto; max-width: none; align-items: flex-start; }
body.touch .r-feed { text-align: left; }
/* ---- 簡易損傷（上から見た車の4面 + 足回り4輪 + 機関/駆動/操舵 + 自走不能ライン） ---- */
.vh-dmg { position: absolute; pointer-events: none; }
.vh-dmg.vh-race { top: 12px; right: 12px; }
body.touch .hud-col .vh-dmg.vh-race { position: static; } /* タッチのレース: 左の情報列の下に流す */
.rd-panel { display: flex; gap: 8px; align-items: stretch; padding: 6px 9px; width: max-content; font-size: 11px; }
.rd-car { flex: none; width: 40px; height: 69px; }
.rd-car path, .rd-car rect { stroke: #000; stroke-width: .9; }
.rd-car .rd-roof { fill: #3a3a46; }
.rd-car .lv0, .rd-chips .lv0 { fill: #5fbf6a; background: #5fbf6a; } .rd-car .lv1, .rd-chips .lv1 { fill: #e8d23c; background: #e8d23c; }
.rd-car .lv2, .rd-chips .lv2 { fill: #f08c28; background: #f08c28; } .rd-car .lv3, .rd-chips .lv3 { fill: #de2c2c; background: #de2c2c; color: #fff; }
.rd-side { width: 116px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.rd-chips { display: flex; gap: 3px; }
.rd-chips span { font-size: 10px; font-weight: var(--w-body); line-height: 1.3; padding: 0 5px; border-radius: 9px; color: #111; white-space: nowrap; }
.rd-chips .hot::after { content: '熱'; margin-left: 2px; }
.rd-chips .hot { box-shadow: 0 0 0 2px #ff5a3a; }
.rd-lab { display: flex; justify-content: space-between; align-items: baseline; color: var(--dim); font-size: 10px; white-space: nowrap; }
.rd-pct { font-size: 20px; font-weight: var(--w-body); line-height: 1; font-variant-numeric: tabular-nums; color: var(--fg); }
.rd-pct.warn { color: var(--warn); } .rd-pct.bad { color: var(--bad); }
.rd-bar { position: relative; height: 9px; margin-right: 3px; background: #2a2428; border: 1px solid #000; border-radius: 3px; }
.rd-bar::after { content: ''; position: absolute; right: -3px; top: -3px; bottom: -3px; width: 3px; background: #ff2a2a; box-shadow: 0 0 4px #f00; } /* 自走不能ライン */
.rd-fill { display: block; height: 100%; background: linear-gradient(90deg, #5fbf6a 0%, #e8d23c 55%, #e0402f 100%); clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0); }
.rd-panel.near .rd-bar { animation: rdBlink .5s steps(2) infinite; }
.rd-panel.dead { border-color: #ff3a2a; }
@keyframes rdBlink { 50% { box-shadow: 0 0 0 2px #ff2a2a, 0 0 8px #f00; } }
.rd-note { font-size: 10px; font-weight: var(--w-body); line-height: 1.2; white-space: nowrap; min-height: 0; }
.rd-note:empty { display: none; }
.rd-note.warn { color: var(--warn); } .rd-note.bad { color: var(--bad); }
/* 狭い画面（タッチ・PCの低い窓）: 小さく */
body.touch .rd-panel, body:not(.touch) #hud.rc .rd-panel { gap: 5px; padding: 3px 5px; border-width: 1px; }
body.touch .rd-car, body:not(.touch) #hud.rc .rd-car { width: 25px; height: 43px; }
body.touch .rd-side, body:not(.touch) #hud.rc .rd-side { width: 82px; gap: 2px; }
body.touch .rd-chips span, body:not(.touch) #hud.rc .rd-chips span { font-size: 8px; padding: 0 3px; }
body.touch .rd-lab, body:not(.touch) #hud.rc .rd-lab { font-size: 8px; } body.touch .rd-pct, body:not(.touch) #hud.rc .rd-pct { font-size: 13px; }
body.touch .rd-bar, body:not(.touch) #hud.rc .rd-bar { height: 6px; }
body.touch .rd-note, body:not(.touch) #hud.rc .rd-note { font-size: 8px; }
body:not(.touch) #hud.rc .vh-dmg.vh-race { top: 6px; right: 6px; }
/* ---- 街（.vh-town）: PCはメーター右下（旧 #tw-speed の位置）・損傷左下（旧 #tw-dmg の位置）。タッチはメーター=ペダルの左（レースと同じ）・損傷=スティックの右隣。
   運転中だけ出る（徒歩・原付の損傷は JS が隠す）ので、下中央のプロンプト・操作説明とは同時に出ない ---- */
.vh-dmg.vh-town { left: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
body.touch .vh-dmg.vh-town { left: calc(var(--sl) + var(--u) * 140px + 26px); bottom: calc(var(--sb) + 16px); } /* スティックの右隣（下中央のプロンプト「降りる」・メーターとは重ねない） */
.vh-det { pointer-events: auto; cursor: pointer; font: inherit; font-size: 10px; font-weight: var(--w-body); line-height: 1.4; padding: 0 9px; border-radius: 9px; color: var(--dim); background: rgba(0, 0, 0, .55); border: 1px solid var(--line); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.vh-det.on { color: var(--fg); border-color: var(--acc); }
body.touch .vh-det { font-size: 8px; padding: 0 6px; }
.vh-pop { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: var(--z-hud-pop); pointer-events: auto; zoom: .7; }
body.touch .vh-pop { zoom: .5; }
.vh-pop[hidden] { display: none; }

/* ===== 結果画面: 賞金・収支の数え上げ演出（js/race.js animateReceipt） ===== */
.res-receipt { position: relative; overflow: visible; }
.res-receipt .cu { font-variant-numeric: tabular-nums; display: inline-block; }
.res-receipt .rc-big { font-family: var(--f-body); font-weight: var(--w-body); font-size: 22px; line-height: 1.15; align-items: baseline; }
.res-receipt .rc-big .cu { transform-origin: right center; }
.res-receipt .rc-gain { color: #b8860b; text-shadow: 0 1px 0 #fff8; }
.res-receipt .rc-loss { color: #c0261c; }
.res-receipt .rc-hide { opacity: 0; }
.res-receipt .rc-stamp .cu { animation: rc-stamp .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.res-receipt .rc-stamp.rc-loss .cu { animation: rc-stamp .35s ease-out both, rc-shake .45s .3s linear both; }
.res-receipt .rc-tick .cu { animation: rc-tick .12s ease-out; }
@keyframes rc-stamp { 0% { transform: scale(2.4); opacity: 0; } 55% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rc-tick { 50% { transform: scale(1.12); } }
@keyframes rc-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.rc-fx { position: absolute; right: 18px; top: 0; width: 0; height: 0; pointer-events: none; }
.rc-fx i { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c0, #ffc83a 55%, #c88a0a); box-shadow: 0 0 6px #ffd84acc; opacity: 0; animation: rc-coin var(--d, .9s) cubic-bezier(.2, .7, .3, 1) var(--w, 0s) both; }
.rc-fx i.sp { width: 6px; height: 6px; border-radius: 1px; background: #fff3a8; transform: rotate(45deg); }
@keyframes rc-coin { 0% { opacity: 1; transform: translate(0, 0) scale(.4); } 60% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1) rotate(180deg); } }
@media (max-width: 960px), (max-height: 520px) { .res-receipt .rc-big { font-size: 17px; } .rc-fx i { width: 7px; height: 7px; } }
@media (prefers-reduced-motion: reduce) { .res-receipt .rc-stamp .cu, .res-receipt .rc-tick .cu { animation: none; } .rc-fx { display: none; } }
.res-receipt .muted { color: #6b6254; }

/* ===== デモリッションダービー（js/match/derbyHud.js）: 上部の残り時間+自分の点・スコアボード・得点ポップアップ・中央コール・結果 ===== */
.d-bank { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 2px 14px; text-shadow: 0 2px 0 #000; white-space: nowrap; }
.d-time { font-family: var(--f-body); font-weight: var(--w-body); font-size: 34px; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.d-time.low { color: #ff5a3a; animation: dLow .5s steps(2) infinite; }
.d-me { display: flex; align-items: baseline; gap: 3px; color: #ffe14a; }
.d-score { display: inline-block; font-family: var(--f-body); font-weight: var(--w-body); font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; transform-origin: 50% 80%; }
.d-score.on { animation: dBump .32s cubic-bezier(.2, 1.7, .4, 1); }
.d-me small { font-size: 14px; color: #fff; }
.d-combo { flex-basis: 100%; text-align: center; min-height: 0; font-family: var(--f-body); font-weight: var(--w-body); font-size: 15px; color: #ffb067; }
.d-combo:empty { display: none; } .d-combo.on { animation: dBump .28s cubic-bezier(.2, 1.7, .4, 1); } .d-combo.hot { color: #ff6a4a; font-size: 18px; }
.d-scrap { flex-basis: 100%; text-align: center; font-size: 11px; color: #dcd0b0; }
body.touch .d-time { font-size: 18px; } body.touch .d-score { font-size: 24px; } body.touch .d-me small { font-size: 9px; } body.touch .d-combo { font-size: 10px; } body.touch .d-combo.hot { font-size: 11px; } body.touch .d-scrap { font-size: 8px; }
body.touch .d-bank { gap: 0 8px; }
.d-board .d-row { display: flex; gap: 5px; align-items: baseline; white-space: nowrap; }
.d-board .d-row .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; } .d-board .d-row b { font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: right; }
.d-board .d-row.me { color: var(--acc); } .d-board .d-row.out { opacity: .55; } .d-board .d-row .st { color: #7dff9a; } .d-board .d-row.out .st { color: #ff5a3a; }
.d-board .d-row > span:first-child { min-width: 1em; }
body:not(.touch) #hud:not(.rc) .d-board { min-width: 190px; }
/* 得点ポップアップ（固定12個のプール。left/top は JS が画面座標で設定。位置は動かさず上へ浮かせる） */
#d-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.d-pop { position: absolute; display: none; transform: translate(-50%, -50%); font-family: var(--f-body); font-weight: var(--w-body); font-style: normal; font-size: 30px; line-height: 1; white-space: nowrap; text-shadow: 0 2px 0 #000, 0 0 8px #0008; color: #fff; }
.d-pop.on { display: block; animation: dPop 1.1s cubic-bezier(.2, .8, .3, 1) both; }
.d-pop.hit { color: #ffe14a; } .d-pop.brk { color: #ff9a3a; font-size: 36px; } .d-pop.ko { color: #ff4a3a; font-size: 50px; animation-duration: 1.5s; } .d-pop.ast { color: #7de0ff; font-size: 26px; }
.d-call { position: absolute; left: 0; right: 0; top: 30%; display: none; text-align: center; font-family: var(--f-disp); text-shadow: 0 4px 0 #000, 0 0 18px #000a; }
.d-call.on { display: block; animation: dCall 2.4s cubic-bezier(.2, 1.4, .35, 1) both; }
.d-call b { display: block; font-weight: var(--w-small); font-size: 76px; line-height: 1.05; color: #fff; } .d-call small { display: block; font-size: 34px; color: #ffe14a; }
.d-call.ko b { color: #ff4a3a; } .d-call.last b { color: #ffe14a; }
body.touch .d-pop { font-size: 20px; } body.touch .d-pop.brk { font-size: 24px; } body.touch .d-pop.ko { font-size: 32px; } body.touch .d-pop.ast { font-size: 17px; }
body.touch .d-call b { font-size: 40px; } body.touch .d-call small { font-size: 20px; } body.touch .d-call { top: 24%; }
@media (max-height: 520px) { .d-call b { font-size: 40px; } .d-call small { font-size: 20px; } .d-pop { font-size: 20px; } .d-pop.ko { font-size: 32px; } }
@keyframes dPop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); } 14% { opacity: 1; transform: translate(-50%, -60%) scale(1.35); } 30% { transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
@keyframes dCall { 0% { opacity: 0; transform: scale(2.6); } 14% { opacity: 1; transform: scale(.94); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }
@keyframes dBump { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes dLow { 50% { opacity: .55; } }
/* 結果 */
.d-res .d-in { animation: dRow .4s ease-out both; animation-delay: calc(var(--i) * 90ms); } .d-res .d-in.me { color: #ffd84a; font-weight: bold; }
.d-bd { margin-top: 8px; max-width: 320px; } .d-bd-r { display: flex; justify-content: space-between; font-size: 13px; border-bottom: 1px dotted var(--line); }
.d-rewards { display: none; margin-top: 8px; padding: 6px 10px; border: 2px solid var(--acc); border-radius: 12px; background: rgba(255, 138, 61, .12); }
.d-rewards.on { display: block; } .d-rewards h3 { margin: 0 0 4px; font-size: 14px; }
.d-rew-i { font-size: 14px; font-weight: var(--w-body); opacity: 0; animation: dRew .6s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(.2s + var(--i) * .35s); } .d-rew-i span { color: var(--acc2); margin-right: 6px; } .d-rew-i.unl { color: #ffe14a; }
@keyframes dRow { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes dRew { from { opacity: 0; transform: scale(.6) translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .d-pop.on, .d-call.on, .d-score.on, .d-combo.on, .d-time.low, .d-res .d-in, .d-rew-i { animation: none; opacity: 1; } .d-pop.on { transform: translate(-50%, -100%); } }
