/* ==========================================================================
   GeoGuesser — Premium Dark-Mode Design System
   Glassmorphic UI with smooth animations and polished transitions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens (Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg: hsl(225, 20%, 6%);
  --surface: hsl(225, 15%, 12%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Primary Gradient */
  --gradient-primary: linear-gradient(135deg, hsl(160, 84%, 39%), hsl(210, 100%, 56%));

  /* Accent Colors */
  --accent-green: hsl(160, 84%, 39%);
  --accent-blue: hsl(210, 100%, 56%);

  /* Text */
  --text-primary: hsl(220, 20%, 92%);
  --text-secondary: hsl(220, 15%, 60%);

  /* Semantic */
  --danger: hsl(0, 85%, 60%);
  --warning: hsl(40, 95%, 55%);
  --success: hsl(160, 84%, 39%);
  --info: hsl(210, 100%, 56%);

  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --font-size-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.9rem);
  --font-size-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  --font-size-lg: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --font-size-xl: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem);
  --font-size-2xl: clamp(1.8rem, 1.5rem + 1.2vw, 2.5rem);
  --font-size-3xl: clamp(2.5rem, 2rem + 2vw, 4rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 50px;
  --radius-round: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-green: 0 0 30px rgba(16, 185, 129, 0.3);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.3);
  --shadow-glow-primary: 0 0 40px rgba(16, 185, 129, 0.2), 0 0 80px rgba(59, 130, 246, 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1 {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h4 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   4. Glassmorphism Utility
   -------------------------------------------------------------------------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* --------------------------------------------------------------------------
   5. Screen System
   -------------------------------------------------------------------------- */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  width: 100%;
  opacity: 0;
  transition: opacity var(--transition-slow), display var(--transition-slow);
  transition-behavior: allow-discrete;
}

.screen.active {
  display: flex;
  opacity: 1;

  @starting-style {
    opacity: 0;
  }
}

.screen-enter {
  animation: fadeIn 0.5s ease forwards, slideUp 0.5s ease forwards;
}

/* --------------------------------------------------------------------------
   5b. Settings Button & Modal
   -------------------------------------------------------------------------- */
.settings-btn {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 100;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-base);
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  transform: rotate(30deg);
}

.settings-btn:active {
  transform: rotate(60deg) scale(0.95);
}

/* Settings Overlay */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.settings-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Settings Modal */
.settings-modal {
  width: min(460px, calc(100vw - var(--space-xl)));
  max-height: calc(100dvh - var(--space-2xl));
  overflow-y: auto;
  padding: 0;
  transform: translateY(20px) scale(0.96);
  transition: transform var(--transition-base);
}

.settings-overlay.open .settings-modal {
  transform: translateY(0) scale(1);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}

