/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  --gold: #B8860B;
  --gold-light: #DAA520;
  --dark-brown: #2d1810;
  --med-brown: #4A2C0B;
  --cream: #F5F0E6;
  --parchment: #E8DFD0;
  --blood-red: #8B0000;
  --forest-green: #2d5016;
  --water-blue: #4682B4;
  --mountain-tan: #8B7355;
  --panel-bg: #1a0f0a;
  --panel-border: #5C4033;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Crimson Text', Georgia, serif;
  background: var(--dark-brown);
  color: var(--cream);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

h1, h2, h3, h4 {
  font-family: 'Cinzel', 'Times New Roman', serif;
  color: var(--gold);
}

.hidden { display: none !important; }

/* ── Game Container Layout ────────────────────────────────────── */
#game-container {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  width: 100vw;
  background: url('images/parchment.png') center center / cover no-repeat;
  background-color: #2d1810;
}

/* Setup mode: map fills the screen, no sidebar or log */
#game-container.setup-mode {
  grid-template-rows: 56px 1fr;
}
#game-container.setup-mode #main-area {
  grid-template-rows: 1fr;
}
#game-container.setup-mode #side-panel {
  display: none;
}
#game-container.setup-mode #game-log {
  display: none;
}
#game-container.setup-mode #main-area {
  grid-template-columns: 1fr;
}

/* ── Turn Bar ─────────────────────────────────────────────────── */
#turn-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(10, 8, 5, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(184, 134, 11, 0.15);
}

#turn-bar h1 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.5rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(184, 134, 11, 0.3), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.turn-info {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
}

.phase-label {
  font-family: 'Cinzel', serif;
  color: var(--parchment);
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.player-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}

.player-badge {
  padding: 3px 12px;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}
.player-badge:hover {
  opacity: 0.85;
}
.player-badge--current {
  opacity: 1;
  font-size: 0.9rem;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* ── Badge Stat Tooltip ──────────────────────────────────────── */
.badge-stat-tooltip {
  position: fixed;
  transform: translateX(-50%);
  z-index: 9000;
  background: rgba(10, 8, 5, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 168, 68, 0.5);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 220px;
  pointer-events: none;
  animation: btt-fade-in 0.15s ease-out;
  text-align: center;
}
@keyframes btt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.btt-you {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: #D4A844;
  background: rgba(212, 168, 68, 0.2);
  border-radius: 8px;
  padding: 2px 8px;
}
.btt-header {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.btt-portrait {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 68, 0.5);
  object-fit: cover;
}
.btt-leader-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: #D4A844;
  line-height: 1.2;
}
.btt-leader-title {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-style: italic;
  color: rgba(212, 168, 68, 0.6);
  line-height: 1.2;
}
.btt-civ-name {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 12px;
  color: rgba(232, 223, 208, 0.7);
  margin-top: 2px;
}
.btt-divider {
  width: 100%;
  height: 1px;
  background: rgba(212, 168, 68, 0.3);
  margin: 8px 0;
}
.btt-stat-row {
  display: flex;
  align-items: center;
  padding: 1px 0;
}
.btt-stat-name {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 13px;
  color: rgba(232, 223, 208, 0.85);
  flex: 1;
  text-align: left;
}
.btt-stat-val {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  min-width: 20px;
  text-align: right;
  margin-right: 6px;
}
.btt-stat-res {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  color: #000;
  border-radius: 3px;
  padding: 1px 4px;
  min-width: 18px;
  text-align: center;
}
.btt-ability {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 11px;
  color: rgba(232, 223, 208, 0.7);
  text-align: left;
  padding: 1px 0;
}
.btt-ab-active { color: rgba(76, 175, 80, 0.85); }
.btt-ab-used { color: rgba(232, 223, 208, 0.4); }
.btt-footer {
  display: flex;
  justify-content: space-between;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 12px;
  color: rgba(232, 223, 208, 0.7);
}
.btt-arrow {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(212, 168, 68, 0.5);
}

.moves-badge, .ap-badge {
  font-family: 'Cinzel', serif;
  color: var(--gold-light);
  font-size: 0.85rem;
}

/* ── Main Area ────────────────────────────────────────────────── */
#main-area {
  display: grid;
  grid-template-columns: 1fr 330px;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

#side-panel {
  grid-row: 1 / -1; /* sidebar spans both rows (map + log) */
  grid-column: 2;
}

#game-log {
  grid-column: 1;
  min-height: 150px;
  max-height: 200px;
}

/* ── Map Container ────────────────────────────────────────────── */
#map-container {
  overflow: auto;
  background: transparent;
  border-right: 2px solid var(--med-brown);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-container.setup-mode #map-container {
  border-right: none;
}

/* ── SVG Hex Styles ──────────────────────────────────────────── */
#hex-map {
  display: block;
  width: 100%;
  height: 100%;
}

/* Dev mode hex coordinate labels */
.hex-dev-label {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 8px;
  fill: #fff;
  font-weight: 700;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 2px;
}

/* Dev expand "+" buttons */
.dev-expand-btn:hover circle {
  fill: rgba(212, 168, 68, 0.2);
  stroke: #f0d070;
}

.hex polygon {
  stroke: rgba(30, 25, 15, 0.6);
  stroke-width: 3;
  cursor: pointer;
  transition: stroke 0.15s, stroke-width 0.15s, filter 0.15s;
}

.hex:hover polygon {
  stroke: rgba(212, 168, 68, 0.7);
  stroke-width: 3;
  filter: brightness(1.15);
}

/* Highlights */
.highlight-selected polygon {
  stroke: var(--gold-light) !important;
  stroke-width: 3 !important;
  filter: brightness(1.3) !important;
}

.highlight-expand polygon {
  stroke: var(--forest-green) !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: 5 3;
  animation: pulse-green 1.2s ease-in-out infinite;
  cursor: pointer;
}

.highlight-attack polygon {
  stroke: var(--blood-red) !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: 5 3;
  animation: pulse-red 1s ease-in-out infinite;
}

.highlight-trade polygon {
  stroke: #f39c12 !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: 5 3;
  animation: pulse-gold 1.2s ease-in-out infinite;
  cursor: pointer;
}

.highlight-capital polygon {
  stroke: var(--gold-light) !important;
  stroke-width: 3.5 !important;
  animation: pulse-gold 1.2s ease-in-out infinite;
  filter: brightness(1.3) drop-shadow(0 0 8px rgba(184, 134, 11, 0.6)) !important;
}

@keyframes pulse-green {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4) drop-shadow(0 0 4px #2d5016); }
}
@keyframes pulse-red {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4) drop-shadow(0 0 4px #8B0000); }
}
@keyframes pulse-gold {
  0%, 100% { filter: brightness(1.2) drop-shadow(0 0 6px rgba(184, 134, 11, 0.4)); }
  50% { filter: brightness(1.7) drop-shadow(0 0 14px rgba(184, 134, 11, 0.8)); }
}

/* ── Hex Hover Highlights ─────────────────────────────────────── */
@keyframes hex-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Expand: inner glow overlay (polygon appended via JS) */
.hex-expand-overlay {
  animation: hex-pulse 1.2s ease-in-out infinite;
}
.hex-expand-overlay--dim {
  opacity: 0.35;
  animation: none;
}

/* Coastal indicator: blue/teal on own hexes */
.hex-highlight-coastal polygon {
  stroke: #00BCD4;
  stroke-width: 2;
  filter: drop-shadow(0 0 4px rgba(0, 188, 212, 0.5));
  animation: hex-pulse 1.2s ease-in-out infinite;
}

/* Attack: red */
.hex-highlight-attack polygon {
  stroke: #e74c3c;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(231, 76, 60, 0.6));
  animation: hex-pulse 1.2s ease-in-out infinite;
}
.hex-highlight-attack-dim polygon {
  stroke: #e74c3c;
  stroke-width: 1.5;
  opacity: 0.35;
}

/* Attack water path: orange/amber */
.hex-highlight-attack-water polygon {
  stroke: #f39c12;
  stroke-width: 2;
  filter: drop-shadow(0 0 5px rgba(243, 156, 18, 0.5));
  animation: hex-pulse 1.2s ease-in-out infinite;
}

/* Attack capital: red + stronger glow */
.hex-highlight-attack-capital polygon {
  stroke: #e74c3c;
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(231, 76, 60, 0.8));
  animation: hex-pulse 1.2s ease-in-out infinite;
}

/* Trade: gold */
.hex-highlight-trade polygon {
  stroke: #D4A844;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(212, 168, 68, 0.6));
  animation: hex-pulse 1.2s ease-in-out infinite;
}
.hex-highlight-trade-dim polygon {
  stroke: #D4A844;
  stroke-width: 1.5;
  opacity: 0.35;
}

/* Trade water path: lighter gold */
.hex-highlight-trade-water polygon {
  stroke: #f0d070;
  stroke-width: 2;
  filter: drop-shadow(0 0 5px rgba(240, 208, 112, 0.5));
  animation: hex-pulse 1.2s ease-in-out infinite;
}

/* Hex cost tooltip */
.hex-cost-tooltip {
  position: fixed;
  z-index: 8000;
  background: rgba(10, 8, 5, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(212, 168, 68, 0.4);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: #D4A844;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Side Panel ───────────────────────────────────────────────── */
#side-panel {
  background: rgba(10, 8, 5, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid rgba(184, 134, 11, 0.12);
}

.panel-section {
  background: rgba(74, 44, 11, 0.3);
  border: 1px solid var(--med-brown);
  border-radius: 6px;
  padding: 12px;
}

.panel-section h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--med-brown);
  padding-bottom: 4px;
}

.panel-section h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.leader-tag, .civ-tag {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--parchment);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Asset Images (from images/ folder) ───────────────────────── */
.portrait {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.emblem {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

/* ── Sidebar Hero Section (large centered portraits) ─────────── */
.sidebar-hero {
  text-align: center;
}

/* 3D spinning coin — leader front, civ back */
.coin-wrapper {
  position: relative;
  width: 174px !important;
  height: 174px !important;
  margin: 12px auto;
  -webkit-perspective: 400px;
  perspective: 400px;
  isolation: isolate;
  overflow: visible;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)) drop-shadow(0 0 8px rgba(139,105,20,0.3));
}
.coin {
  width: 150px !important;
  height: 150px !important;
  position: absolute;
  top: 12px; left: 12px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-animation: coinSpin 10s linear infinite;
  animation: coinSpin 10s linear infinite;
  border-radius: 50%;
  transform: translateZ(0);
  will-change: transform;
}
@keyframes coinSpin {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}
@-webkit-keyframes coinSpin {
  0%   { -webkit-transform: rotateY(0deg); }
  100% { -webkit-transform: rotateY(360deg); }
}
.coin-face {
  position: absolute;
  width: 150px !important;
  height: 150px !important;
  border-radius: 50% !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 0 0 6px #8B6914, 0 0 0 8px #C9A96E, 0 0 20px rgba(201,169,110,0.4);
}
.coin-face img {
  width: 150px !important;
  height: 150px !important;
  object-fit: cover;
  border-radius: 50%;
}
.coin-face::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at center, transparent 50%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}
.coin-front { transform: translateZ(1px); }
.coin-back { transform: rotateY(180deg) translateZ(1px); }

/* Coin edge — 3D thickness */
.coin-edge {
  position: absolute;
  width: 150px; height: 150px;
  border-radius: 50%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: transparent;
  border: 6px solid #C9A96E;
  box-sizing: border-box;
}
.edge-1 { transform: translateZ(-2px);  border-color: #C9A96E; }
.edge-2 { transform: translateZ(-4px);  border-color: #B8943F; }
.edge-3 { transform: translateZ(-6px);  border-color: #A07D3A; }
.edge-4 { transform: translateZ(-8px);  border-color: #8B6914; }
.edge-5 { transform: translateZ(-10px); border-color: #7A6228; }
.edge-6 { transform: translateZ(-12px); border-color: #8B6914; }
.edge-7 { transform: translateZ(-14px); border-color: #A07D3A; }
.edge-8 { transform: translateZ(-16px); border-color: #C9A96E; }
.coin-bg {
  position: absolute;
  top: 12px; left: 12px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  z-index: 0;
  filter: brightness(0.5);
}
.coin-bg-civ { animation: coinBgCiv 10s ease-in-out infinite; }
.coin-bg-leader { animation: coinBgLeader 10s ease-in-out infinite; }
@keyframes coinBgCiv {
  0%{opacity:1} 20%{opacity:1} 30%{opacity:0} 70%{opacity:0} 80%{opacity:1} 100%{opacity:1}
}
@keyframes coinBgLeader {
  0%{opacity:0} 20%{opacity:0} 30%{opacity:1} 70%{opacity:1} 80%{opacity:0} 100%{opacity:0}
}

/* Medallion ring — aged medieval seal, counter-rotating */
.medallion-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 170px; height: 170px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  animation: medallionSpin 18s linear infinite;
  background: radial-gradient(circle,
    transparent 71px, #5C4A1E 71px, #7A6228 73px, #C9A96E 76px,
    #A07D3A 79px, #8B6914 81px, #C9A96E 83px, #7A6228 85px, #5C4A1E 86px, transparent 87px);
  box-shadow: 0 0 0 1px rgba(92,74,30,0.8), 0 0 8px rgba(139,105,20,0.4), inset 0 0 6px rgba(0,0,0,0.5);
}
.medallion-ring::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 170px; height: 170px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,220,150,0.25) 0deg, rgba(255,220,150,0.25) 1.5deg, transparent 1.5deg, transparent 9deg);
  -webkit-mask: radial-gradient(circle, transparent 70px, black 72px, black 86px, transparent 88px);
  mask: radial-gradient(circle, transparent 70px, black 72px, black 86px, transparent 88px);
}
.medallion-ring::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 170px; height: 170px; border-radius: 50%;
  background: repeating-conic-gradient(from 45deg, rgba(201,169,110,0.5) 0deg, rgba(201,169,110,0.5) 3deg, transparent 3deg, transparent 90deg);
  -webkit-mask: radial-gradient(circle, transparent 72px, black 73px, black 85px, transparent 86px);
  mask: radial-gradient(circle, transparent 72px, black 73px, black 85px, transparent 86px);
}
@keyframes medallionSpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(-360deg); }
}

.sidebar-leader-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  color: #D4A844;
  margin-bottom: 2px;
}

.sidebar-leader-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-style: italic;
  color: rgba(212, 168, 68, 0.8);
  margin-bottom: 8px;
}

.sidebar-civ-name {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  color: rgba(232, 223, 208, 0.8);
  margin-bottom: 4px;
}

.sidebar-leader-name, .sidebar-civ-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.sidebar-hint {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(10,8,5,0.9); border: 1px solid #C9A96E;
  color: #C9A96E; font-family: 'Cinzel', serif; font-size: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help; margin-left: 5px; vertical-align: middle; flex-shrink: 0;
}
.sidebar-hint:hover { border-color: #E0C080; color: #E0C080; }
.sidebar-tooltip {
  position: fixed; background: rgba(10,8,5,0.97);
  border: 1px solid #C9A96E; border-radius: 6px;
  padding: 12px 14px; width: 260px; z-index: 9999;
  pointer-events: none; opacity: 0; transition: opacity 150ms ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.sidebar-tooltip.visible { opacity: 1; }
.tooltip-leader-name, .tooltip-civ-name {
  font-family: 'Cinzel', serif; font-size: 12px; font-weight: 700;
  color: #C9A96E; letter-spacing: 0.08em;
}
.tooltip-epithet {
  font-family: 'Crimson Text', Georgia, serif; font-size: 11px;
  color: rgba(232,220,200,0.7); font-style: italic; margin-bottom: 6px;
}
.tooltip-divider {
  height: 1px; background: rgba(201,169,110,0.2); margin: 6px 0;
}
.tooltip-ability-name {
  font-family: 'Cinzel', serif; font-size: 10px;
  color: #C9A96E; margin-bottom: 2px;
}
.tooltip-ability-desc {
  font-family: 'Crimson Text', Georgia, serif; font-size: 11px;
  color: #E8DCC8; line-height: 1.4; margin-bottom: 8px;
}
.tooltip-ability-desc:last-child { margin-bottom: 0; }
/* Wayfarer theme sidebar tooltip */
body.wayfarer-active .sidebar-tooltip,
#game-container.theme-wayfarer .sidebar-tooltip {
  background: rgba(4,14,30,0.98); border-color: #4A6FA5;
  box-shadow: 0 0 15px rgba(14,40,82,0.6);
}
#game-container.theme-wayfarer .tooltip-leader-name,
#game-container.theme-wayfarer .tooltip-civ-name,
#game-container.theme-wayfarer .tooltip-ability-name { color: #8FB3D9; }
#game-container.theme-wayfarer .tooltip-divider { background: rgba(74,111,165,0.3); }
.sidebar-divider {
  width: 80%;
  height: 1px;
  background: rgba(212, 168, 68, 0.3);
  margin: 10px auto;
}

.card-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  object-fit: cover;
  display: block;
  margin: 0 auto 10px;
}

