:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #fff2d6;
  background: #172720;
  font-synthesis: none;
  --paper: #fff2d6;
  --lime: #d7ed78;
  --muted: #b6c3aa;
  --edge: #4a5943;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
main { width: min(100% - 28px, 590px); margin-inline: auto; padding: 14px 0 22px; }
.masthead, .game-header, .stats { display: flex; align-items: center; }
.masthead { justify-content: space-between; border-bottom: 1px solid var(--edge); padding-bottom: 10px; }
a { color: var(--muted); text-decoration: none; font-size: .85rem; }
a:hover { color: var(--lime); }
.brand { color: var(--paper); font-size: .94rem; font-weight: 850; }
.brand span, h1 span { color: var(--lime); }
.game-header { justify-content: space-between; gap: 12px; padding: 10px 0; }
h1 { margin: 0; font-size: clamp(1.65rem, 6vw, 3rem); font-weight: 950; letter-spacing: -.075em; line-height: 1; }
.stats { gap: clamp(7px, 2.8vw, 21px); margin: 0; }
.stats div { text-align: center; min-width: 33px; }
dt { color: var(--muted); font-size: clamp(.62rem, 2.5vw, .73rem); }
dd { margin: 0; font: 800 clamp(1rem, 3vw, 1.4rem) ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.stats div:last-child dd { color: var(--lime); }
.frame { position: relative; overflow: hidden; border-radius: 17px; border: 2px solid #617751; background: #709358; box-shadow: 0 8px 0 #111b15; }
canvas { display: block; width: 100%; aspect-ratio: 1; touch-action: manipulation; cursor: pointer; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: #1019148c; }
.overlay[hidden] { display: none; }
.dialog { text-align: center; max-width: 335px; background: #182720; border: 1px solid #778669; border-radius: 18px; padding: clamp(16px, 5vw, 30px); box-shadow: 0 8px 24px #10191466; }
h2 { font-size: clamp(1.25rem, 5vw, 1.9rem); margin: 0 0 8px; line-height: 1.05; letter-spacing: -.04em; }
.dialog p { margin: 0 0 17px; color: var(--muted); font-size: .91rem; line-height: 1.4; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.play { background: var(--lime); color: #253119; font-weight: 850; border: 0; border-radius: 9px; padding: 10px 24px; }
.play:hover { background: #e8ffa0; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.controls button { min-height: 44px; border: 1px solid var(--edge); background: #22352a; border-radius: 8px; color: var(--paper); font-size: 1.25rem; }
.controls button:hover, .controls button:active { background: #3b5034; color: var(--lime); }
.hint { color: var(--muted); font-size: .8rem; margin: 9px 0 0; text-align: center; }
@media (min-width: 640px) and (max-height: 820px) {
  main { width: clamp(310px, calc(100dvh - 238px), 590px); }
}