.settings-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.settings-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-round);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.settings-body {
  padding: 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.settings-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.settings-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-badge.optional {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.settings-hint {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.settings-input-row {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.settings-input {
  flex: 1;
  padding: 10px 14px;
  font-size: var(--font-size-sm);
  font-family: inherit;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.settings-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
}

.settings-input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.settings-toggle-vis {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-toggle-vis:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.settings-link {
  font-size: var(--font-size-xs);
  color: var(--accent-blue);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
  align-self: flex-start;
}

.settings-link:hover {
  opacity: 1;
}

.settings-field-group {
  margin-top: var(--space-md);
}

.settings-sublabel {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.settings-subhint {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  line-height: 1.4;
  opacity: 0.8;
}

.settings-select {
  width: 100%;
  appearance: auto;
  cursor: pointer;
}

.settings-select option {
  background: var(--surface);
  color: var(--text-primary);
}

.settings-footer {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: var(--space-lg);
}

.settings-security-note {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.7;
}

.settings-save-btn {
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-md), var(--shadow-glow-green);
  width: 100%;
}

.settings-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(16, 185, 129, 0.3);
}

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

.settings-alert {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-xs);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-md);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   5c. Demo Mode Banner
   -------------------------------------------------------------------------- */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 6px var(--space-lg);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  background: rgba(15, 17, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.demo-banner-link {
  color: var(--accent-green);
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.demo-banner-link:hover {
  color: #34d399;
}

/* --------------------------------------------------------------------------
   5d. Demo Street View (static image)
   -------------------------------------------------------------------------- */
.demo-street-view {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.demo-hint-badge {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  background: rgba(15, 17, 25, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 5;
  opacity: 0;
  animation: fadeIn 0.5s ease 1.5s forwards;
}

/* --------------------------------------------------------------------------
   5e. Leaflet Map Overrides
   -------------------------------------------------------------------------- */
.leaflet-container {
  background: var(--bg-primary) !important;
  font-family: inherit !important;
}

/* --------------------------------------------------------------------------
   6. Start Screen — Split Layout
   -------------------------------------------------------------------------- */
.start-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  width: 100%;
  padding: var(--space-xl);
  gap: clamp(40px, 6vw, 100px);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Ambient background glow */
.start-screen::before {
  content: "" / "";
  position: absolute;
  top: 30%;
  left: 35%;
  translate: -50% -50%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, rgba(16, 185, 129, 0.04) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.start-screen > * {
  position: relative;
  z-index: 1;
}

/* ---- Left: Globe Hero ---- */
.start-hero {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Atmospheric glow behind the globe */
.start-hero::before {
  content: "" / "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: var(--radius-round);
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.04) 50%, transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}

.globe-img {
  width: clamp(180px, 22vw, 300px);
  height: clamp(180px, 22vw, 300px);
  border-radius: var(--radius-round);
  object-fit: cover;
  animation: globeFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 0 50px rgba(59, 130, 246, 0.15)) drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
  position: relative;
  z-index: 1;
}

@keyframes globeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ---- Right: Controls ---- */
.start-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 440px;
}

.start-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Game Title */
.game-title {
  font-size: clamp(2rem, 4vw, var(--font-size-3xl));
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(16, 185, 129, 0.3));
  line-height: 1.1;
}

.subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: 300;
  line-height: 1.5;
}

/* Difficulty Selector */
.difficulty-selector {
  display: flex;
  gap: var(--space-sm);
}

.difficulty-card {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.difficulty-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.difficulty-card.active {
  border-color: var(--accent-green);
  box-shadow: var(--shadow-glow-green);
  background: rgba(16, 185, 129, 0.08);
}

.difficulty-icon {
  color: var(--text-secondary);
  transition: color var(--transition-base);
  display: block;
  margin-bottom: 2px;
}

.difficulty-card.active .difficulty-icon {
  color: var(--accent-green);
}

.difficulty-card:hover .difficulty-icon {
  color: var(--text-primary);
}

.difficulty-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.difficulty-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Start Footer */
.start-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Start Button */
.start-btn {
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-md), var(--shadow-glow-green);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.start-btn::before {
  content: "" / "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent 60%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.start-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(16, 185, 129, 0.35);
}

.start-btn:hover::before {
  opacity: 1;
}

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

/* --------------------------------------------------------------------------
   7. Game Screen
   -------------------------------------------------------------------------- */
.game-screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

#street-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* HUD */
.game-hud {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  translate: -50% 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-sm) var(--space-lg);
  min-width: min(600px, 90vw);
  border-radius: var(--radius-pill);
  animation: slideDown 0.5s ease forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    translate: -50% -20px;
  }
  to {
    opacity: 1;
    translate: -50% 0;
  }
}

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hud-left {
  flex: 0 0 auto;
}

.hud-center {
  flex: 1 1 auto;
  justify-content: center;
}

.hud-right {
  flex: 0 0 auto;
}

/* Round Dots */
.round-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.15);
  transition: background var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.dot.active {
  background: var(--accent-green);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.dot.completed {
  background: var(--accent-blue);
}

#round-text {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Timer */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
}

#timer-display {
  font-size: var(--font-size-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.timer-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 1s linear, background-color var(--transition-base);
  transform-origin: left;
}

.timer-bar.timer-ok {
  background: var(--accent-green);
}

.timer-bar.timer-warn {
  background: var(--warning);
}

.timer-bar.timer-danger {
  background: var(--danger);
  animation: timerPulse 0.6s ease-in-out infinite;
}

/* Score Display */
.score-display {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.score-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

#current-score {
  font-size: var(--font-size-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Mini Map */
.mini-map-wrapper {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: stretch;
  animation: slideUp 0.6s ease forwards;
}

.mini-map-container {
  width: 300px;
  height: 200px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
  transition: width var(--transition-base), height var(--transition-base);
}

#guess-map {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-lg) - 1px);
}

.map-prompt {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  translate: -50% 0;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  animation: pulse 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 5;
  transition: opacity var(--transition-base), display var(--transition-base);
  transition-behavior: allow-discrete;
}

.map-prompt.hidden {
  opacity: 0;
  display: none;

  @starting-style {
    opacity: 0;
  }
}

/* Guess Text Input */
.guess-input-row {
  display: flex;
  gap: var(--space-xs);
}

.guess-input {
  flex: 1;
  padding: 10px 14px;
  font-size: var(--font-size-sm);
  font-family: inherit;
  color: var(--text-primary);
  background: rgba(15, 17, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.guess-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
}

.guess-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.guess-input.resolving {
  opacity: 0.5;
  pointer-events: none;
}

/* Guess Button — hidden until user types or places pin */
.guess-btn {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), opacity var(--transition-base), translate var(--transition-base);
  box-shadow: var(--shadow-md);
  text-align: center;
  opacity: 0;
  translate: 0 8px;
  pointer-events: none;
}

.guess-btn.visible {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}

.guess-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.guess-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-green);
}

.guess-btn:not(:disabled):active {
  transform: translateY(0) scale(0.97);
}

.guess-btn.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   8. Result Screen
   -------------------------------------------------------------------------- */
.result-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 100dvh;
  width: 100%;
  padding: 0;
}

