:root {
  --bg: #0e0f12;
  --panel: #14161a;
  --line: #262a31;
  --text: #e8e9ec;
  --mute: #8b919b;
  --lime: #c6ff3d;
  --lime-ink: #101400;
  --blue: #3b6df0;
  --amber: #ffb547;
  --head: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.app { display: grid; height: 100dvh; grid-template-rows: minmax(0, 1fr) auto; }
.stage { position: relative; min-height: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.top {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 12px; align-self: flex-start; padding: 2px 0; }
.brand-mark { font-family: var(--head); font-weight: 900; font-size: 28px; letter-spacing: .02em; line-height: 1; }
.brand-mark i { font-style: normal; color: var(--lime); margin-left: 2px; }
.brand-list { font-size: 13px; color: var(--mute); border-bottom: 1px dashed var(--mute); }
.brand:hover .brand-list { color: var(--text); border-color: var(--text); }

.cams { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.cams::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: rgba(20, 22, 26, .72); border: 1px solid var(--line); backdrop-filter: blur(8px);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: #3b424c; }
.chip:active { transform: translateY(1px); }
.chip-toggle[aria-pressed="true"] { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }

.hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 12px; color: var(--mute); background: rgba(14, 15, 18, .7); padding: 6px 12px;
  border-radius: 999px; white-space: nowrap; pointer-events: none; transition: opacity .6s;
}
.hint.gone { opacity: 0; }

.panel {
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; max-height: 58dvh; overflow-y: auto;
}
.meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--mute); }
.badge { padding: 3px 9px; border-radius: 4px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 11px; }
.badge.draft { background: rgba(255, 181, 71, .14); color: var(--amber); }
.badge.verified { background: rgba(198, 255, 61, .14); color: var(--lime); }
h1 { font-family: var(--head); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: .01em; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.step-n {
  font-family: var(--head); font-weight: 900; font-size: 44px; line-height: .85; color: var(--lime);
  min-width: 1.1ch; font-variant-numeric: tabular-nums;
}
h2 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.step p { font-size: 14px; line-height: 1.45; color: #b7bcc6; }

.timeline { position: relative; padding-top: 6px; }
.ticks { position: absolute; left: 0; right: 0; top: 14px; height: 8px; pointer-events: none; }
.ticks i { position: absolute; top: 0; width: 2px; height: 8px; background: #4a5059; transform: translateX(-1px); border-radius: 1px; }
.ticks i.on { background: var(--lime); }
#scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; touch-action: none; position: relative; z-index: 1; }
#scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--lime) var(--p, 0%), #2a2f36 var(--p, 0%)); }
#scrub::-moz-range-track { height: 4px; border-radius: 2px; background: #2a2f36; }
#scrub::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--lime); }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--lime); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--lime); }
#scrub::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--lime); border: 3px solid var(--panel); }
.times { display: flex; justify-content: space-between; font: 500 12px var(--mono); color: var(--mute); margin-top: -2px; }

.controls { display: flex; align-items: center; gap: 10px; }
.ctl { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.ctl:hover { border-color: #3b424c; background: #1b1e23; }
.ctl svg { width: 20px; height: 20px; fill: var(--text); stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ctl-main { width: 56px; height: 56px; background: var(--lime); border-color: var(--lime); }
.ctl-main:hover { background: #d6ff6e; border-color: #d6ff6e; }
.ctl-main svg { fill: var(--lime-ink); stroke: var(--lime-ink); width: 24px; height: 24px; }
.speed { margin-left: auto; display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.speed button { padding: 7px 11px; border-radius: 999px; font: 500 12px var(--mono); color: var(--mute); }
.speed button.on { background: #262a31; color: var(--text); }

.catalog { margin: auto; width: min(560px, calc(100vw - 24px)); max-height: 80dvh; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; }
.catalog::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
.catalog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.catalog-head h3 { font-family: var(--head); font-size: 26px; font-weight: 800; }
.catalog ul { list-style: none; padding: 6px 10px 14px; }
.catalog li button { width: 100%; text-align: left; padding: 12px 10px; border-radius: 10px; display: grid; gap: 4px; }
.catalog li button:hover { background: #1c1f25; }
.catalog li b { font-size: 16px; font-weight: 600; }
.catalog li small { color: var(--mute); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.catalog li.on b { color: var(--lime); }

@media (min-width: 900px) {
  .app { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) 400px; }
  .panel { max-height: none; border-top: 0; border-left: 1px solid var(--line); padding: 24px 22px; gap: 14px; }
  h1 { font-size: 40px; }
  .brand-mark { font-size: 32px; }
  .step p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
