:root {
  color-scheme: dark;
  --bg: #111c20;
  --panel: #19272c;
  --text: #f4f6ed;
  --muted: #a7b6b7;
  --lime: #d7f76b;
  --blue: #5b86ff;
  --red: #d8423f;
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .38; }
[hidden] { display: none !important; }
.app { width: 100%; max-width: 760px; margin: auto; padding: 0 16px max(16px, env(safe-area-inset-bottom)); }
.header { height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ffffff14; }
.brand { color: var(--text); text-decoration: none; font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand-logo { display: block; height: 46px; width: auto; }
.edition { display: none; font-size: 11px; color: var(--muted); letter-spacing: .12em; }
.scoreboard { display: flex; align-items: center; padding: 14px 3px; gap: 30px; }
.eyebrow { display: block; font-size: 10px; letter-spacing: .12em; font-weight: 600; color: var(--muted); }
.scoreboard strong { display: block; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.round strong { color: #9cadb0; }
.lives { margin-left: auto; text-align: right; }
.lives > div { display: flex; gap: 7px; margin-top: 11px; }
.lives i { width: 22px; height: 5px; background: var(--lime); border-radius: 1px; }
.lives i.lost { background: #34444a; }
/* スマホ幅を基準に、映像の比率を保ちつつ画面高にも合わせる。 */
.field { position: relative; isolation: isolate; height: min(112vw, 49svh, 440px); min-height: 330px; border-radius: 12px; overflow: hidden; border: 1px solid #ffffff24; background: #3e715b; }
canvas { display: block; width: 100%; height: 100%; }
.field-top { position: absolute; top: 14px; left: 13px; right: 13px; display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #e5f0e8; letter-spacing: .03em; }
.field-top b { padding-left: 5px; font-size: 16px; }
.live { display: flex; gap: 6px; align-items: center; }
.live i { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.legend { position: absolute; right: 14px; top: 49px; display: flex; gap: 12px; font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { width: 6px; height: 6px; border-radius: 50%; }
.blue { background: var(--blue); }
.red { background: #d8423f; }
.view-caption { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center; color: #e9f3df99; font-size: 8px; letter-spacing: .06em; }
/* 中継風のVAR確認テロップ。リプレイの間だけ左下に出し、左から右へ短く伸びる。外部フォントは使わず、システムフォントで指定する。 */
.telop { position: absolute; left: 6px; bottom: 6px; z-index: 1; padding: .3em .6em; background: #12131f; color: #fff; font-size: 9.5px; line-height: 1.22; white-space: nowrap; pointer-events: none; visibility: hidden; clip-path: inset(0 100% 0 0); }
.telop.on { visibility: visible; clip-path: inset(0); animation: telop-in .25s ease-out; }
.telop-ja { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; font-weight: 700; }
.telop-en { font-family: "Avenir Next", "Avenir", "Futura", "Century Gothic", "Segoe UI", sans-serif; font-weight: 600; }
/* 静止中に判定対象の部位が隠れる場合の引っ込み。出るときの逆で、右から左へ縮む。 */
.telop.out { visibility: visible; animation: telop-out .25s ease-in forwards; }
@keyframes telop-out { from { clip-path: inset(0); } to { clip-path: inset(0 100% 0 0); } }
@keyframes telop-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.overlay { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #101d25ec 0%, #121f27e0 52%, #142c2b40 88%); padding: 22px; }
#result { background: linear-gradient(180deg, #101d25f0 0%, #121f27e4 60%, #142c2b70 100%); }
.intro-card { width: 100%; max-width: 360px; text-align: left; }
.accent { color: var(--lime); }
h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.05em; margin: 13px 0; }
h2 { font-size: 27px; margin: 20px 0; }
.title-dot { color: var(--lime); }
.intro-card p { font-size: 12px; line-height: 1.9; color: #c2cfcb; margin: 12px 0; }
.rule-pills { display: flex; gap: 8px; margin: 14px 0; }
.rule-pills span { font-size: 10px; padding: 6px 10px; border: 1px solid #ffffff25; border-radius: 5px; }
.primary { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; border-radius: 7px; background: var(--lime); color: #1b2c21; font-size: 14px; font-weight: 800; padding: 0 16px; min-height: 48px; }
.primary:hover { background: #e4ff95; }
.primary span { font-size: 22px; }
.intro-card > small { display: block; text-align: center; font-size: 10px; color: #dbe6e2; margin-top: 10px; text-shadow: 0 1px 3px #000c; }
.intro-card p.best { margin: 4px 0 18px; font-size: 13px; font-weight: 700; color: var(--lime); }
.result-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; margin-top: 10px; padding: 8px 16px; border: 1px solid #ffffff25; border-radius: 7px; color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; }
.result-link small { display: block; font-size: 10px; font-weight: 400; color: #c2cfcb; margin-bottom: 2px; }
.result-link:hover { border-color: var(--lime); }
.result-link span { color: var(--lime); font-size: 18px; }
.decision { padding-top: 12px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 25px; }
.status-row p { margin: 0; font-size: 11px; color: #cbd7d4; }
.status-row > span { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--lime); white-space: nowrap; }
.timer-track { height: 3px; background: #2a393d; border-radius: 4px; overflow: hidden; margin: 8px 0 13px; }
#timer { height: 100%; background: var(--lime); transform-origin: left; }
.urgent #timer { background: var(--red); }
.urgent #time { color: var(--red); }
.answer-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.answer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px 6px; padding: 8px 3px; border-radius: 9px; font-weight: 800; font-size: 14px; min-height: 77px; }
.answer small { flex-basis: 100%; font-size: 10px; font-weight: 600; }
.answer.off { border: 2px solid #ffd23f; background: #ffd23f; color: #1d251d; }
.answer.off small { color: #303019; }
.answer.on { border: 2px solid #fff; background: var(--panel); color: #fff; }
.answer.on small { color: #fff; }
.button-icon { font-size: 30px; line-height: 1; }
.off-mark { width: 26px; height: 34px; border-left: 3px solid currentColor; position: relative; }
.off-mark::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 16px; background: currentColor; clip-path: polygon(0 0, 100% 25%, 100% 100%, 0 75%); }
.answer.selected { opacity: 1; animation: answer-flash .12s ease-out; }
@keyframes answer-flash { 50% { filter: brightness(1.55); box-shadow: 0 0 18px 5px #fff9; } }
.review { background: var(--panel); padding: 12px; border: 1px solid #ffffff15; border-radius: 9px; }
.review strong { font-size: 17px; color: var(--lime); }
.review.incorrect { border-color: #fb887940; }
.review.incorrect strong { color: var(--red); }
.review.correct { border-color: #d7f76b40; }
.review p { font-size: 11px; color: #c0cdcb; line-height: 1.7; margin: 6px 0 11px; }
.review .gain { margin: 4px 0 0; color: var(--lime); font-weight: 700; }
.review-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; }
.review .primary { min-height: 44px; font-size: 12px; padding: 0 12px; }
.secondary { min-height: 44px; border: 1px solid #ffffff25; background: transparent; border-radius: 7px; color: var(--text); font-size: 11px; }
.secondary:not(:disabled):hover { border-color: var(--lime); }
.result-score { display: flex; align-items: baseline; gap: 14px; }
.result-score strong { font-size: 64px; line-height: 1.2; color: var(--lime); font-variant-numeric: tabular-nums; }
.result-score span { font-size: 14px; color: var(--muted); }
/* 結果カードはピッチの固定高さに収める。狭い画面で縮め、広い画面で元の大きさに戻す。 */
#result { padding: 12px 18px; }
#result h2 { font-size: 20px; margin: 6px 0; }
#result .result-score strong { font-size: 44px; line-height: 1.1; }
#result .result-detail { margin: 0 0 4px; font-size: 12px; line-height: 1.6; }
#result .intro-card p.best { margin: 2px 0 10px; font-size: 12px; }
#result .primary { min-height: 44px; }
#result .result-link { min-height: 48px; margin-top: 8px; padding: 6px 14px; }
.result-detail { margin: 4px 0 10px; font-size: 13px; line-height: 1.9; }
.result-detail div { display: flex; gap: 16px; }
.result-detail dt { min-width: 5.5em; color: var(--muted); }
.result-detail dd { margin: 0; font-weight: 700; }
/* 縦に余裕のある端末では、ピッチを高くして選手を大きく見せる。
   画面の高さは min-width では表せないため、ここだけ min-height を使う。回答ボタンは900px以上の高さなら十分に収まる。 */
@media (min-height: 900px) {
  .field { height: min(124vw, 52svh, 520px); }
}
@media (min-width: 600px) {
  #result { padding: 22px; }
  #result h2 { font-size: 27px; margin: 20px 0; }
  #result .result-score strong { font-size: 64px; line-height: 1.2; }
  #result .result-detail { margin: 4px 0 10px; font-size: 13px; line-height: 1.9; }
  #result .intro-card p.best { margin: 4px 0 18px; font-size: 13px; }
  #result .primary { min-height: 48px; }
  #result .result-link { min-height: 56px; margin-top: 10px; padding: 8px 16px; }
  .telop { font-size: 12px; left: 10px; bottom: 10px; }
  .app { padding: 0 28px 28px; }
  .header { height: 76px; }
  .brand { font-size: 21px; }
  .edition { display: block; }
  .scoreboard { padding: 18px 4px; }
  .field { height: 450px; }
  .intro-card { max-width: 380px; }
  h1 { font-size: 48px; }
  .intro-card p { font-size: 14px; }
  .status-row p { font-size: 13px; }
  .answer { font-size: 18px; }
  .field-top { font-size: 12px; }
  .view-caption { font-size: 10px; }
}
/* 装飾の動きはJSのmatchMediaでも省略し、スロー観察は利用できる。 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* タイトルはスマートフォンの画面高に収める。 */
.title-screen { overflow: hidden; background: #080a12; }
.title-screen .app { height: 100svh; max-width: none; padding: 0; }
.title-screen .header, .title-screen .scoreboard, .title-screen .decision,
.title-screen .field-top, .title-screen .legend,
.title-screen .view-caption { display: none; }
.title-screen .field { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; }
.title-screen #intro { z-index: 3; display: block; padding: 0; background: #080a1266; }
.title-screen #intro::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, transparent 0 3px, #0008 3px 4px); opacity: .1; }
.retro-title { position: relative; z-index: 1; width: min(100%, 520px); height: 100%; margin: auto; display: flex; flex-direction: column; align-items: center; padding: max(20px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); color: #fff8ed; text-align: center; font-family: "Courier New", monospace; font-weight: 900; }
.retro-score { font-size: clamp(13px, 3.8vw, 19px); letter-spacing: .1em; text-shadow: 2px 2px #080a12; }
.retro-logo { width: min(100%, 420px); margin: clamp(22px, 6svh, 54px) 0 0; line-height: 0; animation: logo-drop .6s ease-out both; }
.retro-logo img { display: block; width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.retro-menu { display: flex; flex-direction: column; align-items: center; width: 100%; margin: auto 0; }
.push-start { font-size: clamp(17px, 5vw, 24px); letter-spacing: .12em; color: #f85898; margin-bottom: 10px; animation: retro-blink 1.1s steps(1) infinite; }
.retro-item { position: relative; display: block; width: min(100%, 290px); min-height: 52px; border: 0; padding: 6px 8px 6px 29px; background: #080a12ce; color: #fff8ed; font-family: "Courier New", monospace; font-weight: 900; font-size: clamp(17px, 5vw, 21px); letter-spacing: -.07em; text-align: left; text-shadow: 2px 2px #080a12; }
.retro-item .cursor { visibility: hidden; position: absolute; left: 5px; color: #f85898; animation: retro-blink .7s steps(1) infinite; }
.retro-item.selected .cursor { visibility: visible; }
.retro-item:focus-visible, .how-box button:focus-visible { outline: 3px solid #f85898; outline-offset: 2px; }
.retro-footer { display: flex; flex-direction: column; gap: 5px; font-size: clamp(10px, 2.8vw, 13px); letter-spacing: .03em; text-shadow: 2px 2px #080a12; }
.how-window { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 16px; background: #080a12d9; }
.how-box { width: min(100%, 400px); border: 4px solid #fff8ed; box-shadow: 0 0 0 4px #080a12, 8px 8px 0 #3878f8; background: #10152a; padding: 20px 18px; color: #fff8ed; font-family: "Courier New", "Hiragino Kaku Gothic ProN", sans-serif; text-align: left; }
.how-box h2 { margin: 0 0 16px; color: #58d8f8; font-size: 20px; }
.how-box p { margin: 0 0 14px; line-height: 1.8; font-size: 15px; font-weight: 700; }
.how-box button { display: block; min-width: 100px; min-height: 44px; margin: 12px 0 0 auto; border: 2px solid #fff8ed; background: #3878f8; color: #fff; font: 900 16px "Courier New", monospace; }
@keyframes logo-drop { 0% { opacity: 0; transform: translateY(-42px); } 65% { opacity: 1; transform: translateY(8px); } 82% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
@keyframes retro-blink { 50% { opacity: 0; } }
@media (min-width: 600px) {
  .retro-title { padding-top: 28px; padding-bottom: 24px; }
  .retro-logo { margin-top: 48px; }
  .retro-item { width: 320px; }
  .retro-footer { flex-direction: row; gap: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .retro-logo, .push-start, .retro-item .cursor { animation: none; }
}

/* タイトルの文字は端末の太いゴシック体で描く。 */
.retro-title { padding-left: 0; padding-right: 0; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
.retro-logo { width: min(78%, 350px); margin-top: clamp(100px, 17svh, 150px); margin-bottom: clamp(8px, 2svh, 20px); filter: drop-shadow(0 0 22px #080a12) drop-shadow(0 0 32px #080a12); }
.retro-score, .retro-footer { filter: drop-shadow(0 0 12px #080a12) drop-shadow(0 0 22px #080a12); }
.retro-score, .push-start { font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif; font-weight: 800; }
.retro-score { font-size: 19px; }
.retro-menu { gap: 1px; margin: clamp(8px, 2svh, 18px) 0 0; background: radial-gradient(ellipse at center, #080a12e8, #080a1200 74%); }
.push-start { order: 3; margin: 12px 0 0; font-size: 21px; animation: retro-blink 1s steps(1) infinite; }
.retro-item { display: flex; align-items: center; width: max-content; max-width: calc(100% - 32px); min-height: 50px; padding: 4px 0 4px 32px; justify-content: flex-start; background: transparent; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; font-size: 34px; font-weight: 800; letter-spacing: -.07em; text-shadow: none; filter: drop-shadow(0 0 13px #080a12) drop-shadow(0 0 22px #080a12); }
.retro-item .cursor { left: 0; font-size: 20px; }
.retro-footer { align-items: center; gap: 0; margin-top: auto; font-size: 12px; font-weight: 600; opacity: .85; line-height: 1.4; }
.how-box { width: min(100%, 400px); padding: 24px 16px 18px; border: 4px solid #fff8ed; outline: 4px solid #080a12; box-shadow: inset 0 0 0 4px #080a12, inset 0 0 0 7px #fff8ed, 7px 7px 0 #080a12; background: #080a12; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
.how-box h2 { margin-bottom: 22px; font-size: 27px; font-weight: 800; color: #fff8ed; }
.how-box p { font-size: 19px; font-weight: 650; line-height: 1.5; }
.how-box button { display: flex; align-items: center; gap: 4px; min-width: 104px; min-height: 44px; margin: 12px 0 0 auto; border: 0; padding: 5px 7px; background: transparent; font: 800 27px "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
.how-cursor { color: #f85898; font-size: 17px; }
@media (min-width: 600px) { .retro-footer { flex-direction: row; gap: 30px; } }
@media (prefers-reduced-motion: reduce) { .push-start { animation: none; } }
