* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #191a30; color: #ffe9cf; font-family: system-ui, sans-serif; }
main { height: 100dvh; padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-rows: 58px minmax(0, 1fr) 70px; gap: 6px; }
header, footer { display: flex; align-items: center; gap: 8px; }
header { justify-content: space-between; }
h1 { font-size: 21px; margin: 0; letter-spacing: -.6px; }
header span { font-size: 12px; color: #c1b3cd; }
#clock { font-size: 23px; font-variant-numeric: tabular-nums; }
#stage { position: relative; min-height: 0; overflow: hidden; border-radius: 20px; background: #252741; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#message { position: absolute; top: 12px; left: 8px; right: 8px; text-align: center; pointer-events: none; font-size: 12px; text-shadow: 0 1px 3px #191a30; }
footer p { flex: 1; font-size: 11px; line-height: 1.45; margin: 0; }
button { min-width: 52px; min-height: 46px; padding: 8px; border: 1px solid #b38c81; border-radius: 14px; background: #483442; color: #ffe9cf; font: inherit; font-size: 13px; touch-action: manipulation; cursor: pointer; }
button:focus-visible, #stage:focus-visible { outline: 3px solid #ffd38c; outline-offset: -3px; }
#veil { position: absolute; inset: 0; background: #191a30da; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#veil[hidden] { display: none; }
#resume { min-width: 120px; }
@media (orientation: landscape) and (max-height: 500px) {
  main { grid-template-columns: 170px minmax(0, 1fr); grid-template-rows: 1fr 1fr; }
  header { grid-column: 1; align-self: end; flex-wrap: wrap; }
  #stage { grid-column: 2; grid-row: 1 / 3; }
  footer { grid-column: 1; flex-wrap: wrap; align-content: start; }
  footer p { flex-basis: 100%; }
}

/* Warm brass framing around the quiet indigo workshop. */
body { background: radial-gradient(ellipse at top, #393047, #141827); }
#stage { border: 1px solid #887080; }
#message { padding: 7px 9px; border-radius: 12px; background: #191a30b8; }
button, .back { background: linear-gradient(#634553, #392f42); box-shadow: 0 3px 0 #101322; }
.back { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 14px; color: #ffe9cf; text-decoration: none; }
body[data-release] main { grid-template-rows: 58px minmax(0, 1fr) 94px; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
body[data-release] h1 { font-size: clamp(15px, 4.6vw, 21px); }
body[data-release] footer { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
body[data-release] footer p { flex-basis: 100%; }
#save-status { position: fixed; bottom: 2px; margin: 0; width: 100%; text-align: center; font-size: 10px; }
dialog { width: min(350px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow: auto; border: 1px solid #d9aa74; border-radius: 22px; background: #29253e; color: #ffe9cf; padding: 22px; text-align: center; box-shadow: 0 20px 80px #080a18; }
dialog::backdrop { background: #101322b8; }
dialog h2 { margin: 8px 0; font-size: 23px; }
dialog p { font-size: 14px; line-height: 1.5; }
dialog button { margin: 4px; }
.seal { color: #ffcb85; font-size: 34px; }
@media (orientation: landscape) and (max-height: 500px) {
  body[data-release] main { grid-template-rows: 1fr 1fr; }
  body[data-release] footer { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto; transition: none !important; animation: none !important; } }
