* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #172c2b; color: #ffedc6; font-family: system-ui, sans-serif; }
main { height: 100dvh; max-width: 1000px; margin: auto; display: grid; grid-template-rows: 62px minmax(0, 1fr) 82px; 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: 19px; line-height: 1.1; margin: 0; font-weight: 600; }
#clock { font-size: 25px; font-variant-numeric: tabular-nums; }
#stage { position: relative; min-height: 0; overflow: hidden; border-radius: 24px; touch-action: none; background: #24413c; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#message { position: absolute; z-index: 2; top: 8px; left: 12px; right: 12px; margin: 0; text-align: center; font-size: 12px; pointer-events: none; }
#tabs { position: absolute; inset: 0; pointer-events: none; }
#tabs span { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border: 2px solid #ffedc6; border-radius: 50%; color: #492b21; background: #ffedc6cc; transform: translate(-50%, -50%); font-size: 12px; }
#tabs span.selected { border: 3px solid #8ce2b4; background: #fff2d9; }
footer p { font-size: 10px; line-height: 1.6; flex: 1; }
button { min-height: 46px; min-width: 56px; border: 1px solid #b5b49b; border-radius: 12px; background: #305249; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #8ce2b4; outline-offset: -3px; }
[hidden] { display: none !important; }
@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%; }
}

body[data-production] { background: #142f2c; color: #fff0cf; }
body[data-production] main { grid-template-rows: 76px minmax(0, 1fr) 160px; gap: 6px; }
body[data-production] header { justify-content: initial; }
body[data-production] header a { display: grid; place-items: center; min-width: 44px; height: 44px; border: 1px solid #6d9883; border-radius: 50%; color: #f8dab1; text-decoration: none; font-size: 24px; }
body[data-production] header small { display: block; font: 8px system-ui; letter-spacing: 1.4px; color: #bcceb5; margin-bottom: 4px; }
body[data-production] h1 { font: 23px/1 Georgia, serif; }
body[data-production] #clock { margin-left: auto; color: #f3c988; font-size: 25px; }
body[data-production] #stage { border: 1px solid #5c8573; background: radial-gradient(ellipse at 50% 52%, #62847580, transparent 60%), radial-gradient(ellipse at 50% 90%, #34574a, #1a3834 80%); box-shadow: inset 0 0 45px #0c262c88; }
body[data-production] #message { top: 10px; font-size: 12px; line-height: 1.4; text-shadow: 0 2px 3px #16332c; }
body[data-production] #tabs span { width: 44px; height: 44px; border-style: dashed; background: #ffe7b9c9; box-shadow: 0 3px 8px #183a3c55; }
body[data-production] #tabs span.selected { border-style: solid; box-shadow: 0 0 0 4px #79cfa92b; }
body[data-production] footer { display: block; }
body[data-production] footer p { font-size: 10px; text-align: center; line-height: 1.6; margin: 0 0 8px; }
body[data-production] footer p span { color: #bdcfc0; font-size: 9px; }
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: #294e43; border-color: #73987e; }
body[data-production] button:hover { background: #3a6452; }
body[data-production] button[aria-pressed="true"] { background: #655536; border-color: #e2bb75; }
#veil, #graphics-error, #loading { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; background: #183c33ed; padding: 12px; font-size: 14px; }
#veil button, #graphics-error button { padding: 0 22px; }
#graphics-error { z-index: 5; } #loading { z-index: 6; }
.paper-mark { display: block; font: 40px Georgia, serif; color: #f1bf75; }
#completion { position: absolute; bottom: 12px; left: 8px; right: 8px; pointer-events: none; text-align: center; text-shadow: 0 2px 4px #133629; }
#completion strong { display: block; font: 25px Georgia, serif; color: #ffdf9f; }
#completion span { font-size: 11px; }
dialog { max-width: min(350px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 20px; color: #fff0cf; background: #234b3f; border: 1px solid #c4b681; border-radius: 22px; text-align: center; }
dialog::backdrop { background: #092b25b8; } dialog h2 { font: 27px Georgia, serif; margin: 6px 0; } dialog p { font-size: 13px; line-height: 1.5; }
dialog div { display: flex; gap: 8px; } dialog button { flex: 1; padding: 8px; }
@media (max-width: 340px) { body[data-production] h1 { font-size: 21px; } body[data-production] header small { letter-spacing: .7px; } body[data-production] main { padding-left: 8px; padding-right: 8px; } }
@media (orientation: landscape) and (max-height: 500px) {
 body[data-production] main { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 82px minmax(0, 1fr); }
 body[data-production] header { flex-wrap: nowrap; gap: 8px; } body[data-production] h1 { font-size: 21px; } body[data-production] header small { font-size: 7px; letter-spacing: .6px; }
 body[data-production] footer { align-self: center; } body[data-production] #stage { grid-column: 2; grid-row: 1 / 3; }
}
