/* ============ SCROLLBARS ============ */
/* WebKit / Blink (Chrome, Edge, Safari, Android WebView) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(20, 25, 45, 0.45);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(244,215,94,0.35) 0%, rgba(168,138,48,0.25) 100%);
  border-radius: 4px;
  border: 1px solid rgba(244,215,94,0.18);
  box-shadow: inset 0 1px 0 rgba(255, 235, 170, 0.15);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(244,215,94,0.55) 0%, rgba(168,138,48,0.4) 100%);
  border-color: rgba(244,215,94,0.5);
}
::-webkit-scrollbar-corner {
  background: rgba(20, 25, 45, 0.45);
}
/* Firefox */
* {
  scrollbar-color: rgba(244,215,94,0.4) rgba(20,25,45,0.45);
  scrollbar-width: thin;
}

/* ============ BASE ============ */
:root {
  --bg-0: #06080f;
  --bg-1: #0c1120;
  --bg-2: #131a2e;
  --gold-1: #f4d75e;
  --gold-2: #d4af37;
  --gold-3: #a88a30;
  --gold-glow: rgba(244, 215, 94, 0.35);
  --ink-0: #f5efd9;
  --ink-1: #c8c0a2;
  --ink-2: #8a8470;
  --ocean: #0a1226;
}

html, body, #root {
  height: 100%;
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
}

* { box-sizing: border-box; }

.serif { font-family: 'Cinzel', 'Trajan Pro', Georgia, serif; letter-spacing: 0.08em; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ============ STARFIELD ============ */
.starfield {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(80, 100, 180, 0.18), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(180, 130, 60, 0.10), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 30, 60, 0.4), transparent 70%),
    var(--bg-0);
  overflow: hidden;
}
.starfield::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 23% 65%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 47% 33%, rgba(255,255,255,0.55), transparent 50%),
    radial-gradient(1px 1px at 67% 78%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(1px 1px at 81% 22%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 92% 55%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 34% 88%, rgba(255,255,255,0.45), transparent 50%),
    radial-gradient(1px 1px at 56% 11%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(1.5px 1.5px at 18% 44%, rgba(255,230,180,0.7), transparent 50%),
    radial-gradient(1.5px 1.5px at 74% 36%, rgba(255,230,180,0.6), transparent 50%);
  background-size: 100% 100%;
  opacity: 0.9;
  animation: drift 120s linear infinite;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-40px, -20px); }
}

/* ============ GLASS ============ */
.glass {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 50%, rgba(212,175,55,0.04) 100%);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(244, 215, 94, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 170, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  overflow: hidden;
  /* Tell the browser that internal layout/paint changes don't affect siblings —
     HUD updates won't trigger reflows outside this panel's bounding box. */
  contain: layout style paint;
}

.glass-heavy {
  background:
    linear-gradient(135deg, rgba(20, 25, 45, 0.55) 0%, rgba(10, 14, 28, 0.7) 100%);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(244, 215, 94, 0.22);
  contain: layout style paint;
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 170, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 30px 80px rgba(0, 0, 0, 0.65);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

/* gold corner accents */
.gold-corners::before,
.gold-corners::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gold-2);
  opacity: 0.55;
  pointer-events: none;
}
.gold-corners::before { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.gold-corners::after { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* ============ SHINE SWEEP ============ */
.shine {
  position: relative;
  overflow: hidden;
}
.shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 60%;
  height: 200%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 40%,
    rgba(255, 230, 150, 0.0) 45%,
    rgba(255, 230, 150, 0.18) 50%,
    rgba(255, 230, 150, 0.0) 55%,
    transparent 60%,
    transparent 100%
  );
  transform: skewX(-20deg);
  animation: shine-sweep 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine-sweep {
  0%   { left: -60%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}

/* ============ GOLD BUTTON ============ */
.gold-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-0);
  background:
    linear-gradient(180deg, rgba(244,215,94,0.12) 0%, rgba(168,138,48,0.08) 100%);
  border: 1px solid rgba(244, 215, 94, 0.45);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 170, 0.25),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0,0,0,0.4);
}
@media (hover: hover) {
  .gold-btn:hover {
    border-color: rgba(244, 215, 94, 0.85);
    background:
      linear-gradient(180deg, rgba(244,215,94,0.22) 0%, rgba(168,138,48,0.14) 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 235, 170, 0.4),
      inset 0 -1px 0 rgba(0,0,0,0.3),
      0 10px 30px rgba(0, 0, 0, 0.5),
      0 0 22px rgba(244, 215, 94, 0.25),
      0 0 0 1px rgba(0,0,0,0.4);
    color: #fff8dc;
  }
  .gold-btn:hover::after { left: 130%; }
  .gold-btn.ghost:hover {
    border-color: rgba(244, 215, 94, 0.6);
    color: var(--ink-0);
    background: rgba(244, 215, 94, 0.05);
  }
}
.gold-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 70%; height: 100%;
  background: linear-gradient(100deg, transparent 0%, rgba(255,235,170,0.35) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left 0.7s ease;
}
.gold-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.gold-btn.ghost {
  background: transparent;
  border-color: rgba(244, 215, 94, 0.25);
  color: var(--ink-1);
}

