:root{color-scheme:dark;--bg:#102831;--panel:#213e44;--mint:#c3f2cd;--gold:#ffe0a1;--muted:#b5ccd0;--line:#557477}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0;background:radial-gradient(ellipse at 12% 0,#3e6553 0,transparent 60%),var(--bg);color:#f1fff5;font-family:system-ui,-apple-system,sans-serif}button,input,select{font:inherit}button{min-height:44px;padding:10px 15px;border:1px solid var(--line);border-radius:12px;background:#294c52;color:inherit;font-weight:750;cursor:pointer;touch-action:manipulation}button:hover{background:#396168}button:disabled{opacity:.5;cursor:default}button:active{filter:brightness(1.12)}:focus-visible{outline:3px solid var(--gold);outline-offset:3px}.primary{background:var(--mint);color:#163e42;box-shadow:0 4px 0 #416a63;border-color:var(--mint)}.primary:hover{background:#e0ffdf}.small{font-size:.83rem;color:var(--muted);line-height:1.5}.eyebrow{font:800 .71rem ui-monospace,monospace;color:var(--gold);letter-spacing:.1em}h1,h2,h3,p{margin-top:0}p{line-height:1.6}h1{font-size:clamp(2.6rem,6vw,4.8rem);line-height:1.03;letter-spacing:-.06em}h1 span{color:var(--mint)}a{color:var(--gold)}.shell{max-width:1200px;margin:auto;padding:0 24px}.topbar{display:flex;align-items:center;gap:22px;max-width:1300px;margin:auto;padding:20px 24px}.brand{display:flex;gap:12px;align-items:center;color:#fff;text-decoration:none;font-size:1.12rem;font-weight:900}.brand img{object-fit:contain}.brand b{color:var(--mint)}.brand small{display:block;font-size:.58rem;letter-spacing:.12em;color:var(--muted);margin-top:5px}.topbar nav{display:flex;flex-wrap:wrap;gap:4px;margin-left:auto}.topbar nav button{background:transparent;border-color:transparent;font-size:.85rem;padding:8px 11px}.topbar #sound-toggle{border-color:#71948a;min-width:44px}.topbar #sound-toggle[aria-pressed=true]{color:var(--mint);background:#c3f2cd15}.portal{text-decoration:none;font-size:.8rem;white-space:nowrap}.hero{display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:35px;padding:40px 0}.hero p{color:var(--muted);max-width:500px}.hero-actions,.pills{display:flex;flex-wrap:wrap;gap:10px}.pills{margin:20px 0}.pill{font-size:.73rem;border:1px solid #9bc3ad66;padding:7px 12px;border-radius:30px}.hero-art{background:linear-gradient(140deg,#52786a55,#273444);border:1px solid var(--line);border-radius:26px;padding:16px;position:relative;overflow:hidden}.hero-art canvas{display:block;width:100%;aspect-ratio:16/10;border-radius:15px}.hero-cart{position:absolute;right:12px;bottom:8px;width:112px;transform:rotate(8deg);filter:drop-shadow(7px 8px 6px #0006)}.art-label{display:flex;justify-content:space-between;font:800 .65rem ui-monospace,monospace;color:var(--mint);margin:0 0 12px}.status-line{min-height:24px;font-size:.9rem;color:var(--gold);margin:15px 0}.zones{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:0 0 35px}.zone,.panel{background:#24464a;border:1px solid var(--line);border-radius:20px;padding:24px}.zone p{color:var(--muted);font-size:.9rem}.zone small{color:var(--gold);font:800 .7rem ui-monospace,monospace}.zone h3{margin:10px 0}.arena{border:1px solid var(--line);border-radius:23px;background:#16363d;padding:15px;box-shadow:0 20px 60px #0004}.hud{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:10px}.hud-title small{display:block;font:800 .62rem ui-monospace,monospace;color:var(--gold)}.hud-title strong{display:block;font-size:1rem;margin:4px 0}.hud-metrics{font:800 .75rem ui-monospace,monospace;display:flex;gap:13px;color:var(--mint)}.hud-tools{display:flex;gap:5px;margin-left:auto}.hud-tools button{min-width:44px;height:44px;padding:0;font-size:20px}.board-wrap{position:relative;overflow:hidden;border-radius:16px}.board-wrap canvas{display:block;width:100%;aspect-ratio:16/9;touch-action:none}.controls{display:flex;gap:16px;justify-content:space-between;align-items:center;margin-top:12px}.dpad{display:grid;grid-template-columns:repeat(3,48px);grid-template-rows:repeat(2,48px);gap:5px}.dpad button{padding:0;font-size:25px;touch-action:none}.dpad [data-dir=up]{grid-column:2}.dpad [data-dir=left]{grid-row:2;grid-column:1}.dpad [data-dir=down]{grid-row:2;grid-column:2}.dpad [data-dir=right]{grid-row:2;grid-column:3}.action-controls{display:flex;gap:8px}.control-note{font-size:.82rem;color:var(--muted);margin:12px 0}.feedback{border-left:3px solid var(--gold);background:#c3f2cd0b;border-radius:10px;padding:9px 12px;margin:12px 0 0;font-size:.85rem;min-height:40px}.pause-overlay{display:none;position:absolute;inset:0;z-index:10;background:#122a3fbb;backdrop-filter:blur(5px);align-items:center;justify-content:center;flex-direction:column;gap:14px}.pause-overlay.visible{display:flex}.progress{display:flex;gap:5px;margin-bottom:14px}.progress i{height:5px;flex:1;background:#46636a;border-radius:4px}.progress .done{background:var(--mint)}.progress .current{background:var(--gold)}.touch-pressed{background:#c3ffdc66!important}.footer{text-align:center;padding:32px 20px;color:var(--muted);font-size:.72rem}.skip:not(:focus),.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0)}.skip:focus{position:fixed;top:10px;left:10px;background:var(--mint);color:#163e42;padding:10px;z-index:99}
/* One task at a time; no native keyboard inside fullscreen. */
dialog{color:inherit;background:#183943;border:1px solid #94bba2;border-radius:22px;width:min(960px,96vw);max-height:94dvh;padding:18px;box-shadow:0 25px 80px #0007}dialog::backdrop{background:#10222ae3;backdrop-filter:blur(5px)}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:14px;flex:none}.dialog-head h2{font-size:21px;margin:0}.dialog-head>button{min-width:44px;padding:0;font-size:24px}.scroll-copy{overflow:auto;max-height:65dvh;color:#d1e5dd;line-height:1.6}#howto-go,#next-room{width:100%;margin-top:12px}#map-board{display:block;width:100%;aspect-ratio:16/9;background:#16343b;border-radius:13px}#map-dialog{width:min(900px,96vw)}#spell-dialog[open]{display:flex;flex-direction:column;height:min(720px,94dvh);padding:12px;gap:6px;overflow:hidden}#spell-dialog .dialog-head{display:grid;grid-template-columns:1fr 44px;grid-template-areas:'title close' 'steps steps';gap:6px;margin:0}#spell-title{grid-area:title;font-size:18px}#spell-dialog .dialog-head>[data-close]{grid-area:close}#spell-steps{grid-area:steps;display:flex;gap:4px}#spell-steps button{flex:1;min-height:44px;padding:5px;font-size:11px;white-space:nowrap}#spell-steps .current{background:var(--mint);color:#173d42}#spell-body{display:grid;grid-template-columns:1.1fr 1fr;gap:14px;flex:1;min-height:0;overflow:auto;align-items:center}#spell-left{display:flex;flex-direction:column;justify-content:center;min-height:0;gap:8px}#spell-story{font-size:15px;font-weight:650;line-height:1.45;margin:0}#spell-model{width:100%;aspect-ratio:16/9;max-height:240px;display:block;object-fit:contain;background:#112b34;border:1px solid #92bba333;border-radius:13px}#spell-tip{color:var(--gold);font-size:12px;line-height:1.4;margin:0}.chain{font:800 17px ui-monospace,monospace;color:var(--mint);line-height:1.5;overflow:auto;max-height:58px}.power{font:850 40px ui-monospace,monospace;color:var(--gold)}.power sup{font-size:.6em}#power-preview{display:none}#spell-right>div{display:none}#spell-right h3{font-size:20px;margin:0 0 12px}#spell-right p{font-size:14px;line-height:1.5}.breath-choice,.sign-choice,.mini-actions{display:flex;gap:6px}.breath-choice button{flex:1;font-size:22px}.sign-choice button{flex:1;font-size:13px}.selected{background:#bdf6d134!important;border-color:var(--mint)!important}.mini-actions button{flex:1;font-size:12px;padding:8px}.breath-choice{margin-bottom:8px}#breathe{width:100%;margin-bottom:10px;font-size:17px}#breath-count{display:block;text-align:center;font:800 15px ui-monospace,monospace;margin-bottom:8px}.counter{display:grid;grid-template-columns:52px 1fr 52px;gap:8px;align-items:center;margin:15px 0}.counter button{font-size:25px;padding:0}.counter output{font:850 30px ui-monospace,monospace;text-align:center}.answer-fields{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:5px}.answer-fields button{padding:2px 5px;height:44px;min-height:44px;display:flex;flex-direction:column;justify-content:center}.answer-fields small{font-size:10px;color:var(--muted)}.answer-fields output{font:850 23px ui-monospace,monospace;line-height:1.1}.answer-fields button.chosen{border-color:var(--gold);background:#ffe0a120}#keypad{display:grid;grid-template-columns:repeat(4,1fr);gap:5px}#keypad button{height:44px;min-height:44px;padding:0;font-size:23px}#keypad .tool{font-size:14px}#answer-kind{display:none;gap:6px}#answer-kind button{flex:1;font-size:12px;min-height:44px;padding:6px}#spell-notice{font-size:12px;line-height:1.35;color:var(--gold);margin:0;max-height:38px;overflow:auto;flex:none}#spell-notice:empty{display:none}.spell-footer{display:flex;justify-content:space-between;gap:8px;flex:none}.spell-footer button{min-height:44px;font-size:13px}#spell-main{min-width:175px}#built-equation,#hint-equation{font:850 21px ui-monospace,monospace;color:var(--gold);line-height:1.6}#hint-copy{font-size:16px}#spell-dialog[data-phase=story] #story-pane,#spell-dialog[data-phase=breath] #breath-pane,#spell-dialog[data-phase=power] #power-pane,#spell-dialog[data-phase=value] #value-pane,#spell-dialog[data-phase=built] #built-pane,#spell-dialog[data-phase=hint] #hint-pane{display:block}#spell-dialog[data-phase=power] #spell-model,#spell-dialog[data-phase=value] #spell-model,#spell-dialog[data-phase=hint] #spell-model{display:none}#spell-dialog[data-phase=power] #power-preview,#spell-dialog[data-phase=value] #power-preview{display:block}#spell-dialog[data-phase=value] #answer-kind{display:flex}#spell-dialog[data-phase=hint] #spell-left{display:none}#spell-dialog[data-phase=hint] #spell-body{grid-template-columns:1fr}#spell-dialog[data-phase=hint] #hint-pane{text-align:center;max-width:780px;margin:auto}
.result-head{display:flex;justify-content:space-between;gap:20px}.result-head img{width:105px;object-fit:contain}.score-big{font:900 42px ui-monospace,monospace;color:var(--gold);margin:12px 0}.summary-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:20px 0}.summary-card{border:1px solid var(--line);border-radius:12px;padding:13px;background:#17363b}.summary-card p{font-size:.85rem;margin:8px 0}.summary-card small{font-size:.74rem;color:var(--muted)}.record-form,.filters{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:20px 0}.record-form label,.filters label{display:block;font-size:.8rem;margin:0 0 7px}.record-form p{grid-column:1/-1;font-size:.8rem;margin:0}.record-form button{grid-column:1/-1}input,select{min-height:46px;border:1px solid var(--line);border-radius:10px;padding:10px;background:#102d34;color:inherit;width:100%}.table-scroll{overflow:auto}.score-table{width:100%;border-collapse:collapse;font-size:.86rem}.score-table td,.score-table th{padding:15px 10px;border-bottom:1px solid var(--line);text-align:left}.score-table small{font-size:.73rem;color:var(--muted)}.empty{padding:30px;text-align:center;color:var(--muted)}
/* Fullscreen stage keeps scene, touch controls and every dialog together. */
.arcade-expanded{overflow:hidden;overscroll-behavior:none}.arena.immersive{position:fixed;inset:0;z-index:1000;margin:0;padding:0;border:0;border-radius:0;width:100vw;height:100dvh;background:#0d2732}.landscape-stage{position:absolute;inset:0;width:100%;height:100%;overflow:hidden;--edge-left:max(12px,env(safe-area-inset-left));--edge-right:max(12px,env(safe-area-inset-right));--edge-top:max(10px,env(safe-area-inset-top));--edge-bottom:max(10px,env(safe-area-inset-bottom))}.landscape-stage.rotated{inset:auto;left:50%;top:50%;width:100dvh;height:100vw;transform:translate(-50%,-50%) rotate(90deg);--edge-left:max(12px,env(safe-area-inset-top));--edge-right:max(12px,env(safe-area-inset-bottom));--edge-top:max(10px,env(safe-area-inset-left));--edge-bottom:max(10px,env(safe-area-inset-right))}.immersive .board-wrap{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border:0;border-radius:0}.immersive .hud{position:absolute;top:var(--edge-top);left:var(--edge-left);z-index:3;display:block;padding:8px 12px;max-width:calc(100% - 280px);margin:0;border-radius:16px;pointer-events:none}.immersive .hud-title small{font-size:9px}.immersive .hud-title strong{font-size:14px}.immersive .hud-metrics{font-size:11px;gap:13px}.immersive .hud-tools{position:absolute;right:var(--edge-right);top:var(--edge-top);z-index:4;gap:5px}.immersive .hud-tools button{width:44px;min-width:44px;height:48px;padding:0;font-size:19px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:1px}.immersive .hud-tools small{font:700 9px system-ui}.immersive button,.immersive .hud,.immersive .feedback{background:linear-gradient(145deg,#ffffff24,#b4d7cd14);border:1px solid #effffb66;box-shadow:inset 0 1px 0 #ffffff30,0 6px 19px #0003;backdrop-filter:blur(12px) saturate(135%);-webkit-backdrop-filter:blur(12px) saturate(135%);color:#f4fff9;text-shadow:0 1px 4px #05222a}.immersive .controls{display:contents}.immersive .dpad{position:absolute;bottom:var(--edge-bottom);left:var(--edge-left);z-index:4}.immersive .dpad button{border-radius:15px}.immersive .action-controls{position:absolute;bottom:var(--edge-bottom);right:var(--edge-right);z-index:4;display:flex;flex-direction:column;gap:8px}.immersive .action-controls button{width:98px;height:48px;padding:0;font-size:13px;border-radius:16px}.immersive .control-note{display:none}.immersive .feedback{position:absolute;bottom:var(--edge-bottom);left:50%;transform:translateX(-50%);width:calc(100% - 345px);max-height:42px;min-height:0;padding:7px 10px;font-size:11px;line-height:1.4;z-index:3;margin:0;border-radius:12px}.immersive .pause-overlay{z-index:10}.immersive .pause-overlay button{min-width:160px;background:var(--mint);color:#153d42;text-shadow:none}.arcade-expanded dialog[open]{position:fixed;inset:auto;left:50%;top:50%;margin:0;transform:translate(-50%,-50%);width:min(1060px,calc(100vw - 12px));max-width:none;max-height:calc(100dvh - 12px);padding:12px;overflow:auto}.arcade-expanded #spell-dialog[open]{height:calc(100dvh - 8px);max-height:calc(100dvh - 8px);padding:6px 12px;overflow:hidden;gap:4px}.arcade-expanded #spell-dialog .dialog-head{grid-template-columns:minmax(60px,1fr) auto 44px;grid-template-areas:'title steps close';height:44px;gap:6px}.arcade-expanded #spell-title{font-size:16px;max-width:140px}.arcade-expanded #spell-steps button{font-size:10px;padding:5px 7px;min-width:48px}.arcade-expanded #spell-body{overflow:hidden;grid-template-columns:1.05fr 1fr;gap:12px}.arcade-expanded #spell-left{height:100%;gap:6px}.arcade-expanded #spell-story{font-size:13px;line-height:1.4}.arcade-expanded #spell-model{max-height:calc(100% - 76px);min-height:0;object-fit:contain;flex:1}.arcade-expanded #spell-tip{font-size:11px}.arcade-expanded #spell-right h3{font-size:17px;margin-bottom:8px}.arcade-expanded #spell-right p{font-size:12px;margin:0 0 10px}.arcade-expanded #breath-count{font-size:12px;margin-bottom:6px}.arcade-expanded .chain{font-size:14px;max-height:45px}.arcade-expanded #spell-hint,.arcade-expanded #spell-main{padding:6px 12px;font-size:12px}.arcade-expanded .power{font-size:34px}.arcade-expanded #hint-copy{font-size:15px}.arcade-expanded #room-dialog{width:min(530px,calc(100vw - 12px))}.arcade-expanded .scroll-copy{max-height:calc(100dvh - 135px)}.arcade-expanded #map-dialog{height:calc(100dvh - 12px);overflow:hidden}.arcade-expanded #map-board{max-height:calc(100% - 102px);object-fit:contain}.arcade-portrait dialog[open]{transform:translate(-50%,-50%) rotate(90deg);width:min(1060px,calc(100dvh - 12px));max-height:calc(100vw - 12px)}.arcade-portrait #spell-dialog[open]{height:calc(100vw - 8px);max-height:calc(100vw - 8px)}.arcade-portrait #room-dialog{width:min(530px,calc(100dvh - 12px))}.arcade-portrait .scroll-copy{max-height:calc(100vw - 135px)}.arcade-portrait #map-dialog{height:calc(100vw - 12px)}.music-button{min-width:44px!important;min-height:44px!important;flex:none!important;touch-action:manipulation!important}.topbar .music-button{width:44px;font-size:22px;border:1px solid var(--line);padding:5px}.music-muted{opacity:.7}.music-button small{font:700 9px system-ui}
@media(max-width:800px){.topbar{flex-wrap:wrap;gap:12px}.topbar nav{order:3;margin:0;width:100%}.portal{margin-left:auto}.hero{grid-template-columns:1fr;gap:22px}.hero-art{max-width:560px}.zones{grid-template-columns:1fr}.hud{flex-wrap:wrap}.hud-metrics{order:3;width:100%}.summary-grid{grid-template-columns:repeat(2,1fr)}.record-form,.filters{grid-template-columns:1fr}.filters button{align-self:end}}@media(max-width:600px){.shell{padding:0 14px}.hero{padding:20px 0}.hero-actions button{flex:1}.topbar{padding:15px}.summary-grid{grid-template-columns:1fr}.arena{padding:10px}.action-controls{flex-direction:column}.action-controls button{font-size:12px}.controls{gap:8px}#spell-body{grid-template-columns:1fr}#spell-model{max-height:180px}#spell-dialog:not([data-phase=story]):not([data-phase=breath]) #spell-left{max-height:150px}.arcade-expanded #spell-body{grid-template-columns:1.05fr 1fr}.arcade-expanded #spell-left{max-height:none!important}}@media(max-height:420px) and (orientation:landscape),(max-width:420px) and (orientation:portrait){.immersive .hud-title strong{font-size:12px}.immersive .hud-title small{font-size:8px}.immersive .hud-metrics{font-size:10px}.immersive .hud-tools button{height:44px}.arcade-expanded #spell-title{font-size:13px;max-width:112px}.arcade-expanded #spell-steps button{padding:5px;min-width:44px;font-size:10px}.arcade-expanded #spell-notice{max-height:30px;font-size:11px}.arcade-expanded #spell-left{gap:4px}.arcade-expanded #spell-model{max-height:calc(100% - 60px)}.arcade-expanded #built-equation{font-size:17px}.arcade-expanded #spell-tip{font-size:10px}.arcade-expanded #spell-model+div{font-size:12px}.immersive .feedback{max-height:37px;font-size:10px}.arcade-expanded #spell-story{font-size:12px}.arcade-expanded #spell-right h3{font-size:15px}.arcade-expanded #breathe{margin-bottom:5px}.arcade-expanded .counter{margin:8px 0}.arcade-expanded .power{font-size:29px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}
