:root{font-family:ui-rounded,'Trebuchet MS',system-ui,sans-serif;color:#f6edf9;background:#221a3e;color-scheme:dark}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 20% 0%,#47345e,transparent 60%),#221a3e}main{max-width:760px;margin:auto;padding:26px 22px calc(20px + env(safe-area-inset-bottom))}header{display:flex;justify-content:space-between;gap:14px;font-size:10px;letter-spacing:1.5px;font-weight:bold}.brand{color:inherit;text-decoration:none}.tag{color:#b4a1c9}.intro{padding:28px 0 22px}.eyebrow{color:#ffd768;font-size:10px;letter-spacing:2px;font-weight:800}h1{font-size:clamp(42px,8vw,68px);letter-spacing:-3px;margin:12px 0;line-height:1}h1 em{color:#ffd768;font-style:normal}.intro>p:last-child{color:#c4b3d4;font-size:15px;margin:0}.stats{display:flex;justify-content:space-between;gap:12px;background:#382b50;padding:13px 20px;border-radius:18px 18px 0 0;color:#b7a3cc;font-size:10px;letter-spacing:1.5px}.stats strong{display:block;color:#fff3bc;font-size:20px;letter-spacing:0;margin-top:4px}.arena{position:relative;border:1px solid #5c4577;border-radius:0 0 18px 18px;overflow:hidden}canvas{display:block;width:100%;height:min(58vh,600px);min-height:300px;touch-action:none;outline:none}.overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px;background:#231735e8}.overlay[hidden]{display:none}h2{font-size:clamp(24px,4vw,36px);letter-spacing:-1px;margin:10px 0}.overlay p:not(.eyebrow){font-size:14px;line-height:1.65;color:#d8cbe3;max-width:440px}button{font:inherit;font-weight:900;cursor:pointer;border:0;border-radius:12px;min-height:56px;touch-action:none;background:#ffd768;color:#352443;padding:14px 25px;box-shadow:0 4px 0 #b89337}button:focus-visible{outline:3px solid white;outline-offset:3px}button:active{transform:translateY(2px)}button:disabled{opacity:.4;cursor:default}.controls{display:flex;align-items:center;gap:12px;margin-top:14px}.controls span{flex:1;text-align:center;font-size:10px;letter-spacing:1px;color:#d4bddf;line-height:1.6}.controls small{font-size:9px;color:#ad97c4}#left,#right{font-size:25px;min-width:62px}#pause{background:#44335e;color:#f3e5ff;box-shadow:none;padding:14px 18px}footer{font-size:11px;text-align:center;color:#ab93bc;margin-top:22px}@media(max-width:600px){main{padding:18px 12px}.tag{display:none}.intro{padding:20px 0}.intro p:last-child{font-size:13px}.stats{padding:11px 14px}.stats strong{font-size:17px}canvas{height:52vh;min-height:300px}.controls{gap:8px}#left,#right{padding:10px 18px}#pause{padding:12px}.overlay p:not(.eyebrow){font-size:13px}footer{margin-top:17px}}@media(max-height:500px) and (orientation:landscape){main{max-width:900px;padding:10px}.intro{padding:6px 0}.intro h1{font-size:32px}.intro p,.tag,footer{display:none}canvas{height:230px;min-height:230px}.stats{padding:7px 14px}.stats strong{display:inline;margin-left:10px;font-size:16px}.controls{margin-top:8px}}
.mission{display:flex;align-items:center;gap:18px;padding:10px 18px;background:#2c2142;font-size:12px;color:#e9d4f5}.mission span{white-space:nowrap;font-weight:800}progress{width:100%;height:7px;border:0;border-radius:10px;overflow:hidden;accent-color:#ffd768}progress::-webkit-progress-bar{background:#51405e}progress::-webkit-progress-value{background:#ffd768;border-radius:10px}.sound-row{display:flex;align-items:center;justify-content:center;gap:15px;margin-top:18px;color:#bda9cf;font-size:11px}#sound{min-height:44px;padding:10px 14px;font-size:12px;background:#44335e;color:#f3e5ff;box-shadow:none}.overlay:not([hidden]) h2{animation:pop-in .45s cubic-bezier(.2,1.5,.4,1)}@keyframes pop-in{from{opacity:0;transform:scale(.75) translateY(15px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.overlay:not([hidden]) h2{animation:none}}
.sound-row{justify-content:space-between;margin:0 0 24px;padding:12px 16px;background:#302342;border-radius:14px}#sound{min-width:112px;min-height:48px}.stats div:last-child strong{font-size:13px;line-height:24px}.stats{gap:8px}
#soundcheck{min-height:48px;padding:10px 14px;font-size:12px;background:#514060;color:#fff3bc;box-shadow:none}
#math-dialog{border:2px solid #ffd768;border-radius:24px;background:#302342;color:#fff3bc;width:min(92vw,440px);padding:28px;text-align:center}#math-dialog::backdrop{background:#160c28d9}#math-question{font-size:36px;font-weight:900;margin:24px 0}#math-digits{display:flex;justify-content:center;gap:14px}#math-digits input{width:64px;height:76px;border:2px solid #b697cd;border-radius:12px;background:#fff7df;color:#302342;text-align:center;font:900 40px system-ui}#math-digits input:focus{outline:3px solid #ffd768;outline-offset:3px}#math-feedback{min-height:48px;line-height:1.5;color:#e5d7ed}#math-submit{width:100%}
#energy-meter{position:absolute;z-index:1;top:0;left:0;width:100%;height:7px;background:#44394a;pointer-events:none}#energy-meter span{position:absolute;inset:0 auto 0 0;transition:width .08s linear}#energy-base{width:100%;background:#e9d88e}#energy-extra{width:0;background:#ffdf00;box-shadow:0 0 8px #ffe50070}.recharge-row{margin-top:24px;text-align:center}#recharge{font-size:12px;min-height:44px;background:#483957;color:#fff0ab;box-shadow:none}.double-option{display:flex;gap:10px;align-items:center;justify-content:center;font-size:14px;color:#e9d88e;line-height:1.5}.double-option input{width:22px;height:22px;accent-color:#ffdf00}
.overlay.report-death{justify-content:flex-start;overflow-y:auto;padding:18px 12px}.report-death>*{flex-shrink:0}#math-reports{width:100%;text-align:center}#math-reports[hidden]{display:none}#math-reports h3{font-size:20px;margin:5px 0 12px}#math-reports .report-note,#math-reports .report-legend{font-size:11px;line-height:1.6;margin:8px auto}.report-grids{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}.math-grid{background:#1b142b;padding:12px 8px;border-radius:12px}.math-grid h4{margin:0 0 8px;color:#fff3bc}.math-grid table{width:100%;table-layout:fixed;border-spacing:3px}.math-grid th{font-size:11px;color:#ddcdea}.math-grid td{padding:0}.fact{display:block;width:100%;aspect-ratio:1;min-height:0;border-radius:3px;padding:0;box-shadow:none;font-size:12px;color:#17251a;touch-action:manipulation}.fact.untried{background:#3b3048;color:#d7cbe5}.fast{background:#80d78c}.medium{background:#f2d56d}.slow{background:#acafb6}.wrong{background:#eb929b}.report-legend span{padding:3px 5px;border-radius:3px;color:#1e1927}.fact:focus-visible{outline:2px solid white;outline-offset:1px}#fact-detail{font-size:11px!important;min-height:36px}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}@media(max-width:400px){.math-grid{padding:10px 4px}.math-grid table{border-spacing:2px}}
#death-content{width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;transform-origin:top center}.overlay.report-death{overflow:hidden;padding:8px;display:block}.report-death #death-content{justify-content:flex-start}.report-death .report-grids{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.report-death .math-grid{padding:6px}.report-death .math-grid table{border-spacing:2px;max-width:180px;margin:auto}.report-death .math-grid h4{font-size:12px;margin:0 0 4px}.report-death #math-reports h3{font-size:16px;margin:0 0 5px}.report-death #math-reports p{font-size:9px;line-height:1.3;margin:4px auto}.report-death #fact-detail{min-height:22px;font-size:9px!important}.report-death #kicker{margin:4px 0;font-size:9px}.report-death h2{font-size:22px;margin:4px 0}.report-death #message{font-size:11px;line-height:1.3;margin:4px 0 8px}.report-death #start{min-height:40px;padding:8px 20px;font-size:13px}.stats strong{font-size:16px}.stats div:nth-last-child(-n+2) strong{font-size:12px;line-height:20px}.stats{padding-left:12px;padding-right:12px;font-size:9px;letter-spacing:.5px}
#math-choice{display:flex;flex-direction:column;gap:16px}#math-choice[hidden],#math-form[hidden]{display:none}#math-choice button{font-size:14px}#math-choice p{color:#e5d7ed}#session-matrices{margin-top:30px;border-top:1px solid #665075;padding-top:20px;text-align:center}#session-matrices h3{font-size:22px}#session-matrices .report-note,#session-matrices .report-legend,#session-fact-detail{font-size:12px;line-height:1.6;color:#d8cbe3}#session-matrices .report-grids{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}#session-matrices .fact{font-size:14px}#session-matrices .math-grid{padding:16px}
.overlay[hidden]{display:none!important}#session-matrices .fact.improved{box-shadow:0 0 5px 1px #fff1a088;outline:1px solid #fff4bf99;outline-offset:0}
#session-matrices .fact.improved{position:relative;z-index:1;box-shadow:0 0 5px 2px #ffd43bee,0 0 12px 3px #ffe66b88;outline:2px solid #fff2a3;outline-offset:0}#session-matrices .fact.improved::after{content:'';position:absolute;right:1px;top:1px;width:5px;height:5px;border-radius:50%;background:#fff7ba;box-shadow:0 0 4px #fff}
.fact.current-improved{position:relative;z-index:1;box-shadow:0 0 5px 2px #ffd43bee,0 0 12px 3px #ffe66b88!important;outline:2px solid #fff2a3!important;outline-offset:0}.fact.current-improved::after{content:'';position:absolute;right:1px;top:1px;width:5px;height:5px;border-radius:50%;background:#fff7ba;box-shadow:0 0 4px #fff}.fact.previous-improved,#session-matrices .fact.previous-improved{position:relative;z-index:1;box-shadow:0 0 5px 1px #f5974788;outline:1px solid #f5a454cc;outline-offset:0}#session-matrices .fact.previous-improved::after{display:none}
.fallen-leaf{position:fixed;z-index:10000;pointer-events:none;font-size:24px;line-height:1;filter:drop-shadow(0 2px 3px #142a2288)}

#save-panel{margin:24px 0;padding:18px;border:1px solid #ffffff25;border-radius:18px;background:#ffffff06}#save-panel summary{cursor:pointer;color:#ffe891;font-weight:700}#save-panel p{font-size:.9rem;line-height:1.5}#save-panel label{display:block;margin:12px 0}#save-panel input{display:block;width:100%;margin-top:6px;padding:12px;border-radius:9px;border:1px solid #ffffff40;background:#171126;color:white;font:inherit}#save-panel button{margin:5px 0;padding:12px;font-size:.85rem}#save-panel [hidden]{display:none}
