/* ============================================================================
   The Point of No Return — exhibit styling
   Museum-dark space; accents pulled from the disk glow (amber) and the
   escaping photons (cyan). Panels float over the observation window.
   ========================================================================== */

:root {
  --bg: #04060e;
  --panel: rgba(9, 13, 26, 0.78);
  --panel-solid: #0a0e1d;
  --line: rgba(255, 180, 96, 0.16);
  --line-soft: rgba(150, 175, 230, 0.12);
  --amber: #ffab54;
  --amber-hi: #ffd9a0;
  --ember: #ff7a2f;
  --cyan: #7cd4ff;
  --ink: #e9edf6;
  --ink-dim: #9aa5bd;
  --ink-faint: #6b7690;
  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans: 'Space Grotesk', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --rad: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#view:active { cursor: grabbing; }

/* ------------------------------------------------------------- the plaque */
#plaque {
  position: fixed;
  top: clamp(14px, 3vw, 30px);
  left: clamp(14px, 3vw, 34px);
  max-width: min(430px, 72vw);
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
  z-index: 5;
}
#plaque .kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}
#plaque h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 4.2vw, 44px);
  line-height: 1.02;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
#plaque .specimen {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: inline-block;
}

/* ------------------------------------------------------------ the hint ---- */
#hint {
  position: fixed;
  bottom: clamp(76px, 11vh, 96px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  background: rgba(9, 13, 26, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
  animation: hintIn 1s ease 0.8s both;
  transition: opacity 0.8s ease;
}
#hint.gone { opacity: 0; }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ----------------------------------------------------------- readouts ----- */
#readouts {
  position: fixed;
  left: clamp(14px, 3vw, 34px);
  bottom: clamp(14px, 3vw, 26px);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(560px, 60vw);
  z-index: 5;
  pointer-events: none;
}
.ro {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  background: rgba(9, 13, 26, 0.66);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 6px 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ro b { color: var(--amber-hi); font-weight: 600; margin-right: 5px; }
.ro i { color: var(--ink-faint); font-style: normal; margin-left: 6px; }

/* ----------------------------------------------------------- quickbar ----- */
#quickbar {
  position: fixed;
  bottom: clamp(14px, 3vw, 26px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 6;
}
.qbtn {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: rgba(9, 13, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s;
  white-space: nowrap;
}
.qbtn:hover { border-color: var(--amber); box-shadow: 0 0 18px rgba(255, 171, 84, 0.18); }
.qbtn:active { transform: scale(0.97); }
.qbtn.accent { border-color: rgba(255, 171, 84, 0.55); color: var(--amber-hi); }
.qbtn b { color: var(--amber-hi); font-weight: 600; }
.qbtn.lit { border-color: rgba(124, 212, 255, 0.6); color: var(--cyan); }

/* -------------------------------------------------------------- panel ----- */
#panel {
  position: fixed;
  top: clamp(14px, 3vw, 30px);
  right: clamp(14px, 3vw, 30px);
  width: min(372px, calc(100vw - 28px));
  max-height: calc(100vh - 140px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  z-index: 8;
  overflow: hidden;
}
.sheet-handle { display: none; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.tab {
  flex: 1;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 13px 4px 11px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--ink-dim); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

.panes { overflow-y: auto; overscroll-behavior: contain; }
.pane { display: none; padding: 18px 20px 22px; }
.pane.active { display: block; animation: paneIn 0.28s ease; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } }

.pane h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 10px;
}
.pane p { font-size: 13.5px; line-height: 1.55; color: var(--ink-dim); margin: 0 0 12px; }
.pane .lede { font-size: 13.5px; }
.micro { font-size: 11.5px !important; color: var(--ink-faint) !important; }

/* story */
.story-intro p { font-family: var(--serif); font-size: 14.5px; }
.stop-tab {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.dots { display: flex; gap: 5px; margin-left: auto; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: none; background: rgba(154, 165, 189, 0.3);
  padding: 0; cursor: pointer; transition: background 0.2s, transform 0.2s;
}
.dot.on { background: var(--amber); transform: scale(1.35); }
.story-head { display: flex; align-items: center; margin-bottom: 10px; }
.stop-title { color: var(--amber-hi); }
.stop-body { font-family: var(--serif); font-size: 14.5px; line-height: 1.62; color: var(--ink); }
.stop-body b { color: var(--amber-hi); font-weight: 600; }
.stop-tip {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cyan);
  background: rgba(124, 212, 255, 0.07);
  border: 1px solid rgba(124, 212, 255, 0.18);
  border-radius: 10px;
  padding: 9px 12px;
}
.tip-star { color: var(--amber); }
.story-nav { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.story-nav .subtle { margin-left: auto; font-size: 11px; }

/* buttons */
.btn {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(154, 165, 189, 0.1);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.btn:hover { border-color: var(--amber); }
.btn.primary {
  background: linear-gradient(160deg, rgba(255, 171, 84, 0.22), rgba(255, 122, 47, 0.14));
  border-color: rgba(255, 171, 84, 0.5);
  color: var(--amber-hi);
}
.btn.primary:hover { box-shadow: 0 0 16px rgba(255, 150, 60, 0.25); }
.btn.ghost { background: transparent; }
.btn.big { padding: 12px 20px; font-size: 14px; margin-top: 4px; }

/* controls */
.ctl { margin-bottom: 15px; }
.ctl-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--ink-dim); letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.ctl-val { font-family: var(--mono); font-size: 11px; color: var(--amber-hi); }
input[type="range"] {
  width: 100%;
  appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 122, 47, 0.55), rgba(255, 200, 130, 0.8));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber-hi);
  border: 2px solid #1a1206;
  box-shadow: 0 0 10px rgba(255, 171, 84, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber-hi); border: 2px solid #1a1206;
}
select {
  width: 100%;
  font-family: var(--sans); font-size: 12.5px;
  color: var(--ink); background: rgba(154, 165, 189, 0.08);
  border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 8px 10px; outline: none;
}
.tgl-row { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 16px; }
.tgl {
  display: flex; align-items: center; gap: 10px;
  background: rgba(154, 165, 189, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px 12px;
  color: var(--ink); font-family: var(--sans); font-size: 12.5px;
  cursor: pointer; text-align: left; transition: border-color 0.2s;
}
.tgl small { display: block; color: var(--ink-faint); font-size: 10.5px; margin-top: 1px; }
.tgl-dot {
  flex: 0 0 auto; width: 30px; height: 17px; border-radius: 9px;
  background: rgba(154, 165, 189, 0.25); position: relative; transition: background 0.2s;
}
.tgl-dot::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--ink-dim); transition: all 0.2s;
}
.tgl.on { border-color: rgba(255, 171, 84, 0.45); }
.tgl.on .tgl-dot { background: rgba(255, 150, 60, 0.5); }
.tgl.on .tgl-dot::after { left: 15px; background: var(--amber-hi); }
.keys-help {
  font-size: 11px; line-height: 2; color: var(--ink-faint);
  border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 6px;
}
kbd {
  font-family: var(--mono); font-size: 10px;
  background: rgba(154, 165, 189, 0.14); border: 1px solid var(--line-soft);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; margin: 0 1px;
}

