@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;0,900;1,400&display=swap');

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

:root {
  --bg:        #0d0d1a;
  --surface:   #1a1a2e;
  --border:    rgba(255,255,255,0.08);
  --gold:      #e8c900;
  --gold-dim:  rgba(232,201,0,0.15);
  --red:       #c84b4b;
  --green:     #4ecdc4;
  --text:      #f0f0ff;
  --muted:     #8888aa;
  --radius:    12px;
  --map-h:     60vh;
}

html, body {
  height: 100%;
  font-family: 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ── Screens ───────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; min-height: 100dvh; }
.screen.active { display: flex; }

/* ── Home screen ───────────────────────────────────────────── */
#screen-home {
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
  text-align: center;
}

.logo {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 18px var(--gold));
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 18px var(--gold)); }
  50%       { filter: drop-shadow(0 0 32px var(--gold)); }
}

.title {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--gold);
}

.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 28ch;
  line-height: 1.5;
}

.home-btns {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: 100%;
  max-width: 320px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.5rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform .12s, opacity .12s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--gold);
  color: #0d0d1a;
}
.btn-primary:hover { opacity: .9; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-google {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: .9rem;
  font-weight: 400;
}

.btn-share {
  background: var(--green);
  color: #0d0d1a;
}

/* ── User chip ─────────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--muted);
}
.user-chip img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
#btn-logout {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ── Game screen ───────────────────────────────────────────── */
#screen-game {
  flex-direction: column;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.hud-round {
  font-size: .85rem;
  color: var(--muted);
}

.hud-day {
  font-weight: 700;
  font-size: .9rem;
  color: var(--gold);
}

.question-card {
  padding: 1.25rem 1rem .75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
}

.question-hint {
  margin-top: .4rem;
  font-size: .8rem;
  color: var(--muted);
}

#map {
  flex: 1;
  min-height: var(--map-h);
  cursor: crosshair;
}

.map-action-bar {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.map-action-bar .btn { flex: 1; }

#btn-confirm { display: none; }
#btn-confirm.visible { display: inline-flex; }

/* ── Result screen ─────────────────────────────────────────── */
#screen-result {
  flex-direction: column;
}

#result-map {
  flex: 1;
  min-height: var(--map-h);
}

.result-card {
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.result-answer {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
}

.result-answer.drama {
  animation: drama-reveal .5s cubic-bezier(.36,.07,.19,.97);
}

@keyframes drama-reveal {
  0%   { transform: scale(0.5) rotate(-6deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: .9rem;
  color: var(--muted);
}

.result-meta strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
}

.result-punchline {
  text-align: center;
  font-size: .9rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Summary screen ────────────────────────────────────────── */
#screen-summary {
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.5rem;
  gap: 1.25rem;
  overflow-y: auto;
}

.summary-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
}

.summary-day {
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}

.summary-total {
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  line-height: 1;
}
.summary-total small {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.rounds-grid {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.round-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  border: 1px solid var(--border);
}

.round-emoji { font-size: 1.3rem; min-width: 1.8rem; text-align: center; }

.round-question {
  flex: 1;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round-score {
  font-size: 1rem;
  font-weight: 700;
  min-width: 3.5rem;
  text-align: right;
}

.rank-line {
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}
.rank-line strong { color: var(--gold); }

.summary-btns {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: 100%;
  max-width: 320px;
}

/* ── Leaderboard ───────────────────────────────────────────── */
#screen-leaderboard {
  flex-direction: column;
  padding: 1.5rem 1rem;
  gap: 1rem;
  overflow-y: auto;
}

.lb-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .65rem .85rem;
  border: 1px solid var(--border);
}
.lb-row.top { border-color: var(--gold); }

.lb-rank  { min-width: 1.8rem; font-weight: 700; color: var(--muted); }
.lb-name  { flex: 1; }
.lb-score { font-weight: 700; color: var(--gold); }

/* ── Toast ─────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(4rem);
  background: var(--green);
  color: #0d0d1a;
  padding: .65rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  pointer-events: none;
  transition: transform .3s, opacity .3s;
  opacity: 0;
  z-index: 9999;
}
#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Leaflet overrides ─────────────────────────────────────── */
.leaflet-container { background: #1a1a2e; }
.player-pin-icon { font-size: 1.8rem; line-height: 1; }
.answer-pin-icon  { font-size: 1.8rem; line-height: 1; }
