/* ==========================================================================
   九州演武 · 初版界面
   ========================================================================== */

:root {
  --ink: #0a1013;
  --ink-2: #0f181c;
  --panel: #142127;
  --panel-2: #192a31;
  --panel-3: #20353d;
  --paper: #e9dfc7;
  --paper-2: #cfc0a0;
  --gold: #c9a227;
  --gold-2: #e8c766;
  --gold-soft: rgba(201, 162, 39, 0.16);
  --red: #b23a3a;
  --red-2: #d65a4a;
  --red-soft: rgba(178, 58, 58, 0.16);
  --teal: #2a9d8f;
  --purple: #7b5ea7;
  --blue: #4f7cac;
  --tactic-command: #d8b74a;
  --tactic-passive: #5aa9e6;
  --tactic-active-physical: #b23a48;
  --tactic-active-tactical: #7b4a9e;
  --tactic-pursuit-physical: #e0913a;
  --tactic-pursuit-tactical: #e88ab5;
  --text: #e8e2d3;
  --text-strong: #f6efdf;
  --muted: #94a3a2;
  --muted-2: #6f8080;
  --line: rgba(233, 223, 199, 0.12);
  --line-strong: rgba(233, 223, 199, 0.22);
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(42, 157, 143, 0.12), transparent 34rem),
    radial-gradient(circle at 86% 8%, rgba(178, 58, 58, 0.12), transparent 32rem),
    linear-gradient(180deg, #0c1519 0%, #0a1013 42%, #080d10 100%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(110px);
  opacity: 0.18;
}

.ambient-one {
  top: -20vw;
  left: -12vw;
  background: #1d6b61;
}

.ambient-two {
  right: -16vw;
  top: 10vh;
  background: #6d2a2a;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(rgba(255, 255, 255, 0.11) 0.5px, transparent 0.5px);
  background-size: 5px 5px;
  mix-blend-mode: soft-light;
}

/* ---------- 顶部导航 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 16, 19, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-seal {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(232, 199, 102, 0.72);
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(178, 58, 58, 0.92), rgba(122, 31, 31, 0.95));
  box-shadow: inset 0 0 0 3px rgba(10, 16, 19, 0.28), 0 5px 18px rgba(178, 58, 58, 0.2);
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.brand-text h1 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.brand-text p {
  margin: 1px 0 0;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.data-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted-2);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  line-height: 1.5;
}

.data-source::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.data-source.postgres {
  border-color: rgba(42, 157, 143, 0.32);
  background: rgba(42, 157, 143, 0.08);
  color: #78cbbd;
}

.data-source.static {
  border-color: rgba(201, 162, 39, 0.32);
  background: rgba(201, 162, 39, 0.06);
  color: var(--gold-2);
}

.data-source.loading {
  opacity: 0.7;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.top-link {
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- 通用按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.btn:hover {
  border-color: rgba(232, 199, 102, 0.48);
  background: rgba(232, 199, 102, 0.08);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  border-color: rgba(232, 199, 102, 0.75);
  background: linear-gradient(135deg, #e8c766 0%, #c9a227 55%, #a97d16 100%);
  box-shadow: 0 10px 28px rgba(201, 162, 39, 0.2);
  color: #181307;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #f0d782 0%, #d6b13a 55%, #b88b1e 100%);
  box-shadow: 0 14px 34px rgba(201, 162, 39, 0.28);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.028);
}

.btn.small {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 11px;
}

.icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-2);
}

/* ---------- 主布局 ---------- */

.app-shell {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.screen {
  animation: fade-in 420ms ease both;
}

.boot-error {
  max-width: 720px;
  margin: 80px auto;
  padding: 28px 30px;
  border: 1px solid rgba(214, 90, 74, 0.3);
  border-radius: 18px;
  background: rgba(30, 18, 20, 0.7);
}

.boot-error h2 {
  margin: 0 0 8px;
  color: #e68b7d;
  font-family: var(--serif);
  font-size: 26px;
}

.boot-error p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.boot-error code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 10px;
}

.empty-admin-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--gold-2);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 199, 102, 0.45);
}

.empty-admin-link:hover {
  color: #fff1c8;
}

.hero {
  max-width: 880px;
  margin: 16px auto 34px;
  text-align: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--gold-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.kicker-line {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.hero h2 {
  margin: 13px 0 10px;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.14;
}

.hero h2 em {
  color: var(--gold-2);
  font-style: normal;
  text-shadow: 0 0 45px rgba(232, 199, 102, 0.18);
}

.hero p {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 17px;
}

.hero-chips span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ---------- 编队区 ---------- */

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.team-panel {
  position: relative;
  min-width: 0;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%),
    linear-gradient(145deg, rgba(25, 42, 49, 0.95), rgba(16, 27, 32, 0.96));
  box-shadow: var(--shadow);
}

.team-panel::before {
  position: absolute;
  top: 0;
  right: 24px;
  left: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 199, 102, 0.65), transparent);
  content: "";
}

