body[data-active-game="invaders"]{--sp-paper:#f3eddd;--sp-ink:#46382c;--sp-muted:#7b705d;--sp-red:#496146;--sp-green:#4e644b;background:#e7e0cf;color:var(--sp-ink)}
body[data-active-game="invaders"] #play-view{background:#e7e0cf;padding-bottom:32px;color:var(--sp-ink)}
body[data-active-game="invaders"] #play-view .play-header{width:min(1200px,calc(100% - 36px));min-height:70px;padding-block:10px;border-color:#bcb399}
body[data-active-game="invaders"] .play-heading h1{font-family:"Noto Serif TC","PMingLiU",serif;font-size:25px;color:#38503b}
body[data-active-game="invaders"] .play-heading>span{font-size:13px;color:var(--sp-muted)}
body[data-active-game="invaders"] #play-view .play-layout{display:block;width:min(1160px,calc(100% - 36px));max-width:none;margin:18px auto 0}
body[data-active-game="invaders"] .game-aside,body[data-active-game="invaders"] .game-hud,body[data-active-game="invaders"] .hud-progress-track,body[data-active-game="invaders"] .game-help{display:none!important}
body[data-active-game="invaders"] #play-view .game-machine{display:grid;grid-template-columns:minmax(0,1fr) 338px;align-items:start;max-width:none;overflow:visible;background:var(--sp-paper);border:1px solid #beb49a;border-radius:4px;box-shadow:0 18px 52px #4b38211f}
body[data-active-game="invaders"] #play-view .canvas-wrap{grid-column:1;grid-row:2;min-width:0;width:100%;aspect-ratio:10/9;position:relative;align-self:start;overflow:hidden;background:#866645;border-radius:0 0 0 4px}
body[data-active-game="invaders"] #play-view .canvas-wrap>canvas{display:block;position:static;inset:auto;width:100%;height:auto;aspect-ratio:10/9;opacity:1;touch-action:none;pointer-events:auto;outline-offset:-4px}
body[data-active-game="invaders"] #play-view .game-controls.stonepot-controls{display:block;grid-column:2;grid-row:2;min-width:0;padding:22px 20px 18px;border:0;border-left:1px solid #c7bda5;background:var(--sp-paper);font-size:15px;line-height:1.6}
.stonepot-order{grid-column:1/-1;grid-row:1;display:grid;grid-template-columns:minmax(0,1fr) 338px;gap:9px 20px;padding:16px 20px 12px;border-bottom:1px solid #c7bda5;background:#f6f0e1}
.stonepot-heading{display:flex;align-items:center;justify-content:space-between;gap:14px}.stonepot-eyebrow{font-family:"Noto Serif TC","PMingLiU",serif;letter-spacing:.13em;color:#596b46;font-size:16px;font-weight:700}
.stonepot-book-button,.stonepot-book-close,.stonepot-link{border:1px solid #a5977b;background:#f3ead8;color:#5a4939;padding:8px 12px;min-height:44px;cursor:pointer;font:inherit;border-radius:3px}
.stonepot-recipes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;grid-row:1;grid-column:2}.stonepot-recipe{min-height:44px;border:1px solid #c3b596;background:#fbf6e9;padding:8px 5px;color:#6c5944;font:500 14px/1.3 system-ui;cursor:pointer;border-radius:3px}.stonepot-recipe.is-selected{background:#496146;color:#fff5de;border-color:#496146}.stonepot-recipe:disabled:not(.is-selected){opacity:.55;cursor:default}
.stonepot-customer{grid-column:1/-1;font-size:14px;margin:0;color:#746449;line-height:1.5}.stonepot-step-index{display:block;font-size:11px;letter-spacing:.17em;text-transform:uppercase;color:#93734c;margin-bottom:6px}.stonepot-title{font:600 23px/1.45 "Noto Serif TC","PMingLiU",serif;color:#3f523b;margin:0 0 8px}.stonepot-instruction{font-size:15px;line-height:1.75;margin:0 0 15px;color:#73644f}
.stonepot-steps{list-style:none;padding:0;margin:0 0 18px;display:flex;justify-content:space-between;gap:3px;border-bottom:1px solid #c7bda5}.stonepot-steps li{font-size:12px;color:#9b907a;padding:6px 1px 9px}.stonepot-steps li.is-current{color:#496146;border-bottom:2px solid #496146}.stonepot-steps li.is-done{color:#5e7350}
.stonepot-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border:1px solid #cfc5ad;padding:11px 7px;gap:4px;background:#eae3d0}.stonepot-stats>div{text-align:center;min-width:0}.stonepot-stats span{display:block;font-size:11px;color:#887559;white-space:nowrap}.stonepot-stats strong{display:block;font-size:17px;color:#4c4a35;font-weight:600;margin-top:3px;white-space:nowrap}
.stonepot-pending{padding:11px;margin-top:12px;background:#e4e7cf;font-size:13px}.stonepot-pending span{display:block}.stonepot-pending button{font-size:13px;margin-top:6px;width:100%}
.stonepot-dock{margin-top:17px}.stonepot-tool-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.stonepot-tool{min-height:46px;border:1px solid #b6a786;background:#f9f3e5;color:#69573f;padding:8px 5px;border-radius:3px;font:500 13px/1.3 system-ui;cursor:pointer}.stonepot-tool.is-selected{background:#56694c;color:#fff5d9;border-color:#56694c}.stonepot-dock-hint{font-size:13px;line-height:1.65;color:#817056;margin:11px 0 14px}.stonepot-actions{display:grid;grid-template-columns:1fr 1.38fr;gap:8px}.stonepot-secondary,.stonepot-primary{min-height:48px;border-radius:3px;border:1px solid #aa9474;padding:10px 8px;font:600 14px/1.4 system-ui;cursor:pointer}.stonepot-secondary{background:#f1e7d3;color:#6d543c}.stonepot-primary{background:#47603f;color:#fff3d5;border-color:#47603f}.stonepot-primary:hover{background:#354e30}.stonepot-keyboard{border-top:1px solid #d1c6ae;margin-top:18px;padding-top:12px;color:#8a795e;font-size:12px}.stonepot-keyboard summary{cursor:pointer;min-height:44px}.stonepot-keyboard p{margin:6px 0;line-height:1.8}
.stonepot-result-kicker{font-size:12px;color:#7e8058;letter-spacing:.08em;margin:0 0 8px}.stonepot-result h2{font:600 28px/1.3 "Noto Serif TC","PMingLiU",serif;margin:0 0 16px;color:#38503b}.stonepot-scores{display:grid;grid-template-columns:1fr 1fr;border-top:1px solid #c8b99e;border-bottom:1px solid #c8b99e;padding:12px 0}.stonepot-scores>div{text-align:center}.stonepot-scores>div+div{border-left:1px solid #c8b99e}.stonepot-scores strong{display:block;font:500 40px/1.2 Georgia,serif;color:#496146}.stonepot-scores span{font-size:12px;color:#7b6b50}.stonepot-result blockquote{margin:15px 0;padding:11px 13px;border-left:2px solid #b78953;background:#eae3cf;font-size:14px;color:#6e573d;line-height:1.7}.stonepot-result-summary{font-size:13px;line-height:1.7;color:#7b6a50}.stonepot-score-row{margin-top:13px}.stonepot-score-row>div{display:flex;justify-content:space-between;font-size:13px;color:#66543c}.stonepot-score-row p{font-size:12px;margin:4px 0;color:#8b785e;line-height:1.6}.stonepot-meter{display:block;height:4px;background:#d8ccb2;margin-top:6px;overflow:hidden}.stonepot-meter>i{display:block;height:100%;background:#8f7150}.stonepot-collected{font-size:12px;color:#6e7951;line-height:1.6;margin-top:17px}
.stonepot-book{width:min(960px,calc(100vw - 24px));max-width:960px;max-height:calc(100dvh - 30px);overflow:auto;border:1px solid #b5a482;border-radius:5px;background:#f3ecdb;padding:24px;color:#5b4630}.stonepot-book::backdrop{background:#251d18aa;backdrop-filter:blur(4px)}.stonepot-book-head{display:flex;align-items:center;justify-content:space-between;gap:14px;position:sticky;top:-24px;background:#f3ecdb;padding:8px 0 12px;z-index:2;border-bottom:1px solid #c6b798}.stonepot-book-head h2{font:600 28px "Noto Serif TC","PMingLiU",serif;margin:0}.stonepot-book-intro{font-size:14px;line-height:1.7;color:#857056}.stonepot-book-counts{font-size:14px;color:#7d4935;padding:10px 0;border-bottom:1px solid #c6b798}.stonepot-book h3{font-size:18px;line-height:1.6}.stonepot-achievements{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.stonepot-achievement{background:#e9e1cc;border:1px solid #d2c3a4;padding:11px;position:relative}.stonepot-achievement strong{font-size:13px;display:block;padding-right:45px}.stonepot-achievement>span{position:absolute;right:10px;top:11px;font-size:12px;color:#8c7150}.stonepot-achievement p{font-size:12px;line-height:1.6;color:#917b5d;margin:8px 0 0}.stonepot-achievement.is-earned{border-color:#798254;background:#e0e4ca}.stonepot-recent{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.stonepot-receipt{background:#fff6e4;border:1px solid #cfbc96}.stonepot-receipt canvas{display:block;width:100%;height:auto}.stonepot-receipt>div{padding:11px}.stonepot-receipt strong{display:block;font-size:16px;color:#714531}.stonepot-receipt span{display:block;font-size:12px;line-height:1.6;color:#8d7657;margin-top:5px}.stonepot-preview-missing{aspect-ratio:4/3;display:grid;place-items:center;background:#e2d8bc;color:#8a7655;font-size:13px}.stonepot-book-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.stonepot-book-card{padding:14px;background:#fff6e4;border:1px solid #c8b38c}.stonepot-book-card.is-locked{background:#e8e1cd;border-color:#d4c7aa}.stonepot-card-status{font-size:11px;letter-spacing:.13em;color:#8b8064}.stonepot-book-card h3{margin:8px 0;font:600 18px/1.5 "Noto Serif TC","PMingLiU",serif}.stonepot-book-card p{font-size:13px;color:#846e51;line-height:1.7}.stonepot-book-card small{font-size:11px;color:#a18b69}.stonepot-controls [hidden],.stonepot-order [hidden],.stonepot-book [hidden],.stonepot-dock [hidden]{display:none!important}
@media(max-width:820px){body[data-active-game="invaders"] #play-view .play-layout{width:min(680px,calc(100% - 24px));margin-top:8px}body[data-active-game="invaders"] #play-view .game-machine{grid-template-columns:minmax(0,1fr)}.stonepot-order{grid-template-columns:1fr;gap:7px;padding:11px 14px}.stonepot-recipes{grid-column:1;grid-row:2}.stonepot-customer{font-size:12px;grid-row:3}.stonepot-eyebrow{font-size:14px}body[data-active-game="invaders"] #play-view .canvas-wrap{grid-column:1;grid-row:2}body[data-active-game="invaders"] #play-view .game-controls.stonepot-controls{grid-column:1;grid-row:3;border-left:0;border-top:1px solid #c7bda5;padding:17px 17px 18px}.stonepot-title{font-size:23px}.stonepot-instruction{font-size:15px;margin-bottom:10px}.stonepot-stats{padding:9px}.stonepot-steps{margin-bottom:12px}.stonepot-keyboard{margin-bottom:0}.stonepot-dock{margin-top:13px}.stonepot-book-grid,.stonepot-achievements{grid-template-columns:repeat(2,minmax(0,1fr))}.stonepot-recent{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:480px){body[data-active-game="invaders"] #play-view{padding-bottom:calc(135px + env(safe-area-inset-bottom))}body[data-active-game="invaders"] #play-view .play-header{width:calc(100% - 20px);min-height:57px;padding-block:5px;gap:7px;grid-template-columns:52px minmax(0,1fr) 82px}body[data-active-game="invaders"] .play-heading h1{font-size:19px}body[data-active-game="invaders"] .play-heading>span{display:none}body[data-active-game="invaders"] #play-view .play-layout{width:100%;margin:0}body[data-active-game="invaders"] #play-view .game-machine{border:0;border-radius:0;box-shadow:none}.stonepot-order{padding:8px 12px;gap:4px}.stonepot-book-button{padding:5px 10px;font-size:12px;min-height:44px}.stonepot-recipe{font-size:13px;min-height:44px;padding:7px 5px}.stonepot-customer{font-size:11px;margin:4px 0}.stonepot-eyebrow{font-size:13px;letter-spacing:.08em}body[data-active-game="invaders"] #play-view .game-controls.stonepot-controls{padding:14px 14px 16px}.stonepot-work-top{margin-bottom:7px}.stonepot-title{font-size:20px;margin-bottom:6px}.stonepot-step-index{font-size:10px;margin-bottom:4px}.stonepot-instruction{font-size:14px;line-height:1.65}.stonepot-steps{margin-bottom:10px}.stonepot-steps li{font-size:11px;padding-bottom:6px}.stonepot-stats{padding:8px 5px}.stonepot-stats span{font-size:11px}.stonepot-stats strong{font-size:16px}.stonepot-dock{position:fixed;bottom:0;left:0;right:0;z-index:25;margin:0;padding:9px 12px calc(10px + env(safe-area-inset-bottom));background:#f3edddf7;border-top:1px solid #b5a07b;box-shadow:0 -6px 20px #46311820;backdrop-filter:blur(10px)}.stonepot-tool-row{gap:6px;margin-bottom:7px}.stonepot-tool{min-height:44px;font-size:13px;padding:8px 4px}.stonepot-dock-hint{display:none}.stonepot-actions{gap:7px}.stonepot-primary,.stonepot-secondary{min-height:46px;font-size:13px;padding:8px 6px}.stonepot-keyboard{margin-top:12px}.stonepot-book{padding:16px 12px;width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.stonepot-book-head{top:-16px}.stonepot-book-head h2{font-size:23px}.stonepot-book-intro{font-size:13px}.stonepot-book-counts{font-size:12px}.stonepot-book-grid{grid-template-columns:1fr 1fr;gap:7px}.stonepot-book-card{padding:10px}.stonepot-book-card h3{font-size:16px}.stonepot-book-card p{font-size:12px}.stonepot-achievements{grid-template-columns:1fr}.stonepot-recent{gap:8px}.stonepot-receipt>div{padding:8px}.stonepot-receipt strong{font-size:14px}.stonepot-receipt span{font-size:10px}.stonepot-result h2{font-size:27px}.stonepot-scores strong{font-size:37px}}
@media(prefers-reduced-motion:reduce){.stonepot-book,.stonepot-tool,.stonepot-recipe{scroll-behavior:auto;transition:none}}

.stonepot-additions{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:7px}.stonepot-culture{font-size:12px;line-height:1.7;color:#82775e;margin:12px 0 0}.stonepot-stats strong{font-size:16px}.stonepot-tool{font-size:14px}.stonepot-steps li{font-size:13px}
@media(max-width:480px){.stonepot-order{padding:4px 12px;gap:3px}.stonepot-customer{display:none}.stonepot-dock{padding-top:7px}.stonepot-dock-hint{display:block;font-size:12px;line-height:1.4;margin:0 0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stonepot-additions{margin-top:0}.stonepot-tool{font-size:14px}.stonepot-culture{font-size:12px}.stonepot-controls[data-phase=arrange] .stonepot-dock-hint{display:none}body[data-active-game=invaders] #play-view .play-header{min-height:54px}.stonepot-eyebrow{font-size:12px}.stonepot-book-button{font-size:14px}.stonepot-recipe{font-size:14px}.stonepot-keyboard summary{min-height:44px}}

/* Compact counters retain the whole canvas and put live measurements first. */
@media (max-width:759px) and (max-height:740px) {
 body[data-active-game="invaders"] #play-view .play-header{min-height:54px;padding-block:5px}
 body[data-active-game="invaders"] #play-view .play-layout{width:100%;margin:0}
 body[data-active-game="invaders"] #play-view .game-machine{border:0;border-radius:0}
 body[data-active-game="invaders"] .stonepot-order{padding:4px 12px;gap:2px;grid-template-columns:1fr}
 body[data-active-game="invaders"] .stonepot-heading{min-height:44px}
 body[data-active-game="invaders"] .stonepot-customer{display:none}
 body[data-active-game="invaders"] .stonepot-recipes{grid-row:2;grid-column:1;gap:5px}
 body[data-active-game="invaders"] .stonepot-recipe,body[data-active-game="invaders"] .stonepot-book-button{min-height:44px;padding-block:5px}
 body[data-active-game="invaders"] #play-view .canvas-wrap{width:min(100%,max(180px,calc((100dvh - 332px - env(safe-area-inset-bottom)) * 1.111111)));height:auto;min-height:0;max-height:none;aspect-ratio:10 / 9;margin-inline:auto;justify-self:center;display:block}
 body[data-active-game="invaders"] #play-view .canvas-wrap>canvas{display:block;width:100%;max-width:none;height:auto;aspect-ratio:10 / 9;object-fit:fill}
 body[data-active-game="invaders"] #play-view .game-controls.stonepot-controls{display:flex;flex-direction:column;min-width:0;padding:6px 12px 18px;gap:0}
 body[data-active-game="invaders"] .stonepot-stats:not([hidden]){display:grid;order:0;grid-template-columns:repeat(3,minmax(0,1fr));min-height:48px;padding:5px 4px;margin:0;flex:none}
 body[data-active-game="invaders"] .stonepot-stats span{font-size:11px;line-height:1.3}
 body[data-active-game="invaders"] .stonepot-stats strong{font-size:16px;line-height:1.35;margin-top:2px}
 body[data-active-game="invaders"] .stonepot-work-top:not([hidden]){display:block;order:2;margin:9px 0 0}
 body[data-active-game="invaders"] .stonepot-step-index,body[data-active-game="invaders"] .stonepot-title,body[data-active-game="invaders"] .stonepot-steps{display:none}
 body[data-active-game="invaders"] .stonepot-instruction{font-size:14px;line-height:1.55;margin:0}
 body[data-active-game="invaders"] .stonepot-pending{order:1;margin-top:9px}
 body[data-active-game="invaders"] .stonepot-result{order:0}
 body[data-active-game="invaders"] .stonepot-keyboard:not([hidden]){display:block;order:3;margin-top:9px;padding-top:5px}
 body[data-active-game="invaders"] .stonepot-keyboard summary{min-height:44px;display:flex;align-items:center}
 body[data-active-game="invaders"] .stonepot-dock{padding:6px 12px calc(8px + env(safe-area-inset-bottom));margin:0}
 body[data-active-game="invaders"] .stonepot-dock-hint{display:none}
 body[data-active-game="invaders"] .stonepot-tool-row{margin-bottom:6px}
 body[data-active-game="invaders"] .stonepot-tool{min-height:44px}
 body[data-active-game="invaders"] .stonepot-primary,body[data-active-game="invaders"] .stonepot-secondary{min-height:46px}
}
@media (max-width:480px) {
 body[data-active-game="invaders"] .stonepot-recent{grid-template-columns:minmax(0,1fr)}
}

@media (max-width:759px) and (max-height:740px) {
 body[data-active-game="invaders"] .stonepot-dock{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
 body[data-active-game="invaders"] .stonepot-dock .stonepot-tool-row{display:contents}
 body[data-active-game="invaders"] .stonepot-dock .stonepot-tool{min-width:0;min-height:44px;padding:5px 2px;font-size:13px;line-height:1.3;white-space:normal}
 body[data-active-game="invaders"] .stonepot-dock .stonepot-actions{grid-column:1/-1}
 body[data-active-game="invaders"] .stonepot-controls[data-phase="cook"] .stonepot-dock{grid-template-columns:repeat(3,minmax(0,1fr))}
 body[data-active-game="invaders"] .stonepot-culture{order:4}
}