/* ============ FILTER CHIP ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-1);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(244,215,94,0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
@media (hover: hover) {
  .chip:hover {
    border-color: rgba(244,215,94,0.4);
    color: var(--ink-0);
    background: rgba(244,215,94,0.05);
  }
}
.chip.active {
  background: linear-gradient(180deg, rgba(244,215,94,0.22), rgba(168,138,48,0.12));
  border-color: rgba(244,215,94,0.7);
  color: #fff8dc;
  box-shadow: inset 0 1px 0 rgba(255,235,170,0.3), 0 0 16px rgba(244,215,94,0.2);
}

/* ============ GROUP TAB ============ */
.tab {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-1);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
@media (hover: hover) {
  .tab:hover {
    background: rgba(244,215,94,0.06);
    border-color: rgba(244,215,94,0.25);
    color: var(--ink-0);
  }
}
.tab.has-active {
  border-color: rgba(244,215,94,0.35);
  color: var(--gold-2);
}
.tab.active {
  background: linear-gradient(180deg, #f7dd72 0%, #c9a23c 100%);
  border-color: #f4d75e;
  color: #0a0d18;
  box-shadow: 0 0 14px rgba(244,215,94,0.45), inset 0 1px 0 rgba(255,255,255,0.45);
}
.chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ============ DIVIDER ============ */
.gold-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244,215,94,0.5), transparent);
  margin: 16px 0;
}

/* ============ NUMBER DISPLAY ============ */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
}
.stat-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  color: var(--ink-0);
  letter-spacing: 0.04em;
}
.stat-value .unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-2);
  margin-left: 6px;
  letter-spacing: 0.1em;
}

/* ============ MAP CANVAS ============ */
#phaser-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#phaser-container canvas {
  display: block !important;
}

/* graticule overlay */
.graticule {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(244,215,94,0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(244,215,94,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mix-blend-mode: screen;
  opacity: 0.5;
}

/* vignette — base darkening at corners */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
}

/* atmosphere — soft warm centre glow + cool rim. Layered above vignette;
   suggests a curved-globe lighting model with zero JS cost. */
.atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%,
      rgba(244,215,94,0.06) 0%,
      rgba(244,215,94,0.02) 35%,
      transparent 60%),
    radial-gradient(ellipse 110% 110% at 50% 100%,
      rgba(78,128,184,0.10) 0%,
      transparent 55%);
  mix-blend-mode: screen;
}

/* a slow background drift — pure GPU, runs only on hover-capable devices
   to keep mobile batteries happy. */
@media (hover: hover) {
  .atmosphere::after {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at 35% 30%,
      rgba(255,255,255,0.04) 0%, transparent 30%);
    animation: atmosphere-drift 50s ease-in-out infinite alternate;
  }
}
@keyframes atmosphere-drift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(6%, 4%); }
}

