:root {
  --bg: #0c1117;
  --bg-2: #111923;
  --panel: #161f2a;
  --panel-2: #1c2733;
  --panel-3: #223040;
  --ink: #e9e2d3;
  --ink-dim: #b8b2a6;
  --muted: #8492a3;
  --gold: #c7a05b;
  --gold-bright: #e7c57e;
  --gold-soft: rgba(199, 160, 91, 0.18);
  --blue: #5789ae;
  --blue-bright: #83b6d8;
  --red: #b6584d;
  --red-bright: #df8272;
  --green: #6e9b75;
  --green-bright: #9ac7a0;
  --line: rgba(199, 160, 91, 0.2);
  --line-strong: rgba(199, 160, 91, 0.42);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  --cell: clamp(54px, 6.4vh, 74px);
  --cell-h: clamp(46px, 6vh, 64px);
  --gap: 5px;
  --radius: 10px;
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-display: "STKaiti", "KaiTi", "Songti SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible,
[tabindex]:focus-visible,
[role="gridcell"]:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* 手牌区 / 棋盘会裁掉外描边，这两类焦点环改成内描边 */
.card:focus-visible,
.cell:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 2px var(--gold-bright),
    0 0 14px rgba(231, 197, 126, 0.32);
}

.hidden {
  display: none !important;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 18% 8%, rgba(83, 117, 132, 0.18), transparent 34%),
    radial-gradient(circle at 83% 12%, rgba(153, 82, 57, 0.14), transparent 30%),
    radial-gradient(circle at 50% 105%, rgba(199, 160, 91, 0.09), transparent 42%),
    linear-gradient(160deg, #0b1016 0%, #101822 45%, #0b1015 100%);
}

.app-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 42%, black 0%, transparent 78%);
}

.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3));
}

.app {
  width: min(1420px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 8px 0 10px;
}

/* ---------------------------------------------------------
   顶栏
   --------------------------------------------------------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 9px 2px 9px 2px;
  color: var(--gold-bright);
  background:
    linear-gradient(145deg, rgba(199, 160, 91, 0.18), transparent 60%),
    #141c26;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.16);
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1;
  transform: rotate(-2deg);
}

.brand-copy h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.15;
}

.brand-copy p {
  margin: 1px 0 0;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.24em;
  white-space: nowrap;
}

.turn-pill {
  justify-self: center;
  min-width: 190px;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(18, 26, 36, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
}

.turn-pill.enemy-turn {
  color: var(--red-bright);
  border-color: rgba(182, 88, 77, 0.4);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ghost-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-dim);
  background: rgba(19, 27, 37, 0.66);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.ghost-btn:hover {
  color: var(--gold-bright);
  border-color: var(--line-strong);
  background: rgba(28, 39, 51, 0.9);
}

/* ---------------------------------------------------------
   主布局
   --------------------------------------------------------- */
.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  grid-template-areas:
    "play side"
    "hand hand";
  gap: 12px;
  align-items: stretch;
  align-content: start;
}

.play-column {
  display: flex;
  min-width: 0;
  grid-area: play;
  flex-direction: column;
  gap: 9px;
}

.side-panel {
  grid-area: side;
}

.hand-area {
  grid-area: hand;
  align-self: start;
}

/* ---------------------------------------------------------
   双方状态条
   --------------------------------------------------------- */
.hud {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 55%),
    rgba(20, 29, 39, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 28px rgba(0, 0, 0, 0.18);
}

.enemy-hud {
  border-color: rgba(182, 88, 77, 0.26);
  background:
    linear-gradient(180deg, rgba(182, 88, 77, 0.08), transparent 60%),
    rgba(20, 27, 36, 0.92);
}

.player-hud {
  border-color: rgba(87, 137, 174, 0.34);
  background:
    linear-gradient(180deg, rgba(87, 137, 174, 0.1), transparent 60%),
    rgba(19, 28, 39, 0.94);
}

.hud-hero {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 158px;
}

button.hud-hero {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

button.hud-hero:hover .hero-glyph {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  transform: translateY(-1px);
}

.hero-glyph {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold-bright);
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.14), transparent 48%), #19232f;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  transition: transform 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.enemy-hud .hero-glyph {
  color: var(--red-bright);
  border-color: rgba(182, 88, 77, 0.45);
}

.hero-names {
  min-width: 0;
}

.hero-title {
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1.15;
  white-space: nowrap;
}