.result-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 70dvh;
  z-index: 1;
}

.result-card {
  position: relative;
  z-index: 5;
  width: min(600px, 90vw);
  padding: var(--space-xl);
  margin-bottom: var(--space-2xl);
  animation: slideUp 0.5s ease forwards;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

#result-location {
  font-size: var(--font-size-xl);
  font-weight: 600;
  text-align: center;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Score Bar */
.score-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Next Button */
.next-btn {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-md);
  margin-top: var(--space-sm);
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-green);
}

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

/* --------------------------------------------------------------------------
   9. Final Screen
   -------------------------------------------------------------------------- */
.final-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-xl);
}

.final-content {
  width: min(700px, 92vw);
  padding: var(--space-2xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  animation: slideUp 0.6s ease forwards;
}

/* Final Rating */
.final-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.final-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-round);
  background: var(--gradient-primary);
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.25), 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: dropIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#final-rating-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#final-rating-desc {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  max-width: 400px;
}

/* Final Score Display */
.final-score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg) 0;
}

.final-score-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.final-score {
  font-size: clamp(3rem, 2.5rem + 3vw, 5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.3));
}

.final-score-max {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  font-weight: 400;
}

/* Rounds Table */
.rounds-table {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.rounds-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.rounds-table th {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border);
}

.rounds-table td {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rounds-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.rounds-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.04);
}

.rounds-table tbody tr {
  transition: background var(--transition-fast);
}

.rounds-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.07);
}

/* Play Again Button */
.play-again-btn {
  padding: var(--space-md) var(--space-3xl);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-md), var(--shadow-glow-green);
}

.play-again-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-lg), 0 0 50px rgba(16, 185, 129, 0.4);
}

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