/* Accessibility — visible focus ring only for keyboard users (not mouse).
   Gold ring at 2px offset so it never overlaps the existing button border. */
:focus-visible {
  outline: 2px solid rgba(244,215,94,0.85);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible {
  outline: 2px solid rgba(244,215,94,0.85);
  outline-offset: 2px;
}

/* 3D-tilt: subtle perspective skew on the entire map container. Opt-in via
   Settings → 3D tilt. May slightly offset click hit-testing because Phaser
   doesn't read CSS transforms; off by default. */
.map-tilt {
  perspective: 2400px;
  perspective-origin: 50% 30%;
}
.map-tilt #phaser-container {
  transform: rotateX(6deg) scale(1.03);
  transform-origin: 50% 60%;
  transition: transform 0.4s ease;
}

/* Topographic noise — paper-grain pattern below the map for subtle organic
   terrain feel. SVG fractal noise, embedded as data-URI so it ships in CSS
   with zero asset overhead. */
#phaser-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* ============ COUNTRY DETAIL SLIDE ============ */
.slide-in-right {
  animation: slideRight 0.35s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes slideRight {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Panels that slide up + fade into place — used by the floating hover
   card and any other transient bottom-anchored card. */
.panel-rise {
  animation: panelRise 0.22s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes panelRise {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* Interactive HUD chips — soft gold wash + 1px lift so the user
   can feel which chips are actionable vs read-only. */
.chip-interactive {
  transition: background 120ms ease, transform 120ms ease,
              box-shadow 120ms ease;
}
.chip-interactive:hover {
  background: rgba(244,215,94,0.08) !important;
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(244,215,94,0.18) inset;
}
.chip-interactive:active { transform: translateY(0); }

/* Vertical rail "hide" tab — pulse a faint gold glow on hover so the
   tab reads as a drag-handle rather than a passive label. */
.rail-tab {
  transition: background 150ms ease, box-shadow 150ms ease,
              color 150ms ease, transform 150ms ease;
  box-shadow: 0 0 0 rgba(244,215,94,0);
}
.rail-tab:hover {
  background: rgba(12,18,38,0.92) !important;
  color: #fff8d6 !important;
  box-shadow: 2px 0 18px rgba(244,215,94,0.35),
              inset 0 0 12px rgba(244,215,94,0.18);
  transform: translateX(2px);
}

/* ============ LEGEND GRADIENT ============ */
.legend-grad {
  width: 200px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(244,215,94,0.2);
}

/* ============ TICKER ============ */
.ticker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-2);
  letter-spacing: 0.15em;
}

/* ============ MENU TITLE FX ============ */
.title-fx {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  background: linear-gradient(180deg, #fff8dc 0%, #f4d75e 45%, #a88a30 55%, #fff8dc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(244,215,94,0.25));
  letter-spacing: 0.18em;
}

.subtitle {
  color: var(--ink-2);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 11px;
}

/* compass spinner */
.compass-ring {
  width: 12px;
  height: 12px;
  border: 1px solid var(--gold-2);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 2.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* small flag pulse */
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-1);
  box-shadow: 0 0 0 0 rgba(244,215,94,0.7);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(244,215,94,0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(244,215,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(244,215,94,0); }
}

/* loading bar */
.load-bar {
  height: 2px;
  width: 240px;
  background: rgba(244,215,94,0.1);
  overflow: hidden;
  border-radius: 2px;
}
.load-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold-1), transparent);
  animation: load 1.6s ease-in-out infinite;
}
@keyframes load {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}