.card-emblem {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

/* ── Stat Grid ────────────────────────────────────────────────── */
.stat-grid { margin-top: 8px; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.stat-name {
  width: 80px;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--parchment);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-bar {
  display: flex;
  gap: 2px;
  flex: 1;
}

.stat-pip {
  width: 8px;
  height: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
}

.stat-pip.filled {
  background: var(--gold);
  border-color: var(--gold-light);
}

.stat-val {
  width: 20px;
  text-align: center;
  font-weight: 600;
  color: var(--gold-light);
}

.research-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  font-family: 'Cinzel', serif;
}

.research-neglected { background: var(--blood-red); color: #fff; }
.research-maintained { background: #555; color: #ccc; }
.research-improved { background: var(--forest-green); color: #fff; }
.research-mastered { background: var(--gold); color: var(--dark-brown); }

.resource-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--med-brown);
  font-size: 0.85rem;
}

.resource-row strong { color: var(--gold-light); }

.capital-tag {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  padding: 8px 16px;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, var(--med-brown), var(--dark-brown));
  color: var(--gold-light);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.25s ease;
  display: inline-block;
  margin: 4px 2px;
}

.btn:hover {
  background: linear-gradient(180deg, #6b4a1a, var(--med-brown));
  color: #fff;
  box-shadow: 0 0 12px rgba(184, 134, 11, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 0 4px rgba(184, 134, 11, 0.3);
}

.btn-expand { border-color: var(--forest-green); }
.btn-end { border-color: var(--blood-red); }

/* ── Game Log ─────────────────────────────────────────────────── */
#game-log {
  background: rgba(10, 8, 5, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-top: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(184, 134, 11, 0.1);
  margin-top: 0;
  padding-top: 0;
}

#game-log .log-entries::-webkit-scrollbar { width: 5px; }
#game-log .log-entries::-webkit-scrollbar-track { background: rgba(74, 44, 11, 0.1); }
#game-log .log-entries::-webkit-scrollbar-thumb { background: rgba(212, 168, 68, 0.3); border-radius: 3px; }

.log-header {
  padding: 6px 16px;
  border-bottom: 1px solid rgba(184, 134, 11, 0.25);
  background: rgba(10, 8, 5, 0.3);
}

.log-header h3 {
  font-size: 0.85rem;
  margin: 0;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.log-entries {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-family: 'Crimson Text', Georgia, serif;
}

.log-entry {
  padding: 3px 0;
  border-bottom: 1px solid rgba(74, 44, 11, 0.15);
  transition: background 0.15s;
}

.log-entry:hover {
  background: rgba(74, 44, 11, 0.1);
}

.log-system { color: var(--parchment); }
.log-turn { color: var(--gold-light); font-weight: 600; }
.log-setup { color: #7dcea0; }
.log-expand { color: #85c1e9; }
.log-battle { color: #e74c3c; font-weight: 600; }
.log-trade { color: #f39c12; }
.log-warn { color: #e67e22; font-style: italic; }
.log-bot { color: #af7ac5; }
.log-bot-chat { color: #d4a844; font-style: italic; }
.log-info { color: var(--cream); }

/* ── Dice Overlay ─────────────────────────────────────────────── */
#dice-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 7, 5, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlay-fade-in 0.2s ease-out;
}

.dice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  perspective: 600px;
}

.dice-label {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--gold-light);
  text-align: center;
}

/* ── D6 Cube ──────────────────────────────────────────────────── */
.die {
  position: relative;
  transform-style: preserve-3d;
}

.die-d6 {
  width: 80px;
  height: 80px;
}

.die-d6 .die-face {
  position: absolute;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-brown);
  background: linear-gradient(135deg, var(--parchment), #c8b898);
  border: 3px solid var(--gold);
  border-radius: 10px;
  backface-visibility: hidden;
}

.die-d6 .die-face-1 { transform: rotateY(0deg) translateZ(40px); }
.die-d6 .die-face-2 { transform: rotateY(90deg) translateZ(40px); }
.die-d6 .die-face-3 { transform: rotateX(90deg) translateZ(40px); }
.die-d6 .die-face-4 { transform: rotateX(-90deg) translateZ(40px); }
.die-d6 .die-face-5 { transform: rotateY(-90deg) translateZ(40px); }
.die-d6 .die-face-6 { transform: rotateY(180deg) translateZ(40px); }

/* ── D10 / D20 Polyhedron ─────────────────────────────────────── */
.die-d10, .die-d20 {
  width: 100px;
  height: 100px;
}

.die-poly-face {
  position: absolute;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-brown);
  background: linear-gradient(135deg, var(--parchment), #c8b898);
  border: 2px solid var(--gold);
  border-radius: 50%;
  backface-visibility: hidden;
  left: 25px;
  top: 25px;
  transition: opacity 0.3s;
}

/* ── Dice Rolling Animation ───────────────────────────────────── */
.die.rolling {
  animation: dice-tumble 1.8s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes dice-tumble {
  0%   { transform: rotateX(0) rotateY(0) rotateZ(0) scale(0.2); opacity: 0; }
  8%   { opacity: 1; transform: scale(1) rotateX(45deg) rotateY(30deg); }
  20%  { transform: rotateX(340deg) rotateY(200deg) rotateZ(100deg) scale(1); }
  40%  { transform: rotateX(680deg) rotateY(400deg) rotateZ(200deg); }
  60%  { transform: rotateX(900deg) rotateY(520deg) rotateZ(280deg); }
  80%  { transform: rotateX(1020deg) rotateY(590deg) rotateZ(320deg); }
  100% { transform: var(--final-rotation, rotateX(0) rotateY(0)); }
}

/* ── Dice Result Display ──────────────────────────────────────── */
.dice-result {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(184, 134, 11, 0.8), 0 2px 4px rgba(0,0,0,0.5);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dice-result.show {
  opacity: 1;
  transform: scale(1);
}

/* ── Physics Dice Roller ──────────────────────────────────────── */
#dice-roller-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-fade-in 0.3s ease-out;
  transition: opacity 0.4s ease-out;
}
#dice-roller-overlay.dice-overlay-fade-out {
  opacity: 0;
}

.dice-roller-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 8, 5, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dice-roller-frame {
  position: relative;
  width: 340px;
  padding: 28px 20px 24px;
  background: rgba(10, 8, 5, 0.6);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 2px solid rgba(212, 168, 68, 0.4);
  border-radius: 16px;
  box-shadow:
    0 0 30px rgba(212, 168, 68, 0.12),
    inset 0 0 40px rgba(212, 168, 68, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dice-roller-label {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #D4A844;
  margin-bottom: 4px;
}

.dice-roller-threshold {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(212, 168, 68, 0.7);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

#dice-roller-canvas {
  width: 300px;
  height: 300px;
  cursor: pointer;
  border-radius: 8px;
}

.dice-roller-prompt {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #D4A844;
  background: #2A1F10;
  border: 1px solid rgba(212, 168, 68, 0.3);
  padding: 6px 24px;
  border-radius: 4px;
  margin-top: 8px;
  text-transform: uppercase;
  cursor: pointer;
  animation: prompt-pulse 2s ease-in-out infinite;
}

@keyframes prompt-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.dice-roller-result {
  font-family: 'Cinzel', serif;
  font-size: 3.5rem;
  font-weight: 900;
  color: #D4A844;
  text-shadow: 0 0 30px rgba(212, 168, 68, 0.7), 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-top: 8px;
  opacity: 0;
  transform: scale(0.5) translateY(20px);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dice-roller-result.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.dice-roller-result.nat-crit {
  color: #f0d070;
  text-shadow: 0 0 30px rgba(240, 208, 112, 0.8), 0 0 60px rgba(212, 168, 68, 0.5);
}

.dice-roller-result.nat-fail {
  color: #ff5544;
  text-shadow: 0 0 30px rgba(255, 80, 60, 0.8), 0 0 60px rgba(255, 80, 60, 0.4);
}

/* ── Nat 20 Gold Particle Burst ──────────────────────────────── */
.dice-nat20-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  background: #D4A844;
  border-radius: 50%;
  pointer-events: none;
  animation: nat20-burst 0.6s ease-out forwards;
}
@keyframes nat20-burst {
  0%   { transform: translate(-50%, -50%) translate(0, 0); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)); opacity: 0; }
}

/* ── Nat 1 Screen Shake ──────────────────────────────────────── */
.dice-nat1-shake {
  animation: nat1-shake 0.2s ease-out;
}
@keyframes nat1-shake {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3px, 2px); }
  50%  { transform: translate(3px, -3px); }
  75%  { transform: translate(-2px, 3px); }
  100% { transform: translate(0, 0); }
}

/* ── Defy Fate Banner ────────────────────────────────────────── */
.dice-defy-fate-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #D4A844;
  text-shadow: 0 0 20px rgba(212, 168, 68, 0.8), 0 0 40px rgba(212, 168, 68, 0.4);
  white-space: nowrap;
  animation: defy-fate-pulse 0.8s ease-in-out;
  pointer-events: none;
  z-index: 10;
}
@keyframes defy-fate-pulse {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.8); }
  20%  { opacity: 1; transform: translateX(-50%) scale(1.05); }
  80%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* ── Setup Panel ──────────────────────────────────────────────── */
#setup-panel {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 8, 5, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: overlay-fade-in 0.3s ease-out;
  pointer-events: none;
}

.setup-card {
  background: rgba(10, 8, 5, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 168, 68, 0.4);
  border-radius: 12px;
  padding: 40px 52px;
  max-width: 600px;
  min-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: card-enter 0.3s ease-out;
  pointer-events: auto;
}

/* Capital selection: position card to the right, not blocking the map */
#setup-panel.capital-select {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 80px 32px 0 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#setup-panel.capital-select .setup-card {
  min-width: 260px;
  max-width: 320px;
  padding: 28px 32px;
}

.setup-card h2 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.5rem;
  margin-bottom: 8px;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(212, 168, 68, 0.3);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
}

.setup-card p {
  color: rgba(232, 223, 208, 0.55);
  margin-bottom: 0;
  font-size: 0.85rem;
  font-family: 'Cinzel', serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Player Lobby ────────────────────────────────────────────── */
.lobby-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.lobby-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(10, 8, 5, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(212, 168, 68, 0.25);
  border-radius: 8px;
  transition: opacity 0.25s, border-color 0.25s;
}
.lobby-slot--empty {
  opacity: 0.35;
  border-color: rgba(212, 168, 68, 0.1);
}

.lobby-slot-num {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: rgba(212, 168, 68, 0.5);
  letter-spacing: 1px;
  min-width: 42px;
  flex-shrink: 0;
}

.lobby-toggle {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.lobby-tog-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 1px;
  padding: 4px 10px;
  border: 1px solid rgba(212, 168, 68, 0.2);
  background: rgba(10, 8, 5, 0.6);
  color: rgba(212, 168, 68, 0.4);
  cursor: pointer;
  transition: all 0.2s;
}
.lobby-tog-btn:first-child { border-radius: 4px 0 0 4px; }
.lobby-tog-btn:last-child { border-radius: 0 4px 4px 0; }
.lobby-tog-btn:hover { background: rgba(212, 168, 68, 0.1); color: rgba(212, 168, 68, 0.7); }
.lobby-tog--active {
  background: rgba(212, 168, 68, 0.2);
  border-color: rgba(212, 168, 68, 0.5);
  color: #D4A844;
}

.lobby-detail {
  flex: 1;
  min-width: 0;
}

.lobby-name-input {
  width: 100%;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.95rem;
  padding: 5px 10px;
  background: rgba(10, 8, 5, 0.6);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 4px;
  color: var(--parchment);
  outline: none;
  transition: border-color 0.2s;
}
.lobby-name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(212, 168, 68, 0.15);
}
.lobby-name-input::placeholder {
  color: rgba(212, 168, 68, 0.3);
}

.lobby-bot-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.lobby-bot-row .lobby-name-input {
  flex: 1;
  min-width: 0;
}

/* Custom difficulty dropdown */
.diff-dropdown-wrap { display: flex; align-items: center; gap: 4px; flex-shrink: 0; position: relative; }
.diff-dropdown {
  width: 120px; padding: 5px 8px; cursor: pointer;
  font-family: 'Cinzel', serif; font-variant: small-caps; font-size: 13px;
  background: rgba(10,8,5,0.85); border: 1px solid #C9A96E; border-radius: 4px;
  color: #C9A96E; display: flex; justify-content: space-between; align-items: center;
  transition: border-color 0.2s;
}
.diff-dropdown:hover { border-color: #E0C080; }
.diff-dropdown-arrow { font-size: 10px; opacity: 0.6; }
.diff-options {
  position: absolute; top: 100%; left: 0; width: 160px; z-index: 100;
  background: rgba(10,8,5,0.95); border: 1px solid #C9A96E; border-radius: 4px;
  margin-top: 2px; overflow: visible;
}
.diff-option {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; cursor: pointer;
  font-family: 'Cinzel', serif; font-variant: small-caps; font-size: 12px;
  color: rgba(201,169,110,0.7); transition: all 0.15s;
}
.diff-option:hover { background: rgba(201,169,110,0.15); color: #C9A96E; }
.diff-option--active { color: #C9A96E; background: rgba(201,169,110,0.1); }
.diff-option-hint {
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(10,8,5,0.9); border: 1px solid #C9A96E;
  color: #C9A96E; font-family: 'Cinzel', serif; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  cursor: help; flex-shrink: 0;
}
.diff-option-hint:hover { border-color: #E0C080; color: #E0C080; }
.diff-tooltip {
  position: fixed; z-index: 9999; width: 240px; padding: 12px 16px;
  background: rgba(10,8,5,0.97); border: 1px solid #C9A96E; border-radius: 6px;
  pointer-events: none; opacity: 0; transition: opacity 150ms ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.diff-tooltip.visible { opacity: 1; }
.diff-tip-header { font-family: 'Cinzel', serif; font-size: 13px; font-weight: 700; color: #C9A96E; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.diff-tip-divider { height: 1px; background: rgba(201,169,110,0.2); margin: 8px 0; }
.diff-tip-body { font-family: 'Crimson Text', Georgia, serif; font-size: 12px; color: #E8DCC8; line-height: 1.5; }
.diff-star-on { color: #C9A96E; }
.diff-star-off { color: rgba(139,105,20,0.3); }
/* Wayfarer theme tooltip overrides */
body.wayfarer-active .diff-tooltip { background: rgba(4,14,30,0.98); border-color: #4A6FA5; box-shadow: 0 0 15px rgba(14,40,82,0.6); }
body.wayfarer-active .diff-tip-header { color: #8FB3D9; }
body.wayfarer-active .diff-star-on { color: #8FB3D9; }
body.wayfarer-active .diff-tip-body { color: rgba(232,220,200,0.9); }
body.wayfarer-active .diff-tip-divider { background: rgba(74,111,165,0.3); }
/* Wayfarer difficulty dropdown */
body.wayfarer-active .diff-dropdown {
  background: linear-gradient(135deg, rgba(2,8,18,0.9), rgba(6,22,48,0.9));
  border-color: #4A6FA5; color: #8FB3D9;
  box-shadow: 0 0 8px rgba(14,40,82,0.4);
}
body.wayfarer-active .diff-dropdown:hover { border-color: #6A8FC5; box-shadow: 0 0 12px rgba(14,40,82,0.6); }
body.wayfarer-active .diff-dropdown-arrow { color: #4A6FA5; }
body.wayfarer-active .diff-options {
  background: rgba(2,8,18,0.95); border-color: #4A6FA5;
  box-shadow: 0 8px 24px rgba(2,8,18,0.9), 0 0 20px rgba(14,40,82,0.4);
}
body.wayfarer-active .diff-option {
  background: transparent; border-bottom: 1px solid rgba(74,111,165,0.15);
  color: rgba(143,179,217,0.8);
}
body.wayfarer-active .diff-option:hover { background: rgba(14,40,82,0.6); color: #8FB3D9; }
body.wayfarer-active .diff-option--active { background: rgba(10,30,65,0.8); color: #C9A96E; border-left: 2px solid #4A6FA5; }
body.wayfarer-active .diff-option-hint { background: rgba(4,14,30,0.9); border-color: #4A6FA5; color: #8FB3D9; }
body.wayfarer-active .diff-option-hint:hover { border-color: #6A8FC5; color: #C9A96E; }

.lobby-name-input--bot {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(5, 4, 2, 0.7);
  border-color: rgba(212, 168, 68, 0.15);
}
.lobby-name-input--bot:hover,
.lobby-name-input--bot:focus {
  border-color: rgba(212, 168, 68, 0.15);
  box-shadow: none;
}

.lobby-warning {
  text-align: center;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.85rem;
  color: #ff6644;
  margin-top: 8px;
}

.lobby-begin-btn {
  font-size: 1.1rem;
  padding: 10px 36px;
  letter-spacing: 2px;
}

/* ── Stat Choice UI (battle/trade) ────────────────────────────── */
.stat-choice-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.stat-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
  padding: 12px 16px;
}
.stat-choice-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
.lucky-reroll-btn {
  background: rgba(184, 134, 11, 0.2) !important;
  border-color: #D4A844 !important;
}
.lucky-reroll-btn:hover {
  background: rgba(184, 134, 11, 0.35) !important;
}
.stat-choice-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 1px;
}
.stat-choice-val {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.8rem;
  color: rgba(232, 223, 208, 0.6);
}
.stat-choice-change {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
}
.stat-choice-gain { color: #4CAF50; }
.stat-choice-loss { color: #ff5544; }

/* ── Stat Gear Indicator (active Major Project) ──────────────── */
.stat-gear {
  font-size: 12px;
  color: #D4A844;
  animation: gear-spin 3s linear infinite;
  margin-left: 4px;
  filter: drop-shadow(0 0 3px rgba(212, 168, 68, 0.5));
}
.stat-gear--stalled {
  color: #f39c12;
  filter: drop-shadow(0 0 3px rgba(243, 156, 18, 0.5));
}
@keyframes gear-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.stat-lock {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.6;
}

/* ── Toast Notification ──────────────────────────────────────── */
.empire-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9500;
  background: rgba(10, 8, 5, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 168, 68, 0.4);
  border-radius: 10px;
  padding: 16px 32px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #D4A844;
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
  animation: btt-fade-in 0.15s ease-out;
}

/* ── Governor Selection ──────────────────────────────────────── */
.gov-select-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}
.gov-select-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  text-align: left;
}
.gov-select-btn--claimed {
  opacity: 0.35;
  cursor: default;
  border-color: rgba(212, 168, 68, 0.15);
}
.gov-select-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: #D4A844;
}
.gov-select-desc {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 12px;
  color: rgba(232, 223, 208, 0.6);
}

/* ── Stat Locked/Blocked indicator ───────────────────────────── */
.stat-select-blocked {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 10px;
  color: #ff5544;
  display: block;
  margin-top: 2px;
}

/* ── Turn Transition (hot-seat) ──────────────────────────────── */
.turn-transition {
  text-align: center;
  padding: 20px 0;
}

.turn-transition-label {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 4px;
  color: rgba(232, 223, 208, 0.5);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.turn-transition-name {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 16px;
}

.turn-transition-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 68, 0.5);
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
}

.turn-transition-leader {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: rgba(212, 168, 68, 0.6);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

/* ── Leader / Civ Cards ───────────────────────────────────────── */
.leader-card, .civ-card {
  background: linear-gradient(135deg, rgba(74, 44, 11, 0.35), rgba(45, 24, 16, 0.4));
  border: 1px solid rgba(184, 134, 11, 0.5);
  border-radius: 8px;
  padding: 18px;
  margin: 14px 0;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(184, 134, 11, 0.1), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.leader-card h3, .civ-card h3 {
  font-size: 1.25rem;
  margin-bottom: 6px;
  font-family: 'Cinzel', serif;
}

.leader-title {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  color: var(--gold-light);
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.abilities { margin-top: 10px; }

.ability {
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--parchment);
  font-family: 'Crimson Text', Georgia, serif;
  line-height: 1.4;
}

.ability strong {
  color: var(--gold-light);
}

/* ── Stat Rolls (Setup) ──────────────────────────────────────── */
.stat-rolls {
  text-align: left;
  margin: 14px 0;
  background: rgba(74, 44, 11, 0.15);
  border-radius: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(74, 44, 11, 0.3);
}

.stat-rolls p {
  margin-bottom: 8px;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.95rem;
}

.stat-rolls strong { color: var(--gold-light); }

.setup-stats .stat-row {
  justify-content: center;
}

.setup-stats .research-badge {
  padding: 2px 8px;
  border-radius: 10px;
  width: auto;
  font-size: 0.7rem;
}

/* ── Fast Start Button ───────────────────────────────────────── */
.fast-start-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 5500;
  background: rgba(10, 8, 5, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 8px 24px;
  font-family: 'Cinzel', serif;
  font-variant: small-caps;
  letter-spacing: 3px;
  font-size: 12px;
  color: #D4A844;
  cursor: pointer;
  transition: all 0.25s ease;
}

.fast-start-btn:hover {
  border-color: #D4A844;
  box-shadow: 0 0 12px rgba(212, 168, 68, 0.2);
  color: #f0d070;
  background: rgba(20, 16, 10, 0.6);
}

/* ── Skip Bot Turn Button ────────────────────────────────────── */
.skip-bot-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 5500;
  background: rgba(10, 8, 5, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 8px 24px;
  font-family: 'Cinzel', serif;
  font-variant: small-caps;
  letter-spacing: 3px;
  font-size: 12px;
  color: #D4A844;
  cursor: pointer;
  transition: all 0.25s ease;
}

.skip-bot-btn:hover {
  border-color: #D4A844;
  box-shadow: 0 0 12px rgba(212, 168, 68, 0.2);
  color: #f0d070;
  background: rgba(20, 16, 10, 0.6);
}

/* ── Fast Start Summary ──────────────────────────────────────── */
.fast-summary-players {
  text-align: left;
  margin: 16px 0;
}

.fast-summary-human {
  background: rgba(74, 44, 11, 0.25);
  border: 1px solid rgba(212, 168, 68, 0.35);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.fast-summary-human h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

/* Fast Start — leader/civ images */
.fast-img {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #D4A844;
  display: block;
}

.fast-img-lg {
  width: 80px;
  height: 80px;
  margin: 8px auto;
}

.fast-img-sm {
  width: 32px;
  height: 32px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.fast-img-fallback {
  border-radius: 50%;
  border: 2px solid #D4A844;
  background: rgba(30, 20, 10, 0.7);
  color: #D4A844;
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

.fast-img-fallback.fast-img-lg {
  width: 80px;
  height: 80px;
  margin: 8px auto;
  font-size: 28px;
}

.fast-summary-bot {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(74, 44, 11, 0.2);
  font-size: 0.85rem;
  color: var(--parchment);
}

.fast-summary-bot:last-child {
  border-bottom: none;
}

.fast-summary-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(212, 168, 68, 0.5);
  margin-top: 6px;
  display: block;
}

.fast-summary-value {
  color: var(--gold-light);
  font-weight: 600;
}

.fast-summary-desc {
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.6);
  font-family: 'Crimson Text', Georgia, serif;
  margin-top: 2px;
}
.skip-auto-tag {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.75rem;
  font-style: italic;
  color: rgba(212, 168, 68, 0.45);
  margin-left: 4px;
}

/* ── Turn Order ───────────────────────────────────────────────── */
.turn-order-list {
  text-align: left;
  margin: 12px 0;
}

.turn-order-item {
  padding: 6px 0;
  font-size: 1rem;
  color: var(--parchment);
  border-bottom: 1px solid rgba(74, 44, 11, 0.3);
}

.order-num {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

/* ── Color Swatches ───────────────────────────────────────────── */
.color-swatches {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.color-swatch {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid var(--parchment);
  cursor: pointer;
  transition: all 0.2s;
}

.color-swatch:hover {
  transform: scale(1.2);
  border-color: var(--gold-light);
  box-shadow: 0 0 12px rgba(184, 134, 11, 0.5);
}

/* ── Modal Overlay ────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 7, 5, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6000;
  animation: overlay-fade-in 0.3s ease-out;
}

.modal-content {
  background: rgba(10, 8, 5, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 168, 68, 0.4);
  border-radius: 12px;
  padding: 36px 40px;
  max-width: 640px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: card-enter 0.3s ease-out;
}

.modal-content h2 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.4rem;
  letter-spacing: 2px;
  margin-bottom: 20px;
  text-shadow: 0 0 16px rgba(212, 168, 68, 0.3);
}

.btn-modal-close {
  margin-top: 20px;
}

/* ── Settings Modal ──────────────────────────────────────────── */
.settings-grid {
  text-align: left;
  padding: 8px 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(74, 44, 11, 0.2);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--parchment);
  letter-spacing: 1px;
}

.settings-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-slider {
  -webkit-appearance: none;
  width: 140px;
  height: 4px;
  background: rgba(212, 168, 68, 0.2);
  border-radius: 2px;
  outline: none;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D4A844;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212, 168, 68, 0.4);
}

.settings-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D4A844;
  cursor: pointer;
  border: none;
}

.settings-val {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: #D4A844;
  width: 32px;
  text-align: right;
}

.settings-toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  border: 1px solid rgba(212, 168, 68, 0.4);
  background: rgba(40, 30, 15, 0.6);
  cursor: pointer;
  position: relative;
  transition: all 0.25s;
}

.settings-toggle.on {
  background: rgba(212, 168, 68, 0.25);
  border-color: #D4A844;
  box-shadow: inset 0 0 6px rgba(212, 168, 68, 0.3);
}

.settings-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(212, 168, 68, 0.5);
  transition: all 0.25s;
}

.settings-toggle.on::after {
  left: 20px;
  background: #D4A844;
}

/* ── Settings Section Headers ────────────────────────────────── */
.settings-section-header {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: #D4A844;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 10px 0 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(212, 168, 68, 0.2);
}

.settings-select {
  background: rgba(30, 20, 10, 0.6);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 4px;
  color: #E8DFD0;
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}

.settings-select:focus {
  border-color: #D4A844;
}

.settings-select option {
  background: #1a0f0a;
  color: #E8DFD0;
}

.settings-close-x {
  position: absolute;
  top: -8px;
  right: -8px;
  background: none;
  border: none;
  color: rgba(212, 168, 68, 0.5);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  transition: color 0.15s;
}

.settings-close-x:hover {
  color: #D4A844;
}

.settings-btn {
  font-size: 0.75rem;
  padding: 5px 14px;
}

.settings-reset-btn {
  font-size: 0.7rem;
  padding: 5px 16px;
  color: rgba(232, 223, 208, 0.5);
  border-color: rgba(232, 223, 208, 0.2);
  background: rgba(30, 20, 10, 0.3);
}

.settings-reset-btn:hover {
  color: #E8DFD0;
  border-color: rgba(232, 223, 208, 0.4);
}

/* ── Missing Class Definitions ───────────────────────────────── */
.btn-setup {
  margin-top: 12px;
  padding: 10px 24px;
}

.ap-badge {
  background: rgba(212, 168, 68, 0.15);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.8rem;
}

.effect-line {
  font-family: 'Crimson Text', serif;
  font-size: 0.82rem;
  color: rgba(232, 223, 208, 0.7);
  padding: 2px 0;
}

.output-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin: 4px 0;
  background: rgba(30, 20, 10, 0.4);
  border: 1px solid rgba(212, 168, 68, 0.2);
  border-radius: 6px;
  color: #E8DFD0;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  text-align: left;
  transition: all 0.2s;
}

.output-btn:hover {
  border-color: #D4A844;
  background: rgba(212, 168, 68, 0.1);
}

.roll-line {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.7);
  text-align: center;
}

.action-result {
  text-align: center;
  padding: 8px 0;
}

.project-stat {
  font-family: 'Crimson Text', serif;
  font-size: 0.78rem;
  color: rgba(232, 223, 208, 0.7);
}

.btn-sublabel {
  font-size: 0.65rem;
  display: block;
  color: rgba(232, 223, 208, 0.5);
}

.victory-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.6rem;
  letter-spacing: 3px;
}

.victory-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: rgba(232, 223, 208, 0.7);
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.victory-stat-row {
  display: flex;
  justify-content: space-between;
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.6);
  padding: 2px 0;
}

.civ-card {
  text-align: center;
  padding: 10px;
}

.dev-btn {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: #D4A844;
  letter-spacing: 1px;
  background: rgba(10, 8, 5, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  text-align: center;
}

.dev-help {
  display: inline-block;
  width: 13px;
  height: 13px;
  line-height: 13px;
  text-align: center;
  font-size: 9px;
  font-family: 'Crimson Text', serif;
  font-weight: 700;
  color: rgba(212, 168, 68, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.25);
  border-radius: 50%;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Rules Modal (accordion) ─────────────────────────────────── */
.rules-acc-scroll {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 168, 68, 0.35) rgba(0, 0, 0, 0.2);
}
.rules-acc-scroll::-webkit-scrollbar { width: 6px; }
.rules-acc-scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.rules-acc-scroll::-webkit-scrollbar-thumb { background: rgba(212, 168, 68, 0.35); border-radius: 3px; }

.rules-acc-section {
  margin-bottom: 6px;
}

.rules-acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  background: rgba(212, 168, 68, 0.1);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 2px;
  text-align: left;
}
.rules-acc-header:hover {
  background: rgba(212, 168, 68, 0.2);
  box-shadow: 0 0 8px rgba(212, 168, 68, 0.15);
}
.rules-acc-header--active {
  background: rgba(212, 168, 68, 0.2);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(212, 168, 68, 0.2);
}

.rules-acc-chevron {
  font-size: 12px;
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform 0.3s;
}

.rules-acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.rules-acc-body--open {
  /* max-height set via JS */
}

.rules-acc-body-inner {
  padding: 16px;
  text-align: left;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  color: rgba(232, 223, 208, 0.85);
}
.rules-acc-body-inner p {
  margin-bottom: 10px;
}
.rules-acc-body-inner strong {
  color: var(--gold-light);
}

/* ── Sub-Accordions (Leaders / Civilizations) ────────────────── */
.rules-sub-section {
  margin-bottom: 4px;
}

.rules-sub-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: rgba(212, 168, 68, 0.06);
  border: 1px solid rgba(212, 168, 68, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-align: left;
  gap: 10px;
}
.rules-sub-header:hover {
  background: rgba(212, 168, 68, 0.14);
}
.rules-sub-header--active {
  background: rgba(212, 168, 68, 0.14);
  border-color: rgba(212, 168, 68, 0.5);
}

.rules-sub-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 68, 0.5);
  object-fit: cover;
  flex-shrink: 0;
}

.rules-sub-info {
  flex: 1;
  min-width: 0;
}

.rules-sub-name {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 700;
  color: #D4A844;
  line-height: 1.2;
}

.rules-sub-title {
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(212, 168, 68, 0.55);
  line-height: 1.2;
}

.rules-sub-roll {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: rgba(232, 223, 208, 0.4);
  letter-spacing: 1px;
  flex-shrink: 0;
  white-space: nowrap;
}

.rules-sub-chevron {
  font-size: 10px;
  color: rgba(212, 168, 68, 0.5);
  flex-shrink: 0;
  margin-left: 4px;
}

.rules-sub-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.rules-sub-body-inner {
  padding: 10px 12px 10px 62px;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(232, 223, 208, 0.85);
}
.rules-sub-body-inner p {
  margin-bottom: 6px;
}
.rules-sub-body-inner strong {
  color: var(--gold-light);
}

.rules-sub-setup {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 13px;
  color: rgba(232, 223, 208, 0.4);
  margin-top: 4px;
}

.rules-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 168, 68, 0.15);
  width: 100%;
}

.rules-nav-btn {
  font-size: 0.75rem;
  padding: 5px 14px;
  letter-spacing: 1px;
}

/* ── Dice Skip All Setup Link ─────────────────────────────────── */
.dice-skip-all {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  color: rgba(212, 168, 68, 0.45);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: color 0.15s;
}

.dice-skip-all:hover {
  color: #D4A844;
  text-decoration: underline;
}

/* ── Gameplay Action Buttons ─────────────────────────────────── */
.action-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  position: relative;
  background: rgba(30, 20, 10, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.25);
  border-radius: 6px;
  color: #E8DFD0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
}

.action-btn:hover:not(:disabled) {
  border-color: #D4A844;
  background: rgba(212, 168, 68, 0.12);
  box-shadow: 0 0 10px rgba(212, 168, 68, 0.15);
}

.action-btn:disabled, .action-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.action-btn-label { letter-spacing: 0.5px; white-space: nowrap; }

.action-cost {
  font-family: 'Crimson Text', serif;
  font-size: 0.7rem;
  color: rgba(212, 168, 68, 0.5);
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 24px;
}

.active-projects {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(212, 168, 68, 0.1);
}

.active-project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.6);
  padding: 3px 0;
}

.btn-cancel-project, .project-cancel-btn {
  background: rgba(120, 30, 30, 0.4);
  border: 1px solid rgba(139, 0, 0, 0.5);
  color: rgba(231, 76, 60, 0.8);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
}

.btn-cancel-project:hover, .project-cancel-btn:hover {
  background: rgba(139, 0, 0, 0.5);
  color: #e74c3c;
}

.action-btn-danger {
  border-left: 3px solid rgba(139, 0, 0, 0.6);
  background: rgba(120, 30, 30, 0.2);
}

.action-btn-danger:hover:not(:disabled) {
  background: rgba(120, 30, 30, 0.35);
  border-color: #e74c3c;
}

.action-btn-end {
  border: 1px solid rgba(212, 168, 68, 0.5);
  background: rgba(212, 168, 68, 0.08);
  font-weight: 700;
}

/* ── Action Tooltip Icons ────────────────────────────────────── */
.action-tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 68, 0.35);
  background: rgba(10, 8, 5, 0.4);
  color: rgba(212, 168, 68, 0.5);
  font-family: 'Crimson Text', serif;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  position: absolute;
  right: 8px;
  line-height: 1;
  transition: all 0.15s ease;
}