/* --------------------------------------------------------------------------
   10. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.4s ease forwards;
  max-width: 350px;
}

.toast.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

.toast.toast-success {
  border-left: 3px solid var(--accent-green);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast.toast-info {
  border-left: 3px solid var(--accent-blue);
}

@keyframes toastIn {
  from {
    opacity: 0;
    translate: 100px 0;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    translate: 0 0;
  }
  to {
    opacity: 0;
    translate: 100px 0;
  }
}

/* --------------------------------------------------------------------------
   11. Keyframe Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    translate: 0 30px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes spin {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes timerPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes dropIn {
  0% {
    scale: 0;
    opacity: 0;
  }
  60% {
    scale: 1.15;
    opacity: 1;
  }
  80% {
    scale: 0.95;
  }
  100% {
    scale: 1;
    opacity: 1;
  }
}

@keyframes countUp {
  from {
    opacity: 0;
    translate: 0 10px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* --------------------------------------------------------------------------
   12. Utility Classes
   -------------------------------------------------------------------------- */
.gradient-text {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hidden {
  opacity: 0;
  display: none;
  transition: opacity var(--transition-base), display var(--transition-base);
  transition-behavior: allow-discrete;
}

.loading {
  background: linear-gradient(90deg, var(--glass-bg) 25%, rgba(255, 255, 255, 0.1) 50%, var(--glass-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}



/* --------------------------------------------------------------------------
   14. Voice Panel (Game Screen)
   -------------------------------------------------------------------------- */
.voice-panel {
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: 10;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(12, 12, 24, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  animation: slideUp 0.5s ease forwards;
}

.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.voice-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-indicator {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.voice-indicator.connected {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.voice-indicator.listening {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: indicatorPulse 1.2s ease-in-out infinite;
}

.voice-indicator.speaking {
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  animation: indicatorPulse 0.8s ease-in-out infinite;
}

.voice-indicator.thinking {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
  animation: indicatorPulse 0.9s ease-in-out infinite;
}

@keyframes indicatorPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.voice-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.voice-status-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.voice-mute-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
}

.voice-mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.voice-mute-btn.muted {
  color: rgba(255, 255, 255, 0.25);
}

/* Voice Transcript */
.voice-transcript {
  max-height: 100px;
  min-height: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.voice-msg {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.45;
  max-width: 92%;
  animation: fadeIn 0.25s ease;
  word-break: break-word;
}

.voice-msg.bot {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.15);
  color: rgba(255, 255, 255, 0.85);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.voice-msg.system {
  background: none;
  color: var(--text-secondary);
  font-style: normal;
  align-self: center;
  font-size: 10px;
  text-align: center;
  opacity: 0.5;
  padding: 2px 6px;
}

/* Mic Button */
.voice-btn {
  align-self: center;
  width: 48px;
  height: 48px;
  margin: 10px 0 14px;
  border-radius: var(--radius-round);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.25s ease, box-shadow 0.25s ease,
    transform 0.15s ease, background 0.25s ease, color 0.25s ease;
  position: relative;
}

.voice-btn .mic-svg {
  transition: color 0.25s ease;
}

.voice-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  transform: scale(1.06);
}

.voice-btn:active {
  transform: scale(0.94);
}

.voice-btn.listening {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), 0 0 16px rgba(239, 68, 68, 0.15);
  animation: micPulse 1.8s ease-in-out infinite;
}

.voice-btn.speaking {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.voice-btn.thinking {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1), 0 0 16px rgba(168, 85, 247, 0.15);
  animation: micPulseThinking 1.4s ease-in-out infinite;
}

@keyframes micPulseThinking {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1), 0 0 16px rgba(168, 85, 247, 0.15);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(168, 85, 247, 0.06), 0 0 24px rgba(168, 85, 247, 0.2);
  }
}

.voice-btn.connecting {
  border-color: var(--warning);
  color: var(--warning);
  opacity: 0.7;
}

.voice-btn.connecting .mic-svg {
  animation: spin 1.2s linear infinite;
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), 0 0 16px rgba(239, 68, 68, 0.15);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.06), 0 0 24px rgba(239, 68, 68, 0.2);
  }
}

