/* Only the active battlefield uses the reference's wood, stone and paper skin. */
body:has(#battle:not([hidden])){background:#2e231c}
.shell:has(#battle:not([hidden])){padding:env(safe-area-inset-top) 0 max(12px,env(safe-area-inset-bottom));max-width:480px}
.shell:has(#battle:not([hidden]))>header{display:none}
.shell:has(#battle:not([hidden]))>#syncState{padding-inline:12px;color:#e0cbae}
#battle{font-family:"STKaiti","KaiTi","Songti SC",serif;color:#f8ead0;background:#412e23;min-height:100svh;isolation:isolate}
#battle .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#battle #hud_top{margin:0;padding:4px 10px 10px;border:0;border-radius:0;background:linear-gradient(#533827,#342219);color:#fff0d1;box-shadow:inset 0 -2px #ae8754}
.battle-heading{display:flex;justify-content:space-between;align-items:center;padding-left:4px}
.battle-heading h2{margin:0;font-size:22px}
#battle button:not(.grid_cell){min-height:44px}
#battle #pauseBtn{border:0;background:transparent;color:#ffedcc;font-size:14px}
.battle-counters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:1px solid #977047;border-radius:6px;background:#2d211a;text-align:center}
.battle-counters>div{position:relative;padding:5px 0 8px;min-width:0}
.battle-counters>div+div{border-left:1px solid #735438}
.battle-counters span{display:flex;justify-content:center;align-items:center;gap:4px;font:12px/1.4 system-ui,sans-serif;color:#eed1a2}
.battle-counters strong{display:block;font:700 19px/1.3 "KaiTi",serif;font-variant-numeric:tabular-nums;white-space:nowrap}
.battle-counters .mp-icon{font-size:14px;color:#e4b968}
#battle #hpBar{position:absolute;bottom:4px;left:14%;width:72%;height:3px;accent-color:#3D7EFF}
#battle #battle_map{margin:0;border:0;border-radius:0;background:#bd965c url('images/gen/gptimg_1795745057_look.jpg') center center/cover no-repeat}
#battle .grid_cell{--tile-edge:#aa987c;--tile-ink:#3f302b;--tile-paper:#e2dacf;min-height:0;border:2px solid var(--tile-edge);border-radius:7px;color:var(--tile-ink);background:linear-gradient(#f6e9cb,var(--tile-paper));box-shadow:inset 0 0 0 2px #281e1a25,0 4px 0 #47362a,0 5px 5px #24191066;font-size:26px;touch-action:none;user-select:none;transform:none}
#battle .grid_cell small{margin-top:1px;color:inherit;line-height:1.15;font-size:10px}
#battle .grid_cell.blue{--tile-edge:#6689a6;--tile-ink:#234a70;--tile-paper:#bdcbd4}
#battle .grid_cell.purple{--tile-edge:#a9758e;--tile-ink:#64304c;--tile-paper:#ddbeca}
#battle .grid_cell.gold{--tile-edge:#ca872c;--tile-ink:#762b20;--tile-paper:#f4cb67;animation:none;box-shadow:inset 0 0 0 2px #ffe9a7,0 4px 0 #5e3822,0 0 7px #ffe9a7}
#battle #grid .grid_cell.empty{background:linear-gradient(#8b8171,#655d50);border-color:#afa38b;color:#eee1c4;font-size:19px;box-shadow:inset 0 0 0 2px #534a3e,0 5px 0 #3d3228,0 7px 9px #0006}
#battle .grid_cell.locked{background:#68523d;color:#fff3d8;border-color:#9c7d52;font:11px/1 system-ui,sans-serif}
#battle .grid_cell.selected,#battle .grid_cell.match,#battle .grid_cell.drop-hover{outline:3px solid #3D7EFF;outline-offset:2px}
#battle #adou_unit{background:#74382a;color:#fff1ce;box-shadow:0 3px 0 #49271e;font-family:inherit}
.battle-tray{padding:9px 10px 12px;background:linear-gradient(#60422e,#423023);border-block:2px solid #ad8353}
.battle-rack{display:grid;grid-template-columns:54px minmax(0,1fr);gap:6px;align-items:center;padding:4px 0 7px}
.battle-rack h3{margin:0;font-size:15px;line-height:1.2;color:#ffedc5}
.battle-rack h3 span{display:block;margin-top:3px;font:10px/1.25 system-ui,sans-serif;color:#ebcc9a}
.rack-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;min-height:46px}
#forge-slots{grid-template-columns:repeat(2,minmax(0,1fr))}
#battle .rack-slots .grid_cell{position:static;width:100%;height:46px}
#battle .rack-slots .empty{font-size:18px;color:#705b3d}
#battle .actions{display:grid;grid-template-columns:1.25fr 1fr 1fr;gap:6px;margin:6px 0 0}
#battle .actions button{padding:5px 3px;border:1px solid #9f7954;border-radius:5px;background:#3c2b22;color:#fff0d4;font:600 12px/1.25 system-ui,sans-serif}
#battle .actions .primary{background:#8f3729;border-color:#cb8c60;box-shadow:inset 0 0 0 2px #6c2a20}
#battle #wave_indicator,#battle #buff_boost_icons{margin:0;padding:5px 12px;border-radius:0;background:none;color:#f2ddbd}
#battle #ad_panel{margin:8px 10px 0;padding:12px;background:#34271f;color:#fff0d0;border-color:#785b40;border-radius:7px}
#battle #ad_panel .sub{color:#e3c9a5}
.drag-glyph{position:fixed;z-index:12;pointer-events:none;left:0;top:0;width:46px;height:46px;display:grid;place-items:center;background:#eee0c0;color:#533325;border:2px solid #a27b48;border-radius:7px;font:700 28px/1 "KaiTi",serif;box-shadow:0 3px 9px #22150e80}
/* Crop the original battle artwork to the ground, excluding its painted HUD and inventory. */
#battle #battle_map{background-image:url('images/gen/gptimg_1795526546_look.png');background-size:100% 145%;background-position:center 30%}

#startBtn[aria-busy="true"]{opacity:.65;cursor:progress}
#battle .actions{margin:0 0 9px}
#battle #nextBtn:not(:disabled){background:#3D7EFF;border-color:#92b7ff;color:#101e37;font-weight:750}
#battle #nextBtn:disabled{opacity:.6}
