:root {
  color-scheme: dark;
  --ink: #0c1312;
  --panel: #15201d;
  --line: #514838;
  --soft-line: #383e32;
  --gold: #dfb877;
  --light-gold: #f3d7a0;
  --text: #f0e7d2;
  --muted: #bcb6a1;
  --jade: #94c3a4;
  --red: #ec9a80;
  --serif: "Noto Serif SC", "STSong", "Songti SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-family: var(--sans);
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: linear-gradient(160deg, #101716e6, #0c1512b5 40%, #0a100ef7),
    url("../assets/campaign.webp") center / cover fixed, var(--ink);
}

button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid #ffdb89; outline-offset: 2px; z-index: 4; }
img { display: block; max-width: 100%; object-fit: cover; }
.hidden { display: none !important; }
.asset-icon { display: inline-block; width: 23px; height: 23px; flex: 0 0 auto; border-radius: 4px; }
.class-shield { --class-color: #c6b590; }
.class-warrior { --class-color: #e59078; }
.class-archer { --class-color: #8dcba7; }
.class-mage { --class-color: #a4b9e3; }

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(512px, 1fr) auto;
  gap: 12px;
  min-height: 100svh;
  max-width: 1720px;
  padding: 16px clamp(12px, 1.8vw, 30px);
  margin: auto;
}

.paper-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(155deg, #1b2621, #111a18 72%);
  box-shadow: 0 8px 20px #060b0980, inset 0 1px #e3bd7420;
}

.top-bar, .top-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-bar { justify-content: space-between; min-height: 62px; padding: 8px 12px; }
.top-right { justify-content: flex-end; }
.seal-title, .lord-badge, .stat-pill, .relic-bar, .relic-chip { display: flex; align-items: center; gap: 7px; }
.seal-title {
  padding-right: 12px;
  margin-right: 3px;
  border-right: 1px solid #554835;
  color: var(--light-gold);
  font: 700 23px/1 var(--serif);
  letter-spacing: .1em;
  white-space: nowrap;
}

.seal-title img, .lord-heading img { border: 1px solid #bc7554; border-radius: 5px; }
.lord-badge, .stat-pill { min-height: 31px; padding: 0 9px; border-radius: 5px; white-space: nowrap; }
.lord-badge { color: var(--light-gold); font-weight: 700; background: #b9955721; }
.lord-badge img { border: 1px solid #9c805b; }
.stat-pill { background: #0c1513b8; border: 1px solid #384338; }
.stat-label { color: var(--muted); font-size: 11px; }
.stat-val, .moves-num { font-variant-numeric: tabular-nums; }
.stat-val { font-size: 12px; font-weight: 700; }
.hp-track { width: 53px; height: 5px; border-radius: 8px; background: #404a40; overflow: hidden; }
.hp-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #5f926f, #b3ddb2); transition: width .2s ease; }
.gold-pill .stat-val, .wave-pill .stat-val { color: var(--light-gold); }
.relic-bar:empty { display: none; }
.relic-chip .asset-icon { width: 29px; height: 29px; border: 1px solid #927850; }

.ink-btn, .deck-chip-btn {
  padding: 7px 11px;
  border: 1px solid #6f5e45;
  border-radius: 5px;
  background: #283128;
  font-weight: 650;
}

.small-btn { font-size: 12px; }
.ink-btn:hover:not(:disabled), .deck-chip-btn:hover:not(:disabled) {
  color: #fff1cd;
  border-color: #b49762;
  background: #3b4232;
}
.ink-btn:disabled, .deck-chip-btn:disabled { opacity: .53; }
.danger-outline { color: var(--red); border-color: #805344; }
.main-stage { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(450px, 2.8fr) minmax(218px, 1fr); gap: 12px; min-height: 0; }
.side-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px; overflow: auto; scrollbar-width: thin; }
.panel-block { min-width: 0; }
.block-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
  margin: 0 0 7px;
  padding: 0 0 6px 7px;
  border-bottom: 1px solid var(--soft-line);
  border-left: 2px solid #a98450;
  color: var(--light-gold);
  font: 700 17px/1 var(--serif);
  letter-spacing: .06em;
}

.sub-hint { color: var(--muted); font: 400 10px/1.3 var(--sans); letter-spacing: 0; }
.synergy-list { display: grid; gap: 4px; }

.synergy-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border: 1px solid #354031;
  border-radius: 5px;
  background: #121c17;
}
.synergy-item.active { border-color: #947546; background: linear-gradient(110deg, #453d2699, #233025); }
.synergy-icon { width: 29px; height: 29px; flex: 0 0 auto; border-radius: 4px; border: 1px solid #6b5b40; }
.synergy-info { flex: 1; min-width: 0; }
.synergy-head { display: flex; justify-content: space-between; gap: 4px; font-size: 12px; font-weight: 700; }
.synergy-head span:last-child { white-space: nowrap; color: var(--gold); font-size: 10px; }
.synergy-desc { color: var(--muted); font-size: 11px; line-height: 1.38; }
.log-block { display: flex; flex-direction: column; min-height: 52px; flex: 1; }
.battle-log-list { overflow: auto; min-height: 28px; max-height: 140px; margin: 0; padding: 0; list-style: none; scrollbar-width: thin; }
.battle-log-list li { padding: 5px 3px; border-bottom: 1px solid #393e2e; color: var(--muted); font-size: 11px; line-height: 1.45; }
.battle-log-list li:first-child { color: var(--text); }

.center-arena { position: relative; min-width: 0; min-height: 0; padding: 6px; }
.arena-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 31px minmax(0, 1fr);
  height: 100%;
  padding: 10px clamp(9px, 2.4vw, 37px);
  overflow: hidden;
  border: 1px solid #73644992;
  border-radius: 6px;
  background: linear-gradient(180deg, #1b17147a, #0b171613 47%, #0a1b1780 74%, #0c1512a3),
    url("../assets/arena.webp") center / 100% 100%, #14241f;
}

.board-section { display: flex; flex-direction: column; gap: 5px; width: min(100%, 620px); min-height: 0; margin: 0 auto; }
.board-header { display: flex; gap: 7px 10px; align-items: center; justify-content: space-between; }
.board-tag { color: var(--red); font: 700 clamp(11px, 1.05vw, 15px)/1.25 var(--serif); }
.player-tag { color: #b6e0be; }
.board-tip { color: #e3d6bd; font-size: 10px; text-align: right; }
.grid-4x4 { display: grid; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 5px; }

.grid-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 1px;
  border: 1px solid #a4c1a042;
  border-radius: 5px;
  background: #101a1669;
  text-align: left;
}
.grid-cell:empty::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid #aec6a474;
  transform: translate(-50%, -50%) rotate(45deg);
  content: "";
}
.enemy-grid .grid-cell { border-color: #c48c6869; background: #26151261; }
.enemy-grid .grid-cell:empty::before { border-color: #bc88677d; }
.grid-cell:hover:not(:disabled) { border-color: #ead39d; background: #596a4b68; }
.grid-cell.targetable-cell { border-color: #89c9aa; background: #2a694c65; }
.grid-cell.selected-cell { border-color: #ffdc82; box-shadow: inset 0 0 10px #d9a74e6e, 0 0 7px #e3b55980; }

.river-divider { display: flex; align-items: center; justify-content: center; color: #f7e7c0; }
.river-divider span {
  padding: 3px 13px;
  border-right: 1px solid #bcb08a;
  border-left: 1px solid #bcb08a;
  background: #102221c7;
  font: 700 12px/1.1 var(--serif);
  letter-spacing: .22em;
}

.unit-token {
  position: relative;
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--class-color);
  border-radius: 4px;
  background: linear-gradient(110deg, #29362d, #101815 70%);
}

.unit-token[draggable="true"] { cursor: grab; }
.unit-token.tier-4 { border-color: #ffd077; box-shadow: inset 0 0 9px #b88642; }
.unit-art { width: 40%; height: 100%; flex: 0 0 auto; object-position: center 37%; }
.unit-info { min-width: 0; flex: 1; display: grid; gap: 1px; padding: 1px 3px 1px 4px; }
.unit-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff4dc; font-size: 11px; font-weight: 700; }
.unit-tier-badge {
  position: absolute;
  top: 1px;
  left: 1px;
  padding: 0 3px;
  border: 1px solid #d4baa17a;
  border-radius: 3px;
  background: #111b1beb;
  color: #fff0ca;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}
.tier-bg-2 { background: #2c4960; }
.tier-bg-3 { background: #743f38; }
.tier-bg-4 { background: #8a581e; }
.unit-bottom-row, .faction-tag, .unit-equips-mini { display: flex; align-items: center; gap: 3px; }
.unit-bottom-row { flex-wrap: wrap; color: #e4d9bf; font-size: 9px; line-height: 1.05; }
.faction-tag .asset-icon, .unit-equips-mini .asset-icon { width: 12px; height: 12px; border-radius: 2px; }
.unit-hp { white-space: nowrap; font-variant-numeric: tabular-nums; }

.battle-canvas { position: absolute; z-index: 1; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.in-battle :is(.board-section, .river-divider) { visibility: hidden; }
.toast-banner {
  position: absolute;
  z-index: 5;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 85%;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #b5925f;
  border-radius: 6px;
  background: #19221a;
  color: #ffe4a9;
  text-align: center;
  box-shadow: 0 5px 18px #070d09b0;
}
.toast-banner::before { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 3px; background: url("../assets/flare.webp") center / cover; content: ""; }

.inspect-card { display: grid; gap: 8px; padding: 8px; border: 1px solid #4d503c; border-radius: 6px; background: #0e1915ac; }
.empty-inspect, .inventory-empty { display: flex; align-items: center; gap: 8px; min-height: 52px; color: var(--muted); font-size: 12px; }
.empty-art { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid #665a40; border-radius: 5px; }
.inspect-head { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.inspect-head span { display: block; }
.inspect-portrait { width: 60px; height: 60px; flex: 0 0 auto; border: 1px solid #8e774e; border-radius: 5px; }
.inspect-name { margin-bottom: 3px; color: var(--light-gold); font: 700 19px/1.2 var(--serif); }
.inspect-stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; color: var(--muted); font-size: 11px; }
.inspect-stats-grid strong { color: var(--text); }
.inspect-skill-box { padding: 7px; border-left: 2px solid #ad905a; background: #34372574; font-size: 11px; line-height: 1.55; }
.inspect-skill-box strong { color: var(--light-gold); }
.equipped-chips, .deck-remove-list { display: flex; flex-wrap: wrap; gap: 5px; }
.equipped-chip { display: inline-flex; gap: 3px; align-items: center; font-size: 11px; }
.unequip-x { border: 1px solid #805344; border-radius: 3px; background: #422922; color: #ffb89b; }
.equip-inventory { display: grid; gap: 6px; max-height: 225px; overflow: auto; scrollbar-width: thin; }
.equip-item { text-align: left; border: 1px solid #4c513d; background: #17251e; border-radius: 5px; }
.equip-item, .loot-choice { display: flex; align-items: center; gap: 7px; padding: 5px; }
.equip-item:hover, .equip-item.selected { border-color: var(--gold); background: #2b3528; }
.equip-item small { display: block; color: var(--muted); font-size: 10px; }
.inventory-icon { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid #766347; border-radius: 4px; }
.deck-info-block { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--soft-line); }
.deck-pill-row { display: flex; gap: 8px; color: var(--muted); font-size: 11px; }
.deck-pill-row span { flex: 1; padding: 4px 8px; border-radius: 4px; background: #0d1714; }
.deck-pill-row strong { color: var(--light-gold); }

.bottom-dock { display: grid; grid-template-columns: minmax(125px, .89fr) minmax(0, 4fr) auto; align-items: center; gap: 11px; padding: 9px 11px; }
.dock-left, .moves-badge { display: flex; gap: 7px; }
.dock-left { align-items: flex-start; flex-direction: column; }
.moves-badge { align-items: baseline; color: var(--light-gold); }
.moves-num { font: 700 28px/1 var(--serif); }
.moves-label, .selection-hint { color: var(--muted); font-size: 11px; }
.selection-hint { line-height: 1.45; }
.hand-area { display: flex; gap: 6px; align-items: stretch; justify-content: safe center; min-width: 0; min-height: 88px; padding: 3px 1px; overflow-x: auto; scrollbar-width: thin; }
.hand-card {
  position: relative;
  flex: 0 0 clamp(102px, 10vw, 145px);
  min-height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  overflow: hidden;
  padding: 5px 5px 5px 7px;
  border: 1px solid #716148;
  border-top-color: var(--class-color, #e1ba75);
  border-radius: 5px;
  color: #fff4d9;
  background: #141e19;
  text-align: left;
  isolation: isolate;
}
.hand-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, #101914 5%, #101914b9 40%, #10191400 90%);
  content: "";
}
.hand-art { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-position: center 34%; }
.hand-card-tag {
  position: absolute;
  top: 3px;
  left: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #0b1717e8;
  color: var(--class-color, #ffd795);
  font-size: 9px;
  white-space: nowrap;
}
.hand-card-title { font-size: 12px; font-weight: 750; line-height: 1.15; }
.hand-card-desc { color: #e0d5ba; font-size: 10px; line-height: 1.3; }
.hand-card:hover, .hand-card.selected { border-color: #f6d99b; }
.hand-card.selected { box-shadow: inset 0 0 0 1px #f6d99b; }
.hand-card:focus-visible { outline-offset: -2px; }

.war-drum-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid #cb8d5f;
  border-radius: 6px;
  color: #fff0ce;
  background: linear-gradient(145deg, #914632, #572a23);
  box-shadow: inset 0 0 0 2px #30171377, 0 5px 12px #070d0980;
}
.war-drum-btn img { border: 1px solid #cf9b66; border-radius: 50%; }
.war-drum-btn:hover:not(:disabled) { background: linear-gradient(145deg, #a95b3d, #71342a); border-color: #f2bf81; }
.war-drum-btn:disabled { opacity: .52; }
.drum-main, .drum-sub { display: block; white-space: nowrap; }
.drum-main { font: 700 19px/1.12 var(--serif); }
.drum-sub { margin-top: 4px; color: #f7d6b4; font-size: 10px; }
.compact-drum { font-size: 13px; font-weight: 700; }

.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  justify-items: center;
  align-items: safe center;
  overflow: auto;
  padding: clamp(12px, 3vw, 36px);
  background: #0a100ed4;
  backdrop-filter: blur(4px);
}
#modalRules { z-index: 12; }
.modal-scroll {
  width: min(100%, 560px);
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid #8e734c;
  outline: 1px solid #b3966038;
  outline-offset: -5px;
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 0%, #3b4331, #18261f 63%, #131c19);
  box-shadow: 0 24px 70px #040806c9;
}
.modal-wide { width: min(100%, 890px); }
.modal-xl { width: min(100%, 1100px); }
.scroll-title { margin: 0 0 8px; color: var(--light-gold); font: 700 clamp(22px, 3vw, 33px)/1.2 var(--serif); }
.scroll-subtitle { margin: 0 0 17px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.card-choice-grid, .shop-grid { display: grid; gap: 9px; }
.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#heroPickOptions:has(> :nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.choice-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px;
  border: 1px solid #746247;
  border-radius: 6px;
  background: linear-gradient(150deg, #2b382c, #161f1b);
  text-align: left;
}
.choice-card:hover:not(:disabled), .choice-card.chosen { border-color: #e2bb73; background: #343c2e; }
.choice-card.disabled, .shop-item-card.sold { opacity: .54; }
.choice-portrait { width: 100%; height: clamp(100px, 17vw, 183px); object-position: 50% 37%; border: 1px solid #7d694a; border-radius: 4px; }
.relic-choice .choice-portrait { object-fit: contain; background: #0d1714; }
.choice-title, .choice-meta, .choice-desc { display: block; }
.choice-title { color: #f2d5a4; font-weight: 700; }
.choice-title small, .choice-meta { color: var(--muted); font-size: 11px; }
.choice-desc { color: var(--text); font-size: 12px; line-height: 1.55; }
.choice-desc strong { color: var(--gold); }

.lord-stage {
  background: linear-gradient(180deg, #0c1514ad 0%, #0d18136c 27%, #0b1512a8 69%, #0a1211ed),
    url("../assets/campaign.webp") center / cover, #14201d;
  backdrop-filter: none;
}
.lord-scroll { width: min(100%, 850px); }
.lord-heading { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.lord-heading img { width: 38px; height: 38px; box-shadow: 0 4px 14px #0a1211b3; }
.lord-heading h1 {
  margin: 9px 0 7px;
  color: #f9e4b4;
  font: 700 clamp(42px, 6vw, 83px)/1.03 var(--serif);
  letter-spacing: .15em;
  text-indent: .15em;
  text-shadow: 0 2px 2px #0a100d, 0 10px 24px #0a100dc2;
}
.lord-heading p { display: flex; gap: 12px; align-items: center; margin: 0; color: #f5d5a4; font: 700 17px/1.3 var(--serif); letter-spacing: .38em; }
.lord-heading p::before, .lord-heading p::after { width: 34px; height: 1px; background: #c8a56e; content: ""; }

#lordOptions { gap: clamp(8px, 1.5vw, 16px); }
.lord-card {
  --faction-tone: #b4d3ac;
  position: relative;
  display: grid;
  grid-template-rows: clamp(160px, 30vh, 298px) 1fr;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #a68a5f;
  border-radius: 8px;
  background: #18221c;
  text-align: left;
  box-shadow: 0 14px 24px #050a08a6;
  transition: border-color .18s ease, transform .18s ease;
}
.lord-card.faction-wei { --faction-tone: #afc7e0; }
.lord-card.faction-wu { --faction-tone: #f1a88e; }
.lord-card:hover { transform: translateY(-4px); border-color: #f2c781; }
.lord-art { grid-area: 1 / 1; width: 100%; height: 100%; object-position: center 9%; }
.lord-card-heading {
  grid-area: 1 / 1;
  align-self: end;
  display: grid;
  gap: 4px;
  padding: 20px 11px 8px;
  background: linear-gradient(0deg, #101914 3%, #101914d9 42%, transparent);
}
.lord-faction { display: flex; align-items: center; gap: 5px; color: var(--faction-tone); font-size: 11px; font-weight: 700; letter-spacing: .15em; }
.lord-faction img { width: 19px; height: 19px; border: 1px solid #c0a07185; }
.lord-name { color: #fff1ce; font: 700 clamp(24px, 3vw, 35px)/1.08 var(--serif); letter-spacing: .14em; }
.lord-card-body { display: block; padding: 9px 11px 12px; border-top: 1px solid #706045; background: linear-gradient(145deg, #273126, #141c18); }
.lord-stats { display: flex; flex-wrap: wrap; gap: 4px 13px; margin-bottom: 6px; color: #dec9a3; font-size: 11px; }
.lord-stats b { color: #ffe2a8; font-size: 13px; }
.lord-card .choice-desc { color: #e7dfc9; font-size: 12px; line-height: 1.65; }

.reward-header, .reward-actions-top, .section-head-row, .shop-utility-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reward-header, .section-head-row { justify-content: space-between; }
.reward-header .scroll-subtitle { margin-bottom: 0; }
.shop-gold-badge { color: var(--light-gold); font-size: 12px; }
.reward-section { margin-top: 14px; padding-top: 11px; border-top: 1px solid #5a5b45; }
.section-heading { margin: 0 0 7px; color: var(--light-gold); font: 700 17px/1.25 var(--serif); }
.section-head-row { margin-bottom: 7px; }
.section-head-row .section-heading { margin: 0; }
.loot-choice { flex-direction: row; }
.shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-item-card { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 6px; padding: 8px; border: 1px solid #675a43; border-radius: 5px; background: #16221c; }
.shop-item-card button { grid-column: 2; justify-self: start; }
.deck-remove-list { max-height: 125px; overflow: auto; scrollbar-width: thin; }
.deck-chip-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; font-size: 11px; }
.deck-chip-btn .asset-icon { width: 19px; height: 19px; }

.rules-content, .gameover-stats { color: var(--text); line-height: 1.7; }
.rules-content strong, .gameover-stats strong { color: var(--light-gold); }
.gameover-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-top: 15px; }
.modal-footer-center { display: flex; justify-content: center; margin-top: 18px; }

@media (max-width: 1160px) {
  .top-bar { gap: 5px; padding: 8px; }
  .top-group { gap: 5px; }
  .stat-pill, .lord-badge { padding-inline: 5px; }
  .hp-track { width: 33px; }
  .side-panel { padding: 9px; }
}

@media (max-width: 1010px) {
  .app-shell { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; gap: 8px; }
  .main-stage { display: contents; }
  .top-bar, .center-arena, .bottom-dock { grid-column: 1 / -1; }
  .top-bar { grid-row: 1; }
  .center-arena { grid-row: 2; height: clamp(490px, 64svh, 620px); }
  .bottom-dock { grid-row: 3; }
  .side-panel { grid-row: 4; }
  .battle-log-list { max-height: 157px; }
}

@media (max-width: 650px) {
  .app-shell { padding: 6px; }
  .top-bar { min-height: auto; }
  .seal-title { font-size: 18px; padding-right: 5px; margin-right: 0; }
  .seal-title img { width: 23px; height: 23px; }
  .stat-label { font-size: 10px; }
  .wave-pill { order: 5; }
  .hp-track { width: 23px; }
  .top-right, .top-group { justify-content: flex-start; }
  .top-right .small-btn { padding: 4px 7px; }
  .center-arena { height: clamp(461px, 61svh, 540px); padding: 3px; }
  .arena-shell { padding: 7px; grid-template-rows: minmax(0, 1fr) 23px minmax(0, 1fr); }
  .grid-4x4 { gap: 4px; }
  .board-header { min-height: 19px; }
  .board-tip { font-size: 9px; }
  .player-section .board-tip { max-width: 73%; }
  .unit-token { isolation: isolate; align-items: end; }
  .unit-art { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-position: center 33%; }
  .unit-token::after { position: absolute; z-index: -1; inset: 0; background: linear-gradient(0deg, #0a120ff7 14%, #0a120f54 59%, transparent 85%); content: ""; }
  .unit-info { gap: 1px; padding: 1px 2px; }
  .unit-name { font-size: 10px; }
  .unit-bottom-row { font-size: 8px; gap: 2px; }
  .bottom-dock { grid-template-columns: minmax(0, 1fr) auto; padding: 7px; gap: 6px; }
  .dock-left { grid-column: 1; grid-row: 1; gap: 2px; }
  .dock-right { grid-column: 2; grid-row: 1; }
  .hand-area { grid-column: 1 / -1; justify-content: flex-start; }
  .hand-card { flex-basis: 102px; }
  .war-drum-btn { padding: 6px 8px; }
  .war-drum-btn img { width: 29px; height: 29px; }
  .drum-main { font-size: 16px; }
  .moves-num { font-size: 22px; }
  .left-panel { grid-column: 1 / -1; grid-row: 5; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .right-panel { grid-column: 1 / -1; grid-row: 4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-block, .deck-info-block { grid-column: 1 / -1; }
  .lord-heading { margin-bottom: 15px; }
  .lord-stage { align-items: start; padding: 19px 12px; }
  #lordOptions { grid-template-columns: 1fr; max-width: 425px; margin: 0 auto; }
  .lord-card { --portrait-col: max(94px, 32%); grid-template: auto / var(--portrait-col) minmax(0, 1fr); min-height: 142px; }
  .lord-art { position: absolute; inset: 0 auto 0 0; grid-area: auto; width: var(--portrait-col); object-position: center 11%; }
  .lord-card-heading { position: relative; padding: 18px 6px 7px; }
  .lord-card-body { grid-area: 1 / 2; padding: 8px; border-top: 0; border-left: 1px solid #706045; }
  .lord-faction { font-size: 10px; }
  .lord-card .choice-desc { font-size: 11px; }
  .lord-card:hover { transform: none; }
  .three-cols, #heroPickOptions:has(> :nth-child(4)), .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loot-choice { flex-direction: column; align-items: flex-start; }
  .shop-item-card { grid-template-columns: 1fr; }
  .shop-item-card button { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* === 《九王策》新增城建、光环连线、升级分支与折饷样式 === */
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.wave-trait-box {
  padding: 7px 9px;
  border: 1px solid #755b3c;
  border-left: 3px solid #d4825a;
  border-radius: 5px;
  background: linear-gradient(155deg, #271b18cc, #121c19dd);
  font-size: 11px;
  line-height: 1.5;
}
.wave-trait-title { color: #f6c294; font-weight: 700; margin-bottom: 3px; }
.wave-trait-tip { color: #e2d8be; }

.grid-cell.aura-source-cell {
  border-color: #6cc99b;
  box-shadow: inset 0 0 8px #5eb68666;
}
.grid-cell.aura-target-cell {
  border-color: #f3c870;
  box-shadow: inset 0 0 10px #dfb87788, 0 0 6px #dfb87755;
}
.grid-cell.relocate-target-cell {
  border: 1.5px dashed #7fd9f2;
  background: #1c3a4466;
}

.unit-token.cat-citadel {
  border-color: #f3c870;
  background: linear-gradient(110deg, #3c321d, #171e1a 75%);
  box-shadow: inset 0 0 10px #b9893255;
}
.unit-token.cat-building {
  border-color: #a68c5b;
  background: linear-gradient(110deg, #262e29, #131a17 75%);
}
.branch-badge {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  background: #8a581e;
  color: #fff2cf;
  font-size: 9px;
  font-weight: 700;
}
.squad-badge {
  color: #aadbb9;
  font-size: 9px;
  font-weight: 700;
}

.inspect-actions {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
.upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #d4a656;
  border-radius: 5px;
  background: linear-gradient(145deg, #5c4622, #322817);
  color: #ffefc4;
  font-size: 12px;
  font-weight: 700;
}
.upgrade-btn:hover:not(:disabled) {
  border-color: #ffe29a;
  background: linear-gradient(145deg, #74582a, #41341d);
}
.upgrade-btn:disabled { opacity: 0.45; }
.upgrade-token-ico { width: 18px; height: 18px; object-fit: contain; }

.inspect-sub-actions {
  display: flex;
  gap: 6px;
}
.inspect-sub-actions .ink-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
}
.aura-summary-box {
  padding: 5px 7px;
  border-radius: 4px;
  background: #172721;
  border: 1px solid #3c5448;
  font-size: 10.5px;
  color: #bfe0ca;
  line-height: 1.45;
}

.hand-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 clamp(106px, 10.5vw, 148px);
}
.hand-card-wrap .hand-card {
  flex: 1;
  width: 100%;
  min-height: 82px;
}
.salvage-btn {
  padding: 2px 5px;
  border: 1px solid #725e3c;
  border-radius: 4px;
  background: #23281d;
  color: #ebd29b;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.salvage-btn:hover:not(:disabled) {
  border-color: #dfb877;
  background: #3a3723;
  color: #fff2cc;
}

.econ-badge {
  flex-direction: column;
  gap: 2px;
}
.econ-badge .moves-num {
  color: #a9dfb8;
  font-size: 24px;
}

@media (max-width: 650px) {
  .two-cols { grid-template-columns: 1fr; }
  .hand-card-wrap { flex-basis: 104px; }
}

