/* Battle: the same paper cards and pastel palette as the lobby. */
body:has(#game-screen:not(.hidden)){background:#eeedff;color:#28253e;overflow:auto}
body:has(#game-screen:not(.hidden)) .topbar{background:#faf9ff;border-bottom:1px solid #d5cfea;box-shadow:none}
body:has(#game-screen:not(.hidden)) .game-brand{color:#29243e}
body:has(#game-screen:not(.hidden)) .game-brand small,body:has(#game-screen:not(.hidden)) .top-center{color:#817397}
body:has(#game-screen:not(.hidden)) .topbar nav button{background:#e9e4f7;color:#51466d;box-shadow:none;border:1px solid #d5ccea}
body:has(#game-screen:not(.hidden)) .topbar nav button span{color:#6650b3}
#game-screen{--ink:#302942;--muted:#7c708f;--card:#faf9ff;display:flex;flex-direction:column;gap:12px;position:relative;width:100%;height:calc(100dvh - 66px)!important;min-height:630px;padding:16px 24px 18px;background:#eeedff;overflow:visible;color:var(--ink)}
#game-screen .battle-hud{display:grid;grid-template-columns:108px minmax(130px,1fr) 100px 170px;gap:20px;align-items:center;flex:0 0 auto;height:66px;min-height:66px;padding:0;border:0;background:none;overflow:visible}
#game-screen .battle-hud>div{padding:0;border:0;min-width:0;margin:0;height:auto}
#game-screen .wave small{display:block;font-size:11px;color:#776886;letter-spacing:0}
#game-screen .wave strong{font-size:34px;line-height:1.1;color:#6250af}
#game-screen .wave i{font-size:13px;color:#9587a9;margin-left:8px;font-style:normal}
#game-screen .base-health{display:grid;gap:8px;min-height:0;width:auto;max-width:none}
#game-screen .base-health>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0}
#game-screen .base-health span{display:inline;font-size:11px;color:#7f718f}
#game-screen .base-health b{font-size:19px;color:#42374f;white-space:nowrap}
#game-screen .meter{height:6px;background:#e2dbee;border:0;border-radius:20px;overflow:hidden;margin:0}
#game-screen .meter span{display:block;height:100%;background:#a494d5}
#game-screen .battle-hud>.battle-stat:not(#battle-clock){display:none}
#game-screen #battle-clock{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;background:#faf9ff;border:1px solid #cfc3e2;border-radius:12px;height:58px;min-width:0;box-shadow:none}
#game-screen #battle-clock small{font-size:10px;color:#8a7090}
#game-screen #battle-clock b{font-size:22px;line-height:1;color:#5c456c}
#game-screen #battle-clock.boss-timer{background:#ffe4ed;border-color:#e6a6bf}
#game-screen .speed-group{display:flex;gap:5px;justify-content:flex-end;align-items:center;min-height:0}
#game-screen .speed-group button{display:grid;place-items:center;width:38px;height:38px;min-height:0;font-size:13px;background:#e1dbee;color:#6a5d7b;border:1px solid #c7bcd9;box-shadow:none;padding:0}
#game-screen .speed-group button.active{background:#d5f775;border-color:#8d9f5b;color:#364125}
#game-screen .game-layout,#game-screen .game-layout.inspecting{display:grid!important;grid-template-columns:minmax(0,1fr) 265px;grid-template-rows:minmax(0,1fr);gap:16px;flex:1 1 0;min-height:0;height:auto;margin:0;padding:0;overflow:visible}
#game-screen .arena{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;padding:0;border:2px solid #4f435f;border-radius:20px;background:#eeedff;box-shadow:0 4px 0 #d4cae5;overflow:hidden}
#game-screen .arena-label,#game-screen .arena-bottom{position:relative;inset:auto;display:flex;align-items:center;justify-content:space-between;flex:0 0 38px;height:38px;padding:0 16px;margin:0;border:0;background:#faf9ff;border-radius:0;z-index:2;color:#594970;letter-spacing:0;font-size:12px}
#game-screen .arena-label{display:grid;grid-template-columns:5px minmax(0,1fr) auto;gap:8px;border-bottom:1px solid #d0c6e4;font-weight:900}
#game-screen .arena-title{grid-area:1 / 2;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#game-screen .arena-label .live-dot{grid-area:1 / 1}
#game-screen .arena-label #field-count{grid-area:1 / 3}
#game-screen .arena-label:has(.wave-banner:not(.hidden)) .arena-title{visibility:hidden}
#game-screen .arena-label small{font-size:8px;font-weight:700;color:#a090b0;margin-left:8px;letter-spacing:1px}
#game-screen #field-count{margin-left:auto;white-space:nowrap;font-size:10px;color:#887599}
#game-screen .arena-bottom{flex-basis:28px;height:28px;border-top:1px solid #d0c6e4;font-size:9px;color:#9584a7}
#game-screen .arena-bottom #dps{position:static;display:inline;background:none;border:0;color:#715a95;padding:0;font-size:11px}
#game-screen #battlefield{position:relative;inset:auto;display:block;width:100%;height:0;min-height:0;flex:1 1 0;touch-action:none;background:#eeedff}
#game-screen #float-layer{top:38px;bottom:28px}
#game-screen .next-wave{bottom:42px;left:50%;transform:translateX(-50%);width:230px;min-height:44px;border-radius:12px!important;box-shadow:0 3px 0 #6b713b;padding:8px 14px;font-size:14px}
#game-screen .sidebar{display:flex!important;flex-direction:column;gap:12px;min-height:0;width:auto;height:auto;padding:0;margin:0;overflow:auto;grid-column:auto;grid-row:auto;border:0;border-radius:0;background:none;box-shadow:none}
#game-screen .battle-context{padding:15px 16px;border:1px solid #cbc0e3;border-radius:15px;background:#ded5f3}
#game-screen .battle-context small{color:#7d619f;font-size:10px;font-weight:900}
#game-screen .battle-context p{font-size:13px;line-height:1.5;font-weight:850;color:#4a375e;margin:5px 0 0;word-break:keep-all}
#game-screen .side-section{display:block;padding:15px!important;border:1px solid #d6cbe8;background:#faf9ff;border-radius:15px;flex:none}
#game-screen .section-label{display:flex;margin:0 0 10px;color:#8c769f;font-size:10px;letter-spacing:0}
#game-screen .section-label .tiny{color:#a190b3}
#game-screen #mission-card{display:block!important;margin:0}
#game-screen #mission-card h3{font-size:16px;line-height:1.3;margin:0 0 7px;color:#493656;white-space:normal;font-weight:900}
#game-screen #mission-card h3.success-text{color:#568044!important}
#game-screen #mission-card h3.failure-text{color:#94749b!important}
#game-screen #mission-card p{display:block;font-size:11px;line-height:1.5;color:#9a879f;margin:0 0 12px}
#game-screen .progress-label{display:flex;justify-content:space-between;gap:12px;margin:0 0 7px;font-size:10px;color:#8b759b;white-space:nowrap}
#game-screen #mission-card .reward{display:block;margin:10px 0 0;color:#a17c3c;font-size:11px}
#game-screen .empty-copy{color:#9c8bab;font-size:11px}
#game-screen .synergy-item{background:#eee7f7;padding:8px;border:0;color:#826792}
#game-screen .synergy-item strong{color:#6a527d}
#game-screen .selected-card,#game-screen .track-section{display:none}
#game-screen .incident-card{position:static;inset:auto;flex:none;width:auto;max-width:none;min-height:0;margin:0;padding:12px 15px;border:1px solid #dfb1c6;border-radius:15px;background:#ffe7ef;box-shadow:none;color:#a06585;pointer-events:auto}
#game-screen .incident-card.complete{background:#e7f0d4;border-color:#bccfa0;color:#708c4e}
#game-screen .incident-card.failed{background:#eee7f1;border-color:#d8c7e0}
#game-screen .incident-card>div{display:flex;justify-content:space-between;font-size:10px}
#game-screen .incident-card h3{margin:5px 0;font-size:14px;color:#65405c;line-height:1.4}
#game-screen .incident-card p{display:block;margin:5px 0;font-size:10px;line-height:1.5;color:#9e7592}
#game-screen .incident-card footer{display:flex;justify-content:space-between;margin:7px 0 0;font-size:11px;color:inherit}
#game-screen .commandbar{position:relative;inset:auto;display:grid;grid-template-columns:130px minmax(240px,1fr) repeat(4,minmax(75px,.35fr)) 54px;grid-template-rows:64px;align-items:stretch;gap:9px;flex:0 0 auto;width:100%;height:auto;min-height:0;margin:0;padding:12px 0 0;background:none;border:0;border-top:1px solid #d4c9e4;overflow:visible;box-shadow:none}
#game-screen .commandbar>*{grid-column:auto!important;grid-row:auto!important;position:relative!important;inset:auto!important;width:auto!important;min-width:0!important;max-width:none!important;height:64px!important;min-height:0!important;margin:0!important;transform:none!important}
#game-screen .commandbar .resources{display:flex!important;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;padding:0 10px;background:#fff3d7;border:1px solid #e1c792;border-radius:13px;text-align:left}
#game-screen .coin{display:block;flex:0 0 34px;width:34px;height:34px;background:none;border:0;box-shadow:none;line-height:1}
#game-screen .coin svg{width:100%;height:100%}
#game-screen .resources strong{font-size:23px;max-width:none;line-height:1.1;color:#805b37;overflow:visible;display:block}
#game-screen .resources small{display:block;font-size:9px;color:#b29569;margin-top:4px}
#game-screen .commandbar .summon-group{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0}
#game-screen .commandbar .summon-group .summon-button{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;width:100%;height:100%;padding:6px;grid-area:auto!important;background:#d5f775!important;box-shadow:0 3px 0 #929f5c!important;border:2px solid #485338!important;border-radius:14px!important;color:#354329}
#game-screen .commandbar .summon-group #summon-ten{background:#d8c9f5!important;border-color:#6d588b!important;box-shadow:0 3px 0 #a18ab9!important}
#game-screen .commandbar .summon-button b{font-size:17px!important;line-height:1.2}
#game-screen .commandbar .summon-button small{display:block;font-size:10px!important;margin-top:4px;color:#6c784d}
#game-screen .commandbar .command,#game-screen .commandbar .save-button{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:5px;border:1px solid #cbbdde!important;background:#faf9ff!important;color:#69547e;box-shadow:0 2px 0 #d7cbe6}
#game-screen .commandbar .command b{font-size:12px}
#game-screen .commandbar .command>span{display:block;font-size:17px;color:#a489be!important;line-height:1}
#game-screen .commandbar .command small{display:none}
#game-screen .commandbar [data-panel=upgrades]{background:#e3eacb!important;border-color:#b4c192!important;color:#667745}
#game-screen #save{font-size:11px;color:#a08dab}
#game-screen .arena-label .wave-banner{position:static;inset:auto;grid-area:1 / 2;display:flex;flex-direction:column;justify-content:center;min-width:0;width:100%;max-width:100%;height:100%;padding:0;margin:0;transform:none;background:none;border:0;border-radius:0;box-shadow:none;font-family:inherit;font-size:12px;line-height:1.25;letter-spacing:0;text-align:left;text-shadow:none;color:#705098;pointer-events:none;overflow:hidden}
#game-screen .arena-label .wave-banner strong{display:block;font-size:inherit;line-height:1.25;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#game-screen .arena-label .wave-banner small{display:block;font-family:inherit;font-size:9px;line-height:1.3;letter-spacing:0;margin:1px 0 0;color:#937aa6;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#game-screen #pause-overlay{background:#eee7faad}
#game-screen #pause-overlay strong{color:#786093}
#game-screen #pause-overlay button{background:#f9f6ff;color:#786093;border:1px solid #b6a2c9;border-radius:12px}
#summon-callout{background:#fff9f3f5;border-color:#a5b666;box-shadow:0 4px 0 #c7c39b}
#summon-callout b{color:#56426a}#summon-callout small{color:#879c3c}#summon-callout span{color:#a187ac}
@media(max-width:1000px){
#game-screen{padding:12px;gap:10px}
#game-screen .game-layout,#game-screen .game-layout.inspecting{grid-template-columns:minmax(0,1fr) 225px;gap:10px}
#game-screen .commandbar{grid-template-columns:110px minmax(210px,1fr) repeat(4,65px) 42px;gap:6px}
#game-screen .commandbar .command b{font-size:10px}
}
@media(max-width:760px){
#game-screen{height:auto!important;min-height:calc(100dvh - 54px);padding:10px 10px max(14px,env(safe-area-inset-bottom));gap:10px;overflow:visible}
#game-screen .battle-hud{grid-template-columns:72px minmax(70px,1fr) 68px;grid-template-rows:48px 30px;height:84px;min-height:84px;gap:6px 10px}
#game-screen .battle-hud .wave{min-width:0;grid-column:1;grid-row:1}
#game-screen .wave small{font-size:9px}#game-screen .wave strong{font-size:28px}#game-screen .wave i{font-size:11px;margin-left:4px}
#game-screen .base-health{grid-column:2;grid-row:1;gap:5px;height:auto}
#game-screen .base-health>div:first-child{display:block}
#game-screen .base-health span{display:block;font-size:8px;line-height:1.4}
#game-screen .base-health b{font-size:15px;line-height:1.4}
#game-screen #battle-clock{grid-column:3;grid-row:1;height:45px;border-radius:10px}
#game-screen #battle-clock b{font-size:18px}#game-screen #battle-clock small{font-size:8px}
#game-screen .speed-group{grid-column:1/-1;grid-row:2;gap:5px;justify-content:flex-end;height:30px}
#game-screen .speed-group::before{content:'빠르게 웃고, 가볍게 버텨.';margin-right:auto;font-size:10px;color:#a18bb0}
#game-screen .speed-group button{width:34px;height:28px;font-size:11px}
#game-screen .game-layout,#game-screen .game-layout.inspecting{display:flex!important;flex-direction:column;gap:10px;flex:none;height:auto;min-height:0}
#game-screen .arena{width:100%;height:auto;aspect-ratio:auto;border-radius:16px;flex:none}
#game-screen .arena-label{padding:0 10px;flex-basis:32px;height:32px;font-size:11px}
#game-screen .arena-label small{display:none}#game-screen #field-count{font-size:9px}
#game-screen #battlefield{flex:none;height:auto;aspect-ratio:1;width:100%}
#game-screen .arena-bottom{flex-basis:23px;height:23px;padding:0 10px;font-size:8px}
#game-screen .arena-bottom .desktop-hint{display:inline;font-size:8px}#game-screen .arena-bottom #dps{font-size:9px}
#game-screen #float-layer{top:32px;bottom:23px}
#game-screen .sidebar{display:grid!important;grid-template-columns:1fr;gap:8px;overflow:visible;flex:none;height:auto;min-height:0}
#game-screen .battle-context{padding:7px 10px;border-radius:10px;display:flex;align-items:center;gap:9px}
#game-screen .battle-context small{font-size:8px;white-space:nowrap;display:none}
#game-screen .battle-context p{font-size:10px;margin:0;line-height:1.4}
#game-screen .side-section{padding:10px 12px!important;border-radius:12px}
#game-screen .side-section:has(#synergy-list){display:none}
#game-screen .section-label{display:none}
#game-screen #mission-card{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:5px 10px;align-items:center}
#game-screen #mission-card h3{font-size:12px;margin:0;white-space:normal}
#game-screen #mission-card p{display:none}
#game-screen #mission-card .progress-label{margin:0;font-size:9px;gap:10px}
#game-screen #mission-card .meter{grid-column:1/-1;height:4px}
#game-screen #mission-card .reward{display:none}
#game-screen .incident-card{padding:9px 12px;border-radius:12px;display:grid;grid-template-columns:1fr auto;align-items:center;gap:4px 12px}
#game-screen .incident-card>div{grid-column:1/-1;font-size:9px}
#game-screen .incident-card h3{font-size:12px;margin:0}
#game-screen .incident-card p{display:none}
#game-screen .incident-card footer{font-size:10px;margin:0;gap:12px}
#game-screen .commandbar{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:38px 58px 36px;gap:7px;padding:10px 0 0;min-height:0;flex:none;position:sticky;bottom:0;background:#eeedfff5;z-index:10;backdrop-filter:blur(8px)}
#game-screen .commandbar>*{height:auto!important;min-height:0!important}
#game-screen .commandbar .resources{grid-column:1/4!important;grid-row:1!important;justify-content:flex-start;gap:7px;border:0;background:none;padding:0}
#game-screen .commandbar .resources .coin{flex-basis:29px;width:29px;height:29px}
#game-screen .resources>div{display:flex;align-items:baseline;gap:6px}#game-screen .resources strong{font-size:22px;max-width:none}#game-screen .resources small{display:inline;font-size:10px;margin:0}
#game-screen .commandbar #save{grid-column:4!important;grid-row:1!important;height:30px!important;align-self:center;background:none!important;box-shadow:none;border-color:#d8cbe3!important}
#game-screen .commandbar .summon-group{grid-column:1/-1!important;grid-row:2!important;gap:8px}
#game-screen .commandbar #merge{grid-column:1!important;grid-row:3!important}
#game-screen .commandbar>[data-panel=odds]{grid-column:2!important;grid-row:3!important}
#game-screen .commandbar>[data-panel=upgrades]{grid-column:3!important;grid-row:3!important}
#game-screen .commandbar>[data-panel=codex]{grid-column:4!important;grid-row:3!important}
#game-screen .commandbar .command>span{display:none}#game-screen .commandbar .command b{font-size:10px}
#game-screen .arena-label .wave-banner{font-size:11px}
#game-screen .arena-label .wave-banner small{font-size:8px}
#game-screen .next-wave{min-height:38px;width:200px;font-size:12px;bottom:35px}
}
#game-screen .arena-label{width:100%;max-width:none}
#game-screen .arena-bottom .desktop-hint{position:static;inset:auto;padding:0;background:none;border:0;color:#9584a7;text-shadow:none;line-height:1.2}
#game-screen .arena-bottom #dps{font-weight:850;text-shadow:none}
#game-screen .commandbar .command b{color:inherit}
#game-screen .incident-card strong,#game-screen .incident-card b{color:inherit}
body:has(#game-screen:not(.hidden)) .chapter{color:#817397!important}
@media(max-width:760px){
#game-screen{height:calc(100dvh - 54px)!important;min-height:700px;overflow:visible}
#game-screen .game-layout,#game-screen .game-layout.inspecting{flex:1 1 0;min-height:0}
#game-screen .arena{flex:1 1 0;min-height:180px}
#game-screen #battlefield{flex:1 1 0;height:0;aspect-ratio:auto;min-height:0}
#game-screen .sidebar{flex:none;gap:6px}
#game-screen .sidebar .side-section{padding:9px 12px!important}
#game-screen .sidebar .side-section #mission-card p,#game-screen .sidebar .side-section #mission-card .reward{display:none!important}
#game-screen .incident-card{padding:8px 12px}
#game-screen .incident-card strong,#game-screen .incident-card b{color:inherit}
#game-screen .commandbar{position:relative;bottom:auto;grid-template-rows:30px 50px 32px;padding-top:8px;gap:6px;backdrop-filter:none}
#game-screen .commandbar .summon-group .summon-button{height:100%!important}
}
#game-screen .sidebar .side-section{width:100%;min-width:0;max-width:none}
#game-screen .incident-card>div{color:inherit}