.hero-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-hp {
  margin-top: 1px;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

.hero-hp b {
  color: var(--green-bright);
  font-size: 13px;
}

.hud-bars {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.bar-row {
  display: grid;
  grid-template-columns: 34px minmax(40px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.bar-row > span:first-child {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.bar-row > b {
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.hp-bar > i {
  background: linear-gradient(90deg, #4e7d59, #8fbd8a);
}

.enemy-hud .hp-bar > i {
  background: linear-gradient(90deg, #7f3833, #c96e5f);
}

.mana-bar {
  height: 7px;
}

.mana-bar > i {
  background: linear-gradient(90deg, #3d6a91, #8ec5e4);
}

.hud-mana {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.hud-mana b {
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 600;
}

.hud-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px 9px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: nowrap;
}

.hud-meta b {
  color: var(--gold-bright);
  font-weight: 600;
}

.peasant-inline {
  color: var(--green-bright);
  font-size: 10px;
  font-weight: 400;
}

.end-turn-btn {
  padding: 5px 9px;
  border: 1px solid rgba(199, 160, 91, 0.55);
  border-radius: 6px;
  color: #20180e;
  background: linear-gradient(180deg, #e6c57e, #b88d45);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: filter 0.16s ease, transform 0.16s ease;
}

.end-turn-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.end-turn-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7) brightness(0.72);
  transform: none;
}

.skill-btn {
  padding: 5px 8px;
  border: 1px solid rgba(199, 160, 91, 0.38);
  border-radius: 5px;
  color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.08);
  cursor: pointer;
  font-size: 10px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.skill-btn:hover {
  border-color: var(--gold);
  background: rgba(199, 160, 91, 0.16);
}

.skill-btn.used {
  opacity: 0.55;
  border-color: rgba(199, 160, 91, 0.2);
}

.skill-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

/* ---------------------------------------------------------
   战场
   --------------------------------------------------------- */
.board-wrap {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(199, 160, 91, 0.045), transparent 65%),
    rgba(11, 17, 24, 0.72);
  box-shadow: var(--shadow), inset 0 0 42px rgba(0, 0, 0, 0.32);
}

.col-labels {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  gap: var(--gap);
  margin-left: 0;
  margin-bottom: 5px;
}

.col-labels span {
  color: rgba(199, 160, 91, 0.6);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-align: center;
}

.board-body {
  display: block;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  grid-template-rows: repeat(6, var(--cell-h));
  gap: var(--gap);
  touch-action: manipulation;
}

.cell {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 70%),
    rgba(21, 30, 41, 0.7);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: default;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.028), transparent 62%);
}

.cell::after {
  content: attr(data-coord);
  position: absolute;
  top: 3px;
  left: 4px;
  color: rgba(255, 255, 255, 0.12);
  font-size: 7px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.cell:hover::after {
  opacity: 1;
}

.cell.deploy-enemy {
  border-color: rgba(196, 92, 80, 0.24);
  background:
    linear-gradient(180deg, rgba(196, 92, 80, 0.2), rgba(48, 18, 22, 0.58) 72%),
    rgba(34, 20, 24, 0.9);
}

.cell.deploy-player {
  border-color: rgba(88, 145, 204, 0.26);
  background:
    linear-gradient(180deg, rgba(88, 145, 204, 0.22), rgba(16, 34, 55, 0.55) 72%),
    rgba(18, 30, 46, 0.9);
}

.cell[data-r="3"] {
  border-top-color: rgba(199, 160, 91, 0.36);
  box-shadow: inset 0 2px 0 rgba(199, 160, 91, 0.1);
}

.cell.row-full {
  border-color: rgba(182, 88, 77, 0.34);
  box-shadow: inset 0 0 18px rgba(182, 88, 77, 0.08);
}

.cell:hover {
  border-color: rgba(199, 160, 91, 0.3);
  background-color: rgba(34, 47, 60, 0.85);
}

.cell.valid-deploy,
.cell.valid-repair,
.cell.valid-move,
.cell.valid-summon,
.cell.valid-attack,
.cell.valid-skill-enemy,
.cell.valid-skill-ally {
  cursor: pointer;
  animation: cellPulse 1.8s ease-in-out infinite;
}

.cell.valid-deploy,
.cell.valid-repair,
.cell.valid-summon {
  border-color: rgba(231, 197, 126, 0.82);
  background:
    radial-gradient(circle at 50% 50%, rgba(231, 197, 126, 0.18), transparent 70%),
    rgba(37, 40, 38, 0.88);
  box-shadow: inset 0 0 16px rgba(231, 197, 126, 0.12), 0 0 0 1px rgba(231, 197, 126, 0.1);
}

.cell.valid-move {
  border-color: rgba(131, 182, 216, 0.78);
  background:
    radial-gradient(circle at 50% 50%, rgba(131, 182, 216, 0.2), transparent 68%),
    rgba(24, 38, 50, 0.9);
}

.cell.valid-attack,
.cell.valid-skill-enemy {
  border-color: rgba(223, 130, 114, 0.95);
  background:
    radial-gradient(circle at 50% 50%, rgba(223, 130, 114, 0.26), transparent 68%),
    rgba(45, 30, 31, 0.94);
  box-shadow:
    inset 0 0 0 2px rgba(223, 130, 114, 0.55),
    inset 0 0 20px rgba(223, 130, 114, 0.16),
    0 0 14px rgba(223, 130, 114, 0.2);
}

.cell.valid-attack .unit,
.cell.valid-skill-enemy .unit {
  border-color: var(--red-bright);
  box-shadow:
    inset 0 0 0 1px rgba(223, 130, 114, 0.5),
    0 0 14px rgba(223, 130, 114, 0.28);
}

.cell.valid-skill-ally .unit {
  border-color: var(--green-bright);
  box-shadow:
    inset 0 0 0 1px rgba(154, 199, 160, 0.45),
    0 0 14px rgba(154, 199, 160, 0.2);
}

.cell.valid-skill-ally {
  border-color: rgba(154, 199, 160, 0.8);
  background:
    radial-gradient(circle at 50% 50%, rgba(154, 199, 160, 0.2), transparent 68%),
    rgba(27, 43, 33, 0.9);
}

.cell.valid-deploy::before,
.cell.valid-repair::before,
.cell.valid-move::before,
.cell.valid-summon::before,
.cell.valid-attack::before,
.cell.valid-skill-enemy::before,
.cell.valid-skill-ally::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.16) 0 2px, transparent 2.5px),
    radial-gradient(circle at 50% 50%, transparent 0 40%, rgba(255, 255, 255, 0.06) 41% 42%, transparent 43%);
}

.cell.valid-repair::after {
  content: "修";
  top: 3px;
  right: 4px;
  left: auto;
  color: var(--gold-bright);
  font-size: 10px;
}

.cell.selected-cell {
  border-color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px var(--gold-bright), 0 0 18px rgba(231, 197, 126, 0.16);
}

@keyframes cellPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.14); }
}

/* ---------------------------------------------------------
   棋子
   --------------------------------------------------------- */
.unit {
  position: absolute;
  inset: 3px;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3px 2px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.09), transparent 45%),
    linear-gradient(160deg, #2b3948, #1a242f 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 3px 8px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  user-select: none;
}

.unit.owner-1 {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.07), transparent 45%),
    linear-gradient(160deg, #40302f, #261d20 70%);
  border-color: rgba(182, 88, 77, 0.24);
}

.unit.owner-0 {
  border-color: rgba(87, 137, 174, 0.3);
}