.enemy-panel::before {
  background: linear-gradient(90deg, transparent, rgba(214, 90, 74, 0.7), transparent);
}

.team-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--gold-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.23em;
}

.enemy-panel .eyebrow {
  color: #e78a7a;
}

.team-head h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.team-level {
  padding: 2px 7px;
  border: 1px solid rgba(232, 199, 102, 0.3);
  border-radius: 5px;
  color: var(--gold-2);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.team-level.enemy {
  border-color: rgba(214, 90, 74, 0.32);
  color: #e78a7a;
}

.troop-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 82px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.troop-box span {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.troop-box strong {
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.2;
}

.enemy-panel .troop-box strong {
  color: #e78a7a;
}

.troop-box small {
  color: var(--muted-2);
  font-size: 9px;
}

.formation {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

/* ---------- 编队位 ---------- */

.slot-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease;
}

.slot-card:hover {
  transform: translateY(-2px);
}

.slot-card.static {
  cursor: default;
}

.slot-card.static:hover {
  transform: none;
}

.slot-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(232, 199, 102, 0.08), rgba(232, 199, 102, 0.015));
}

.enemy-panel .slot-rail {
  background:
    linear-gradient(180deg, rgba(214, 90, 74, 0.09), rgba(214, 90, 74, 0.015));
}

.slot-rail .pos-name {
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
}

.enemy-panel .slot-rail .pos-name {
  color: #e78a7a;
}

.slot-rail .pos-index {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.unit-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-width: 0;
  min-height: 104px;
  padding: 12px 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.038), transparent 58%),
    rgba(9, 16, 19, 0.52);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.unit-card::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
  background: var(--unit-accent, var(--gold));
  opacity: 0.7;
  content: "";
}

.slot-card:hover .unit-card {
  border-color: rgba(232, 199, 102, 0.38);
  background:
    linear-gradient(135deg, rgba(232, 199, 102, 0.07), transparent 62%),
    rgba(9, 16, 19, 0.62);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.enemy-panel .slot-card:hover .unit-card {
  border-color: rgba(214, 90, 74, 0.4);
  background:
    linear-gradient(135deg, rgba(214, 90, 74, 0.07), transparent 62%),
    rgba(9, 16, 19, 0.62);
}

.unit-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--unit-accent, var(--gold)) 45%, transparent);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(145deg, color-mix(in srgb, var(--unit-accent, var(--gold)) 72%, #101a1e), #111c21);
  color: #f8f1df;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.unit-main {
  min-width: 0;
}

.unit-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.unit-title strong {
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-sub {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.badge.grade-S {
  border-color: rgba(232, 199, 102, 0.42);
  background: rgba(232, 199, 102, 0.08);
  color: var(--gold-2);
}

.badge.grade-A {
  border-color: rgba(42, 157, 143, 0.34);
  color: #73c6bb;
}

.badge.grade-B,
.badge.grade-C {
  color: var(--muted-2);
}

.unit-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: -0.01em;
}

.unit-stats b {
  color: var(--paper-2);
  font-weight: 500;
}

.unit-troop {
  margin-top: 7px;
}

.unit-troop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted-2);
  font-size: 8px;
}

.unit-troop-head b {
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 500;
}

.unit-troop-track {
  height: 5px;
  margin-top: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
}

.unit-troop-fill {
  height: 100%;
  background: linear-gradient(90deg, #718e4d, #a8bb63);
  transition: width 260ms ease;
}

.editor-troop {
  margin-top: 8px;
}

.unit-tactics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.tactic-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 1px 5px;
  overflow: hidden;
  border-left: 2px solid var(--tactic-color, var(--muted));
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--tactic-color, var(--muted));
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.tactic-pill.self {
  background: rgba(232, 199, 102, 0.06);
  color: var(--tactic-color, var(--paper-2));
}

.unit-edit {
  align-self: flex-start;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.slot-card:hover .unit-edit {
  color: var(--gold-2);
  opacity: 1;
}

.slot-card.empty .unit-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted-2);
}

.slot-card.empty .unit-card strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.slot-card.empty .unit-card span {
  font-size: 9px;
}

.team-foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.7;
}

.hint-dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(232, 199, 102, 0.5);
}

.hint-dot.enemy {
  background: var(--red-2);
  box-shadow: 0 0 8px rgba(214, 90, 74, 0.45);
}

/* ---------- 敌方预设 ---------- */

.preset-tabs {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.14);
}

.preset-tab {
  flex: 1;
  min-width: 0;
  padding: 6px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  opacity: 0.78;
  transition: background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.preset-tab span {
  display: block;
  margin-bottom: 1px;
  font-size: 8px;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.preset-tab:hover {
  color: var(--paper);
}

.preset-tab.active {
  background: rgba(178, 58, 58, 0.2);
  color: #f1b2a7;
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(214, 90, 74, 0.2);
}

/* ---------- 中间 VS 区 ---------- */

.versus-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 16px 4px;
}

.versus-line {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--line-strong));
}