/* --------------------------------------------------------------------------
   15. Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Screen system — scrollable */
  .screen {
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-screen {
    height: 100dvh;
  }

  /* ── Compact HUD ── */
  .game-hud {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--space-xs);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    min-width: unset;
    width: auto;
    max-width: calc(100vw - var(--space-md) * 2);
    justify-content: center;
  }

  .hud-left,
  .hud-center,
  .hud-right {
    gap: 4px;
  }

  .hud-center {
    flex: 0 0 auto;
  }

  #round-text {
    display: none;
  }

  #timer-display {
    font-size: var(--font-size-sm);
  }

  .score-label {
    display: none;
  }

  #current-score {
    font-size: var(--font-size-base);
  }

  .dot {
    width: 6px;
    height: 6px;
  }

  .timer-container {
    min-width: 50px;
  }

  /* ── Hide mini-map, keep input + button ── */
  .mini-map-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-xs) var(--space-sm);
    padding-bottom: max(var(--space-xs), env(safe-area-inset-bottom));
    flex-direction: row;
    gap: var(--space-xs);
    z-index: 10;
    background: rgba(12, 12, 24, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    align-items: center;
  }

  .mini-map-container {
    display: none;
  }

  .map-prompt {
    display: none;
  }

  .guess-input-row {
    flex: 1;
  }

  .guess-input {
    font-size: 16px;
    padding: 10px 14px;
    min-height: 44px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .guess-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
  }

  .guess-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0 16px;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    /* Always visible on mobile — no map to pin on */
    opacity: 1;
    translate: 0 0;
    pointer-events: auto;
  }

  /* ── Voice panel → floating mic only ── */
  .voice-panel {
    all: unset;
    position: fixed;
    bottom: calc(54px + max(var(--space-xs), env(safe-area-inset-bottom)) + var(--space-sm));
    right: var(--space-sm);
    z-index: 11;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: none;
    border: none;
    box-shadow: none;
    width: auto;
    animation: none;
  }

  .voice-header,
  .voice-transcript {
    display: none;
  }

  .voice-controls {
    padding: 0;
    background: none;
    border: none;
    gap: 6px;
  }

  .voice-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    background: rgba(12, 12, 24, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  }

  .voice-btn.listening {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), 0 4px 20px rgba(0, 0, 0, 0.4);
  }

  .voice-btn.speaking {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
  }

  .voice-mute-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: rgba(12, 12, 24, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-round);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* ── Start screen — centered, tight, premium ── */
  .start-screen {
    flex-direction: column;
    gap: 0;
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    min-height: 100dvh;
    height: auto;
    justify-content: center;
    align-items: center;
  }

  .start-screen::before {
    top: 40%;
    left: 50%;
    width: 300px;
    height: 300px;
  }

  .start-hero {
    margin-bottom: var(--space-sm);
  }

  .start-hero::before {
    width: 120px;
    height: 120px;
  }

  .globe-img {
    width: 100px;
    height: 100px;
  }

  .start-controls {
    align-items: center;
    max-width: 100%;
    width: 100%;
    gap: var(--space-md);
  }

  .start-header {
    align-items: center;
    gap: 2px;
  }

  .game-title {
    font-size: 1.6rem;
    letter-spacing: 0.1em;
  }

  .subtitle {
    text-align: center;
    font-size: var(--font-size-xs);
    opacity: 0.7;
  }

  /* Difficulty cards — horizontal row of compact pills */
  .difficulty-selector {
    width: 100%;
    flex-direction: row;
    gap: var(--space-xs);
    justify-content: center;
  }

  .difficulty-card {
    flex: 1;
    min-width: 0;
    width: auto;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    border-radius: var(--radius-md);
    min-height: unset;
  }

  .difficulty-icon {
    width: 18px;
    height: 18px;
  }

  .difficulty-name {
    font-size: 0.7rem;
    font-weight: 600;
  }

  .difficulty-desc {
    font-size: 0.55rem;
    line-height: 1.3;
    opacity: 0.6;
  }

  /* Footer compact */
  .start-footer {
    width: 100%;
    gap: var(--space-sm);
  }

  .start-btn {
    min-height: 48px;
    width: 100%;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-base);
  }

  /* Settings modal mobile */
  .settings-modal {
    width: calc(100vw - var(--space-md) * 2);
    max-height: calc(100dvh - var(--space-lg));
  }

  .settings-input {
    font-size: 16px;
  }

  /* ── Result / Final screens ── */
  .result-card {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    width: calc(100vw - var(--space-md) * 2);
    max-width: 100%;
  }

  .result-stats {
    flex-direction: column;
    gap: var(--space-md);
  }

  .result-map-container {
    height: 200px;
  }

  .next-btn,
  .play-again-btn {
    min-height: 48px;
    width: 90vw;
    max-width: 400px;
  }

  .final-content {
    padding: var(--space-md);
    width: calc(100vw - var(--space-md) * 2);
    max-width: 100%;
  }

  .rounds-table th,
  .rounds-table td {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }

  /* Toast — top of screen */
  .toast-container {
    left: var(--space-sm);
    right: var(--space-sm);
    bottom: auto;
    top: var(--space-sm);
  }

  .toast {
    max-width: 100%;
    font-size: var(--font-size-xs);
  }
}