.unit.kind-barracks {
  border-color: rgba(199, 160, 91, 0.36);
  background:
    linear-gradient(135deg, rgba(199, 160, 91, 0.14), transparent 48%),
    linear-gradient(160deg, #37404a, #20272d 72%);
}

.unit.kind-hero {
  border-color: rgba(231, 197, 126, 0.58);
  background:
    radial-gradient(circle at 50% 25%, rgba(231, 197, 126, 0.2), transparent 52%),
    linear-gradient(160deg, #39424b, #1d232b 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 18px rgba(199, 160, 91, 0.1);
}

.unit .glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  color: rgba(255, 255, 255, 0.125);
  font-family: var(--font-display);
  font-size: calc(var(--cell) * 0.62);
  font-weight: 700;
  line-height: 1;
  transform: translate(-50%, -52%);
}

.unit.owner-1 .glyph {
  color: rgba(223, 130, 114, 0.14);
}

.unit.kind-barracks .glyph {
  color: rgba(231, 197, 126, 0.15);
}

.unit .name {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  max-width: calc(100% - 2px);
  overflow: hidden;
  color: #f2ecdf;
  font-size: clamp(10px, calc(var(--cell) * 0.15), 12.5px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.unit .sub {
  display: none;
}

.unit .stat {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 15px;
  height: 14px;
  padding: 0 2px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.unit .atk {
  bottom: 2px;
  left: 2px;
  color: #20140f;
  background: linear-gradient(180deg, #e4a17d, #bd6a4e);
}

.unit .hp {
  right: 2px;
  bottom: 2px;
  color: #142019;
  background: linear-gradient(180deg, #9bc798, #63936a);
}

.unit .level {
  position: absolute;
  top: 50%;
  right: 2px;
  z-index: 2;
  padding: 0 3px;
  border: 1px solid rgba(231, 197, 126, 0.4);
  border-radius: 2px;
  color: var(--gold-bright);
  background: rgba(15, 20, 25, 0.72);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  transform: translateY(-50%);
}

.unit .tag {
  display: none;
}

.unit .status-dot {
  position: absolute;
  top: 1px;
  left: 1px;
  z-index: 3;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 6px rgba(154, 199, 160, 0.7);
}

.unit.exhausted {
  filter: saturate(0.58) brightness(0.8);
}

.unit.exhausted .status-dot {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.unit.ready {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(154, 199, 160, 0.14),
    0 3px 9px rgba(0, 0, 0, 0.28);
}

.unit.selected-token {
  border-color: var(--gold-bright);
  box-shadow:
    inset 0 0 0 1px rgba(231, 197, 126, 0.65),
    0 0 18px rgba(231, 197, 126, 0.22);
}

.unit .badges {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: flex;
  transform: translate(-50%, -50%);
  gap: 2px;
}

.unit .badge {
  display: grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  color: #dfeaf4;
  background: rgba(15, 20, 26, 0.78);
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
}

.unit .badge.shield {
  color: #d9edf8;
  border-color: rgba(131, 182, 216, 0.5);
}

.unit .badge.fly {
  color: #cfe8ff;
  border-color: rgba(131, 182, 216, 0.5);
  background: rgba(40, 76, 108, 0.82);
}

.unit .badge.armor {
  color: #f0e6c8;
  border-color: rgba(231, 197, 126, 0.55);
  background: rgba(90, 72, 36, 0.85);
}

.unit.kind-hero .glyph {
  font-size: calc(var(--cell) * 0.7);
}

.unit.kind-hero .name {
  font-size: clamp(10px, calc(var(--cell) * 0.14), 12px);
}

/* ---------------------------------------------------------
   选择栏
   --------------------------------------------------------- */
.selection-bar {
  display: flex;
  min-height: 38px;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 3px 9px;
  scrollbar-width: none;
}

.selection-bar > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

.selection-bar > .selection-spacer {
  flex: 1 1 auto;
}

.selection-bar > .selection-copy,
.selection-bar > .selection-title {
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
}
  border: 1px solid rgba(199, 160, 91, 0.14);
  border-radius: 8px;
  background: rgba(17, 24, 33, 0.74);
}

.selection-hint {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.selection-title {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.selection-copy {
  color: var(--ink-dim);
  font-size: 11px;
}

.selection-copy b {
  color: var(--ink);
}

.selection-spacer {
  flex: 1;
}

.action-btn {
  padding: 6px 10px;
  border: 1px solid rgba(199, 160, 91, 0.36);
  border-radius: 5px;
  color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.08);
  cursor: pointer;
  font-size: 11px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.action-btn:hover {
  border-color: var(--gold);
  background: rgba(199, 160, 91, 0.17);
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.action-btn.danger {
  color: var(--red-bright);
  border-color: rgba(182, 88, 77, 0.36);
  background: rgba(182, 88, 77, 0.08);
}

.summon-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.summon-option .mini-stat {
  color: var(--muted);
  font-size: 10px;
}

/* ---------------------------------------------------------
   侧栏
   --------------------------------------------------------- */
.side-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}

.inspect-panel {
  min-height: 168px;
  max-height: 340px;
  overflow-y: auto;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(199, 160, 91, 0.055), transparent 48%),
    rgba(18, 26, 35, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  scrollbar-color: rgba(199, 160, 91, 0.26) transparent;
  scrollbar-width: thin;
}

.inspect-empty {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.inspect-empty strong {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.gold-text {
  color: var(--gold-bright);
}

.mini-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-top: 3px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.12);
}

.mini-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-dim);
  font-size: 9px;
}

.legend-swatch {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #555;
}

.legend-swatch.player { background: var(--blue-bright); }
.legend-swatch.enemy { background: var(--red-bright); }
.legend-swatch.gold { background: var(--gold-bright); }
.legend-swatch.blue { background: #6aa8cf; }
.legend-swatch.red { background: #d98273; }

.deck-line {
  margin-top: 1px;
  color: rgba(199, 160, 91, 0.62);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.inspect-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.inspect-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.inspect-sub {
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.inspect-glyph {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--gold-bright);
  background: #141c25;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
}

.inspect-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 7px 0;
}

.stat-chip {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.16);
  font-size: 10px;
}

.stat-chip.atk {
  color: #e6aa8b;
  border-color: rgba(190, 106, 78, 0.28);
}

.stat-chip.hp {
  color: var(--green-bright);
  border-color: rgba(110, 155, 117, 0.28);
}

.inspect-desc {
  margin: 7px 0 0;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.55;
}

.inspect-note {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.log-panel {
  display: flex;
  min-height: 0;
  flex: 0 0 230px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 22, 30, 0.78);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: 0.14em;
}

.log-count {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid rgba(199, 160, 91, 0.22);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0;
}

.log-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 7px 9px 10px;
  scrollbar-color: rgba(199, 160, 91, 0.26) transparent;
  scrollbar-width: thin;
}

.log-entry {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px;
  padding: 3px 0 3px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  color: var(--ink-dim);
  font-size: 10.5px;
  line-height: 1.5;
}

.log-entry .log-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.log-entry[data-kind="damage"]::before,
.log-entry[data-kind="kill"]::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: rgba(201, 110, 95, 0.75);
}

.log-entry[data-kind="kill"]::before {
  background: rgba(231, 197, 126, 0.8);
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry .log-turn {
  color: rgba(199, 160, 91, 0.5);
  font-size: 9.5px;
  text-align: right;
}

.log-entry[data-kind="damage"] .log-text {
  color: #d99784;
}

.log-entry[data-kind="heal"] .log-text,
.log-entry[data-kind="buff"] .log-text {
  color: var(--green-bright);
}

.log-entry[data-kind="turn"] .log-text {
  color: var(--gold-bright);
  font-weight: 600;
}

.log-entry[data-kind="skill"] .log-text {
  color: #d8b9e6;
}

.log-entry[data-kind="deploy"] .log-text,
.log-entry[data-kind="summon"] .log-text {
  color: #aec9dc;
}

.log-entry[data-kind="kill"] .log-text {
  color: var(--red-bright);
  font-weight: 600;
}

/* ---------------------------------------------------------
   手牌
   --------------------------------------------------------- */
.hand-area {
  margin-top: 0;
  padding: 5px 12px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(199, 160, 91, 0.04), transparent 55%),
    rgba(15, 22, 30, 0.82);
  box-shadow: 0 13px 34px rgba(0, 0, 0, 0.2);
}

.hand-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.eyebrow {
  display: block;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.hand-head strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.hand-hint {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.hand {
  display: flex;
  min-height: 140px;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 3px 6px;
  scrollbar-color: rgba(199, 160, 91, 0.26) transparent;
  scrollbar-width: thin;
}

.hand-empty {
  display: flex;
  min-height: 132px;
  flex: 1;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(199, 160, 91, 0.2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.card {
  position: relative;
  display: flex;
  width: 132px;
  min-width: 132px;
  height: 144px;
  flex-direction: column;
  overflow: hidden;
  padding: 7px 8px 8px;
  border: 1px solid rgba(199, 160, 91, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 22%, rgba(199, 160, 91, 0.1), transparent 52%),
    linear-gradient(160deg, #26313d, #18212b 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 5px 12px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card:hover {
  border-color: rgba(231, 197, 126, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 10px 22px rgba(0, 0, 0, 0.32);
  transform: translateY(-5px);
}

.card.selected {
  border-color: var(--gold-bright);
  box-shadow:
    inset 0 0 0 1px rgba(231, 197, 126, 0.55),
    0 0 22px rgba(231, 197, 126, 0.18),
    0 10px 22px rgba(0, 0, 0, 0.3);
  transform: translateY(-8px);
}

.card.unaffordable {
  filter: saturate(0.6) brightness(0.7);
}

.card.unaffordable:hover {
  filter: saturate(0.75) brightness(0.82);
}

.card-cost {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(160, 211, 237, 0.55);
  border-radius: 50%;
  color: #e5f5ff;
  background: radial-gradient(circle at 35% 30%, #6099bd, #2e5671 70%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.card-sigil {
  position: relative;
  display: grid;
  place-items: center;
  height: 28px;
  flex: 0 0 auto;
  margin: 0 1px 2px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 50%, rgba(199, 160, 91, 0.1), transparent 64%),
    rgba(8, 13, 18, 0.24);
}

.card-sigil::before,
.card-sigil::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(199, 160, 91, 0.13);
  border-radius: 50%;
}

.card-sigil::before {
  width: 34px;
  height: 34px;
}

.card-sigil::after {
  width: 24px;
  height: 24px;
}

.card-sigil span {
  position: relative;
  z-index: 1;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1;
  text-shadow: 0 0 16px rgba(231, 197, 126, 0.18);
}

.card.barracks .card-sigil span {
  color: #e0c082;
}

.card.type-peasant .card-sigil span {
  color: #9fc7a2;
}

.card-name {
  position: relative;
  z-index: 1;
  overflow: hidden;
  flex: 0 0 auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-line {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  color: var(--gold);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.card-stats {
  color: var(--ink-dim);
  font-size: 9px;
  white-space: nowrap;
}

.card-stats .a {
  color: #e6aa8b;
}

.card-stats .h {
  color: var(--green-bright);
}

.card-desc {
  display: -webkit-box;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 40px;
  margin-top: 3px;
  color: rgba(233, 226, 211, 0.72);
  font-size: 9.5px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-level {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 4px;
  border: 1px solid rgba(231, 197, 126, 0.32);
  border-radius: 3px;
  color: var(--gold-bright);
  background: rgba(10, 15, 20, 0.58);
  font-size: 8px;
}

/* ---------------------------------------------------------
   弹层
   --------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 9, 13, 0.76);
  backdrop-filter: blur(7px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(680px, 100%);
  max-height: min(86vh, 880px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(199, 160, 91, 0.08), transparent 40%),
    #151e28;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  scrollbar-color: rgba(199, 160, 91, 0.28) transparent;
  scrollbar-width: thin;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(199, 160, 91, 0.22);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
}

/* 卡片图鉴 */
.codex-modal {
  display: flex;
  width: min(1180px, 100%);
  max-height: calc(100vh - 28px);
  flex-direction: column;
  overflow: hidden;
}

.codex-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-right: 26px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(199, 160, 91, 0.16);
}

.codex-head h2 {
  margin: 2px 0 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(24px, 2.5vw, 32px);
  letter-spacing: 0.12em;
}

.codex-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.codex-count {
  flex: none;
  padding: 5px 10px;
  border: 1px solid rgba(231, 197, 126, 0.3);
  border-radius: 7px;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 17px;
}

.codex-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 9px;
}

.codex-search {
  width: min(250px, 35vw);
  padding: 7px 10px;
  border: 1px solid rgba(199, 160, 91, 0.22);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
}

.codex-search:focus {
  border-color: rgba(231, 197, 126, 0.6);
}

.codex-search::placeholder {
  color: var(--muted);
}

.codex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.codex-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(199, 160, 91, 0.18);
  border-radius: 5px;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
  font-size: 10px;
}

.codex-filter b {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
}

.codex-filter:hover,
.codex-filter.active {
  border-color: rgba(231, 197, 126, 0.55);
  color: var(--gold-bright);
}

.codex-filter.active b {
  color: rgba(231, 197, 126, 0.7);
}

.codex-grid {
  display: grid;
  min-height: 0;
  overflow-y: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 2px 4px 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(199, 160, 91, 0.35) transparent;
}

.codex-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  gap: 5px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 2px solid rgba(199, 160, 91, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.035), transparent 48%),
    rgba(18, 27, 37, 0.88);
}

.codex-card.codex-hero {
  border-top-color: rgba(214, 181, 94, 0.8);
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 181, 94, 0.11), transparent 48%),
    rgba(18, 27, 37, 0.9);
}

.codex-card.codex-spell {
  border-top-color: rgba(150, 139, 196, 0.8);
}

.codex-card.codex-barracks {
  border-top-color: rgba(111, 159, 196, 0.8);
}

.codex-card.codex-unit {
  border-top-color: rgba(111, 158, 106, 0.8);
}

.codex-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.codex-cost {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  font-weight: 700;
}

.codex-type {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: var(--muted);
  font-size: 8.5px;
}

.codex-glyph {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(199, 160, 91, 0.28);
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.2);
  font-family: var(--font-display);
  font-size: 20px;
}

.codex-card h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.codex-stats {
  color: var(--gold);
  font-size: 9px;
  line-height: 1.4;
}

.codex-desc {
  margin: 1px 0 0;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.5;
}

.codex-extra {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.codex-foot {
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 8.5px;
}

.codex-empty {
  grid-column: 1 / -1;
  padding: 40px 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.primary-btn {
  padding: 9px 18px;
  border: 1px solid rgba(231, 197, 126, 0.6);
  border-radius: 6px;
  color: #22190d;
  background: linear-gradient(180deg, #e8c77f, #b88c45);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

/* ---------------------------------------------------------
   英雄选择
   --------------------------------------------------------- */
.hero-select-overlay {
  overflow-y: auto;
  align-items: start;
  padding-top: clamp(20px, 4vh, 52px);
  padding-bottom: 30px;
}

.hero-select-inner {
  width: min(1180px, 100%);
}

.hero-select-head {
  margin-bottom: 18px;
  text-align: center;
}

.hero-select-head h2 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.hero-select-head p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.6;
}

.hero-choices {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.hero-race {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.hero-race-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  padding: 0 1px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-race-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.hero-race-head em {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 8.5px;
  font-style: normal;
}

.hero-race-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-choices .hero-card {
  padding: 9px 9px 8px;
  border-radius: 9px;
}

.hero-choices .hero-card-top {
  gap: 8px;
  margin-bottom: 6px;
}

.hero-choices .hero-card-glyph {
  width: 36px;
  height: 36px;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.14), 0 0 14px var(--hero-glow, rgba(199, 160, 91, 0.1));
  font-size: 20px;
}

.hero-choices .hero-card h3 {
  font-size: 15px;
}

.hero-choices .hero-card .hero-card-title {
  font-size: 8px;
  letter-spacing: 0.1em;
}

.hero-choices .hero-card .hero-card-hp {
  margin-top: 2px;
  font-size: 8.5px;
}

.hero-choices .hero-blurb {
  display: -webkit-box;
  overflow: hidden;
  min-height: 27px;
  margin: 0 0 6px;
  font-size: 10px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-choices .hero-skill-list {
  gap: 3px;
  margin-bottom: 6px;
}

.hero-choices .hero-skill {
  grid-template-columns: 19px minmax(0, 1fr);
  gap: 5px;
  padding: 3px 5px;
  border-radius: 4px;
}

.hero-choices .hero-skill .skill-cost {
  width: 17px;
  height: 17px;
  font-size: 8px;
}

.hero-choices .hero-skill-name {
  font-size: 9px;
}

.hero-choices .hero-skill-desc {
  display: none;
}

.hero-choices .hero-pick {
  margin-top: auto;
  padding: 5px 6px;
  font-size: 10px;
}

.hero-card {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 18px 17px 16px;
  border: 1px solid rgba(199, 160, 91, 0.25);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, var(--hero-glow, rgba(199, 160, 91, 0.12)), transparent 48%),
    linear-gradient(160deg, #202a35, #151d26 72%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.hero-card:hover {
  border-color: var(--hero-color, var(--gold));
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-4px);
}

.hero-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}

.hero-card-glyph {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border: 1px solid var(--hero-color, var(--gold));
  border-radius: 50%;
  color: var(--hero-color, var(--gold-bright));
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.16), transparent 45%),
    #19222c;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.14), 0 0 22px var(--hero-glow, rgba(199, 160, 91, 0.1));
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
}

.hero-card h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.hero-card .hero-card-title {
  color: var(--hero-color, var(--gold));
  font-size: 10px;
  letter-spacing: 0.14em;
}

.hero-card .hero-card-hp {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.hero-blurb {
  display: -webkit-box;
  overflow: hidden;
  min-height: 34px;
  margin: 0 0 11px;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-skill-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.hero-skill {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.13);
}

.hero-skill .skill-cost {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(131, 182, 216, 0.4);
  border-radius: 50%;
  color: #cbe9fa;
  background: rgba(66, 112, 145, 0.32);
  font-size: 10px;
  font-weight: 800;
}

.hero-skill.ultimate .skill-cost {
  color: var(--gold-bright);
  border-color: rgba(231, 197, 126, 0.55);
  background: rgba(199, 160, 91, 0.15);
}

.hero-skill-name {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.hero-skill-name em {
  margin-left: 4px;
  color: var(--gold);
  font-size: 8px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.hero-skill-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.hero-pick {
  width: 100%;
  margin-top: auto;
}

.hero-select-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 10px;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rule-chips i {
  padding: 2px 6px;
  border: 1px solid rgba(199, 160, 91, 0.18);
  border-radius: 999px;
  color: var(--gold);
  font-style: normal;
}

/* 局外牌组构筑 */
.deck-select-inner {
  display: flex;
  width: min(1180px, 100%);
  max-height: calc(100vh - 28px);
  flex-direction: column;
  padding: 18px;
  border: 1px solid rgba(199, 160, 91, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgba(88, 145, 204, 0.14), transparent 42%),
    radial-gradient(circle at 88% 100%, rgba(182, 88, 77, 0.1), transparent 46%),
    linear-gradient(160deg, #1b2530, #0e151d 76%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.deck-select-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.deck-select-head h2 {
  margin: 2px 0 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  letter-spacing: 0.12em;
}

.deck-select-head p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.6;
}

.deck-total {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid rgba(231, 197, 126, 0.36);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.deck-total b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
}

.deck-total span {
  color: var(--muted);
  font-size: 10px;
}

.deck-rule {
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  word-break: break-word;
}

.pool-row.locked {
  opacity: 0.48;
}

.pool-row.locked .deck-plus {
  cursor: not-allowed;
}

.deck-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.8fr);
  gap: 12px;
}

.deck-pool-panel,
.deck-secondary-panel,
.deck-summary-panel,
.deck-start-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background: rgba(5, 11, 17, 0.34);
}

.deck-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}

.deck-summary-panel {
  flex: 1;
}

.deck-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(199, 160, 91, 0.14);
}

.deck-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.deck-panel-head span {
  color: var(--muted);
  font-size: 9.5px;
}

.deck-pool,
.deck-list {
  min-height: 0;
  overflow-y: auto;
  padding: 4px 3px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(199, 160, 91, 0.35) transparent;
}

.deck-pool {
  max-height: 54vh;
}

.deck-list {
  max-height: 25vh;
}

.pool-group {
  margin: 8px 0 2px;
}

.pool-group h4 {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.pool-row {
  display: grid;
  align-items: center;
  grid-template-columns: 26px minmax(0, 1fr) auto auto auto;
  gap: 7px;
  min-height: 38px;
  padding: 4px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.pool-row:hover {
  background: rgba(255, 255, 255, 0.028);
}

.pool-glyph {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(199, 160, 91, 0.25);
  border-radius: 5px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.2);
  font-family: var(--font-display);
  font-size: 14px;
}

.pool-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-name em {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  font-style: normal;
  text-overflow: ellipsis;
}

.pool-name .pool-desc {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.4;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pool-cost {
  min-width: 26px;
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.pool-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pool-count {
  min-width: 20px;
  color: var(--ink-dim);
  font-size: 10px;
  text-align: center;
}

.deck-plus,
.deck-minus {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(199, 160, 91, 0.24);
  border-radius: 4px;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.deck-plus:hover,
.deck-minus:hover {
  border-color: rgba(231, 197, 126, 0.55);
  color: var(--gold-bright);
}

.deck-plus:disabled,
.deck-minus:disabled {
  cursor: not-allowed;
  opacity: 0.25;
}

.deck-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 2px 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 10px;
}

.deck-row .name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-row .count {
  color: var(--gold);
  font-size: 9px;
}

.deck-row .deck-minus {
  width: 18px;
  height: 18px;
  font-size: 12px;
}

.deck-empty {
  padding: 20px 8px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.deck-start-panel p {
  margin: 2px 0 7px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.deck-barracks {
  display: grid;
  max-height: 190px;
  overflow-y: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding-right: 2px;
  scrollbar-width: thin;
}

.deck-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(199, 160, 91, 0.2);
  border-radius: 6px;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  font-size: 10px;
  text-align: left;
}

.deck-chip b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 13px;
}

.deck-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-chip.selected {
  border-color: rgba(231, 197, 126, 0.72);
  color: var(--ink);
  background: rgba(199, 160, 91, 0.16);
}

.deck-chip:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.deck-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.deck-actions .ghost-btn,
.deck-actions .primary-btn {
  flex: 1;
  padding: 7px 8px;
  font-size: 11px;
}

.deck-actions .primary-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.4;
}

.deck-warning {
  min-height: 14px;
  margin-top: 5px;
  color: var(--red-bright);
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
}

/* ---------------------------------------------------------
   技能弹层
   --------------------------------------------------------- */
.skill-modal {
  width: min(720px, 100%);
}

.skill-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.skill-head .hero-card-glyph {
  width: 66px;
  height: 66px;
}

.skill-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.08em;
}

.skill-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.skill-turn-note {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid rgba(199, 160, 91, 0.22);
  border-radius: 999px;
  color: var(--gold);
  font-size: 9px;
  white-space: nowrap;
}

.skill-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(131, 182, 216, 0.055), transparent 60%),
    rgba(0, 0, 0, 0.13);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.skill-option:hover:not(:disabled) {
  border-color: rgba(231, 197, 126, 0.55);
  background:
    linear-gradient(90deg, rgba(231, 197, 126, 0.09), transparent 60%),
    rgba(0, 0, 0, 0.18);
  transform: translateX(2px);
}

.skill-option:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.skill-option.ultimate {
  border-color: rgba(199, 160, 91, 0.26);
  background:
    linear-gradient(90deg, rgba(199, 160, 91, 0.09), transparent 65%),
    rgba(0, 0, 0, 0.15);
}

.skill-option-cost {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(131, 182, 216, 0.45);
  border-radius: 50%;
  color: #d6efff;
  background: radial-gradient(circle at 35% 30%, #5688aa, #29465e 70%);
  font-size: 15px;
  font-weight: 800;
}

.skill-option.ultimate .skill-option-cost {
  color: #241a0c;
  border-color: rgba(231, 197, 126, 0.65);
  background: radial-gradient(circle at 35% 30%, #efd294, #b68a42 70%);
}

.skill-option-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.skill-option-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.skill-option-state {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.skill-option-state.ready {
  color: var(--green-bright);
}

.skill-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

/* ---------------------------------------------------------
   规则
   --------------------------------------------------------- */
.rules-modal {
  width: min(900px, 100%);
}

.rules-head {
  margin-bottom: 15px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.rules-head h2 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.08em;
}

.rules-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rules-grid article {
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.12);
}

.rules-grid h3 {
  margin: 0 0 6px;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.05em;
}

.rules-grid p {
  margin: 0 0 6px;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.6;
}

.rules-grid p:last-child {
  margin-bottom: 0;
}

.rules-grid b {
  color: var(--ink);
}

.rules-grid code {
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--gold);
  background: rgba(199, 160, 91, 0.09);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.rules-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
}

/* ---------------------------------------------------------
   结算
   --------------------------------------------------------- */
.gameover-modal {
  width: min(560px, 100%);
  text-align: center;
}

.gameover-emblem {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 2px auto 12px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.14), transparent 48%),
    #1b2530;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
}

.gameover-modal.defeat .gameover-emblem {
  color: var(--red-bright);
  border-color: rgba(182, 88, 77, 0.6);
}

.gameover-modal h2 {
  margin: 0 0 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.15em;
}

.gameover-modal .gameover-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
}

.gameover-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 16px 0;
}

.gameover-stat {
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.13);
}