.versus-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(232, 199, 102, 0.32);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(232, 199, 102, 0.14), transparent 52%),
    rgba(10, 16, 19, 0.75);
  box-shadow: 0 0 0 6px rgba(232, 199, 102, 0.025), 0 15px 40px rgba(0, 0, 0, 0.3);
}

.versus-seal span {
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
}

.versus-seal small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.35em;
}

.versus-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.versus-copy strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.versus-copy span {
  max-width: 150px;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.6;
}

.start-btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 64px;
  padding: 12px 10px;
  border-radius: 14px;
}

.start-btn span {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.start-btn small {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

.versus-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.versus-meta span {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted-2);
  font-size: 7.5px;
}

/* ---------- 编队备注 ---------- */

.setup-note {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.note-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.note-index {
  color: rgba(232, 199, 102, 0.4);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.2;
}

.note-card strong {
  display: block;
  color: var(--paper-2);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.note-card p {
  margin: 2px 0 0;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.7;
}

/* ==========================================================================
   战斗界面
   ========================================================================== */

.battle-screen {
  width: 100%;
}

@media (min-width: 981px) {
  .battle-screen {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 190px);
  }

  .battle-bottom {
    flex: 1;
    min-height: 0;
  }

  .log-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .battle-log {
    flex: 1;
    max-height: none;
    min-height: 220px;
  }
}

.battle-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(16, 27, 32, 0.84);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.battle-top > .btn {
  justify-self: start;
  width: max-content;
}

.round-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 170px;
}

.round-kicker {
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.24em;
}

.round-box strong {
  margin: 1px 0 5px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.08em;
}

.round-dots {
  display: flex;
  gap: 4px;
}

.round-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(232, 199, 102, 0.25);
  border-radius: 1px;
  transform: rotate(45deg);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.round-dots i.done {
  border-color: rgba(232, 199, 102, 0.55);
  background: rgba(232, 199, 102, 0.45);
}

.round-dots i.active {
  border-color: var(--gold-2);
  background: var(--gold-2);
  box-shadow: 0 0 10px rgba(232, 199, 102, 0.6);
}

.battle-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.speed-group {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.14);
}

.speed-btn {
  min-width: 27px;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  font-size: 9px;
  cursor: pointer;
}

.speed-btn.active {
  background: rgba(232, 199, 102, 0.16);
  color: var(--gold-2);
}

/* ---------- 战场 ---------- */

.battlefield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.field-side {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 199, 102, 0.045), transparent 55%),
    linear-gradient(160deg, rgba(25, 42, 49, 0.92), rgba(12, 21, 25, 0.96));
  box-shadow: var(--shadow);
}

