:root {
  --bg: #07090e;
  --bg-elevated: #10151d;
  --bg-panel: rgba(10, 16, 24, 0.88);
  --bg-subtle: #161d28;
  --fg: #e8eef4;
  --fg-muted: #9aa7b5;
  --fg-subtle: #6d7b8a;
  --border: color-mix(in oklab, var(--fg) 12%, transparent);
  --border-strong: color-mix(in oklab, var(--fg) 22%, transparent);
  --accent: #7ec8e3;
  --accent-dim: color-mix(in oklab, var(--accent) 18%, transparent);
  --accent-fg: #071018;
  --ok: #7dba8a;
  --warn: #c9a46a;
  --danger: #c57a72;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --font-display: "Barlow Condensed", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --motion-quick: 150ms;
  --motion-fast: 250ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: hidden; }
html {
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
}
button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }

.app {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(7,9,14,0.55), rgba(7,9,14,0.82)),
    url("/img/hangar.jpg") center / cover no-repeat;
}

.hidden { display: none !important; }

/* Login */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--space-5);
}
.login-card {
  width: min(420px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(10px);
}
.login-card .brand {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-3);
}
.login-card .brand img {
  height: 96px;
  width: auto;
  object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 46%, transparent 80%);
  mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 46%, transparent 80%);
}
.login-card h1 { font-size: 2.2rem; margin-bottom: var(--space-2); }
.login-card p { color: var(--fg-muted); margin: 0 0 var(--space-5); }
label { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-subtle); margin: 0 0 var(--space-2); }
input {
  width: 100%;
  height: 44px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-4);
}
input:focus { outline: 2px solid color-mix(in oklab, var(--accent) 50%, transparent); border-color: var(--accent); }
.btn {
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-4);
  background: var(--bg-subtle);
  color: var(--fg);
  font-weight: 600;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  width: 100%;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.98); }
.error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; margin: 0 0 var(--space-3); }
.hint { font-size: 0.8rem; color: var(--fg-subtle); margin-top: var(--space-3); }

/* Shell */
.shell { min-height: 100%; min-width: 0; display: grid; grid-template-rows: auto auto 1fr; }
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 10px 18px;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.logo {
  display: flex;
  align-items: center;
  height: 48px;
}
.logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 46%, transparent 80%);
  mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 46%, transparent 80%);
}
.player {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(160deg, #243040, #0d131c);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar.has-flag { border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.player b { display: block; font-size: 0.92rem; }
.player span { color: var(--fg-muted); font-size: 0.75rem; letter-spacing: 0.06em; }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.gold-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 78%);
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--fg);
  display: grid; place-items: center;
}
.text-btn {
  height: 36px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--fg);
  display: inline-flex; align-items: center; text-decoration: none;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
}

.nav {
  display: flex; gap: 6px; padding: 10px 18px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.nav button {
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--fg-muted);
  font-family: var(--font-display); letter-spacing: 0.12em; font-size: 0.92rem;
}
.nav button.active {
  color: var(--fg);
  background: var(--accent-dim);
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
}
.stage { padding: 16px; min-height: 0; min-width: 0; }