.gameover-stat b {
  display: block;
  color: var(--gold-bright);
  font-size: 18px;
  line-height: 1.2;
}

.gameover-stat span {
  color: var(--muted);
  font-size: 10.5px;
}

.gameover-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.secondary-btn {
  padding: 9px 16px;
  border: 1px solid rgba(199, 160, 91, 0.3);
  border-radius: 6px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.secondary-btn:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
}

/* ---------------------------------------------------------
   Toast
   --------------------------------------------------------- */
.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 100;
  max-width: min(520px, calc(100vw - 30px));
  padding: 9px 16px;
  border: 1px solid rgba(199, 160, 91, 0.42);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(20, 29, 39, 0.97);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  font-size: 11px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(182, 88, 77, 0.6);
  color: #f0c0b6;
}

/* ---------------------------------------------------------
   响应式
   --------------------------------------------------------- */
/* ---------------------------------------------------------
   v3：单牌组 / 杀戮尖塔式手牌 / 英雄 / 法术 / 王座 / 墓园
   --------------------------------------------------------- */
.hand-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.card.hero-type {
  border-color: rgba(214, 181, 94, 0.52);
  background:
    radial-gradient(circle at 50% 20%, rgba(214, 181, 94, 0.14), transparent 52%),
    linear-gradient(160deg, #2d303b, #191d27 72%);
}

.card.hero-type .card-sigil span {
  color: #efd18f;
}

.card.spell-type {
  border-color: rgba(150, 139, 196, 0.5);
  background:
    radial-gradient(circle at 50% 20%, rgba(150, 139, 196, 0.16), transparent 52%),
    linear-gradient(160deg, #292c3c, #171b26 72%);
}

.card.spell-type .card-sigil span {
  color: #c4b7ee;
}

.card.captain-type {
  border-color: rgba(199, 160, 91, 0.3);
}

.card-level {
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  font-size: 10px;
}

.skill-cost-inline {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 17px;
  padding: 0 3px;
  border: 1px solid rgba(131, 182, 216, 0.35);
  border-radius: 999px;
  color: #cbe9fa;
  background: rgba(66, 112, 145, 0.25);
  font-size: 8px;
  font-weight: 700;
}

.unit.kind-throne {
  border-color: rgba(231, 197, 126, 0.68);
  padding-bottom: 18px;
  background:
    radial-gradient(circle at 50% 22%, rgba(231, 197, 126, 0.2), transparent 52%),
    linear-gradient(160deg, #3b3b3c, #202126 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 0 20px rgba(199, 160, 91, 0.16);
}

.unit.kind-throne .glyph {
  color: rgba(231, 197, 126, 0.2);
  font-size: calc(var(--cell) * 0.74);
}

.unit.kind-throne .name {
  color: #f5e2b8;
  font-size: clamp(10px, calc(var(--cell) * 0.135), 12.5px);
  line-height: 1.2;
}

/* 王座血量：贴底细条 + 数字，不再和「王座」大字抢右上角 */
.unit.kind-throne .throne-foot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
}

.unit.kind-throne .throne-hp {
  position: relative;
  display: block;
  flex: 1 1 auto;
  height: 12px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(6, 12, 10, 0.6);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.unit.kind-throne .throne-hp > i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: block;
  background: linear-gradient(90deg, #4e7d59, #8fbd8a);
}

.unit.owner-1.kind-throne .throne-hp > i {
  background: linear-gradient(90deg, #7f3833, #c96e5f);
}

.unit.kind-throne .throne-hp > b {
  position: relative;
  z-index: 1;
  display: block;
  color: #eef6e9;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.unit.kind-throne .stat.atk {
  position: static;
  height: 12px;
  min-width: 14px;
  font-size: 8.5px;
}

.unit.kind-throne .sub {
  color: rgba(231, 197, 126, 0.7);
}

.log-entry[data-kind="grave"] .log-text {
  color: #d7b3e8;
}

.log-entry[data-kind="shuffle"] .log-text {
  color: #8fd0c5;
}

.log-entry[data-kind="spell"] .log-text {
  color: #c4b7ee;
}

.log-entry[data-kind="draw"] .log-text {
  color: #9cb6c8;
}

.graveyard-modal {
  width: min(860px, 100%);
}

.grave-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grave-section {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  padding: 13px;
  border: 1px solid rgba(199, 160, 91, 0.2);
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 0%, rgba(199, 160, 91, 0.06), transparent 50%),
    rgba(0, 0, 0, 0.13);
}

.grave-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.grave-section-head h3 {
  margin: 1px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.06em;
}

.grave-section-head h3 span {
  margin-left: 6px;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.grave-meta {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
  white-space: nowrap;
}

.grave-list {
  display: flex;
  max-height: 205px;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-color: rgba(199, 160, 91, 0.26) transparent;
  scrollbar-width: thin;
}

.grave-list.compact {
  max-height: none;
  margin: 7px 0;
  padding: 0;
}

.grave-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.018);
}

.grave-glyph {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid rgba(199, 160, 91, 0.25);
  border-radius: 4px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.18);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1;
}

.grave-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grave-name b {
  color: var(--gold-bright);
  font-weight: 600;
}

.grave-type {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.grave-empty {
  display: grid;
  min-height: 92px;
  flex: 1;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.grave-shuffle {
  width: 100%;
  margin-top: 9px;
  font-size: 11px;
}

.grave-shuffle:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8) brightness(0.62);
}

.grave-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
}

