:root { color-scheme: light; --ink:#1b3037; --muted:#63777d; --paper:#eaf0f2; --line:#ccd8db; --acid:#e8f174; --red:#ce573f; --white:#fff; font-family:-apple-system,BlinkMacSystemFont,"Yu Gothic","Hiragino Kaku Gothic ProN",Meiryo,sans-serif; }
* { box-sizing:border-box; }
body { margin:0; background:var(--paper); color:var(--ink); -webkit-font-smoothing:antialiased; }
button,a { -webkit-tap-highlight-color:transparent; }
button { font:inherit; color:inherit; cursor:pointer; }
button:focus-visible,a:focus-visible { outline:3px solid #507994; outline-offset:5px; }
[hidden] { display:none !important; }
.game { width:min(100%,780px); margin:auto; padding:max(24px,env(safe-area-inset-top)) 32px max(20px,env(safe-area-inset-bottom)); }
.masthead { display:flex; align-items:center; justify-content:space-between; padding-bottom:17px; border-bottom:1px solid var(--line); }
.wordmark { position:relative; color:var(--ink); text-decoration:none; font-size:19px; font-weight:900; letter-spacing:-.055em; }
.wordmark-flap { display:inline-block; width:12px; height:12px; margin-left:8px; background:var(--acid); border-right:1px solid var(--ink); border-bottom:1px solid var(--ink); transform:skewY(-14deg); }
.masthead-actions { display:flex; gap:10px; }
.icon-button { width:42px; height:42px; border:1px solid var(--line); background:transparent; border-radius:50%; display:grid; place-items:center; touch-action:manipulation; }
.icon-button svg { width:20px; height:20px; }
.icon-button:disabled { opacity:.4; cursor:default; }
.sound-button .sound-off,.sound-button[aria-pressed="false"] .sound-on { display:none; }
.sound-button[aria-pressed="false"] .sound-off { display:block; }
.intro { text-align:center; padding:34px 0 7px; }
.eyebrow { margin:0; font-size:13px; letter-spacing:.13em; font-weight:700; }
.tiny-roll { display:inline-block; width:13px; height:13px; border:2px solid var(--ink); border-radius:50%; vertical-align:-2px; margin-right:8px; box-shadow:inset 0 0 0 2px var(--paper),inset 0 0 0 3px var(--ink); }
h1 { position:relative; display:inline-block; margin:12px 0 7px; font-size:clamp(40px,8vw,64px); line-height:1.3; letter-spacing:-.075em; font-weight:900; }
.title-flap { position:absolute; right:-15px; top:1px; width:23px; height:24px; background:var(--acid); transform:rotate(10deg) skewY(-8deg); clip-path:polygon(0 0,100% 0,100% 100%,0 74%); border-top:2px solid var(--ink); }
.intro-copy { font-size:16px; margin:5px 0 0; line-height:1.65; }
.material-heading { display:flex; align-items:center; justify-content:center; gap:10px; font-size:14px; font-weight:700; padding-top:18px; }
.material-no { color:var(--muted); font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:12px; font-weight:400; }
.material-tag { color:var(--muted); padding-left:10px; border-left:1px solid var(--line); font-size:12px; font-weight:400; }
.roll-stage { position:relative; margin:3px -16px 0; height:360px; isolation:isolate; }
canvas { display:block; width:100%; height:100%; }
.stage-note { position:absolute; bottom:8px; left:0; width:100%; text-align:center; color:var(--muted); font-size:13px; pointer-events:none; }
.stage-feedback { position:absolute; top:14px; left:50%; transform:translateX(-50%); min-width:100px; text-align:center; font-size:15px; font-weight:800; border-radius:4px; pointer-events:none; white-space:nowrap; opacity:0; }
.stage-feedback.visible { opacity:1; padding:7px 16px; }
.stage-feedback.success { background:var(--acid); color:var(--ink); }
.stage-feedback.miss { color:var(--white); background:var(--red); }
.stage-feedback.pass { color:var(--ink); background:#d5e2e6; }
.lock-scrim { position:absolute; bottom:13px; left:50%; transform:translateX(-50%); width:160px; display:none; text-align:center; font-size:13px; color:var(--red); }
.lock-track { height:3px; margin-top:9px; background:#efd5d0; overflow:hidden; }
.lock-track i { display:block; height:100%; width:100%; background:var(--red); transform-origin:left; }
.game[data-state="MISS_LOCK"] .lock-scrim { display:block; }
.game[data-state="MISS_LOCK"] .stage-note { visibility:hidden; }
.game[data-state="MISS_LOCK"] .roll-stage { animation:miss-shake .24s ease-out; }
.scoreboard { position:relative; display:flex; justify-content:space-between; align-items:end; padding:24px 4px 18px; }
.stat-label { display:block; font-size:13px; font-weight:600; color:var(--muted); margin-bottom:0; }
.time-stat strong,.found-stat strong { font-family:Arial,Helvetica,sans-serif; font-weight:800; font-variant-numeric:tabular-nums; line-height:1.05; letter-spacing:-.07em; }
.time-stat strong { font-size:64px; }
.found-stat { text-align:right; }
.found-stat strong { font-size:50px; }
.small-unit { font-family:inherit; font-size:14px; font-weight:500; letter-spacing:0; margin-left:7px; }
.timer-track { position:absolute; left:0; right:0; height:4px; bottom:0; background:#d3dfe2; }
.timer-track span { display:block; width:100%; height:100%; background:var(--ink); transform-origin:left; }
.game.urgent #timer,.game.urgent .stat-label:first-child { color:var(--red); }
.game.urgent #timer-fill { background:var(--red); }
.play-controls { display:grid; grid-template-columns:1fr .85fr 1fr; gap:20px; max-width:450px; margin:0 auto; }
.turn-button { height:72px; border:1px solid #b8c8cc; border-bottom:3px solid #a9bbc0; border-radius:14px; background:#dce7ea; display:flex; align-items:center; justify-content:center; gap:12px; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:none; }
.turn-button span { font-size:30px; line-height:1; }
.turn-button small { font-size:13px; }
.turn-button:active,.turn-button.is-held { background:#cbdbe0; transform:translateY(2px); border-bottom-width:1px; }
.pass-button { border:1px dashed #a9bbc0; background:transparent; border-radius:14px; height:72px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; touch-action:manipulation; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.pass-button span { font-size:16px; font-weight:750; letter-spacing:.06em; }
.pass-button small { font-size:12px; color:var(--muted); }
.pass-button:disabled { cursor:default; opacity:.42; }
.pass-button:not(:disabled) { border-style:solid; border-color:var(--ink); background:var(--acid); }
.turn-button:disabled { cursor:default; opacity:.45; transform:none; }
.tap-hint { text-align:center; margin:16px 0 0; font-size:15px; font-weight:700; }
.tap-hint span { display:block; margin-top:6px; color:var(--muted); font-size:12px; font-weight:400; }
.game[data-screen="play"] canvas { cursor:crosshair; touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.start-actions { max-width:450px; margin:8px auto 0; }
.how-to { display:flex; justify-content:center; gap:34px; padding:0 0 18px; }
.how-to p { margin:0; font-size:15px; font-weight:600; white-space:nowrap; }
.how-to span { font-family:ui-monospace,Consolas,monospace; color:var(--muted); font-size:12px; margin-right:8px; }
.primary-button { width:100%; border:0; background:var(--ink); color:var(--acid); border-radius:14px; padding:17px 24px; font-size:24px; font-weight:800; letter-spacing:.06em; box-shadow:0 4px 0 #0b2027; touch-action:manipulation; }
.primary-button span { display:block; font-size:12px; font-weight:500; letter-spacing:.04em; color:#d9e5e7; margin-top:4px; }
.primary-button:active { transform:translateY(2px); box-shadow:0 2px 0 #0b2027; }
.fine-print { text-align:center; color:var(--muted); font-size:12px; margin:15px 0 0; line-height:1.6; }
.fine-print span { margin:0 8px; color:#a6b5b9; }
.footer { display:flex; justify-content:space-between; color:var(--muted); font-size:12px; border-top:1px solid var(--line); margin-top:30px; padding-top:14px; }
.result { padding:52px 0 22px; text-align:center; max-width:450px; margin:auto; }
.result .eyebrow { letter-spacing:.18em; }
.result-line { margin:15px 0 20px; font-size:18px; font-weight:700; }
.result-score { display:flex; justify-content:center; align-items:baseline; gap:13px; margin:0 -15px; }
.result-score >span { font-size:21px; font-weight:700; }
.result-score strong { position:relative; font-size:132px; font-family:Arial,Helvetica,sans-serif; font-weight:800; line-height:1; letter-spacing:-.065em; z-index:0; }
.result-score strong:after { content:""; position:absolute; bottom:9px; left:-10px; right:-14px; height:27px; background:var(--acid); transform:rotate(-3deg); z-index:-1; }
.result-caption { font-size:13px; color:var(--muted); margin:12px 0 34px; }
.result-details { display:grid; grid-template-columns:repeat(3,1fr); padding:22px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); margin-bottom:32px; }
.result-details >div+div { border-left:1px solid var(--line); }
.result-details span { display:block; font-size:13px; color:var(--muted); margin-bottom:8px; }
.result-details strong { font-size:26px; font-weight:750; }
.result-details small { font-size:12px; margin-left:5px; font-weight:500; }
.text-button { border:0; background:transparent; padding:17px 24px; color:var(--muted); font-size:14px; margin-top:10px; text-decoration:underline; text-underline-offset:4px; }
@keyframes miss-shake { 0%,100% { transform:translateX(0); } 20%,60% { transform:translateX(-4px); } 40%,80% { transform:translateX(4px); } }
@media (hover:hover) { .primary-button:hover { background:#2b434b; } .icon-button:hover:not(:disabled) { background:#d9e5e8; } .turn-button:hover:not(:disabled) { background:#d1e0e4; } }
@media (min-width:650px) { .game[data-screen="play"] .roll-stage { height:410px; } .game[data-screen="start"] .roll-stage { height:340px; } }
@media (max-width:480px) { .game { padding:15px 20px max(17px,env(safe-area-inset-bottom)); } .masthead { padding-bottom:12px; } .wordmark { font-size:17px; } .icon-button { width:38px; height:38px; } .intro { padding-top:28px; } h1 { font-size:45px; margin-top:10px; } .title-flap { width:17px; height:19px; right:-10px; top:3px; } .intro-copy { font-size:14px; } .material-heading { padding-top:17px; gap:7px; font-size:13px; } .material-tag { font-size:11px; padding-left:7px; } .material-no { font-size:11px; } .roll-stage { height:285px; margin-left:-15px; margin-right:-15px; } .game[data-screen="start"] .roll-stage { height:265px; } .stage-note { bottom:9px; font-size:12px; } .scoreboard { padding-top:21px; padding-bottom:14px; } .time-stat strong { font-size:58px; } .found-stat strong { font-size:46px; } .play-controls { gap:12px; } .turn-button,.pass-button { height:67px; border-radius:12px; } .turn-button { flex-direction:column; gap:2px; } .turn-button small { font-size:11px; } .tap-hint { font-size:14px; margin-top:15px; } .how-to { gap:24px; padding-bottom:17px; } .how-to p { font-size:13px; } .primary-button { padding:15px 20px; font-size:23px; } .fine-print { font-size:11px; } .fine-print span { margin:0 4px; } .footer { font-size:11px; margin-top:24px; } .result { padding-top:43px; } .result-line { font-size:16px; } .result-score strong { font-size:116px; } }
@media (max-width:350px) { .game { padding-left:17px; padding-right:17px; } h1 { font-size:40px; } .material-tag { display:none; } .how-to { gap:18px; } .turn-button,.pass-button { height:62px; } .roll-stage { height:266px; } .game[data-screen="start"] .roll-stage { height:247px; } }
@media (prefers-reduced-motion:reduce) { .game[data-state="MISS_LOCK"] .roll-stage { animation:none; } }
@media (max-width:600px) and (max-height:720px) {
  .game[data-screen="play"] .masthead { padding-bottom:9px; }
  .game[data-screen="play"] .scoreboard { padding-top:13px; padding-bottom:10px; }
  .game[data-screen="play"] .time-stat strong { font-size:50px; }
  .game[data-screen="play"] .found-stat strong { font-size:40px; }
  .game[data-screen="play"] .material-heading { padding-top:12px; }
  .game[data-screen="play"] .roll-stage { height:calc(100vh - 281px - max(15px,env(safe-area-inset-top))); height:calc(100svh - 281px - max(15px,env(safe-area-inset-top))); min-height:180px; max-height:330px; }
  .game[data-screen="play"] .turn-button,.game[data-screen="play"] .pass-button { height:62px; }
  .game[data-screen="play"] .tap-hint { margin-top:12px; }
  .game[data-screen="play"] .tap-hint span,.game[data-screen="play"] .footer { display:none; }
  .game[data-screen="play"] .stage-note { bottom:6px; font-size:11px; }
}
@media (min-width:601px) and (max-height:800px) {
  .game[data-screen="play"] { padding-top:max(16px,env(safe-area-inset-top)); }
  .game[data-screen="play"] .masthead { padding-bottom:10px; }
  .game[data-screen="play"] .scoreboard { padding-top:14px; padding-bottom:12px; }
  .game[data-screen="play"] .time-stat strong { font-size:58px; }
  .game[data-screen="play"] .found-stat strong { font-size:46px; }
  .game[data-screen="play"] .material-heading { padding-top:14px; }
  .game[data-screen="play"] .roll-stage { height:clamp(250px,calc(100vh - 400px),340px); }
  .game[data-screen="play"] .footer { display:none; }
}
@media (max-width:480px) { .game { padding-top:max(15px,env(safe-area-inset-top)); } }

/* ---------- V2 additions ---------- */
.best-line { display:inline-block; margin:12px 0 0; padding:3px 12px; border-radius:999px; background:var(--acid); font-size:13px; font-weight:700; }
#count-value { font:inherit; }
.pause-scrim { position:absolute; inset:0; z-index:3; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:20px; text-align:center; background:rgba(234,240,242,.9); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
.pause-scrim[hidden] { display:none !important; }
.pause-scrim p { margin:0; font-size:26px; font-weight:900; letter-spacing:.08em; }
.pause-scrim span { color:var(--muted); font-size:13px; }
.pause-scrim .primary-button { width:auto; min-width:200px; margin-top:8px; font-size:18px; padding:13px 28px; }
.pause-scrim .text-button { margin-top:0; padding:10px 20px; }
.result-best { display:inline-block; margin:-22px 0 30px; padding:4px 14px; border-radius:999px; border:1px solid var(--line); color:var(--muted); font-size:13px; font-weight:700; }
.result-best.is-new { border-color:var(--ink); background:var(--acid); color:var(--ink); }
.missed { margin:-8px 0 30px; }
.missed h2 { margin:0; font-size:15px; font-weight:800; }
.missed-note { margin:4px 0 12px; color:var(--muted); font-size:12px; }
.missed-list { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.missed-list figure { margin:0; padding:6px 4px 8px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.35); }
.missed-list canvas { height:96px; }
.missed-list figcaption { font-size:11px; font-weight:700; line-height:1.4; }
.missed-list figcaption small { display:block; color:var(--muted); font-weight:400; font-size:10px; }
.share-button { width:100%; margin-top:14px; padding:14px 20px; border:1px solid var(--ink); border-radius:14px; background:transparent; font-size:16px; font-weight:800; touch-action:manipulation; }
@media (hover:hover) { .share-button:hover { background:#d9e5e8; } }
@media (max-width:350px) { .missed-list { grid-template-columns:repeat(2,1fr); } }

/* Phones held sideways: roll on the left, everything else on the right, no scrolling. */
@media (orientation:landscape) and (max-height:520px) {
  .game[data-screen="play"] { width:100%; max-width:960px; height:100vh; height:100svh; padding:max(10px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    display:grid; grid-template-columns:minmax(0,1fr) minmax(250px,36%); grid-template-rows:auto auto auto 1fr auto auto; column-gap:20px; align-content:start; }
  .game[data-screen="play"] .playground { display:contents; }
  .game[data-screen="play"] .masthead { grid-column:2; grid-row:1; padding-bottom:6px; }
  .game[data-screen="play"] .icon-button { width:34px; height:34px; }
  .game[data-screen="play"] .scoreboard { grid-column:2; grid-row:2; padding:8px 2px 10px; }
  .game[data-screen="play"] .time-stat strong { font-size:44px; }
  .game[data-screen="play"] .found-stat strong { font-size:36px; }
  .game[data-screen="play"] .material-heading { grid-column:2; grid-row:3; padding-top:10px; justify-content:flex-start; }
  .game[data-screen="play"] .roll-stage { grid-column:1; grid-row:1 / -1; margin:0; height:auto; min-height:0; max-height:none; }
  .game[data-screen="play"] .play-controls { grid-column:2; grid-row:5; width:100%; gap:10px; }
  .game[data-screen="play"] .turn-button,.game[data-screen="play"] .pass-button { height:58px; }
  .game[data-screen="play"] .turn-button { flex-direction:column; gap:2px; }
  .game[data-screen="play"] .tap-hint { grid-column:2; grid-row:6; margin-top:8px; font-size:13px; }
  .game[data-screen="play"] .tap-hint span,.game[data-screen="play"] .footer { display:none; }
}