/* Research layout */
.research {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 14px;
  min-height: calc(100vh - 140px);
}
.armory-layout {
  grid-template-columns: 1fr 320px;
}
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 0;
}
.panel h2 {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--fg-subtle);
  padding: 14px 16px 8px;
}
.cat-list { display: flex; flex-direction: column; padding: 0 8px 12px; }
.cat-list button {
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
}
.cat-list button.active {
  background: var(--accent-dim);
  color: var(--fg);
}
.tree {
  padding: 16px 18px 24px;
  overflow: auto;
}
.tree-head p { margin: 6px 0 16px; color: var(--fg-muted); font-size: 0.9rem; }
.branch { margin-bottom: 22px; }
.branch-title {
  font-size: 0.72rem; letter-spacing: 0.14em; color: var(--fg-subtle); margin-bottom: 10px;
}
.nodes {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
}
.node {
  width: 132px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  text-align: left;
  color: inherit;
}
.node:hover { border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 35%, transparent);
}
.node img, .node .sil {
  height: 54px; width: 100%; object-fit: cover; border-radius: var(--radius-xs);
  background: #0c121a;
}
.sil { display: grid; place-items: center; color: var(--fg-subtle); font-size: 0.7rem; }
.node .name { font-size: 0.82rem; font-weight: 600; margin-top: 6px; }
.node .meta { font-size: 0.7rem; color: var(--fg-subtle); }
.badge {
  display: inline-block; margin-top: 6px; font-size: 0.65rem; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--fg-muted);
}
.badge.ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, transparent); }
.badge.prog { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.node-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.node-progress span {
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 2.2em;
}
.node-bar {
  flex: 1;
  height: 5px;
  margin: 0;
}

.detail { display: flex; flex-direction: column; }
.detail-photo { height: 180px; object-fit: cover; width: 100%; background: #0c121a; }
.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.detail-body h3 { font-size: 1.4rem; }
.role { color: var(--fg-muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.stat span { display: block; font-size: 0.68rem; color: var(--fg-subtle); letter-spacing: 0.08em; }
.stat b { font-variant-numeric: tabular-nums; }
.frag-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 8px;
  background: var(--bg-elevated);
}
.btn-sell {
  margin-top: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:disabled,
.btn-locked,
.btn-locked:disabled {
  background: #1a222c;
  color: var(--fg-subtle);
  border-color: var(--border);
  width: 100%;
  opacity: 1;
  filter: none;
  transform: none;
  cursor: not-allowed;
}
.btn-primary:disabled:hover,
.btn-locked:hover { filter: none; transform: none; }

.research-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.unit-dossier { display: flex; flex-direction: column; }
.dossier-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.dossier-photo {
  width: 100%;
  height: min(78vh, 760px);
  object-fit: cover;
  object-position: center center;
  background: #0c121a;
  display: block;
}

.profile-page { display: grid; gap: 14px; }
.country-search {
  width: min(360px, 100%);
  margin: 4px 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  padding: 0 16px 18px;
  max-height: calc(100vh - 280px);
  overflow: auto;
}
.flag-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: inherit;
}
.flag-pick img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #0c121a;
}
.flag-pick span { font-size: 0.78rem; line-height: 1.2; }
.flag-pick:hover { border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.flag-pick.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 35%, transparent);
}

#list-amount-error { min-height: 1.1em; color: var(--danger); margin: 4px 0 0; }
.market-actions { display: flex; gap: 8px; align-items: center; }
.modal label { display: block; font-size: 0.72rem; letter-spacing: 0.1em; color: var(--fg-subtle); margin: 10px 0 4px; }
.modal input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--fg);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.frag-row { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 4px; color: var(--fg-muted); }
.bar { height: 6px; background: #1c2530; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }

.empty {
  padding: 48px 24px;
  color: var(--fg-muted);
  text-align: center;
}
.games { display: grid; gap: 10px; }
.game-card {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px;
  gap: 12px;
}
.game-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.join-pick { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.seat-row, .doctrine-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }

.match-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  min-height: 0;
  height: 100%;
}
.triangle-map {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  border: none;
  cursor: grab;
  touch-action: none;
}
.triangle-map.panning { cursor: grabbing; }
.map-viewport {
  position: relative;
  height: min(58vh, 560px);
  background: #0a1018;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  touch-action: none;
}
.map-nav {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.map-nav button {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #121a24cc;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
}
.map-nav #map-zoom-fit { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; }
.map-nav-hint {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 0.72rem;
  color: var(--fg-muted);
  pointer-events: none;
}
.triangle-map .air-dot { fill: #4d6278; }
.triangle-map .air-grid-fill { pointer-events: all; }
.triangle-map .air-aim {
  fill: none;
  stroke: #e0b43a;
  stroke-width: 0.7;
  pointer-events: none;
}
.triangle-map .mu.air circle { stroke-dasharray: 1.1 0.7; }
.triangle-map .road { stroke: #3d4d5e; stroke-width: 1.4; }
.triangle-map .waterway.coastal { stroke: #7ec8e3; stroke-width: 0.85; stroke-dasharray: 1.15 0.75; }
.triangle-map .waterway.deep { stroke: #1d4e89; stroke-width: 1.45; }
.triangle-map .sea-node.coastal circle { fill: #14384a; stroke: #9fd4e8; stroke-width: 0.45; }
.triangle-map .sea-node.deep circle { fill: #10243f; stroke: #4d78b0; stroke-width: 0.55; }
.triangle-map .sea-node.port circle { fill: #14384a; stroke: #7ec8e3; stroke-width: 0.6; }
.triangle-map .sea-node.port text { font-size: 3.2px; fill: #9fd4e8; }
.triangle-map .sea-node.aimed circle { stroke: #fff; }
.triangle-map .view-radius {
  fill: color-mix(in oklab, var(--accent) 8%, transparent);
  stroke: var(--accent);
  stroke-width: 0.35;
  stroke-dasharray: 1.2 1;
  pointer-events: none;
  opacity: 0.7;
}
.triangle-map .view-radius.foe {
  fill: color-mix(in oklab, var(--danger) 8%, transparent);
  stroke: var(--danger);
}
.triangle-map .road.diag { stroke: #5a6d80; stroke-dasharray: 2 1.5; }
.triangle-map .territory circle { fill: #16202c; stroke: var(--accent); stroke-width: 0.6; cursor: pointer; }
.triangle-map .territory.city circle { stroke-width: 0.9; }
.triangle-map .territory.mine circle { fill: color-mix(in oklab, var(--accent) 35%, #16202c); }
.triangle-map .territory.foe circle { fill: color-mix(in oklab, var(--danger) 35%, #16202c); }
.triangle-map .territory.neutral circle { fill: #16202c; }
.wallets { display: flex; flex-direction: column; gap: 8px; }
.wallet { font-size: 0.85rem; color: var(--fg-muted); }
.wallet.mine { color: var(--fg); }
.wallet-name { font-size: 0.72rem; letter-spacing: 0.12em; color: var(--fg-muted); margin-bottom: 6px; }
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.res-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0e1620;
  font-variant-numeric: tabular-nums;
}
.res-chip .res-sym {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #9bb0c4;
}
.res-chip b { font-size: 0.92rem; color: var(--fg); }
.res-chip .meta { grid-column: 2; font-size: 0.68rem; }
.res-chip.res-mechanical .res-sym { color: #d7a15a; }
.res-chip.res-electronic .res-sym { color: #5ec8ff; }
.res-chip.res-oil .res-sym { color: #c9b35a; }
.res-chip.res-food .res-sym { color: #7dba8a; }
.res-chip.res-hightech .res-sym { color: #c084fc; }
.res-chip.res-manpower .res-sym { color: #8ab4d4; }
.res-chip.drain .meta { color: var(--danger); }
.triangle-map .territory text.econ {
  fill: #9bb0c4;
  font-size: 3.1px;
  text-anchor: middle;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.triangle-map .territory text.econ.res-mechanical { fill: #d7a15a; }
.triangle-map .territory text.econ.res-electronic { fill: #5ec8ff; }
.triangle-map .territory text.econ.res-oil { fill: #c9b35a; }
.triangle-map .territory text.econ.res-food { fill: #7dba8a; }
.triangle-map .territory text.econ.res-hightech { fill: #c084fc; }
.tick-load {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0e1620;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.tick-load b { color: var(--fg); font-size: 0.95rem; }
.tick-load .tick-k { letter-spacing: 0.12em; font-size: 0.68rem; }
.tick-load .tick-pct { color: #7dba8a; }
.tick-load.warn .tick-pct, .tick-load.warn b { color: var(--warn); }
.tick-load.hot .tick-pct, .tick-load.hot b { color: var(--danger); }
.tick-load .tick-loop { width: 100%; font-size: 0.7rem; opacity: 0.85; }
.log-line.log-kind-capture b { color: #7dba8a; }
.log-line.log-kind-income b { color: #c9a46a; }
.go-stop { display: flex; gap: 8px; }
.go-stop .btn { flex: 1; padding: 10px 12px; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; }
.train-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 10px;
}
.city-yard { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.build-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0e1620;
}
.build-row b { font-size: 0.88rem; }
.build-row .btn { height: 32px; padding: 0 12px; flex-shrink: 0; }
.train-row select {
  flex: 1;
  min-width: 0;
  height: 40px;
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.train-row .btn {
  width: auto;
  flex: 0 0 auto;
  padding: 0 14px;
  white-space: nowrap;
}
.triangle-map .territory text {
  fill: var(--fg-muted); font-size: 4px; text-anchor: middle; font-family: var(--font-display);
}
.triangle-map .mu circle { cursor: pointer; stroke: #071018; stroke-width: 0.4; }
.triangle-map .mu.mine circle { fill: var(--accent); }
.triangle-map .mu.foe circle { fill: var(--danger); }
.triangle-map .mu.picked circle { stroke: #fff; stroke-width: 0.7; }
.triangle-map .mu.dead circle { opacity: 0.25; }
.triangle-map .mu.fighting circle { fill: var(--warn); }
.match-log {
  max-height: 220px; overflow: auto; font-size: 0.75rem; color: var(--fg-muted);
  display: flex; flex-direction: column; gap: 6px;
}
.log-line b { color: var(--accent); margin-right: 6px; }
.log-time {
  display: inline-block;
  min-width: 4.6em;
  margin-right: 8px;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.log-line.log-kind-battle b { color: var(--warn); }
.log-line.log-kind-order b { color: var(--ok); }
.log-line.log-kind-spot b { color: #c9a46a; }
.log-line.log-kind-lost b { color: var(--fg-subtle); }
.log-line.log-kind-shell b { color: #e0b43a; }
.log-line.log-kind-end b { color: #e8c547; }

.match-over {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e8c547;
  background: color-mix(in oklab, #e8c547 12%, transparent);
  color: #e8c547;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}
.match-wait {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--border));
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  color: var(--fg);
  font-size: 0.92rem;
}

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: grid; place-items: center; padding: 16px; z-index: 20;
}
.modal {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.modal h2 { font-size: 1.6rem; margin-bottom: 8px; }
.modal p { color: var(--fg-muted); margin: 0 0 18px; }
.supply-modal { width: min(440px, 100%); text-align: center; }
.supply-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warn);
}
.crate-stage {
  position: relative;
  margin: 4px auto 8px;
  min-height: 168px;
}
.crate-art {
  width: 100%;
  max-height: 210px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.crate-art.crate-dim { opacity: 0.35; filter: blur(0.4px); }
.crate-loot {
  position: absolute;
  inset: 22% 24% 28%;
  display: grid;
  place-items: center;
}
.crate-loot img {
  width: min(180px, 70%);
  max-height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.55));
}
.supply-modal .btn { width: 100%; }

@media (max-width: 980px) {
  .match-layout, .research, .armory-layout { grid-template-columns: 1fr; }
  .cat-list { flex-direction: row; overflow-x: auto; }
  .detail-photo { height: 140px; }
  .dossier-photo { height: min(58vh, 500px); object-fit: cover; }
}
@media (max-width: 720px) {
  .login-wrap { padding: 12px; }
  .login-card { padding: 18px 14px; }
  .login-card .brand img { height: 64px; }
  .login-card h1 { font-size: 1.6rem; }
  .login-card p { margin-bottom: 16px; }
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .logo, .logo img { height: 34px; }
  .player { min-width: 0; }
  .player b, .player span {
    display: block;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chip { height: 32px; padding: 0 10px 0 6px; }
  .text-btn, .icon-btn { height: 32px; }
  .icon-btn { width: 32px; }
  .nav { padding: 8px 10px; gap: 4px; }
  .nav button { height: 36px; padding: 0 12px; font-size: 0.82rem; }
  .stage { padding: 10px; }
  .node { width: calc(50% - 5px); }
  .dossier-photo { height: 42vh; }
  .detail-photo { height: 120px; }
  .game-card { flex-direction: column; align-items: stretch; padding: 12px; }
  .game-actions, .join-pick, .seat-row, .doctrine-row { justify-content: flex-start; }
  .flag-grid {
    grid-template-columns: 1fr 1fr;
    max-height: none;
    padding: 0 10px 14px;
  }
  .map-viewport { height: 46vh; }
  .empty { padding: 24px 12px; }
  .modal { padding: 18px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
