*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --font: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
}
html, body { height: 100%; background: #0a0a0a; font-family: var(--font); overflow: hidden; }

/* ── LANDING ─────────────────────────────────────────────── */
#landing {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  transition: opacity .7s ease, visibility .7s;
}
#landing.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }

#landing-bg { position: absolute; inset: 0; overflow: hidden; }
#landing-cam-wrap { position: absolute; inset: -20px; }
#landing-cam-wrap iframe {
  width: 100%; height: 100%; border: none;
  filter: blur(20px) brightness(0.5) saturate(1.1);
  transform: scale(1.05); pointer-events: none;
}
#landing-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.2); }

/* Header — 3 zones, title truly centered */
#landing-header {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px 32px;
}
.landing-header-left {
  display: flex; align-items: center; gap: 20px;
}
.landing-title {
  font-family: var(--serif); font-size: 1.05rem;
  font-weight: 400; color: #fff;
  letter-spacing: .06em; text-align: center;
}
.landing-header-right {
  display: flex; align-items: center; gap: 16px;
  justify-content: flex-end; position: relative;
}
.landing-nav-link {
  background: transparent; border: none;
  font-size: .72rem; color: rgba(255,255,255,.6);
  letter-spacing: .02em; cursor: pointer;
  font-family: var(--font); transition: color .15s;
  padding: 0;
}
.landing-nav-link:hover { color: #fff; }
.landing-live-pill {
  display: flex; align-items: center; gap: 5px;
  font-size: .6rem; color: rgba(255,255,255,.45);
  letter-spacing: .08em;
}
.landing-pulse {
  width: 5px; height: 5px; border-radius: 50%;
  background: #4ade80; animation: pulse-live 2s ease-in-out infinite;
}
@keyframes pulse-live { 0%,100%{opacity:1} 50%{opacity:.3} }
.landing-lang-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px; padding: 3px 8px;
  color: rgba(255,255,255,.55); font-size: .63rem;
  cursor: pointer; font-family: var(--font); transition: all .15s;
  letter-spacing: .04em;
}
.landing-lang-btn:hover { border-color: rgba(255,255,255,.5); color: #fff; }

/* CTA */
#landing-cta {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
#landing-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.7);
  border-radius: 50px; padding: 15px 38px;
  color: #fff; font-family: var(--serif);
  font-size: .95rem; font-weight: 400;
  letter-spacing: .02em; cursor: pointer;
  transition: all .25s; backdrop-filter: blur(4px);
}
#landing-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: #fff; transform: scale(1.02);
}
#landing-sub {
  font-size: .62rem; color: rgba(255,255,255,.35);
  letter-spacing: .08em; text-transform: uppercase;
}

/* Footer */
#landing-footer {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px;
  font-size: .6rem; color: rgba(255,255,255,.3); letter-spacing: .03em;
}
.landing-map-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,.3); font-size: .6rem;
  cursor: pointer; font-family: var(--font);
  transition: color .15s; letter-spacing: .03em;
}
.landing-map-btn:hover { color: rgba(255,255,255,.7); }

/* ── VIEWER ──────────────────────────────────────────────── */
#app { position: fixed; inset: 0; z-index: 5; }
#app.hidden { display: none; }
#cam-fullscreen { position: relative; width: 100%; height: 100%; }
#cam-frame-wrap {
  position: absolute; inset: 0; background: #0a0a0a;
}
#cam-frame-wrap iframe,
#cam-frame-wrap video {
  width: 100%; height: 100%; border: none; display: block;
}

/* Top bar */
#top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  height: 50px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,.5) 0%, transparent 100%);
}
#top-location {
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 500; color: #fff; letter-spacing: .02em;
}
#top-sep, #top-country { color: rgba(255,255,255,.45); }
#top-right { display: flex; align-items: center; gap: 12px; }
#top-time { font-size: .62rem; color: rgba(255,255,255,.45); letter-spacing: .04em; }
.icon-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,.45); font-size: .9rem;
  cursor: pointer; padding: 4px; transition: color .15s;
}
.icon-btn:hover { color: #fff; }
.radio-btn {
  display: flex; align-items: center; gap: 4px;
  background: transparent; border: none;
  color: rgba(255,255,255,.45); font-size: .62rem;
  cursor: pointer; transition: color .15s; font-family: var(--font);
}
.radio-btn:hover, .radio-btn.playing { color: #a78bfa; }

/* Fact */
.fact-btn {
  position: absolute; top: 58px; right: 18px; z-index: 10;
  width: 22px; height: 22px; border-radius: 50%;
  background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.5); font-family: var(--serif);
  font-size: .72rem; font-style: italic;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.fact-btn:hover { border-color: rgba(255,255,255,.8); color: #fff; }
.fact-btn.hidden { display: none; }
.fact-popup {
  position: absolute; top: 50px; right: 16px; z-index: 20;
  background: rgba(8,8,8,.85); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px; padding: 14px 16px;
  max-width: 260px; cursor: pointer;
}
.fact-popup.hidden { display: none; }
.fact-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fact-icon-i {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.5); font-family: var(--serif);
  font-size: .6rem; font-style: italic; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.fact-title { font-size: .67rem; font-weight: 500; color: #ddd; flex: 1; }
.fact-close { background: none; border: none; color: #555; font-size: 1rem; cursor: pointer; }
.fact-close:hover { color: #fff; }
.fact-body { font-size: .72rem; color: #888; line-height: 1.65; }
.fact-hint { font-size: .58rem; color: #444; margin-top: 8px; text-align: right; }

/* Bottom bar */
#bottom-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  height: 90px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 100%);
}
.bottom-back-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,.3); font-size: .65rem;
  cursor: pointer; font-family: var(--font);
  transition: color .15s; letter-spacing: .02em; min-width: 90px;
}
.bottom-back-btn:hover { color: rgba(255,255,255,.7); }
.viewer-map-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,.3); font-size: .65rem;
  cursor: pointer; font-family: var(--font);
  transition: color .15s; letter-spacing: .02em; min-width: 90px;
  text-align: right;
}
.viewer-map-btn:hover { color: rgba(255,255,255,.7); }
#open-cam-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.55);
  border-radius: 50px; padding: 13px 32px;
  color: #fff; font-family: var(--serif);
  font-size: .88rem; cursor: pointer; transition: all .2s;
}
#open-cam-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.9);
}

/* ── CATEGORY MENU — slide from right ───────────────────── */
.cat-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.25);
}
.cat-overlay.hidden { display: none; }