.action-tip-icon:hover {
  border-color: #D4A844;
  color: #D4A844;
  background: rgba(212, 168, 68, 0.1);
}

.action-tip-popup {
  position: fixed;
  z-index: 9998;
  max-width: 280px;
  padding: 10px 14px;
  background: rgba(10, 8, 5, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 168, 68, 0.4);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(232, 223, 208, 0.85);
  pointer-events: none;
  animation: tip-fade-in 0.2s ease-out;
}

@keyframes tip-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stat Selection Panel ────────────────────────────────────── */
.stat-select-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0;
}

.stat-select-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: rgba(30, 20, 10, 0.4);
  border: 1px solid rgba(212, 168, 68, 0.2);
  border-radius: 6px;
  color: #E8DFD0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
}

.stat-select-btn:hover:not(:disabled) {
  border-color: #D4A844;
  background: rgba(212, 168, 68, 0.1);
}

.stat-select-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stat-select-name { color: #D4A844; letter-spacing: 0.5px; }

.stat-select-val {
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.5);
}

.stat-select-note {
  font-family: 'Crimson Text', serif;
  font-size: 0.65rem;
  font-style: italic;
  color: rgba(232, 223, 208, 0.3);
  margin-left: 4px;
}

.btn-back {
  margin-top: 8px;
  font-size: 0.75rem;
  padding: 6px 14px;
  opacity: 0.7;
}

