:root {
  --bg-color: #0A121A;
  --bg-secondary: #1a232f;
  --primary: #74B9FF;
  --secondary: #DFE6E9;
  --accent: #E17055;
  --text-primary: #ffffff;
  --text-secondary: #b2bec3;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --radius: 12px;
  --transition: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  min-height: 600px;
  position: relative;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: opacity var(--transition);
}

.screen.hidden {
  display: none;
  opacity: 0;
}

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

.title {
  font-size: 2.5rem;
  color: var(--primary);
  text-align: center;
  margin-bottom: 2rem;
}

.menu-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.region-select, .mode-select {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.region-btn, .mode-btn, .primary-btn, .secondary-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  text-align: center;
  min-width: 120px;
}

.region-btn:hover, .mode-btn:hover, .primary-btn:hover, .secondary-btn:hover {
  background: var(--glass-border);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.region-btn.active, .mode-btn.active {
  background: var(--primary);
  color: var(--bg-color);
  border-color: var(--primary);
}

.game-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  background: var(--glass);
  padding: 1rem;
  border-radius: var(--radius);
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-box .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

#score-val, #timer-val, #streak-val {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.question-area {
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#question-text {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

#flag-display {
  font-size: 4rem;
}

.game-area {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 300px;
}

#map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Map specific styles */
.world-map-bg {
  width: 100%;
  height: auto;
  opacity: 0.5;
}

.country-marker {
  /* SVG circles use cx/cy for position, no absolute needed */
  /* transform: translate(-50%, -50%) is not needed for SVG circle as cx/cy is center */
  cursor: pointer;
  transition: var(--transition);
  /* fill/stroke handled by attributes or here */
}

.country-marker:hover {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  transform: translate(-50%, -50%) scale(1.2);
}

.country-marker.correct {
  background: #2ecc71;
  border-color: #2ecc71;
}

.country-marker.incorrect {
  background: var(--accent);
  border-color: var(--accent);
}

#options-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}

.option-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.option-btn:hover {
  background: var(--glass-border);
  border-color: var(--primary);
}

.option-btn.correct {
  background: #2ecc71;
  border-color: #2ecc71;
}

.option-btn.incorrect {
  background: var(--accent);
  border-color: var(--accent);
}

.controls {
  margin-top: auto;
  text-align: center;
}

#hint-text {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Game Over Styles */
#game-over-screen {
  text-align: center;
  justify-content: center;
}

.final-score, .final-streak {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.primary-btn {
  background: var(--primary);
  color: var(--bg-color);
  font-weight: bold;
  font-size: 1.2rem;
  padding: 1rem 2rem;
}

.primary-btn:hover {
  background: #5dade2; /* lighter shade */
  color: white;
}

/* Responsive */
@media (max-width: 600px) {
  #options-container {
    grid-template-columns: 1fr;
  }

  .game-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }

  .region-select {
    justify-content: center;
  }
}
