:root{color-scheme:dark;--ink:#263629;--paper:#e8d8ac;--gold:#dbb469;--wood:#342b20;--muted:#a99e81;--serif:"STZhongsong","Noto Serif SC","Songti SC",SimSun,serif;--sans:"Microsoft YaHei","PingFang SC",sans-serif}*{box-sizing:border-box}body{margin:0;background:#14251f;color:#eadfbe;font-family:var(--sans);min-height:100vh;background-image:radial-gradient(ellipse at 48% 0,#304333 0,transparent 68%),linear-gradient(115deg,#15291f,#162520 70%,#1d3023)}button{font:inherit;cursor:pointer;color:inherit;touch-action:manipulation}button:disabled{cursor:not-allowed;filter:saturate(.45);opacity:.55}button:focus-visible,canvas:focus-visible{outline:3px solid #ffe1a0;outline-offset:3px}button{transition:filter .16s,background .16s,transform .16s}button:not(:disabled):active{transform:translateY(1px)}[hidden]{display:none!important}.svg-defs{position:absolute;width:0;height:0;overflow:hidden}svg{width:24px;height:24px;flex-shrink:0}.app{max-width:1536px;margin:0 auto;padding:24px 36px 12px}.masthead{display:flex;align-items:center;gap:24px;min-height:92px;padding:0 5px 22px}.brand{display:flex;align-items:center;gap:14px}.crest{width:51px;height:65px}.brand-kicker{font:10px Georgia,serif;letter-spacing:2.6px;color:#af9e6b}h1{font:700 34px var(--serif);letter-spacing:5px;margin:4px 0 0;color:#ead5a0;text-shadow:0 2px 0 #0b1b15}.chapter{display:flex;align-items:center;gap:16px;margin-left:auto;padding-right:20px}.chapter-number{font:10px Georgia,serif;letter-spacing:2px;color:#b0b291}.chapter strong{font:18px var(--serif);letter-spacing:3px}.chapter-dots{font-size:10px;letter-spacing:3px;color:var(--gold)}.chapter-dots i{font-style:normal;color:#536146}.help-btn{border:1px solid #5b6246;border-radius:3px;padding:10px 13px;background:#243a2b;color:#d8ccaa;font-size:13px;min-height:42px}.help-btn>span{display:inline-grid;place-items:center;width:17px;height:17px;border:1px solid #a99569;border-radius:50%;margin-right:6px;font-family:Georgia,serif}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 272px;gap:18px;align-items:stretch}.battle-frame{min-width:0;border:3px solid #8c784b;outline:1px solid #131e17;box-shadow:0 0 0 3px #332f21,0 15px 45px #071a1670;background:#332b21;border-radius:8px;overflow:hidden}.topbar{display:flex;align-items:center;justify-content:space-between;min-height:75px;padding:12px 20px;background:linear-gradient(#3d3828,#29291f);border-bottom:3px solid #9a804b;box-shadow:inset 0 1px #c6ad6866}.stats{display:flex;gap:26px}.stat{display:flex;align-items:center;gap:8px}.stat svg{width:23px;height:23px}.stat>div{display:flex;flex-direction:column;gap:3px}.stat span{font-size:10px;letter-spacing:1.5px;color:#c0b58d}.stat strong{font:700 23px Georgia,serif;line-height:1}.gold-stat{color:#e8c368}.life-stat{color:#de8a72}.wave-stat{color:#c5d0a3}.kill-stat{color:#c7b795}.utility{display:flex;gap:5px}.square-btn{display:grid;place-items:center;min-width:36px;height:36px;border:1px solid #796f4d;border-radius:3px;background:#4b4632;font:700 17px Georgia,serif;color:#e7d7a3;box-shadow:inset 0 1px #a7935d55,0 2px #17271d}.square-btn svg{width:18px;height:18px}.square-btn.active{background:#70603a;border-color:#dfba68}.square-btn:hover{filter:brightness(1.2)}#sound-btn:not(.active){opacity:.65}#board{position:relative;isolation:isolate;background:#63733b}#battlefield{display:block;width:100%;height:auto;aspect-ratio:3/2;touch-action:manipulation}.map-label{position:absolute;top:25px;left:29px;pointer-events:none;color:#fff0bd;text-shadow:0 2px 4px #173520;display:flex;flex-direction:column;gap:5px}.map-label span{font:9px Georgia,serif;letter-spacing:2.5px;opacity:.8}.map-label b{font:15px var(--serif);letter-spacing:2px}.combat-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;min-height:94px;border-top:3px solid #8e7646;background:linear-gradient(#3c3527,#292c21);box-shadow:inset 0 1px #baa05e77}.spells{display:flex;gap:12px;align-items:center}.spell-button{position:relative;display:flex;align-items:center;gap:9px;border:0;background:none;padding:1px 8px 1px 0;text-align:left;min-height:56px}.spell-button>span:nth-child(2){display:flex;flex-direction:column;gap:5px}.spell-button b{font-size:14px;letter-spacing:1px;color:#f0dcaf}.spell-button small{font-size:10px;color:#b9b296}.spell-seal{width:49px;height:49px;display:grid;place-items:center;background:radial-gradient(#9d5934,#4a3225);border:2px solid #bd914c;outline:2px solid #211e18;border-radius:9px;box-shadow:inset 0 0 0 3px #4c3b27}.spell-seal svg{width:29px;height:29px;color:#f8a452}.frost .spell-seal{background:radial-gradient(#46777c,#263f3e);border-color:#879f89;box-shadow:inset 0 0 0 3px #344641}.frost svg{color:#bbe5dd}.spell-button kbd{position:absolute;bottom:-2px;left:36px;font-size:10px;padding:0 4px;color:#e0d6b3;background:#29271e;border:1px solid #9f8c58;border-radius:2px}.spell-button.selected .spell-seal{outline:3px solid #fae1a0;box-shadow:0 0 12px #e5c07955}.cooldown{position:absolute;inset:7px auto auto 6px;width:38px;text-align:center;font:700 19px Georgia,serif;background:#1b2a23cc;border-radius:3px;color:#fff0c5;line-height:36px;pointer-events:none}.cooldown:empty{display:none}.cancel-spell{font-size:11px;padding:8px;background:none;border:1px solid #8b7853;border-radius:3px}.wave-control{width:210px;flex-shrink:0}#wave-btn,.primary-button{width:100%;min-height:47px;background:linear-gradient(#ead18a,#c29b4e);border:1px solid #f4dea0;border-radius:4px;color:#3d3524;box-shadow:inset 0 0 0 3px #6a512633,0 3px #151f17;font-weight:700;letter-spacing:1px;text-shadow:0 1px #fff4cc55;font-size:14px}#wave-btn:hover,.primary-button:hover{filter:brightness(1.1)}.progress-track{height:3px;background:#191f17;margin:9px 2px 0;border-radius:2px;overflow:hidden}#wave-progress{width:0;height:100%;background:#c8b770;transition:width .3s}.field-guide{background:#e6d6ab;color:#394232;border:3px solid #96814f;box-shadow:0 0 0 2px #323225,0 12px 25px #081b1740;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;background-image:repeating-linear-gradient(0deg,#6b5e2410 0,transparent 1px,transparent 4px)}.guide-tabs{display:flex;min-height:48px;background:#303929;padding:6px 6px 0;gap:3px;border-bottom:1px solid #8b7951}.guide-tabs button{flex:1;padding:9px 5px;border:0;border-radius:4px 4px 0 0;background:transparent;color:#b6b294;font-size:14px;letter-spacing:1px}.guide-tabs button.active{background:#e6d6ab;color:#384132;box-shadow:inset 0 2px #f1e4c2;font-weight:bold}.guide-heading{padding:20px 19px 12px}.guide-heading>span{font:9px Georgia,serif;letter-spacing:1.6px;color:#8f7954}.guide-heading h2{font:700 24px var(--serif);margin:7px 0 7px;letter-spacing:2px;color:#334133}.guide-heading p{font-size:12px;margin:0;color:#737252}.tower-list{padding:0 11px}.tower-card{display:flex;width:100%;align-items:center;position:relative;text-align:left;border:1px solid transparent;border-bottom:1px solid #a9925744;background:none;border-radius:3px;padding:5px 3px;min-height:112px;color:var(--ink)}.tower-card canvas{width:91px;height:98px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 3px 1px #5d633326)}.tower-copy{display:flex;flex-direction:column;gap:5px;min-width:0}.tower-copy>small{font-size:10px;color:#787951;letter-spacing:1px}.tower-copy>b{font:700 18px var(--serif);letter-spacing:1px}.tower-copy>span{font-size:10px;color:#767452}.tower-copy>em{display:flex;align-items:center;gap:4px;font:700 15px Georgia,serif;font-style:normal;color:#78602f}.tower-copy em svg{width:15px;height:15px;color:#bc9743}.tower-card:hover{background:#faf0c85c}.tower-card.selected{background:#f3e6b9;border:1px solid #718055;box-shadow:inset 3px 0 #76844c}.tower-card.unaffordable .tower-copy em{color:#a26c4a}.guide-note{display:flex;gap:9px;padding:17px 18px;color:#767654}.guide-note p{margin:0;font-size:11px;line-height:1.8}.note-star{color:#929153;font-size:18px}.guide-bottom{display:flex;align-items:center;justify-content:center;gap:9px;margin-top:auto;padding:13px 6px;border-top:1px solid #9b875044;font:12px var(--serif);color:#81805b}.guide-bottom span{font-size:6px}.enemy-entry{display:flex;align-items:center;gap:8px;min-height:99px;margin:0 13px;padding:3px 0;border-bottom:1px solid #9b875044}.enemy-entry canvas{width:71px;height:80px;object-fit:contain;flex-shrink:0}.enemy-entry div{display:flex;flex-direction:column;gap:5px}.enemy-entry b{font:700 16px var(--serif)}.enemy-entry small{font-size:10px;color:#817653}.enemy-entry p{font-size:10px;line-height:1.5;color:#777552;margin:0}footer{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:17px 4px;color:#9ca38a;font-size:11px;line-height:1.7}footer p{margin:0}footer>span{white-space:nowrap;color:#7e8d76;font-size:10px;letter-spacing:1px}footer i{font-style:normal;margin:0 7px}#build-menu{position:absolute;z-index:4;width:254px;color:#354030;background:#ebdeb6;border:3px solid #9b824d;border-radius:6px;box-shadow:0 8px 20px #17261c88,0 0 0 2px #443c29;padding:10px}.build-title{display:flex;align-items:center;gap:8px;justify-content:space-between;font-weight:bold;font-size:14px;padding-bottom:8px;border-bottom:1px solid #aa965c66}.build-title>span{font-size:10px;color:#7b7556}.build-title>button{background:#d7c794;border:1px solid #a49060;border-radius:2px;color:#6a6447;font-size:18px;width:25px;height:25px;padding:0}.build-options{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}.build-options>button{display:flex;flex-direction:column;gap:6px;align-items:center;border:1px solid #9d9668;border-radius:3px;background:#dfd7aa;color:#364734;padding:9px 4px;font-size:12px}.build-options>button:hover{background:#f6e8b7}.build-options small{font-size:10px;color:#8d713c}.tower-detail{font-size:11px;line-height:1.7;margin:8px 0}.upgrade-options>button:first-child{background:#ccd09a}#toast{position:absolute;z-index:5;bottom:18px;left:50%;transform:translate(-50%,8px);max-width:90%;padding:10px 17px;background:#243c2eea;border:1px solid #b29b5e;border-radius:4px;color:#efe2b7;font-size:13px;line-height:1.6;text-align:center;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;white-space:normal}#toast.show{opacity:1;transform:translate(-50%,0)}#wave-banner{position:absolute;top:33%;left:10%;width:80%;text-align:center;pointer-events:none;font:700 24px var(--serif);letter-spacing:3px;color:#ffedb6;text-shadow:0 3px 0 #34422a,0 0 14px #152719;background:linear-gradient(90deg,transparent,#24462ad9 25%,#24462ad9 75%,transparent);padding:18px 8px;opacity:0;transform:translateY(-10px);transition:opacity .25s,transform .25s}#wave-banner.show{opacity:1;transform:translateY(0)}dialog{position:fixed;width:min(480px,calc(100% - 32px));max-height:90vh;overflow:auto;text-align:center;border:3px solid #ab9057;border-radius:8px;background:#e8d9af;color:#354231;padding:27px 33px;box-shadow:0 0 0 4px #303628,0 18px 100px #07181088}dialog::backdrop{background:#0d211dca;backdrop-filter:blur(3px)}.dialog-crest svg{width:52px;height:64px}.dialog-eyebrow{font:9px Georgia,serif;letter-spacing:2px;color:#8d7751}dialog h2{font:700 26px var(--serif);margin:12px 0 15px;letter-spacing:2px}dialog p{font-size:13px;line-height:1.9;color:#6b7052}dialog ol{padding-left:24px;text-align:left;display:flex;flex-direction:column;gap:14px}dialog li{padding-left:5px;color:#8d7d49}dialog li b{display:block;color:#3d4c36;font-size:14px;margin-bottom:4px}dialog li span{display:block;color:#6b7052;font-size:12px;line-height:1.8}.key-guide{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;font-size:11px;margin:22px 0 15px}kbd{font-family:var(--sans);font-size:11px;display:inline-block;padding:3px 5px;background:#d5c897;border:1px solid #b6a570;border-radius:3px;margin-right:3px}.keyboard-tip{display:block;font-size:10px;line-height:1.8;color:#7b7d5e;margin-bottom:21px}.result-buttons{display:flex;gap:12px;margin-top:25px}.secondary-button{width:100%;border:1px solid #9e946c;border-radius:4px;background:#dad3a5;color:#4a583c;font-size:13px}#result-stars{font-size:43px;letter-spacing:9px;color:#b78d3a;margin-top:15px;text-shadow:0 2px #fff0c0}
@media(min-width:1600px){.app{padding-top:35px}.game-layout{grid-template-columns:minmax(0,1fr) 286px}.tower-card{min-height:120px}.tower-card canvas{width:99px;height:106px}}
@media(max-width:1170px){.app{padding:18px 20px 10px}.game-layout{grid-template-columns:minmax(0,1fr) 238px;gap:13px}.stats{gap:16px}.stat strong{font-size:20px}.stat svg{width:19px}.topbar{padding:11px 13px}.kill-stat{display:none}.tower-card canvas{width:75px;height:87px}.tower-card{min-height:103px}.guide-heading{padding:17px 14px 10px}.guide-heading h2{font-size:22px}.tower-copy>b{font-size:16px}.combat-bar{padding:12px 13px;gap:9px}.spells{gap:9px}.spell-button small{display:none}.spell-button b{font-size:12px}.spell-seal{width:42px;height:45px}.wave-control{width:174px}.chapter{padding-right:0;gap:10px}.chapter-number{display:none}.guide-note{padding:13px}.guide-bottom{font-size:10px}.masthead{padding-bottom:18px}}
@media(max-width:900px){.game-layout{grid-template-columns:1fr}.masthead{min-height:76px}.brand-kicker{font-size:8px;letter-spacing:2px}h1{font-size:30px}.crest{height:55px;width:44px}.chapter strong{font-size:16px}.chapter-dots{display:none}.field-guide{display:block}.guide-tabs{width:100%;min-height:44px;padding:4px 6px 0}.guide-tabs button{flex:none;min-width:126px}.guide-heading{padding:12px 16px}.guide-heading>span,.guide-heading p{display:none}.guide-heading h2{font-size:19px;margin:0}.tower-list{display:grid;grid-template-columns:repeat(4,1fr);padding:0 8px 9px;gap:5px}.tower-card{border:1px solid #ac985e44;min-height:116px;padding:3px 4px;gap:1px}.tower-card canvas{width:67px;height:86px}.tower-copy{gap:5px}.tower-copy>b{font-size:15px;letter-spacing:0}.tower-copy>span{display:none}.tower-copy>small{font-size:9px;letter-spacing:0}.guide-note{padding:9px 16px;border-top:1px solid #9c8c5044;align-items:center}.guide-note p{font-size:11px}.guide-bottom{display:none}.enemy-entry{display:inline-flex;vertical-align:top;width:calc(33.333% - 23px);min-height:105px}.enemy-entry canvas{width:60px;height:85px}.enemy-entry b{font-size:14px}.enemy-entry p{font-size:10px}.combat-bar{min-height:85px}.spell-button small{display:block}.kill-stat{display:flex}.stats{gap:26px}footer{padding:12px 3px}.field-guide{margin-top:2px}}
@media(max-width:600px){.app{padding:12px 10px 7px}.masthead{gap:8px;min-height:64px;padding:0 2px 14px}.brand{gap:8px}.crest{width:32px;height:43px}.brand-kicker{font-size:6px;letter-spacing:1px}h1{font-size:25px;letter-spacing:3px}.chapter{display:none}.help-btn{margin-left:auto;font-size:11px;padding:7px 8px;min-height:38px}.help-btn>span{width:14px;height:14px;margin-right:3px}.battle-frame{border-width:2px;border-radius:5px}.topbar{min-height:62px;padding:9px 10px;border-bottom-width:2px;gap:8px}.stats{gap:12px}.stat{gap:5px}.stat svg{width:17px;height:17px}.stat span{font-size:8px;letter-spacing:0}.stat strong{font-size:18px}.kill-stat{display:none}.utility{gap:4px}.square-btn{min-width:29px;height:32px;font-size:14px}.square-btn svg{width:15px;height:15px}.map-label{top:10px;left:12px;gap:3px}.map-label span{font-size:6px;letter-spacing:1px}.map-label b{font-size:10px;letter-spacing:1px}.combat-bar{min-height:75px;padding:10px 9px;gap:8px;border-top-width:2px}.spells{gap:6px}.spell-button{gap:5px;min-height:42px;padding-right:0}.spell-seal{width:37px;height:39px;border-radius:6px}.spell-seal svg{width:24px;height:24px}.spell-button b{font-size:11px;letter-spacing:0}.spell-button small{display:none}.spell-button kbd{left:26px;font-size:8px}.wave-control{width:128px}#wave-btn{font-size:11px;letter-spacing:0;min-height:40px}.cooldown{font-size:16px;width:31px;left:3px;top:4px;line-height:34px}.progress-track{margin-top:6px}.cancel-spell{position:absolute;right:15px;bottom:82px;background:#314832;color:#fff0c3;font-size:10px;z-index:5}.combat-bar{position:relative}.field-guide{border-width:2px}.guide-tabs button{font-size:13px;min-width:115px}.tower-list{grid-template-columns:1fr 1fr;gap:5px;padding:0 8px 8px}.tower-card{min-height:106px;padding:3px 7px}.tower-card canvas{width:76px;height:94px}.tower-copy>b{font-size:16px}.tower-copy>small{font-size:9px}.guide-heading h2{font-size:19px}.guide-heading{padding:12px 15px 9px}.tower-copy>em{font-size:14px}.guide-note p{font-size:10px}.guide-note{gap:7px;padding:8px 12px}.enemy-entry{width:calc(50% - 20px);margin:0 8px;gap:2px}.enemy-entry canvas{width:56px;height:83px}.enemy-entry b{font-size:13px}.enemy-entry small{font-size:8px}.enemy-entry p{font-size:9px}footer{align-items:flex-start;gap:8px;padding-top:11px;font-size:10px}footer>span{display:none}#build-menu{width:228px;max-width:88%;padding:8px;border-width:2px;left:8%!important;top:6%!important}.build-title{font-size:13px}.build-options>button{padding:8px 3px;min-height:45px}.tower-detail{font-size:10px}.build-options{gap:5px;margin-top:6px}#wave-banner{font-size:16px;letter-spacing:1px;padding:12px 4px;top:28%;left:5%;width:90%}#toast{font-size:11px;padding:7px 11px;bottom:9px;width:max-content;max-width:93%}dialog{padding:22px 23px}dialog h2{font-size:23px}}
@media(max-width:380px){.app{padding:10px 6px}.stats{gap:9px}.stat{gap:3px}.stat svg{width:15px}.topbar{padding:9px 7px}.spell-button>span:nth-child(2){display:none}.spells{gap:10px}.spell-seal{width:42px}.wave-control{width:145px}.tower-card{padding-left:2px}.tower-card canvas{width:70px}}
@media(max-height:500px) and (orientation:landscape){.app{padding:8px 14px}.masthead{min-height:53px;padding-bottom:10px}h1{font-size:24px}.crest{width:32px;height:43px}.game-layout{grid-template-columns:minmax(0,1fr) 220px;gap:11px}.chapter{display:none}.help-btn{margin-left:auto}.topbar{min-height:52px;padding:7px 10px}.stat span{font-size:8px}.stat strong{font-size:17px}.stats{gap:15px}.kill-stat{display:none}.combat-bar{min-height:65px;padding:8px}.spell-button b{display:none}.spell-button small{display:none}.spell-seal{width:37px;height:38px}.wave-control{width:145px}#wave-btn{min-height:35px;font-size:11px}.guide-tabs button{min-width:0;flex:1;font-size:12px}.guide-heading{padding:10px}.guide-heading h2{font-size:18px}.tower-list{display:block;padding:0 6px}.tower-card{min-height:84px;border-width:0 0 1px}.tower-card canvas{width:70px;height:79px}.tower-copy>b{font-size:16px}.tower-copy>small{font-size:9px}.tower-copy>em{font-size:13px}.guide-note{padding:8px}.guide-note p{font-size:9px}.enemy-entry{width:calc(100% - 16px);margin:0 8px;min-height:83px}.enemy-entry canvas{height:73px}.enemy-entry div p{font-size:9px}footer{font-size:9px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
@media(min-width:901px) and (max-height:1050px){.app{max-width:max(940px,calc((100dvh - 305px)*1.5 + 334px));width:100%;padding-top:16px}.masthead{min-height:76px;padding-bottom:18px}.topbar{min-height:64px;padding-top:8px;padding-bottom:8px}.combat-bar{min-height:82px;padding-top:10px;padding-bottom:10px}.field-guide{max-height:calc(100dvh - 140px);min-height:0}.guide-tabs,.guide-bottom{flex-shrink:0}#battle-panel,#codex-panel{min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:#a29362 #d8c99c}.guide-heading{padding-top:15px;padding-bottom:10px}}