/* ── Action Roll Result ──────────────────────────────────────── */
.roll-breakdown {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.7);
  margin-bottom: 8px;
  text-align: center;
}

.result-banner {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.2rem;
  letter-spacing: 2px;
  margin: 8px 0;
  text-align: center;
  text-shadow: 0 0 12px currentColor;
}

.result-change {
  font-family: 'Crimson Text', serif;
  font-size: 0.9rem;
  color: rgba(232, 223, 208, 0.8);
  text-align: center;
  margin-bottom: 10px;
}

/* ── Battle / Trade Confirmation & Result ────────────────────── */
.battle-confirm { text-align: center; }

.battle-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.battle-side {
  flex: 1;
  text-align: center;
  padding: 12px;
  background: rgba(30, 20, 10, 0.4);
  border: 1px solid rgba(212, 168, 68, 0.2);
  border-radius: 8px;
}

.battle-side h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #D4A844;
  margin: 0 0 6px;
}

.battle-stat-line {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.7);
  margin: 4px 0;
}

.battle-vs {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.2rem;
  color: rgba(212, 168, 68, 0.5);
  flex-shrink: 0;
}

.battle-effects {
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
  color: rgba(232, 223, 208, 0.6);
  margin: 8px 0;
  line-height: 1.5;
}

.modal-content .btn { margin: 6px 4px; }
.modal-content .btn-danger {
  background: rgba(139, 0, 0, 0.5);
  border-color: rgba(231, 76, 60, 0.5);
}
.modal-content .btn-danger:hover {
  background: rgba(139, 0, 0, 0.7);
  border-color: #e74c3c;
}

/* ── Victory Screen ──────────────────────────────────────────── */
.victory-screen { text-align: center; }

.victory-screen .victory-crown {
  font-size: 3rem;
  margin-bottom: 10px;
}

.victory-screen h2 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.8rem;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(212, 168, 68, 0.5);
  margin-bottom: 8px;
}

.victory-screen .victory-condition {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: rgba(232, 223, 208, 0.7);
  letter-spacing: 1.5px;
  margin-bottom: 16px;
}

.victory-screen .victory-stats {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.5);
  line-height: 1.8;
  margin-bottom: 16px;
}

/* ── Map Hex Highlights ──────────────────────────────────────── */
.highlight-attack .hex-overlay {
  fill: rgba(231, 76, 60, 0.25);
  stroke: #e74c3c;
  stroke-width: 2px;
  animation: pulse-highlight 1.5s ease-in-out infinite;
}

.highlight-trade .hex-overlay {
  fill: rgba(243, 156, 18, 0.2);
  stroke: #f39c12;
  stroke-width: 2px;
  animation: pulse-highlight 1.5s ease-in-out infinite;
}

@keyframes pulse-highlight {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Sidebar Sections (Projects, Governors) ──────────────────── */
.sidebar-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(212, 168, 68, 0.12);
}

.sidebar-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: rgba(212, 168, 68, 0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-item {
  font-family: 'Crimson Text', serif;
  font-size: 0.78rem;
  color: rgba(232, 223, 208, 0.8);
  padding: 2px 0;
}

.sidebar-muted {
  font-size: 0.7rem;
  color: rgba(232, 223, 208, 0.4);
}

/* ── Hex Info — Owner Stats ──────────────────────────────────── */
.hex-owner-stats {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(212, 168, 68, 0.15);
}

.hex-stat-row {
  display: flex;
  justify-content: space-between;
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.6);
  padding: 1px 0;
}

/* ── Hex Claim Animation ─────────────────────────────────────── */
.hex-owner-overlay.hex-claim-anim {
  transition: fill-opacity 0.6s ease-out;
}

.hex-claim-flag {
  opacity: 1;
  animation: flag-plant 1.2s ease-out forwards;
}

@keyframes flag-plant {
  0% { opacity: 0; transform: translateY(10px) scale(0.5); }
  20% { opacity: 1; transform: translateY(-4px) scale(1.3); }
  40% { transform: translateY(0px) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(0.8); }
}

/* ── Civ Card Banner (setup flow) ─────────────────────────────── */
.civ-card-banner {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 68, 0.3);
  margin-bottom: 10px;
  display: block;
}

