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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3345;
  --text: #e8e6e3;
  --text-dim: #8b8d97;
  --accent: #c9a84c;
  --accent-glow: #c9a84c33;
  --green: #4caf7c;
  --orange: #e8934a;
  --red: #e85454;
  --blue: #4a8ee8;
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ===== Header ===== */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  position: relative;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-nyc {
  color: var(--accent);
}

.pill {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
}

.score-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

/* ===== Round Bar ===== */
#round-bar {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1000;
}

.round-dots {
  display: flex;
  gap: 8px;
}

.round-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  transition: all 0.3s ease;
}

.round-dot.active {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.round-dot.correct {
  border-color: var(--green);
  background: var(--green);
}

.round-dot.far {
  border-color: var(--orange);
  background: var(--orange);
}

.round-dot.very-far {
  border-color: var(--red);
  background: var(--red);
}

/* ===== Map ===== */
#map {
  flex: 1;
  width: 100%;
  z-index: 1;
}

body {
  display: flex;
  flex-direction: column;
}

/* Leaflet overrides */
.leaflet-container {
  background: var(--bg) !important;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-control-attribution {
  background: var(--surface) !important;
  color: var(--text-dim) !important;
  font-size: 0.6rem !important;
}

.leaflet-control-attribution a {
  color: var(--text-dim) !important;
}

/* Custom markers */
.guess-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transform: translate(-10px, -10px);
}

.answer-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transform: translate(-10px, -10px);
}

.answer-marker-label {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Clue Panel ===== */
#clue-panel {
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1000;
}

#round-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

#round-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

#multiplier-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--bg);
}

#category-badge-wrap {
  margin-bottom: 8px;
}

#category-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  display: none;
}

#category-badge.architecture {
  display: inline-block;
  background: var(--blue);
  color: #fff;
}

#category-badge.historical {
  display: inline-block;
  background: #9c6ade;
  color: #fff;
}

#clue-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  min-height: 44px;
}

#clue-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* ===== Buttons ===== */
.btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Overlays ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.overlay-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 4px;
  color: var(--accent);
}

#result-year, #result-detail {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.result-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 18px 0;
}

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

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Summary ===== */
.summary-content {
  max-width: 380px;
}

.summary-score {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0 2px;
}

.summary-max {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

#summary-rounds, #played-rounds {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  text-align: left;
}

.summary-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.summary-round-name {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.summary-round-distance {
  color: var(--text-dim);
  margin-right: 12px;
  font-size: 0.75rem;
}

.summary-round-score {
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

.share-confirm {
  font-size: 0.8rem;
  color: var(--green);
  margin-top: 8px;
  transition: opacity 0.3s ease;
}

.share-confirm.hidden {
  opacity: 0;
}

#countdown-wrap, #countdown-wrap-played {
  margin-top: 18px;
}

#countdown-wrap p, #countdown-wrap-played p {
  font-size: 0.75rem;
  color: var(--text-dim);
}

#countdown, #countdown-played {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ===== Animations ===== */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.score-pop {
  animation: pulse 0.4s ease;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  #clue-panel {
    max-width: 480px;
    margin: 0 auto;
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
