/* ==========================================================================
   POLITIKA — The Novarian Theatre
   A dark war-room aesthetic: ink, parchment, brass, and cartographic teal.
   ========================================================================== */

:root {
  --ink-950: #071017;
  --ink-925: #08141c;
  --ink-900: #0a1821;
  --ink-850: #0d1e28;
  --ink-800: #102532;
  --ink-750: #142d3a;
  --line: rgba(185, 215, 222, 0.13);
  --line-strong: rgba(197, 224, 229, 0.23);
  --paper: #f0e6d2;
  --paper-soft: #d8cdb8;
  --muted: #8ba1aa;
  --muted-2: #647d87;
  --gold: #c9a35c;
  --gold-bright: #e8c987;
  --gold-dim: rgba(201, 163, 92, 0.16);
  --teal: #4ec3ad;
  --teal-dim: rgba(78, 195, 173, 0.14);
  --crimson: #da685a;
  --crimson-dim: rgba(218, 104, 90, 0.13);
  --blue: #64a7d8;
  --shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.46);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --serif: "Bodoni MT", "Didot", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", "Aptos", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  --page: 1580px;
  --ease: cubic-bezier(0.22, 0.75, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--ink-950);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -3;
  background:
    radial-gradient(ellipse 55% 55% at 82% 5%, rgba(42, 108, 113, 0.24), transparent 66%),
    radial-gradient(ellipse 46% 45% at 5% 38%, rgba(201, 163, 92, 0.07), transparent 70%),
    linear-gradient(160deg, #08141c 0%, #061017 55%, #08151d 100%);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(156, 195, 201, 0.035) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(156, 195, 201, 0.025) 50%, transparent 50.2%);
  background-size: 160px 160px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 78%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }

::selection {
  background: var(--gold);
  color: #10191e;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #071119; }
::-webkit-scrollbar-thumb {
  background: #203a45;
  border: 2px solid #071119;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: #31515e; }

h1, h2, h3, p { margin-top: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.eyebrow .dot { color: var(--gold); margin: 0 4px; }

/* ── Buttons and shared controls ─────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.button-primary {
  background: linear-gradient(135deg, #e2c17b, #c5a057);
  color: #121b20;
  box-shadow: 0 8px 28px rgba(201, 163, 92, 0.17);
}
.button-primary:hover {
  background: linear-gradient(135deg, #f0d391, #d3ae64);
  box-shadow: 0 10px 34px rgba(201, 163, 92, 0.25);
}
.button-outline {
  border-color: var(--line-strong);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.025);
}
.button-outline:hover { border-color: var(--gold); color: var(--gold-bright); }
.button-ghost { border-color: transparent; color: var(--muted); }
.button-ghost:hover { color: var(--paper); background: rgba(255, 255, 255, 0.04); }
.button-danger {
  border-color: rgba(218, 104, 90, 0.32);
  color: #f0a196;
  background: var(--crimson-dim);
}
.button-danger:hover { border-color: var(--crimson); background: rgba(218, 104, 90, 0.2); }
.button-small { min-height: 34px; padding: 0 14px; font-size: 11px; }
.button-large { min-height: 54px; padding: 0 27px; font-size: 14px; }
.button-block { width: 100%; }
.button .discord-mark { width: 21px; height: auto; }

.text-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}
.text-button:hover { color: var(--gold-bright); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-button:hover { color: var(--paper); border-color: var(--line-strong); background: rgba(255,255,255,.035); }
.icon-button svg { width: 18px; height: 18px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 12px clamp(18px, 3.2vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 15, 22, 0.78);
  backdrop-filter: blur(18px) saturate(130%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--paper);
}

.brand-mark {
  width: 35px;
  height: 41px;
  color: var(--gold);
  flex: none;
}

.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.brand-copy small {
  margin-top: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.21em;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  white-space: nowrap;
}
.header-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(78, 195, 173, 0.09), 0 0 12px rgba(78, 195, 173, 0.6);
  animation: status-pulse 2.8s ease-in-out infinite;
}
.header-status.is-offline i { background: var(--crimson); box-shadow: 0 0 0 4px rgba(218, 104, 90, 0.09); animation: none; }
.header-status.is-connecting i { background: var(--gold); box-shadow: 0 0 0 4px rgba(201,163,92,.08); }

.world-code-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-height: 40px;
  padding: 5px 11px;
  border: 1px solid rgba(78, 195, 173, 0.22);
  border-radius: 9px;
  background: rgba(78, 195, 173, 0.055);
  color: var(--paper);
  cursor: pointer;
}
.world-code-chip span {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .11em;
}
.world-code-chip strong {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
}
.world-code-chip:hover { border-color: var(--teal); }

.wallet-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 6px 13px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  color: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.wallet-chip:hover { border-color: rgba(201, 163, 92, 0.45); background: rgba(201, 163, 92, 0.06); }
.wallet-label {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
}
.wallet-chip strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.wallet-chip svg { width: 14px; height: 14px; color: var(--gold); opacity: 0.8; }
.wallet-mode {
  position: absolute;
  top: -7px;
  right: 9px;
  padding: 1px 6px;
  border: 1px solid rgba(201, 163, 92, 0.35);
  border-radius: 999px;
  background: #0b1a23;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.11em;
}
.wallet-mode.is-live { color: var(--teal); border-color: rgba(78, 195, 173, 0.35); }

.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, #173441, #0b1b25);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 16px;
  overflow: hidden;
  flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-small { width: 34px; height: 34px; }
.user-copy { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-copy small { color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .12em; }
.user-copy strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(27, 67, 76, 0.34), transparent 45%),
    var(--ink-950);
}
.loading-crest { width: 58px; color: var(--gold); animation: crest-breathe 2.6s var(--ease) infinite; }
.loading-crest svg { display: block; width: 100%; }
.loading-screen .eyebrow { margin-top: 24px; color: var(--gold); letter-spacing: .24em; }
.loading-bar {
  width: 190px;
  height: 1px;
  margin-top: 18px;
  background: rgba(255,255,255,.09);
  overflow: hidden;
}
.loading-bar span {
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: loading-sweep 1.45s ease-in-out infinite;
}
.loading-copy { margin: 15px 0 0; color: var(--muted-2); font-size: 11px; letter-spacing: .04em; }

/* ── Landing ─────────────────────────────────────────────────────────────── */
.landing {
  width: min(100%, var(--page));
  min-height: calc(100vh - 186px);
  margin: 0 auto;
  padding: clamp(52px, 7vw, 100px) clamp(20px, 3.6vw, 52px) 64px;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(480px, 1.08fr);
  gap: clamp(40px, 5vw, 92px);
  align-items: center;
  animation: fade-up .8s var(--ease) both;
}

.landing-copy { max-width: 650px; }
.hero-kicker { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; color: var(--gold); font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .2em; }
.hero-kicker .rule { width: 36px; height: 1px; background: var(--gold); opacity: .65; }

.landing h1 {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: clamp(58px, 6.6vw, 94px);
  font-weight: 400;
  line-height: .94;
  letter-spacing: -.035em;
  color: var(--paper);
}
.landing h1 em { color: var(--gold-bright); font-weight: 400; }

.hero-lede {
  max-width: 510px;
  margin-bottom: 32px;
  color: #a9b9bd;
  font-size: 16px;
  line-height: 1.72;
}

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.login-note { margin: 15px 0 0; color: var(--muted-2); font-size: 11px; }
.login-note.is-error { color: #f0a196; }

.desktop-login {
  margin-top: 20px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(201, 163, 92, .055), rgba(7, 20, 28, .3));
}
.desktop-login[hidden] { display: none; }
.desktop-login-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.desktop-login-head .eyebrow { margin: 0; color: var(--gold); font-size: 8px; }
.desktop-login-badge {
  padding: 2px 7px;
  border: 1px solid rgba(201, 163, 92, .3);
  border-radius: 999px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
}
.desktop-login > p {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}
.desktop-login code { color: var(--gold-bright); }
.link-form { display: flex; gap: 7px; }
.link-form input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: rgba(2, 11, 16, .5);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
}
.link-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,163,92,.08); }
.link-form .button { min-height: 38px; padding: 0 15px; border-radius: 7px; font-size: 11px; }
.desktop-login-hint { margin-bottom: 0 !important; color: var(--muted-2) !important; font-size: 8.5px !important; }

