:root {
  --accent: #0F766E;
  --ink: #F2F5F3;
  --ground: #0D1012;
  --panel: rgba(13, 16, 18, .82);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ground); color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
canvas { display: block; touch-action: none; }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center;
  gap: 14px; background: var(--ground); text-align: center; padding: 24px;
}
#load-track { width: min(260px, 70vw); height: 3px; background: #23292C; overflow: hidden; }
#load-bar { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
#load-label { font-size: 13px; color: #8A9490; letter-spacing: .02em; }

/* ---------- waypoint markers ---------- */
#markers { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.mark {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 7px; border: 0; border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font: inherit; font-size: 13px; cursor: pointer;
  pointer-events: auto; backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mark .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 255, 255, .22);
  flex: none;
}
.mark:hover, .mark:focus-visible { background: var(--accent); }
.mark:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (hover: none) { .mark .lbl { display: none; } .mark { padding: 7px; } }

/* ---------- chrome ---------- */
#ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#brand {
  position: absolute; left: 0; top: 0;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .8);
}
#hint {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 7px 14px; border-radius: 999px; background: var(--panel);
  font-size: 12px; color: #A7B2AD; white-space: nowrap;
}

/* ---------- downgrade prompt + error ---------- */
#downgrade {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(54px + env(safe-area-inset-bottom));
  pointer-events: auto; border: 0; border-radius: 6px; padding: 12px 14px;
  background: var(--panel); color: var(--ink); max-width: min(340px, 90vw);
}
#downgrade::backdrop { background: transparent; }
#downgrade p { margin: 0 0 10px; font-size: 13.5px; }
button.act {
  border: 0; border-radius: 4px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
}
button.act:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

#error {
  position: fixed; inset: 0; z-index: 40; display: none; place-content: center;
  padding: 28px; background: var(--ground); text-align: center;
}
#error h1 { font-size: 19px; margin: 0 0 8px; font-weight: 600; }
#error p { margin: 0 0 14px; color: #8A9490; font-size: 14px; max-width: 34ch; }
#error pre {
  font-size: 11px; color: #5C6663; white-space: pre-wrap; word-break: break-word;
  max-width: 40ch; margin: 0 auto; text-align: left;
}

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* authoring aid (?author=1) — never reachable from a published tour */
#author {
  position: fixed; right: 10px; top: 10px; z-index: 25; max-width: 320px;
  padding: 10px 12px; border-radius: 4px; background: var(--panel);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink);
}
#author kbd { background: #2A3236; border-radius: 3px; padding: 0 4px; }
#author pre {
  margin: 8px 0 0; max-height: 45vh; overflow: auto; font-size: 11px;
  color: #9FB3AC; white-space: pre; user-select: all;
}
