:root {
  --bg: #050403;
  --ink: #ece6da;
  --muted: #9a9286;
  --faint: #5e574e;
  --line: rgba(236, 230, 218, 0.14);
  --ochre: #d99a55;
  --ochre-deep: #b4642c;
  --panel: rgba(12, 10, 8, 0.82);
  --sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Inter, "Segoe UI", sans-serif;
  --text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Inter, "Segoe UI", sans-serif;
  --pad: clamp(16px, 3.4vw, 48px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 var(--text); -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--ochre); outline-offset: 3px; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; }
.view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.view.dragging { cursor: grabbing; }
.view.pointing { cursor: pointer; }

.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ochre); }

/* ---------- chrome ---------- */
.top, .bottom, .hint, .marks { transition: opacity 0.6s ease; }
.app:not(.entered) :is(.top, .bottom, .marks, .hint) { opacity: 0; pointer-events: none; }
.app.flying .marks { opacity: 0; pointer-events: none; }

.top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: baseline; gap: 18px;
  padding: calc(var(--pad) * 0.8) var(--pad); pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}
.top > * { pointer-events: auto; }
.brand { font: 500 14px var(--sans); letter-spacing: 0.01em; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }
.station-title { margin: 0; font: 300 14px var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 20px;
  padding: var(--pad); padding-bottom: max(var(--pad), env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
}
.bottom > * { pointer-events: auto; }
.dots { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dots button {
  position: relative; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
}
.dots button::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(236, 230, 218, 0.55); transition: all 0.4s ease;
}
.dots button[aria-current="step"]::before { background: var(--ochre); border-color: var(--ochre); box-shadow: 0 0 12px rgba(217, 154, 85, 0.7); }
.dots button:disabled { cursor: default; }
.dots button:disabled::before { border-style: dashed; opacity: 0.5; }
.dots button:not(:disabled):hover::before { border-color: var(--ink); }
.station-line { margin: 0; font: 300 15px var(--sans); color: #cfc7b9; flex: 1; min-width: 0; text-wrap: balance; }
.credits-open { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); padding: 8px 0; }
.credits-open:hover { color: var(--ink); }

.hint {
  position: absolute; left: 50%; bottom: calc(var(--pad) + 64px); transform: translateX(-50%); margin: 0;
  font: 400 13px var(--sans); color: #d8cfbf; letter-spacing: 0.02em; text-align: center; pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9); max-width: 80vw; opacity: 0;
}
.hint.show { opacity: 1; }

/* ---------- hotspots and waypoints ---------- */
.marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mark {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  pointer-events: auto; display: grid; place-items: center; will-change: transform;
}
.mark::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(240, 214, 170, 0.75);
  box-shadow: 0 0 10px 2px rgba(217, 154, 85, 0.45); animation: breathe 3.2s ease-in-out infinite; transition: opacity 0.3s;
}
.mark::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1.5px solid var(--ochre);
  opacity: 0; transform: scale(0.6); transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 0 18px rgba(217, 154, 85, 0.35), inset 0 0 12px rgba(217, 154, 85, 0.2);
}
.mark:hover::after, .mark:focus-visible::after, .mark.open::after { opacity: 1; transform: scale(1); }
.mark:focus-visible { outline: none; }
.mark .label {
  position: absolute; left: 50%; top: calc(100% + 2px); transform: translate(-50%, -4px); white-space: nowrap;
  font: 500 13px var(--sans); color: var(--ink); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.8);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none;
}
.mark:hover .label, .mark:focus-visible .label, .mark.open .label { opacity: 1; transform: translate(-50%, 0); }
.mark.offscreen { opacity: 0; pointer-events: none; }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.1); } }