.landing-meta {
  display: flex;
  gap: 0;
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.landing-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 115px;
  padding-right: 24px;
  margin-right: 24px;
  border-right: 1px solid var(--line);
}
.landing-meta > div:last-child { border: 0; margin: 0; padding: 0; }
.landing-meta strong { font-family: var(--serif); font-size: 25px; font-weight: 400; color: var(--paper); }
.landing-meta span { color: var(--muted-2); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }

.landing-visual { min-width: 0; position: relative; }
.landing-map-frame {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(18, 42, 53, .9), rgba(7, 19, 27, .96));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.landing-map-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(201,163,92,.08), transparent 30%, transparent 70%, rgba(78,195,173,.05));
}
.landing-map-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 26px 8px;
}
.landing-map-head h2 { margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 400; }
.landing-map-wrap { position: relative; }
#landingMap { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 700; }
.landing-outline { fill: rgba(21, 44, 52, .86); stroke: #41616a; stroke-width: 1.4; filter: url(#landingGlow); }
#landingProvinces .landing-province {
  stroke: #061018;
  stroke-width: 1.2;
  opacity: .58;
  transition: opacity .3s, filter .3s;
}
#landingProvinces .landing-province.is-owned { opacity: .88; filter: url(#landingGlow); }
.landing-map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(7,19,28,.3), transparent 22%, transparent 70%, rgba(7,19,28,.75)),
    radial-gradient(ellipse at center, transparent 42%, rgba(7,19,28,.45));
}
.landing-stats {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(9px);
}
.landing-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(7, 20, 28, .85);
}
.landing-stats span { color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .12em; }
.landing-stats strong { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.landing-map-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 26px 18px;
  border-top: 1px solid var(--line);
  background: rgba(7,19,27,.7);
}
.landing-map-foot p { margin: 0; color: var(--muted); font-size: 11px; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(78,195,173,.26);
  border-radius: 999px;
  background: rgba(78,195,173,.06);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .1em;
  white-space: nowrap;
}
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
  overflow: hidden;
}
.feature { padding: 18px 17px; background: rgba(9, 24, 33, .9); }
.feature-number { display: block; margin-bottom: 12px; color: var(--gold); font-family: var(--mono); font-size: 9px; letter-spacing: .12em; }
.feature h3 { margin: 0 0 5px; font-family: var(--serif); font-size: 22px; font-weight: 400; }
.feature p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.landing-compass circle, .landing-compass path:not(.compass-needle) { fill: none; stroke: #3b5a64; stroke-width: 1; }
.landing-compass text { fill: #5e7c85; font-family: var(--mono); font-size: 10px; }
.landing-compass .compass-needle { fill: var(--gold); opacity: .55; }

/* ── Dashboard shell ─────────────────────────────────────────────────────── */
.dashboard {
  width: min(100%, var(--page));
  margin: 0 auto;
  padding: clamp(24px, 3vw, 42px) clamp(16px, 2.6vw, 38px) 74px;
  animation: fade-up .55s var(--ease) both;
}

.war-room-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 26px;
}
.war-room-heading { min-width: 0; }
.war-room-heading h1 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: clamp(34px, 3.6vw, 49px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.02em;
}
.party-motto { margin: 0; color: var(--muted); font-size: 13px; }
.turn-clock {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.022);
}
.clock-icon { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid rgba(201,163,92,.25); border-radius: 50%; color: var(--gold); }
.clock-icon svg { width: 18px; height: 18px; }
.turn-clock span { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .13em; }
.turn-clock strong { display: block; margin-top: 2px; font-family: var(--mono); font-size: 17px; font-weight: 500; letter-spacing: .04em; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card {
  position: relative;
  min-height: 108px;
  padding: 15px 17px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255,255,255,.027), rgba(255,255,255,.008)),
    rgba(8, 23, 31, .65);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -44px;
  width: 105px;
  height: 105px;
  border: 1px solid rgba(201,163,92,.08);
  border-radius: 50%;
}
.stat-treasury { border-color: rgba(201, 163, 92, .25); background: linear-gradient(135deg, rgba(201,163,92,.09), rgba(8,23,31,.72) 60%); }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted-2); font-family: var(--mono); font-size: 8px; letter-spacing: .13em; }
.stat-icon { color: var(--gold); font-family: var(--serif); font-size: 17px; opacity: .8; }
.stat-value { display: block; margin: 5px 0 1px; font-family: var(--mono); font-size: clamp(22px, 2.1vw, 28px); font-weight: 500; line-height: 1.18; letter-spacing: -.04em; }
.stat-value.accent-teal { color: var(--teal); }
.stat-value.accent-gold { color: var(--gold-bright); }
.stat-sub { margin: 0; color: var(--muted-2); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(160deg, rgba(255,255,255,.022), transparent 42%),
    rgba(8, 22, 30, .72);
  box-shadow: 0 18px 50px rgba(0,0,0,.14);
}