/* ========== v6: Crisis modal, action panel, alliance overlay ========== */
.crisis-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(6,8,15,0.55) 0%, rgba(6,8,15,0.92) 70%);
  backdrop-filter: blur(6px) saturate(1.1);
}
.crisis-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(232,90,79,0.08) 90%);
}
.crisis-modal {
  position: relative;
  width: min(720px, 92vw);
  max-height: 88vh;
  padding: 28px 32px;
  overflow-y: auto;
  animation: crisis-in 0.35s cubic-bezier(.2,.7,.3,1.1);
}
@keyframes crisis-in {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.crisis-choice {
  width: 100%; text-align: left;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(244,215,94,0.18);
  border-radius: 4px;
  padding: 14px 16px;
  color: var(--ink-1);
  font-family: Inter, sans-serif;
  transition: all 0.18s ease;
}
@media (hover: hover) {
  .crisis-choice:hover:not(:disabled) {
    background: rgba(244,215,94,0.06);
    border-color: rgba(244,215,94,0.5);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(244,215,94,0.08);
  }
}
.crisis-choice.picked {
  background: rgba(244,215,94,0.08);
  border-color: rgba(244,215,94,0.6);
  box-shadow: 0 0 24px rgba(244,215,94,0.18);
}
.crisis-choice-icon {
  width: 36px; height: 36px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(244,215,94,0.08);
  border: 1px solid rgba(244,215,94,0.25);
  color: var(--gold-2);
  font-size: 18px;
  flex-shrink: 0;
}
.effect-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(244,215,94,0.12);
}

/* Action tiles in country dossier */
.action-tile {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(244,215,94,0.15);
  border-radius: 3px;
  padding: 8px 10px;
  text-align: left;
  transition: all 0.15s ease;
  color: var(--ink-1);
}
@media (hover: hover) {
  .action-tile:hover:not(:disabled) {
    background: rgba(244,215,94,0.07);
    border-color: rgba(244,215,94,0.45);
  }
}
.action-feedback {
  font-size: 10px; color: var(--ink-1);
  font-style: italic; line-height: 1.5;
  padding: 8px 10px;
  background: rgba(122,200,138,0.05);
  border: 1px solid rgba(122,200,138,0.2);
  border-radius: 3px;
}


/* ========== v7: faction picker, toasts, score panel ========== */
.faction-card {
  padding: 18px 18px 16px;
  background: rgba(12,18,38,0.55);
  border: 1px solid rgba(244,215,94,0.18);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
@media (hover: hover) {
  .faction-card:hover {
    background: rgba(12,18,38,0.75);
    transform: translateY(-2px);
  }
}
.faction-card.active {
  background: rgba(12,18,38,0.85);
}
.toast {
  animation: toast-in 0.35s cubic-bezier(.2,.7,.3,1.1);
  pointer-events: auto;
}
@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}


/* country picker rows */
.country-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
  width: 100%;
}
@media (hover: hover) {
  .country-row:hover {
    background: rgba(244,215,94,0.05);
    border-color: rgba(244,215,94,0.18);
  }
}
.country-row.active {
  background: rgba(244,215,94,0.1);
  border-color: rgba(244,215,94,0.45);
  box-shadow: inset 0 0 12px rgba(244,215,94,0.08);
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,215,94,0.0); }
  50%      { box-shadow: 0 0 18px 2px rgba(244,215,94,0.45); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,116,116,0.0); }
  50%      { box-shadow: 0 0 18px 3px rgba(224,116,116,0.55); }
}