.enemy-field {
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 90, 74, 0.05), transparent 55%),
    linear-gradient(160deg, rgba(40, 30, 31, 0.94), rgba(15, 20, 23, 0.97));
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.field-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.side-tag {
  padding: 2px 6px;
  border: 1px solid rgba(232, 199, 102, 0.3);
  border-radius: 4px;
  color: var(--gold-2);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.side-tag.enemy {
  border-color: rgba(214, 90, 74, 0.32);
  color: #e78a7a;
}

.field-head strong {
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-troops {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.field-units {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 11px;
}

/* ---------- 战斗单位卡 ---------- */

.battle-unit {
  position: relative;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--unit-accent, var(--gold));
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 58%),
    rgba(7, 13, 16, 0.52);
  transition: opacity 220ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.enemy-field .battle-unit {
  border-left-color: var(--unit-accent, var(--red-2));
}

.battle-unit.active {
  border-color: rgba(232, 199, 102, 0.62);
  box-shadow: 0 0 0 1px rgba(232, 199, 102, 0.16), 0 0 26px rgba(232, 199, 102, 0.14);
  transform: translateY(-1px);
}

.enemy-field .battle-unit.active {
  border-color: rgba(214, 90, 74, 0.65);
  box-shadow: 0 0 0 1px rgba(214, 90, 74, 0.16), 0 0 26px rgba(214, 90, 74, 0.12);
}

.battle-unit.dead {
  opacity: 0.34;
  filter: grayscale(0.75);
}

.battle-unit.dead::after {
  position: absolute;
  right: 10px;
  bottom: 5px;
  color: rgba(214, 90, 74, 0.7);
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  content: "溃";
  transform: rotate(-8deg);
}

.battle-unit.hit {
  animation: hit-shake 320ms ease;
}

.bu-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bu-pos {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.bu-name {
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bu-troop {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 8px;
}

.hp-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
}

.hp-label {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.hp-track {
  position: relative;
  flex: 1;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
}

.hp-fill {
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(90deg, #7c9d55, #b0c067);
  transition: width 260ms ease;
}

.hp-fill.mid {
  background: linear-gradient(90deg, #b58b36, #d4b35a);
}

.hp-fill.low {
  background: linear-gradient(90deg, #9a3434, #d25b4c);
}

.hp-text {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: -0.03em;
}

.bu-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-top: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
}

.bu-meta b {
  color: var(--paper-2);
  font-weight: 500;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 15px;
  margin-top: 5px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 8px;
  line-height: 1.45;
}

.status-chip.buff {
  border-color: rgba(42, 157, 143, 0.32);
  background: rgba(42, 157, 143, 0.08);
  color: #7ac9be;
}

.status-chip.debuff {
  border-color: rgba(214, 90, 74, 0.3);
  background: rgba(214, 90, 74, 0.08);
  color: #e4988c;
}

.status-chip.permanent {
  border-color: rgba(232, 199, 102, 0.28);
  background: rgba(232, 199, 102, 0.06);
  color: var(--gold-2);
}

.status-more {
  color: var(--muted-2);
  font-size: 7.5px;
}

.float-text {
  position: absolute;
  top: 7px;
  right: 10px;
  z-index: 3;
  color: #f0b0a4;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  animation: float-up 850ms ease-out both;
}

.float-text.heal {
  color: #7ad4a6;
}

.float-text.shield {
  color: var(--gold-2);
  font-size: 11px;
}

/* ---------- 战场中央 ---------- */

.field-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
}

.field-line {
  flex: 1;
  width: 1px;
  min-height: 30px;
  background: linear-gradient(180deg, transparent, rgba(232, 199, 102, 0.18), transparent);
}

.war-seal {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(232, 199, 102, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(232, 199, 102, 0.12), transparent 58%),
    rgba(10, 16, 19, 0.8);
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 23px;
  box-shadow: 0 0 0 5px rgba(232, 199, 102, 0.025);
}

.round-pulse {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
}

.round-pulse.pulse {
  animation: pulse-gold 500ms ease;
}

/* ---------- 战报 ---------- */

.battle-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 215px;
  gap: 14px;
  margin-top: 14px;
}

.log-panel {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 30%),
    rgba(15, 25, 30, 0.9);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.log-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.log-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.09em;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  width: 11px;
  height: 11px;
  accent-color: var(--gold);
}

.battle-log {
  max-height: 292px;
  padding: 7px 3px 1px 0;
  overflow-y: auto;
  scrollbar-color: rgba(232, 199, 102, 0.25) transparent;
  scrollbar-width: thin;
}

.battle-log::-webkit-scrollbar,
.roster-pane::-webkit-scrollbar,
.config-pane::-webkit-scrollbar {
  width: 5px;
}

.battle-log::-webkit-scrollbar-thumb,
.roster-pane::-webkit-scrollbar-thumb,
.config-pane::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(232, 199, 102, 0.22);
}

.log-line {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 6px;
  padding: 2.5px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.log-mark {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  text-align: center;
}

.log-line.damage {
  color: #d9c9ad;
}

.log-line.damage .log-mark {
  color: #d79282;
}

.log-line.heal {
  color: #9fceb0;
}

.log-line.heal .log-mark {
  color: #6fc196;
}

.log-line.status {
  color: #aebbb9;
}

.log-line.status .log-mark {
  color: #8aaba5;
}

.log-line.action {
  color: var(--paper);
}

.log-line.action .log-mark {
  color: var(--gold-2);
}

.log-line.death {
  color: #e6a195;
}

.log-line.death .log-mark {
  color: #d65a4a;
}

.log-line.result {
  color: var(--gold-2);
  font-weight: 600;
}

.log-line.result .log-mark {
  color: var(--gold-2);
}

.log-line.info,
.log-line.roll,
.log-line.order,
.log-line.system {
  color: var(--muted-2);
  font-size: 10px;
}

.log-line.roll {
  font-style: italic;
  opacity: 0.68;
}

.log-round {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0 6px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.log-round::before,
.log-round::after {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 199, 102, 0.2));
  content: "";
}

.log-round::after {
  background: linear-gradient(90deg, rgba(232, 199, 102, 0.2), transparent);
}

.battle-side-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 25, 30, 0.9);
}

.side-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(233, 223, 199, 0.08);
}

.side-stat span {
  color: var(--muted-2);
  font-size: 8px;
}

.side-stat strong {
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.tiny {
  margin: auto 0 0;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.7;
}

/* ==========================================================================
   结果层
   ========================================================================== */

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 10, 0.72);
  backdrop-filter: blur(8px);
}

.result-card {
  position: relative;
  width: min(540px, 100%);
  padding: 34px 34px 28px;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 102, 0.28);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 199, 102, 0.13), transparent 48%),
    linear-gradient(155deg, rgba(29, 47, 54, 0.98), rgba(12, 21, 25, 0.99));
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: result-in 380ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.result-card::before {
  position: absolute;
  top: 0;
  right: 30px;
  left: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  content: "";
}

