:root {
  --bg: #0d1117;
  --panel: #161d27;
  --panel2: #1d2632;
  --border: #2b3646;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #e0a635;
  --accent2: #46a758;
  --danger: #d05353;
  --radius: 12px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ============ HEADER ============ */
#topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.brand-logo { height: 48px; width: auto; display: block; }
.accent { color: var(--accent); }

#hud { display: flex; gap: 26px; }
.hud-item { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.hud-label { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
#hud-round, #hud-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pro-btn {
  background: linear-gradient(135deg, #e0a635, #c07f16);
  color: #1a1205;
  border: none;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.pro-btn:hover { filter: brightness(1.1); }

/* ============ GAME LAYOUT ============ */
#game-screen {
  display: flex;
  height: calc(100% - 56px);
}

#photo-panel {
  flex: 1.15;
  min-width: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#photo-frame { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; cursor: zoom-in; }

#photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  transition: transform 0.08s ease-out;
  will-change: transform;
}

#photo-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.82);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

#guess-panel {
  flex: 1;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

#map { flex: 1; min-height: 0; }

#controls {
  padding: 14px 18px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#year-row { display: flex; flex-direction: column; gap: 4px; }

#year-display {
  align-self: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#year-slider {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--panel2);
  outline: none;
  cursor: pointer;
}
#year-slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff2d4;
  cursor: grab;
}
#year-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff2d4;
  cursor: grab;
}

.year-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

/* ============ BUTTONS ============ */
.big-btn {
  background: var(--accent2);
  color: #06130a;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.big-btn:hover:not(:disabled) { filter: brightness(1.12); }
.big-btn:active:not(:disabled) { transform: scale(0.98); }
.big-btn:disabled { background: var(--panel2); color: var(--muted); cursor: not-allowed; }
.free-btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }

.pro-tag {
  background: linear-gradient(135deg, #e0a635, #c07f16);
  color: #1a1205;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 6px;
}

.archive-row { display: flex; gap: 8px; }
.archive-row input {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
}
.archive-row input:focus { border-color: var(--accent); }
.archive-go { width: auto; padding: 10px 22px; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 6px;
}
.link-btn:hover { color: var(--text); }

/* ============ OVERLAYS ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 16, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  overflow-y: auto;
  padding: 20px;
}

.start-card, .result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 38px;
  max-width: 540px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.logo { font-size: 52px; font-weight: 900; letter-spacing: 8px; }
.start-logo { width: 100%; max-width: 430px; height: auto; align-self: center; filter: drop-shadow(0 6px 24px rgba(0,0,0,0.55)); }
.logo.small { font-size: 30px; letter-spacing: 4px; }
.tagline { color: var(--accent); font-weight: 600; letter-spacing: 1px; margin-top: -10px; }
.desc { color: var(--muted); font-size: 15px; line-height: 1.55; }
.desc strong { color: var(--text); }

.rules { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rule {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.rule-pts { color: var(--accent); font-weight: 800; font-size: 16px; white-space: nowrap; }

.best-score { color: var(--muted); font-size: 13px; }
.best-score b { color: var(--accent); }

.pro-tease {
  border: 1px dashed #6b5620;
  background: rgba(224, 166, 53, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.pro-tease-title { color: var(--accent); font-weight: 800; letter-spacing: 1px; margin-bottom: 3px; }

/* ============ RESULT ============ */
.result-total { font-size: 58px; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); font-size: 13px; margin-top: -12px; }

.result-rows { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.result-row-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.pts { color: var(--accent); font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 4px; transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }

.result-detail { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.answer-box {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
}
.ans-title { font-weight: 800; font-size: 16px; }
.ans-meta { color: var(--accent); font-size: 13px; margin: 3px 0 7px; }
.ans-caption { color: var(--muted); font-size: 13px; line-height: 1.5; }

.final-score { font-size: 64px; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.final-rank { font-size: 18px; font-weight: 700; }

/* ============ PRO MODAL ============ */
.pro-list { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--text); padding-left: 6px; }
.pro-price { font-size: 40px; font-weight: 900; color: var(--accent); }
.pro-price span { font-size: 15px; color: var(--muted); font-weight: 600; }

/* ============ MAP MARKERS ============ */
/* pointer-events: none — markers must never intercept or follow the cursor */
.guess-marker { font-size: 30px; line-height: 1; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); }
.actual-marker { font-size: 26px; line-height: 1; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); }

/* ============ RESULT BAR ============ */
.result-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: rgba(18, 24, 32, 0.97);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  transform: translateY(110%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.result-bar.show { transform: translateY(0); pointer-events: auto; }

.rb-score { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.rb-total { font-size: 40px; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.rb-max { font-size: 11px; color: var(--muted); }

.rb-breakdown { display: flex; flex-direction: column; gap: 6px; }
.rb-line { font-size: 14px; display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.rb-pts { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 48px; }
.rb-note { color: var(--muted); font-size: 12.5px; }

.rb-answer { flex: 1; min-width: 220px; }
.rb-title { font-weight: 800; font-size: 15px; }
.rb-meta { color: var(--accent); font-size: 12.5px; margin: 2px 0 4px; }
.rb-caption { color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 640px; }

.rb-next { width: auto; padding: 13px 30px; flex-shrink: 0; }

@media (max-width: 900px) {
  .result-bar { gap: 14px; padding: 12px 16px; }
  .rb-caption { display: none; }
  .rb-next { width: 100%; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .logo { font-size: 34px; letter-spacing: 5px; }
  .start-card, .result-card { padding: 26px 22px; }
  #game-screen { flex-direction: column; height: auto; min-height: calc(100% - 56px); }
  #photo-panel { min-height: 38vh; flex: none; }
  #guess-panel { min-width: 0; border-left: none; border-top: 1px solid var(--border); flex: none; }
  #map { flex: none; height: 44vh; }
}