/* Milestone celebration — fullscreen pop with radial sparkle. */
@keyframes milestone-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes milestone-pop {
  0%   { transform: scale(0.86); opacity: 0; }
  60%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1.00); opacity: 1; }
}
@keyframes milestone-glow {
  0%   { opacity: 0; transform: scale(0.6); }
  20%  { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* Advisor shine — diagonal sweep in the source advisor's accent
   color, played once when the Cabinet opens from a briefing. Sets up
   the visual "you came from this advisor" trail without a button. */
.advisor-shine::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 60%;
  height: 200%;
  background: linear-gradient(
    115deg,
    transparent 0%,
    var(--shine-accent, #f4d75e) 50%,
    transparent 100%
  );
  opacity: 0.18;
  filter: blur(8px);
  transform: translateX(0);
  animation: advisor-shine-sweep 1500ms ease-out 1 forwards;
}
.advisor-shine::after {
  content: '';
  position: absolute;
  inset: 0;
  border-left: 2px solid var(--shine-accent, #f4d75e);
  opacity: 0.42;
  pointer-events: none;
  border-radius: inherit;
}
@keyframes advisor-shine-sweep {
  0%   { transform: translateX(0);    opacity: 0; }
  20%  { opacity: 0.28; }
  100% { transform: translateX(260%); opacity: 0; }
}

@keyframes floater-pop {
  0%   { transform: translate(-50%, 0)   scale(0.8); opacity: 0; }
  15%  { transform: translate(-50%, -6px) scale(1.05); opacity: 1; }
  85%  { transform: translate(-50%, -28px) scale(1);   opacity: 1; }
  100% { transform: translate(-50%, -36px) scale(0.95); opacity: 0; }
}

/* Turn-advance flourish: a thin golden line that sweeps once across the
   viewport, picking up a soft glow. The element is positioned fixed by
   the React component; the animation runs and the element re-mounts on
   each turn via React's key prop. */
.turn-sweep::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(244,215,94,0)   30%,
    rgba(244,215,94,0.35) 50%,
    rgba(244,215,94,0)   70%,
    transparent 100%);
  transform: translateX(-100%);
  animation: turn-sweep-anim 1.0s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  mix-blend-mode: screen;
}
@keyframes turn-sweep-anim {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%);  }
}

@keyframes digest-pop {
  0%   { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}
@keyframes digest-fade {
  0%, 70% { opacity: 1; }
  100%    { opacity: 0; }
}

/* Big floating Next-Turn CTA. Pulse-state gets a slow gold glow so it's
   unmissable; blocked-state is static red. Hover lifts the button by a few
   pixels for tactile feedback. Active state presses it back down. */
.next-turn-cta.pulse {
  animation: next-turn-pulse 2.4s ease-in-out infinite;
}
@keyframes next-turn-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(244,215,94,0.32), inset 0 1px 0 rgba(255,255,255,0.25); }
  50%      { box-shadow: 0 6px 28px rgba(244,215,94,0.55), inset 0 1px 0 rgba(255,255,255,0.30); }
}
@media (hover: hover) {
  .next-turn-cta:not(.blocked):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(244,215,94,0.6), inset 0 1px 0 rgba(255,255,255,0.35);
  }
}
.next-turn-cta:not(.blocked):active {
  transform: translateY(1px);
}

/* Custom hover tooltip — replaces native title= on buttons that need
   an immediate, theme-matched hint. Use data-tip="..." on the element
   (button, link, span); the tooltip appears on hover without OS delay
   and styled to match the gold-on-dark theme. No JS required.

   For accessibility, pair with aria-label so screen readers still
   announce the hint — data-* attributes are not announced. */
[data-tip] {
  position: relative;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  min-width: 0;
  max-width: 280px;
  padding: 3px 8px;
  background: rgba(20, 24, 38, 0.72);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(244, 215, 94, 0.22);
  border-radius: 2px;
  color: var(--ink-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
  text-transform: none;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: data-tip-in 0.12s ease-out;
}
@keyframes data-tip-in {
  from { opacity: 0; transform: translate(-50%, 3px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Tutorial coach-mark ring pulses to draw the eye to its target. */
@keyframes tutorial-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(244,215,94,0.12), 0 0 26px rgba(244,215,94,0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(244,215,94,0.20), 0 0 38px rgba(244,215,94,0.78); }
}


/* ========== v8: universal polish pass ========== */
/* Pure presentation — embossed surfaces. Only background-image, inset
   box-shadow and text-shadow are touched; nothing in the box model
   changes, so every layout is pixel-identical. */

/* Embossed tiles — flat fills become top-lit plaques. The lift is an
   inset highlight (top) + inset shadow (bottom); both inset, so the
   footprint never grows. */
.action-tile,
.crisis-choice {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.012) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.30);
}
.action-tile:hover:not(:disabled) {
  background-image: linear-gradient(180deg, rgba(244,215,94,0.14) 0%, rgba(244,215,94,0.035) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.16),
    inset 0 -1px 0 rgba(0,0,0,0.28);
}
.crisis-choice:hover:not(:disabled) {
  background-image: linear-gradient(180deg, rgba(244,215,94,0.13) 0%, rgba(244,215,94,0.035) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.16),
    0 6px 18px rgba(244,215,94,0.10);
}
.crisis-choice.picked {
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.20),
    0 0 24px rgba(244,215,94,0.18);
}