/* ── Shop Modal ──────────────────────────────────────────────── */
/* ── Shop — Premium Redesign ─────────────────────────────────── */
.modal-content:has(.shop-header) { max-width: 960px; }
.shop-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.shop-title { font-family: 'Cinzel', serif; font-size: 22px; color: #C9A96E; letter-spacing: 0.2em; text-shadow: 0 0 20px rgba(201,169,110,0.5); margin: 0; }
.credits-display { font-family: 'Cinzel', serif; font-size: 16px; color: #C9A96E; background: rgba(0,0,0,0.4); border: 1px solid rgba(201,169,110,0.3); border-radius: 20px; padding: 4px 14px; }

/* Tabs */
.shop-tab-bar { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid rgba(201,169,110,0.15); margin-bottom: 20px; }
.shop-tab { position: relative; font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: 0.12em; color: rgba(201,169,110,0.5); background: transparent; border: none; border-bottom: 2px solid transparent; padding: 10px 16px; cursor: pointer; transition: all 150ms; text-transform: uppercase; }
.shop-tab:hover { color: rgba(201,169,110,0.85); border-bottom-color: rgba(201,169,110,0.3); background: rgba(201,169,110,0.04); }
.shop-tab-active { color: #FFD700; border-bottom: 2px solid #C9A96E; text-shadow: 0 0 10px rgba(201,169,110,0.9), 0 0 20px rgba(201,169,110,0.5); background: rgba(201,169,110,0.08); border-radius: 4px 4px 0 0; }
.shop-tab-active::after { content: ''; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: #C9A96E; box-shadow: 0 0 6px rgba(201,169,110,0.8); }

/* Card grid */
.shop-cards-container { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; max-height: 50vh; overflow-y: auto; padding: 4px 4px 24px; scrollbar-width: thin; scrollbar-color: rgba(201,169,110,0.4) rgba(0,0,0,0.3); }
.shop-cards-container::-webkit-scrollbar { width: 4px; }
.shop-cards-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.shop-cards-container::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.4); border-radius: 2px; }

/* Item cards */
.shop-card { width: 200px; height: 280px; border-radius: 12px; position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: transform 200ms, box-shadow 200ms; flex-shrink: 0;
  background: linear-gradient(160deg, #1a1208 0%, #120e06 40%, #0e0a04 100%); }
.shop-card:hover { transform: translateY(-4px) scale(1.02); }
.shop-card::before { content: ''; position: absolute; inset: 0; border-radius: 12px; background: radial-gradient(ellipse at top left, var(--rarity-bg, rgba(158,158,158,0.08)) 0%, transparent 60%); pointer-events: none; z-index: 1; }

/* Rarity tiers */
.shop-card[data-rarity="common"] { --rarity-color: #9E9E9E; --rarity-glow: rgba(158,158,158,0.3); --rarity-bg: rgba(158,158,158,0.08); border: 1px solid #9E9E9E; }
.shop-card[data-rarity="rare"] { --rarity-color: #4A90D9; --rarity-glow: rgba(74,144,217,0.4); --rarity-bg: rgba(74,144,217,0.08); border: 1px solid #4A90D9; }
.shop-card[data-rarity="epic"] { --rarity-color: #9B59B6; --rarity-glow: rgba(155,89,182,0.5); --rarity-bg: rgba(155,89,182,0.1); border: 1px solid #9B59B6; }
.shop-card[data-rarity="legendary"] { --rarity-color: #C9A96E; --rarity-glow: rgba(201,169,110,0.6); --rarity-bg: rgba(201,169,110,0.12); border: 2px solid #C9A96E; animation: legendaryShimmer 3s ease-in-out infinite; }
@keyframes legendaryShimmer { 0%,100%{box-shadow:0 0 10px rgba(201,169,110,0.3)} 50%{box-shadow:0 0 25px rgba(201,169,110,0.6), 0 0 50px rgba(201,169,110,0.2)} }
.shop-card:hover { box-shadow: 0 12px 30px rgba(0,0,0,0.6), 0 0 20px var(--rarity-glow, rgba(158,158,158,0.2)); }

/* Card header */
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; position: relative; z-index: 2; }
.rarity-badge { font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: 0.15em; color: var(--rarity-color); background: rgba(0,0,0,0.4); border: 1px solid var(--rarity-color); border-radius: 3px; padding: 2px 6px; text-transform: uppercase; }
.featured-tag { font-family: 'Cinzel', serif; font-size: 9px; color: #FFD700; opacity: 0.8; }

/* Card icon */
.card-icon-area { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px; background: radial-gradient(circle at center, var(--rarity-bg, rgba(158,158,158,0.08)) 0%, transparent 70%); position: relative; z-index: 2; }
.card-icon { font-size: 3.5rem; filter: drop-shadow(0 0 8px var(--rarity-glow, rgba(158,158,158,0.3))); }
.card-icon-img { width: 90px; height: 90px; object-fit: cover; border-radius: 50%; font-size: 1rem; }

/* Card divider */
.card-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--rarity-color, #9E9E9E), transparent); opacity: 0.4; margin: 0 10px; position: relative; z-index: 2; }

/* Card info */
.card-info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 2; }
.card-name { font-family: 'Cinzel', serif; font-size: 11px; color: #E8DCC8; font-weight: bold; line-height: 1.3; }
.card-category { font-family: 'Crimson Text', Georgia, serif; font-size: 10px; color: var(--rarity-color, #9E9E9E); opacity: 0.8; text-transform: uppercase; letter-spacing: 0.1em; }
.card-price { font-family: 'Cinzel', serif; font-size: 12px; color: #C9A96E; margin-top: 2px; }
.card-original-price { text-decoration: line-through; opacity: 0.5; font-size: 10px; }
.card-sale-price { color: #FF6B6B; }
.card-sale-badge { background: #CC0000; color: white; font-family: 'Cinzel', serif; font-size: 8px; padding: 1px 5px; border-radius: 3px; margin-left: 4px; }
.card-price-val { color: #C9A96E; }

/* Buy button */
.card-buy-btn { margin-top: 6px; width: 100%; padding: 6px; font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 0.1em; background: linear-gradient(180deg, rgba(201,169,110,0.2) 0%, rgba(139,105,20,0.1) 100%); border: 1px solid #C9A96E; color: #C9A96E; border-radius: 4px; cursor: pointer; transition: all 150ms; }
.card-buy-btn:hover { background: rgba(201,169,110,0.3); color: #FFD700; box-shadow: 0 0 10px rgba(201,169,110,0.4); }
.card-btn-equipped { background: rgba(76,175,80,0.2); border-color: rgba(76,175,80,0.5); color: #4CAF50; cursor: default; }
.card-btn-disabled { opacity: 0.4; cursor: not-allowed; }

/* Bundle cards */
.shop-card-bundle { width: 420px; height: auto; }
.shop-bundle-items { display: flex; gap: 4px; padding: 8px; justify-content: center; background: rgba(0,0,0,0.3); }
.shop-bundle-thumb { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; border: 1px solid rgba(201,169,110,0.3); }
.shop-save-badge { background: rgba(76,175,80,0.3); color: #4CAF50; font-size: 0.55rem; padding: 1px 6px; border-radius: 3px; margin-left: 6px; }

/* Empty state */
.shop-empty { width: 100%; text-align: center; font-family: 'Crimson Text', Georgia, serif; color: rgba(232,223,208,0.4); padding: 40px 0; }

/* Buy Credits */
.buy-credits-section { border-top: 1px solid rgba(201,169,110,0.2); padding-top: 16px; margin-top: 16px; }
.credits-title { font-family: 'Cinzel', serif; font-size: 13px; color: #C9A96E; text-align: center; letter-spacing: 0.15em; margin-bottom: 12px; }
.credits-packages { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.credits-package { background: linear-gradient(180deg, #1a1208, #0e0a04); border: 1px solid rgba(201,169,110,0.3); border-radius: 8px; padding: 12px 20px; text-align: center; transition: all 150ms; cursor: pointer; position: relative; }
.credits-package:hover { border-color: #C9A96E; box-shadow: 0 0 15px rgba(201,169,110,0.3); transform: translateY(-2px); }
.credits-package.best-value { border-color: #FFD700; }
.credits-package.best-value::before { content: 'BEST VALUE'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: #CC0000; color: white; font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.credits-pkg-amount { font-family: 'Cinzel', serif; font-size: 1rem; color: #C9A96E; }
.credits-pkg-price { font-family: 'Crimson Text', Georgia, serif; font-size: 0.8rem; color: rgba(232,223,208,0.6); margin-top: 2px; }

/* Purchase animation */
.shop-card-purchased { animation: shop-flip 0.8s ease-in-out; }
@keyframes shop-flip { 0%{transform:perspective(600px) rotateY(0deg)} 50%{transform:perspective(600px) rotateY(180deg)} 100%{transform:perspective(600px) rotateY(360deg)} }

/* ── Shop Slot Machine Side Panel ────────────────────────────── */
.shop-slot-panel-fixed {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 210px;
  z-index: 6100;
  background: rgba(10, 8, 5, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(201, 169, 110, 0.35);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.shop-slot-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  gap: 10px;
}
.shop-slot-header {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 3px;
  color: #C9A96E;
  text-transform: uppercase;
}
.shop-slot-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(201, 169, 110, 0.5);
  box-shadow: 0 0 12px rgba(201, 169, 110, 0.2);
  background: rgba(10, 8, 5, 0.6);
}
.shop-slot-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shop-slot-name {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: #D4A844;
  text-align: center;
  line-height: 1.5;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(212, 168, 68, 0.3);
}
.shop-slot-flavor {
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.6);
  text-align: center;
}
.shop-slot-free-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: #5cb85c;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(92, 184, 92, 0.4);
  animation: slot-free-pulse 2s ease-in-out infinite;
}
.shop-slot-free-used {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.7rem;
  color: rgba(232, 223, 208, 0.35);
  font-style: italic;
}
.shop-slot-enter {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 12px 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #D4A844;
  background: rgba(10, 8, 5, 0.6);
  border: 1px solid rgba(201, 169, 110, 0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.shop-slot-enter:hover {
  border-color: #D4A844;
  box-shadow: 0 0 12px rgba(212, 168, 68, 0.3);
}
.shop-slot-enter-text {
  position: relative;
  z-index: 2;
}
/* Button rising dots */
.shop-slot-coins {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.shop-coin-drop {
  position: absolute;
  bottom: -6px;
  border-radius: 50%;
  background: #C9A96E;
  animation: shop-dot-rise linear forwards;
}
@keyframes shop-dot-rise {
  0% { transform: translateY(0); opacity: 0.5; }
  100% { transform: translateY(-50px); opacity: 0; }
}
.shop-slot-cost {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.7rem;
  color: rgba(232, 223, 208, 0.4);
}
/* Panel background 3D falling coins */
.shop-slot-embers {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  perspective: 400px;
}
.panel-coin {
  position: absolute;
  top: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFD700 0%, #C9A96E 40%, #8B6914 70%, #5C4A1E 100%);
  box-shadow: 2px 0 0 #8B6914, 3px 0 0 #5C4A1E, inset -2px -2px 4px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(255,215,0,0.3);
  border: 1px solid #A07D3A;
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  animation: coinFall var(--coin-dur) var(--coin-delay) linear both, panelCoinSpin var(--coin-spin) var(--coin-delay) linear infinite;
}
@keyframes coinFall {
  0%   { top: -20px; opacity: 0; }
  8%   { opacity: var(--coin-opacity, 0.6); }
  85%  { opacity: var(--coin-opacity, 0.5); }
  100% { top: calc(100% + 20px); opacity: 0; }
}
@keyframes panelCoinSpin {
  0%   { transform: rotateY(0deg) scaleX(1); }
  12%  { transform: rotateY(90deg) scaleX(0.1); }
  25%  { transform: rotateY(180deg) scaleX(1); }
  37%  { transform: rotateY(270deg) scaleX(0.1); }
  50%  { transform: rotateY(360deg) scaleX(1); }
  62%  { transform: rotateY(450deg) scaleX(0.1); }
  75%  { transform: rotateY(540deg) scaleX(1); }
  87%  { transform: rotateY(630deg) scaleX(0.1); }
  100% { transform: rotateY(720deg) scaleX(1); }
}

/* ── Slot Machine — Full Screen Casino ───────────────────────── */
.slot-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 6000; overflow-y: auto; animation: slot-enter 0.4s ease-out; }
.slot-exit { animation: slot-leave 0.4s ease-in forwards; }
@keyframes slot-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slot-leave { from { transform: translateX(0); } to { transform: translateX(100%); opacity: 0; } }

/* Background */
.slot-bg { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 0; background: url('assets/images/casino_background.jpg') center/cover no-repeat; }
.slot-bg-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; background: rgba(0,0,0,0.45); }
.slot-vignette { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(120,80,20,0.15) 70%, rgba(40,20,5,0.5) 100%); }

/* Curtain */
.slot-curtain { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; pointer-events: none; }
.slot-curtain-left, .slot-curtain-right { width: 50%; height: 100%; background: linear-gradient(135deg, #0a2a10 0%, #0f3a15 30%, #0a2a10 60%, #061a0a 100%); transition: transform 0.8s ease-out; box-shadow: inset 0 0 40px rgba(0,0,0,0.6); }
.slot-curtain-left { border-right: 3px solid #C9A96E; }
.slot-curtain-right { border-left: 3px solid #C9A96E; }
.slot-curtain-open .slot-curtain-left { transform: translateX(-100%); }
.slot-curtain-open .slot-curtain-right { transform: translateX(100%); }

/* Candle flicker */
.slot-candle { position: fixed; top: 0; bottom: 0; width: 80px; z-index: 3; pointer-events: none; }
.slot-candle-left { left: 0; background: linear-gradient(to right, rgba(180,120,40,0.1), transparent); animation: slot-flicker 3s ease-in-out infinite alternate; }
.slot-candle-right { right: 0; background: linear-gradient(to left, rgba(180,120,40,0.1), transparent); animation: slot-flicker 3.5s ease-in-out infinite alternate-reverse; }
@keyframes slot-flicker { 0%,100%{opacity:0.4} 30%{opacity:0.9} 60%{opacity:0.3} 80%{opacity:0.7} }

/* Smoke */
.slot-smoke { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.slot-smoke-wisp { position: absolute; bottom: -20px; width: 80px; height: 80px; background: radial-gradient(ellipse, rgba(180,170,160,0.06) 0%, transparent 70%); border-radius: 50%; animation: slot-smoke-rise 5s ease-out forwards; }
@keyframes slot-smoke-rise { 0%{transform:translateY(0) scale(1);opacity:0.05} 100%{transform:translateY(-110vh) scale(2.5);opacity:0} }

/* Back button */
.slot-back-btn { position: fixed; top: 12px; left: 12px; z-index: 20; font-family: 'Cinzel', serif; font-size: 0.8rem; color: #C9A96E; background: rgba(10,8,5,0.8); border: 1px solid rgba(201,169,110,0.3); border-radius: 6px; padding: 8px 14px; cursor: pointer; transition: all 0.2s; backdrop-filter: blur(4px); }
.slot-back-btn:hover { border-color: #D4A844; background: rgba(10,8,5,0.95); }

/* Content */
.slot-content { position: relative; z-index: 5; padding: 30px 20px; max-width: 960px; margin: 0 auto; text-align: center; opacity: 0; transition: opacity 0.6s ease-in; }
.slot-powered { opacity: 1; }

/* Casino sign video */
.casino-sign-wrapper {
  position: fixed;
  top: 80px;
  left: 12px;
  width: 420px;
  border-radius: 16px;
  overflow: visible;
  z-index: 10;
  pointer-events: none;
  animation: borderFlicker 8s infinite;
}
.casino-sign-wrapper::before {
  content: ''; position: absolute; top: -6px; left: -6px; right: -6px; bottom: -6px;
  border: 3px solid #C9A96E; border-radius: 20px; pointer-events: none;
  box-shadow: 0 0 15px rgba(201,169,110,0.6), 0 0 30px rgba(201,169,110,0.3);
}
.casino-sign-wrapper::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid #8B6914; border-radius: 16px; pointer-events: none;
}
.casino-sign-corner {
  position: absolute; width: 24px; height: 24px; z-index: 11;
  border-color: #C9A96E; border-style: solid; border-width: 0;
}
.casino-sign-corner-tl { top: -10px; left: -10px; border-top-width: 3px; border-left-width: 3px; border-radius: 6px 0 0 0; }
.casino-sign-corner-tr { top: -10px; right: -10px; border-top-width: 3px; border-right-width: 3px; border-radius: 0 6px 0 0; }
.casino-sign-corner-br { bottom: -10px; right: -10px; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 6px 0; }
.casino-sign-corner-bl { bottom: -10px; left: -10px; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 6px; }
@keyframes borderFlicker {
  0%,92%,100% { opacity: 1; }
  93% { opacity: 0.7; }
  94% { opacity: 1; }
  96% { opacity: 0.8; }
  97% { opacity: 1; }
}
.casino-sign-inner {
  border-radius: 16px;
  overflow: hidden;
}
.slot-sign-video {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: screen;
}

/* 3-column layout */
.slot-layout { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* LEFT — Creighton */
.slot-creighton { position: fixed; right: 120px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; width: 220px; z-index: 10; }
.slot-portrait { width: 190px; height: 190px; border-radius: 50%; overflow: hidden; border: 4px solid rgba(212,168,68,0.6); box-shadow: 0 0 30px rgba(212,168,68,0.25), inset 0 0 20px rgba(0,0,0,0.4); background: rgba(10,8,5,0.6); }
.slot-portrait img { width: 100%; height: 100%; object-fit: cover; }
.slot-speech-bubble { position: relative; max-width: 220px; }
.slot-speech { font-family: 'Crimson Text', Georgia, serif; font-style: italic; font-size: 0.9rem; color: rgba(232,223,208,0.85); text-align: center; line-height: 1.4; background: rgba(10,8,5,0.85); padding: 12px 14px; border-radius: 10px; border: 1px solid #C9A96E; backdrop-filter: blur(4px); min-height: 2.5em; }
.slot-cursor { color: #C9A96E; font-weight: bold; margin-left: 1px; }
.slot-cursor-blink { animation: slotCursorBlink 500ms steps(1) 2; }
@keyframes slotCursorBlink { 0%,100%{opacity:1} 50%{opacity:0} }
.slot-speech-arrow { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 10px solid rgba(10,8,5,0.85); position: absolute; top: -10px; left: 50%; transform: translateX(-50%); }

/* CENTER — Cabinet */
.slot-cabinet { position: relative; display: flex; align-items: stretch; order: 2; }
/* Cabinet ornate border overlay */
.slot-cabinet-inner {
  border: 3px solid #C9A96E;
  animation: cabinetBorderFlicker 8s infinite;
}
.slot-cabinet-inner::after {
  content: ''; position: absolute; top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 1px solid #8B6914; border-radius: inherit; pointer-events: none; z-index: 10;
}
@keyframes cabinetBorderFlicker {
  0%,92%,100% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 20px rgba(201,169,110,0.4), 0 0 40px rgba(201,169,110,0.2), inset 0 0 30px rgba(0,0,0,0.4); border-color: #C9A96E; }
  93% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.4); border-color: rgba(201,169,110,0.5); }
  94% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 20px rgba(201,169,110,0.4), inset 0 0 30px rgba(0,0,0,0.4); border-color: #C9A96E; }
  96% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.4); border-color: rgba(201,169,110,0.6); }
  97% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 20px rgba(201,169,110,0.4), inset 0 0 30px rgba(0,0,0,0.4); border-color: #C9A96E; }
}
/* Cabinet corner decorations */
.cabinet-corner { position: absolute; width: 28px; height: 28px; z-index: 11; pointer-events: none; }
.cabinet-corner::before, .cabinet-corner::after { content: ''; position: absolute; background: #C9A96E; border-radius: 2px; }
.cabinet-corner::before { top: 6px; left: 0; width: 18px; height: 3px; }
.cabinet-corner::after { top: 0; left: 6px; width: 3px; height: 18px; }
.corner-tl { top: -4px; left: -4px; }
.corner-tr { top: -4px; right: -4px; transform: rotate(90deg); }
.corner-br { bottom: -4px; right: -4px; transform: rotate(180deg); }
.corner-bl { bottom: -4px; left: -4px; transform: rotate(270deg); }
.slot-cabinet-glow { position: absolute; top: -20px; left: -20px; right: -20px; bottom: -20px; border-radius: 20px; background: radial-gradient(ellipse at center, rgba(201,169,110,0.12) 0%, transparent 70%); pointer-events: none; z-index: 0; }
.slot-cabinet-3d { position: absolute; top: 10px; left: -8px; bottom: -6px; width: 12px; background: linear-gradient(to right, #1a0e05, #2C1810); border-radius: 4px 0 0 4px; border: 1px solid rgba(139,105,20,0.3); border-right: none; z-index: 0; }
.slot-cabinet-inner { position: relative; z-index: 1; width: clamp(340px, 40vw, 440px); min-height: clamp(350px, 60vh, 520px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1a0d06 0%, #2c1508 15%, #3d1f0a 30%, #2a1206 50%, #3a1a08 65%, #251005 80%, #1a0d06 100%);
  border: 3px solid #C9A96E; border-radius: 4px 4px 10px 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(201,169,110,0.2), inset 0 0 30px rgba(0,0,0,0.4); overflow: hidden; }
.slot-cabinet-inner::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; border-radius: inherit; z-index: 1;
  background-image: repeating-linear-gradient(92deg, transparent 0px, transparent 3px, rgba(255,255,255,0.012) 3px, rgba(255,255,255,0.012) 4px, transparent 4px, transparent 9px, rgba(0,0,0,0.08) 9px, rgba(0,0,0,0.08) 10px);
  mix-blend-mode: overlay;
}
.slot-cabinet-top { font-family: 'Cinzel', serif; font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 700; letter-spacing: 5px; color: #D4A844; text-align: center; text-shadow: 0 0 15px rgba(212,168,68,0.5), 0 2px 4px rgba(0,0,0,0.8);
  background: linear-gradient(180deg, #120a04 0%, #1e0e05 50%, #150b04 100%); border-bottom: 2px solid #C9A96E; border-radius: 0; padding: 14px 20px 10px; position: relative; z-index: 2; animation: cabinetBorderFlicker 8s infinite; }
/* Side trim */
.slot-cabinet-trim { position: absolute; top: 60px; bottom: 60px; width: 6px; z-index: 2; }
.slot-trim-left { left: 6px; border-left: 2px solid rgba(201,169,110,0.25); background: repeating-linear-gradient(to bottom, transparent 0px, transparent 20px, rgba(201,169,110,0.15) 20px, rgba(201,169,110,0.15) 24px); }
.slot-trim-right { right: 6px; border-right: 2px solid rgba(201,169,110,0.25); background: repeating-linear-gradient(to bottom, transparent 0px, transparent 20px, rgba(201,169,110,0.15) 20px, rgba(201,169,110,0.15) 24px); }

/* Cabinet body with reels */
.slot-cabinet-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 20px; }

/* Reel window — CodePen sprite-sheet system */
.slot-reel-window {
  display: flex; gap: 8px; padding: 10px; position: relative;
  background: #0A0806; border: 4px solid #C9A96E; border-radius: 6px;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 12px rgba(201,169,110,0.15);
  width: 100%; transition: box-shadow 0.3s;
}
.slot-reel-glow { box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 25px rgba(201,169,110,0.4); }
.slot-win-line { position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: linear-gradient(to right, transparent, #C9A96E, transparent); z-index: 5; pointer-events: none; transform: translateY(-50%); }

/* Individual reel — sprite sheet background */
.reel {
  width: 120px; height: 360px;
  border: 1px solid rgba(201,169,110,0.3); border-radius: 3px;
  overflow: hidden; position: relative;
  background-repeat: repeat-y; background-position: 0 0;
}
.reel::after {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(rgba(0,0,0,0.6) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.6) 100%);
  pointer-events: none; z-index: 1;
}

/* Win animations by rarity */
.slot-win-common .slot-reel-window { animation: slotWinPulse 0.5s ease-out; --win-color: rgba(192,192,192,0.3); }
.slot-win-rare .slot-reel-window { animation: slotWinPulse 0.5s ease-out; --win-color: rgba(74,144,217,0.3); }
.slot-win-epic .slot-reel-window { animation: slotWinPulse 0.5s ease-out; --win-color: rgba(155,89,182,0.3); }
.slot-win-legendary .slot-reel-window { animation: slotWinLegendary 0.8s ease-out; }
@keyframes slotWinPulse { 0%{box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 30px var(--win-color)} 100%{box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 12px rgba(201,169,110,0.15)} }
@keyframes slotWinLegendary { 0%{box-shadow: 0 0 80px #C9A96E, inset 0 0 40px #C9A96E} 100%{box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 12px rgba(201,169,110,0.15)} }

/* Lever assembly */
.lever-assembly {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 0 12px 0 8px;
}
.lever-arm {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; user-select: none;
  transform-origin: bottom center;
  transition: transform 150ms ease-in;
}
.lever-arm:hover .lever-ball { filter: brightness(1.1); }
.lever-rod {
  width: 14px; height: 180px;
  background: linear-gradient(90deg, #8B6914 0%, #C9A96E 30%, #FFD700 50%, #C9A96E 70%, #8B6914 100%);
  border-radius: 7px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.5), -1px 0 4px rgba(255,215,0,0.2);
}
.lever-ball {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff6666, #cc0000 50%, #8b0000 100%);
  border: 2px solid #8b0000;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.6), inset -2px -2px 4px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(255,150,150,0.3);
  margin-bottom: -4px; z-index: 2;
  transition: filter 0.2s;
}
.lever-mount {
  width: 30px; height: 20px;
  background: linear-gradient(180deg, #2a2a2a, #111);
  border: 2px solid #C9A96E; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  margin-top: -4px;
}
.lever-arm.slot-lever-pulled { transform: rotate(40deg) !important; }
@keyframes cabinetShake { 0%{transform:translateX(0)} 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} 100%{transform:translateX(0)} }
.slot-cabinet-shake { animation: cabinetShake 150ms ease-out; }
.lever-label {
  font-family: 'Cinzel', serif; font-size: 11px; color: #C9A96E;
  letter-spacing: 0.15em; margin-top: 8px;
}

/* Cabinet base */
.slot-cabinet-base { background: linear-gradient(180deg, #1e1008 0%, #150b04 100%); border-top: 2px solid #8B6914; padding: 10px 20px; text-align: center; border-radius: 0 0 8px 8px; position: relative; z-index: 2; }
.slot-coin-slot { font-family: 'Cinzel', serif; font-size: 0.55rem; color: rgba(201,169,110,0.4); letter-spacing: 3px; border: 1px solid rgba(139,105,20,0.3); display: inline-block; padding: 3px 14px; border-radius: 3px; margin-bottom: 4px; }
.slot-monogram { font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 700; color: rgba(201,169,110,0.2); letter-spacing: 6px; }

/* RIGHT — Sidebar */
.slot-sidebar { position: fixed; right: 24px; width: 200px; display: flex; flex-direction: column; gap: 12px; z-index: 10; }
.slot-sidebar-title { font-family: 'Cinzel', serif; font-size: 10px; color: #C9A96E; letter-spacing: 0.15em; text-transform: uppercase; text-align: center; border-bottom: 1px solid rgba(201,169,110,0.2); padding-bottom: 6px; margin-bottom: 2px; }
.slot-sidebar-stats { font-family: 'Cinzel', serif; font-size: 11px; color: #E8DCC8; background: rgba(10,8,5,0.85); padding: 10px 14px; border-radius: 6px; border: 1px solid #C9A96E; box-shadow: 0 0 12px rgba(201,169,110,0.2); }
.slot-sidebar-stats > div { display: flex; justify-content: space-between; padding: 3px 0; }
.slot-stat-label { color: rgba(201,169,110,0.7); font-size: 10px; }
.slot-stat-val { color: rgba(232,223,208,0.8); }

/* Result panel — below record on right */
.slot-result { min-height: 40px; position: fixed; right: 24px; width: 220px; z-index: 20; }
.slot-reward {
  position: relative; left: auto; right: auto; top: auto; transform: none;
  display: inline-block; text-align: center; width: 100%; white-space: nowrap;
  padding: 8px 20px; background: rgba(10,8,5,0.92); border: 1px solid var(--rarity-color, #C9A96E);
  border-radius: 6px; font-family: 'Cinzel', serif; font-size: 13px; color: var(--rarity-color, #C9A96E);
  letter-spacing: 0.1em; box-shadow: 0 0 15px rgba(201,169,110,0.3);
  animation: slotToastIn 300ms ease-out forwards;
}
@keyframes slotToastIn {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Gold flash */
.slot-gold-flash { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(212,168,68,0.25); pointer-events: none; animation: slot-flash 0.3s ease-out forwards; }
@keyframes slot-flash { 0%{opacity:1} 100%{opacity:0} }

/* Balance */
.slot-balance { font-family: 'Cinzel', serif; font-size: 16px; color: #C9A96E; margin-bottom: 8px; letter-spacing: 2px; text-shadow: 0 0 12px rgba(212,168,68,0.4); text-align: center; }

/* Buttons */
.slot-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 4px 0 12px; }
.slot-btn { font-family: 'Cinzel', serif; font-size: 0.8rem; padding: 10px 24px; min-width: 160px; letter-spacing: 0.1em; background: linear-gradient(to bottom, #3D2B00, #1A1200) !important; border: 1px solid #C9A96E !important; color: #C9A96E !important; transition: all 150ms ease; }
.slot-btn:hover:not(:disabled) { box-shadow: 0 0 12px rgba(212,168,68,0.3); background: linear-gradient(to bottom, #4D3B10, #2A2200) !important; }
.slot-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.slot-btn-main { font-size: 0.9rem; padding: 10px 24px; }
.slot-btn:active:not(:disabled) { transform: scale(0.96) translateY(1px); box-shadow: none !important; }
.slot-btn-main:active:not(:disabled) { transform: scale(0.95) translateY(2px); }
.slot-btn-free { background: linear-gradient(to bottom, #1a3d1a, #0d2b0d) !important; border-color: #4CAF50 !important; color: #7FD47F !important; animation: slot-free-pulse 2s ease-in-out infinite; position: relative; overflow: hidden; }
.slot-btn-free::before { content: '\2726 FREE \2726'; position: absolute; top: -1px; left: 8px; font-size: 8px; letter-spacing: 2px; color: #4CAF50; opacity: 0.7; }
@keyframes slot-free-pulse { 0%,100%{box-shadow:0 0 6px rgba(76,175,80,0.4)} 50%{box-shadow:0 0 18px rgba(76,175,80,0.8), 0 0 30px rgba(76,175,80,0.3)} }
/* Win line flash */
@keyframes winLineFlash {
  0%,100% { opacity: 1; box-shadow: 0 0 12px #C9A96E, 0 0 30px #C9A96E; height: 3px; }
  50%     { opacity: 1; box-shadow: 0 0 30px #FFD700, 0 0 60px #FFD700; height: 4px; }
}
.slot-win-line-active { animation: winLineFlash 400ms ease-in-out 4; background: linear-gradient(to right, transparent, #FFD700, transparent) !important; }
/* Reel glow per rarity */
.reel-glow-common    { box-shadow: 0 0 20px rgba(192,192,192,0.8) !important; }
.reel-glow-rare      { box-shadow: 0 0 20px rgba(74,144,217,0.9) !important; }
.reel-glow-epic      { box-shadow: 0 0 20px rgba(155,89,182,0.9) !important; }
.reel-glow-legendary { box-shadow: 0 0 30px rgba(212,168,68,1.0) !important; }
/* Portrait win pulse */
@keyframes portraitWinPulse {
  0%,100% { border-color: rgba(212,168,68,0.6); box-shadow: 0 0 30px rgba(212,168,68,0.25); }
  50%     { border-color: #FFD700; box-shadow: 0 0 50px rgba(255,215,0,0.7), 0 0 80px rgba(255,215,0,0.3); }
}
.slot-portrait-win { animation: portraitWinPulse 600ms ease-in-out infinite; }
/* Cabinet win flare */
@keyframes cabinetWinFlare {
  0%   { box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 60px rgba(255,215,0,0.8), 0 0 100px rgba(255,215,0,0.4), inset 0 0 30px rgba(0,0,0,0.4); border-color: #FFD700; }
  100% { box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 20px rgba(201,169,110,0.4), 0 0 40px rgba(201,169,110,0.2), inset 0 0 30px rgba(0,0,0,0.4); border-color: #C9A96E; }
}
.slot-cabinet-win-flare { animation: cabinetWinFlare 800ms ease-out forwards; }
/* 10X slam */
.slot-10x-slam {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
  z-index: 200; font-family: 'Cinzel', serif; font-size: clamp(100px,20vw,180px); font-weight: 900;
  color: #FFD700; text-shadow: 0 0 40px rgba(255,215,0,0.9), 0 0 80px rgba(255,215,0,0.5), 4px 4px 0px #8B6914, 8px 8px 0px rgba(0,0,0,0.4);
  letter-spacing: -4px; pointer-events: none; user-select: none;
  animation: slam10x 900ms cubic-bezier(0.15,1.4,0.4,1.0) forwards;
}
@keyframes slam10x {
  0%   { transform: translate(-50%,-50%) scale(0) rotate(-8deg); opacity: 0; }
  40%  { transform: translate(-50%,-50%) scale(1.15) rotate(2deg); opacity: 1; }
  60%  { transform: translate(-50%,-50%) scale(0.95) rotate(-1deg); opacity: 1; }
  75%  { transform: translate(-50%,-50%) scale(1.05) rotate(0deg); opacity: 1; }
  85%  { transform: translate(-50%,-50%) scale(1.0) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1.0) rotate(0deg); opacity: 0; }
}
/* Coin shower */
.slot-coin { position: fixed; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFD700, #C9A96E 60%, #8B6914); border: 1px solid #8B6914; pointer-events: none; z-index: 100; animation: slotCoinFall var(--dur) cubic-bezier(0.25,0.46,0.45,0.94) forwards; }
@keyframes slotCoinFall { 0%{transform:translate(0,0) rotate(0deg);opacity:1} 100%{transform:translate(var(--tx),var(--ty)) rotate(var(--rot));opacity:0} }
/* Haul slide-in */
@keyframes haulSlideIn { 0%{opacity:0;transform:translateX(20px)} 100%{opacity:1;transform:translateX(0)} }

/* Bulk results */
.slot-bulk-summary { text-align: left; padding: 12px; background: rgba(10,8,5,0.92); border: 1px solid #C9A96E; border-radius: 6px; backdrop-filter: blur(8px); white-space: normal; word-break: break-word; animation: haulSlideIn 300ms ease-out forwards; box-shadow: 0 0 15px rgba(201,169,110,0.2); }
.slot-bulk-summary h3 { font-family: 'Cinzel', serif; font-size: 0.75rem; color: #C9A96E; margin-bottom: 8px; letter-spacing: 3px; border-bottom: 1px solid rgba(201,169,110,0.2); padding-bottom: 6px; }
.slot-bulk-list { max-height: 180px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(201,169,110,0.4) rgba(0,0,0,0.3); }
.slot-bulk-list::-webkit-scrollbar { width: 4px; }
.slot-bulk-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 2px; }
.slot-bulk-list::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.4); border-radius: 2px; }
.slot-bulk-row { padding: 4px 8px; margin-bottom: 3px; font-family: 'Crimson Text', Georgia, serif; font-size: 0.8rem; color: rgba(232,223,208,0.8); background: rgba(10,8,5,0.4); border-radius: 3px; }
.slot-bulk-totals { margin-top: 8px; font-family: 'Cinzel', serif; font-size: 0.7rem; color: #C9A96E; text-align: center; letter-spacing: 1px; }

/* ── Credits Modal ───────────────────────────────────────────── */
.credits-body {
  text-align: center;
}

.credits-body p {
  margin-bottom: 10px;
  color: var(--parchment);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.95rem;
}

.credits-tracks {
  text-align: left;
  margin: 16px 0;
  padding: 12px 16px;
  background: rgba(74, 44, 11, 0.15);
  border-radius: 6px;
  border: 1px solid rgba(74, 44, 11, 0.25);
}

.credits-tracks h4 {
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: rgba(212, 168, 68, 0.6);
}

.credits-source {
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.35);
  margin-bottom: 6px;
}

.credits-track {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.9rem;
  color: var(--parchment);
  padding: 3px 0;
}

/* ── Themes Modal ────────────────────────────────────────────── */
.theme-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
}

.theme-card {
  width: 200px;
  background: rgba(10, 8, 5, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.theme-card:hover {
  border-color: #D4A844;
  box-shadow: 0 0 15px rgba(212, 168, 68, 0.2);
  transform: scale(1.03);
}

.theme-card.active {
  border-color: #D4A844;
  box-shadow: 0 0 12px rgba(212, 168, 68, 0.25), inset 0 0 20px rgba(212, 168, 68, 0.06);
}

.theme-card-thumb {
  width: 100%;
  height: 100px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(30, 20, 10, 0.5);
  margin-bottom: 10px;
  display: block;
}

.theme-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #D4A844;
  letter-spacing: 1.5px;
}

.theme-card .theme-card-active-badge {
  font-size: 0.65rem;
  color: rgba(212, 168, 68, 0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}

/* ── Civilizations & Leaders Modal ────────────────────────────── */
.cl-tabs {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-bottom: 24px;
}

.cl-tab {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 2px;
  padding: 10px 28px;
  background: rgba(30, 20, 10, 0.4);
  border: 1px solid rgba(212, 168, 68, 0.25);
  color: rgba(232, 223, 208, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cl-tab:first-child { border-radius: 6px 0 0 6px; }
.cl-tab:last-child  { border-radius: 0 6px 6px 0; }

.cl-tab:hover {
  background: rgba(212, 168, 68, 0.12);
  color: #E8DFD0;
}

.cl-tab.active {
  background: rgba(212, 168, 68, 0.2);
  border-color: #D4A844;
  color: #D4A844;
}

.cl-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.cl-card {
  width: 110px;
  background: rgba(10, 8, 5, 0.5);
  border: 1px solid rgba(212, 168, 68, 0.25);
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.cl-card:hover {
  border-color: #D4A844;
  box-shadow: 0 0 15px rgba(212, 168, 68, 0.2);
  transform: scale(1.03);
}

.cl-card-portrait {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 2px solid rgba(212, 168, 68, 0.5);
  object-fit: cover;
  display: block;
  margin: 0 auto 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.cl-card-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  line-height: 1;
}

.cl-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: #D4A844;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.cl-card-title {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.7rem;
  color: rgba(232, 223, 208, 0.45);
  margin-top: 2px;
}

.cl-card-civ {
  width: 120px;
  padding: 16px 10px;
}

/* ── Leader/Civ Detail View ──────────────────────────────────── */
.cl-detail {
  display: flex;
  gap: 24px;
  text-align: left;
  max-width: 580px;
  margin: 0 auto;
}

.cl-detail-portrait-wrap {
  flex-shrink: 0;
}

.cl-detail-portrait {
  width: 140px;
  height: 140px;
  border-radius: 10px;
  border: 2px solid rgba(212, 168, 68, 0.6);
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.cl-detail-civ-icon {
  font-size: 4rem;
  flex-shrink: 0;
  width: 100px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
}

.cl-detail-info {
  flex: 1;
  min-width: 0;
}

.cl-detail-name {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: #D4A844;
  margin: 0 0 4px;
  letter-spacing: 1px;
}

.cl-detail-title {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(232, 223, 208, 0.5);
  margin-bottom: 6px;
}

.cl-detail-roll {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: rgba(212, 168, 68, 0.6);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.cl-detail-desc {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.7);
  margin-bottom: 10px;
}

.cl-detail-abilities {
  margin-bottom: 10px;
}

.cl-detail-ability {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.8);
  margin-bottom: 4px;
  line-height: 1.4;
}

.cl-detail-ability strong {
  color: #D4A844;
}

.cl-detail-bonuses {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cl-detail-bonuses li {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(232, 223, 208, 0.8);
  padding: 3px 0;
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}

.cl-detail-bonuses li::before {
  content: '\2022';
  color: #D4A844;
  position: absolute;
  left: 0;
}

.cl-detail-setup {
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
  color: rgba(232, 223, 208, 0.5);
  margin-bottom: 12px;
}

.cl-detail-lore {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: rgba(232, 223, 208, 0.4);
  line-height: 1.5;
  border-top: 1px solid rgba(212, 168, 68, 0.15);
  padding-top: 10px;
  margin-top: 6px;
}

.cl-back-btn {
  margin-top: 16px;
  font-size: 0.8rem;
  padding: 8px 20px;
}

/* Wider modal for C&L detail views */
.modal-content:has(.cl-detail) {
  max-width: 700px;
}
.modal-content:has(.cl-cards) {
  max-width: 700px;
}

/* Wider modal for Rules accordion */
.modal-content:has(.rules-acc-scroll) {
  max-width: 900px;
}

/* ── Golden Motes Particle Animation ──────────────────────────── */
@keyframes mote-rise {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  5% {
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.9;
    transform: translateY(-50vh) translateX(calc(var(--mote-drift, 0px) * 0.5));
  }
  90% {
    opacity: 0.7;
  }
  95% {
    opacity: 0;
  }
  100% {
    transform: translateY(-110vh) translateX(var(--mote-drift, 0px));
    opacity: 0;
  }
}

/* ── Theme: Right / Bottom-Right Layout (The Conqueror) ──────── */
#main-menu.theme-right .menu-content {
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 40px;
  padding-right: 40px;
}

#main-menu.theme-right .menu-title {
  margin-top: 0;
  margin-right: 0;
  text-align: right;
}

#main-menu.theme-right .menu-signpost {
  position: static;
  transform: none;
  align-items: flex-end;
  margin-top: 16px;
}

/* ── Theme: Left-Side Layout (The Imperialist) ──────────────── */
#main-menu.theme-left .menu-vignette {
  background:
    linear-gradient(to left,
      transparent 30%,
      rgba(0, 0, 0, 0.3) 55%,
      rgba(0, 0, 0, 0.7) 80%,
      rgba(0, 0, 0, 0.8) 100%),
    radial-gradient(ellipse at center,
      transparent 45%,
      rgba(10, 7, 5, 0.35) 75%,
      rgba(10, 7, 5, 0.7) 100%);
}

#main-menu.theme-left .menu-content {
  align-items: flex-start;
  justify-content: flex-start;
  padding-left: 40px;
  padding-top: 40px;
}

#main-menu.theme-left .menu-title {
  margin-top: 0;
  margin-right: 0;
  margin-left: 0;
  text-align: left;
}

#main-menu.theme-left .menu-signpost {
  position: static;
  transform: none;
  right: auto;
  left: auto;
  align-items: flex-start;
  margin-top: 20px;
}

/* ── Theme: Bottom Layout (The Wayfarer) ─────────────────────── */
#main-menu.theme-bottom .menu-vignette {
  background:
    linear-gradient(to bottom,
      transparent 30%,
      rgba(0, 0, 0, 0.3) 55%,
      rgba(0, 0, 0, 0.7) 80%,
      rgba(0, 0, 0, 0.85) 100%),
    radial-gradient(ellipse at center,
      transparent 45%,
      rgba(10, 7, 5, 0.35) 75%,
      rgba(10, 7, 5, 0.7) 100%);
}

#main-menu.theme-bottom .menu-content {
  align-items: center;
  justify-content: flex-start;
}

#main-menu.theme-bottom .menu-title {
  margin-right: 0;
  margin-left: 0;
  text-align: center;
  margin-top: 6vh;
  filter: drop-shadow(0 0 30px rgba(10, 30, 65, 0.5));
}
#main-menu.theme-bottom .menu-title h1 {
  text-shadow:
    0 0 20px rgba(14, 40, 82, 0.9),
    0 0 40px rgba(10, 30, 65, 0.8),
    0 0 60px rgba(6, 22, 48, 0.6),
    0 0 80px rgba(4, 14, 30, 0.4),
    0 2px 4px rgba(0,0,0,0.9);
}

#main-menu.theme-bottom .menu-signpost {
  position: absolute;
  right: auto;
  left: 60px;
  top: auto;
  bottom: 80px;
  transform: none;
}

#main-menu.theme-bottom .plank-btn {
  background: rgba(5, 15, 35, 0.7);
  border-color: rgba(201, 169, 110, 0.4);
}
#main-menu.theme-bottom .plank-btn:hover {
  background: rgba(8, 20, 45, 0.85);
}
#main-menu.theme-bottom .plank-btn.disabled {
  background: rgba(5, 15, 35, 0.4);
}
#main-menu.theme-bottom .patch-notes {
  background: rgba(5, 15, 35, 0.6);
  left: auto;
  right: 24px;
  bottom: 8px;
}

/* ── Rain Particle Animation ─────────────────────────────────── */
@keyframes rain-fall {
  0% {
    transform: rotate(15deg) translateY(0);
    opacity: 0;
  }
  5% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(15deg) translateY(110vh);
    opacity: 0;
  }
}

@keyframes rain-splash {
  0%, 85% {
    opacity: 0;
    transform: scale(0);
  }
  90% {
    opacity: 0.5;
    transform: scale(1.5);
  }
  100% {
    opacity: 0;
    transform: scale(0.5);
  }
}

/* ── Theme Transition Fade ───────────────────────────────────── */
.theme-fade {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.theme-fade.active {
  opacity: 1;
}

/* ── Dev Mode Button ──────────────────────────────────────────── */
.dev-mode-btn {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(180, 170, 155, 0.6);
  background: rgba(10, 8, 5, 0.3);
  border: 1px solid rgba(120, 110, 100, 0.3);
  border-radius: 4px;
  padding: 5px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.dev-mode-btn:hover {
  color: rgba(212, 168, 68, 0.7);
  border-color: rgba(212, 168, 68, 0.4);
  background: rgba(10, 8, 5, 0.5);
}

/* ── Scrollbar for side panel ─────────────────────────────────── */
#side-panel::-webkit-scrollbar { width: 6px; }
#side-panel::-webkit-scrollbar-track { background: transparent; }
#side-panel::-webkit-scrollbar-thumb { background: var(--med-brown); border-radius: 3px; }

/* ── Log scrollbar ────────────────────────────────────────────── */
.log-entries::-webkit-scrollbar { width: 6px; }
.log-entries::-webkit-scrollbar-track { background: transparent; }
.log-entries::-webkit-scrollbar-thumb { background: var(--med-brown); border-radius: 3px; }

/* ── Entrance Animations ─────────────────────────────────────── */
@keyframes overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ══════════════════════════════════════════════════════════════════
   MAIN MENU
   ══════════════════════════════════════════════════════════════════ */

#main-menu {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 5000;
  overflow: hidden;
  background: #1a0f0a;
}

/* ── Video Background ─────────────────────────────────────────── */
.menu-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}


/* ── Dark Liquid Glass Overlay ────────────────────────────────── */
.menu-glass {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.3) 100%),
    rgba(5, 4, 3, 0.45);
  backdrop-filter: blur(2px) saturate(0.8);
  -webkit-backdrop-filter: blur(2px) saturate(0.8);
}

/* ── Background & Parallax Layers ─────────────────────────────── */
.menu-bg-layer {
  position: absolute;
  top: -3%; left: -3%;
  width: 106%; height: 106%;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

#menu-bg {
  background: url('images/war-room.jpg') center center / cover no-repeat;
  background-color: #1a0f0a;
}

#menu-fog {
  background: radial-gradient(ellipse at 50% 80%,
    rgba(184, 134, 11, 0.06) 0%,
    transparent 50%),
    radial-gradient(ellipse at 30% 40%,
    rgba(139, 69, 19, 0.05) 0%,
    transparent 60%);
  pointer-events: none;
}

/* ── Right-Side Darkening Gradient ────────────────────────────── */
.menu-vignette {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    /* Right-side darkening so buttons are readable */
    linear-gradient(to right,
      transparent 30%,
      rgba(0, 0, 0, 0.3) 55%,
      rgba(0, 0, 0, 0.7) 80%,
      rgba(0, 0, 0, 0.8) 100%),
    /* Subtle edge vignette */
    radial-gradient(ellipse at center,
      transparent 45%,
      rgba(10, 7, 5, 0.35) 75%,
      rgba(10, 7, 5, 0.7) 100%);
  pointer-events: none;
  z-index: 2;
}

/* ── Firelight Flicker ────────────────────────────────────────── */
.menu-firelight {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 55% 75%,
    rgba(184, 134, 11, 0.12) 0%,
    rgba(255, 140, 0, 0.04) 30%,
    transparent 65%);
  animation: firelight-pulse 4s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 3;
}

@keyframes firelight-pulse {
  0%   { opacity: 0.6; transform: scale(1); }
  25%  { opacity: 0.9; transform: scale(1.02); }
  50%  { opacity: 0.5; transform: scale(0.98); }
  75%  { opacity: 1;   transform: scale(1.03); }
  100% { opacity: 0.7; transform: scale(1.01); }
}

/* ── Lantern Glows ────────────────────────────────────────────── */
.menu-lantern {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

.lantern-left {
  bottom: 8%; left: 3%;
  background: radial-gradient(circle,
    rgba(184, 134, 11, 0.15) 0%,
    rgba(255, 140, 0, 0.06) 40%,
    transparent 70%);
  animation: lantern-glow-1 5s ease-in-out infinite alternate;
}

.lantern-right {
  bottom: 10%; right: 5%;
  background: radial-gradient(circle,
    rgba(218, 165, 32, 0.12) 0%,
    rgba(255, 140, 0, 0.05) 40%,
    transparent 70%);
  animation: lantern-glow-2 6.5s ease-in-out infinite alternate;
}

.lantern-top {
  top: 5%; right: 20%;
  width: 180px; height: 180px;
  background: radial-gradient(circle,
    rgba(184, 134, 11, 0.08) 0%,
    transparent 60%);
  animation: lantern-glow-3 7s ease-in-out infinite alternate;
}

@keyframes lantern-glow-1 {
  0%   { opacity: 0.5; transform: scale(1); }
  50%  { opacity: 1;   transform: scale(1.1); }
  100% { opacity: 0.6; transform: scale(0.95); }
}
@keyframes lantern-glow-2 {
  0%   { opacity: 0.4; transform: scale(0.95); }
  50%  { opacity: 0.9; transform: scale(1.05); }
  100% { opacity: 0.5; transform: scale(1); }
}
@keyframes lantern-glow-3 {
  0%   { opacity: 0.3; transform: scale(1); }
  50%  { opacity: 0.7; transform: scale(1.08); }
  100% { opacity: 0.4; transform: scale(0.97); }
}

/* ── Ember Canvas ─────────────────────────────────────────────── */
#ember-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* ── Cursor Spotlight ─────────────────────────────────────────── */
#menu-spotlight {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(184, 134, 11, 0.07) 0%,
    rgba(218, 165, 32, 0.03) 30%,
    transparent 60%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  transition: left 0.1s ease-out, top 0.1s ease-out;
}

/* ── Menu Content (above effects) ─────────────────────────────── */
.menu-content {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ── Title ────────────────────────────────────────────────────── */
.menu-title {
  margin-top: 8vh;
  margin-right: min(8vw, 160px);
  text-align: right;
  user-select: none;
}

.menu-title h1 {
  font-family: 'Cinzel', serif;
  font-variant: small-caps;
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 8px;
  text-transform: uppercase;
  text-shadow:
    0 0 40px rgba(184, 134, 11, 0.5),
    0 0 80px rgba(184, 134, 11, 0.25),
    0 0 120px rgba(184, 134, 11, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 4px 8px rgba(0, 0, 0, 0.6);
  -webkit-text-stroke: 0.5px rgba(218, 165, 32, 0.4);
}

.menu-subtitle {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  color: var(--gold-light);
  letter-spacing: 6px;
  margin-top: 8px;
  text-shadow:
    0 0 20px rgba(184, 134, 11, 0.4),
    0 0 40px rgba(184, 134, 11, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.8);
}

/* ── Menu Button Group ────────────────────────────────────────── */
.menu-signpost {
  position: absolute;
  right: min(8vw, 160px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signpost-board {
  display: contents;
}

/* No nail/pin pseudo-element */
.signpost-board::before {
  display: none;
}

/* ── Menu Buttons ────────────────────────────────────────────── */
.plank-btn {
  display: block;
  padding: 14px 48px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #D4A844;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid rgba(212, 168, 68, 0.5);
  border-radius: 2px;
  background: rgba(10, 8, 5, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease;
  opacity: 0;
  animation: menu-btn-fade-in 0.5s ease-out forwards;
}

/* Staggered fade-in */
.plank-btn:nth-child(1) { animation-delay: 0.1s; }
.plank-btn:nth-child(2) { animation-delay: 0.2s; }
.plank-btn:nth-child(3) { animation-delay: 0.3s; }
.plank-btn:nth-child(4) { animation-delay: 0.4s; }
.plank-btn:nth-child(5) { animation-delay: 0.5s; }
.plank-btn:nth-child(6) { animation-delay: 0.6s; }

@keyframes menu-btn-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plank-btn:hover {
  color: #f0d070;
  border-color: #D4A844;
  background: rgba(20, 16, 10, 0.7);
  box-shadow: 0 0 15px rgba(212, 168, 68, 0.2);
  text-shadow: 0 0 8px rgba(212, 168, 68, 0.3), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.plank-btn:active {
  background: rgba(25, 20, 12, 0.75);
  box-shadow: 0 0 8px rgba(212, 168, 68, 0.15);
  transform: scale(0.98);
}

/* ── Wayfarer theme — music button ────────────────────────────── */
#main-menu.theme-bottom .menu-music-toggle {
  background: rgba(5,15,35,0.7);
  border-color: rgba(201,169,110,0.4);
}
#main-menu.theme-bottom .menu-music-toggle:hover {
  background: rgba(8,20,45,0.85);
  border-color: #C9A96E;
}
#main-menu.theme-bottom .menu-vol-slider {
  background: rgba(4,14,30,0.9);
  border-color: rgba(201,169,110,0.3);
}

/* ── Wayfarer theme — global modal styling ────────────────────── */
body.wayfarer-active #modal-overlay {
  background: rgba(2,8,18,0.75);
  backdrop-filter: blur(4px);
}
body.wayfarer-active .modal-content {
  background: linear-gradient(180deg, rgba(4,14,30,0.95) 0%, rgba(6,22,48,0.95) 100%);
  border: 2px solid rgba(201,169,110,0.3);
  box-shadow: 0 0 40px rgba(14,40,82,0.3), inset 0 0 20px rgba(2,8,18,0.5);
}
body.wayfarer-active .modal-content h2 {
  color: #C9A96E;
  text-shadow: 0 0 15px rgba(14,40,82,0.6);
  border-bottom: 1px solid rgba(201,169,110,0.2);
  padding-bottom: 12px;
}
body.wayfarer-active .theme-cards { gap: 16px; }
body.wayfarer-active .theme-card {
  background: rgba(6,22,48,0.8);
  border: 1px solid rgba(201,169,110,0.2);
  box-shadow: 0 0 10px rgba(14,40,82,0.2);
}
body.wayfarer-active .theme-card:hover {
  border-color: rgba(201,169,110,0.5);
  box-shadow: 0 0 20px rgba(14,40,82,0.4), inset 0 0 10px rgba(2,8,18,0.4);
}
body.wayfarer-active .theme-card.active {
  border: 2px solid #C9A96E;
  box-shadow: 0 0 25px rgba(201,169,110,0.3), 0 0 50px rgba(14,40,82,0.4);
}
body.wayfarer-active .theme-card-name { color: #C9A96E; }
body.wayfarer-active .theme-card-active-badge {
  color: #C9A96E;
  background: rgba(10,30,65,0.8);
  border: 1px solid rgba(201,169,110,0.3);
}
body.wayfarer-active .modal-content .btn {
  background: rgba(5,15,35,0.7);
  border-color: rgba(201,169,110,0.4);
  color: #C9A96E;
}
body.wayfarer-active .modal-content .btn:hover {
  background: rgba(8,20,45,0.85);
  box-shadow: 0 0 12px rgba(14,40,82,0.3);
}
/* Wayfarer: shop modal */
body.wayfarer-active .shop-tab {
  background: rgba(5,15,35,0.5);
  border-color: rgba(201,169,110,0.2);
  color: rgba(201,169,110,0.6);
}
body.wayfarer-active .shop-tab--active {
  background: rgba(10,30,65,0.7);
  border-color: rgba(201,169,110,0.5);
  color: #C9A96E;
}
body.wayfarer-active .shop-card {
  background: rgba(6,22,48,0.7);
}
/* Wayfarer: settings, rules, credits modals */
body.wayfarer-active .settings-row {
  border-bottom-color: rgba(201,169,110,0.1);
}
body.wayfarer-active .credits-tracks {
  background: rgba(6,22,48,0.3);
  border-color: rgba(201,169,110,0.15);
}
body.wayfarer-active .rules-acc-header {
  background: rgba(6,22,48,0.5);
}
/* Wayfarer: player setup / lobby screen */
body.wayfarer-active #setup-panel {
  background: rgba(2,8,18,0.5);
}
body.wayfarer-active .setup-card {
  background: linear-gradient(180deg, rgba(2,8,18,0.95) 0%, rgba(6,22,48,0.95) 100%);
  border: 2px solid #4A6FA5;
  box-shadow: 0 0 40px rgba(14,40,82,0.7), inset 0 0 20px rgba(2,8,18,0.5);
  position: relative;
  overflow: hidden;
}
body.wayfarer-active .setup-card h2 {
  color: #C9A96E;
  text-shadow: 0 0 15px rgba(14,40,82,0.9), 0 0 30px rgba(10,30,65,0.6);
}
body.wayfarer-active .fast-summary-human {
  background: rgba(6,22,48,0.5);
  border-color: rgba(74,111,165,0.5);
  box-shadow: 0 0 12px rgba(14,40,82,0.4);
}
body.wayfarer-active .fast-summary-human h3 {
  color: #8FB3D9 !important;
  border-bottom: 1px solid rgba(74,111,165,0.3);
  padding-bottom: 6px;
}
body.wayfarer-active .fast-img {
  box-shadow: 0 0 12px rgba(14,40,82,0.8), 0 0 0 2px #4A6FA5;
  border-color: #4A6FA5;
}
body.wayfarer-active .fast-summary-label {
  color: rgba(143,179,217,0.7);
  letter-spacing: 0.15em;
}
body.wayfarer-active .skip-auto-tag {
  color: rgba(143,179,217,0.5);
}
body.wayfarer-active .fast-summary-value {
  color: #C9A96E;
}
body.wayfarer-active .fast-summary-desc {
  color: rgba(232,220,200,0.7);
}
body.wayfarer-active .fast-summary-bot {
  border-bottom-color: rgba(74,111,165,0.2);
  color: rgba(232,220,200,0.9);
}
body.wayfarer-active .fast-img-fallback {
  background: rgba(4,14,30,0.7);
  border-color: #4A6FA5;
  color: #8FB3D9;
}
/* Wayfarer setup summary scrollbar */
body.wayfarer-active .setup-card::-webkit-scrollbar { width: 4px; }
body.wayfarer-active .setup-card::-webkit-scrollbar-track { background: rgba(2,8,18,0.9); }
body.wayfarer-active .setup-card::-webkit-scrollbar-thumb { background: #4A6FA5; border-radius: 2px; }
body.wayfarer-active .lobby-slot {
  background: rgba(6,22,48,0.5);
  border-color: rgba(201,169,110,0.2);
}
body.wayfarer-active .lobby-slot--empty {
  border-color: rgba(201,169,110,0.08);
}
body.wayfarer-active .lobby-tog-btn {
  background: rgba(4,14,30,0.6);
  border-color: rgba(201,169,110,0.2);
  color: rgba(201,169,110,0.4);
}
body.wayfarer-active .lobby-tog--active {
  background: rgba(10,30,65,0.6);
  border-color: rgba(201,169,110,0.5);
  color: #C9A96E;
}
body.wayfarer-active .lobby-name-input {
  background: rgba(4,14,30,0.6);
  border-color: rgba(201,169,110,0.3);
}
body.wayfarer-active .lobby-name-input:focus {
  border-color: #C9A96E;
  box-shadow: 0 0 8px rgba(14,40,82,0.4);
}
body.wayfarer-active .lobby-name-input--bot {
  background: rgba(2,8,18,0.7);
}
body.wayfarer-active .lobby-begin-btn,
body.wayfarer-active .btn-setup {
  background: linear-gradient(135deg, rgba(2,8,18,0.9) 0%, rgba(6,22,48,0.9) 100%);
  border: 1px solid #4A6FA5;
  color: #8FB3D9;
  box-shadow: 0 0 12px rgba(14,40,82,0.5);
  transition: all 150ms ease;
}
body.wayfarer-active .lobby-begin-btn:hover,
body.wayfarer-active .btn-setup:hover {
  border-color: #C9A96E;
  color: #C9A96E;
  box-shadow: 0 0 20px rgba(14,40,82,0.8);
}
body.wayfarer-active .setup-music-wrap .menu-music-toggle {
  background: rgba(5,15,35,0.7);
  border-color: rgba(201,169,110,0.4);
}

/* ── Wayfarer theme — dice roller ─────────────────────────────── */
body.wayfarer-active .dice-roller-backdrop {
  background: rgba(2,8,18,0.6);
}
body.wayfarer-active .dice-roller-frame {
  background: rgba(4,14,30,0.8);
  border: 1px solid #4A6FA5;
  box-shadow: 0 0 30px rgba(14,40,82,0.7), 0 0 60px rgba(10,30,65,0.4);
}
body.wayfarer-active .dice-roller-prompt {
  background: rgba(5,15,35,0.8);
  border-color: rgba(201,169,110,0.3);
}
body.wayfarer-active .dice-roller-result {
  text-shadow: 0 0 20px rgba(14,40,82,0.6);
}
body.wayfarer-active #dice-overlay {
  background: rgba(2,8,18,0.5);
}

/* ── Wayfarer theme — in-game global styling ─────────────────── */
#game-container.theme-wayfarer {
  background: linear-gradient(180deg, rgba(2,8,18,1) 0%, rgba(6,22,48,0.98) 100%);
}
#game-container.theme-wayfarer #turn-bar {
  background: rgba(4,14,30,0.9);
  border-bottom-color: rgba(201,169,110,0.3);
}
#game-container.theme-wayfarer #side-panel {
  background: rgba(4,14,30,0.85);
  border-color: rgba(201,169,110,0.2);
}
#game-container.theme-wayfarer #game-log {
  background: rgba(4,14,30,0.85);
  border-color: rgba(201,169,110,0.2);
}
#game-container.theme-wayfarer .btn,
#game-container.theme-wayfarer .action-btn {
  background: rgba(5,15,35,0.7);
  border-color: rgba(201,169,110,0.4);
}
#game-container.theme-wayfarer .btn:hover,
#game-container.theme-wayfarer .action-btn:hover {
  background: rgba(8,20,45,0.85);
}
#game-container.theme-wayfarer .setup-card {
  background: rgba(4,14,30,0.85);
  border-color: rgba(201,169,110,0.3);
}
#game-container.theme-wayfarer .panel-section {
  border-color: rgba(201,169,110,0.15);
}

/* ── Wayfarer victory ship silhouette ─────────────────────────── */
.wayfarer-victory-ship {
  position: fixed;
  bottom: 22vh;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 60px;
  z-index: 10003;
  pointer-events: none;
  animation: shipBob 3s ease-in-out infinite;
}
.wayfarer-victory-ship::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  width: 60px;
  height: 20px;
  background: #0a0a0a;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.wayfarer-victory-ship::after {
  content: '';
  position: absolute;
  bottom: 18px;
  left: 35px;
  width: 3px;
  height: 40px;
  background: #0a0a0a;
  box-shadow: -12px 8px 0 0 #0a0a0a, -12px 8px 0 8px rgba(10,10,10,0.6);
}
@keyframes shipBob {
  0%, 100% { transform: translateX(-50%) translateY(-3px); }
  50% { transform: translateX(-50%) translateY(3px); }
}

/* ── Wayfarer ship rock animation ─────────────────────────────── */
@keyframes shipRock {
  0%   { transform: rotate(-2deg) translateY(0px); }
  25%  { transform: rotate(0deg) translateY(-3px); }
  50%  { transform: rotate(2deg) translateY(0px); }
  75%  { transform: rotate(0deg) translateY(-2px); }
  100% { transform: rotate(-2deg) translateY(0px); }
}

/* ── Wayfarer wave hover effect ───────────────────────────────── */
.wave-hover {
  box-shadow: 0 0 20px rgba(201,169,110,0.8), inset 0 0 15px rgba(10,40,80,0.5) !important;
}
.wave-hover * {
  text-shadow: 0 0 10px rgba(201,169,110,0.9);
}

/* ── Music Toggle ─────────────────────────────────────────────── */
/* ── Music Button + Volume Slider ─────────────────────────────── */
.menu-music-wrap {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 0;
}

.menu-music-toggle {
  background: rgba(61, 43, 31, 0.7);
  border: 1px solid rgba(184, 134, 11, 0.4);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.menu-music-toggle:hover {
  background: rgba(61, 43, 31, 0.9);
  border-color: var(--gold);
}

.music-icon {
  font-size: 1.1rem;
}

/* Volume slider — hidden by default, slides out on hover */
.menu-vol-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 8, 5, 0.6);
  border: 1px solid rgba(212, 168, 68, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px 0 0 8px;
  padding: 8px 12px;
  margin-right: -4px;
  opacity: 0;
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease-out 0.5s, width 0.2s ease-out 0.5s, padding 0.2s ease-out 0.5s;
}

/* Show slider when hovering the wrapper */
.menu-music-wrap:hover .menu-vol-slider {
  opacity: 1;
  width: 160px;
  padding: 8px 12px;
  pointer-events: auto;
  transition-delay: 0s;
}

.menu-vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 4px;
  background: #2A1F10;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.menu-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D4A844;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212, 168, 68, 0.5);
  margin-top: -5px;
}

.menu-vol-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D4A844;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px rgba(212, 168, 68, 0.5);
}

.menu-vol-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}

.menu-vol-pct {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: #D4A844;
  min-width: 20px;
  text-align: right;
  margin-left: -2px;
}

/* ── Setup Music Controls (lobby screen) ─────────────────────── */
.setup-music-wrap {
  position: fixed;
  top: 8px;
  right: 20px;
  z-index: 600;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 0;
}
.setup-music-wrap .menu-vol-slider {
  opacity: 0;
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease-out 0.5s, width 0.2s ease-out 0.5s, padding 0.2s ease-out 0.5s;
}
.setup-music-wrap:hover .menu-vol-slider {
  opacity: 1;
  width: 160px;
  padding: 8px 12px;
  pointer-events: auto;
  transition-delay: 0s;
}

/* Music Muted State — handled by inline SVG injected via JS */

/* ── Audio Splash ─────────────────────────────────────────────── */
#audio-splash {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.5s;
}

#audio-splash h2 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 2.5rem;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(184, 134, 11, 0.5);
  margin-bottom: 16px;
}

#audio-splash p {
  color: var(--parchment);
  font-size: 1.1rem;
  animation: splash-pulse 2s ease-in-out infinite;
}

@keyframes splash-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Menu Fade Out Transition ─────────────────────────────────── */
.menu-fade-out {
  animation: menu-exit 0.8s ease-in forwards;
}

@keyframes menu-exit {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}

/* ── Load Game (disabled styling) ─────────────────────────────── */
.plank-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(212, 168, 68, 0.2);
  color: rgba(212, 168, 68, 0.4);
}

/* ── Version Number ──────────────────────────────────────────── */
.menu-version {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 10px;
  color: rgba(212, 168, 68, 0.2);
  letter-spacing: 1px;
  z-index: 10;
  user-select: none;
}

/* ── Patch Notes ─────────────────────────────────────────────── */
.patch-notes {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 380px;
  max-height: 300px;
  background: rgba(10, 8, 5, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(212, 168, 68, 0.3);
  border-radius: 8px;
  padding: 14px 16px;
  z-index: 10;
  overflow: hidden;
  overflow-y: auto;
  font-size: 13px;
}

/* When buttons are on the left (theme-left), move patch notes to right */
#main-menu.theme-left .patch-notes {
  left: auto;
  right: 24px;
  bottom: 8px;
}

.patch-notes::-webkit-scrollbar { width: 4px; }
.patch-notes::-webkit-scrollbar-track { background: rgba(74, 44, 11, 0.1); border-radius: 2px; }
.patch-notes::-webkit-scrollbar-thumb { background: rgba(212, 168, 68, 0.3); border-radius: 2px; }

.patch-header {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: #D4A844;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.patch-version {
  font-size: 12px;
  color: rgba(212, 168, 68, 0.4);
  letter-spacing: 1px;
  margin-left: 6px;
}

.patch-date {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: rgba(212, 168, 68, 0.5);
  margin-bottom: 4px;
}

.patch-entries ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.patch-entries li {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 12px;
  color: rgba(232, 223, 208, 0.75);
  line-height: 1.5;
  padding-left: 10px;
  position: relative;
}

.patch-entries li::before {
  content: '\2022';
  color: rgba(212, 168, 68, 0.4);
  position: absolute;
  left: 0;
}