.waypoint { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.waypoint::before {
  width: 18px; height: 18px; background: radial-gradient(circle, rgba(255, 236, 200, 0.95), rgba(240, 170, 90, 0.55) 45%, rgba(240, 170, 90, 0) 72%);
  box-shadow: 0 0 26px 8px rgba(240, 170, 90, 0.35);
}
.waypoint::after { inset: 10px; border-style: dashed; }
.waypoint .label { color: #f3e3c6; }
.waypoint.locked::before { background: radial-gradient(circle, rgba(200, 190, 175, 0.5), rgba(120, 110, 100, 0) 70%); box-shadow: none; animation: none; }
.waypoint.locked { cursor: not-allowed; }

/* ---------- info card ---------- */
.card {
  position: absolute; top: 50%; right: var(--pad); transform: translateY(-50%); width: min(400px, calc(100vw - 2 * var(--pad)));
  max-height: calc(100vh - 2 * var(--pad) - 120px); overflow: auto;
  padding: 28px 28px 24px; background: var(--panel); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes card-in { from { opacity: 0; transform: translate(12px, -50%); } }
.card h2 { margin: 10px 0 12px; font: 300 28px/1.12 var(--sans); letter-spacing: -0.025em; text-wrap: balance; padding-right: 24px; }
.card .body { margin: 0; color: #d5cdc0; font-size: 15px; line-height: 1.6; }
.card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.card .actions:empty { display: none; }
.card .actions button {
  padding: 10px 16px; border: 1px solid rgba(217, 154, 85, 0.6); border-radius: 3px; color: #f2dfc0; font: 500 14px var(--sans);
  transition: background 0.2s;
}
.card .actions button:hover { background: rgba(217, 154, 85, 0.16); }
.card .actions button.primary { background: var(--ochre); color: #1a120a; border-color: var(--ochre); }
.card .actions button.primary:hover { background: #e7ab6a; }
.card .actions button:disabled { opacity: 0.5; cursor: default; }
.card .note { width: 100%; margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.card .credit { margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.card .credit:empty { display: none; }
.card .credit a { border-bottom: 1px solid var(--line); }
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); font-size: 14px; }
.close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

/* ---------- credits drawer ---------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); overflow: auto; padding: 56px 32px 32px;
  background: rgba(10, 8, 6, 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-left: 1px solid var(--line);
  animation: drawer-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 6;
}
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } }
.drawer h2 { margin: 10px 0 20px; font: 300 30px/1.1 var(--sans); letter-spacing: -0.03em; }
.drawer h3 { margin: 26px 0 8px; font: 500 12px var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: #cfc7b9; line-height: 1.5; }
.drawer li b { display: block; font: 500 14px var(--sans); color: var(--ink); }
.drawer li a { border-bottom: 1px solid var(--line); }
.drawer p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ---------- title card ---------- */
.title-card {
  position: absolute; inset: 0; display: grid; place-items: center; padding: var(--pad); z-index: 8;
  background: radial-gradient(ellipse at 50% 60%, rgba(30, 18, 8, 0.55), rgba(3, 2, 1, 0.94) 70%);
  transition: opacity 1.4s ease, visibility 1.4s;
}
.app.entered .title-card { opacity: 0; visibility: hidden; pointer-events: none; }
.title-inner { max-width: 620px; text-align: center; }
.title-card h1 { margin: 16px 0 22px; font: 200 clamp(40px, 7.5vw, 84px)/1 var(--sans); letter-spacing: -0.045em; text-wrap: balance; }
.title-card .intro { margin: 0 auto 34px; max-width: 540px; color: #d3cabb; font-size: 16px; line-height: 1.65; text-wrap: pretty; }
.enter-row { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.enter {
  position: relative; overflow: hidden; min-width: 240px; padding: 16px 34px; border-radius: 3px; background: #e9dfcd; color: #15100a;
  font: 500 16px var(--sans); letter-spacing: 0.01em; transition: background 0.3s, transform 0.2s;
}
.enter:not(:disabled):hover { background: #f5ead8; transform: translateY(-1px); }
.enter:disabled { cursor: progress; background: rgba(233, 223, 205, 0.16); color: #cfc4b2; }
.enter .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.enter .progress i { display: block; height: 100%; width: 0; background: var(--ochre); transition: width 0.25s ease; }
.enter:not(:disabled) .progress { display: none; }
.sound-note { margin: 0; font-size: 12px; color: var(--faint); letter-spacing: 0.06em; }
.caveat { margin: 34px auto 0; max-width: 480px; font-size: 12px; line-height: 1.6; color: var(--faint); }

/* ---------- failure ---------- */
.fail { position: absolute; inset: 0; display: grid; place-content: center; padding: var(--pad); text-align: center; gap: 4px; z-index: 9; background: var(--bg); }
.fail h2 { margin: 12px 0; font: 300 32px var(--sans); letter-spacing: -0.03em; }
.fail p { max-width: 460px; margin: 0 auto; color: var(--muted); }
.fail .back { margin-top: 24px; color: var(--ochre); }

.artifact-host { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.artifact-host > * { pointer-events: auto; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .top { flex-direction: column; gap: 2px; }
  .station-title { font-size: 13px; }
  .bottom { flex-wrap: wrap; gap: 8px 14px; }
  .station-line { order: 3; flex-basis: 100%; font-size: 14px; }
  .credits-open { margin-left: auto; }
  .card {
    top: auto; bottom: 0; right: 0; left: 0; transform: none; width: auto; max-height: 62vh; border-radius: 12px 12px 0 0;
    padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheet-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
  .card h2 { font-size: 24px; }
  .hint { bottom: 132px; }
  .title-card .intro { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; }
}
