/* METEOR CITY IMPACT — documentary editorial grotesque, near-monochrome + ember accent */
:root {
  --ink: #e8e6e1;
  --ink-dim: #9a978f;
  --ink-faint: #5c5a54;
  --paper: #0b0b0c;
  --bar: #101012;
  --line: #26262a;
  --ember: #ff5d1f;
  --ember-soft: rgba(255, 93, 31, 0.55);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --grot: "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--paper); color: var(--ink); font-family: var(--grot); overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- top bar ---------- */
#bar-top {
  flex: 0 0 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--bar); border-bottom: 1px solid var(--line);
  letter-spacing: 0.12em; user-select: none; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-mark { width: 9px; height: 9px; background: var(--ember); align-self: center; flex: 0 0 auto;
  box-shadow: 0 0 10px var(--ember-soft); }
.brand-title { font-weight: 700; font-size: 14px; letter-spacing: 0.22em; white-space: nowrap; }
.brand-sub { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.28em; white-space: nowrap; }
.top-right { display: flex; align-items: baseline; gap: 16px; }
.chapter-label { font-size: 11px; font-weight: 700; letter-spacing: 0.24em; color: var(--ember); white-space: nowrap; }
.timecode { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); white-space: nowrap; }

/* ---------- stage ---------- */
#stage { position: relative; flex: 1 1 auto; min-height: 0; background: #000; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }

/* boot overlay */
#boot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 20%, rgba(20,20,24,0.88), rgba(5,5,6,0.97));
  z-index: 10; transition: opacity 0.9s ease; }
#boot.hidden { opacity: 0; pointer-events: none; }
.boot-card { max-width: 560px; padding: 32px; text-align: left; }
.boot-kicker { font-size: 10px; letter-spacing: 0.34em; color: var(--ember); margin-bottom: 18px; }
.boot-card h1 { font-size: clamp(38px, 7vw, 64px); line-height: 0.95; font-weight: 800; letter-spacing: 0.02em; margin-bottom: 18px; }
.boot-copy { font-size: 13px; line-height: 1.65; color: var(--ink-dim); margin-bottom: 26px; max-width: 46ch; }
.btn-primary {
  font-family: var(--grot); font-weight: 700; font-size: 13px; letter-spacing: 0.26em;
  color: #0b0b0c; background: var(--ember); border: 0; padding: 14px 30px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover, .btn-primary:focus-visible { box-shadow: 0 0 24px var(--ember-soft); transform: translateY(-1px); outline: none; }
.boot-keys { margin-top: 22px; font-size: 10px; letter-spacing: 0.18em; color: var(--ink-faint); }

/* ---------- bottom bar ---------- */
#bar-bottom {
  flex: 0 0 auto; background: var(--bar); border-top: 1px solid var(--line);
  padding: 10px 18px 12px; z-index: 5; user-select: none;
}
.transport { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.t-btn {
  font-family: var(--grot); background: #17171a; color: var(--ink); border: 1px solid var(--line);
  min-width: 42px; min-height: 34px; font-size: 14px; cursor: pointer; letter-spacing: 0.14em;
}
.t-btn.wide { font-size: 10px; font-weight: 700; padding: 0 14px; }
.t-btn:hover, .t-btn:focus-visible { border-color: var(--ink-dim); outline: none; }
.t-btn[aria-pressed="true"] { background: var(--ember); color: #0b0b0c; border-color: var(--ember); }
.speed-group, .fx-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grp-label { font-size: 9px; letter-spacing: 0.26em; color: var(--ink-faint); margin: 0 4px 0 8px; }
.s-btn {
  font-family: var(--mono); background: transparent; color: var(--ink-dim); border: 1px solid var(--line);
  min-width: 44px; min-height: 30px; font-size: 11px; cursor: pointer; padding: 0 8px;
}
.s-btn:hover, .s-btn:focus-visible { color: var(--ink); border-color: var(--ink-dim); outline: none; }
.s-btn.active { color: var(--ember); border-color: var(--ember); }
.fx { display: flex; align-items: center; gap: 7px; cursor: pointer; padding: 6px 4px; min-height: 34px; }
.fx input { appearance: none; width: 13px; height: 13px; border: 1px solid var(--ink-faint); background: transparent; cursor: pointer; flex: 0 0 auto; }
.fx input:checked { background: var(--ember); border-color: var(--ember); box-shadow: 0 0 8px var(--ember-soft); }
.fx input:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.fx span { font-size: 9px; letter-spacing: 0.2em; color: var(--ink-dim); }
.fx input:checked + span { color: var(--ink); }

/* ---------- timeline rail ---------- */
.rail-wrap { position: relative; }
#rail { position: relative; height: 22px; display: flex; gap: 2px; margin-bottom: 2px; }
.rail-seg { position: relative; border: 1px solid var(--line); border-bottom: 0; background: #141416; cursor: pointer; overflow: hidden; }
.rail-seg .seg-name { position: absolute; left: 8px; top: 4px; font-size: 8px; letter-spacing: 0.22em; color: var(--ink-faint); white-space: nowrap; pointer-events: none; }
.rail-seg.active { border-color: var(--ember); background: rgba(255, 93, 31, 0.07); }
.rail-seg.active .seg-name { color: var(--ember); }
.rail-seg:hover .seg-name { color: var(--ink); }
.seg-impact { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ember); opacity: 0.8; pointer-events: none; }
#scrub { width: 100%; height: 26px; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; display: block; }
#scrub::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--ember) var(--fill, 0%), #2c2c30 var(--fill, 0%)); }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 18px; margin-top: -7px; background: var(--ink); border: 0; box-shadow: 0 0 0 1px #000; }
#scrub::-moz-range-track { height: 4px; background: #2c2c30; }
#scrub::-moz-range-progress { height: 4px; background: var(--ember); }
#scrub::-moz-range-thumb { width: 12px; height: 18px; background: var(--ink); border: 0; border-radius: 0; }
#scrub:focus-visible { outline: 1px solid var(--ink-dim); outline-offset: 2px; }
#chapters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ch-btn {
  font-family: var(--grot); background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  font-size: 9px; font-weight: 700; letter-spacing: 0.2em; padding: 7px 10px; min-height: 32px; cursor: pointer;
}
.ch-btn .num { color: var(--ink-faint); margin-right: 6px; font-family: var(--mono); font-weight: 400; }
.ch-btn:hover, .ch-btn:focus-visible { color: var(--ink); border-color: var(--ink-dim); outline: none; }
.ch-btn.active { color: var(--ember); border-color: var(--ember); }
.ch-btn.active .num { color: var(--ember); }

/* ---------- narrow viewports ---------- */
@media (max-width: 760px) {
  #bar-top { flex-basis: 46px; padding: 0 12px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 11px; }
  .chapter-label { display: none; }
  .timecode { font-size: 10px; }
  #bar-bottom { padding: 8px 10px 10px; }
  .transport { gap: 6px; margin-bottom: 8px; }
  .t-btn { min-width: 44px; min-height: 40px; }
  .t-btn.wide { font-size: 9px; padding: 0 10px; }
  .s-btn { min-width: 44px; min-height: 40px; }
  .fx { min-height: 40px; }
  .fx span { font-size: 8px; }
  #rail { height: 18px; }
  .rail-seg .seg-name { display: none; }
  #scrub { height: 34px; }
  #scrub::-webkit-slider-thumb { width: 16px; height: 26px; margin-top: -11px; }
  .ch-btn { padding: 10px 10px; min-height: 44px; font-size: 8px; }
  .boot-card { padding: 20px; }
}