/* wonder */
.wonder-sec { margin-bottom: 22px; }
.wonder-sec h3 { font-size: 15px; color: var(--amber-hi); }
.challenges { display: flex; flex-direction: column; gap: 8px; }
.challenge {
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px;
  background: rgba(154, 165, 189, 0.04); transition: border-color 0.3s;
}
.challenge.done { border-color: rgba(255, 171, 84, 0.6); background: rgba(255, 150, 60, 0.06); }
.ch-name { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; }
.ch-check { color: var(--ink-faint); }
.challenge.done .ch-check { color: var(--amber); }
.ch-task { font-size: 12px; line-height: 1.5; color: var(--ink-dim); }
.ch-hint { font-size: 10.5px; color: var(--ink-faint); margin-top: 5px; }

.quiz-score { font-family: var(--mono); font-size: 11px; color: var(--cyan); margin-bottom: 8px; }
.quiz-q {
  border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; background: rgba(154, 165, 189, 0.04);
}
.quiz-title { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.quiz-opts { display: flex; flex-direction: column; gap: 5px; }
.quiz-opt {
  text-align: left; font-family: var(--sans); font-size: 12px;
  color: var(--ink-dim); background: rgba(154, 165, 189, 0.07);
  border: 1px solid transparent; border-radius: 8px; padding: 7px 10px;
  cursor: pointer; transition: all 0.15s;
}
.quiz-opt:hover:not(.locked) { border-color: var(--amber); color: var(--ink); }
.quiz-opt.right { border-color: #4dd08a; color: #b8f4d4; background: rgba(77, 208, 138, 0.1); }
.quiz-opt.wrong { border-color: rgba(255, 110, 110, 0.6); color: #ffb9b9; }
.quiz-opt.locked { cursor: default; opacity: 0.75; }
.quiz-why { font-size: 11.5px; line-height: 1.5; color: var(--cyan); margin-top: 8px; }
.quiz-why.good { color: #b8f4d4; }

.facts { display: flex; flex-direction: column; gap: 7px; }
.fact {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: rgba(154, 165, 189, 0.05); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; color: var(--ink);
  font-family: var(--sans); transition: border-color 0.2s;
}
.fact:hover { border-color: var(--amber); }
.fact-n {
  flex: 0 0 auto; font-family: var(--mono); font-size: 10px; color: var(--amber);
  border: 1px solid var(--line); border-radius: 50%;
  width: 20px; height: 20px; display: grid; place-items: center; margin-top: 1px;
}
.fact-t { font-size: 12px; line-height: 1.5; color: var(--ink-dim); }
.fact-t b { color: var(--amber-hi); font-weight: 600; }

.glossary { display: flex; flex-direction: column; gap: 4px; }
.gloss-item { border-bottom: 1px solid var(--line-soft); }
.gloss-item summary {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  padding: 8px 2px; cursor: pointer; list-style: none;
}
.gloss-item summary::before { content: '+'; color: var(--amber); margin-right: 8px; }
.gloss-item[open] summary::before { content: '–'; }
.gloss-item summary:hover { color: var(--amber-hi); }
.gloss-body { font-size: 12px; line-height: 1.55; color: var(--ink-dim); padding: 0 2px 10px 18px; }

/* how real */
.real-list { margin: 0; padding-left: 18px; }
.real-list li { font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); margin-bottom: 10px; }
.real-list b { color: var(--amber-hi); }
.real-list i { color: var(--ink); }

/* ------------------------------------------------------------- popover ---- */
#popcard {
  position: fixed;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 14px 16px;
  z-index: 9;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#popcard.show { opacity: 1; transform: none; pointer-events: auto; }
.pop-kicker {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 5px;
}
#popcard h3 { font-family: var(--serif); font-size: 18px; margin: 0 24px 7px 0; color: var(--amber-hi); }
.pop-body { font-family: var(--serif); font-size: 13px; line-height: 1.58; color: var(--ink); }
.pop-body b { color: var(--amber-hi); }
.pop-fact {
  margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--cyan);
  border-top: 1px solid var(--line-soft); padding-top: 9px;
}
.pop-x {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--ink-faint);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px;
}
.pop-x:hover { color: var(--ink); }

/* -------------------------------------------------------------- marker ---- */
#marker {
  position: fixed; width: 46px; height: 46px;
  margin: -23px 0 0 -23px; border-radius: 50%;
  border: 2px solid var(--amber);
  pointer-events: none; opacity: 0; z-index: 7;
}
#marker.ping { animation: ping 0.8s ease-out; }
@keyframes ping {
  0% { opacity: 0.9; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* --------------------------------------------------------------- toast ---- */
#toast {
  position: fixed; top: clamp(14px, 4vh, 40px); left: 50%;
  transform: translate(-50%, -16px);
  max-width: min(480px, calc(100vw - 40px));
  font-size: 13px; line-height: 1.5;
  color: var(--ink);
  background: rgba(14, 18, 34, 0.92);
  border: 1px solid rgba(255, 171, 84, 0.5);
  border-radius: 12px; padding: 12px 18px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 12; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast b { color: var(--amber-hi); }

/* ------------------------------------------------------------ fallback ---- */
#fallback {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #0a1024, #04060e 75%);
  z-index: 50; padding: 20px;
}
#fallback[hidden] { display: none; }
.fb-card {
  max-width: 480px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--rad); padding: 30px; text-align: center;
}
.fb-card h1 { font-family: var(--serif); font-weight: 500; color: var(--amber-hi); }
.fb-card p { font-size: 14px; line-height: 1.6; color: var(--ink-dim); }
.fb-small { font-size: 12px !important; color: var(--ink-faint) !important; }
.noscript { position: fixed; inset: auto 20px 20px; margin: auto; z-index: 60; }

