* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { color: #ffedce; background: #161328; font-family: system-ui, sans-serif; }
main { height: 100dvh; display: grid; grid-template-rows: 56px 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: 10px; }
h1 { font-size: 18px; max-width: 240px; margin: 0; }
#clock { font-size: 24px; font-variant-numeric: tabular-nums; }
#stage { position: relative; min-height: 0; overflow: hidden; border-radius: 24px; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#message { position: absolute; top: 8px; left: 8px; right: 8px; text-align: center; font-size: 12px; pointer-events: none; }
footer p { font-size: 10px; line-height: 1.5; flex: 1; }
button { min-height: 46px; min-width: 54px; border: 1px solid #b39182; border-radius: 12px; background: #352840; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #ffe2a3; outline-offset: -3px; }
@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%; }
}

[hidden] { display: none !important; }
body[data-production] { background: #181328; color: #ffedce; }
body[data-production] main { grid-template-rows: 82px minmax(0, 1fr) 166px; gap: 6px; max-width: 1100px; margin: auto; }
body[data-production] header { justify-content: initial; }
body[data-production] header a { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; color: #ffdcaa; text-decoration: none; border: 1px solid #695067; border-radius: 50%; font-size: 24px; }
body[data-production] header small { font-size: 9px; letter-spacing: 1.5px; color: #cbb0c3; }
body[data-production] h1 { font-size: 21px; line-height: 1.1; font-weight: 650; }
body[data-production] #clock { margin-left: auto; font-size: 25px; color: #ffd38c; }
body[data-production] #stage { border: 1px solid #685067; background: radial-gradient(ellipse at 50% 85%, #79526566, transparent 65%), radial-gradient(ellipse at 45% 20%, #494064, #211a34 80%); box-shadow: inset 0 0 50px #150f2677; }
body[data-production] #message { top: 4px; font-size: 13px; line-height: 1.4; margin: 10px; text-shadow: 0 2px 4px #171023; }
body[data-production] footer { display: block; }
body[data-production] footer p { text-align: center; font-size: 12px; line-height: 1.5; margin: 4px 0 8px; }
body[data-production] footer p span { font-size: 10px; color: #cbb9cd; }
nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
nav button { grid-column: span 2; }
nav button:nth-last-child(-n+2) { grid-column: span 3; }
body[data-production] button { min-width: 44px; min-height: 44px; font: 600 12px system-ui; background: #392c47; border-color: #8c6c83; }
body[data-production] button:hover { background: #51405c; }
body[data-production] button[aria-pressed="true"] { background: #735253; border-color: #f0c38c; }
#veil, #graphics-error, #loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #20182bdd; padding: 12px; z-index: 3; }
#graphics-error { z-index: 5; } #loading { z-index: 6; }
#veil button, #graphics-error button { padding: 0 24px; }
#completion { position: absolute; bottom: 10px; left: 8px; right: 8px; text-align: center; pointer-events: none; }
#completion strong { display: block; font: 24px Georgia, serif; color: #ffdb9d; }
#completion span { font-size: 12px; }
dialog { max-width: min(360px, calc(100vw - 24px)); border: 1px solid #bf9484; border-radius: 24px; padding: 24px; background: #2b2139; color: #ffedce; }
dialog::backdrop { background: #120d20bb; } dialog h2 { font: 26px Georgia, serif; margin-top: 0; }
dialog div { display: flex; gap: 8px; } dialog button { flex: 1; padding: 8px; }
@media (orientation: landscape) and (max-height: 500px) {
 body[data-production] main { grid-template-columns: 230px minmax(0, 1fr); grid-template-rows: 90px minmax(0, 1fr); }
 body[data-production] header { flex-wrap: nowrap; } body[data-production] h1 { font-size: 19px; }
 body[data-production] footer { align-self: center; } body[data-production] footer p { font-size: 11px; }
 body[data-production] #stage { grid-column: 2; grid-row: 1 / 3; }
}
