:root {
  --green-900: #15291c;
  --green-700: #24503a;
  --green-500: #3c7a55;
  --green-100: #e8f2ec;
  --accent: #ffd166;
  --ink: #15291c;
  --muted: #6b7f73;
  --line: #dfe8e2;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: linear-gradient(#dcebed 0%, #c4d3c8 48%, #9caf97 100%); font-family: Manrope, system-ui, -apple-system, sans-serif; }
button { font: inherit; cursor: pointer; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 14px 28px; background: linear-gradient(rgba(21,41,28,.88), rgba(21,41,28,0)); pointer-events: none; }
header a { flex: 0 0 auto; padding: 8px 12px; color: white; background: rgba(21,41,28,.76); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; font-size: 12px; font-weight: 800; text-decoration: none; pointer-events: auto; }
header h1 { margin: 0; color: white; font-size: 15px; font-weight: 800; text-shadow: 0 1px 6px rgba(0,0,0,.45); }
header h1 small { display: block; margin-top: 2px; font-size: 10px; font-weight: 600; opacity: .85; }
.controls { position: fixed; top: 84px; left: 14px; z-index: 11; display: grid; gap: 8px; }
.controls button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; color: var(--ink); background: white; border: 0; border-radius: 9px; box-shadow: 0 2px 10px rgba(0,0,0,.24); font-size: 20px; font-weight: 800; }
.controls button:hover { background: var(--green-100); }
.controls svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#north { position: fixed; top: 86px; right: 16px; z-index: 11; display: grid; justify-items: center; color: var(--green-900); font-size: 11px; font-weight: 800; transform-origin: center 19px; pointer-events: none; }
#north i { width: 0; height: 0; margin-top: 2px; border-right: 6px solid transparent; border-bottom: 17px solid var(--green-900); border-left: 6px solid transparent; }
#hint { position: fixed; bottom: 15px; left: 50%; z-index: 10; margin: 0; padding: 7px 14px; color: white; background: rgba(21,41,28,.76); border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
#selection { position: fixed; right: 14px; bottom: 55px; z-index: 12; width: min(270px, calc(100% - 28px)); padding: 13px 15px; background: white; border-radius: 11px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
#selection .eyebrow { margin: 0 0 3px; color: var(--green-500); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#selection h2 { margin: 0; font-size: 22px; }
#selection p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; }
#close-selection { position: absolute; top: 9px; right: 9px; width: 29px; height: 29px; padding: 0; color: var(--ink); background: var(--green-100); border: 0; border-radius: 8px; font-size: 20px; }
#sources { position: fixed; left: 14px; bottom: 55px; z-index: 10; max-width: min(400px, calc(100% - 28px)); padding: 8px 10px; color: var(--ink); background: rgba(255,255,255,.9); border-radius: 9px; font-size: 9px; line-height: 1.4; pointer-events: none; }
#sources strong, #sources span { display: block; }
#loading { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: white; background: var(--green-900); font-size: 14px; font-weight: 700; transition: opacity .45s; }
#loading.done { display: none; }
#loading .bar { width: 180px; height: 4px; overflow: hidden; background: rgba(255,255,255,.2); border-radius: 2px; }
#loading .bar i { width: 35%; height: 100%; display: block; background: var(--accent); border-radius: 2px; animation: loading 1.1s infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(520%); } }

@media (max-width: 640px) {
  header { padding-inline: 12px; }
  header h1 { max-width: calc(100vw - 105px); font-size: 12px; }
  #hint { bottom: 12px; font-size: 9px; }
  #sources { bottom: 48px; max-width: calc(100% - 28px); }
  #selection { left: 14px; right: 14px; bottom: 96px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
