:root {
  --bg: #0f1419;
  --bg-elev: #1a2028;
  --bg-card: #232b36;
  --border: #2f3a47;
  --text: #e8eef5;
  --text-dim: #97a3b0;
  --accent: #d4a843;
  --accent-hover: #e0b75a;
  --us: #c14953;
  --intl: #4a8db5;
  --good: #5fb37c;
  --mid: #d4a843;
  --bad: #c14953;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ---------- Landing ---------- */
#screen-landing {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1f2a37, var(--bg));
}

.landing-inner {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--accent);
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
}

.subtitle {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 36px;
  font-style: italic;
}

.daily-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.daily-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.daily-date {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.daily-meta {
  font-size: 13px;
  color: var(--text-dim);
}

.rules {
  margin-top: 24px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

.played-state {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.played-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.played-score {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -2px;
  margin-bottom: 12px;
}

.played-summary {
  font-size: 26px;
  letter-spacing: 6px;
  margin-bottom: 20px;
}

.played-state .final-buttons {
  margin-bottom: 0;
}

.played-state .btn-primary,
.played-state .btn-secondary {
  width: auto;
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-card);
}

/* ---------- Game ---------- */
#screen-game {
  display: none;
}

#screen-game.active {
  display: flex;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.round-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.score-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 11px;
}

.score-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#total-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.question-card {
  background: var(--bg-card);
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#question-text {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 500;
}

#map {
  flex: 1;
  width: 100%;
  background: #0a0f14;
  cursor: crosshair;
  min-height: 200px;
}

.game-footer {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.guess-hint {
  flex: 1;
  font-size: 13px;
  color: var(--text-dim);
}

.game-footer .btn-primary {
  width: auto;
  padding: 12px 28px;
}

/* ---------- Round Result Overlay ---------- */
.round-result-overlay {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  animation: slideUp 0.22s ease-out;
}

.round-result-overlay.show {
  display: flex;
}

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

.overlay-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.overlay-points {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.overlay-distance {
  font-size: 14px;
  color: var(--text-dim);
  text-align: right;
}

.overlay-event {
  font-size: 17px;
  font-weight: 700;
}

.overlay-detail {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}

.round-result-overlay .btn-primary {
  margin-top: 4px;
  width: 100%;
  max-width: none;
}

/* Line connecting guess to correct answer */
.leaflet-overlay-pane path.answer-line {
  stroke: #ffffff;
  stroke-width: 3;
  stroke-dasharray: 6, 8;
  opacity: 0.85;
}

/* ---------- Final ---------- */
#screen-final {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.final-inner {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.final-inner h2 {
  font-size: 22px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 16px;
}

.final-score {
  font-size: 84px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -3px;
  line-height: 1;
}

.final-max {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.final-summary {
  font-size: 32px;
  letter-spacing: 8px;
  margin-bottom: 32px;
}

.final-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.final-buttons .btn-primary {
  width: auto;
}

.final-note {
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------- Review ---------- */
#screen-review {
  overflow: hidden;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.review-header h2 {
  font-size: 18px;
}

.review-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.review-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.review-item-event {
  font-size: 15px;
  font-weight: 700;
}

.review-item-points {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.review-item-question {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.review-item-detail {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}

.review-item-distance {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ---------- Map customizations ---------- */
.leaflet-container {
  background: #1a2532;
  font-family: inherit;
}

.guess-marker {
  background: var(--accent);
  border: 3px solid #1a1a1a;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.answer-marker {
  background: var(--good);
  border: 3px solid white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .title { font-size: 44px; }
  .result-points { font-size: 44px; }
  .final-score { font-size: 64px; }
  .final-summary { font-size: 26px; letter-spacing: 6px; }
  .game-footer .btn-primary { padding: 12px 18px; font-size: 14px; }
  .guess-hint { font-size: 12px; }
  #question-text { font-size: 15px; }
}
