/* ═══════════════════════════════════════════════════
   Ticket to Ride — Design System
   ═══════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ───────────────────── */
:root {
  --font-main: 'Outfit', system-ui, sans-serif;

  /* Dark theme palette */
  --bg-primary: #0f1923;
  --bg-secondary: #1a2836;
  --bg-card: #1e3044;
  --bg-card-hover: #253d55;
  --bg-surface: #15202d;
  --bg-overlay: rgba(10, 15, 25, 0.85);

  /* Accent colors */
  --accent: #f0a030;
  --accent-hover: #ffb840;
  --accent-glow: rgba(240, 160, 48, 0.3);
  --accent-secondary: #40b8e0;

  /* Text */
  --text-primary: #e8edf2;
  --text-secondary: #8fa0b4;
  --text-muted: #5a6f82;
  --text-accent: #f0a030;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(240, 160, 48, 0.4);

  /* Danger */
  --danger: #e04050;
  --danger-hover: #f05060;

  /* Success */
  --success: #30c070;

  /* Train card colors */
  --card-red: #e04040;
  --card-orange: #e89030;
  --card-yellow: #e8d040;
  --card-green: #40b060;
  --card-blue: #4080e0;
  --card-purple: #9060c0;
  --card-black: #383838;
  --card-white: #d8d8d8;
  --card-locomotive: linear-gradient(135deg, #e04040, #e89030, #e8d040, #40b060, #4080e0, #9060c0);

  /* Player colors */
  --player-0: #e74c3c;
  --player-1: #3498db;
  --player-2: #2ecc71;
  --player-3: #f39c12;
  --player-4: #9b59b6;

  /* Spacing & Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Screens ─────────────────────────────────── */
.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
}

/* ═══════════════════════════════════════════════
   LOBBY SCREEN
   ═══════════════════════════════════════════════ */
#screen-lobby {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(240, 160, 48, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(64, 184, 224, 0.06) 0%, transparent 60%),
    var(--bg-primary);
}

.lobby-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.lobby-hero {
  text-align: center;
  margin-bottom: 32px;
}

.train-icon {
  font-size: 64px;
  margin-bottom: 8px;
  animation: trainBounce 2s var(--ease-bounce) infinite;
}

@keyframes trainBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.lobby-hero h1 {
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 300;
}

.lobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group.row {
  display: flex;
  gap: 8px;
}

.input-group.row-group {
  display: flex;
  gap: 8px;
}

.input-group.row-group .flex-input {
  box-sizing: border-box;
  flex: 1 1 50%;
  min-width: 0;
  text-transform: none;
  /* Only code goes uppercase, password doesn't */
  letter-spacing: normal;
}

.input-group.row-group #room-code {
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* ─── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #d88020);
  color: #1a1a1a;
  box-shadow: var(--shadow-sm), 0 0 12px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #2d4e6a;
  border-color: var(--border-active);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-actions .btn-primary {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ─── Waiting Room ────────────────────────────── */
.waiting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.waiting-header h2 {
  font-size: 14px;
  font-weight: 600;
}

.waiting-header span {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 2px;
}

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

.lock-icon {
  font-size: 18px;
  opacity: 0.8;
  cursor: help;
}

#waiting-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.waiting-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.waiting-player .color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.waiting-player .name {
  flex: 1;
  font-weight: 600;
}

.waiting-player .host-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.waiting-actions {
  display: flex;
  gap: 8px;
}

.waiting-actions .btn {
  flex: 1;
}