/* ── Map ─────────────────────────────────────────────────────────────────── */
.map-panel { padding: 0; overflow: hidden; }
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}
.panel-heading h2 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 400; line-height: 1.1; }
.map-heading { padding-bottom: 14px; }
.map-heading-meta { display: flex; align-items: center; gap: 14px; }
.tick-label { color: var(--muted-2); font-family: var(--mono); font-size: 8px; letter-spacing: .11em; }
.tick-label strong { color: var(--paper-soft); font-weight: 500; margin-left: 4px; }

.map-frame {
  position: relative;
  margin: 0 12px;
  border: 1px solid rgba(197,224,229,.1);
  border-radius: 10px;
  background: #07141d;
  overflow: hidden;
  aspect-ratio: 1000 / 700;
  min-height: 380px;
}
#gameMap {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
#gameMap.is-dragging { cursor: grabbing; }
.map-contours path { fill: none; stroke: rgba(72, 111, 124, 0.12); stroke-width: 1; }
.map-outline { fill: rgba(24, 47, 55, 0.95); stroke: #4d7079; stroke-width: 1.4; transition: fill .3s; }
#mapLandmass path { fill: rgba(20, 40, 49, .9); stroke: none; }
.map-compass circle, .map-compass path:not(.compass-needle) { fill: none; stroke: rgba(112, 151, 160, .35); stroke-width: 1; }
.map-compass text { fill: rgba(139, 176, 185, .52); font-family: var(--mono); font-size: 10px; }
.map-compass .compass-needle { fill: rgba(201,163,92,.65); }
.map-scale-label { fill: rgba(100, 136, 146, .47); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }

.province { cursor: pointer; outline: none; }
.province-shape {
  stroke: #07131b;
  stroke-width: 1.15;
  stroke-linejoin: round;
  transition: filter .2s var(--ease), opacity .2s;
  vector-effect: non-scaling-stroke;
}
.province:hover .province-shape { filter: brightness(1.18) saturate(1.08); }
.province.is-selected .province-shape {
  stroke: var(--gold-bright);
  stroke-width: 2.4;
  filter: url(#provinceGlow) brightness(1.08);
}
.province:focus-visible .province-shape { stroke: #fff1cf; stroke-width: 2.5; }
.province.is-enemy-target .province-shape { stroke: rgba(218, 104, 90, 0.58); stroke-width: 1.8; }
.province-label { pointer-events: none; }
.province-number-ring { fill: #07141c; stroke: rgba(240,230,210,.62); stroke-width: 1.15; vector-effect: non-scaling-stroke; }
.province.is-selected .province-number-ring { stroke: var(--gold-bright); stroke-width: 1.8; }
.province-number { fill: var(--paper); font-family: var(--mono); font-size: 13px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.province-name {
  fill: var(--paper);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 14, 20, .95);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.province-owner-label { fill: rgba(226, 216, 196, .72); font-family: var(--mono); font-size: 7px; letter-spacing: .06em; text-anchor: middle; paint-order: stroke; stroke: rgba(5,14,20,.95); stroke-width: 3px; }
.province-shield { fill: var(--gold-bright); opacity: .92; pointer-events: none; }
.province-shield-ring { fill: #07141c; stroke: rgba(232,201,135,.8); stroke-width: 1; }

.map-filters {
  position: absolute;
  left: 14px;
  bottom: 40px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.map-filter {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(5,16,23,.82);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .07em;
  padding: 5px 7px;
  cursor: pointer;
}
.map-filter.is-active { border-color: var(--teal); color: var(--teal); background: rgba(78,195,173,.12); }
.ai-badge { margin-left: 7px; border: 1px solid rgba(218,104,90,.45); border-radius: 999px; padding: 2px 6px; color: #e08a7f; font-family: var(--mono); font-size: 7px; letter-spacing: .06em; }
.danger-text { color: var(--crimson) !important; }

.map-controls {
  position: absolute;
  top: 13px;
  right: 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(197,224,229,.12);
  border-radius: 9px;
  background: rgba(7, 20, 28, .78);
  backdrop-filter: blur(9px);
}
.map-control {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--paper-soft);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.map-control:hover { background: rgba(255,255,255,.08); color: var(--gold-bright); }
.map-control svg { width: 15px; height: 15px; }
.map-control-reset { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; padding-top: 2px; }

.map-tooltip {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  min-width: 145px;
  max-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(6, 17, 24, .94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  transform: translate(-50%, calc(-100% - 12px));
}
.map-tooltip .tooltip-eyebrow { color: var(--gold); font-family: var(--mono); font-size: 7px; letter-spacing: .12em; }
.map-tooltip strong { display: block; margin: 2px 0; font-family: var(--serif); font-size: 18px; font-weight: 400; }
.map-tooltip span { display: block; color: var(--muted); font-size: 9px; }
.map-corner-label {
  position: absolute;
  left: 14px;
  bottom: 11px;
  color: rgba(128, 159, 168, .45);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .11em;
  pointer-events: none;
}

.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px 15px;
}
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; min-width: 0; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.legend-unclaimed .legend-swatch { background: repeating-linear-gradient(45deg, #3a4b50, #3a4b50 2px, #1a2c34 2px, #1a2c34 4px); }
.legend-count { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.map-hint { margin: 0; color: var(--muted-2); font-size: 8.5px; text-align: right; white-space: nowrap; }

.province-index { display: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sidebar-primary { overflow: hidden; }
.sidebar-primary-header { padding: 20px 20px 0; }
.sidebar-primary h2 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 400; line-height: 1.1; }

.dossier-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
}
.dossier-id .back-button { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.dossier-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 8px; }
.dossier-title-row h2 { margin: 0; font-size: 31px; }
.dossier-region { color: var(--muted); font-size: 10px; }
.owner-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 20px 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.owner-ribbon-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.owner-flag { width: 13px; height: 13px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); flex: none; }
.owner-ribbon strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.owner-ribbon span { color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .1em; }
.owner-ribbon .shield-tag { color: var(--gold); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; }
.owner-ribbon .unclaimed { color: var(--muted); }

.dossier-body { padding: 14px 20px 19px; }
.dossier-flavour { margin: 0 0 14px; color: #9aadb2; font-size: 11px; line-height: 1.6; font-style: italic; }
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}
.mini-stat { padding: 8px 9px; background: rgba(5,16,23,.9); }
.mini-stat span { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; }
.mini-stat strong { display: block; margin-top: 1px; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.mini-stat strong.teal { color: var(--teal); }
.mini-stat strong.gold { color: var(--gold-bright); }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 9px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .12em;
}
.section-label .section-aside { color: var(--muted-2); font-weight: 400; letter-spacing: .04em; }

.building-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 17px; }
.building { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); }
.building-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.building-title { display: flex; align-items: center; gap: 6px; }
.building-title strong { font-size: 10.5px; font-weight: 600; }
.building-level { color: var(--gold); font-family: var(--mono); font-size: 7px; letter-spacing: .04em; }
.building-desc { margin: 2px 0 0; color: var(--muted-2); font-size: 8.5px; line-height: 1.4; }
.building-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.building-cost { color: var(--paper-soft); font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.pips { display: flex; gap: 2px; margin-top: 7px; }
.pip { width: 8px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.11); }
.pip.filled { background: var(--gold); box-shadow: 0 0 5px rgba(201,163,92,.3); }

.recruit-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 17px; }
.recruit-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.recruit-row:first-child { border-top: 0; }
.recruit-name { display: flex; flex-direction: column; }
.recruit-name strong { font-size: 10.5px; font-weight: 600; }
.recruit-name span { color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.recruit-action { display: flex; align-items: center; gap: 9px; }
.recruit-cost { color: var(--paper-soft); font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.recruit-locked { color: var(--muted-2); font-size: 8px; }

.action-callout {
  padding: 11px 12px;
  border: 1px solid rgba(201,163,92,.22);
  border-radius: 7px;
  background: rgba(201,163,92,.055);
}
.action-callout p { margin: 0 0 9px; color: #b7c4c5; font-size: 9.5px; line-height: 1.5; }
.action-callout .button { width: 100%; }
.action-callout.danger { border-color: rgba(218,104,90,.25); background: var(--crimson-dim); }
.action-callout.neutral { border-color: var(--line); background: rgba(255,255,255,.02); }
.action-warning { margin: 7px 0 0; color: #dc9c90; font-size: 8.5px; line-height: 1.4; }

.overview-crest {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}
.party-emblem {
  display: grid;
  place-items: center;
  width: 46px;
  height: 52px;
  color: var(--gold);
  border: 1px solid rgba(201,163,92,.26);
  border-radius: 10px;
  background: rgba(201,163,92,.06);
  flex: none;
}
.party-emblem svg { width: 26px; height: 32px; }
.overview-crest h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.08; }
.overview-crest p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.party-reputation { margin-top: 4px !important; color: var(--muted-2) !important; font-family: var(--mono); font-size: 8px !important; letter-spacing: .07em; }
.party-reputation strong { color: var(--gold-bright); font-weight: 500; }
.nation-tag { margin-left: 6px; border: 1px solid rgba(232,201,135,.35); border-radius: 4px; padding: 2px 5px; color: var(--gold-bright); font: 9px var(--mono); letter-spacing: .08em; vertical-align: 4px; }
.nation-meta { margin-top: 3px !important; color: var(--muted-2) !important; font-size: 8px !important; line-height: 1.5; }
.overextension-warning { margin-top: 4px !important; color: #d98b72 !important; font: 8px var(--mono); letter-spacing: .03em; }
.province-capital-star { fill: var(--gold-bright); font-size: 18px; filter: drop-shadow(0 0 3px rgba(232,201,135,.7)); pointer-events: none; }
.victory-card { border: 1px solid rgba(232,201,135,.3); border-radius: 8px; background: rgba(232,201,135,.045); padding: 9px; margin-bottom: 8px; }
.victory-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; margin: 4px 0; }
.victory-row strong { color: var(--paper); font-weight: 500; }
.victory-bar { height: 4px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin: 4px 0 7px; }
.victory-bar i { display: block; height: 100%; background: var(--gold); }
.condition-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.condition-item { border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: rgba(0,0,0,.18); min-width: 0; }
.condition-item span { display: block; color: var(--muted-2); font: 7px var(--mono); letter-spacing: .09em; }
.condition-item strong { display: block; margin: 3px 0; font-size: 16px; font-weight: 500; }
.condition-item small { display: block; color: var(--muted); font-size: 8px; line-height: 1.35; }
.condition-warnings { display: flex; flex-direction: column; gap: 3px; margin: 0 0 10px; color: #d98b72; font-size: 9px; line-height: 1.4; }
@media (max-width: 720px) { .condition-strip { grid-template-columns: 1fr 1fr; } }
.next-steps { margin: 0 0 12px; border: 1px solid rgba(78,195,173,.28); border-radius: 8px; background: rgba(78,195,173,.055); overflow: hidden; }
.next-steps summary { display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; list-style: none; }
.next-steps summary::-webkit-details-marker { display: none; }
.next-steps-title { font-family: var(--mono); font-size: 8px; letter-spacing: .12em; color: var(--teal); }
.next-steps-progress { margin-left: auto; font-family: var(--mono); font-size: 8px; color: var(--muted); }
.next-steps-chevron { color: var(--muted); font-size: 12px; transition: transform .2s; }
.next-steps[open] .next-steps-chevron { transform: rotate(180deg); }
.next-steps-body { padding: 0 10px 10px; }
.next-steps-bar { height: 3px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 8px; }
.next-steps-bar i { display: block; height: 100%; background: var(--teal); }
.next-steps-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.next-step { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.next-step-mark { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-family: var(--mono); font-size: 7px; color: var(--muted); flex: none; }
.next-step.is-done { color: var(--muted-2); }
.next-step.is-done .next-step-mark { border-color: rgba(78,195,173,.5); color: var(--teal); background: rgba(78,195,173,.12); }
.next-steps-action { margin-top: 8px; display: flex; justify-content: flex-end; }
@media (max-width: 620px) { .next-steps-list { grid-template-columns: 1fr; } }
.law-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.law-pill { border: 1px solid rgba(232,201,135,.35); border-radius: 999px; padding: 4px 8px; color: var(--gold-bright); font-size: 9px; }
.law-pill small { color: var(--muted); font-family: var(--mono); font-size: 7px; margin-left: 4px; }
.bill-card, .referendum-card { border: 1px solid var(--line); border-radius: 8px; padding: 9px; margin-bottom: 8px; background: rgba(0,0,0,.16); }
.bill-head, .referendum-option-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bill-head strong { font-family: var(--display); font-size: 14px; font-weight: 500; }
.bill-head span, .referendum-option-head span { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.bill-card p, .referendum-card p { color: var(--muted); font-size: 9px; line-height: 1.5; margin: 5px 0; }
.bill-actions { display: flex; gap: 5px; }
.bill-choice-list { display: flex; flex-direction: column; gap: 8px; }
.bill-choice { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.2); color: var(--paper); cursor: pointer; }
.bill-choice:hover { border-color: var(--teal); }
.bill-choice strong { font-family: var(--display); font-size: 18px; font-weight: 500; }
.bill-choice span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.referendum-option { border-top: 1px solid var(--line); padding: 8px 0; }
.referendum-option:first-of-type { border-top: 0; }
.referendum-bar { height: 4px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin: 5px 0; }
.referendum-bar i { display: block; height: 100%; background: var(--teal); }
.referendum-option-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.referendum-option-foot span { color: var(--muted-2); font-size: 8px; line-height: 1.4; }
.diplomacy-party-list { display: flex; flex-direction: column; gap: 6px; }
.diplomacy-party { align-items: flex-start; }
.diplomacy-buttons { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 300px; }
.trade-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-columns .form-field { gap: 6px; }
.trade-columns input, .trade-columns select { width: 100%; }
@media (max-width: 820px) { .trade-columns { grid-template-columns: 1fr; } .diplomacy-party { flex-direction: column; } .diplomacy-buttons { justify-content: flex-start; } }
.overview-body { padding: 15px 20px 19px; }
.overview-ledger {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1px;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}
.world-invite {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: center;
  margin: 0 0 15px;
  padding: 10px 12px;
  border: 1px solid rgba(78,195,173,.26);
  border-radius: 8px;
  background: rgba(78,195,173,.06);
}
.world-invite span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
}
.world-invite strong {
  grid-column: 1;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .1em;
}
.world-invite .button { grid-column: 2; grid-row: 1 / span 2; }

.party-member-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.party-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.party-member-copy { display: flex; flex-direction: column; min-width: 0; }
.party-member-copy strong { font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.party-member-copy span { color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; }
.party-member .avatar { flex: none; }
.member-role-select {
  margin-left: auto;
  max-width: 115px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0,0,0,.28);
  color: var(--paper);
  font: 9px var(--mono);
  padding: 4px 5px;
}
.party-ranks-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.party-ranks-head .section-label { margin-bottom: 7px; }
.party-role-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.party-role-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; color: var(--muted); font-size: 9px; }
.party-role-pill small { color: var(--teal); font-family: var(--mono); font-size: 7px; }
.rank-admin-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; }
.rank-admin-list { display: flex; flex-direction: column; gap: 6px; }
.rank-admin-row { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.rank-admin-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rank-admin-row strong { font-size: 11px; font-weight: 500; }
.rank-admin-row span { color: var(--muted-2); font-size: 9px; }
.rank-editor { border-left: 1px solid var(--line); padding-left: 16px; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.permission-option { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.permission-option input { accent-color: var(--teal); }
@media (max-width: 820px) { .rank-admin-grid { grid-template-columns: 1fr; } .rank-editor { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; } }

.invite-member-form {
  margin: 0 0 15px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.invite-member-form label { display: block; margin-bottom: 6px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .1em; }
.invite-member-row { display: flex; gap: 6px; }
.invite-member-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0,0,0,.2);
  color: var(--paper);
  padding: 7px 8px;
  font: 11px var(--mono);
}
.invite-member-row input:focus { outline: none; border-color: var(--teal); }
.invite-member-form .form-hint { margin: 6px 0 0; font-size: 9px; }

.party-invite-card {
  margin-bottom: 9px;
  padding: 11px;
  border: 1px solid rgba(78,195,173,.3);
  border-radius: 8px;
  background: rgba(78,195,173,.07);
}
.party-invite-kicker { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .09em; }
.party-invite-card strong { display: block; margin: 3px 0; font-family: var(--serif); font-size: 17px; font-weight: 400; }
.party-invite-card p { margin: 0 0 8px; color: var(--muted); font-size: 10px; }
.party-invite-actions { display: flex; gap: 6px; }
.ledger-cell { padding: 9px 10px; background: rgba(5,16,23,.9); }
.ledger-cell span { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; }
.ledger-cell strong { display: block; margin-top: 2px; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.ledger-cell strong.teal { color: var(--teal); }
.ledger-cell strong.gold { color: var(--gold-bright); }

.holding-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 15px; }
.holding {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.holding:hover { background: rgba(255,255,255,.035); border-color: var(--line); }
.holding-number { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-family: var(--mono); font-size: 8px; flex: none; }
.holding-copy { display: flex; flex-direction: column; min-width: 0; }
.holding-copy strong { font-size: 10px; font-weight: 600; }
.holding-copy span { color: var(--muted-2); font-size: 8px; }
.holding-income { margin-left: auto; color: var(--teal); font-family: var(--mono); font-size: 8.5px; white-space: nowrap; }
.empty-copy { margin: 0 0 12px; color: var(--muted); font-size: 10px; line-height: 1.55; }

/* ── Feed ────────────────────────────────────────────────────────────────── */
.feed-panel { overflow: hidden; }
.feed-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 17px 18px 12px; border-bottom: 1px solid var(--line); }
.feed-heading h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 400; }
.feed-heading .eyebrow { margin-bottom: 4px; }
.feed-count { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.feed-list { padding: 4px 0 6px; max-height: 251px; overflow-y: auto; }
.feed-item { display: flex; gap: 9px; padding: 8px 17px; border-bottom: 1px solid rgba(255,255,255,.035); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); font-family: var(--mono); font-size: 8px; flex: none; }
.feed-copy { min-width: 0; }
.feed-copy p { margin: 0; color: #bdc9c9; font-size: 9.5px; line-height: 1.45; }
.feed-copy time { display: block; margin-top: 2px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .04em; }
.feed-empty { padding: 18px 17px 22px; color: var(--muted-2); font-size: 9.5px; }

/* ── Standings ───────────────────────────────────────────────────────────── */
.standings-panel { margin-top: 14px; overflow: hidden; }
.standings-note { color: var(--muted-2); font-size: 8.5px; }
.standings-table { border-top: 1px solid var(--line); }
.standing-row {
  display: grid;
  grid-template-columns: 34px minmax(130px, 1.6fr) repeat(3, minmax(70px, .7fr));
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(255,255,255,.035);
  font-size: 10px;
}
.standing-row:last-child { border-bottom: 0; }
.standing-row.is-you { background: rgba(201,163,92,.045); }
.standing-rank { color: var(--muted-2); font-family: var(--mono); font-size: 9px; }
.standing-party { display: flex; align-items: center; gap: 8px; min-width: 0; }
.standing-party strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 600; }
.standing-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.standing-cell { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.standing-cell strong { color: var(--paper); font-weight: 500; }
.standings-empty { padding: 24px 18px; color: var(--muted); font-size: 10px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100%, var(--page));
  margin: 0 auto;
  padding: 20px clamp(18px, 3.2vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.brand-mini { color: var(--gold); font-family: var(--serif); font-size: 15px; letter-spacing: .17em; }
.footer-links { display: flex; align-items: center; gap: 17px; }
.footer-links a { color: var(--muted-2); text-decoration: none; }
.footer-links a:hover { color: var(--gold-bright); }
.economy-footer { color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .1em; }

code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(2, 10, 15, .5);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: .9em;
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 15, .78);
  backdrop-filter: blur(9px);
  animation: fade-in .25s ease both;
}
.modal-panel {
  position: relative;
  width: min(100%, 620px);
  max-height: min(88vh, 940px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(50, 115, 121, .13), transparent 35%),
    linear-gradient(155deg, #10232d, #081720 72%);
  box-shadow: var(--shadow-lg);
  animation: modal-in .3s var(--ease) both;
}
.modal-panel.modal-wide { width: min(100%, 790px); }
.modal-panel.modal-narrow { width: min(100%, 470px); }
.modal-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(5,15,21,.6);
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--paper); border-color: var(--line-strong); }
.modal-close svg { width: 16px; height: 16px; }
.modal-content { padding: 29px; }
.modal-content .eyebrow { color: var(--gold); }
.modal-content h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 36px; font-weight: 400; line-height: 1.08; }
.modal-content > p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.modal-content .modal-lede { max-width: 500px; margin-bottom: 23px; }
.modal-divider { height: 1px; margin: 20px 0; background: var(--line); }

.form-grid { display: grid; gap: 15px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.form-field input, .form-field textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: rgba(2, 11, 16, .45);
  color: var(--paper);
  font-size: 12px;
  transition: border-color .2s, box-shadow .2s;
}
.form-field textarea { min-height: 70px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,163,92,.09); }
.form-field input::placeholder, .form-field textarea::placeholder { color: #536b75; }
.form-hint { margin: 0; color: var(--muted-2); font-size: 9px; }
.form-error { margin: 0; padding: 9px 11px; border: 1px solid rgba(218,104,90,.28); border-radius: 6px; background: var(--crimson-dim); color: #efab9f; font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 5px; }

.colour-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.colour-swatch {
  position: relative;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s;
}
.colour-swatch:hover { transform: scale(1.08); }
.colour-swatch.is-selected { box-shadow: 0 0 0 2px #10232d, 0 0 0 3px var(--gold-bright); transform: scale(1.06); }
.colour-swatch::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(0,0,0,.22); border-radius: 50%; }

.onboarding-flag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(201,163,92,.22);
  border-radius: 8px;
  background: var(--gold-dim);
  color: var(--paper-soft);
  font-size: 10px;
}
.onboarding-flag svg { width: 20px; color: var(--gold); flex: none; }

.attack-summary { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 20px 0; }
.attack-side { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.022); text-align: center; }
.attack-side span { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .1em; }
.attack-side strong { display: block; margin-top: 4px; font-family: var(--serif); font-size: 21px; font-weight: 400; }
.attack-side small { display: block; margin-top: 2px; color: var(--muted); font-size: 8.5px; }
.attack-vs { color: var(--gold); font-family: var(--serif); font-size: 22px; }
.odds-block { margin: 16px 0; }
.odds-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.odds-head span { color: var(--muted-2); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }
.odds-head strong { color: var(--gold-bright); font-family: var(--mono); font-size: 19px; font-weight: 500; }
.odds-bar { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.odds-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b65e52, #d9ad62 50%, #4ec3ad); }
.battle-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 17px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--line); overflow: hidden; }
.battle-fact { padding: 10px; background: rgba(5,16,23,.9); }
.battle-fact span { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .06em; }
.battle-fact strong { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; font-weight: 500; }

.result-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 17px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.result-banner.success { border-color: rgba(78,195,173,.3); background: var(--teal-dim); }
.result-banner.failure { border-color: rgba(218,104,90,.3); background: var(--crimson-dim); }
.result-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; color: var(--gold); font-family: var(--serif); font-size: 22px; flex: none; }
.result-banner.success .result-mark { color: var(--teal); }
.result-banner.failure .result-mark { color: var(--crimson); }
.result-banner h3 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 400; }
.result-banner p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }

.manual-list { display: grid; gap: 0; margin: 18px 0 0; counter-reset: manual; }
.manual-item { display: grid; grid-template-columns: 35px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.manual-item:first-child { border-top: 0; }
.manual-number { color: var(--gold); font-family: var(--mono); font-size: 9px; letter-spacing: .1em; padding-top: 3px; }
.manual-item h3 { margin: 0 0 3px; font-family: var(--serif); font-size: 20px; font-weight: 400; }
.manual-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--gold);
  border-radius: 7px;
  background: rgba(8, 23, 31, .96);
  box-shadow: var(--shadow-md);
  color: #d7e0dd;
  font-size: 10.5px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in .3s var(--ease) both;
}
.toast.success { border-left-color: var(--teal); }
.toast.error { border-left-color: var(--crimson); }
.toast .toast-mark { color: var(--gold); font-family: var(--mono); font-size: 10px; }
.toast.success .toast-mark { color: var(--teal); }
.toast.error .toast-mark { color: var(--crimson); }
.toast p { margin: 0; }

/* ── Empty, error, and utility states ────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
}
.empty-state svg { width: 31px; color: var(--gold); opacity: .65; }
.empty-state h3 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 400; }
.empty-state p { max-width: 280px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

.busy-overlay { position: relative; pointer-events: none; opacity: .6; }
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.is-loading { opacity: .55; pointer-events: none; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(13px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes crest-breathe { 0%, 100% { opacity: .72; transform: scale(.97); } 50% { opacity: 1; transform: scale(1); } }
@keyframes loading-sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 356px; }
  .map-frame { min-height: 340px; }
  .header-actions { gap: 12px; }
  .wallet-mode { display: none; }
}

@media (max-width: 1080px) {
  .landing {
    grid-template-columns: 1fr;
    gap: 42px;
    padding-top: 54px;
  }
  .landing-copy { max-width: 720px; }
  .landing h1 { font-size: clamp(58px, 10vw, 84px); }
  .landing-visual { max-width: 780px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .feed-panel { height: 100%; }
  .feed-list { max-height: 360px; }
  .map-frame { min-height: 420px; }
}

@media (max-width: 820px) {
  .site-header { min-height: 66px; padding: 9px 17px; }
  .brand-copy strong { font-size: 20px; }
  .brand-copy small { font-size: 7px; }
  .brand-mark { width: 29px; height: 35px; }
  .header-status, .header-manual, .user-copy { display: none; }
  .world-code-chip { display: none; }
  .header-actions { gap: 8px; }
  .header-actions .button-small { display: none; }
  .wallet-chip { padding: 6px 9px; gap: 6px; }
  .wallet-label { display: none; }
  .wallet-chip strong { font-size: 12px; }
  .wallet-chip svg { display: none; }
  .landing { min-height: auto; padding: 36px 18px 44px; }
  .hero-lede { font-size: 14px; }
  .landing-meta { gap: 0; margin-top: 30px; }
  .landing-meta > div { min-width: 0; flex: 1; padding-right: 10px; margin-right: 10px; }
  .landing-meta strong { font-size: 21px; }
  .landing-meta span { font-size: 7px; }
  .landing-stats { left: 11px; right: 11px; bottom: 11px; }
  .landing-stats > div { padding: 8px 8px; }
  .landing-stats span { font-size: 6px; }
  .landing-stats strong { font-size: 10px; }
  .landing-map-head { padding: 17px 17px 5px; }
  .landing-map-head h2 { font-size: 21px; }
  .landing-map-foot { padding: 11px 17px 14px; }
  .landing-map-foot p { font-size: 9px; }
  .feature { padding: 14px; }
  .feature h3 { font-size: 19px; }
  .feature p { font-size: 9px; }
  .dashboard { padding: 21px 12px 50px; }
  .war-room-header { align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .turn-clock { min-width: 0; padding: 8px 10px; gap: 8px; }
  .clock-icon { display: none; }
  .turn-clock span { font-size: 6px; }
  .turn-clock strong { font-size: 13px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { min-height: 94px; padding: 12px 13px; }
  .stat-value { font-size: 21px; }
  .stat-sub { font-size: 8.5px; }
  .panel-heading { padding: 15px 15px; }
  .panel-heading h2 { font-size: 23px; }
  .map-heading-meta .tick-label { display: none; }
  .map-frame { margin: 0 8px; min-height: 0; }
  .map-footer { flex-direction: column; align-items: flex-start; gap: 8px; padding: 11px 13px 14px; }
  .map-hint { display: none; }
  .province-index {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 13px 14px;
  }
  .province-index button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.025);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9px;
    cursor: pointer;
  }
  .province-index button:hover, .province-index button.is-selected { border-color: var(--gold); color: var(--gold-bright); }
  .sidebar { grid-template-columns: 1fr; }
  .feed-list { max-height: 250px; }
  .standings-panel { margin-top: 10px; }
  .standing-row { grid-template-columns: 26px minmax(100px, 1.5fr) repeat(2, minmax(44px, .7fr)); gap: 6px; padding: 8px 12px; }
  .standing-row .standing-cell:nth-child(3) { display: none; }
  .standings-note { display: none; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 11px; padding: 18px; }
  .modal-content { padding: 23px 18px; }
  .modal-content h2 { font-size: 30px; }
  .modal-panel { max-height: 91vh; }
  .battle-facts { grid-template-columns: repeat(2, 1fr); }
  .attack-summary { gap: 6px; }
  .attack-side { padding: 10px 5px; }
  .attack-side strong { font-size: 17px; }
}

@media (max-width: 540px) {
  .brand-copy small { display: none; }
  .header-actions .text-button { display: none; }
  .war-room-heading h1 { font-size: 31px; }
  .party-motto { max-width: 260px; font-size: 11px; }
  .turn-clock { display: none; }
  .landing h1 { font-size: 51px; }
  .hero-kicker { font-size: 8px; letter-spacing: .12em; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .login-note { text-align: left; }
  .link-form { flex-direction: column; }
  .link-form .button { width: 100%; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; }
  .feature-number { grid-row: span 2; margin: 2px 0 0; }
  .landing-meta span { max-width: 70px; line-height: 1.3; }
  .landing-map-foot { gap: 8px; }
  .landing-map-foot .text-button { display: none; }
  .stat-value { font-size: 19px; }
  .stat-top { font-size: 7px; }
  .stat-icon { font-size: 14px; }
  .sidebar-primary h2 { font-size: 25px; }
  .overview-crest { padding: 16px 15px 13px; }
  .overview-body { padding: 13px 15px 16px; }
  .dossier-body { padding: 12px 15px 16px; }
  .owner-ribbon { margin: 12px 15px 0; }
  .sidebar-primary-header { padding: 16px 15px 0; }
  .standing-row { grid-template-columns: 22px minmax(80px, 1.4fr) minmax(38px, .6fr); font-size: 9px; }
  .standing-row .standing-cell:nth-child(4) { display: none; }
  .feed-heading { padding: 14px 15px 10px; }
  .feed-item { padding: 8px 15px; }
  .modal-root { padding: 9px; }
  .modal-panel { max-height: 94vh; border-radius: 14px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .button { width: 100%; }
  .toast-stack { right: 10px; bottom: 10px; }
}

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