* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #14152f; color: #fff0cd; font-family: system-ui, sans-serif; }
main { height: 100dvh; display: grid; grid-template-rows: 60px minmax(0, 1fr) 86px; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom)); }
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 19px; margin: 0; letter-spacing: -.6px; }
header span { color: #d6ab94; font-size: 12px; }
#clock { font-size: 23px; font-variant-numeric: tabular-nums; }
#stage { position: relative; min-height: 0; border-radius: 24px; overflow: hidden; touch-action: none; background: #222347; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#message { position: absolute; top: 10px; left: 10px; right: 10px; text-align: center; font-size: 12px; pointer-events: none; }
footer p { font-size: 10px; line-height: 1.6; flex: 1; }
button { min-width: 54px; min-height: 46px; border: 1px solid #be8c6e; border-radius: 14px; padding: 8px; background: #363251; color: inherit; font: inherit; font-size: 13px; touch-action: manipulation; }
button:focus-visible, #stage:focus-visible { outline: 3px solid #d1f878; outline-offset: -3px; }
#veil { position: absolute; inset: 0; background: #17162fc9; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 16px; }
#veil[hidden] { display: none; }
#stage.finished #veil { top: auto; background: #17162fc9; padding: 8px; }
#veil p { margin: 0 0 8px; }
@media (orientation: landscape) and (max-height: 500px) {
 main { grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: 1fr 1fr; }
 #stage { grid-column: 2; grid-row: 1 / 3; }
 header, footer { flex-wrap: wrap; } footer p { flex-basis: 100%; }
}
/* Production framing leaves the complete wheel and every control in view. */
body[data-production] { background: radial-gradient(ellipse at top, #30304d, #111427 75%); }
body[data-production] main { grid-template-rows: 70px minmax(0, 1fr) 155px; }
body[data-production] header > div { flex: 1; min-width: 0; }
body[data-production] h1 { font-size: 19px; line-height: 1.05; letter-spacing: -.4px; }
body[data-production] header span { font-size: 10px; }
.back { min-width: 44px; height: 46px; display: grid; place-items: center; border: 1px solid #be8c6e; border-radius: 14px; color: inherit; text-decoration: none; }
body[data-production] #stage { box-shadow: inset 0 0 0 1px #b9896450, 0 10px 35px #090e2040; background: radial-gradient(ellipse at 30% 20%, #4c3954, #20233f 60%, #151a32); }
body[data-production] footer { display: block; }
body[data-production] footer p { margin: 0 0 6px; line-height: 1.45; }
nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
nav button { padding: 6px; }
button { cursor: pointer; }
#loading, #graphics-error { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; padding: 16px; background: #171b35f2; }
#loading[hidden], #graphics-error[hidden] { display: none; }
#graphics-error button { justify-self: center; }
dialog { width: min(340px, calc(100vw - 24px)); padding: 18px; border: 1px solid #be8c6e; border-radius: 20px; background: #24243e; color: #fff0cd; }
dialog::backdrop { background: #101329c9; }
dialog h2 { font-size: 21px; margin: 0; }
dialog div { display: flex; gap: 8px; }
dialog button { flex: 1; }
@media (orientation: landscape) and (max-height: 500px) {
 body[data-production] main { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 90px minmax(0, 1fr); }
 body[data-production] header { flex-wrap: nowrap; gap: 6px; }
 body[data-production] h1 { font-size: 16px; }
 body[data-production] nav { grid-template-columns: repeat(2, 1fr); }
 body[data-production] #message { top: 0; font-size: 11px; }
}
