* { box-sizing: border-box; }
:root {
 --ink:#1d3a26; --cream:#fbf3d9; --parch:#f3e6bf; --parch-2:#e9d7a6; --wood:#6b4426; --wood-dark:#3f2614; --wood-light:#9a6a3c;
 --gold:#ffc93c; --gold-dark:#b9821c; --leaf:#5fae3c; --leaf-dark:#2f6a24; --red:#d9483b; --sky:#183f2f;
 --display:"Lilita One","Baloo 2","Arial Rounded MT Bold",ui-rounded,"Trebuchet MS",system-ui,sans-serif;
 font-family:ui-rounded,"Nunito","Trebuchet MS",system-ui,sans-serif; color:var(--ink); background:#10301f; font-synthesis:none;
}
body { margin:0; min-height:100dvh; background:radial-gradient(ellipse at 50% -10%,#3f7a4c,#123622 60%,#0b2216); padding:clamp(0px,2vw,24px); }
button { font:inherit; }
[hidden] { display:none!important; }
.visually-hidden { position:absolute!important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
kbd { font:800 11px/1 ui-monospace,Menlo,monospace; padding:3px 6px; border-radius:6px; background:#fff8e3; border:1px solid #b99a62; box-shadow:0 2px 0 #b99a62; color:#4a3418; }
.shell { position:relative; display:flex; flex-direction:column; max-width:1240px; margin:auto; min-height:calc(100dvh - 48px); background:var(--cream); border:5px solid var(--wood-dark); border-radius:22px; overflow:hidden; box-shadow:0 0 0 3px #c99a55 inset,0 18px 65px #04140c90; }

/* Top bar: a carved wooden sign with gold lettering. */
.topbar { position:relative; min-height:72px; padding:12px 24px; color:#fff4d2; display:flex; align-items:center; gap:20px;
 background:repeating-linear-gradient(90deg,#ffffff06 0 2px,transparent 2px 9px),linear-gradient(180deg,#8a5a31,#6b4426 55%,#55341c); border-bottom:4px solid var(--wood-dark); box-shadow:0 4px 0 #00000025; }
.brand { display:flex; gap:9px; align-items:center; font-size:11px; letter-spacing:.13em; line-height:1.15; font-weight:900; flex:none; text-shadow:0 2px 0 #3a210f; }
.brand strong { font-family:var(--display); font-size:18px; letter-spacing:.06em; color:var(--gold); }.brand-mark { font-size:38px; color:var(--gold); line-height:1; filter:drop-shadow(0 2px 0 #3a210f); }
.hud { display:flex; align-items:center; justify-content:center; gap:clamp(10px,2vw,22px); margin:auto; }
.hud div { display:grid; gap:1px; min-width:74px; padding:5px 12px 6px; border-radius:12px; background:linear-gradient(#2d1a0c,#3f2614); border:2px solid #a87943; box-shadow:inset 0 2px 4px #0008,0 2px 0 #2b170a; text-align:center; }
.hud small,.profile-stats small { font-size:9px; letter-spacing:.12em; font-weight:900; opacity:.85; }
.hud b { font-family:var(--display); font-size:19px; color:#fff1c2; text-shadow:0 2px 0 #00000080; font-variant-numeric:tabular-nums; }
.hud div:nth-child(1) b { color:#c6f27a; }.hud div:nth-child(2) b { color:#ffe066; }.hud div:nth-child(4) b { color:#ffb2a6; }
.wave-tile { position:relative; }
.wave-tile:has(.call-wave:not([hidden])) > :is(small,b) { visibility:hidden; }
.call-wave { position:absolute; inset:-2px; display:grid; align-content:center; gap:1px; padding:0 2px; white-space:nowrap; border:2px solid #8a5a12; border-radius:inherit; background:linear-gradient(#ffe174,#ffc23a); color:#452f13; cursor:pointer; }
.call-wave strong { font-size:12px; line-height:1.15; }
.call-wave:active { background:#f2b630; }
.hud div.bump { animation:hud-bump .32s cubic-bezier(.3,1.8,.5,1); }
@keyframes hud-bump { 0% { transform:scale(1); } 40% { transform:scale(1.18); } 100% { transform:scale(1); } }
.topbar-actions { display:flex; gap:6px; }

/* Buttons: chunky, pressable, with a thick base. */
.btn { position:relative; border:3px solid #2c5a22; border-radius:14px; background:linear-gradient(#fffaf0,#efe2bb); color:#24451d; min-height:44px; padding:9px 16px; cursor:pointer; font-weight:900; letter-spacing:.01em;
 box-shadow:0 4px 0 #2c5a22,0 6px 8px #0003; transition:transform .08s,box-shadow .08s,filter .12s; }
.btn:hover { filter:brightness(1.06); transform:translateY(-1px); box-shadow:0 5px 0 #2c5a22,0 8px 10px #0003; }
.btn:active { transform:translateY(3px); box-shadow:0 1px 0 #2c5a22; }
.btn:disabled { opacity:.5; cursor:not-allowed; transform:none; filter:grayscale(.5); }
.btn.primary { background:linear-gradient(#ffe174,#ffc23a 60%,#f0a923); color:#4a2d07; border-color:#8a5a12; box-shadow:0 4px 0 #8a5a12,0 6px 10px #0004; text-shadow:0 1px 0 #fff4c4; }
.btn.primary:active { box-shadow:0 1px 0 #8a5a12; }
.btn.danger { background:linear-gradient(#ffd9cf,#f3a698); border-color:#8a2e22; color:#5a1a12; box-shadow:0 4px 0 #8a2e22; }
.btn.big { min-height:56px; font-size:18px; padding:13px 24px; font-family:var(--display); letter-spacing:.03em; }
.btn.small { font-size:12px; min-height:38px; padding:7px 11px; border-radius:11px; box-shadow:0 3px 0 #2c5a22; }
.topbar .btn { background:linear-gradient(#5e8e3e,#3f6f28); border-color:#24420f; color:#fffbe9; box-shadow:0 3px 0 #24420f; text-shadow:0 1px 0 #1b330c; }
.topbar .btn:active { box-shadow:0 0 0 #24420f; }
.topbar .btn[aria-pressed="true"] { background:linear-gradient(#ffd25a,#f0a923); color:#4a2d07; border-color:#8a5a12; text-shadow:none; }
.icon-btn { min-width:40px; font-size:16px!important; }
.skip-link { position:absolute; top:-100px; left:12px; z-index:100; background:#fff; padding:12px; }.skip-link:focus { top:12px; }
:focus-visible { outline:3px solid #ff9d2e; outline-offset:3px; }
.screen { padding:32px; }.eyebrow { font-size:11px; font-weight:900; letter-spacing:.15em; color:#8a6a2a; margin:0 0 12px; }

/* Title screen: a living garden scene with drifting pollen. */
.shed-screen { flex:1; display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr auto; position:relative; min-height:630px; padding:0; background:radial-gradient(ellipse at 20% 30%,#fff9e4,#f6e9c2 70%); }
.shed-copy { padding:clamp(40px,7vw,86px) 20px 42px clamp(30px,6vw,72px); align-self:center; z-index:1; }
.shed-copy h1 { font-family:var(--display); font-weight:400; font-size:clamp(46px,6.2vw,80px); line-height:.95; letter-spacing:-.01em; margin:0; color:#24521f; text-shadow:0 4px 0 #c99a55,0 8px 18px #6b442640; }
.shed-copy h1 em { font-style:normal; color:#e79a1c; text-shadow:0 4px 0 #8a5a12,0 8px 18px #6b442640; }
.intro { font-size:18px; line-height:1.55; max-width:390px; color:#5b5236; margin:22px 0; }.local-note { font-size:12px; color:#7a6a48; line-height:1.5; }
#btn-battle { font-size:22px; min-height:64px; padding:14px 30px; }
.shed-art { position:relative; min-height:440px; background:linear-gradient(180deg,transparent 65%,#163d3059),url('../assets/garden-scene.png') center/cover; border-left:4px solid var(--wood-dark); overflow:hidden; }
.shed-art::before,.shed-art::after { content:""; position:absolute; inset:-20%; pointer-events:none; background-image:radial-gradient(circle,#fff6b0 0 2px,transparent 3px),radial-gradient(circle,#ffffffcc 0 1.5px,transparent 2.5px); background-size:120px 140px,90px 110px; background-position:0 0,40px 60px; opacity:.7; }
.art-caption { position:absolute; bottom:20px; right:22px; font-size:11px; letter-spacing:.17em; font-weight:900; color:#fff4cc; text-shadow:0 2px 6px #153b2d; z-index:1; }
.shed-bottom { grid-column:1/-1; background:linear-gradient(#8a5a31,#6b4426); border-top:4px solid var(--wood-dark); color:#fff4d2; display:flex; align-items:center; justify-content:space-between; gap:22px; padding:20px 32px; }
.profile-stats { display:flex; gap:24px; }.profile-stats>span { display:grid; gap:4px; }.profile-stats b { font-family:var(--display); font-weight:400; font-size:17px; color:var(--gold); text-shadow:0 2px 0 #3a210f; }.profile-stats>span:last-child b { white-space:nowrap; }#shed-wins,#shed-losses,#shed-draws { display:inline; }
.shed-menu { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

/* Battle layout */
body.in-battle { padding:8px; overflow:hidden; }.in-battle .shell { height:calc(100dvh - 16px); min-height:0; display:flex; flex-direction:column; max-width:1500px; border-width:4px; border-radius:16px; }.in-battle .topbar { flex:none; min-height:58px; padding:7px 18px; }
.battle-screen { flex:1; min-height:0; padding:10px 14px 12px; display:flex; flex-direction:column; background:linear-gradient(#f4e8c4,#ead9a8); }
.battle-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; flex:none; }.battle-heading .eyebrow { display:none; }
.battle-heading h1,.sub-screen h1 { margin:0; font-family:var(--display); font-weight:400; font-size:26px; letter-spacing:.01em; color:#2b5622; }
.enemy-label { font-size:9px; letter-spacing:.1em; color:#8a6a3a; font-weight:900; text-align:right; }.enemy-label strong { display:inline; color:#b2412f; font-family:var(--display); font-weight:400; font-size:15px; letter-spacing:.02em; margin-left:8px; }
.battle-layout { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 252px; grid-template-rows:minmax(0,1fr) auto; gap:12px; }
.board-column { min-height:0; min-width:0; display:grid; place-items:center; background:radial-gradient(ellipse,#5b3a1f,#3f2614); border-radius:14px; box-shadow:inset 0 3px 10px #0007; }
.canvas-wrap { position:relative; display:grid; place-items:center; max-width:100%; max-height:100%; border:3px solid #2b170a; border-radius:12px; overflow:hidden; background:#6d9c5c; box-shadow:0 0 0 2px #b8874a,0 6px 18px #0008; }
#battle-canvas { display:block; touch-action:none; max-width:100%; }
#battle-canvas:focus-visible { outline:none; }
.paused-label { position:absolute; inset:0; display:grid; place-items:center; background:#0f2a1c80; color:#fff5d0; font-family:var(--display); font-size:42px; letter-spacing:.2em; text-shadow:0 4px 0 #00000080; pointer-events:none; backdrop-filter:blur(1.5px); }

/* In-field overlays share one clipped layer so their animations never make the field scrollable. */
.hud-layer { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:2; }
/* Wave banner: big, short-lived, never blocks input. */
.wave-banner { position:absolute; left:0; right:0; top:42%; display:grid; justify-items:center; gap:2px; pointer-events:none; z-index:3; padding:10px 0 12px;
 background:linear-gradient(90deg,transparent,#1b3f17d9 18%,#1b3f17d9 82%,transparent); color:#fff5c8; text-align:center; }
.wave-banner strong { font-family:var(--display); font-weight:400; font-size:clamp(28px,6vw,54px); letter-spacing:.08em; line-height:1; color:#ffe27a; text-shadow:0 4px 0 #6a4310,0 0 22px #ffcf4a90; }
.wave-banner span { font-size:clamp(11px,1.6vw,15px); font-weight:900; letter-spacing:.14em; text-transform:uppercase; }
.wave-banner[data-tone="boss"] { background:linear-gradient(90deg,transparent,#5a1010e0 18%,#5a1010e0 82%,transparent); }
.wave-banner[data-tone="boss"] strong { color:#ff8a6a; text-shadow:0 4px 0 #3a0808,0 0 26px #ff3a2aa0; }
.wave-banner[data-tone="win"] strong { color:#c6f27a; text-shadow:0 4px 0 #24420f,0 0 22px #9be05090; }
.wave-banner.show { animation:banner-in 2s cubic-bezier(.2,.9,.3,1) both; }
@keyframes banner-in { 0% { opacity:0; transform:scaleY(.2); } 10% { opacity:1; transform:scaleY(1.08); } 16% { transform:scaleY(1); } 82% { opacity:1; } 100% { opacity:0; } }
.wave-banner.show strong { animation:banner-title 2s cubic-bezier(.2,.9,.3,1) both; }
@keyframes banner-title { 0% { transform:translateX(-30%) scale(1.5); opacity:0; } 14% { transform:translateX(0) scale(1); opacity:1; } 84% { transform:translateX(0); } 100% { transform:translateX(18%); opacity:0; } }

/* Tutorial coach bubble */
.coach { position:absolute; left:50%; top:10px; transform:translateX(-50%); z-index:2; pointer-events:none; display:flex; align-items:center; gap:10px; max-width:min(92%,480px);
 padding:10px 14px; border-radius:14px; background:#fffaf0f2; border:3px solid #e0a324; box-shadow:0 4px 0 #8a5a12,0 8px 18px #0005; font-size:14px; font-weight:800; color:#3d2a10; }
.coach-step { flex:none; font:900 11px/1 system-ui; padding:5px 7px; border-radius:8px; background:#ffcc3d; color:#4a2d07; }
.coach.show { animation:coach-in .45s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes coach-in { from { opacity:0; transform:translate(-50%,-12px) scale(.9); } to { opacity:1; transform:translate(-50%,0) scale(1); } }

.battle-side { min-width:0; min-height:0; display:flex; flex-direction:column; gap:12px; }
.unit-inspector { padding:14px; background:linear-gradient(#fff8e2,#f3e3b6); border:3px solid #b8874a; border-radius:14px; min-height:232px; box-shadow:0 4px 0 #8a5f30; }
.unit-inspector[data-source="opponent"] { border-color:#b2513f; box-shadow:0 4px 0 #7a2e22; }
.inspect-heading { display:flex; gap:10px; align-items:center; min-height:49px; }.inspect-heading img { width:48px; height:48px; object-fit:contain; filter:drop-shadow(0 3px 2px #0003); }.inspect-heading small { display:block; color:#8a6a3a; font-size:10px; line-height:1.4; font-weight:900; text-transform:uppercase; }.inspect-heading h2 { margin:2px 0 0; font-family:var(--display); font-weight:400; font-size:21px; line-height:1.1; letter-spacing:.01em; color:#2b4a1e; }
.inspect-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:14px 0 10px; }.inspect-stats div { border-top:2px dotted #c9a66a; padding-top:7px; }.inspect-stats dt { font-size:11px; color:#7a6038; font-weight:800; }.inspect-stats dd { margin:2px 0 0; font-size:17px; font-weight:900; font-variant-numeric:tabular-nums; }
.inspect-footprint { font-size:12px; font-weight:900; color:#9a6a1c; margin:8px 0; }#inspect-desc { font-size:12px; line-height:1.45; color:#5f5236; margin:8px 0 0; }
.skill-heading h3 { margin:0; font-size:13px; color:#5a3d1c; letter-spacing:.04em; text-transform:uppercase; }.skill-buttons { margin-top:7px; }
.skill-btn { --charge:0; position:relative; overflow:hidden; width:100%; display:flex; justify-content:space-between; gap:8px; align-items:center; border:3px solid #7a5aa8; border-radius:12px; min-height:46px; padding:9px 10px; color:#fff; font-size:12px; font-weight:900; cursor:pointer; isolation:isolate;
 background:#3d2a5a; box-shadow:0 4px 0 #2a1a40; text-shadow:0 1px 0 #0008; transition:transform .08s,box-shadow .08s; }
.skill-btn::before { content:""; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,#a46cf0,#e08cf0); transform-origin:left; transform:scaleX(var(--charge)); transition:transform .25s; }
.skill-btn.ready { border-color:#ffd25a; box-shadow:0 4px 0 #8a5a12,0 0 14px #ffd25a90; }
.skill-btn.ready:active { transform:translateY(3px); box-shadow:0 1px 0 #8a5a12; }
.skill-btn.disabled { cursor:default; }
.skill-btn .slot-key { position:static; }
.emergency-bar { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.emergency-bar .btn { background:linear-gradient(#ffe0d6,#ffb6a3); border-color:#8a2e22; color:#5a1a12; box-shadow:0 3px 0 #8a2e22; animation:urgent 1.1s ease-in-out infinite; }
@keyframes urgent { 50% { filter:brightness(1.12); } }
.text-button { border:0; background:none; padding:8px 0; color:#5a3d1c; font:inherit; font-size:12px; font-weight:900; cursor:pointer; min-height:38px; }.battle-help { margin-top:auto; text-align:left; }

/* Toolbox: rarity-framed cards with a price tag and hotkey. */
.battle-dock { grid-column:1/-1; border-top:3px solid #c9a66a; padding-top:9px; min-width:0; }
.dock-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }.dock-heading h2 { font-family:var(--display); font-weight:400; font-size:19px; letter-spacing:.02em; margin:0; flex:none; color:#5a3d1c; }
.instruction { font-size:12px; color:#7a6038; line-height:1.35; margin:0 auto 0 0; }
.dock-slots { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:9px; }
.shop-slot { --rim:#9cb86a; --rim-dark:#5f7a36; --glow:transparent; position:relative; min-height:76px; display:grid; grid-template-columns:48px minmax(0,1fr); grid-template-rows:auto auto; text-align:left; gap:3px 7px; align-items:center; padding:8px;
 background:linear-gradient(#fffdf4,#f6ebcb); border:3px solid var(--rim); border-radius:14px; color:#2f2a17; cursor:grab; touch-action:none; box-shadow:0 4px 0 var(--rim-dark),0 0 0 0 var(--glow); transition:transform .1s,box-shadow .12s; }
.shop-slot:hover:not(.empty) { transform:translateY(-3px); box-shadow:0 7px 0 var(--rim-dark),0 0 16px var(--glow); }
.shop-slot:active:not(.empty) { cursor:grabbing; transform:translateY(2px); box-shadow:0 2px 0 var(--rim-dark); }
.rarity-rare { --rim:#4f9ae0; --rim-dark:#245a94; --glow:#4f9ae080; background:linear-gradient(#f4fbff,#dcecf8); }
.rarity-epic { --rim:#a565e8; --rim-dark:#5e2f94; --glow:#a565e890; background:linear-gradient(#fbf4ff,#ead9f8); }
.rarity-hero { --rim:#f0b429; --rim-dark:#8a5a12; --glow:#ffd25aa0; background:linear-gradient(#fffbea,#fbe8a8); }
.rarity-tool { --rim:#a07a4e; --rim-dark:#5a3d1c; background:linear-gradient(#fbf3e4,#ead8b8); }
.shop-slot .lvl { font-size:12px; line-height:1.15; font-weight:900; overflow-wrap:anywhere; }
.shop-slot .cost { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:900; color:#3f6a1e; }
.coin { width:11px; height:11px; border-radius:50%; background:radial-gradient(circle at 35% 35%,#e7ffb0,#7cc23a 60%,#3f7a1a); box-shadow:0 1px 0 #2f5a12; flex:none; }
.shop-slot.selected { --rim:#ffb21e; --rim-dark:#9a5a08; transform:translateY(-4px); box-shadow:0 8px 0 var(--rim-dark),0 0 0 3px #ffe08a,0 0 22px #ffc23a; }
.shop-slot.disabled { filter:saturate(.45); }
.shop-slot.disabled .cost { color:#b2412f; }
.shop-slot.empty { background:repeating-linear-gradient(45deg,#efe2bd 0 8px,#e8d9b0 8px 16px); border-style:dashed; --rim:#c4ad7a; --rim-dark:transparent; color:#8a7650; cursor:default; box-shadow:none; }
.empty-mark { grid-row:span 2; font-size:24px; text-align:center; color:#c4ad7a; }
.unit-icon { display:block; grid-row:span 2; width:48px; height:48px; object-fit:contain; user-select:none; -webkit-user-drag:none; filter:drop-shadow(0 3px 2px #0003); }
.card-level { position:absolute; top:-7px; left:-5px; padding:2px 6px; border-radius:9px; background:linear-gradient(#ffe174,#f0a923); border:2px solid #8a5a12; color:#4a2d07; font:900 10px/1.2 system-ui; font-style:normal; box-shadow:0 2px 0 #8a5a12; z-index:1; }
.slot-key { position:absolute; top:5px; right:6px; font-size:10px; padding:2px 5px; opacity:.75; }
.shop-slot.merge-partner { --rim:#4fbf3a; --rim-dark:#24701a; background:linear-gradient(#f2ffe0,#d6f2b0); box-shadow:0 4px 0 var(--rim-dark),0 0 0 3px #b8f07a,0 0 18px #7ad04a; animation:partner .7s ease-in-out infinite alternate; }
@keyframes partner { to { transform:translateY(-3px); } }
.shop-slot.pop { animation:card-pop .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes card-pop { 0% { transform:scale(.7); } 60% { transform:scale(1.12); } 100% { transform:scale(1); } }
.shop-slot.deal { animation:card-deal .4s cubic-bezier(.2,1.4,.5,1) both; }
.shop-slot.deal:nth-child(2) { animation-delay:.04s; }.shop-slot.deal:nth-child(3) { animation-delay:.08s; }.shop-slot.deal:nth-child(4) { animation-delay:.12s; }.shop-slot.deal:nth-child(5) { animation-delay:.16s; }
@keyframes card-deal { from { transform:translateY(30px) rotate(-6deg) scale(.8); opacity:0; } to { transform:none; opacity:1; } }
body:not(.gamepad) .pad-only { display:none; }
.drag-ghost { position:fixed; left:0; top:0; z-index:100; pointer-events:none; width:72px; height:72px; transform:translate(-50%,-60%) scale(1.1) rotate(-6deg); display:grid; place-items:center; filter:drop-shadow(0 10px 6px #173d3080); }
.drag-ghost img { width:100%; height:100%; object-fit:contain; }

/* Biomass orbs flying to the HUD */
.orb { position:fixed; z-index:15; width:16px; height:16px; border-radius:50%; pointer-events:none; background:radial-gradient(circle at 35% 35%,#f4ffd0,#9be050 50%,#4f9a2a); box-shadow:0 0 10px #b8f07a,0 0 2px #fff; }

/* Shed sub-screens */
.sub-screen { width:100%; max-width:850px; margin:0 auto; min-height:600px; padding:48px 32px; }.sub-screen>p:not(.eyebrow) { color:#6a5a3a; line-height:1.5; }
.skills-list { display:grid; gap:12px; margin:24px 0; }.skill-card { background:linear-gradient(#fff8e2,#f3e3b6); border:3px solid #b8874a; border-radius:14px; padding:15px; display:grid; gap:10px; box-shadow:0 4px 0 #8a5f30; }.skill-card h3 { margin:0; font-family:var(--display); font-weight:400; font-size:20px; color:#2b4a1e; }
.tier-row { display:flex; flex-wrap:wrap; gap:6px; }.tier-chip { background:#fffdf4; border:2px solid #e0cc9a; border-radius:8px; padding:6px; font-size:12px; }.tier-chip.owned { background:#c6ea9a; border-color:#5f9a3a; }.tier-chip.locked { opacity:.55; }.buy-btn { justify-self:start; }
.commander-choice { display:grid; gap:8px; margin-top:22px; max-width:400px; font-weight:900; }.commander-choice select { width:100%; min-height:48px; padding:10px; font:inherit; color:#193b2c; background:#fffdf4; border:3px solid #b8874a; border-radius:12px; }
.table-wrap { overflow:auto; }.lb-table { width:100%; border-collapse:collapse; margin:20px 0; }.lb-table th,.lb-table td { text-align:left; padding:12px; border-bottom:2px dotted #d6bf8a; white-space:nowrap; }.lb-table th { font-size:11px; color:#8a6a3a; }.lb-table .me { font-weight:900; background:#ffe9a8; }
.help-body { display:grid; gap:4px; margin:22px 0; }.help-body article { display:flex; gap:18px; border-top:2px dotted #d6bf8a; padding:16px 0; }.help-body article>b { color:#d0901c; font-family:var(--display); font-weight:400; font-size:22px; min-width:32px; }.help-body h2 { font-size:17px; margin:0 0 4px; }.help-body p { margin:0; color:#5f5236; line-height:1.5; }
.field-guide-art { margin:24px 0; overflow:hidden; border-radius:16px; background:#fdf5df; border:3px solid #b8874a; }.field-guide-art img { display:block; width:100%; height:auto; }.field-guide-art figcaption { padding:12px 16px; color:#5f5236; font-size:14px; }

/* Dialogs */
.overlay { position:fixed; inset:0; z-index:20; overflow:hidden; display:grid; place-items:center; padding:16px; background:#0b1f14cc; backdrop-filter:blur(3px); }
.result-card,.panel-card { position:relative; background:linear-gradient(#fffaf0,#f3e3b6); border:4px solid var(--wood-dark); border-radius:22px; padding:30px 32px; text-align:center; max-width:440px; width:100%; box-shadow:0 0 0 3px #c99a55 inset,0 14px 50px #000a; animation:dialog-in .35s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes dialog-in { from { transform:translateY(24px) scale(.9); opacity:0; } to { transform:none; opacity:1; } }
.result-card h2,.panel-card h2 { font-family:var(--display); font-weight:400; font-size:28px; margin:4px 0 12px; color:#2b4a1e; }
.result-banner { margin:-62px auto 6px; width:max-content; max-width:100%; padding:10px 34px 12px; font-family:var(--display); font-size:40px; letter-spacing:.08em; line-height:1; color:#fff8d0; border-radius:14px; text-shadow:0 3px 0 #0006;
 background:linear-gradient(#ffcf4a,#e8961c); border:4px solid #7a4a0c; box-shadow:0 6px 0 #7a4a0c,0 0 30px #ffd25a; }
.result-overlay[data-tone="loss"] .result-banner { background:linear-gradient(#e06a5a,#a8322a); border-color:#5a1410; box-shadow:0 6px 0 #5a1410,0 0 30px #ff5a4a90; }
.result-overlay[data-tone="draw"] .result-banner { background:linear-gradient(#a8b4c0,#6a7a8a); border-color:#2e3a48; box-shadow:0 6px 0 #2e3a48; }
.result-overlay[data-tone="win"]::before { content:""; position:absolute; left:50%; top:50%; width:150vmax; height:150vmax; margin:-75vmax 0 0 -75vmax; pointer-events:none; background:repeating-conic-gradient(from 0deg,#ffe27a2a 0 10deg,transparent 10deg 20deg); -webkit-mask:radial-gradient(circle,#000 10%,transparent 45%); mask:radial-gradient(circle,#000 10%,transparent 45%); animation:rays 14s linear infinite; }
@keyframes rays { to { transform:rotate(360deg); } }
.result-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:6px 0 12px; }
.result-stats div { display:grid; gap:2px; padding:10px 4px; border-radius:12px; background:#fffdf4; border:2px solid #e0cc9a; }
.result-stats b { font-family:var(--display); font-weight:400; font-size:26px; color:#2b4a1e; }.result-stats small { font-size:10px; font-weight:900; color:#8a6a3a; text-transform:uppercase; letter-spacing:.06em; }
.result-gold { font-family:var(--display); font-size:28px; color:#c27a12; margin:6px 0; text-shadow:0 2px 0 #fff4c4; }.result-rating { font-weight:800; color:#5f5236; margin:4px 0 16px; }
.result-previous { margin:6px 0; font-weight:800; color:var(--leaf-dark); }
.result-actions,.menu-list { display:grid; gap:10px; }
.result-card { max-height:calc(100dvh - 24px); overflow-y:auto; }
.result-card .result-banner { margin-top:0; }
.menu-hint { margin:16px 0 0; font-size:11px; color:#7a6038; line-height:2; }
.settings-card { text-align:left; }
.setting { display:grid; grid-template-columns:130px 1fr; align-items:center; gap:12px; padding:10px 0; border-bottom:2px dotted #d6bf8a; font-weight:900; color:#4a3418; }
.setting.check { grid-template-columns:auto 1fr; }
.setting input[type="range"] { width:100%; accent-color:#e79a1c; height:28px; }
.setting input[type="checkbox"] { width:22px; height:22px; accent-color:#5f9a3a; }
.settings-actions { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0; }
.settings-card > .btn.big { width:100%; }
.toast { position:fixed; z-index:30; bottom:16px; left:50%; transform:translate(-50%,12px); opacity:0; pointer-events:none; background:#2b170af0; color:#fff4d2; border:2px solid #c99a55; border-radius:12px; padding:10px 16px; max-width:min(90%,500px); text-align:center; font-size:13px; font-weight:900; transition:opacity .15s,transform .15s; box-shadow:0 6px 18px #0006; }
.toast.show { opacity:1; transform:translate(-50%,0); }.noscript { background:#f6f1da; padding:24px; }

@media (prefers-reduced-motion:no-preference) {
 .shop-slot .unit-icon { animation:toolbox-breathe 2.4s ease-in-out infinite; transform-origin:50% 90%; }.shop-slot:nth-child(2n) .unit-icon { animation-delay:-.7s; }.shop-slot:nth-child(3n) .unit-icon { animation-delay:-1.3s; }
 .battle-screen[data-paused='true'] .unit-icon,.battle-screen[data-paused='true'] .shop-slot { animation-play-state:paused; }
 @keyframes toolbox-breathe { 0%,100% { transform:translateY(0) rotate(-2deg); } 50% { transform:translateY(-2px) rotate(2deg); } }
 .shed-art::before { animation:pollen 18s linear infinite; }.shed-art::after { animation:pollen 26s linear infinite reverse; }
 @keyframes pollen { to { transform:translate(60px,-140px); } }
 #btn-battle { animation:cta 2.2s ease-in-out infinite; }
 @keyframes cta { 0%,100% { box-shadow:0 4px 0 #8a5a12,0 6px 10px #0004,0 0 0 0 #ffc23a80; } 50% { box-shadow:0 4px 0 #8a5a12,0 6px 10px #0004,0 0 0 10px #ffc23a00; } }
 .skill-btn.ready { animation:ready-glow 1.4s ease-in-out infinite; }
 @keyframes ready-glow { 50% { box-shadow:0 4px 0 #8a5a12,0 0 22px #ffd25a; } }
}
@media (max-width:760px) {
 body { padding:0; }.shell { border:0; border-radius:0; min-height:100dvh; box-shadow:none; }.topbar { padding:10px 14px; gap:10px; flex-wrap:wrap; }.hud { order:3; width:100%; justify-content:space-between; gap:6px; }.hud div { min-width:0; flex:1; padding:3px 4px 4px; }.hud b { font-size:15px; }.topbar-actions { margin-left:auto; }
 .shed-screen { grid-template-columns:1fr; }.shed-copy { padding:45px 24px 28px; }.shed-copy h1 { font-size:52px; }.shed-art { min-height:290px; border-left:0; border-top:4px solid var(--wood-dark); }.shed-bottom { display:block; padding:20px; }.profile-stats { justify-content:space-between; gap:8px; }.shed-menu { margin-top:20px; display:grid; grid-template-columns:repeat(2,1fr); }.shed-menu .btn { font-size:12px; padding:8px; }.sub-screen { padding:30px 20px; }
 body.in-battle { padding:0; }.in-battle .shell { height:100dvh; border:0; border-radius:0; }.in-battle .topbar { padding:6px 10px; min-height:70px; gap:5px; }.in-battle .brand { font-size:8px; }.in-battle .brand strong { font-size:12px; }.in-battle .brand-mark { font-size:25px; }.in-battle .topbar .btn { min-height:34px; padding:5px 8px; }.in-battle .hud { margin-top:2px; }.in-battle .hud small { font-size:8px; }.in-battle .hud b { font-size:14px; }
 .battle-screen { padding:6px 10px 8px; }.battle-heading { display:none; }.battle-layout { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto auto; gap:6px; }.board-column { width:100%; }.battle-side { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px; }.unit-inspector { min-height:108px; padding:8px; grid-column:1/-1; box-shadow:0 2px 0 #8a5f30; border-width:2px; }.inspect-heading { min-height:30px; }.inspect-heading img { width:30px; height:30px; }.inspect-heading small { font-size:8px; }.inspect-heading h2 { font-size:15px; }.inspect-stats { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; margin:6px 0; }.inspect-stats div { padding-top:4px; }.inspect-stats dt { font-size:9px; }.inspect-stats dd { font-size:13px; }.inspect-footprint { display:inline; font-size:10px; margin:0 5px 0 0; }#inspect-desc { display:inline; font-size:10px; line-height:1.3; }.ability-panel { display:flex; align-items:center; gap:5px; }.skill-heading { display:none; }.skill-buttons { margin:0; }.skill-btn { min-height:34px; font-size:10px; padding:5px 8px; gap:10px; border-width:2px; }.skill-btn .slot-key { display:none; }.emergency-bar { margin:0; }.emergency-bar .btn { min-height:34px; font-size:10px; padding:5px; }.battle-help { min-height:34px; font-size:10px; padding:4px 0; margin:0; text-align:right; }
 .battle-dock { padding-top:6px; }.dock-heading { gap:6px; margin-bottom:6px; }.dock-heading h2 { font-size:15px; }.instruction { display:none; }.dock-heading .btn { min-height:34px; font-size:11px; padding:5px 8px; }.dock-slots { gap:5px; }
 .shop-slot { min-height:88px; display:flex; flex-direction:column; justify-content:center; text-align:center; padding:5px 2px; gap:3px; border-width:2px; }.unit-icon { width:34px; height:34px; }.shop-slot .lvl { font-size:10px; }.shop-slot .cost { font-size:10px; }.shop-slot.empty .cost { font-size:9px; }.card-level { font-size:8px; padding:1px 4px; }.slot-key { display:none; }
 .coach { font-size:12px; padding:7px 10px; top:6px; }.result-banner { font-size:30px; }.result-card,.panel-card { padding:26px 18px; }.setting { grid-template-columns:100px 1fr; }
}
@media (max-width:760px) and (orientation:portrait) {
 .shop-slot { min-height:118px; gap:5px; }.unit-icon { width:54px; height:54px; }.shop-slot .lvl { font-size:11px; }
}
@media (max-width:360px) { .cost-unit { display:none; }.hud small { font-size:7px; letter-spacing:.02em; } .shop-slot .lvl { font-size:9px; }.brand strong { font-size:13px; }.in-battle .topbar .btn { font-size:11px; padding:5px 7px; } }
@media (max-height:560px) and (min-width:761px) {
 .battle-screen { padding:6px 10px 8px; }.battle-heading { display:none; }
 .battle-layout { grid-template-columns:minmax(0,1fr) 260px; grid-template-rows:minmax(0,1fr) auto; gap:6px 8px; }
 .board-column { grid-row:1/-1; }.battle-side { gap:5px; min-height:0; overflow:hidden; }
 .unit-inspector { flex:none; min-height:0; padding:7px; }.inspect-heading { min-height:24px; gap:6px; }.inspect-heading img { width:26px; height:26px; }.inspect-heading h2 { font-size:15px; }.inspect-heading small { font-size:8px; }
 .inspect-stats { grid-template-columns:repeat(4,minmax(0,1fr)); margin:5px 0; gap:4px; }.inspect-stats div { padding-top:4px; }.inspect-stats dt { font-size:8px; }.inspect-stats dd { font-size:11px; }.inspect-footprint { font-size:10px; margin:4px 0; }#inspect-desc { display:none; }
 .skill-heading,.battle-help { display:none; }.skill-buttons { margin:0; }.skill-btn { min-height:32px; padding:5px 8px; font-size:10px; }.skill-btn .slot-key { display:none; }.emergency-bar { margin-top:4px; }.emergency-bar .btn { min-height:28px; padding:4px; font-size:10px; }
 .battle-dock { grid-column:2; border-top:0; padding-top:0; }.dock-heading { margin-bottom:5px; }.dock-heading h2,.instruction { display:none; }.dock-heading .btn { width:100%; min-height:30px; font-size:11px; padding:4px; }
 .dock-slots { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px 5px; }
 .shop-slot { min-height:54px; display:flex; flex-direction:column; justify-content:center; text-align:center; padding:4px 2px; gap:1px; border-width:2px; }.unit-icon { width:26px; height:26px; }.shop-slot .lvl { font-size:9px; }.shop-slot .cost { font-size:9px; }.cost-unit,.slot-key { display:none; }.empty-mark { font-size:16px; }.card-level { font-size:8px; padding:1px 4px; }
 .in-battle .topbar { min-height:44px; padding:4px 14px; }.hud div { padding:2px 8px 3px; }.hud b { font-size:15px; }
 .overlay { padding:8px; }.result-card,.panel-card { padding:14px 20px; max-height:calc(100dvh - 16px); overflow:auto; max-width:560px; }
 .result-card h2,.panel-card h2 { font-size:20px; margin:2px 0 6px; }.result-banner { margin:0 auto 4px; font-size:24px; padding:6px 22px 8px; }
 .result-stats { margin:4px 0 6px; }.result-stats div { padding:4px; }.result-stats b { font-size:18px; }.result-gold { font-size:20px; margin:2px 0; }.result-rating { margin:2px 0 8px; font-size:13px; }
 .result-actions,.menu-list { grid-template-columns:1fr 1fr; gap:8px; }.result-actions .btn,.menu-list .btn { min-height:40px; padding:6px; }.menu-hint { margin-top:8px; line-height:1.6; }.result-card .local-note { font-size:10px; margin:6px 0 0; }
 .setting { grid-template-columns:120px 1fr; padding:4px 0; }.setting input[type="range"] { height:22px; }.settings-actions { margin:8px 0; }.settings-card > .btn.big { min-height:40px; }
}
@media (prefers-reduced-motion:reduce) { *,*:before,*:after { transition:none!important; animation:none!important; } }

/* Simplified Chinese typography. The Latin display face has no CJK glyphs, so
   Chinese text falls back to the platform font; this swaps in rounded,
   friendly CJK faces with heavier weights and tuned letter-spacing. */
[lang="zh"] { --display:"Yuanti SC","YouYuan","PingFang SC","Microsoft YaHei","HarmonyOS Sans SC","MiSans",ui-rounded,sans-serif; }
[lang="zh"] body { font-family:"PingFang SC","Microsoft YaHei","HarmonyOS Sans SC","MiSans",system-ui,sans-serif; }
[lang="zh"] .brand strong,[lang="zh"] .hud b,[lang="zh"] .btn.big,[lang="zh"] .profile-stats b,
[lang="zh"] .battle-heading h1,[lang="zh"] .sub-screen h1,[lang="zh"] .enemy-label strong,
[lang="zh"] .inspect-heading h2,[lang="zh"] .dock-heading h2,[lang="zh"] .skill-card h3,
[lang="zh"] .help-body article>b,[lang="zh"] .result-card h2,[lang="zh"] .panel-card h2,
[lang="zh"] .result-stats b,[lang="zh"] .result-gold { font-weight:700; letter-spacing:.04em; }
[lang="zh"] .shed-copy h1 { font-weight:800; letter-spacing:.02em; line-height:1.15; }
[lang="zh"] .paused-label { font-weight:800; letter-spacing:.12em; }
[lang="zh"] .wave-banner strong { font-weight:800; letter-spacing:.05em; }
[lang="zh"] .result-banner { font-weight:800; letter-spacing:.05em; }
[lang="zh"] .enemy-label,[lang="zh"] .hud small,[lang="zh"] .inspect-heading small,
[lang="zh"] .result-stats small,[lang="zh"] .instruction { letter-spacing:.02em; }
[lang="zh"] .menu-hint { line-height:1.8; }
