:root {
  color-scheme: light;
  --ink: #514d41;
  --muted: #827b6c;
  --line: #514d4125;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: #faf8f2; color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #789078; outline-offset: 5px; }
button:disabled { cursor: default; }
button svg { width: 20px; height: 20px; flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
#game { position: relative; width: 100%; height: 100%; height: 100svh; min-height: 440px; overflow: hidden; isolation: isolate; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: manipulation; }

/* The source logo stays intact. Multiply removes its white backing visually. */
.topbar { position: absolute; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 28px 44px; z-index: 5; mix-blend-mode: multiply; }
.wordmark { display: flex; align-items: center; gap: 22px; }
.wordmark img { width: 106px; height: auto; display: block; }
.game-name { padding: 5px 0 5px 22px; border-left: 1px solid var(--line); font-size: 14px; font-weight: 400; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; }
.best { display: flex; align-items: center; gap: 7px; margin-right: 16px; font-size: 12px; letter-spacing: .05em; }
.best svg { width: 17px; height: 17px; }
.best strong { font-size: 16px; font-weight: 500; margin-left: 5px; font-variant-numeric: tabular-nums; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; background: transparent; font-size: 18px; transition: background .2s; }
.icon-button:hover { background: #27302108; }
.icon-button svg { width: 18px; height: 18px; }
.sound-on { display: none; }
[aria-pressed=true] .sound-off { display: none; }
[aria-pressed=true] .sound-on { display: initial; }

.intro, .result { position: absolute; left: 9%; top: 27%; z-index: 2; max-width: 440px; animation: fade-in .5s ease-out both; }
h1 { font-size: clamp(70px, 7.8vw, 116px); line-height: 1; letter-spacing: -.065em; font-weight: 400; margin: 0 0 24px; }
h1 em, h2 em { font: inherit; color: #76846b; }
.intro-copy { font-size: 17px; line-height: 1.6; margin: 0; color: var(--muted); }
.start-actions { margin-top: 32px; display: inline-flex; flex-direction: column; align-items: center; }
.primary-button { min-height: 54px; min-width: 198px; padding: 0 23px; display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: #fafbf5; font-size: 15px; font-weight: 400; transition: background .2s, transform .2s; touch-action: manipulation; }
.primary-button:hover { background: #414c39; transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }
.key-hint { font-size: 12px; color: var(--muted); margin: 13px 0 0; }
kbd { font-family: inherit; font-size: 12px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; margin-left: 2px; }
.footer { position: absolute; bottom: 26px; left: 44px; right: 44px; text-align: center; pointer-events: none; font-size: 12px; color: #87917f; }
[data-screen=playing] .footer { display: none; }

.hud { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 3; min-width: 260px; }
.score { font-size: 76px; line-height: 1; letter-spacing: -.055em; font-weight: 300; font-variant-numeric: tabular-nums; }
.score.bump { animation: score-pop .23s ease-out; }
.score-label { font-size: 14px; color: var(--muted); margin: 7px 0 0; }
.feedback { font-size: 16px; min-height: 26px; margin-top: 20px; color: #5e775c; opacity: 0; transition: opacity .15s; }
.feedback.show { opacity: 1; }
.feedback.bonus { color: #a56d3c; }
.play-hint { position: absolute; left: 24px; right: 24px; bottom: max(30px, env(safe-area-inset-bottom)); z-index: 3; margin: 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.4; pointer-events: none; user-select: none; }
.touch-hint { display: none; }
@media (max-width: 600px), (pointer: coarse) {
  .pointer-hint { display: none; }
  .touch-hint { display: inline; }
}

.eyebrow { font-size: 12px; font-weight: 400; letter-spacing: .04em; line-height: 1.7; margin: 0 0 22px; color: var(--muted); }
.result { top: 24%; }
.result h2, dialog h2 { font-size: 66px; line-height: 1.02; font-weight: 400; letter-spacing: -.055em; margin: 0 0 25px; }
.result-score { display: flex; gap: 18px; align-items: center; margin: 15px 0; }
.result-score>strong { font-size: 64px; line-height: 1; font-weight: 300; letter-spacing: -.05em; }
.result-score>span { font-size: 14px; line-height: 1.6; color: var(--muted); }
.result-detail { font-size: 14px; color: var(--muted); margin: 18px 0 28px; }
.text-button { display: block; padding: 14px 4px; margin: 7px 0 0; border: 0; background: none; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; color: var(--muted); }
.text-button:hover { color: var(--ink); }
dialog { max-width: min(480px, calc(100vw - 36px)); max-height: calc(100svh - 40px); border: 1px solid #27302110; padding: 42px 40px 35px; border-radius: 16px; color: var(--ink); background: #f8f9f4; box-shadow: 0 20px 100px #27302115; }
dialog::backdrop { background: #27302122; backdrop-filter: blur(8px); }
dialog h2 { font-size: 52px; }
.close-button { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; font-size: 24px; }
.rules { list-style: none; margin: 0 0 25px; padding: 0; }
.rules li { margin: 22px 0; }
.rules strong { display: block; font-size: 16px; font-weight: 500; margin-bottom: 6px; }
.rules span, .dialog-note { font-size: 16px; line-height: 1.6; color: var(--muted); }
.dialog-note { margin-bottom: 24px; }
dialog .primary-button { width: 100%; justify-content: center; }
#pause-dialog { text-align: center; width: 380px; }
#pause-dialog .text-button { margin: 12px auto 0; }
.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; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes score-pop { 50% { transform: scale(1.1); } }

@media (min-width: 1500px) {
  .intro, .result { left: 12%; }
  .topbar { padding: 36px 60px; }
}
@media (max-width: 850px) {
  .topbar { padding: 24px; }
  .intro, .result { left: 6%; max-width: 350px; }
  h1 { font-size: 74px; }
}
@media (max-width: 600px) {
  #game { min-height: 500px; }
  .topbar { padding: max(18px, env(safe-area-inset-top)) 20px 0; }
  .wordmark { gap: 12px; }
  .wordmark img { width: 82px; }
  .game-name { padding: 4px 0 4px 12px; font-size: 12px; }
  .toolbar { gap: 3px; }
  .icon-button { width: 34px; height: 34px; }
  .best { font-size: 12px; gap: 4px; margin-right: 5px; }
  .best svg { display: none; }
  .best strong { font-size: 14px; margin-left: 2px; }
  [data-screen=playing] .game-name { display: none; }
  .intro, .result { left: 20px; right: 20px; top: 110px; max-width: none; text-align: center; }
  h1 { font-size: 54px; line-height: 1; margin: 0 0 16px; }
  .intro-copy { font-size: 16px; }
  .intro-copy br { display: none; }
  .start-actions { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); margin: 0; min-width: 220px; }
  .start-actions .primary-button { width: 100%; }
  .key-hint { font-size: 12px; margin-top: 12px; }
  .footer { left: 20px; right: 20px; bottom: max(23px, env(safe-area-inset-bottom)); font-size: 12px; }
  .hud { top: 94px; min-width: 230px; }
  .score { font-size: 64px; }
  .score-label { font-size: 14px; }
  .feedback { font-size: 14px; margin-top: 18px; }
  .result { top: 100px; }
  .result .eyebrow { font-size: 12px; margin-bottom: 12px; }
  .result h2 { font-size: 46px; margin-bottom: 14px; }
  .result h2 br { display: none; }
  .result h2 em { margin-left: .1em; }
  .result-score { justify-content: center; gap: 12px; margin: 10px 0; }
  .result-score>strong { font-size: 46px; }
  .result-score>span { font-size: 14px; text-align: left; }
  .result-detail { font-size: 14px; margin: 10px 0; }
  .result>.primary-button { position: fixed; bottom: 111px; left: 50%; transform: translateX(-50%); width: 220px; }
  .result>.text-button { position: fixed; bottom: 66px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .result>.primary-button:hover { transform: translateX(-50%); }
  dialog { padding: 34px 25px 25px; }
  dialog h2 { font-size: 44px; }
}
@media (max-width: 370px) {
  .game-name { display: none; }
  h1 { font-size: 48px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-height: 700px) and (min-width: 601px) {
  .topbar { padding-top: 20px; }
  .intro, .result { top: 24%; }
  h1 { font-size: 76px; }
  .start-actions { margin-top: 24px; }
  .hud { top: 85px; }
  .score { font-size: 56px; }
  .result h2 { font-size: 52px; }
  .result-score>strong { font-size: 48px; }
  .result-detail { margin: 10px 0 20px; }
  .result .eyebrow { margin-bottom: 15px; }
}
@media (max-height: 700px) and (max-width: 600px) {
  .intro { top: 90px; }
  h1 { font-size: 46px; margin-bottom: 12px; }
  .start-actions { bottom: 61px; }
  .start-actions .primary-button { min-height: 48px; }
  .start-actions .key-hint { margin-top: 8px; }
  .hud { top: 80px; }
  .score { font-size: 52px; }
  .feedback { margin-top: 14px; }
  .result { top: 82px; }
  .result h2 { font-size: 36px; }
  .result>.primary-button { bottom: 90px; min-height: 48px; }
  .result>.text-button { bottom: 45px; }
  .footer { bottom: 15px; }
  [data-screen=result] .footer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; }
}

.website-return { pointer-events: auto; color: #54634c; text-decoration: underline; text-underline-offset: 4px; }