.result-close {
  position: absolute;
  top: 13px;
  right: 13px;
}

.result-kicker {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.result-card h2 {
  margin: 5px 0 6px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
  text-shadow: 0 0 40px rgba(232, 199, 102, 0.18);
}

.result-card.loss h2 {
  color: #df7c6d;
  text-shadow: 0 0 40px rgba(214, 90, 74, 0.16);
}

.result-card.draw h2 {
  color: var(--paper-2);
}

.result-card > p {
  max-width: 380px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 21px 0 22px;
}

.result-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
  text-align: left;
}

.result-grid span {
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.result-grid strong {
  overflow: hidden;
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

/* ==========================================================================
   弹层 / 编成
   ========================================================================== */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal-root.open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 10, 0.76);
  backdrop-filter: blur(9px);
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, 100%);
  max-height: min(880px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(232, 199, 102, 0.22);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(28, 46, 53, 0.99), rgba(11, 19, 23, 0.99));
  box-shadow: 0 45px 120px rgba(0, 0, 0, 0.65);
  animation: modal-in 260ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.modal-card.help-card {
  width: min(780px, 100%);
}

body.modal-open {
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 19px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.08em;
}

.modal-head p {
  margin: 3px 0 0;
  color: var(--muted-2);
  font-size: 10px;
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(320px, 0.86fr);
  min-height: 0;
  overflow: hidden;
}

.roster-pane {
  min-width: 0;
  padding: 16px 18px 20px;
  overflow-y: auto;
}