@media (max-width: 480px) {
  .start-screen {
    padding: var(--space-sm) var(--space-md);
  }

  .globe-img {
    width: 80px;
    height: 80px;
  }

  .start-hero::before {
    width: 90px;
    height: 90px;
  }

  .game-title {
    font-size: 1.4rem;
    letter-spacing: 0.08em;
  }

  .difficulty-name {
    font-size: 0.6rem;
  }

  .difficulty-desc {
    display: none;
  }

  .game-hud {
    padding: 4px 8px;
  }

  #timer-display {
    font-size: var(--font-size-xs);
  }

  #current-score {
    font-size: var(--font-size-sm);
  }

  .result-map-container {
    height: 160px;
  }

  .voice-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }
}

/* Very small phones (iPhone SE, Galaxy Fold) */
@media (max-width: 360px) {
  .game-title {
    font-size: 1.3rem;
  }

  .difficulty-card {
    padding: var(--space-xs) var(--space-sm);
  }

  .globe-img {
    width: 70px;
    height: 70px;
  }

  .guess-btn {
    padding: 0 10px;
    font-size: var(--font-size-xs);
  }
}

/* Touch device improvements */
@media (pointer: coarse) {
  .guess-btn,
  .start-btn,
  .next-btn,
  .play-again-btn,
  .difficulty-card {
    min-height: 48px;
  }

  .voice-btn {
    min-width: 48px;
    min-height: 48px;
  }
}

/* --------------------------------------------------------------------------
   14. Reduced Motion
   -------------------------------------------------------------------------- */
@property --animation-reduced {
  syntax: "*";
  inherits: false;
  initial-value: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: var(--animation-reduced) !important;
  }

  .screen.active {
    transition-duration: 0.01ms;
  }

  .difficulty-card:hover {
    transform: none;
  }

  .start-btn:hover,
  .guess-btn:not(:disabled):hover,
  .next-btn:hover,
  .play-again-btn:hover {
    transform: none;
  }

  .timer-bar {
    transition-duration: 0.01ms;
  }

  .score-bar {
    transition-duration: 0.01ms;
  }

  html {
    scroll-behavior: auto;
  }
}
