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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
  color: #e5e7eb;
  min-height: 100vh;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
}

/* HEADER */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.25rem 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  font-size: 1.6rem;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #facc15;
}

.main-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nav-btn:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

/* SCREENS */

.screen {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.screen.active {
  display: block;
}

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

/* BUTTONS */

.primary-btn,
.secondary-btn {
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease,
    background 0.15s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  box-shadow: 0 10px 25px rgba(22, 163, 74, 0.4);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.55);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

.secondary-btn:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.large {
  padding-inline: 1.6rem;
  font-size: 1.05rem;
}

/* MENU SCREEN */

.hero {
  margin-top: 1.2rem;
  padding: 1.4rem 1.4rem 1.2rem;
  border-radius: 1rem;
  background: radial-gradient(circle at top left, #1f2937, #020617);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.hero h1 {
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
}

.hero p {
  max-width: 540px;
  font-size: 0.98rem;
  color: #cbd5f5;
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.player-name-input {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.9rem;
}

.player-name-input label {
  color: #e5e7eb;
}

.player-name-input input {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  outline: none;
  min-width: 160px;
}

.player-name-input input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px #16a34a;
}

.best-score {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #facc15;
}

/* Mode selector */

.mode-selector {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #111827;
}

.mode-selector h2 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mode-btn {
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.mode-btn.selected {
  background: #0f766e;
  border-color: #14b8a6;
  box-shadow: 0 10px 25px rgba(20, 184, 166, 0.4);
}

.mode-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.mode-hint {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

.highlights {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.card {
  background: #020617;
  border-radius: 0.9rem;
  padding: 0.9rem 0.9rem 1rem;
  border: 1px solid #111827;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.card p {
  font-size: 0.92rem;
  color: #d1d5db;
}

/* HOW TO PLAY */

.info-section {
  margin-top: 1.4rem;
  padding: 1.3rem 1.2rem;
  border-radius: 1rem;
  background: #020617;
  border: 1px solid #111827;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.info-section h1 {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
}

.steps {
  margin-left: 1.25rem;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.steps li {
  margin-bottom: 0.5rem;
}

.steps ul {
  margin-top: 0.25rem;
  margin-left: 1.1rem;
}

.tip {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #facc15;
}

.info-section .primary-btn {
  margin-top: 1rem;
}

/* GAME SCREEN */

.game-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1rem;
}

.side-panel {
  background: #020617;
  border-radius: 1rem;
  padding: 0.9rem;
  border: 1px solid #111827;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  background: #020617;
  border-radius: 0.7rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #111827;
}

.status-bar div {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.trip-card,
.fare-card {
  background: #020617;
  border-radius: 0.9rem;
  padding: 0.7rem 0.75rem 0.85rem;
  border: 1px solid #111827;
}

.trip-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

#trip-info p {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.fare-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.option-btn {
  border-radius: 0.7rem;
  border: 1px solid #1f2937;
  background: #111827;
  color: #e5e7eb;
  padding: 0.45rem 0.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.option-btn:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}

.option-btn.correct {
  background: #22c55e;
  color: #022c22;
}

.option-btn.wrong {
  background: #b91c1c;
}

.feedback {
  margin-top: 0.4rem;
  min-height: 1.2rem;
  font-size: 0.88rem;
}

.feedback.correct {
  color: #4ade80;
}

.feedback.wrong {
  color: #fca5a5;
}

.controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.map-panel {
  background: #020617;
  border-radius: 1rem;
  padding: 0.7rem;
  border: 1px solid #111827;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

#map {
  width: 100%;
  height: 360px;
  border-radius: 0.85rem;
  overflow: hidden;
}

.map-caption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

/* OVERLAY */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.9);
  z-index: 9999;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: #020617;
  border-radius: 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid #111827;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.8);
  text-align: center;
  max-width: 380px;
}

.overlay-card h2 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.overlay-card p {
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.score-table {
  width: 100%;
  margin-top: 0.4rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.score-table th,
.score-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #111827;
}

.score-table th {
  text-align: left;
  color: #9ca3af;
  font-weight: 500;
}

.score-table td {
  text-align: right;
  font-weight: 600;
}

.overlay-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

/* FOOTER */

.app-footer {
  margin-top: 1.2rem;
  font-size: 0.8rem;
  text-align: center;
  color: #9ca3af;
}

#taxi-cursor {
  position: fixed;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 50;
  font-size: 1.6rem;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  display: none;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .highlights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  #map {
    height: 280px;
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .highlights {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.5rem;
  }
}

.best-score {
  margin-top: 0.7rem;
}

.best-score h2 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.leaderboard-list {
  list-style: decimal;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #e5e7eb;
}

.leaderboard-list.small {
  font-size: 0.85rem;
}

.leaderboard-list li {
  margin-bottom: 0.15rem;
}

.leaderboard-list li span.name {
  font-weight: 600;
}

.leaderboard-list li span.score {
  color: #facc15;
}

.leaderboard-list li.empty {
  list-style: none;
  padding-left: 0;
  color: #9ca3af;
}

.overlay-leaderboard {
  margin-top: 0.6rem;
  text-align: left;
}

.overlay-leaderboard h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