/* Effect chips + faction cards — a lighter version of the same lift. */
.effect-chip {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
  box-shadow: inset 0 1px 0 rgba(255,235,170,0.08);
}
.faction-card {
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.35),
    0 6px 22px rgba(0,0,0,0.40);
}

/* Crisis-choice glyph box — embossed to match its parent tile. */
.crisis-choice-icon {
  background-image: linear-gradient(180deg, rgba(244,215,94,0.16) 0%, rgba(244,215,94,0.04) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.22),
    inset 0 -1px 0 rgba(0,0,0,0.30);
}

/* Filter chips — a hairline top highlight so the dense HUD reads as
   physical pieces rather than printed labels. */
.chip {
  box-shadow: inset 0 1px 0 rgba(255,235,170,0.05);
}

/* Engraved divider — a dark groove just under the gold hairline. */
.gold-rule {
  box-shadow: 0 1px 0 rgba(0,0,0,0.45);
}

/* Stat numerals pick up a faint warm bloom. */
.stat-value {
  text-shadow: 0 0 14px rgba(244,215,94,0.14);
}

/* Non-interactive embossed tile — the same plaque lift as .action-tile
   but without the cursor / hover affordance. For stat read-outs that
   were previously flat inline-styled blocks. */
.tile {
  background-color: rgba(255,255,255,0.022);
  background-image: linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.012) 100%);
  border: 1px solid rgba(244,215,94,0.14);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.30);
}


/* ========== v9: control tactility pass ========== */
/* Press feedback — gold buttons, chips and tabs physically depress on
   click/tap; gold buttons also lift a hair on hover. Momentary
   transforms on small elements only — no compositing layers, no
   backdrop-filter. :active sits outside the hover media query so a
   touch tap gets the same feedback as a mouse click. */
.gold-btn {
  transition: background 0.3s ease, border-color 0.3s ease,
              box-shadow 0.3s ease, color 0.3s ease,
              opacity 0.3s ease, transform 0.09s ease;
}
@media (hover: hover) {
  .gold-btn:not([disabled]):hover { transform: translateY(-1px); }
}
.gold-btn:not([disabled]):active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.42),
    inset 0 1px 0 rgba(255,235,170,0.12),
    0 1px 4px rgba(0,0,0,0.35),
    0 0 0 1px rgba(0,0,0,0.4);
}
.chip, .tab {
  transition: background 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease,
              transform 0.08s ease;
}
.chip:active, .tab:active { transform: translateY(1px); }


/* ========== v10: main-menu finish ========== */
/* Title type gets a crisp dark carve beneath a softer gold glow, so
   "Atlas Mundi" reads as struck metal rather than flat gradient text.
   Stacked drop-shadows on the existing filter — no new layers. */
.title-fx {
  filter:
    drop-shadow(0 1px 0 rgba(0,0,0,0.55))
    drop-shadow(0 3px 12px rgba(244,215,94,0.30));
}


/* ========== v11: modal depth (paint only) ========== */
/* Re-do of the reverted modal-depth pass — this time WITHOUT touching
   backdrop-filter. The earlier version added/raised backdrop-filter
   and broke GPU layer compositing over the Phaser canvas. Here only
   paint changes: the overlay backdrop darkens and the modal gains a
   longer drop shadow plus a faint gold rim. .crisis-overlay's
   pre-existing blur is deliberately left exactly as-is. */
.crisis-overlay {
  background: radial-gradient(ellipse at center,
    rgba(6,8,15,0.72) 0%, rgba(4,6,12,0.96) 78%);
}
.crisis-modal {
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,0.24),
    inset 0 -1px 0 rgba(0,0,0,0.45),
    0 40px 100px rgba(0,0,0,0.72),
    0 0 0 1px rgba(244,215,94,0.08);
}
