/* UK Geography & Election Hex Quiz - Modern Cartographic Dark Theme */
:root {
  --bg-primary: #070d1e;
  --bg-secondary: #0f1a36;
  --bg-card: rgba(18, 29, 58, 0.85);
  --bg-card-border: rgba(99, 140, 230, 0.25);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --crimson: #ef4444;
  --crimson-glow: rgba(239, 68, 68, 0.35);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --purple: #a855f7;

  /* Party Colors */
  --party-labour: #e4003b;
  --party-conservative: #0087dc;
  --party-libdem: #faa61a;
  --party-green: #52ca00;
  --party-reform: #12b6cf;
  --party-other: #8b5cf6;
  --party-snp: #fdf38e;
  --party-plaid: #3f8428;
  --party-sinnfein: #326760;
  --party-dup: #d46a4c;
  --party-sdlp: #2aa82c;
  --party-alliance: #f6cb2f;
  --party-uup: #4890d2;
  --party-tuv: #0c3a66;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Cinzel', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-family: var(--font-sans);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--bg-card-border);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 20%, #112046 0%, var(--bg-primary) 70%);
  color: var(--text-main);
  user-select: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ==================== TOP HUD HEADER ==================== */
.top-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(11, 20, 42, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-card-border);
  z-index: 40;
  gap: 10px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.title-wrap h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-wrap .route-indicator {
  font-size: 0.76rem;
  color: var(--cyan);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Constituency Search Input */
.constituency-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.constituency-search-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-full);
  padding: 5px 12px 5px 28px;
  font-size: 0.78rem;
  color: #ffffff;
  outline: none;
  width: 170px;
  transition: all 0.2s ease;
}

.constituency-search-input:focus {
  width: 210px;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--cyan);
}

.constituency-search-icon {
  position: absolute;
  left: 9px;
  pointer-events: none;
  font-size: 0.75rem;
  opacity: 0.7;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 240px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  margin-top: 6px;
  box-shadow: var(--shadow-card);
  z-index: 60;
  display: none;
}

.search-results-dropdown.visible {
  display: block;
}

.search-result-item {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.04);
}

/* Roll Journey Dice Button */
.dice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
  border: 1px solid rgba(199, 210, 254, 0.4);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dice-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%);
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.55);
}

.dice-btn:active {
  transform: translateY(0) scale(0.98);
}

.dice-btn-icon {
  font-size: 1.05rem;
  display: inline-block;
  animation: diceWiggle 3.5s ease-in-out infinite;
}

@keyframes diceWiggle {
  0%, 82%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-16deg); }
  92% { transform: rotate(16deg); }
}

/* Secondary Sub-Bar (Stats HUD) */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 14px;
  background: rgba(15, 26, 54, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
  z-index: 30;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label {
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.stat-val {
  font-weight: 700;
  color: var(--text-main);
}

.lives-hearts {
  color: var(--crimson);
  letter-spacing: 2px;
}

/* ==================== MAP VIEWPORT ==================== */
.map-container {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
  background-color: #020511;
  background-image: 
    radial-gradient(rgba(56, 189, 248, 0.08) 1.2px, transparent 1.2px),
    radial-gradient(ellipse at 50% 48%, #0d1e4c 0%, #08122d 42%, #030715 80%, #01030a 100%);
  background-size: 32px 32px, 100% 100%;
}

.hex-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Atmospheric Cartography Layers */
.layer-cartography {
  pointer-events: none;
  user-select: none;
}

.carto-graticule {
  fill: none;
  stroke: rgba(56, 189, 248, 0.1);
  stroke-width: 0.9;
  stroke-dasharray: 6 5;
}

.carto-meridian {
  stroke: rgba(245, 158, 11, 0.22);
  stroke-width: 1.3;
  stroke-dasharray: 8 4;
}

.carto-graticule-label {
  fill: rgba(148, 163, 184, 0.38);
  font-size: 8px;
  font-weight: 600;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: 0.5px;
}

.carto-sea-label {
  fill: rgba(148, 163, 184, 0.16);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 7px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  text-transform: uppercase;
}

.carto-sea-sm {
  font-size: 10.5px;
  letter-spacing: 4.5px;
}

.carto-region-title {
  fill: rgba(255, 255, 255, 0.11);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 6px;
  text-anchor: middle;
  text-transform: uppercase;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

.carto-region-sm {
  font-size: 9px;
  letter-spacing: 3.5px;
}

/* Vector Compass Rose */
.carto-compass-rose {
  opacity: 0.85;
}

.compass-ring-outer {
  fill: none;
  stroke: rgba(56, 189, 248, 0.35);
  stroke-width: 1.4;
}

.compass-ring-inner {
  fill: rgba(8, 18, 45, 0.45);
  stroke: rgba(245, 158, 11, 0.3);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.compass-tick {
  stroke: rgba(56, 189, 248, 0.45);
  stroke-width: 1.2;
}

.compass-hub {
  fill: #38bdf8;
  stroke: #f59e0b;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 5px #38bdf8);
}

.compass-lbl {
  fill: rgba(148, 163, 184, 0.75);
  font-size: 8px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  text-anchor: middle;
}

.compass-lbl-n {
  fill: #f59e0b;
  font-size: 10px;
  font-weight: 900;
}

/* Scale Bar */
.carto-scale-bar {
  opacity: 0.75;
}

.scale-line {
  stroke: rgba(148, 163, 184, 0.45);
  stroke-width: 1.5;
}

.scale-label {
  fill: rgba(148, 163, 184, 0.55);
  font-size: 7.5px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  text-anchor: middle;
}

/* Active Trajectory Line */
.flight-trajectory-path {
  fill: none;
  stroke: url(#grad-flight-path);
  stroke-width: 2.8;
  stroke-dasharray: 8 5;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7));
  pointer-events: none;
  animation: flightDash 28s linear infinite;
}

@keyframes flightDash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Hex Tiles SVG Styling */
.hex-link-line {
  stroke: rgba(148, 163, 184, 0.14);
  stroke-width: 2.2;
  stroke-dasharray: 4 3;
}

/* Maritime Ferry Routes */
.hex-ferry-line {
  stroke: rgba(56, 189, 248, 0.55);
  stroke-width: 2.6;
  stroke-dasharray: 7 4;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
  animation: ferryDash 18s linear infinite;
  pointer-events: none;
}

@keyframes ferryDash {
  to {
    stroke-dashoffset: -400;
  }
}

.ferry-icon-watermark {
  font-size: 12px;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.9));
}

.hex-tile {
  cursor: pointer;
}

.hex-coast-halo {
  fill: rgba(56, 189, 248, 0.04);
  stroke: rgba(56, 189, 248, 0.14);
  stroke-width: 3.2;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.3));
  pointer-events: none !important;
}