.grave-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  text-align: center;
}

/* 右侧行动面板：点选单位后的技能 / 召唤入口 */
.ability-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0;
}

.build-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.mulligan-modal {
  display: flex;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  flex-direction: column;
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(199, 160, 91, 0.3);
  border-radius: 14px;
  background: linear-gradient(160deg, #1b2530, #0e151d 76%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.mulligan-head h2 {
  margin: 2px 0 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.1em;
}

.mulligan-head p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.mulligan-section h3 {
  margin: 8px 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mulligan-hand {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.mulligan-card {
  display: flex;
  min-height: 104px;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mulligan-card:hover {
  border-color: rgba(231, 197, 126, 0.5);
}

.mulligan-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.mulligan-card-head b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mulligan-card-head em {
  flex: 0 0 auto;
  color: var(--gold-bright);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.mulligan-card-type {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.mulligan-card-desc {
  display: -webkit-box;
  overflow: hidden;
  flex: 1 1 auto;
  color: rgba(233, 226, 211, 0.72);
  font-size: 10px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.mulligan-card-action {
  margin-top: auto;
  color: var(--muted);
  font-size: 10px;
}

.mulligan-card.selected .mulligan-card-action {
  color: var(--gold-bright);
}

.mulligan-card.selected {
  border-color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.16);
  box-shadow: 0 0 0 1px rgba(231, 197, 126, 0.4);
}

.mulligan-barracks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.mulligan-barrack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
  font-size: 10px;
}

.mulligan-barrack-top {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mulligan-barrack-stat {
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mulligan-barrack-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 9.5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mulligan-barrack-name {
  flex: 0 0 auto;
  color: var(--ink);
}

.mulligan-barrack-count {
  color: var(--muted);
  font-size: 9px;
}

.mulligan-count {
  margin-top: 10px;
  color: var(--gold);
  font-size: 11px;
}

.mulligan-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.ability-btn {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(131, 182, 216, 0.055), transparent 60%),
    rgba(0, 0, 0, 0.14);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.ability-btn:hover:not(:disabled) {
  border-color: rgba(231, 197, 126, 0.5);
  background:
    linear-gradient(90deg, rgba(231, 197, 126, 0.09), transparent 60%),
    rgba(0, 0, 0, 0.18);
  transform: translateX(2px);
}

.ability-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.ability-btn.ultimate {
  border-color: rgba(199, 160, 91, 0.28);
  background:
    linear-gradient(90deg, rgba(199, 160, 91, 0.09), transparent 65%),
    rgba(0, 0, 0, 0.15);
}

.ability-cost {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(131, 182, 216, 0.42);
  border-radius: 50%;
  color: #d6efff;
  background: radial-gradient(circle at 35% 30%, #5688aa, #29465e 70%);
  font-size: 11px;
  font-weight: 800;
}

.ability-btn.ultimate .ability-cost {
  color: #241a0c;
  border-color: rgba(231, 197, 126, 0.6);
  background: radial-gradient(circle at 35% 30%, #efd294, #b68a42 70%);
}

.ability-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(199, 160, 91, 0.3);
  border-radius: 5px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.2);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
}

.ability-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.ability-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.ability-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ability-state {
  max-width: 72px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
  text-align: right;
}

.ability-state.ready {
  color: var(--green-bright);
}

.ability-btn.summon-ability {
  background:
    linear-gradient(90deg, rgba(199, 160, 91, 0.07), transparent 65%),
    rgba(0, 0, 0, 0.14);
}

.ability-btn.summon-ability .ability-name {
  color: var(--gold-bright);
  font-size: 12px;
}

@media (max-width: 1120px) {
  :root {
    --cell: clamp(48px, 6.2vh, 66px);
    --cell-h: clamp(38px, 5vh, 50px);
  }

  .game-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "play"
      "hand"
      "side";
  }

  .hud {
    min-height: 46px;
    padding: 3px 9px;
  }

  .hero-glyph {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .hero-name {
    font-size: 14px;
  }

  .card {
    height: 132px;
  }

  .hand {
    min-height: 140px;
  }

  .hand-empty {
    min-height: 130px;
  }

  .side-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: stretch;
  }

  .inspect-panel {
    min-height: 190px;
  }

  .log-panel {
    min-height: 190px;
  }
}

@media (max-height: 820px) {
  :root {
    --cell: clamp(50px, 6.2vh, 64px);
    --cell-h: clamp(42px, 5.6vh, 52px);
  }

  .topbar {
    min-height: 44px;
    margin-bottom: 6px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .brand-copy h1 {
    font-size: 19px;
  }

  .hud {
    min-height: 48px;
    gap: 10px;
    padding: 4px 10px;
  }

  .hero-glyph {
    width: 36px;
    height: 36px;
    font-size: 21px;
  }

  .hero-name {
    font-size: 14px;
  }

  .selection-bar {
    min-height: 34px;
    padding: 3px 9px;
  }

  .hand-area {
    padding: 6px 10px 6px;
  }

  .hand-head {
    margin-bottom: 3px;
  }

  .hand-head strong {
    font-size: 14px;
  }

  .hand {
    min-height: 132px;
    padding: 2px 2px 4px;
  }

  .card {
    height: 136px;
  }

  .card-sigil {
    height: 34px;
  }

  .card-name {
    font-size: 12px;
  }

  .card-desc {
    font-size: 8.5px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
  }

  .hand-empty {
    min-height: 124px;
  }

  .inspect-panel {
    max-height: 240px;
  }

  .log-panel {
    flex-basis: 170px;
  }
}

@media (max-width: 760px) {
  .app {
    width: calc(100vw - 18px);
  }

  .topbar {
    grid-template-columns: 1fr auto auto;
    gap: 6px;
  }

  .turn-pill {
    justify-self: end;
    min-width: 0;
    padding: 5px 9px;
    font-size: 10px;
  }

  .top-actions {
    display: flex;
    gap: 4px;
  }

  .ghost-btn {
    padding: 5px 7px;
    font-size: 11px;
  }

  .brand-copy p {
    display: none;
  }

  .board-wrap {
    overflow-x: auto;
  }

  .side-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-select-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .grave-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .grave-section {
    min-height: 0;
  }

  .selection-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .hand-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .hand-hint {
    text-align: left;
  }

  .hud {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .hud-meta {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 2px;
  }

  .player-hud .hud-meta {
    flex-wrap: wrap;
  }

  .end-turn-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .card {
    width: 108px;
    min-width: 108px;
  }

  .gameover-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .deck-select-inner {
    display: block;
    overflow-y: auto;
  }

  .deck-layout {
    display: block;
  }

  .deck-side {
    margin-top: 10px;
  }

  .deck-pool {
    max-height: 34vh;
  }

  .deck-list {
    max-height: 20vh;
  }

  .deck-barracks {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .deck-barracks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deck-select-inner {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  :root {
    --cell: clamp(42px, calc((100vw - 32px) / 7), 58px);
    --cell-h: 34px;
    --gap: 4px;
  }

  .unit .name {
    font-size: 8px;
  }

  .unit .stat {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .unit .level {
    font-size: 7px;
  }

  .board-wrap {
    padding: 6px;
  }

  .modal {
    padding: 18px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .codex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .codex-modal {
    padding: 16px 12px;
  }

  .codex-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .codex-search {
    width: 100%;
  }

  .codex-grid {
    grid-template-columns: 1fr;
  }

  .codex-card {
    min-height: 0;
  }
}

/* ---------------------------------------------------------
   兵营召唤 v4：士兵 / 队长两段式面板、随机队长、召唤池预览
   --------------------------------------------------------- */
.summon-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.mini-btn {
  padding: 2px 8px;
  border: 1px solid rgba(199, 160, 91, 0.32);
  border-radius: 5px;
  background: rgba(199, 160, 91, 0.08);
  color: var(--gold-bright);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.mini-btn:hover {
  border-color: var(--gold);
  background: rgba(199, 160, 91, 0.18);
}

.ability-btn.active {
  border-color: rgba(231, 197, 126, 0.62);
  background:
    linear-gradient(90deg, rgba(231, 197, 126, 0.14), transparent 65%),
    rgba(0, 0, 0, 0.2);
}

.summon-blocked {
  margin: 8px 0;
  padding: 7px 9px;
  border: 1px dashed rgba(199, 160, 91, 0.32);
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.06);
  font-size: 10px;
  line-height: 1.45;
}

.summon-roll {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 0 8px;
}

.summon-roll-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  gap: 2px;
  padding: 6px 6px 7px;
  border: 1px solid rgba(199, 160, 91, 0.3);
  border-radius: 7px;
  background:
    linear-gradient(160deg, rgba(199, 160, 91, 0.1), transparent 55%),
    rgba(0, 0, 0, 0.2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.summon-roll-card:hover {
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(231, 197, 126, 0.16);
  transform: translateY(-2px);
}

.roll-cost {
  align-self: flex-start;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(199, 160, 91, 0.18);
  color: var(--gold-bright);
  font-size: 9px;
  line-height: 15px;
}

.roll-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 1px 0 2px;
  border: 1px solid rgba(199, 160, 91, 0.34);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
}

.roll-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.roll-stats {
  color: var(--muted);
  font-size: 9px;
}

.roll-desc {
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.35;
}

.pool-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 6px 0 8px;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
}

.pool-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.pool-label {
  flex: 0 0 78px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.pool-label em {
  display: block;
  color: rgba(231, 197, 126, 0.62);
  font-size: 8px;
  font-style: normal;
}

.pool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.summon-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-size: 8.5px;
  line-height: 15px;
}

.summon-chip b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-weight: 700;
}

.summon-chip em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
}

/* 手牌已满时，只含抽牌效果的卡不可发动 */
.card.blocked {
  opacity: 0.46;
  filter: grayscale(0.55);
}

.card.blocked::after {
  content: "手牌已满";
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(140, 60, 52, 0.9);
  color: #ffe9e4;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.inspect-note.warn {
  color: var(--red-bright);
}

.codex-card.generated {
  border-style: dashed;
}

@media (max-width: 560px) {
  .summon-roll {
    grid-template-columns: 1fr;
  }

  .pool-line {
    flex-wrap: wrap;
  }
}

/* ---------------------------------------------------------
   种族：标签、筛选与构筑提示
   --------------------------------------------------------- */
.race-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  color: var(--race-color, var(--muted));
  background: rgba(0, 0, 0, 0.18);
  font-size: 9px;
  line-height: 15px;
  white-space: nowrap;
}

.race-tag.common {
  color: var(--muted);
}

.race-tag.home {
  box-shadow: inset 0 0 0 1px rgba(231, 197, 126, 0.32);
}

.race-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 10px;
}

.race-chip {
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.race-chip:hover {
  border-color: rgba(199, 160, 91, 0.45);
  color: var(--ink);
}

.race-chip.active {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.14);
}

.race-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.race-hint span {
  color: var(--muted);
}

.filter-divider {
  width: 1px;
  align-self: stretch;
  margin: 0 6px;
  background: rgba(255, 255, 255, 0.08);
}

.pool-row.home-race {
  background: linear-gradient(90deg, rgba(231, 197, 126, 0.07), transparent 70%);
}

@media (max-width: 1180px) {
  .hero-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .pool-row {
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
  }

  .pool-row .race-tag {
    display: none;
  }

  .hero-choices {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------
   双将 / 种族分组构筑
   --------------------------------------------------------- */
.deck-secondary-panel p {
  display: none;
}

.deck-secondary {
  display: flex;
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 4px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.secondary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
}

.secondary-chip b {
  font-family: var(--font-display);
  font-size: 11px;
}

.secondary-chip:hover {
  border-color: rgba(199, 160, 91, 0.45);
}

.secondary-chip.active {
  border-color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.14);
  box-shadow: inset 0 0 0 1px rgba(231, 197, 126, 0.25);
}

.pool-race {
  margin-bottom: 10px;
}

.pool-race-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pool-race-head h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.pool-race-head em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.pool-subgroup h5 {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.codex-race-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 6px;
  margin: 6px 0 -2px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
}

.codex-race-head b {
  margin-left: auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

/* ---------------------------------------------------------
   v3.37：节奏切换 / 加派 / 围攻 / 产费营校验
   --------------------------------------------------------- */
.ghost-btn.active {
  color: var(--gold-bright);
  border-color: var(--line-strong);
  background: rgba(58, 48, 24, 0.55);
}

.deck-rule.warn {
  color: var(--red-bright);
}

.badge.siege {
  color: #e8c37a;
  border-color: rgba(199, 160, 91, 0.5);
}

.boost-ability {
  margin-top: 6px;
  border-style: dashed;
}

.boost-ability .ability-name {
  color: var(--gold-bright);
}

/* ---------------------------------------------------------
   v4.0：爬塔入口、战斗页的爬塔标记
   --------------------------------------------------------- */
.turn-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.run-badge {
  padding: 1px 9px;
  border: 1px solid rgba(199, 160, 91, 0.32);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(199, 160, 91, 0.08);
  font-size: 10px;
  line-height: 16px;
  white-space: nowrap;
}

.run-badge span {
  margin-left: 6px;
  color: var(--muted);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.gameover-sub.run-note {
  margin-top: -4px;
  color: var(--gold-bright);
  font-size: 11.5px;
}

.setup-modal .mulligan-barracks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 52vh;
  overflow: auto;
}

.setup-barrack-card {
  width: 100%;
  text-align: left;
}

.setup-hint {
  margin-right: auto;
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}


.hand .card.spell-type {
  touch-action: none;
}

body.spell-dragging {
  cursor: grabbing;
  user-select: none;
}

.spell-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(199, 160, 91, 0.7);
  border-radius: 8px;
  background: rgba(18, 26, 35, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  font-size: 13px;
  transform: translate(0, 0);
}

.spell-drag-ghost b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

.spell-drag-ghost span {
  color: var(--muted);
}

.cell.spell-drag-hover {
  outline: 2px solid var(--gold-bright);
  outline-offset: -3px;
  box-shadow: inset 0 0 18px rgba(255, 214, 130, 0.35);
}

