#battle-root {
  min-height: 100svh;
  padding: 12px 0 10px;
  background: radial-gradient(ellipse at 18% 0%, #344139, transparent 52%), repeating-linear-gradient(113deg, #1c2522 0 1px, #1a221f 1px 6px);
}
.battle-board {
  --paper:#efe4c5; --paper-dim:#cabfa2; --gold:#e7c381; --stroke:#ead09a3c; --ink:#23302a; --muted:#c5cbba;
  width:min(calc(100% - 24px), max(1090px, calc(128svh + 125px)), 1620px);
  margin:auto; color:var(--paper); font:14px/1.45 "Microsoft YaHei UI","PingFang SC",sans-serif;
  font-variant-numeric:tabular-nums;
}
.battle-board button,.battle-board select {font:inherit; color:inherit; border-radius:2px;}
.battle-board button {cursor:pointer;}
.battle-board button:focus-visible,.battle-board select:focus-visible,.battle-board canvas:focus-visible {outline:2px solid #eab358;outline-offset:-2px;}
.battle-board button:disabled {cursor:default;}
.battle-board [hidden] {display:none!important;}
.battle-board h1,.battle-board h2,.battle-board h3,.battle-board p,.battle-board dl,.battle-board dd {margin:0;}
.battle-board h1,.battle-board h2,.battle-board h3,.battle-title span,.battle-console-title strong,.battle-roster-heading h2 {font-family:"STZhongsong","SimSun","Songti SC",serif;}
.battle-button,.battle-zooms button {border:1px solid var(--stroke);background:#29352d;min-height:32px;padding:4px 9px;}
.battle-button:hover,.battle-zooms button:hover:not(:disabled) {background:#405044;border-color:#c2a474;}
.battle-button[aria-pressed="true"] {background:#5b5138;color:#ffdd94;border-color:#b89654;}
.battle-header {display:grid;grid-template-columns:auto minmax(150px,1fr) auto auto;align-items:center;gap:18px;padding:9px 15px;background:linear-gradient(110deg,#28352d,#19231f 50%,#29332b);border:1px solid var(--stroke);border-top:2px solid #b9975f;box-shadow:0 4px 12px #0003;}
.battle-return {font-size:13px!important;background:#1c2721;color:var(--paper-dim)!important;}
.battle-title {border-left:1px solid var(--stroke);padding-left:15px;line-height:1.15;}
.battle-title span {color:#dcc18d;font-size:12px;letter-spacing:.14em;}
.battle-title h1 {font-size:clamp(21px,2vw,31px);letter-spacing:.09em;font-weight:700;}
.battle-resources {display:flex;align-items:center;}
.battle-resources div {padding:0 14px;border-left:1px solid var(--stroke);min-width:72px;}
.battle-resources dt {display:flex;align-items:center;gap:7px;color:#c1c7b9;font-size:11px;white-space:nowrap;}
.battle-resources dd {font-size:21px;font-weight:700;line-height:1.15;color:#f1deac;}
.battle-resources i {display:inline-block;width:10px;height:10px;position:relative;}
.resource-coin {border:3px solid #dfb46d;background:#655437;border-radius:50%;}
.resource-banner {border-left:2px solid #a2c6a5;}
.resource-banner:after {content:"";position:absolute;left:0;top:0;width:8px;height:7px;background:#a2c6a5;clip-path:polygon(0 0,100% 0,75% 45%,100% 85%,0 100%);}
.resource-plan {border:2px solid #84bbb7;transform:rotate(45deg) scale(.82);}
.battle-time,.battle-speed {display:flex;align-items:center;}
.battle-time {gap:10px;}
.battle-time output {color:#dbd7c1;font-size:14px;}
.battle-speed {gap:2px;}
.battle-speed button {font-size:12px;padding:3px 7px;}
.battle-layout {display:grid;grid-template-columns:minmax(0,1fr) clamp(264px,22vw,330px);gap:10px;margin-top:9px;align-items:start;}
.battle-theater {min-width:0;}
.battle-map-footer {display:flex;align-items:baseline;gap:11px;padding:6px 12px;color:#e9dfbd;background:linear-gradient(90deg,#413c2d,#2e352b);border:1px solid #b29962a8;border-bottom:0;font-size:13px;}
.battle-map-footer strong {letter-spacing:.16em;color:#f9d895;white-space:nowrap;}
.battle-map-frame {position:relative;width:100%;aspect-ratio:1000/650;border:1px solid #b69d67;box-shadow:0 4px 14px #0005;background:#465849;}
.battle-map-window {position:absolute;inset:0;overflow:hidden;overscroll-behavior:contain;}
.battle-map {display:block;width:100%;height:100%;touch-action:none;user-select:none;}
.battle-map-hint,.battle-aim,.battle-paused {position:absolute;z-index:1;background:#17241fee;border:1px solid #a99a70c9;color:#f4e6bf;}
.battle-map-hint {display:flex;align-items:center;gap:5px;top:9px;left:9px;padding:3px 8px;font-size:11px;pointer-events:none;}
.battle-map-hint i {width:7px;height:7px;border-radius:50%;background:var(--banner-color);}
.battle-map-hint i:nth-child(2){background:#dc8269;margin-left:4px;}
.battle-map-hint i:nth-child(3){background:#aeb1a0;margin-left:4px;}
.battle-zooms {display:flex;flex-shrink:0;background:#1e2c23;border:1px solid #998763ad;}
.battle-zooms button {border:0;border-radius:0;line-height:1;font-size:16px;background:transparent;padding:3px 8px;min-width:28px;min-height:24px;}
.battle-zooms button + button {border-left:1px solid var(--stroke);}
.battle-zooms button[data-action="overview"] {font-size:11px;color:#e8d4a4;}
.battle-zooms button:disabled {opacity:.35;}
.battle-aim,.battle-paused {left:50%;transform:translateX(-50%);text-align:center;pointer-events:none;white-space:nowrap;box-shadow:0 3px 12px #0004;}
.battle-aim {bottom:8px;padding:4px 10px;font-size:12px;}
.battle-paused {top:12%;letter-spacing:.2em;padding:6px 16px;}
.battle-roster {display:grid;grid-template-columns:clamp(92px,10vw,142px) minmax(0,1fr);align-items:center;gap:12px;padding:7px 10px;background:linear-gradient(90deg,#27332a,#202b25);border:1px solid #bda57568;border-top:0;}
.battle-minimap {display:block;width:100%;height:auto;border:1px solid #a78f60;background:#334436;cursor:crosshair;touch-action:none;user-select:none;}
.battle-roster-units {min-width:0;}
.battle-roster-heading {display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;}
.battle-roster-heading h2 {font-size:15px;letter-spacing:.1em;color:#e9d39e;}
.battle-roster-heading>span,.roster-count {font-family:inherit;color:#b8c2b3;font-size:11px;}
.roster-count {letter-spacing:0;font-weight:400;margin-left:3px;}
.roster-cards {display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#748074 #26342e;}
.roster-cards>p {font-size:12px;color:#c9cebf;}
.roster-card {display:flex;align-items:center;gap:7px;position:relative;text-align:left;min-width:115px;flex:0 0 auto;padding:4px 21px 6px 6px;border:1px solid #64715d;background:#354036;line-height:1.3;}
.roster-card:hover,.roster-card[aria-pressed="true"] {border-color:#e1bc73;background:#474b37;}
.roster-seal,.spell-seal {display:grid;place-items:center;flex-shrink:0;font:700 22px/1 "STKaiti","KaiTi","STZhongsong","SimSun",serif;}
.roster-seal {color:#eed6a0;border:1px solid #a68d59;width:29px;height:31px;box-shadow:inset 0 0 0 2px #343b2d;}
.roster-card b,.roster-card small,.battle-control b,.battle-control small {display:block;}
.roster-card b {font-size:13px;}
.roster-card small {font-size:10px;color:#c9d0b9;}
.battle-board kbd {color:#d3cca9;font:10px/1.3 Consolas,monospace;border:1px solid #91a28b55;padding:1px 3px;border-radius:2px;}
.roster-card kbd {position:absolute;top:4px;right:4px;}
.roster-health {position:absolute;left:0;bottom:0;width:var(--hp);height:2px;background:var(--banner-color);}
.battle-lesson {display:flex;align-items:baseline;gap:9px;color:#e5dcc2;background:#383a2b;border-left:3px solid #bda368;margin-top:6px;padding:6px 10px;font-size:12px;}
.battle-lesson strong {white-space:nowrap;color:#edd18c;}
.battle-console {min-width:0;border:1px solid #a38c5d;background:#252e26;box-shadow:0 6px 16px #0004;}
.battle-console-title {display:flex;align-items:center;justify-content:space-between;gap:6px;padding:9px 12px;background:linear-gradient(100deg,#384436,#263129);border-bottom:1px solid #9e885d;}
.battle-console-title strong {font-size:18px;letter-spacing:.15em;color:#f1d59c;}
.battle-console-title select,.battle-directed select {border:1px solid #89927a;background:#2d3a30;min-width:0;padding:3px 5px;max-width:100%;cursor:pointer;}
.battle-console-title select {color:#ddd8be;font-size:11px;max-width:143px;}
.battle-console-current {min-height:122px;padding:14px 13px 12px;color:#302e23;background:repeating-linear-gradient(0deg,#9e805206 0 1px,transparent 1px 4px),linear-gradient(108deg,#dfcda3,#f2e7c9 62%,#d9c69d);}
.battle-console-current h2 {font-size:clamp(23px,2vw,30px);line-height:1.2;letter-spacing:.06em;margin:2px 0 4px;}
.inspect-kind {font-size:10px;letter-spacing:.1em;font-weight:bold;color:#695c40;}
.battle-console-current h3,.battle-console-section h2,.battle-reports h2 {font-size:14px;letter-spacing:.17em;margin:8px 0 7px;}
.battle-console-current p {font-size:12px;line-height:1.6;color:#554d38;}
.hp-bar {height:4px;background:#9a916d70;margin:3px 0 8px;overflow:hidden;}
.hp-bar i {display:block;height:100%;background:#698969;}
.battle-control {display:grid;align-items:center;gap:7px;position:relative;width:100%;text-align:left;}
.order-buttons {display:flex;gap:5px;margin:8px 0;}
.order-buttons button,.battle-directed button {background:#3e4a36;color:#f5e8c9;border-color:#78764d;font-size:12px;}
.order-buttons button {flex:auto;}
.order-buttons button[aria-pressed="true"] {background:#785936;}
.battle-directed {display:flex;align-items:end;gap:7px;margin-top:8px;}
.battle-directed label {display:grid;flex:1;gap:3px;min-width:0;font-size:11px;}
.battle-directed select {width:100%;color:#493f2f;background:#efe3c3;border-color:#ae9a71;min-height:32px;font-size:12px;}
.battle-console-section,.battle-reports {padding:6px 12px 11px;border-top:1px solid #92845d66;}
.battle-console-section h2,.battle-reports h2 {color:#dfc994;margin-top:3px;}
.battle-spells {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;}
.battle-spell {grid-template-columns:24px minmax(0,1fr);padding:6px 5px;min-height:46px;color:#eee1c0;border:1px solid #7581668c;background:linear-gradient(90deg,#ad97623d var(--cooldown,0%),transparent var(--cooldown,0%)),#344034;}
.battle-spell:hover,.battle-spell[aria-pressed="true"] {border-color:#dec086;background-color:#52533c;}
.battle-spell[aria-disabled="true"] {color:#bcc0b0;background-color:#2c342c;}
.spell-seal {width:23px;height:27px;border:1px solid #9b795c;font-size:17px;color:#e9c4a2;background:#674c3b;}
.battle-spell:nth-child(2) .spell-seal {color:#c8dfbc;background:#435a42;border-color:#7c9876;}
.battle-spell:nth-child(3) .spell-seal {color:#d0dce5;background:#465461;border-color:#7d91a2;}
.battle-spell:nth-child(4) .spell-seal {color:#eddfac;background:#635e40;border-color:#a49d6e;}
.battle-spell b {font-size:12px;padding-right:5px;line-height:1.3;}
.battle-spell small {font-size:10px;color:#c8cbb3;margin-top:3px;}
.battle-spell kbd {position:absolute;right:2px;top:2px;font-size:8px;line-height:1;padding:1px 2px;}
.battle-spell-cooldown {position:absolute;bottom:4px;right:4px;font-size:10px;color:#f3d39a;}
.battle-console-log {font-size:11px;line-height:1.5;color:#c8ccb9;}
.battle-console-log div {display:flex;gap:8px;margin:2px 0;}
.battle-console-log div:first-child {color:#f1dfb2;}
.battle-console-log time {color:#acae94;font-family:Consolas,monospace;}
.battle-keys {padding:6px 0 0;text-align:center;color:#b1bdab;font-size:11px;}
.battle-keys b,.battle-roster-heading b {padding:0 4px;color:#737b62;}
.sr-battle {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
@media(max-width:1050px){.battle-header{gap:10px}.battle-layout{grid-template-columns:minmax(0,1fr) 255px}.battle-console-current{padding:11px}.battle-resources div{padding:0 10px;min-width:63px}}
@media(max-width:800px){
  #battle-root{padding:5px 0}.battle-board{width:calc(100% - 10px)}.battle-layout{grid-template-columns:minmax(0,1fr);gap:7px;margin-top:5px}
  .battle-header{grid-template-columns:auto 1fr auto;gap:5px 8px;padding:6px 8px}.battle-title{padding-left:8px}.battle-title h1{font-size:20px}
  .battle-resources div{min-width:51px;padding:0 6px}.battle-resources dd{font-size:17px}.battle-time{grid-column:1/-1;justify-content:flex-end;border-top:1px solid var(--stroke);padding-top:4px}
  .battle-time button{min-height:27px}.battle-console{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);align-items:start}.battle-console-title{grid-column:1/-1}
  .battle-console-current{grid-row:2/4;height:100%}.battle-console-section,.battle-reports{padding:7px 8px}
  .battle-spells{grid-template-columns:1fr}.battle-spell{min-height:35px}.battle-spell span:nth-child(2){display:flex;align-items:baseline;gap:5px}.battle-keys{display:none;}
  .battle-map-hint{left:5px;top:5px;font-size:10px}.battle-roster{padding:6px 8px}.battle-roster-heading{margin-bottom:4px}.battle-roster-heading h2{font-size:14px}
  .battle-zooms button{min-width:32px;min-height:29px}.battle-return{min-height:36px}
}
@media(max-width:510px){.battle-console{display:block}.battle-spells{grid-template-columns:repeat(2,minmax(0,1fr))}.battle-header{gap:4px}.battle-resources dt{font-size:10px;gap:4px}.battle-resources div{min-width:42px;padding:0 4px}.battle-title span{font-size:10px}.battle-title h1{font-size:17px}.battle-time{justify-content:space-between}.battle-map-footer{font-size:11px;padding:5px 7px}.battle-aim{max-width:68%;white-space:normal;font-size:10px}.battle-lesson{font-size:11px}.battle-map-hint{padding:2px 5px}.battle-control,.roster-card{min-height:43px}.battle-spell{min-height:42px}}@media(min-width:801px) and (max-height:700px){
  #battle-root{padding:4px 0}.battle-board{width:min(calc(100% - 14px),max(760px,calc(154svh - 42px)))}
  .battle-layout{grid-template-columns:minmax(0,1fr) 253px;gap:7px;margin-top:5px}
  .battle-header{padding:5px 9px;gap:8px}.battle-title h1{font-size:21px}.battle-resources div{min-width:53px;padding:0 7px}.battle-resources dd{font-size:17px}
  .battle-map-footer{padding:4px 8px;font-size:11px}.battle-roster{padding:4px 7px 6px}.battle-roster-heading{margin-bottom:4px}.battle-roster-heading h2{font-size:13px}
  .battle-lesson{padding:4px 7px;margin-top:4px}.battle-keys{padding-top:3px;font-size:10px}
  .battle-console-title{padding:5px 9px}.battle-console-current{padding:8px 9px}.battle-console-current h2{font-size:23px}
  .battle-console-section,.battle-reports{padding:5px 8px}.battle-spell{min-height:37px;padding:4px 5px}
  .battle-console{max-height:calc(100svh - 69px);overflow-y:auto;scrollbar-width:thin}
}
.battle-resources dd small {display:inline-block;color:#b8c6a4;font-size:10px;font-weight:400;margin-left:5px;white-space:nowrap;}
@media(max-width:800px){.battle-resources dd small {display:block;font-size:9px;line-height:1;margin:1px 0 0;}}

.battle-map-commands {
  position:absolute;z-index:2;max-width:calc(100% - 10px);width:max-content;
  border:1px solid #574c33;border-radius:4px;background:#e7d9b2;color:#393322;
  box-shadow:0 3px 9px #12241969,0 0 0 1px #e9c886b3;
}
.battle-map-commands header {
  display:flex;align-items:center;gap:8px;min-height:24px;padding:1px 2px 1px 7px;
  border-radius:3px 3px 0 0;background:linear-gradient(105deg,#2d453c,#26352e);color:#f4e2b4;
}
.battle-map-commands header strong {font:700 14px/1.2 "STZhongsong","SimSun",serif;letter-spacing:.05em;}
.battle-map-commands header span {font-size:10px;color:#d8cba5;}
.battle-map-commands header button {border:0;background:transparent;color:#e3d4b5;min-width:25px;min-height:23px;margin-left:auto;font-size:18px;line-height:1;}
.map-tiles,.map-garrison-list {display:flex;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#9c956f transparent;}
.map-tiles {gap:3px;padding:4px;max-width:min(382px,calc(100vw - 26px));}
.battle-board .map-tile {
  flex:1 0 49px;min-width:49px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
  padding:1px 4px 3px;border:1px solid #bca77b;border-bottom-color:#9d8a63;border-radius:2px;
  background:linear-gradient(#fcf0d0,#e5d3a8);color:#443a27;line-height:1.1;white-space:nowrap;
}
.map-tile .command-art {display:block;width:32px;height:32px;}
.map-tile b {font-size:11px;font-weight:700;}
.map-tile small {color:#615638;font-size:10px;}
.map-tile .tile-cost {font-size:10px;color:#79542b;}
.battle-board .map-tile:disabled {background:#d3c7a9;border-color:#baad8d;}
.map-tile:disabled .tile-cost {color:#79524a;}
.map-tile:disabled canvas {filter:grayscale(.65);opacity:.71;}
.battle-board .map-tile:hover:not(:disabled),.battle-board .map-tile:focus-visible {background:#fff5d6;border-color:#86602d;}
.map-garrison {display:flex;align-items:center;gap:5px;padding:2px 5px;border-top:1px solid #ae9c70;background:#d8c9a5;border-radius:0 0 3px 3px;}
.map-garrison strong,.map-garrison-list span {font-size:10px;white-space:nowrap;}
.map-garrison-list {flex:1;min-width:0;gap:3px;align-items:center;max-width:230px;}
.map-garrison-list span {color:#6c654d;}
.map-garrison-list button {display:flex;gap:2px;align-items:center;flex:none;min-height:24px;padding:1px 4px;background:#354c40;border:1px solid #4e6654;color:#faebc6;font-size:11px;white-space:nowrap;touch-action:none;user-select:none;cursor:grab;}
.map-garrison-list canvas {width:19px;height:19px;flex:none;}
.map-garrison-list button:hover,.map-garrison-list button:focus-visible {background:#48664e;}
.garrison-summary {display:flex;gap:12px;margin:8px 0 4px;font-size:11px;color:#675a3d;}
.garrison-summary b {color:#344735;}
@media(max-width:800px) {
  .battle-map-commands {max-width:min(84%,350px);}
  .map-tiles {max-width:100%;}
  .battle-map-commands header {min-height:25px;}
  .map-garrison-list button,.battle-map-commands header button {min-height:28px;}
  .map-tile .command-art {width:27px;height:27px;}
}
@media(max-width:510px) {
  .battle-map-frame {min-height:265px;}
  .battle-roster {grid-template-columns:90px minmax(0,1fr);gap:7px;}
  .battle-map-commands {max-width:82%;}
  .map-tiles {gap:2px;padding:2px;}
  .battle-board .map-tile {min-width:42px;flex-basis:42px;padding:1px 2px 2px;}
  .map-tile .command-art {width:22px;height:22px;}
  .battle-map-commands header strong {font-size:12px;}
  .map-garrison {padding:1px 4px;}
}