.hex-bevel-glare {
  pointer-events: none !important;
  opacity: 0.9;
}

.hex-polygon {
  fill: #131f42;
  stroke: #2a3e6f;
  stroke-width: 1.8;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
  pointer-events: auto;
}

/* Regional Border Accents & Subtle Fills */
.hex-tile.hex-region-scotland .hex-polygon {
  stroke: #25447a;
}

.hex-tile.hex-region-wales .hex-polygon {
  stroke: #1e5244;
}

.hex-tile.hex-region-ni .hex-polygon {
  stroke: #1e5850;
}

.hex-tile.hex-region-london .hex-polygon {
  stroke: #5c4524;
}

.hex-tile.hex-region-north .hex-polygon {
  stroke: #283a69;
}

.hex-tile.hex-region-midlands .hex-polygon {
  stroke: #2d3e75;
}

.hex-tile.hex-region-south .hex-polygon {
  stroke: #24355f;
}

.hex-tile:hover .hex-polygon {
  stroke: #38bdf8 !important;
  stroke-width: 2.6 !important;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7)) !important;
}

.hex-code {
  fill: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none !important;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.hex-code-sm {
  font-size: 7.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.hex-subtext {
  fill: #94a3b8;
  font-size: 9.5px;
  font-weight: 500;
  pointer-events: none !important;
}

.hex-badge {
  font-size: 12px;
  pointer-events: none !important;
}

.hex-stripes-overlay {
  display: none;
  pointer-events: none !important;
}

.hex-beacon-ring,
.hex-marker-icon {
  pointer-events: none !important;
}

/* ==================== BEACON PULSE WAVES & MARKERS ==================== */
.hex-beacon-ring {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

.hex-beacon-ring.beacon-start {
  stroke: #10b981;
  filter: url(#glow-emerald);
  animation: beaconWaveStart 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.hex-beacon-ring.beacon-target {
  stroke: #f59e0b;
  filter: url(#glow-gold);
  animation: beaconWaveTarget 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.hex-beacon-ring.beacon-current {
  stroke: #06b6d4;
  filter: url(#glow-cyan);
  animation: beaconWaveStart 1.9s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes beaconWaveStart {
  0% {
    r: 16;
    stroke-opacity: 0.95;
    stroke-width: 3.5;
  }
  65% {
    stroke-opacity: 0.4;
  }
  100% {
    r: 46;
    stroke-opacity: 0;
    stroke-width: 0.5;
  }
}

@keyframes beaconWaveTarget {
  0% {
    r: 16;
    stroke-opacity: 1;
    stroke-width: 4;
  }
  65% {
    stroke-opacity: 0.45;
  }
  100% {
    r: 50;
    stroke-opacity: 0;
    stroke-width: 0.5;
  }
}

.hex-marker-icon {
  font-size: 16px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
  pointer-events: none;
  animation: floatMarker 2.2s ease-in-out infinite alternate;
}

@keyframes floatMarker {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* Hex States */
.hex-tile.hex-start .hex-polygon {
  fill: #064e3b;
  stroke: #10b981;
  stroke-width: 3.8;
  filter: url(#glow-emerald);
  animation: startBeaconPulse 1.8s infinite alternate ease-in-out;
}

@keyframes startBeaconPulse {
  0% { stroke: #10b981; stroke-width: 3.2; filter: drop-shadow(0 0 6px #10b981); }
  100% { stroke: #34d399; stroke-width: 5; filter: drop-shadow(0 0 16px #34d399); }
}

.hex-tile.hex-start .hex-code {
  fill: #a7f3d0;
  font-weight: 800;
}

.hex-tile.hex-target .hex-polygon {
  fill: #451a03;
  stroke: #f59e0b;
  stroke-width: 4;
  filter: url(#glow-gold);
  animation: targetBeaconPulse 1.6s infinite alternate ease-in-out;
}

@keyframes targetBeaconPulse {
  0% { stroke: #d97706; stroke-width: 3.2; filter: drop-shadow(0 0 8px #f59e0b); }
  100% { stroke: #fbbf24; stroke-width: 5.4; filter: drop-shadow(0 0 20px #f59e0b); }
}

.hex-tile.hex-target .hex-code {
  fill: #fef08a;
  font-weight: 800;
}

.hex-tile.hex-current .hex-polygon {
  fill: #0c4a6e;
  stroke: var(--cyan);
  stroke-width: 4;
  filter: url(#glow-cyan);
  animation: currentPulse 2s infinite ease-in-out;
}

@keyframes currentPulse {
  0%, 100% { stroke-width: 3.5; }
  50% { stroke-width: 5.2; filter: drop-shadow(0 0 12px var(--cyan)); }
}

.hex-tile.hex-current .hex-code {
  fill: #38bdf8;
}

.hex-tile.hex-visited .hex-polygon {
  fill: #064e3b;
  stroke: var(--emerald);
  stroke-width: 2.6;
  filter: url(#glow-emerald);
}

.hex-tile.hex-visited .hex-code {
  fill: #a7f3d0;
}

.hex-tile.hex-blocked .hex-polygon {
  fill: #450a0a;
  stroke: var(--crimson);
  stroke-width: 2.8;
}

.hex-tile.hex-blocked .hex-stripes-overlay {
  display: block;
}

.hex-tile.hex-blocked .hex-code {
  fill: #fca5a5;
  text-decoration: line-through;
}

.hex-tile.hex-selectable .hex-polygon {
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-dasharray: 6 3;
  animation: selectablePulse 1.5s infinite ease-in-out;
}

@keyframes selectablePulse {
  0%, 100% { stroke: #f59e0b; }
  50% { stroke: #fbbf24; stroke-width: 3.5; }
}

/* Election Filled Hexes */
.hex-tile.hex-party-filled .hex-polygon {
  stroke-width: 2;
  stroke: rgba(255, 255, 255, 0.4);
}

.hex-tile.hex-party-filled .hex-code {
  fill: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.hex-tile.hex-party-filled .hex-subtext {
  fill: #ffffff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Floating Map Controls */
.floating-map-controls {
  position: absolute;
  right: 14px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
}

.map-ctrl-btn {
  background: rgba(15, 26, 54, 0.85);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s;
}

.map-ctrl-btn:hover {
  background: rgba(30, 48, 96, 0.95);
  transform: scale(1.06);
}

.map-ctrl-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(56, 189, 248, 0.3));
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.hex-tile.hex-heatmap-tile .hex-polygon {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.6;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* Region Quick Jump Navigation Chips */
.region-nav-chips {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(11, 19, 43, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 25;
  max-width: calc(100vw - 230px);
  overflow-x: auto;
  scrollbar-width: none;
}

.region-nav-chips::-webkit-scrollbar {
  display: none;
}

.region-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.18s ease;
}

.region-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.region-chip.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(59, 130, 246, 0.3));
  color: #38bdf8;
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

@media (max-width: 820px) {
  .region-nav-chips {
    top: 50px;
    left: 14px;
    right: auto;
    max-width: calc(100vw - 28px);
  }
}

/* Floating Interactive Hex Tooltip */
.hex-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  min-width: 190px;
  max-width: 280px;
  background: rgba(8, 14, 34, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 16px rgba(56, 189, 248, 0.2);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: #ffffff;
  opacity: 1;
  transition: opacity 0.12s ease;
}

.hex-tooltip.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.hex-tooltip-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
  line-height: 1.25;
}

.hex-tooltip-region {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.hex-tooltip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hex-tooltip-detail {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 5px;
}

/* County Hover Tooltip & Sized Flag Thumbnail */
.county-tooltip {
  max-width: 320px !important;
  min-width: 220px !important;
  overflow: hidden;
}

.tooltip-flag-thumb {
  width: 36px !important;
  height: 24px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  object-fit: cover !important;
  border-radius: 4px;
  border: 1.5px solid #fbbf24;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  display: block !important;
  flex-shrink: 0 !important;
}

/* Route Info Pill */
.route-pill {
  position: absolute;
  top: 12px;
  left: 14px;
  background: rgba(15, 26, 54, 0.85);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 25;
}

/* ==================== BOTTOM INTERACTIVE ACTION SHEET ==================== */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--bg-card-border);
  border-left: 1px solid var(--bg-card-border);
  border-right: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 20px 22px;
  box-shadow: var(--shadow-card);
  z-index: 50;
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-sheet.hidden {
  transform: translateY(110%);
  pointer-events: none;
}

.bottom-sheet.is-floating {
  position: fixed !important;
  bottom: auto !important;
  right: auto !important;
  margin: 0 !important;
  width: min(640px, calc(100vw - 24px));
  border-radius: var(--radius-lg);
  border-bottom: 1px solid var(--bg-card-border);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--cyan);
  transition: box-shadow 0.2s ease;
  z-index: 60;
}

.sheet-drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin: -10px -12px 12px -12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.sheet-drag-handle:active {
  cursor: grabbing;
  background: rgba(56, 189, 248, 0.08);
}

.sheet-handle-pill {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  transition: background 0.2s, transform 0.2s;
}

.sheet-drag-handle:hover .sheet-handle-pill {
  background: var(--cyan);
  transform: scaleX(1.15);
}

.sheet-drag-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-drag-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.btn-dock-sheet {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dock-sheet:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  transform: scale(1.04);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  margin: 0 auto 12px;
}

/* Population Higher/Lower Question Card */
.question-header {
  text-align: center;
  margin-bottom: 12px;
}

.question-pretitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.question-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.comparison-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  gap: 12px;
}

.comp-box {
  flex: 1;
}

.comp-box.left {
  text-align: left;
}

.comp-box.right {
  text-align: right;
}

.comp-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.comp-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.comp-pop {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cyan);
  margin-top: 2px;
}

.comp-vs {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.trivia-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin-bottom: 14px;
}

/* Higher/Lower Action Buttons */
.hl-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hl-btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 10px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hl-btn.higher {
  background: linear-gradient(135deg, #10b981, #059669);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.hl-btn.higher:hover, .hl-btn.higher:active {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--emerald-glow);
}

.hl-btn.lower {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.hl-btn.lower:hover, .hl-btn.lower:active {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.hl-btn .btn-arrow {
  font-size: 1.4rem;
}

.hl-btn .btn-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
}

/* ==================== ELECTION MODE PARTY SELECTOR ==================== */
.party-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.party-pick-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.party-pick-btn:hover, .party-pick-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.party-color-indicator {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
}

/* Result Reveal Box inside sheet */
.result-reveal {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-reveal.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald);
  color: #6ee7b7;
}

.result-reveal.failure {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--crimson);
  color: #fca5a5;
}

.result-reveal-header {
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* MP Official Portrait Card */
.mp-portrait-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 6px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.mp-photo-wrap {
  width: 78px;
  height: 78px;
  border-radius: var(--radius-full);
  border: 3px solid var(--cyan);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #081026;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(0, 0, 0, 0.4);
  position: relative;
}

.mp-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--radius-full);
  image-rendering: -webkit-optimize-contrast;
  display: block;
  transition: transform 0.25s ease;
}

.mp-photo-wrap:hover .mp-portrait-img {
  transform: scale(1.06);
}

.mp-portrait-fallback {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  letter-spacing: -1px;
}

.mp-info-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mp-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.mp-party-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  width: fit-content;
  margin-top: 1px;
}

.mp-majority {
  font-size: 0.76rem;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Westminster Political Lore & Insights Card */
.political-lore-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(135deg, rgba(20, 30, 55, 0.78) 0%, rgba(10, 18, 38, 0.9) 100%);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-left: 4px solid #fbbf24;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 8px 0 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  animation: fadeInLore 0.3s ease-out;
  text-align: left;
}

@keyframes fadeInLore {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lore-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lore-headline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fbbf24;
}

.lore-type-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(251, 191, 36, 0.15);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.lore-content {
  font-size: 0.84rem;
  line-height: 1.44;
  color: #e2e8f0;
}

.lore-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.lore-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.70rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.lore-chip.highlight {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

/* Heritage & Founding Banner */
.heritage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  margin: 4px 0 6px 0;
  font-size: 0.76rem;
  color: #fde68a;
  text-align: left;
}

.heritage-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(251, 191, 36, 0.15);
  color: #fef08a;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* 20-Year Electoral Arc Timeline Card */
.electoral-timeline-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 5px 0;
  text-align: left;
}

.timeline-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.timeline-nodes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.timeline-year {
  font-size: 0.65rem;
  font-weight: 700;
  color: #cbd5e1;
  font-family: var(--font-mono);
}

.timeline-pill {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease;
}

.timeline-pill:hover {
  transform: scale(1.15);
}

.timeline-arrow {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.68rem;
  flex-shrink: 0;
}

/* Notable Alumni & Historic Figures Banner */
.alumni-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(15, 23, 42, 0.5) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 3.5px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  margin: 5px 0;
  font-size: 0.79rem;
  line-height: 1.35;
  color: #fef3c7;
  text-align: left;
}

.alumni-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Constituency Geography, Settlements & Scenic Photography */
.constituency-geo-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin: 6px 0;
  text-align: left;
}

.geo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.geo-type-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.geo-region-tag {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
}

/* Scenic Photo Box */
.constituency-photo-box {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 2px;
}

.constituency-photo-box.hidden {
  display: none !important;
}

.constituency-scenic-wrap {
  width: 100%;
  position: relative;
  display: flex;
  max-height: 180px;
  overflow: hidden;
}

.constituency-scenic-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.constituency-scenic-img:hover {
  transform: scale(1.03);
}

.constituency-photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px 6px;
  background: linear-gradient(180deg, transparent 0%, rgba(3, 7, 18, 0.88) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.constituency-photo-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f8fafc;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.photo-loading-pulse {
  padding: 14px 10px;
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
  animation: pulseOpacity 1.5s infinite ease-in-out;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* Major Towns & Places */
.geo-places-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.geo-places-title {
  font-size: 0.70rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

.geo-places-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.geo-place-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Landscape description */
.geo-landscape-text {
  font-size: 0.80rem;
  line-height: 1.42;
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 5px;
  margin-top: 2px;
}

.continue-btn {
  margin-top: 8px;
  background: #ffffff;
  color: #0b1329;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-end;
}

.continue-btn:hover {
  background: #e2e8f0;
}

/* ==================== MODALS & OVERLAYS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 23, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: center;
}

.modal-card.is-floating {
  position: fixed !important;
  margin: 0 !important;
  transition: box-shadow 0.2s ease !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--cyan);
  z-index: 105;
}

.modal-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  margin: -16px -16px 14px -16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: background 0.2s ease;
}

.modal-drag-handle:active {
  cursor: grabbing;
  background: rgba(56, 189, 248, 0.1);
}

.modal-drag-handle:hover .sheet-drag-label {
  color: var(--cyan);
}

.modal-badge-hero {
  font-size: 4rem;
  line-height: 1;
  margin: 10px 0;
  filter: drop-shadow(0 0 20px var(--gold-glow));
  animation: medalFloat 2.5s infinite ease-in-out;
}

@keyframes medalFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}

.modal-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Medal / Rank Showcase */
.rank-showcase {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.rank-award-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}

.rank-award-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Stats Matrix */
.stats-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
}

.stat-box-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.stat-box-lbl {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

/* Journey Emoji Trail Box */
.trail-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 1.15rem;
  letter-spacing: 2px;
  margin-bottom: 16px;
  word-break: break-all;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-2px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Routes Selection Modal List */
.routes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-bottom: 16px;
}

.route-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.route-card:hover, .route-card.selected {
  background: rgba(37, 99, 235, 0.15);
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.route-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.route-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
}

.route-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.route-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 26, 54, 0.95);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 3D Dice Roller Modal */
.dice-modal-card {
  max-width: 380px;
  text-align: center;
  padding: 26px 22px;
  background: linear-gradient(180deg, rgba(16, 24, 52, 0.98) 0%, rgba(8, 14, 34, 0.98) 100%);
  border: 1px solid rgba(129, 140, 248, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.3);
}

.dice-arena {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  margin: 12px auto 22px;
  height: 80px;
  perspective: 600px;
}

.dice-cube {
  width: 58px;
  height: 58px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.dice-cube.rolling {
  animation: diceSpin 0.65s cubic-bezier(0.2, 0.8, 0.3, 1) infinite;
}

@keyframes diceSpin {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  50% { transform: rotateX(180deg) rotateY(270deg) rotateZ(90deg); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(180deg); }
}

.dice-face {
  position: absolute;
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.35);
}

.face-1 { transform: rotateY(0deg) translateZ(29px); color: #ef4444; }
.face-2 { transform: rotateY(90deg) translateZ(29px); }
.face-3 { transform: rotateY(180deg) translateZ(29px); }
.face-4 { transform: rotateY(-90deg) translateZ(29px); }
.face-5 { transform: rotateX(90deg) translateZ(29px); }
.face-6 { transform: rotateX(-90deg) translateZ(29px); color: #2563eb; }

.dice-journey-info {
  margin-top: 12px;
  animation: fadeIn 0.4s ease-out;
}

.dice-route-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-top: 10px;
}

.dice-start-pill {
  font-size: 0.86rem;
  font-weight: 700;
  color: #34d399;
}

.dice-arrow-pill {
  color: var(--gold);
  font-weight: 800;
  font-size: 1.1rem;
}

.dice-target-pill {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fbbf24;
}

.dice-route-meta {
  font-size: 0.8rem;
  color: var(--cyan);
  margin-top: 8px;
  font-weight: 600;
}

/* Mobile & Tablet Ergonomics (iOS & Android) */
@media (max-width: 768px) {
  .top-hud {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-section {
    flex: 1 1 auto;
  }
  .hud-actions {
    flex-shrink: 0;
  }
  .mode-switcher {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 3px 4px;
    overflow: visible;
  }
  .mode-switcher-divider {
    display: none;
  }
  .mode-tab-desc {
    display: none;
  }
  .mode-tab {
    padding: 5px 4px;
    gap: 5px;
    justify-content: center;
    min-width: 0;
    width: 100%;
    flex-shrink: 1;
  }
  .mode-tab-header {
    gap: 3px;
  }
  .mode-tab-game-badge {
    font-size: 0.58rem;
    padding: 1px 3px;
  }
  .mode-tab-title {
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .constituency-search-wrap {
    order: 4;
    width: 100%;
  }
  .constituency-search-input {
    width: 100%;
  }
  .bottom-sheet {
    max-height: 82vh;
    padding: 14px 16px;
    padding-bottom: max(22px, calc(env(safe-area-inset-bottom, 20px) + 8px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .floating-map-controls {
    bottom: 180px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  .top-hud {
    padding: 6px 10px;
  }
  .brand-section h1 {
    font-size: 0.92rem;
  }
  .brand-attribution-badge {
    padding: 3px 7px;
    font-size: 0.68rem;
  }
  .attr-label {
    display: none;
  }
  .reset-game-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .reset-game-btn .btn-label {
    display: none;
  }
  .dice-btn .dice-btn-text {
    display: none;
  }
  .dice-btn {
    padding: 6px 10px;
  }
  .mode-tab-title {
    font-size: 0.8rem;
  }
}

/* ==================== PULSE RING & BEACON ON TOP OF CONSTITUENCIES ==================== */
.hex-beacon-ring {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
  transform-origin: 0 0;
  animation: beacon-ring-breathe 2s ease-in-out infinite;
}

.hex-beacon-wave {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
  transform-origin: 0 0;
  opacity: 0.85;
  animation: beacon-wave-pulse 2s cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
}

/* 1. Current Player / Active Hex (Cyan Neon) */
.beacon-current.hex-beacon-ring {
  stroke: #38bdf8;
  stroke-width: 2.6px;
  fill: rgba(56, 189, 248, 0.05); /* Transparent subtle sheen so hexagons underneath are fully visible */
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
}
.beacon-current.hex-beacon-wave {
  stroke: #7dd3fc;
  stroke-width: 1.8px;
  fill: none; /* Fully transparent so hexagon is never obscured */
}

/* 2. Target / Goal Destination (Gold Sunset Beacon) */
.beacon-target.hex-beacon-ring {
  stroke: #fbbf24;
  stroke-width: 3.0px;
  fill: rgba(251, 191, 36, 0.06); /* Transparent subtle sheen */
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8));
}
.beacon-target.hex-beacon-wave {
  stroke: #fde68a;
  stroke-width: 2.0px;
  fill: none; /* Fully transparent */
  animation-delay: 0.2s;
}

/* 3. Start Position (Emerald Crown) */
.beacon-start.hex-beacon-ring {
  stroke: #34d399;
  stroke-width: 2.6px;
  fill: rgba(52, 211, 153, 0.05); /* Transparent subtle sheen */
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.7));
}
.beacon-start.hex-beacon-wave {
  stroke: #a7f3d0;
  stroke-width: 1.8px;
  fill: none; /* Fully transparent */
}

@keyframes beacon-wave-pulse {
  0% {
    transform: scale(1.0);
    opacity: 0.95;
  }
  70% {
    opacity: 0.45;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

@keyframes beacon-ring-breathe {
  0%, 100% {
    transform: scale(1.0);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* ==================== MODE SWITCHER: GAME 1 VS GAME 2 ==================== */
.mode-switcher {
  display: flex;
  align-items: center;
  background: rgba(11, 20, 42, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 4px;
  gap: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.mode-switcher-divider {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-family);
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
  text-align: left;
  user-select: none;
  position: relative;
}

.mode-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.mode-tab-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.22s ease;
  flex-shrink: 0;
}

.mode-tab-icon {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.mode-tab-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-tab-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-tab-game-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 1.5px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  line-height: 1.3;
}

.badge-election {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.badge-counties {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.mode-tab-title {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #e2e8f0;
  transition: color 0.2s ease;
}

.mode-tab-desc {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

/* --- THEME 1: ELECTION MAP (Westminster Cyan & Electric Blue) --- */
.mode-tab-election:not(.active):hover {
  background: rgba(14, 116, 144, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
}
.mode-tab-election:not(.active):hover .mode-tab-title {
  color: #f0f9ff;
}

.mode-tab-election.active {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.35) 0%, rgba(15, 23, 42, 0.96) 100%);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.mode-tab-election.active .mode-tab-icon-wrap {
  background: rgba(56, 189, 248, 0.24);
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
  transform: scale(1.06);
}
.mode-tab-election.active .mode-tab-title {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}
.mode-tab-election.active .mode-tab-desc {
  color: #7dd3fc;
  font-weight: 600;
}
.mode-tab-election.active .badge-election {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.65);
}

/* --- THEME 2: COUNTIES & TOWNS (Imperial Amber & Gold) --- */
.mode-tab-counties:not(.active):hover {
  background: rgba(180, 83, 9, 0.16);
  border-color: rgba(251, 191, 36, 0.4);
}
.mode-tab-counties:not(.active):hover .mode-tab-title {
  color: #fffbeb;
}

.mode-tab-counties.active {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.38) 0%, rgba(15, 23, 42, 0.96) 100%);
  border: 1.5px solid #fbbf24;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.mode-tab-counties.active .mode-tab-icon-wrap {
  background: rgba(251, 191, 36, 0.24);
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
  transform: scale(1.06);
}
.mode-tab-counties.active .mode-tab-title {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}
.mode-tab-counties.active .mode-tab-desc {
  color: #fde68a;
  font-weight: 600;
}
.mode-tab-counties.active .badge-counties {
  background: #d97706;
  color: #ffffff;
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.65);
}

/* Responsive mode switcher scaling */
@media (max-width: 950px) {
  .mode-tab {
    padding: 6px 12px;
    gap: 8px;
  }
  .mode-tab-icon-wrap {
    width: 32px;
    height: 32px;
  }
  .mode-tab-icon {
    font-size: 1.15rem;
  }
  .mode-tab-title {
    font-size: 0.88rem;
  }
  .mode-tab-desc {
    font-size: 0.68rem;
  }
}

@media (max-width: 720px) {
  .mode-tab-desc {
    display: none;
  }
  .mode-tab {
    padding: 6px 10px;
  }
  .mode-tab-header {
    gap: 5px;
  }
  .mode-tab-title {
    font-size: 0.82rem;
  }
}

/* ==================== COUNTY CHALLENGE HUD & STATS ==================== */
.county-hud-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  gap: 12px;
  flex-wrap: wrap;
}

.county-stat-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

.county-rank-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  border: 1.5px solid #f59e0b;
  color: #fbbf24;
  border-radius: var(--radius-full);
  padding: 4px 14px;
  font-weight: 800;
  font-size: 0.84rem;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.county-streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  animation: flame-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes flame-pulse {
  0% {
    transform: scale(1.0);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
  }
  100% {
    transform: scale(1.06);
    box-shadow: 0 0 18px rgba(249, 115, 22, 0.7);
  }
}

/* ==================== COUNTY CONQUERED MAP STATE ==================== */
.county-conquered .hex-polygon {
  stroke: #fbbf24 !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6)) !important;
}

.county-conquered .hex-badge {
  fill: #fbbf24 !important;
  font-weight: 900 !important;
}

/* Target Pulse on County Map */
.target-pulse .hex-polygon {
  stroke: #38bdf8 !important;
  stroke-width: 4px !important;
  animation: target-pulse-glow 1.5s ease-in-out infinite alternate !important;
}

@keyframes target-pulse-glow {
  0% {
    filter: drop-shadow(0 0 6px #0284c7);
  }
  100% {
    filter: drop-shadow(0 0 18px #38bdf8);
  }
}

/* ==================== COUNTY QUIZ CHOICE BUTTONS ==================== */
.county-quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0 6px;
  width: 100%;
}

.county-choice-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: rgba(30, 41, 59, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.county-choice-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.25);
}

.county-choice-btn:active {
  transform: translateY(0);
}

.county-choice-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #94a3b8;
}

.county-choice-btn:hover .county-choice-key {
  background: #38bdf8;
  color: #081026;
}

/* ==================== DUAL VIEWPORTS (ZERO CROSS-CONTAMINATION) ==================== */
.map-viewport-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.map-viewport-layer.active {
  display: block !important;
}

.map-viewport-layer.hidden {
  display: none !important;
}

/* ==================== VECTOR COUNTY MAP SVG ==================== */
.county-map-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.county-map-svg:active {
  cursor: grabbing;
}

.county-map-ocean {
  pointer-events: none;
}

.county-polygons-layer {
  stroke-linejoin: round;
  stroke-linecap: round;
}

.county-polygon {
  fill: rgba(26, 38, 64, 0.88);
  stroke: #334155;
  stroke-width: 1.2px;
  cursor: pointer;
  transition: fill 0.22s ease, stroke 0.22s ease, filter 0.22s ease;
}

.county-polygon:hover {
  fill: rgba(56, 189, 248, 0.35);
  stroke: #38bdf8;
  stroke-width: 2.2px;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7));
}

/* Target County Outline Highlight (Actively Selected by Quiz) */
.county-polygon.target-county {
  fill: rgba(245, 158, 11, 0.38) !important;
  stroke: #fbbf24 !important;
  stroke-width: 3.2px !important;
  filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.9)) !important;
  animation: county-target-breathe 2s ease-in-out infinite alternate;
}

@keyframes county-target-breathe {
  0% {
    fill: rgba(245, 158, 11, 0.28);
    stroke: #fbbf24;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.7));
  }
  100% {
    fill: rgba(245, 158, 11, 0.52);
    stroke: #fef08a;
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 1));
  }
}

/* Conquered County Heraldic Fill (Calm & Non-Distracting) */
.county-polygon.conquered-county {
  fill: rgba(30, 58, 138, 0.35) !important;
  stroke: rgba(96, 165, 250, 0.65) !important;
  stroke-width: 1.4px !important;
  filter: none !important;
}

.county-polygon.conquered-county:hover {
  fill: rgba(30, 58, 138, 0.6) !important;
  stroke: #93c5fd !important;
  stroke-width: 2.0px !important;
}

/* Target Beacon Rings over County Center */
.county-beacon-wave {
  fill: none;
  stroke: #fbbf24;
  stroke-width: 2.5px;
  animation: beacon-wave-pulse 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.county-beacon-ring {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2px;
  animation: beacon-ring-breathe 2.2s ease-in-out infinite;
}

.county-beacon-core {
  fill: #fef08a;
  stroke: #fbbf24;
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 8px #fbbf24);
}

/* Conquered Badge Marker */
.conquered-badge-marker text {
  font-size: 11px;
  user-select: none;
}

.conquered-badge-bg {
  fill: #4c1d95;
  stroke: #fbbf24;
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
}

/* ==================== RICH COUNTY REVEAL & DOSSIER CARD ==================== */
.county-reveal-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.county-flag-hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.county-flag-img-wrap {
  position: relative;
  flex-shrink: 0;
  width: 90px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #fbbf24;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.35);
  background: #020617;
}

.county-flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.county-flag-img-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tooltip-flag-wrap {
  width: 52px;
  height: 34px;
  border-radius: 4px;
  overflow: hidden;
  border: 1.5px solid #fbbf24;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tooltip-flag-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.county-flag-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.county-flag-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.county-flag-name-tag {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fbbf24;
}

.county-motto-banner {
  font-size: 0.78rem;
  font-style: italic;
  color: #94a3b8;
}

/* County Scenic Photography Card */
.county-scenic-hero {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.county-scenic-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.county-scenic-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(2, 6, 23, 0.9) 0%, rgba(2, 6, 23, 0.5) 70%, transparent 100%);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.county-scenic-caption {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* County Towns Matrix */
.county-towns-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.county-town-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.county-town-box-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.county-town-box-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #38bdf8;
}

/* County Geographic Dossier Card */
.county-geo-dossier-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.county-geo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.county-geo-type-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.county-geo-peak-pill {
  font-size: 0.74rem;
  font-weight: 600;
  color: #fbbf24;
}

.county-landscape-desc {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.county-settlements-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: #94a3b8;
}

.county-settlement-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 6px;
  color: #e2e8f0;
  font-weight: 600;
}

/* ==================== 4-GAME HUB MODE SWITCHER ==================== */
.mode-switcher {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 3px 5px;
  gap: 3px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  flex-wrap: nowrap;
  overflow: visible;
  max-width: 100%;
}

.mode-switcher-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
  flex-shrink: 0;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-family);
  white-space: nowrap;
  flex: 1 1 auto;
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.mode-tab-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.mode-tab-text-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.mode-tab-header {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mode-tab-game-badge {
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.badge-election { background: rgba(56, 189, 248, 0.25); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-counties { background: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-world    { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-usa      { background: rgba(239, 68, 68, 0.25);  color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.mode-tab-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #e2e8f0;
}

.mode-tab-desc {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

/* Active Mode Tab Themes */
.mode-tab-election.active {
  background: rgba(14, 116, 144, 0.35);
  border-color: #06b6d4;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}
.mode-tab-election.active .mode-tab-title { color: #38bdf8; }

.mode-tab-counties.active {
  background: rgba(180, 83, 9, 0.35);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}
.mode-tab-counties.active .mode-tab-title { color: #fbbf24; }

.mode-tab-world.active {
  background: rgba(4, 120, 87, 0.35);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}
.mode-tab-world.active .mode-tab-title { color: #34d399; }

.mode-tab-usa.active {
  background: rgba(185, 28, 28, 0.35);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}
.mode-tab-usa.active .mode-tab-title { color: #f87171; }

/* Responsive Mode Switcher: Guaranteed 100% visibility of all 4 games across all screen sizes */
@media (max-width: 1100px) {
  .mode-tab-desc {
    display: none !important;
  }
  .mode-tab {
    padding: 5px 8px;
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .mode-switcher {
    order: 3;
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px !important;
    padding: 3px !important;
    overflow: visible !important;
  }
  .mode-switcher-divider {
    display: none !important;
  }
  .mode-tab {
    padding: 5px 3px !important;
    gap: 4px !important;
    justify-content: center !important;
    min-width: 0 !important;
    width: 100% !important;
    flex: none !important;
  }
  .mode-tab-desc {
    display: none !important;
  }
  .mode-tab-game-badge {
    font-size: 0.58rem !important;
    padding: 1px 3px !important;
  }
  .mode-tab-title {
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .mode-tab-icon {
    font-size: 1.1rem !important;
  }
}

@media (max-width: 480px) {
  .mode-switcher {
    gap: 2px !important;
    padding: 2px !important;
  }
  .mode-tab {
    padding: 4px 1px !important;
    gap: 2px !important;
  }
  .mode-tab-title {
    font-size: 0.68rem !important;
  }
  .mode-tab-icon {
    font-size: 1rem !important;
  }
}

/* Reset Game Button in HUD */
.reset-game-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.reset-game-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

/* ==================== ENEMY STRONGHOLDS & CONQUEST STYLES ==================== */
.enemy-country,
.enemy-county {
  fill: rgba(185, 28, 28, 0.55) !important;
  stroke: #ef4444 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.7)) !important;
  animation: enemy-pulse 2s ease-in-out infinite alternate !important;
}

@keyframes enemy-pulse {
  0% {
    fill: rgba(185, 28, 28, 0.45);
    stroke: #ef4444;
  }
  100% {
    fill: rgba(220, 38, 38, 0.7);
    stroke: #fca5a5;
  }
}

.enemy-badge-marker-bg {
  fill: #991b1b;
  stroke: #ef4444;
  stroke-width: 2;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* ==================== WORLD, USA & COUNTY MAP VECTORS ==================== */
.world-map-svg,
.usa-map-svg,
.county-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.world-graticules-layer {
  pointer-events: none;
}

.world-graticule-line {
  stroke: rgba(148, 163, 184, 0.16);
  stroke-width: 1px;
  stroke-dasharray: 4, 6;
  vector-effect: non-scaling-stroke;
}

.world-graticule-equator {
  stroke: rgba(56, 189, 248, 0.32);
  stroke-width: 1.2px;
  stroke-dasharray: 6, 4;
}

.world-graticule-lbl {
  font-family: var(--font-mono, monospace);
  font-size: 8.5px;
  font-weight: 700;
  fill: rgba(148, 163, 184, 0.45);
  letter-spacing: 0.08em;
  user-select: none;
}

.usa-inset-boxes {
  pointer-events: none;
}

.world-bg-country {
  fill: #0c1527;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 0.7px;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.world-polygon,
.usa-polygon,
.county-polygon {
  fill: rgba(30, 41, 59, 0.78);
  stroke: rgba(96, 165, 250, 0.45);
  stroke-width: 1.2px;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.18s ease, stroke 0.18s ease, filter 0.18s ease;
}

.world-polygon:hover,
.usa-polygon:hover,
.county-polygon:hover {
  fill: rgba(56, 189, 248, 0.38);
  stroke: #38bdf8;
  stroke-width: 2px;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.world-polygon.conquered-country,
.usa-polygon.conquered-country,
.county-polygon.conquered-county {
  fill: rgba(16, 185, 129, 0.45) !important;
  stroke: #34d399 !important;
  stroke-width: 2px !important;
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.35));
}

.world-polygon.target-country,
.usa-polygon.target-country,
.county-polygon.target-county {
  fill: rgba(245, 158, 11, 0.35) !important;
  stroke: #fbbf24 !important;
  stroke-width: 2.6px !important;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.85));
  animation: target-poly-pulse 1.8s ease-in-out infinite;
}

@keyframes target-poly-pulse {
  0%, 100% {
    fill-opacity: 0.85;
    stroke-opacity: 1;
  }
  50% {
    fill-opacity: 0.38;
    stroke-opacity: 0.65;
  }
}

.world-beacon-wave,
.usa-beacon-wave {
  fill: none;
  stroke: #fbbf24;
  stroke-width: 2.5;
  animation: world-beacon-pulse 2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.world-beacon-wave.wave-2,
.usa-beacon-wave.wave-2 {
  animation-delay: 0.6s;
}

.world-beacon-core,
.usa-beacon-core {
  fill: #fbbf24;
  stroke: #ffffff;
  stroke-width: 2;
  filter: drop-shadow(0 0 8px #fbbf24);
}

@keyframes world-beacon-pulse {
  0% {
    r: 10;
    opacity: 1;
  }
  100% {
    r: 45;
    opacity: 0;
  }
}

/* ==================== 4-METRIC DOSSIER GRID (GDP, GNP, POPULATION, RELIGION) ==================== */
.dossier-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.dossier-metric-tile {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dossier-metric-lbl {
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dossier-metric-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
}

.dossier-history-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.dossier-history-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 4px;
}

/* ==================== ENEMY TERRITORY & BADGES ==================== */
.county-polygon.enemy-county,
.world-polygon.enemy-country,
.usa-polygon.enemy-country {
  fill: rgba(220, 38, 38, 0.45) !important;
  stroke: #ef4444 !important;
  stroke-width: 2.2px !important;
}

.conquered-badge-marker-bg {
  fill: #064e3b;
  stroke: #10b981;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
}

.enemy-badge-marker-bg {
  fill: #7f1d1d;
  stroke: #ef4444;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
}

/* World & USA Tooltip Positioning */
#world-tooltip, #usa-tooltip {
  pointer-events: none;
  z-index: 100;
}

/* ==================== POWERED BY YOURLIFEMAPPED BADGES & LINKS ==================== */
.brand-attribution-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  text-decoration: none;
  font-size: 0.76rem;
  color: #e0f2fe;
  transition: all 0.2s ease;
  margin-left: 6px;
  white-space: nowrap;
}

.brand-attribution-badge:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.attr-label {
  color: #94a3b8;
  font-size: 0.7rem;
}

.attr-name {
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.attr-icon {
  font-size: 0.68rem;
  color: #38bdf8;
}

.sheet-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.74rem;
  color: #94a3b8;
}

.sheet-powered-by a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s ease;
}

.sheet-powered-by a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.modal-powered-by {
  margin-top: 14px;
  text-align: center;
  font-size: 0.76rem;
  color: #94a3b8;
}

.modal-powered-by a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 700;
}

.modal-powered-by a:hover {
  text-decoration: underline;
}