.cat-menu {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 260px; z-index: 51;
  background: rgba(0,0,0,.55); backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 40px 32px;
  transform: translateX(0);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cat-menu.hidden { transform: translateX(100%); }
.cat-menu-close {
  position: absolute; top: 20px; right: 20px;
  background: none; border: none; color: rgba(255,255,255,.35);
  font-size: 1.1rem; cursor: pointer; transition: color .15s;
}
.cat-menu-close:hover { color: #fff; }
.cat-menu-grid {
  display: flex; flex-direction: column; gap: 2px;
}
.cat-item {
  background: transparent; border: none;
  padding: 12px 0; color: rgba(255,255,255,.55);
  font-family: var(--serif); font-size: 1.05rem;
  cursor: pointer; transition: color .15s;
  text-align: left; letter-spacing: .01em;
}
.cat-item:hover { color: #fff; }
.cat-item.active { color: #fff; }

/* ── MAP OVERLAY — embeds the classic map+sidebar app via iframe ── */
.map-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: #0a0a0a;
}
.map-overlay.hidden { display: none; }
#classic-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none; display: block;
}
.map-close-btn {
  position: absolute; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: rgba(10,10,10,.9); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.2); border-radius: 30px;
  padding: 10px 24px; color: rgba(255,255,255,.8);
  font-size: .75rem; cursor: pointer; font-family: var(--font);
  transition: all .2s; z-index: 61;
}
.map-close-btn:hover { border-color: rgba(255,255,255,.6); color: #fff; }

/* ── LANG MENU ───────────────────────────────────────────── */
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: rgba(12,12,12,.97); border: 1px solid #222;
  border-radius: 8px; padding: 4px; min-width: 130px;
  display: none; flex-direction: column; gap: 1px; z-index: 200;
}
.lang-menu.open { display: flex; }
.lang-item { font-size: .72rem; color: #ccc; padding: 8px 10px; border-radius: 5px; cursor: pointer; transition: background .1s; }
.lang-item:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ── CHALLENGE ───────────────────────────────────────────── */
.challenge-overlay { position:fixed; inset:0; z-index:200; background:rgba(0,0,0,.8); display:flex; align-items:center; justify-content:center; }
.challenge-overlay.hidden { display:none; }
.challenge-box { background:#111; border:1px solid #222; border-radius:16px; width:90%; max-width:700px; overflow:hidden; display:flex; flex-direction:column; max-height:90vh; }
.challenge-header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid #1a1a1a; }
.challenge-streak { font-size:.75rem; font-weight:600; color:#f0f0f0; }
.challenge-close { background:none; border:none; color:#666; font-size:1.2rem; cursor:pointer; }
.challenge-frame-wrap { height:260px; background:#000; }
.challenge-frame-wrap iframe { width:100%; height:100%; border:none; pointer-events:none; }
.challenge-hint { font-size:.72rem; color:#888; padding:10px 16px; border-bottom:1px solid #1a1a1a; }
.challenge-options { display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:12px; }
.challenge-option { background:#1a1a1a; border:1px solid #2a2a2a; border-radius:8px; padding:10px; font-size:.72rem; color:#ccc; cursor:pointer; text-align:center; transition:all .15s; }
.challenge-option:hover { border-color:#555; color:#fff; }
.challenge-option.correct { border-color:#4ade80; color:#4ade80; }
.challenge-option.wrong { border-color:#f87171; color:#f87171; }
.challenge-result { padding:20px; display:flex; flex-direction:column; align-items:center; gap:12px; }
.challenge-result.hidden { display:none; }
.challenge-result-title { font-size:1rem; font-weight:600; color:#f0f0f0; }
.challenge-result-score { font-size:.8rem; color:#888; }
.challenge-name-entry { display:flex; flex-direction:column; align-items:center; gap:8px; }
.challenge-name-entry.hidden { display:none; }
.challenge-name-entry input { background:#1a1a1a; border:1px solid #333; border-radius:6px; padding:6px 10px; color:#f0f0f0; font-size:.75rem; outline:none; }
.challenge-name-entry button { background:#f0f0f0; border:none; border-radius:6px; padding:6px 16px; font-size:.72rem; cursor:pointer; }
.challenge-leaderboard { width:100%; max-width:300px; }
.challenge-replay { background:transparent; border:1px solid #333; border-radius:8px; padding:8px 20px; color:#ccc; font-size:.72rem; cursor:pointer; }