/* ------------------------------------------------------------- scrollbars - */
.panes::-webkit-scrollbar { width: 8px; }
.panes::-webkit-scrollbar-thumb { background: rgba(154, 165, 189, 0.2); border-radius: 4px; }

/* ============================================================ MOBILE ====== */
@media (max-width: 860px) {
  #plaque { max-width: 62vw; }
  #plaque h1 { font-size: 24px; }
  #plaque .specimen { display: none; }

  #panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; max-height: 46vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 54px));
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.24, 1);
  }
  #panel.open { transform: translateY(0); }
  .sheet-handle {
    display: grid; place-items: center;
    height: 30px; background: none; border: none; cursor: pointer;
    flex: 0 0 auto;
  }
  .sheet-handle span {
    width: 44px; height: 4px; border-radius: 2px;
    background: rgba(154, 165, 189, 0.4);
  }

  #quickbar { bottom: 66px; }
  #quickbar .qbtn { padding: 9px 14px; font-size: 12px; }
  #readouts {
    bottom: auto; top: auto;
    top: 12px; right: 12px; left: auto;
    flex-direction: column; align-items: flex-end;
    max-width: 46vw; gap: 5px;
  }
  .ro { font-size: 10px; padding: 5px 8px; }
  .ro i { display: none; }
  #hint { display: none; }
  #popcard { width: min(320px, calc(100vw - 24px)); }
  .stop-body { font-size: 14px; }
}

@media (max-height: 500px) {
  #readouts { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #hint { animation: none; }
  .pane.active { animation: none; }
}
