@charset "UTF-8";

:root {
  color-scheme: dark;
  --ink: #edf0e8;
  --muted: #9faeaa;
  --faint: #758883;
  --page: #0c1717;
  --panel: #142321;
  --panel-raised: #1b2e29;
  --line: rgba(200, 217, 192, .13);
  --gold: #d9b779;
  --gold-light: #f0d49e;
  --copper: #ba7954;
  --human: #b45c4f;
  --enemy: #668fa3;
  --paper: #e8dfc7;
  --paper-ink: #272a24;
  --card-w: 64px;
  --card-h: 89px;
  --radius: 12px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 47% 0%, rgba(70, 100, 74, .2), transparent 58%),
    linear-gradient(120deg, rgba(215, 183, 121, .025) 25%, transparent 25%, transparent 75%, rgba(215, 183, 121, .025) 75%),
    #0c1717;
  background-size: auto, 12px 12px, auto;
  font-size: 14px;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, summary, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--gold-light); text-underline-offset: 3px; }
a:hover { color: #fff0d1; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
button:focus-visible, summary:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 4px;
}
[hidden] { display: none !important; }

.app { max-width: 1440px; margin: 0 auto; padding: 20px 28px 28px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 0 19px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { flex: 0 0 auto; color: var(--gold); }
.edition { color: var(--faint); font-family: "Segoe UI", Arial, sans-serif; font-size: 12px; vertical-align: middle; letter-spacing: .02em; }
.eyebrow { color: var(--gold); font-size: 10px; letter-spacing: .19em; text-transform: uppercase; font-weight: 600; }
.brand h1 { font-size: 36px; line-height: 1.08; letter-spacing: .025em; margin-top: 3px; }
.creator-credit { display:block; margin-top:5px; color:var(--muted); font-size:10px; line-height:1.35; letter-spacing:.015em; }
@media(max-width:680px) { .creator-credit { max-width:145px; font-size:8px; } }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 20px; align-items: start; }
.table {
  min-width: 0;
  position: relative;
  padding: 21px;
  border: 1px solid rgba(190, 205, 178, .17);
  border-radius: 15px;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(44, 76, 55, .44), transparent 78%),
    linear-gradient(150deg, rgba(255, 255, 255, .025), transparent 55%),
    #142722;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .2), inset 0 0 0 5px rgba(8, 20, 17, .2);
}
.intro { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding-bottom: 15px; }
.intro h2 { font-size: 24px; line-height: 1.25; }
.intro p { color: var(--muted); font-size: 12px; max-width: 390px; }
.score-strip { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 10px; margin-bottom: 19px; }
.conquest-mark { display: grid; place-items: center; color: var(--gold); font-size: 21px; opacity: .7; }
.player-score {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 67px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--human);
  border-radius: 7px;
  background: rgba(8, 18, 16, .34);
}
.player-score.enemy { border-left-color: var(--enemy); }
.player-score small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
.player-score h2 { font-size: 19px; line-height: 1.25; }
.garrison-count { margin-left: auto; color: var(--gold-light); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.garrison-count > b { display: block; font-family: Georgia, serif; font-size: 27px; font-weight: 400; line-height: 1; }
.garrison-count > b > span { font-family: "Segoe UI", sans-serif; color: var(--muted); font-size: 14px; }
.garrison-count small { color: var(--gold); font-size: 8px; text-align: right; margin-top: 3px; }
.wall-count { display: block; color: var(--muted); font-size: 10px; }
.player-score .stat { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.resource { color: var(--gold-light); font-variant-numeric: tabular-nums; }

.battlefield { position: relative; display: grid; gap: 16px; }
.army { position: relative; min-width: 0; padding: 0 0 4px; }
.army-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 25px; margin-bottom: 9px; }
.army-header h2, .army-header h3 { font-size: 18px; }
.army-header p, .army-header small { color: var(--muted); font-size: 11px; }
.army-header .deck-mark { flex: 0 0 9px; width: 9px; height: 15px; margin-right: -4px; border: none; border-radius: 0; background: var(--human); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.army.enemy .army-header .deck-mark { background: var(--enemy); }
.army-header > h2, .army-header > h3, .army-header > strong { margin-right: auto; }
.army-formation { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.castle-zone { grid-column: 2; grid-row: 1; }
.front-zone { grid-column: 1; grid-row: 1; min-width: 0; }
.castle, .frontline { display: flex; align-items: flex-start; justify-content: center; flex-wrap: nowrap; gap: 6px; position: relative; }
.castle { padding: 6px 8px 7px; border-radius: 5px; background: rgba(7, 14, 14, .23); border: 1px solid rgba(147, 165, 148, .14); }
.frontline { padding-top: 29px; }
.zone-label { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; margin-bottom: 7px; color: #9bad9c; font-size: 9px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.zone-label small { color: var(--faint); font-size: 9px; font-weight: 400; letter-spacing: .025em; text-transform: none; }
.card-wrap { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; position: relative; }
.card-wrap > .card { flex: none; }
.card {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  height: var(--card-h);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 7px;
  border: 1px solid #f2e9d3;
  border-radius: 5px;
  color: var(--paper-ink);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255,255,255,.6), transparent 68%),
    linear-gradient(140deg, #eee6d2, #d9cdb2);
  box-shadow: 0 3px 0 #b5a68a, 0 5px 9px rgba(0,0,0,.2);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  line-height: 1.1;
  user-select: none;
}
.card .rank { font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -.06em; }
.card .small-suit { display: none; }
.card .suit { position: absolute; right: 7px; top: 7px; font-family: Georgia, "Times New Roman", serif; font-size: 21px; line-height: 1; }
.card .role { width: 100%; display: block; margin-top: auto; padding-top: 5px; border-top: 1px solid rgba(67, 55, 34, .2); color: #454a3b; font-size: 8px; font-weight: 700; letter-spacing: .015em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .slot { display: block; margin-top: 3px; color: #6a6b57; font-size: 9px; line-height: 1.15; }
.card .bonus { position: absolute; top: 34px; right: 5px; color: #405a3e; font-size: 9px; font-weight: 700; line-height: 1.2; padding: 2px 3px; border-radius: 3px; background: rgba(70, 98, 63, .1); }
.known-mark { position: absolute; top: 35px; left: 6px; color: #54704c; font-size: 11px; line-height: 1; }
.card.red-suit .rank, .card.red-suit .suit { color: #a03f36; }
.card:hover:not(:disabled):not(.empty):not(.dead) { transform: translateY(-3px); box-shadow: 0 3px 0 #b5a68a, 0 8px 14px rgba(0,0,0,.3); }
.card:disabled { cursor: default; }
.card.selected { outline: 2px solid var(--gold-light); outline-offset: 3px; transform: translateY(-5px); box-shadow: 0 3px 0 #a88a53, 0 7px 21px rgba(215,183,121,.23); }
.card.eligible { border-color: var(--gold-light); box-shadow: 0 3px 0 #9c895f, 0 0 0 2px rgba(217,183,121,.26); }
.card.committed { outline: 2px solid #c58e60; outline-offset: 2px; }
.card.revealed { border-color: #e9d49f; }
.card.back {
  color: var(--gold);
  border-color: #667b81;
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(180,208,214,.07) 6px 7px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(180,208,214,.06) 6px 7px),
    linear-gradient(145deg, #2c4b59, #1d3440);
  box-shadow: 0 3px 0 #142b34, 0 5px 9px rgba(0,0,0,.2);
}
.army.human .card.back { border-color: #9c7367; background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(237,205,184,.07) 6px 7px), repeating-linear-gradient(-45deg, transparent 0 6px, rgba(237,205,184,.06) 6px 7px), linear-gradient(145deg, #774d43, #56362f); box-shadow: 0 3px 0 #442a25, 0 5px 9px rgba(0,0,0,.2); }
.card.back > * { visibility: hidden; }
.card.back::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(225,211,172,.37); border-radius: 2px; }
.card.back::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; color: #d3bd8b; font-size: 29px; text-shadow: 0 2px 0 rgba(0,0,0,.22); }
.card.empty { color: var(--faint); background: rgba(5, 16, 13, .2); border: 1px dashed rgba(173,192,164,.22); box-shadow: none; align-items: center; justify-content: center; text-align: center; cursor: default; }
.card.empty .role { border: 0; color: var(--faint); white-space: normal; margin-top: 0; font-weight: 400; }
.card.dead { opacity: .38; filter: grayscale(1); background: #7d8272; border-color: #929b85; box-shadow: none; cursor: default; }
.card.dead::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; color: #303a2e; font-size: 47px; font-weight: 300; }
.wall { display: block; position: relative; margin: 4px 0 7px; width: var(--card-w); min-height: 16px; padding: 3px 2px 1px; color: #bfc8b9; background: #3b4940; border: 1px solid #536153; border-radius: 0 0 3px 3px; text-align: center; font-size: 8px; font-weight: 700; line-height: 1.2; letter-spacing: .025em; }
.wall::before { content: ""; position: absolute; left: -1px; right: -1px; top: -5px; height: 5px; background: repeating-linear-gradient(90deg, #536153 0 8px, transparent 8px 13px); }
.wall.protected, .protected .wall { color: #d2ddc4; }
.wall.exposed, .exposed .wall { color: #c18d72; background: rgba(113,61,43,.23); border-color: #795640; }
.wall.exposed::before, .exposed .wall::before { background: repeating-linear-gradient(90deg, #795640 0 5px, transparent 5px 14px); height: 3px; top: -3px; }

.phase-panel { margin: 0; padding: 17px 18px; border: 1px solid rgba(217,183,121,.27); border-radius: 9px; background: linear-gradient(120deg, rgba(217,183,121,.065), transparent 70%), rgba(8,19,16,.4); }
.phase-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.step-count { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid rgba(217,183,121,.35); border-radius: 4px; color: var(--gold); font-size: 10px; font-weight: 600; line-height: 1.3; letter-spacing: .02em; }
.phase-panel h2 { font-size: 22px; line-height: 1.2; }
.phase-panel p { color: #bbc5b7; font-size: 12px; max-width: 710px; }
.phase-panel .actions { margin-top: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(205,220,192,.2);
  border-radius: 5px;
  background: #23382e;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.button:hover:not(:disabled) { background: #304838; border-color: rgba(217,183,121,.55); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { color: #241f15; border-color: #e2c58b; background: linear-gradient(#e0c38a, #c7a56b); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 2px 5px rgba(0,0,0,.15); }
.button.primary:hover:not(:disabled) { background: linear-gradient(#f0d9a7, #dbb97a); border-color: #f0d9a7; }
.button.secondary { background: #2a3c30; color: #e6e8da; }
.button.danger { color: #efc1aa; background: #4a2f28; border-color: #805541; }
.button.danger:hover:not(:disabled) { background: #624034; }
.button.ghost { background: transparent; border-color: var(--line); color: #b7c2b8; }
.button.ghost:hover:not(:disabled) { color: var(--ink); background: rgba(255,255,255,.04); }
.button:disabled { opacity: .42; box-shadow: none; }
.button.compact, .compact .button { min-height: 44px; font-size: 11px; padding: 8px 12px; }
.hint, .helper-text { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 9px; }
.hint strong, .helper-text strong { color: #d3d9c8; font-weight: 600; }
.badge, .chip, .status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid rgba(217,183,121,.25); border-radius: 4px; background: rgba(217,183,121,.06); color: #dac38e; font-size: 10px; line-height: 1.4; white-space: nowrap; }
.chip { color: #b8c9bb; border-color: var(--line); background: rgba(195,215,185,.05); }
.status-pill { border-radius: 99px; }
.muted { color: var(--muted); }
.deck-mark { width: 7px; height: 11px; display: inline-block; border-radius: 1px; background: var(--human); border: 1px solid rgba(255,255,255,.15); }
.deck-mark.enemy { background: var(--enemy); }
.army.enemy .deck-mark { background: var(--enemy); }
.setup-hand { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 9px; padding: 18px 0 9px; }
.setup-hand .card { --card-w: 67px; --card-h: 93px; }
.empty-state { color: var(--muted); text-align: center; padding: 24px 12px; border: 1px dashed var(--line); border-radius: 7px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.choice-grid { margin-top: 12px; }
.choice-grid > div { padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: rgba(0,0,0,.09); font-size: 11px; }
.choice-grid b { display: block; color: #d7dec9; font-weight: 600; margin-bottom: 3px; }
.choice-grid span { display: block; color: var(--muted); line-height: 1.4; }
.battle-banner { padding: 9px 13px; border: 1px solid rgba(217,183,121,.25); border-radius: 6px; color: var(--gold-light); background: rgba(217,183,121,.06); font-family: Georgia, "Times New Roman", serif; text-align: center; }

.duel-preview { display: flex; justify-content: center; align-items: center; gap: 25px; padding: 17px 8px; margin-top: 12px; border-top: 1px solid var(--line); }
.duelist { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.duelist > p, .duelist > small { font-size: 11px; color: var(--muted); text-align: center; }
.duelist > span { color: #a3b49f; font-size: 10px; text-align: center; }
.duelist > strong { color: var(--gold-light); font-size: 17px; font-variant-numeric: tabular-nums; }
.duelist > strong small { color: #8b9f8d; font-family: "Segoe UI", Arial, sans-serif; font-size: 9px; font-weight: 400; }
.duel-card { display: flex; gap: 6px; align-items: center; justify-content: center; }
.duel-item { display: grid; justify-items: center; gap: 6px; }
.duel-item > small { color: var(--muted); font-size: 9px; }
.duel-card .card { --card-w: 72px; --card-h: 99px; }
.duel-card .card-placeholder { display: grid; place-items: center; width: 72px; height: 99px; border: 1px dashed var(--line); border-radius: 5px; color: var(--faint); }
.card.troop-0.back { border-color: #9c7367; background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(237,205,184,.07) 6px 7px), linear-gradient(145deg, #774d43, #56362f); }
.card.turning { animation: card-turn .45s ease both; }
.card.leaving { outline: 2px solid var(--copper); outline-offset: 2px; }
.army:has(.leaving) { padding-bottom: 25px; }
.card .loss-mark { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 110px; padding: 3px 5px; color: #f2ceb5; background: #4a2f28; border: 1px solid #805541; border-radius: 3px; font-size: 8px; line-height: 1.2; text-align: center; }
.card.back .loss-mark { visibility: visible; }
.duel-card:has(.leaving) { margin-bottom: 25px; }
.reveal-progress { position: relative; overflow: hidden; min-width: 180px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 5px; color: var(--gold-light); font-size: 11px; }
.reveal-progress i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--gold); transform-origin: left; animation: reveal-time 3s linear both; }
@keyframes card-turn { from { transform: scaleX(.04); opacity: .5; } to { transform: scaleX(1); opacity: 1; } }
@keyframes reveal-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.duel-preview .versus, .duel-preview > span { color: var(--faint); font-family: Georgia, "Times New Roman", serif; font-size: 18px; }

.sidebar { display: grid; gap: 13px; min-width: 0; }
.sidebar > section, .sidebar > details, .ledger { padding: 17px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(150deg, rgba(255,255,255,.02), transparent), #14221e; }
.sidebar h2 { font-size: 19px; margin-bottom: 11px; }
.sidebar h3 { font-size: 16px; margin-bottom: 9px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.section-heading .resource { font-size: 18px; }
.text-button { min-height: 44px; padding: 6px 7px; border: 1px solid transparent; border-radius: 4px; color: var(--gold); background: transparent; font-size: 10px; }
.text-button:hover { color: var(--gold-light); border-color: var(--line); background: rgba(217,183,121,.045); }
.sidebar p { color: var(--muted); font-size: 12px; }
.ledger { position: relative; border-color: rgba(217,183,121,.25); background: linear-gradient(145deg, rgba(217,183,121,.05), transparent), #19271f; }
.ledger .pot, .ledger .pot-amount, .ledger .amount { display: block; color: var(--gold-light); font-family: Georgia, "Times New Roman", serif; font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ledger small { color: var(--muted); font-size: 11px; }
.ledger .rule-row { margin-top: 8px; }
.ledger h2 { font-size: 22px; line-height: 1.25; }
.ledger-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.ledger-line strong { color: var(--gold-light); font-weight: 500; font-size: 19px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ledger-line + .ledger-line strong { color: #c8d2bb; font-size: 14px; }
.log-list { display: grid; gap: 0; list-style: none; padding: 0; margin: 0; max-height: 245px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4c614b transparent; }
.log-entry { padding: 9px 0; color: #aebcaf; border-bottom: 1px solid rgba(195,211,182,.08); font-size: 11px; line-height: 1.5; }
.log-entry:first-child { padding-top: 0; color: #d5ddcc; }
.log-entry:last-child { padding-bottom: 0; border-bottom: none; }
.log-entry strong { color: var(--gold); font-weight: 600; }
.rule-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; color: #b5c2b2; font-size: 11px; border-bottom: 1px solid rgba(195,211,182,.07); }
.rule-row:last-child { border-bottom: none; }
.rule-key { flex: 0 0 auto; color: var(--gold); font-size: 11px; font-weight: 600; }
.rule-row > span:last-child { text-align: right; }
.quick-rules > .eyebrow { display: block; margin-bottom: 8px; }
.rule-row b { color: #d5c494; font-weight: 500; }
.seed-label { margin: 0; padding: 0 3px; color: #8b9d8c; font-size: 10px; line-height: 1.6; }
.strength-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 11px; }
.strength-strip > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 5px; color: #bbc8b3; font-size: 11px; }
.strength-strip b { color: var(--gold-light); font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 400; line-height: 1; }
.result-notes { margin-top: 9px; }
.result-notes p { padding: 3px 0; color: #b2c0aa; font-size: 11px; }
details summary { cursor: pointer; color: #d5ddcb; font-weight: 600; font-size: 12px; list-style-position: outside; margin-left: 12px; }
details[open] summary { margin-bottom: 12px; }
.footer-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; margin-top: 17px; color: #80958a; font-size: 10px; line-height: 1.55; }
.footer-note a { color: #b6bfa6; }

dialog { max-height: min(88vh, 850px); }
dialog.modal, .modal { width: min(820px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid #657155; border-radius: 12px; color: var(--ink); background: #17271f; box-shadow: 0 30px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(3,11,9,.79); backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.08); }
.modal-head h2 { font-size: 26px; }
.close { display: grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: #c2cdbb; font-size: 25px; line-height: 1; }
.close:hover { color: var(--gold-light); background: rgba(255,255,255,.05); }
.rules-content { padding: 22px 24px 26px; color: #c2cdbb; font-size: 13px; line-height: 1.65; }
.rules-content h3 { font-size: 21px; color: var(--gold-light); margin-top: 24px; margin-bottom: 8px; }
.rules-content h3:first-child { margin-top: 0; }
.rules-content p + p { margin-top: 9px; }
.rules-content ul, .rules-content ol { padding-left: 20px; margin: 9px 0 13px; }
.rules-content li { margin: 5px 0; }
.rules-content strong { color: #e5e8da; }
.rules-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.rules-content th { text-align: left; color: var(--gold); font-weight: 600; }
.rules-content td, .rules-content th { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rules-content .lead { color: #dce2cf; font-size: 15px; }
.rules-content .rule-row { display: grid; grid-template-columns: minmax(150px, .4fr) 1fr; gap: 16px; padding: 8px 0; font-size: 12px; line-height: 1.5; }
.rules-content .rule-row span { text-align: left; }
.modal.compact { max-width: 510px; }
#new-form { padding: 20px 24px 24px; }
#new-form p { color: var(--muted); font-size: 12px; }
#new-form label { display: block; margin: 18px 0 6px; font-size: 12px; }
#new-form input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #586749; border-radius: 5px; color: #f1ead6; background: #0f1e17; font-size: 16px; }
#new-form input::placeholder { color: #81927d; opacity: 1; font-size: 13px; }
#new-form .actions { margin-top: 17px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px)); padding: 11px 18px; border: 1px solid #9d8e64; border-radius: 7px; color: #f1e2bc; background: #28392b; box-shadow: 0 8px 30px rgba(0,0,0,.35); font-size: 12px; text-align: center; }

@media (min-width: 1380px) {
  :root { --card-w: 69px; --card-h: 95px; }
  .table { padding: 24px; }
  .army-formation { gap: 27px; }
  .castle, .frontline { gap: 7px; }
  .card .role { font-size: 8.5px; }
}

@media (max-width: 1110px) {
  .app { max-width: 1030px; padding: 18px 22px 24px; }
  .game-layout { grid-template-columns: 1fr; gap: 16px; }
  .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .sidebar > :only-child { grid-column: 1 / -1; }
  .log-list { max-height: 180px; }
  .intro p { max-width: 420px; }
}

@media (max-width: 840px) {
  :root { --card-w: 57px; --card-h: 82px; }
  .app { padding: 15px 14px 22px; }
  .masthead { gap: 12px; padding-bottom: 15px; }
  .brand h1 { font-size: 31px; }
  .eyebrow { font-size: 9px; letter-spacing: .13em; }
  .top-actions { gap: 5px; }
  .top-actions .button { font-size: 11px; padding: 7px 9px; min-height: 44px; }
  .table { padding: 15px; }
  .intro { display: block; padding-bottom: 13px; }
  .intro h2 { font-size: 22px; }
  .intro p { margin-top: 4px; max-width: none; }
  .army-formation { grid-template-columns: 1fr; gap: 10px; }
  .castle-zone { grid-column: 1; grid-row: 1; justify-self: center; }
  .front-zone { grid-column: 1; grid-row: 2; }
  .army.human .castle-zone { grid-row: 2; }
  .army.human .front-zone { grid-row: 1; }
  .army-header { min-height: 23px; }
  .army-header h2, .army-header h3 { font-size: 17px; }
  .battlefield { gap: 17px; }
  .castle { padding: 6px 8px; }
  .frontline { padding-top: 0; }
  .score-strip { gap: 8px; margin-bottom: 14px; }
  .player-score { padding: 9px 10px; gap: 8px; min-height: 61px; flex-wrap: wrap; }
  .player-score h2 { font-size: 17px; }
  .garrison-count > b { font-size: 24px; }
  .player-score .stat { width: 100%; text-align: left; font-size: 10px; }
  .phase-panel { padding: 14px; }
  .phase-panel h2 { font-size: 20px; }
  .sidebar { grid-template-columns: 1fr 1fr; }
  .sidebar > :first-child { grid-column: 1 / -1; }
  .sidebar > section, .sidebar > details, .ledger { padding: 14px; }
  .duel-preview { gap: 17px; }
}

@media (max-width: 520px) {
  :root { --card-w: clamp(37px, calc((100vw - 62px) / 7 - 4px), 49px); --card-h: calc(var(--card-w) * 1.45 + 6px); }
  body { font-size: 13px; }
  .app { padding: 12px 10px 20px; }
  .masthead { align-items: center; gap: 9px; }
  .brand { gap: 7px; }
  .brand-mark { width: 26px; height: 34px; }
  .brand h1 { font-size: 25px; }
  .brand .eyebrow { font-size: 7px; max-width: 150px; }
  .edition { font-size: 9px; }
  .top-actions { max-width: 164px; flex-wrap: nowrap; }
  .top-actions .button { font-size: 9px; padding: 7px 6px; min-height: 44px; }
  .table { padding: 12px 10px 14px; border-radius: 10px; }
  .intro h2 { font-size: 21px; }
  .intro p { font-size: 11px; line-height: 1.45; }
  .player-score { padding: 8px; gap: 5px; }
  .player-score h2 { font-size: 16px; }
  .player-score small { font-size: 8px; }
  .garrison-count > b { font-size: 21px; }
  .garrison-count > b > span { font-size: 11px; }
  .garrison-count small { font-size: 7px; }
  .score-strip { grid-template-columns: 1fr 16px 1fr; gap: 4px; }
  .conquest-mark { font-size: 17px; }
  .castle, .frontline { gap: 4px; }
  .army-header { gap: 8px; }
  .army-header small, .army-header p { font-size: 10px; }
  .card { padding: 5px 4px; border-radius: 4px; }
  .card .rank { font-size: 19px; }
  .card .suit { font-size: 17px; right: 4px; top: 5px; }
  .card .role { font-size: 6.8px; padding-top: 4px; letter-spacing: -.025em; }
  .card .slot { font-size: 7px; margin-top: 2px; }
  .card .bonus { top: 27px; right: 3px; padding: 1px 2px; font-size: 8px; }
  .known-mark { top: 27px; left: 4px; font-size: 9px; }
  .card.back::before { inset: 4px; }
  .card.back::after { font-size: 23px; }
  .wall { font-size: 7px; min-height: 14px; margin: 4px 0 6px; padding-top: 3px; }
  .setup-hand { gap: 8px 7px; padding-top: 14px; }
  .setup-hand .card { --card-w: 47px; --card-h: 73px; }
  .setup-hand .card .role { font-size: 7px; }
  .phase-panel { padding: 12px; }
  .phase-top { gap: 9px; }
  .phase-panel h2 { font-size: 19px; }
  .phase-panel p { font-size: 11px; }
  .step-count { min-height: 23px; font-size: 9px; padding: 3px 7px; }
  .actions { gap: 6px; }
  .actions .button { min-height: 44px; padding: 9px 10px; font-size: 11px; flex-grow: 1; }
  .sidebar { grid-template-columns: 1fr; gap: 10px; }
  .sidebar > :first-child { grid-column: auto; }
  .sidebar h2 { font-size: 18px; }
  .duel-preview { gap: 12px; padding: 13px 0; }
  .duel-card { gap: 4px; }
  .duel-card .card { --card-w: 52px; --card-h: 79px; }
  .duel-card .card-placeholder { width: 52px; height: 79px; }
  .duelist { min-width: 0; }
  .duelist > strong { font-size: 13px; }
  .duelist > span { max-width: 132px; }
  .duel-item > small { font-size: 8px; }
  .duel-card .loss-mark { max-width: 60px; font-size: 7px; }
  .duelist > p, .duelist > small { font-size: 10px; }
  .modal-head { padding: 16px; }
  .modal-head h2 { font-size: 23px; }
  .rules-content { padding: 17px; font-size: 12px; }
  .rules-content h3 { font-size: 19px; }
  .rules-content table { font-size: 11px; }
  .rules-content td, .rules-content th { padding: 6px 4px; }
  .rules-content .rule-row { grid-template-columns: 1fr; gap: 3px; font-size: 11px; }
  .rules-content .lead { font-size: 13px; }
  #new-form { padding: 17px; }
  .strength-strip { gap: 6px; }
  .strength-strip > span { padding: 8px; font-size: 10px; }
  .choice-grid { grid-template-columns: 1fr; gap: 6px; }
  .toast { bottom: 14px; padding: 10px 13px; font-size: 11px; }
}

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