.pane-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.pane-title strong {
  color: var(--paper-2);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.pane-title span {
  color: var(--muted-2);
  font-size: 8px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.roster-card {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.roster-card:hover:not(:disabled) {
  border-color: rgba(232, 199, 102, 0.4);
  background: rgba(232, 199, 102, 0.055);
  transform: translateY(-1px);
}

.roster-card.selected {
  border-color: rgba(232, 199, 102, 0.68);
  background:
    linear-gradient(135deg, rgba(232, 199, 102, 0.13), transparent 65%),
    rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(232, 199, 102, 0.08);
}

.roster-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.roster-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--unit-accent, var(--gold)) 42%, transparent);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(145deg, color-mix(in srgb, var(--unit-accent, var(--gold)) 66%, #111c21), #111c21);
  color: #f8f1df;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
}

.roster-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.roster-name strong {
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-name span {
  flex: 0 0 auto;
  color: var(--gold-2);
  font-family: var(--mono);
  font-size: 7px;
}

.roster-meta {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-adapt {
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.adapt-mini {
  min-width: 14px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 6.5px;
  text-align: center;
}

.adapt-mini.s {
  border-color: rgba(232, 199, 102, 0.36);
  color: var(--gold-2);
}

.adapt-mini.a {
  border-color: rgba(42, 157, 143, 0.3);
  color: #73c6bb;
}

.config-pane {
  min-width: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 25%),
    rgba(7, 13, 16, 0.32);
}

.config-general {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.config-general .roster-avatar {
  width: 44px;
  height: 44px;
  font-size: 19px;
}

.config-general h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.06em;
}

.config-general p {
  margin: 1px 0 0;
  color: var(--muted-2);
  font-size: 8.5px;
}

.config-quote {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 9.5px;
  font-style: italic;
  line-height: 1.6;
}

.config-block {
  margin-top: 13px;
}

.progress-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
}
.progress-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}
.progress-row select {
  min-width: 110px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--paper);
}
.progress-remaining {
  color: var(--gold);
  font-size: 10px;
}
.alloc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.alloc-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}
.alloc-grid input {
  width: 64px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--paper);
}
.star-badge {
  color: #e2b73c;
  letter-spacing: 1px;
}
.bu-star {
  margin-left: 5px;
  color: #e2b73c;
  font-size: 8px;
  letter-spacing: 0;
}
.tactic-pill .tactic-rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 3px;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  vertical-align: middle;
}
.tactic-pill .rating-S { background: rgba(201, 162, 39, 0.35); color: #ffe28a; }
.tactic-pill .rating-A { background: rgba(179, 92, 255, 0.3); color: #e0c2ff; }
.tactic-pill .rating-B { background: rgba(90, 169, 230, 0.3); color: #b9e2ff; }
.tactic-pill .rating-C { background: rgba(150, 150, 150, 0.25); color: #ccc; }

.config-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.config-label label,
.config-label strong {
  color: var(--paper-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.config-label span {
  color: var(--muted-2);
  font-size: 7.5px;
}

.config-select,
.config-block select {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #0d171b;
  color: var(--text);
  font-size: 10.5px;
  cursor: pointer;
  transition: border-color 160ms ease;
}

.config-select:focus,
.config-block select:focus {
  border-color: rgba(232, 199, 102, 0.52);
}

.config-block select option,
.config-block select optgroup {
  background: #0d171b;
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.stat-cell {
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}

.stat-cell span {
  display: block;
  color: var(--muted-2);
  font-size: 7px;
  letter-spacing: 0.06em;
}

.stat-cell strong {
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.config-self-tactic {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(232, 199, 102, 0.045);
}

.config-self-tactic span {
  flex: 0 0 auto;
  padding: 1px 4px;
  border: 1px solid rgba(232, 199, 102, 0.28);
  border-radius: 3px;
  color: var(--gold-2);
  font-size: 7px;
}

.config-self-tactic strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 500;
}

.config-self-tactic small {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 7px;
}

.preview-note {
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.7;
}

.config-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted-2);
  text-align: center;
}

.config-empty strong {
  margin-bottom: 3px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
}

.config-empty span {
  max-width: 220px;
  font-size: 9px;
  line-height: 1.7;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.modal-foot-note {
  color: var(--muted-2);
  font-size: 8px;
}

.modal-foot-actions {
  display: flex;
  gap: 7px;
}

.tactic-hint {
  margin: 5px 0 0;
  padding: 6px 8px;
  border-left: 2px solid rgba(232, 199, 102, 0.35);
  border-radius: 0 5px 5px 0;
  background: rgba(232, 199, 102, 0.04);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.tactic-hint span {
  display: block;
  margin-bottom: 1px;
  color: var(--gold-2);
  font-size: 7.5px;
  letter-spacing: 0.04em;
}

.tactic-hint.muted {
  color: var(--muted-2);
  font-style: italic;
}

.config-self-tactic {
  cursor: help;
}

.tactic-tooltip {
  position: fixed;
  z-index: 130;
  width: min(310px, calc(100vw - 20px));
  padding: 10px 12px;
  border: 1px solid rgba(232, 199, 102, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(150deg, rgba(29, 47, 54, 0.99), rgba(10, 18, 22, 0.99));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.tactic-tooltip.hidden {
  display: none;
}

.tt-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.tt-head strong {
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
}

.tt-type {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 7px;
  line-height: 1.6;
}

.tt-type.command { color: var(--tactic-command); }
.tt-type.passive { color: var(--tactic-passive); }
.tt-type.active,
.tt-type.active-support { color: var(--tactic-active-physical); }
.tt-type.active-physical { color: var(--tactic-active-physical); }
.tt-type.active-tactical { color: var(--tactic-active-tactical); }
.tt-type.pursuit,
.tt-type.pursuit-physical { color: var(--tactic-pursuit-physical); }
.tt-type.pursuit-tactical { color: var(--tactic-pursuit-tactical); }

.tt-chance {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7.5px;
}

.tactic-tooltip p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.7;
}

/* ---------- 战报统计 ---------- */

.modal-card.report-card {
  width: min(1120px, 100%);
  max-height: min(1040px, calc(100vh - 24px));
}

.report-body {
  flex: 1;
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.report-view-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 8px 20px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.report-series-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 10px 20px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.report-series-tab {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.report-series-tab:hover {
  color: var(--paper-2);
  border-color: rgba(232, 199, 102, 0.3);
}

.report-series-tab.active {
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(201, 162, 39, 0.1);
  color: var(--gold-2);
}

.report-view-tab {
  flex: 0 0 auto;
  padding: 7px 10px 6px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.report-view-tab:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--paper-2);
}

.report-view-tab.active {
  border-color: var(--line);
  background: rgba(201, 162, 39, 0.08);
  color: var(--gold-2);
}

.report-view[hidden] {
  display: none;
}

.report-round-view {
  padding-top: 2px;
}

.report-round-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.report-round-head strong {
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.report-round-head span {
  color: var(--muted-2);
  font-size: 9px;
}

.report-log {
  max-height: min(520px, 54vh);
  padding: 10px 14px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  scrollbar-color: rgba(232, 199, 102, 0.25) transparent;
  scrollbar-width: thin;
}

.report-log .log-line {
  font-size: 12px;
  line-height: 1.7;
}

.log-body {
  min-width: 0;
}

.log-detail {
  margin-top: 2px;
  padding-left: 1px;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.55;
}

.log-target {
  margin-top: 1px;
  color: rgba(226, 215, 192, 0.72);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  line-height: 1.55;
}

.tactic-log-name {
  font-weight: 500;
}

.log-detail span {
  display: block;
}

.damage-source {
  border-bottom: 1px dotted rgba(216, 183, 74, 0.5);
  cursor: help;
}

.log-detail b {
  color: var(--gold-2);
  font-weight: 600;
}

.report-log-empty {
  padding: 24px 0;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.report-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.report-overview > div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.report-overview span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.report-overview strong {
  display: block;
  overflow: hidden;
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-overview strong.win { color: var(--gold-2); }
.report-overview strong.loss { color: #e68b7d; }
.report-overview strong.draw { color: var(--muted); }

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.report-side {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-top: 2px solid rgba(232, 199, 102, 0.55);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 30%),
    rgba(8, 14, 17, 0.25);
}

.report-side.player {
  border-top-color: rgba(92, 196, 145, 0.72);
}

.report-side.enemy {
  border-top-color: rgba(214, 90, 74, 0.6);
}

.report-side.player .side-tag {
  border-color: rgba(92, 196, 145, 0.36);
  color: #7fd0a3;
}

.report-side.enemy .side-tag {
  border-color: rgba(214, 90, 74, 0.36);
  color: #e8897b;
}

.report-side.player .report-side-head strong,
.report-side.player .report-unit-head strong {
  color: #7fd0a3;
}

.report-side.enemy .report-side-head strong,
.report-side.enemy .report-unit-head strong {
  color: #e8897b;
}

.unit-name.player {
  color: #7fd0a3;
  font-weight: 600;
}

.unit-name.enemy {
  color: #e8897b;
  font-weight: 600;
}

.report-legend {
  display: inline-flex;
  gap: 8px;
  margin-left: 10px;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.report-legend b {
  font-weight: 500;
}

.report-legend b::before {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.report-legend .player {
  color: #7fd0a3;
}

.report-legend .enemy {
  color: #e8897b;
}

.report-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.report-side-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.report-side-head strong {
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-troops {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
}

.troop-bar-chart {
  margin: 9px 0 7px;
}

.report-unit .troop-bar-chart {
  margin: 7px 0 5px;
}

.troop-bar {
  display: flex;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.troop-bar-remaining {
  background: linear-gradient(90deg, #3f9d6c, #7fd0a3);
}

.troop-bar-wounded {
  background: linear-gradient(90deg, #9a7424, #e8c766);
}

.troop-bar-lost {
  background: linear-gradient(90deg, #59333a, #9c4b52);
}

.troop-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.troop-bar-legend b {
  color: var(--text);
  font-weight: 500;
}

.troop-bar-legend .wounded b {
  color: #e8c766;
}

.troop-bar-legend .total b {
  color: var(--text-strong);
}

.report-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 9px 0;
}

.report-totals > div {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
}

.report-totals span {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.report-totals b {
  display: block;
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.report-totals small {
  display: block;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-units {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.report-unit {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.report-unit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.report-unit-head strong {
  display: block;
  color: var(--text-strong);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
}

.report-unit-head span {
  display: block;
  color: var(--muted-2);
  font-size: 9px;
}

.report-unit-total {
  text-align: right;
}

.report-unit-total span {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
}

.report-unit-total b {
  color: var(--gold-2);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.report-table {
  margin-top: 5px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 32px 44px 40px;
  gap: 4px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(233, 223, 199, 0.07);
  color: var(--muted);
  font-size: 9.5px;
}

.report-row.report-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.report-row > span:not(:first-child) {
  font-family: var(--mono);
  text-align: right;
}

.report-row.report-normal {
  color: var(--paper-2);
}

.report-source {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.report-source > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-type {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 3px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 7.5px;
  line-height: 1.55;
}

.report-type.command { color: var(--tactic-command); }
.report-type.passive { color: var(--tactic-passive); }
.report-type.active,
.report-type.active-support { color: var(--tactic-active-physical); }
.report-type.active-physical { color: var(--tactic-active-physical); }
.report-type.active-tactical { color: var(--tactic-active-tactical); }
.report-type.pursuit,
.report-type.pursuit-physical { color: var(--tactic-pursuit-physical); }
.report-type.pursuit-tactical { color: var(--tactic-pursuit-tactical); }
.report-type.normal { color: var(--paper-2); }

.report-tactic-name {
  cursor: help;
  border-bottom: 1px dotted rgba(232, 199, 102, 0.35);
}

/* ---------- 帮助弹层 ---------- */

.help-body {
  flex: 1;
  min-height: 0;
  padding: 18px 24px 24px;
  overflow-y: auto;
}

.help-body h3 {
  margin: 16px 0 6px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.help-body h3:first-child {
  margin-top: 0;
}

.help-body p,
.help-body li {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.help-body ul {
  margin: 4px 0;
  padding-left: 17px;
}

.help-body li::marker {
  color: rgba(232, 199, 102, 0.5);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 7px 0;
}

.help-grid div {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
}

.help-grid strong {
  display: block;
  margin-bottom: 2px;
  color: var(--paper-2);
  font-size: 10.5px;
}

.help-grid span {
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.7;
}

.help-callout {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 2px solid rgba(232, 199, 102, 0.55);
  background: rgba(232, 199, 102, 0.05);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

/* ---------- 页脚 ---------- */

.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1500px, calc(100% - 36px));
  margin: auto auto 0;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

/* ---------- 动画 ---------- */

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(8px) scale(0.9); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-22px) scale(1.03); }
}

@keyframes hit-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@keyframes pulse-gold {
  0% { box-shadow: 0 0 0 0 rgba(232, 199, 102, 0.3); }
  100% { box-shadow: 0 0 0 10px rgba(232, 199, 102, 0); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .setup-grid {
    grid-template-columns: minmax(0, 1fr) 160px minmax(0, 1fr);
    gap: 14px;
  }

  .team-panel {
    padding: 17px;
  }

  .unit-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .unit-avatar {
    width: 42px;
    height: 42px;
    font-size: 19px;
  }

  .unit-edit {
    display: none;
  }

  .unit-stats {
    font-size: 8px;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .player-panel {
    order: 1;
  }

  .enemy-panel {
    order: 2;
  }

  .versus-column {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    order: 3;
    padding: 3px 10px;
  }

  .versus-line,
  .versus-copy {
    display: none;
  }

  .versus-seal {
    width: 48px;
    height: 48px;
  }

  .versus-seal span {
    font-size: 20px;
  }

  .start-btn {
    width: auto;
    min-width: 210px;
    min-height: 48px;
  }

  .start-btn small {
    display: none;
  }

  .versus-meta {
    display: none;
  }

  .battlefield {
    grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
  }

  .field-center {
    padding: 8px 0;
  }

  .war-seal {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .battle-bottom {
    grid-template-columns: 1fr;
  }

  .battle-side-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
  }

  .battle-side-panel .tiny {
    grid-column: 1 / -1;
    margin: 4px 0 0;
  }

  .side-stat {
    display: block;
    padding: 0;
    border: 0;
  }

  .side-stat span,
  .side-stat strong {
    display: block;
    text-align: left;
  }

  .modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .report-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .roster-pane {
    overflow: visible;
    border-bottom: 1px solid var(--line);
  }

  .config-pane {
    overflow: visible;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding: 9px 14px;
  }

  .versus-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 2px 10px 8px;
  }

  .versus-seal {
    align-self: center;
  }

  .start-btn {
    width: 100%;
    min-width: 0;
  }

  #random-player,
  #random-enemy {
    width: 100%;
  }

  .brand-seal {
    width: 37px;
    height: 37px;
    font-size: 21px;
  }

  .brand-text h1 {
    font-size: 17px;
  }

  .brand-text p {
    font-size: 8px;
  }

  .top-actions .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .app-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 20px;
  }

  .hero {
    margin: 4px auto 22px;
  }

  .hero h2 {
    font-size: 34px;
  }

  .hero p {
    font-size: 11.5px;
  }

  .hero-chips {
    gap: 4px;
  }

  .hero-chips span {
    font-size: 8px;
  }

  .team-head h3 {
    font-size: 20px;
  }

  .setup-note {
    grid-template-columns: 1fr;
  }

  .battle-top {
    grid-template-columns: 1fr auto;
    row-gap: 8px;
  }

  .round-box {
    grid-column: 1 / -1;
    grid-row: 1;
    order: -1;
  }

  .battle-actions {
    justify-content: flex-end;
  }

  .battlefield {
    grid-template-columns: 1fr;
  }

  .player-field {
    order: 3;
  }

  .field-center {
    flex-direction: row;
    padding: 2px 10px;
  }

  .field-line {
    flex: 1;
    width: auto;
    height: 1px;
    min-height: 0;
    background: linear-gradient(90deg, transparent, rgba(232, 199, 102, 0.18), transparent);
  }

  .field-line:last-child {
    display: none;
  }

  .round-pulse {
    writing-mode: horizontal-tb;
  }

  .enemy-field {
    order: 1;
  }

  .field-center {
    order: 2;
  }

  .battle-side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-root {
    padding: 8px;
  }

  .modal-card {
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .modal-card.report-card {
    max-height: calc(100vh - 16px);
  }

  .modal-head {
    padding: 14px 15px 11px;
  }

  .modal-head h2 {
    font-size: 20px;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-foot {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .report-body {
    padding: 12px;
  }

  .report-row {
    grid-template-columns: minmax(0, 1.5fr) 28px 40px 36px;
    font-size: 8px;
  }

  .report-totals b {
    font-size: 12px;
  }

  .modal-foot-note {
    width: 100%;
  }

  .modal-foot-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .result-card {
    padding: 28px 20px 22px;
  }

  .result-card h2 {
    font-size: 38px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    width: calc(100% - 20px);
  }
}

@media (max-width: 480px) {
  .hero h2 {
    font-size: 29px;
  }

  .team-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .slot-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .slot-rail {
    min-height: 96px;
  }

  .unit-card {
    grid-template-columns: 1fr;
    min-height: 96px;
    padding: 10px;
  }

  .unit-avatar {
    display: none;
  }

  .unit-title strong {
    font-size: 16px;
  }

  .unit-stats {
    gap: 2px 7px;
  }

  .roster-grid {
    grid-template-columns: 1fr;
  }

  .battle-actions {
    flex-wrap: wrap;
  }

  .round-box strong {
    font-size: 15px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
