* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #17172e; color: #fff0ce; font: 14px system-ui, sans-serif; }
#stage { position: relative; width: 100%; height: 100dvh; overflow: hidden; }
canvas, #field { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { z-index: 1; touch-action: none; user-select: none; }
header { position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; pointer-events: none; }
small { color: #8de0bd; font-size: 9px; letter-spacing: 1.5px; }
h1 { margin: 5px 0; font-size: 24px; font-weight: 600; }
#clock { position: absolute; right: 0; top: 23px; font-size: 24px; font-variant-numeric: tabular-nums; }
#message { position: absolute; z-index: 2; top: 76px; width: 92%; left: 4%; text-align: center; color: #ffd480; pointer-events: none; font-size: 12px; }
footer { position: absolute; z-index: 2; bottom: max(12px, env(safe-area-inset-bottom)); width: 100%; text-align: center; pointer-events: none; }
#help { line-height: 1.5; font-size: 11px; text-shadow: 0 1px 4px #17172e; }
nav { display: flex; gap: 10px; justify-content: center; }
button { min-width: 90px; min-height: 44px; border: 1px solid #8de0bd; border-radius: 24px; background: #30283f; color: #fff0ce; font: inherit; pointer-events: auto; }
:focus-visible { outline: 2px solid #ffd480; outline-offset: -3px; }
#completion { position: absolute; z-index: 2; top: 22%; width: 100%; text-align: center; pointer-events: none; }
#completion strong { font-size: 23px; }
#error { position: absolute; z-index: 3; top: 40%; padding: 24px; background: #30283f; }
[hidden] { display: none !important; }
@media (max-width: 350px) { h1 { font-size: 21px; } }
@media (max-height: 500px) {
  header { top: 6px; width: 30%; } h1 { font-size: 20px; } small { letter-spacing: 0; }
  #clock { top: 60px; left: 0; font-size: 18px; }
  #message { top: 8px; left: 65%; width: 32%; }
  footer { width: 32%; right: 0; bottom: 8px; } #help { font-size: 10px; }
  #completion { width: 30%; top: 38%; } #completion strong { font-size: 18px; }
}

body[data-production] { background: #171428; }
body[data-production] header small { color: #9ad9bb; }
body[data-production] nav { flex-wrap: wrap; gap: 6px; padding: 0 8px; }
body[data-production] button { min-width: 44px; padding: 8px 12px; background: linear-gradient(#49334c,#2b233b); box-shadow: inset 0 1px #b68b5966; }
#storage, #reward-status { margin: 4px 8px 0; font-size: 10px; color: #c7c0cb; }
#reward-status:empty { display: none; }
dialog { max-width: min(90vw,360px); border: 1px solid #d6a463; border-radius: 20px; background: #30243d; color: #fff0ce; padding: 20px; }
dialog::backdrop { background: #100d20bb; }
dialog button { margin: 4px; }
#loading { position: absolute; z-index: 4; top: 40%; width: 100%; text-align: center; }
body[data-production] #completion { background: #241a36e8; border-block: 1px solid #b58c58; padding: 16px; }
@media (max-height:500px) { body[data-production] footer { width: 34%; } body[data-production] #help { font-size: 9px; } body[data-production] nav { gap: 4px; } body[data-production] button { font-size: 11px; padding: 6px 8px; } }
@media (prefers-reduced-motion:reduce) { * { scroll-behavior: auto; } }