/* ─── Lobby List ──────────────────────────────── */
.lobby-list-container {
  margin-top: 20px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.lobby-list-container h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.lobby-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.lobby-item:hover {
  background: var(--bg-card-hover);
}

.lobby-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lobby-item .lobby-info {
  font-size: 14px;
}

.lobby-lock {
  font-size: 12px;
  opacity: 0.7;
}

.lobby-item .lobby-players {
  font-size: 12px;
  color: var(--text-muted);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(224, 64, 80, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 64, 80, 0.2);
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════════════ */
#screen-game {
  flex-direction: column;
}

/* ─── Top Bar ─────────────────────────────────── */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 48px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.phase-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(64, 184, 224, 0.15);
  color: var(--accent-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.turn-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.turn-indicator.your-turn {
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ─── Game Layout ─────────────────────────────── */
.game-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Map ─────────────────────────────────────── */
.map-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}

#game-map {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  cursor: default;
}

/* SVG Map Styles */
.city-dot {
  cursor: default;
  transition: r 0.2s var(--ease-out);
}

.city-label {
  font-family: var(--font-main);
  fill: #c8d8e8;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.city-ring {
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.city-ring-active {
  animation: cityPulse 1.5s ease-out infinite;
}

@keyframes cityPulse {
  0% {
    r: 10;
    opacity: 0.8;
    stroke-width: 3;
  }

  100% {
    r: 18;
    opacity: 0;
    stroke-width: 0;
  }
}

.route-segment {
  cursor: pointer;
  transition: opacity 0.2s, stroke-width 0.2s;
  stroke-linecap: round;
}

.route-segment:hover {
  stroke-width: 8;
  opacity: 1;
  filter: url(#glow);
}

.route-segment.claimed {
  cursor: default;
  opacity: 0.9;
}

.route-segment.unavailable {
  cursor: default;
  opacity: 0.25;
}

/* ─── Side Panel ──────────────────────────────── */
.side-panel {
  width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-section h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* ─── Player List ─────────────────────────────── */
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.player-row.active-turn {
  background: rgba(240, 160, 48, 0.1);
  border: 1px solid var(--border-active);
}

.player-color-bar {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

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

.player-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.player-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

/* ─── Deck Area ───────────────────────────────── */
.deck-area {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.deck-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-subtle);
}

.deck-stack:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.deck-card {
  font-size: 32px;
  line-height: 1;
}

.deck-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.deck-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Face-up cards */
.face-up-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.face-up-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border-subtle);
}

.face-up-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.face-up-color {
  width: 28px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.face-up-label {
  font-size: 12px;
  font-weight: 600;
  flex: 1;
}

@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Player Hand ─────────────────────────────── */
.player-hand-area {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 120px;
  overflow: hidden;
}

.hand-section {
  flex: 1;
  overflow: hidden;
}

.hand-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.hand-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.hand-card {
  min-width: 52px;
  height: 72px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s var(--ease-out);
  cursor: default;
  flex-shrink: 0;
  position: relative;
}

.hand-card .card-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hand-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.tickets-section {
  max-width: 400px;
}

.hand-tickets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.hand-ticket {
  min-width: 140px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.hand-ticket .ticket-cities {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.hand-ticket .ticket-points {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.hand-ticket.completed {
  border-color: var(--success);
  background: rgba(48, 192, 112, 0.08);
}

.hand-ticket.completed .ticket-points {
  color: var(--success);
}

/* ═══════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--ease-out);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  display: flex;
  margin-top: 20px;
}

/* ─── Test Panel ──────────────────────────────── */
.test-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 280px;
  background: rgba(30, 35, 40, 0.95);
  border: 1px solid var(--accent);
  border-radius: 8px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.test-panel-header {
  background: var(--accent);
  color: #fff;
  padding: 8px;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
}

.test-panel-content {
  padding: 12px;
}

.test-panel-content label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.test-card-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.test-card-buttons .btn-small {
  padding: 6px 10px;
  font-size: 11px;
  flex: 1 1 30%;
  border: none;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ─── Settings Button ─────────────────────────── */
.btn-settings {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(30, 35, 40, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: all 0.2s var(--ease-out);
  backdrop-filter: blur(4px);
}

.btn-settings:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: rotate(45deg);
  box-shadow: var(--shadow-glow-sm);
}

/* Adjust test panel to not overlap with settings button if it were open (though test panel has its own position) */
.test-panel {
  top: 60px;
  /* Shift down because settings button is at top: 10px */
}

/* ─── Ticket Selection ────────────────────────── */
.ticket-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.ticket-select-item:hover {
  background: var(--bg-card-hover);
}

.ticket-select-item.selected {
  border-color: var(--accent);
  background: rgba(240, 160, 48, 0.08);
}

.ticket-select-item .check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.ticket-select-item.selected .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
}

.ticket-route {
  flex: 1;
}

.ticket-route .cities {
  font-weight: 600;
  font-size: 14px;
}

.ticket-route .arrow {
  color: var(--text-muted);
  margin: 0 4px;
}

.ticket-points-badge {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

/* ─── Claim Modal ─────────────────────────────── */
#claim-card-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.claim-card-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}

.claim-card-option:hover {
  border-color: var(--border-active);
}

.claim-card-option.selected {
  border-color: var(--accent);
}

.claim-card-color {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.claim-card-count {
  font-size: 16px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.claim-card-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.claim-card-arrows button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  padding: 0 4px;
  line-height: 1;
}

.claim-card-arrows button:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════
   GAME OVER
   ═══════════════════════════════════════════════ */
#screen-gameover {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(240, 160, 48, 0.12) 0%, transparent 60%),
    var(--bg-primary);
}

.gameover-container {
  text-align: center;
  max-width: 600px;
  width: 90%;
}

.gameover-container h1 {
  font-size: 36px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#final-scores {
  margin-bottom: 24px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
}

.score-row.winner {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.score-rank {
  font-size: 20px;
  font-weight: 800;
  width: 32px;
  text-align: center;
}

.score-row.winner .score-rank {
  color: var(--accent);
}

.score-player-info {
  flex: 1;
}

.score-player-name {
  font-weight: 700;
  font-size: 16px;
}

.score-breakdown {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.score-total {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

/* ─── Toast Notifications ─────────────────────── */
#toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  animation: slideInRight 0.3s var(--ease-out);
  max-width: 320px;
}

.toast.error {
  border-color: rgba(224, 64, 80, 0.4);
  background: rgba(224, 64, 80, 0.15);
}

.toast.success {
  border-color: rgba(48, 192, 112, 0.4);
  background: rgba(48, 192, 112, 0.15);
}

@keyframes slideInRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100px);
    opacity: 0;
  }
}

/* ─── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ─── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
  }

  .side-panel {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .panel-section {
    min-width: 240px;
  }

  .player-hand-area {
    height: auto;
    min-height: 100px;
  }
}

/* Language Switch */
.lang-switch-container {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.lang-switch-container .btn-lang {
  flex: 1;
  padding: 8px;
  font-size: 14px;
}

.lang-switch-container .btn-lang.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* ─── Ticket Selection Cards ───────────────────── */
.ticket-select-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
  max-height: 70vh;
  overflow-y: auto;
  padding: 10px;
}

.ticket-card {
  position: relative;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s var(--ease-bounce);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  user-select: none;
}

.ticket-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.ticket-card.selected {
  border-color: var(--accent);
  background: rgba(240, 160, 48, 0.08);
  box-shadow: 0 0 20px var(--accent-glow);
}

.ticket-card.selected::before {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #1a1a1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  z-index: 5;
  box-shadow: var(--shadow-sm);
}

.ticket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 1;
}

.ticket-card-route {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticket-card-city {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.ticket-card-arrow {
  color: var(--accent);
  font-size: 12px;
  margin: -2px 0;
  opacity: 0.8;
}

.ticket-points-badge {
  background: var(--bg-card);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-sm);
}

.ticket-mini-map {
  width: 100%;
  height: 150px;
  background: #121a21;
  border-radius: var(--radius-md);
  margin: 12px 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  display: block;
}

.btn-card-info {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  font-size: 20px;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.btn-card-info:hover {
  background: var(--accent);
  color: #1a1a1a;
  border-color: var(--accent);
  transform: scale(1.15) rotate(10deg);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* ─── Route Info Modal ────────────────────────── */
.info-modal-content {
  max-width: 800px !important;
  padding: 0 !important;
  overflow: hidden;
  background: var(--bg-primary) !important;
}

.info-modal-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.info-map-container {
  padding: 20px;
  background: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
}

#info-map-svg {
  width: 100%;
  max-height: 50vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.info-modal-content .modal-actions {
  padding: 16px 32px 24px;
}

.dashed-line {
  stroke: var(--accent);
  stroke-width: 5;
  stroke-dasharray: 10 10;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.mini-map-route {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 2.5;
  fill: none;
}

@keyframes dashoffset {
  to {
    stroke-dashoffset: -100;
  }
}

.dashed-line-animated {
  animation: dashoffset 20s linear infinite;
}

.info-city-dot {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
}

.city-pulse-marker {
  animation: cityPulse 2s ease-out infinite;
  pointer-events: none;
}

.info-city-label {
  fill: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Adjust modal content to avoid double scroll */
#modal-tickets .modal-content {
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 32px;
}

#modal-tickets-list {
  flex: 1;
  overflow-y: auto;
  margin-right: -10px;
  padding-right: 10px;
}