:root{color-scheme:light;--cream:#fbf6e9;--ink:#4a352b;--muted:#8e7969;--line:#e1d2ba;--yellow:#f3d56e;--mint:#d9e9df;--red:#db7b69}*{box-sizing:border-box}body{margin:0;background:var(--cream);color:var(--ink);font:14px/1.65 -apple-system,BlinkMacSystemFont,'PingFang SC','Microsoft YaHei',sans-serif}button,a,input{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer}button:disabled{cursor:default;opacity:.48}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #4d98ac;outline-offset:3px}button{border:1.5px solid var(--line);background:#fffdf6;border-radius:10px;padding:10px 15px}a{color:inherit;text-decoration:none}.topbar{max-width:1440px;margin:auto;padding:18px 30px;display:flex;align-items:center;justify-content:space-between;gap:16px}.brand{display:flex;gap:10px;align-items:center;font-size:16px;font-weight:900;line-height:1.3}.brand>span{display:grid;place-items:center;background:var(--yellow);border:2px solid var(--ink);border-radius:11px;width:38px;height:42px;font-size:23px;transform:rotate(-5deg)}.brand small{display:block;font-size:9px;letter-spacing:2px;color:var(--muted);margin-top:5px}.top-actions{display:flex;gap:18px;align-items:center;font-size:12px}.top-actions button{padding:5px 10px;background:transparent}.preview-label{color:var(--muted);font-size:11px}.game-layout{max-width:1440px;margin:10px auto 30px;padding:0 30px;display:grid;grid-template-columns:210px minmax(320px,1fr) 200px;gap:27px;align-items:start}.story-panel,.arsenal-panel{padding-top:22px}.eyebrow{color:#a58155;font-size:10px;font-weight:800;letter-spacing:1.3px}h1{font-size:29px;line-height:1.3;margin:12px 0}h2{font-size:22px;line-height:1.3}.story-panel>p{color:var(--muted);font-size:12px}.chapter-stamp{font-size:75px;line-height:1.4;text-align:center;background:#f2e7ca;border-radius:26px;margin:20px 0;transform:rotate(-3deg)}.story-actions{display:grid;gap:8px}.story-actions button{display:flex;justify-content:space-between;align-items:center;text-align:left;font-weight:700}.story-actions span{font-size:10px;color:var(--muted)}.wallet{margin:22px 0 12px;padding:18px;background:#f1e7d3;border-radius:12px}.wallet>span{display:block;font-size:11px;color:var(--muted)}.wallet strong{font-size:28px;line-height:1.5}.wallet small{display:block;font-size:10px}.story-panel #quality-button{width:100%;background:var(--mint);font-size:11px}.save-note{font-size:10px!important}.control-copy{font-size:10px!important;line-height:1.8;border-top:1px solid var(--line);padding-top:14px;margin-top:22px!important}.battle-column{min-width:0}.battle-hud{display:flex;align-items:center;gap:15px;padding:12px 0}.health{display:grid;grid-template-columns:auto minmax(55px,95px) 26px;align-items:center;gap:8px;font-size:11px}.health>span{font-weight:700}.hp-track{height:8px;border-radius:8px;background:#e7d9c6;overflow:hidden}.hp-track i{display:block;height:100%;background:#a8cdb6;border-radius:8px;transition:width .15s}.health b{font-size:11px}.objectives{display:flex;gap:12px;margin-left:auto;font-size:11px;color:var(--muted)}#pause-button{padding:3px 10px;font-weight:900;background:#fffdf6}.stage{height:min(76vh,780px);min-height:470px;position:relative;border:2px solid #b99b75;border-radius:20px;overflow:hidden;background:#e3d5b3;box-shadow:0 7px 0 #dfd1b7;touch-action:none}.stage canvas{display:block;width:100%;height:100%;outline:0;touch-action:none}#boss-hud{position:absolute;left:15%;right:15%;top:15px;pointer-events:none;background:#fff6e9e8;border:1px solid #c28f73;border-radius:8px;padding:7px 10px;text-align:center;font-size:10px}#boss-hud>div{height:6px;background:#eedbcc;border-radius:4px;overflow:hidden}#boss-hud i{display:block;height:100%;background:#cd7969}#boss-number{font-weight:500}#lesson-banner{position:absolute;top:18px;left:8%;right:8%;background:#fffaf0ed;border:1px solid #d9c19b;box-shadow:0 3px 9px #49372e17;border-radius:12px;text-align:center;padding:11px;font-size:12px;pointer-events:none}#toast{position:absolute;bottom:20px;left:15%;right:15%;background:#49392fee;color:#fff4d8;border-radius:10px;padding:9px 12px;font-size:12px;text-align:center;pointer-events:none;opacity:0;transition:opacity .15s}#toast.visible{opacity:1}.battle-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:20px}.battle-footer button{padding:8px 12px;font-size:11px}#quick-weapon b{background:var(--yellow);border-radius:4px;padding:2px 5px;margin-left:6px;font-size:10px}#wave-time{font-size:10px;color:var(--muted);text-align:center}#cry-button{position:relative;overflow:hidden;background:#e6eff0;min-width:130px}#cry-button span{position:relative;z-index:1}#cry-fill{position:absolute;inset:0 auto 0 0;width:0;background:#acd8e0;transition:width .15s}.arsenal-panel h2{font-size:21px;margin:12px 0}#weapon-glyph{display:grid;place-items:center;font-size:65px;background:#eee4d1;border:1px solid var(--line);border-radius:22px;height:142px;margin:22px 0 14px}#weapon-role{font-size:12px;color:var(--muted);min-height:60px}.arsenal-panel dl{font-size:11px;margin:16px 0 25px}.arsenal-panel dl>div{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding:8px 0}.arsenal-panel dd{font-weight:800;margin:0}.tip-card{padding:15px;border:1px dashed #c6b49a;border-radius:11px;font-size:11px}.tip-card p{margin:7px 0 0;color:var(--muted)}.motion-toggle{display:block;margin-top:24px;font-size:10px;color:var(--muted)}.motion-toggle input{vertical-align:middle}.touch-controls{display:none;position:absolute;inset:0;pointer-events:none}#joystick{position:absolute;left:22px;bottom:24px;width:96px;height:96px;border:2px solid #78644c55;background:#fff7e648;border-radius:50%;pointer-events:auto;touch-action:none;user-select:none}#joystick i{display:block;position:absolute;left:26px;top:26px;width:40px;height:40px;background:#ad957c88;border:2px solid #fff9e8aa;border-radius:50%;pointer-events:none}#joystick span{position:absolute;top:100%;left:35px;font-size:10px;color:#7b6651}#touch-fire{position:absolute;bottom:28px;right:24px;width:76px;height:76px;border:3px solid #af884e;background:#efd079b8;border-radius:50%;font-weight:900;font-size:18px;pointer-events:auto;touch-action:none;user-select:none}#touch-fire.held{background:#f6e398;transform:scale(.94)}dialog{border:2px solid #b59978;border-radius:20px;padding:25px;color:var(--ink);background:#fffaf0;width:min(640px,calc(100vw - 28px));max-height:85dvh;box-shadow:0 18px 80px #3f30264d}dialog::backdrop{background:#332a225f;backdrop-filter:blur(3px)}.dialog-heading{display:flex;align-items:center;justify-content:space-between}.dialog-heading>span{font-size:10px;letter-spacing:1px;color:#a47a4d}#close-menu{padding:1px 9px;background:transparent;border:0;font-size:26px}dialog h2{font-size:27px;margin:7px 0 12px}#dialog-copy{font-size:13px;color:var(--muted)}#dialog-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:22px}#dialog-actions button{font-weight:700}#dialog-actions .primary{background:var(--yellow);border-color:#b39459}.level-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}.level-card{padding:13px 5px;font-size:11px;text-align:center}.level-card strong{display:block;font-size:20px}.level-card small{display:block;font-size:9px}.level-card.complete{background:#e1eee4;border-color:#a9c5ad}.level-card.boss{border-color:#c89a80}.weapon-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.weapon-card{text-align:left;padding:15px}.weapon-card .glyph{font-size:27px;float:right}.weapon-card strong{display:block;font-size:14px}.weapon-card small{display:block;font-size:10px;color:var(--muted);margin-top:6px}.weapon-card.selected{border:2px solid #b9a05b;background:#fff3c9}.result-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:18px 0}.result-grid>div{background:#f0e7d5;border-radius:10px;padding:13px;text-align:center;font-size:10px}.result-grid strong{display:block;font-size:23px}.menu-note{padding:13px 15px;background:#e8eee4;border-radius:10px;font-size:12px}.primary{background:var(--yellow)}
@media(max-width:1150px){.game-layout{grid-template-columns:185px minmax(320px,1fr);gap:20px;max-width:1080px}.arsenal-panel{display:none}.stage{height:76vh}.topbar{max-width:1080px}h1{font-size:25px}}
@media(pointer:coarse){.touch-controls{display:block}.control-copy{display:none}#toast{bottom:140px}}
@media(max-width:700px){body{overflow-x:hidden}.topbar{padding:12px 15px}.brand{font-size:13px}.brand>span{width:29px;height:32px;font-size:18px;border-radius:8px}.brand small{font-size:7px}.preview-label{display:none}.top-actions{gap:10px;font-size:10px}.top-actions a{display:none}.game-layout{display:flex;flex-direction:column;padding:0 12px;margin:0 0 20px;gap:6px}.story-panel{padding:0;width:100%;display:flex;align-items:center;gap:7px;flex-wrap:wrap}.story-panel>.eyebrow{display:none}h1{font-size:18px;margin:3px 0;flex:1}.story-panel>p,.chapter-stamp,.wallet small,.wallet>span,.control-copy,.save-note{display:none}.story-actions{display:flex;gap:5px}.story-actions button{padding:6px 8px;font-size:10px}.story-actions span{display:none}.wallet{padding:3px 8px;margin:0;background:#f1e7d3;line-height:1.2;order:4}.wallet strong{font-size:15px}.wallet strong::before{content:'币 ';font-size:10px}.story-panel #quality-button{width:auto;padding:6px 8px;font-size:9px;order:5}.battle-column{width:100%}.battle-hud{padding:8px 0;gap:8px}.health{grid-template-columns:auto 70px 21px;gap:6px;font-size:10px}.objectives{gap:7px;font-size:10px}#pause-button{padding:2px 9px}.stage{height:calc(100dvh - 216px);min-height:380px;max-height:850px;border-radius:14px;box-shadow:0 4px 0 #dfd1b7}.battle-footer{margin-top:12px;gap:5px}.battle-footer button{font-size:10px;padding:7px 8px}#wave-time{font-size:9px}#cry-button{min-width:110px}#joystick{left:17px;bottom:25px}#touch-fire{right:19px;bottom:30px}.touch-controls{display:block}#toast{bottom:139px;left:8%;right:8%}#lesson-banner{font-size:11px;top:13px}#boss-hud{left:10%;right:10%;top:11px}dialog{padding:20px}dialog h2{font-size:23px}.level-grid{gap:6px}.level-card{padding:9px 3px}.level-card strong{font-size:17px}.level-card small{font-size:8px}.weapon-grid{gap:7px}.weapon-card{padding:11px}.weapon-card strong{font-size:12px}.result-grid strong{font-size:20px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

@media(max-width:700px){.story-panel h1{flex:0 0 100%;font-size:17px;line-height:1.35;margin:1px 0}.story-panel{gap:6px}.stage{height:calc(100dvh - 225px)}}

/* The menus use the same real artwork as the battlefield. */
.brand>span{overflow:hidden;background:#fbe396}
.brand>span img{width:52px;height:52px;object-fit:contain;transform:translateY(5px)}
.chapter-stamp{height:190px;background:radial-gradient(ellipse,#fff9e9 35%,#f1dfb2 100%);display:flex;align-items:center;justify-content:center;transform:none;border:1px solid #e0c89c}
.chapter-stamp img{height:205px;width:205px;object-fit:contain;filter:drop-shadow(0 6px 0 #b38b4520)}
.weapon-art{display:block;width:100%;height:100%;object-fit:contain}
#weapon-glyph{padding:10px;background:radial-gradient(ellipse,#fffcf4 20%,#eee4d1 100%)}
.weapon-card .glyph{display:block;float:none;width:100%;height:86px;margin-bottom:7px}
.weapon-card:disabled{opacity:.6}
@media(max-width:700px){.chapter-stamp{display:none}.weapon-card .glyph{height:76px}.brand>span img{width:40px;height:40px}}

/* Keep the win condition distinct from optional loot. */
.objectives{align-items:center;gap:9px}
#enemies-left{order:-1;background:#fbe4db;border:1px solid #d99981;color:#944736;padding:3px 9px;border-radius:7px;font-size:12px;font-weight:800;white-space:nowrap}
#props-left{color:#9b7943;font-size:10px;white-space:nowrap}
#lesson-banner{border-color:#d8ac69;background:#fff8e4f2;font-weight:650}
@media(max-width:700px){#props-left{display:none}#enemies-left{font-size:11px;padding:3px 6px}.objectives{gap:3px}.health{grid-template-columns:auto 60px 21px}}
