.math-page{padding-top:10px;padding-bottom:30px}.math-back{font-size:11px;color:var(--muted)}
.math-intro{display:flex;justify-content:space-between;align-items:center;margin:22px 0 32px}.math-intro h1{font-family:Georgia,serif;font-size:clamp(45px,7vw,80px);letter-spacing:-3px;margin:10px 0 13px;line-height:1}.math-intro h1 span{color:#526e48}.math-intro h1 i{font-size:33px;color:#c48c40;font-style:normal;vertical-align:top;display:inline-block;transform:rotate(12deg);margin-left:12px}.math-intro p{font-size:14px;color:var(--muted);margin:0}.math-intro-note{display:flex;align-items:center;gap:16px}.math-intro-note>span{font:28px Georgia,serif;letter-spacing:4px;color:#b3874a}.math-intro-note p{font:italic 15px/1.6 Georgia,serif}
.math-layout{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:28px;align-items:start}.math-game-panel{--math-accent:#287662;padding:20px;border-radius:18px}.math-game-panel .game-top{gap:12px;flex-wrap:wrap}.math-game-panel .game-top h2{font-size:22px}.math-game-panel .game-top h2 span{font-size:12px;font-weight:400;color:var(--muted)}.math-toolbar{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-left:auto}.math-toolbar button{min-height:44px;border:1px solid #c5cdb7;background:#f1f1e6;border-radius:7px;padding:7px 10px;font-size:11px}.math-toolbar .game-fullscreen-toggle{background:#e4edd9}.math-toolbar .game-fullscreen-toggle[aria-pressed=true]{background:#303d32}
.math-hud{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;border-block:1px solid var(--line);padding:13px 0;margin:10px 0 16px}.math-hud>div{display:flex;flex-direction:column;gap:4px}.math-hud span{font-size:8px;letter-spacing:1.2px;color:var(--muted)}.math-hud strong{font:23px ui-monospace,monospace;color:var(--ink)}#math-hearts{font:20px Georgia,serif;color:#b34b64;white-space:nowrap}
.math-question-bar{position:sticky;top:0;z-index:3;text-align:center;background:#f0efdf;border:1px solid #d1d7bd;border-radius:9px;padding:14px 12px}.math-question-bar>span{font-size:8px;font-weight:700;letter-spacing:1.6px;color:var(--math-accent)}.math-question-bar h2{font-family:Georgia,serif;font-size:clamp(27px,3.4vw,43px);font-weight:600;letter-spacing:-1px;line-height:1.15;margin:8px 0 2px}.math-feedback{min-height:23px;font-size:12px;line-height:1.5;text-align:center;color:#526e48;margin:10px 0}.math-feedback.math-wrong{color:#a0464f}.math-feedback.math-correct{font-weight:700}
.math-game-panel .math-board-wrap{width:100%;max-width:600px;aspect-ratio:1;margin:auto;background:#dfedce;border-radius:12px;isolation:isolate}.math-board-wrap canvas{image-rendering:auto;outline-offset:-4px}.math-overlay{position:absolute;inset:0;overflow:auto;padding:20px;background:#f4f2e5ef;display:flex;text-align:center;z-index:1}.math-overlay[hidden]{display:none}.math-overlay-inner{margin:auto;width:100%;max-width:390px}.math-overlay-star{font:52px Georgia,serif;color:#b58d48}.math-overlay h3{font:600 clamp(26px,3vw,39px)/1.1 Georgia,serif;letter-spacing:-1px;margin:12px 0}.math-overlay p{font-size:13px;line-height:1.7;color:#66715b;margin:0 0 20px}.math-overlay .button{display:block;margin:0 auto;min-height:44px;padding:12px 22px;font-size:13px}.math-secondary{border:0;background:none;text-decoration:underline;text-underline-offset:3px;padding:10px 4px;font-size:12px;min-height:44px}.math-overlay .math-secondary{display:block;margin:5px auto 0}.math-overlay .math-secondary[hidden]{display:none}
.math-board-footer{display:flex;justify-content:space-between;gap:16px;font-size:9px;line-height:1.6;color:var(--muted);margin:10px 0}.math-board-footer>span:first-child{max-width:70%}.math-board-footer>span:last-child{text-align:right;font-size:8px;white-space:nowrap}.math-game-panel .math-controls{display:flex;margin:14px auto}.math-controls button{width:46px;height:44px;border:1px solid #c8d0b8;border-radius:7px;background:#e8eddf;font-size:21px;touch-action:none}.math-controls>div{display:flex;gap:6px;flex-direction:column}.math-game-panel #math-save-status{font-size:11px;line-height:1.7;color:var(--muted);margin-bottom:0}.math-result{border-block:1px solid var(--line);padding:15px 0;margin:15px 0}.math-result h3{font:25px Georgia,serif;margin:0 0 12px}.math-result dl{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:0}.math-result dl>div{padding:10px;background:#eff0e3;border-radius:6px}.math-result dt{font-size:9px;color:var(--muted)}.math-result dd{font:22px ui-monospace,monospace;margin:5px 0 0}.math-result p{font-size:13px;margin:14px 0 0}
.math-boss{display:flex;justify-content:center;align-items:center;gap:12px;margin-top:10px}.math-boss[hidden]{display:none}.math-boss>span{font-size:34px;color:#8c6940}.math-boss>div{display:flex;flex-direction:column;min-width:160px;font-size:10px;gap:5px}.math-boss progress{width:100%;height:10px;accent-color:#b58a4a}
.math-sidebar>section,.math-sidebar>details{border-top:1px solid #bdc5ad;padding:19px 0}.math-sidebar>section:first-child{border-top:3px double #8b9977;padding-top:17px}.math-sidebar h2{font:29px/1.15 Georgia,serif;letter-spacing:-.5px;margin:8px 0 15px}.math-sidebar p{font-size:11px;line-height:1.8;color:var(--muted)}.math-settings>label:not(.math-motion){display:block;font-size:11px;margin-bottom:7px}.math-settings select{width:100%;padding:11px 8px;background:#fffdf6;border:1px solid #bfc8af;border-radius:6px;font:12px 'Trebuchet MS',sans-serif;color:var(--ink)}.math-motion{display:flex;gap:7px;align-items:center;font-size:11px;margin:14px 0}.math-wallet{display:flex;justify-content:space-between;align-items:center;border-block:1px solid var(--line);padding:12px 0;margin-top:16px}.math-wallet>span{font-size:9px;letter-spacing:1px}.math-wallet strong{font:25px ui-monospace,monospace}.math-wallet strong span{color:#b58d48}
.math-world{margin-bottom:16px}.math-world-heading{display:flex;gap:8px;align-items:center;margin-bottom:8px;font-size:12px;font-weight:700}.math-world-heading>span{font:23px Georgia,serif;color:#9d824d}.math-levels{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}.math-levels button{height:38px;border:1px solid #c6cfb5;border-radius:7px;background:#f1f1e6;font-size:11px;position:relative}.math-levels button[aria-current=true]{background:#526e48;color:#fffdf6;border-color:#526e48}.math-levels button.math-level-done::after{content:'✓';position:absolute;top:-8px;right:1px;color:#397148;font-size:11px;background:var(--paper);border-radius:50%}.math-levels button:disabled{opacity:.5}.math-map-note{margin-bottom:0}
#math-cosmetics{display:grid;grid-template-columns:1fr 1fr;gap:7px}.math-cosmetic{padding:10px 5px;border:1px solid #c5ceb5;background:#f1f0e6;border-radius:7px;font-size:10px;line-height:1.4;min-height:74px;display:flex;flex-direction:column;align-items:center;gap:5px}.math-cosmetic b{font-size:21px;color:var(--item-color,#687951)}.math-cosmetic small{font-size:9px;color:#6b735f}.math-cosmetic[aria-pressed=true]{border-color:#526e48;box-shadow:inset 0 0 0 1px #526e48}.math-record summary,.math-how summary{font-size:12px;cursor:pointer;min-height:32px}.math-record dl{font-size:11px;display:grid;grid-template-columns:1fr auto;gap:8px}.math-record dd{margin:0;font-family:monospace}.math-challenge-banner{display:flex;align-items:center;justify-content:space-between;gap:20px;border:1px solid #c6b58d;background:#eee8d2;border-radius:12px;padding:20px;margin-bottom:24px}.math-challenge-banner[hidden]{display:none}.math-challenge-banner h2{font:27px Georgia,serif;margin:7px 0}.math-challenge-banner p{font-size:12px;margin:0}.math-challenge-banner button{background:none;border:0;text-decoration:underline;font-size:11px;min-height:44px}.math-share-box{padding:14px 0;border-top:1px solid var(--line);font-size:11px}.math-share-box>div{display:flex;gap:8px;margin-top:7px}.math-share-box input{min-width:0;flex:1;border:1px solid #bdc9ad;border-radius:5px;padding:9px;font-size:11px}.math-share-box button{min-height:44px;border:1px solid #bdc9ad;border-radius:5px;padding:8px;background:#e7eddc}.math-share-box p{font-size:10px;color:var(--muted)}.math-footer{display:flex;gap:20px;flex-wrap:wrap;font-size:11px;padding-top:26px;margin-top:28px;border-top:1px solid var(--line)}.math-footer>span{margin-right:auto;color:var(--muted)}
.math-game-panel.is-game-fullscreen .math-hud{max-width:860px;margin-inline:auto}.math-game-panel.is-game-fullscreen .math-question-bar{top:74px;max-width:860px;margin-inline:auto}.math-game-panel.is-game-fullscreen .math-board-wrap{max-width:760px}.math-game-panel.is-game-fullscreen .math-result,.math-game-panel.is-game-fullscreen .math-share-box{max-width:860px;margin-inline:auto}
@keyframes math-pop{0%{transform:scale(.96)}60%{transform:scale(1.025)}100%{transform:scale(1)}}.math-celebrate{animation:math-pop .35s ease-out}.math-reduced *{animation:none!important;transition:none!important}@media(prefers-reduced-motion:reduce){.math-page *{animation:none!important;transition:none!important}}
@media(max-width:1000px){.math-layout{grid-template-columns:minmax(0,1fr) 230px;gap:20px}.math-game-panel{padding:16px}.math-toolbar{gap:5px}.math-intro-note{display:none}.math-toolbar button{padding-inline:8px}.math-game-panel .game-top h2{font-size:20px}}
@media(max-width:760px){.math-layout{grid-template-columns:1fr}.math-sidebar{display:grid;grid-template-columns:1fr 1fr;gap:0 24px}.math-game-panel .game-top{display:block}.math-toolbar{margin-top:12px;justify-content:space-between}.math-toolbar .game-fullscreen-toggle{margin-left:0}.math-game-panel.is-game-fullscreen .game-top{display:flex;gap:4px}.math-game-panel.is-game-fullscreen .game-top h2{font-size:18px}.math-game-panel.is-game-fullscreen .math-toolbar{margin-top:0}.math-game-panel.is-game-fullscreen .math-question-bar{top:96px}.math-intro{margin:20px 0}.math-hud{gap:8px}.math-hud strong{font-size:20px}.math-result dl{gap:7px}.math-challenge-banner{display:block}.math-challenge-banner button{padding-left:0}}
@media(max-width:450px){.math-page.wrap{width:calc(100% - 24px)}.math-intro .eyebrow{font-size:8px;letter-spacing:1px}.math-intro h1{font-size:51px}.math-game-panel{padding:12px;border-radius:12px;box-shadow:3px 4px 0 #dde1ce}.math-question-bar{padding:11px 8px}.math-question-bar h2{font-size:30px}.math-hud span{font-size:7px}.math-hud strong{font-size:17px}#math-hearts{font-size:16px}.math-overlay{padding:14px}.math-overlay-star{font-size:34px}.math-overlay h3{font-size:27px}.math-overlay p{font-size:12px;margin-bottom:14px}.math-sidebar{display:block}.math-toolbar button{font-size:10px}.math-intro p{font-size:12px}.math-board-footer{font-size:8px}.math-board-footer>span:last-child{font-size:7px}.math-game-panel.is-game-fullscreen .math-toolbar{width:100%}.math-game-panel.is-game-fullscreen .math-question-bar{top:105px}.math-result dd{font-size:19px}}
@media(max-height:600px){.math-game-panel.is-game-fullscreen .math-overlay-star{display:none}.math-game-panel.is-game-fullscreen .math-overlay h3{font-size:22px}.math-game-panel.is-game-fullscreen .math-overlay p{font-size:11px}}
.math-game-panel .math-controls{justify-content:center;align-items:center;gap:6px}
@media(max-width:450px){.math-intro h1 i{display:none}.math-intro h1{font-size:clamp(41px,13vw,51px)}}

.math-game-panel[data-world=forest] .math-question-bar{background:#e0eadb;border-color:#98b28e}
.math-game-panel[data-world=galaxy] .math-question-bar{background:#272e49;border-color:#747ba1;color:#fff8e9}
.math-game-panel[data-world=dungeon] .math-question-bar{background:#e6ddef;border-color:#aa96b8}

.math-leaderboard table{width:100%;border-collapse:collapse;font-size:12px;text-align:left;table-layout:fixed}
.math-leaderboard th{font-size:9px;text-transform:uppercase;letter-spacing:1px;padding:7px 3px;border-bottom:1px solid var(--line)}
.math-leaderboard td{padding:10px 3px;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}
.math-leaderboard th:first-child{width:24px}.math-leaderboard th:last-child{width:45px;text-align:right}.math-leaderboard td:last-child{text-align:right;font-family:monospace;font-weight:700}
.math-leaderboard td small{display:block;font-size:8px;line-height:1.6;color:var(--muted);margin-top:4px}.math-private-name{filter:blur(4px);user-select:none}

/* Keep the normal reading order visually; fullscreen gives the board its own column. */
.math-play-layout{display:grid;grid-template-columns:minmax(0,1fr)}
.math-mission{display:contents}
.math-arena{grid-row:4;min-width:0}
@media(min-width:768px){
 .math-game-panel.is-game-fullscreen{display:flex;flex-direction:column;overflow:hidden;padding:12px 18px;gap:8px}
 .math-game-panel.is-game-fullscreen .game-top{position:static;flex:none;margin:0;padding:4px 0 8px}
 .math-game-panel.is-game-fullscreen .game-fullscreen-status{flex:none;margin:0;font-size:10px}
 .math-game-panel.is-game-fullscreen .math-play-layout{flex:1;min-height:0;grid-template-columns:clamp(260px,27vw,360px) minmax(0,1fr);gap:24px}
 .math-game-panel.is-game-fullscreen .math-mission{display:flex;flex-direction:column;gap:8px;min-width:0;min-height:0}
 .math-game-panel.is-game-fullscreen .math-hud{width:100%;grid-template-columns:repeat(2,1fr);gap:10px;margin:0;padding:10px 0;flex:none}
 .math-game-panel.is-game-fullscreen .math-question-bar{position:static;top:auto;width:100%;max-width:none;margin:0;padding:18px 10px;flex:none}
 .math-game-panel.is-game-fullscreen .math-question-bar h2{font-size:clamp(27px,2.7vw,38px);overflow-wrap:anywhere}
 .math-game-panel.is-game-fullscreen .math-feedback{margin:0;min-height:36px;flex:none}
 .math-game-panel.is-game-fullscreen .math-board-footer{margin:0;flex-wrap:wrap;gap:4px;flex:none}
 .math-game-panel.is-game-fullscreen .math-board-footer>span:first-child{max-width:100%}
 .math-game-panel.is-game-fullscreen .math-controls{margin:0;flex:none}
 .math-game-panel.is-game-fullscreen .math-controls>div{display:contents}
 .math-game-panel.is-game-fullscreen #math-save-status{margin:0;font-size:10px;line-height:1.4;flex:none}
 .math-game-panel.is-game-fullscreen .math-result{width:100%;margin:0;padding:6px 0;flex:none}
 .math-game-panel.is-game-fullscreen .math-result h3{font-size:18px;margin:0 0 5px}
 .math-game-panel.is-game-fullscreen .math-result dl{gap:4px}
 .math-game-panel.is-game-fullscreen .math-result dl>div{padding:4px}
 .math-game-panel.is-game-fullscreen .math-result dd{font-size:17px;margin:2px 0 0}
 .math-game-panel.is-game-fullscreen .math-result p{font-size:10px;margin:4px 0 0}
 .math-game-panel.is-game-fullscreen .math-share-box{width:100%;margin:0;padding:5px 0;flex:none}
 .math-game-panel.is-game-fullscreen .math-share-box p{margin:3px 0;font-size:9px}
 .math-game-panel.is-game-fullscreen .math-arena{grid-row:auto;min-height:0;display:grid;place-items:center;container-type:size}
 .math-game-panel.is-game-fullscreen .math-board-wrap{width:min(100cqw,100cqh);height:auto;max-width:none;max-height:100%;margin:0;aspect-ratio:1}
 .math-game-panel.is-game-fullscreen .math-overlay{overflow:hidden}
}
@media(min-width:768px) and (max-height:740px){
 .math-game-panel.is-game-fullscreen .math-mission{gap:4px}
 .math-game-panel.is-game-fullscreen .math-hud{padding:5px 0;gap:4px}
 .math-game-panel.is-game-fullscreen .math-hud strong{font-size:18px}
 .math-game-panel.is-game-fullscreen .math-question-bar{padding:8px}
 .math-game-panel.is-game-fullscreen .math-question-bar h2{font-size:27px;margin-top:4px}
 .math-game-panel.is-game-fullscreen .math-feedback{font-size:11px;min-height:30px}
 .math-game-panel.is-game-fullscreen .math-boss{margin-top:4px}
 .math-game-panel.is-game-fullscreen .math-boss>span{font-size:22px}
 .math-game-panel.is-game-fullscreen .math-secondary{min-height:36px;padding:5px}
}
@media(min-width:768px){
 .math-game-panel.is-game-fullscreen:has(.math-result:not([hidden])) .math-hud,
 .math-game-panel.is-game-fullscreen:has(.math-result:not([hidden])) .math-feedback,
 .math-game-panel.is-game-fullscreen:has(.math-result:not([hidden])) .math-board-footer,
 .math-game-panel.is-game-fullscreen:has(.math-result:not([hidden])) .math-controls{display:none}
}
@media(min-width:768px) and (max-height:500px){
 .math-game-panel.is-game-fullscreen{padding:6px 12px;gap:4px}
 .math-game-panel.is-game-fullscreen .math-mission{gap:2px}
 .math-game-panel.is-game-fullscreen .math-hud{grid-template-columns:repeat(4,1fr);gap:4px;padding:4px 0}
 .math-game-panel.is-game-fullscreen .math-hud strong{font-size:16px}
 .math-game-panel.is-game-fullscreen .math-question-bar{padding:5px}
 .math-game-panel.is-game-fullscreen .math-question-bar h2{font-size:22px}
 .math-game-panel.is-game-fullscreen .math-boss>span{font-size:18px}
 .math-game-panel.is-game-fullscreen .math-board-footer{display:none}
 .math-game-panel.is-game-fullscreen .math-result h3{font-size:14px}
 .math-game-panel.is-game-fullscreen .math-share-box p{display:none}
}

/* Game over turns the board into a score screen, including in fullscreen. */
.math-death-board[hidden]{display:none}
.math-death-board{margin:8px 0 12px;text-align:left}
.math-death-board h4{font:700 18px/1.2 Georgia,serif;margin:0 0 6px;text-align:center}
.math-overlay .math-death-board p{font-size:12px;line-height:1.4;margin:6px 0}
#math-death-standing{background:#e0ecd4;border:1px solid #a1b78d;border-radius:7px;padding:9px;font-weight:700;color:#294b2f}
.math-death-board table{width:100%;table-layout:fixed;border-collapse:collapse;font-size:12px}
.math-death-board th{font-size:9px;text-transform:uppercase;letter-spacing:1px;text-align:left;border-bottom:1px solid #bdc9ad;padding:5px 7px}
.math-death-board td{padding:5px 7px;border-bottom:1px solid #dce2d0;overflow-wrap:anywhere}
.math-death-board th:first-child{width:40px}.math-death-board th:last-child{width:70px}
.math-death-board th:last-child,.math-death-board td:last-child{text-align:right;font-family:monospace}
.math-death-board td small{display:none}
.math-your-standing{background:#dcebcf;color:#294b2f;font-weight:700;box-shadow:inset 3px 0 #526e48}
.math-game-over .math-board-wrap{aspect-ratio:auto;min-height:620px}
.math-game-over .math-overlay{padding:20px;overflow:hidden}
.math-game-over .math-overlay-inner{max-width:480px}
.math-game-over .math-overlay-star{display:none}
.math-game-over .math-overlay h3{font-size:25px;margin:0 0 5px}
.math-game-over .math-overlay>div>p{font-size:12px;margin:0 0 8px;line-height:1.4}
.math-overlay #math-death-refresh{margin:3px auto;padding:3px;min-height:32px;font-size:10px}
@media(min-width:768px){
 .math-game-panel.is-game-fullscreen.math-game-over .math-board-wrap{width:100%;height:100%;min-height:0;max-height:none;aspect-ratio:auto;background:#f4f2e5}
 .math-game-panel.is-game-fullscreen.math-game-over .math-overlay-inner{max-width:600px}
}
@media(min-width:768px) and (max-height:600px){
 .math-game-panel.is-game-fullscreen.math-game-over .math-overlay{padding:8px}
 .math-game-panel.is-game-fullscreen.math-game-over .math-overlay h3{font-size:18px;margin:0 0 2px}
 .math-game-panel.is-game-fullscreen.math-game-over .math-overlay>div>p{display:none}
 .math-game-panel.is-game-fullscreen .math-death-board{margin:4px 0}
 .math-game-panel.is-game-fullscreen .math-death-board h4{font-size:14px;margin:0}
 .math-game-panel.is-game-fullscreen .math-death-board th{padding:2px 6px;font-size:8px}
 .math-game-panel.is-game-fullscreen .math-death-board td{padding:2px 6px;font-size:11px;line-height:1.2}
 .math-game-panel.is-game-fullscreen .math-death-board p{font-size:10px;line-height:1.3;margin:3px 0}
 .math-game-panel.is-game-fullscreen #math-death-standing{padding:4px}
 .math-game-panel.is-game-fullscreen #math-death-refresh{min-height:24px;margin:0;padding:0 4px}
 .math-game-panel.is-game-fullscreen #math-death-board-status:empty{display:none}
 .math-game-panel.is-game-fullscreen.math-game-over .math-overlay .button{padding:8px 16px;min-height:36px;font-size:12px}
}
.math-game-over .math-overlay{background:#f4f2e5}
@media(min-width:768px) and (max-height:500px){
 .math-game-panel.is-game-fullscreen .math-death-board table:has(tr:nth-child(6)){display:block}
 .math-game-panel.is-game-fullscreen .math-death-board table:has(tr:nth-child(6)) thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .math-game-panel.is-game-fullscreen #math-death-players:has(tr:nth-child(6)){display:grid;grid-template-rows:repeat(5,auto);grid-auto-flow:column;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 10px}
 .math-game-panel.is-game-fullscreen #math-death-players:has(tr:nth-child(6)) tr{display:grid;grid-template-columns:24px minmax(0,1fr) 46px;align-items:center}
 .math-game-panel.is-game-fullscreen #math-death-players:has(tr:nth-child(6)) td{padding:4px;font-size:11px}
}
