:root {
  color-scheme: dark light;
  --bg: #0c0e13;
  --surface: #14171f;
  --surface-2: #1b1f2a;
  --line: #262b38;
  --text: #eceef3;
  --muted: #98a0b3;
  --accent: #f5a524;
  --accent-ink: #1a1203;
  --accent-soft: rgba(245, 165, 36, 0.13);
  --danger: #ff7a70;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #f0eee9;
    --line: #e2dfd8;
    --text: #1a1c22;
    --muted: #62687a;
    --accent: #c26a00;
    --accent-ink: #ffffff;
    --accent-soft: rgba(194, 106, 0, 0.1);
    --danger: #c0392b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.page { max-width: 1040px; margin: 0 auto; padding: 0 20px 48px; }

/* Masthead */
.masthead { padding: 22px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent); font-weight: 650; }
.brand-track { fill: var(--line); }
.brand-fill { fill: var(--accent); }
.brand-dot { fill: var(--bg); }

/* Hero */
.hero { padding: 7vh 0 34px; max-width: 760px; }
.hero.compact { padding-top: 6px; max-width: none; }
.hero.compact h1, .hero.compact .lede { display: none; }
h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 720; text-wrap: balance; }
.lede { margin-top: 18px; font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 620px; text-wrap: pretty; }

.search { margin-top: 30px; display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 7px; transition: border-color 0.15s, box-shadow 0.15s; }
.hero.compact .search { margin-top: 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 12px 14px; font-size: 17px; }
.search input::placeholder { color: var(--muted); opacity: 0.7; }
.search button { border: 0; border-radius: 11px; padding: 0 22px; background: var(--accent); color: var(--accent-ink); font-weight: 650; white-space: nowrap; transition: filter 0.15s, transform 0.05s; }
.search button:hover { filter: brightness(1.08); }
.search button:active { transform: translateY(1px); }
.search button:disabled { opacity: 0.6; cursor: progress; }
.error { margin-top: 14px; color: var(--danger); font-weight: 500; }

/* Loading */
.loading { padding: 56px 0; display: flex; flex-direction: column; align-items: center; gap: 18px; color: var(--muted); }
.pulse { display: flex; align-items: center; gap: 5px; height: 34px; }
.pulse i { width: 5px; height: 100%; border-radius: 3px; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; transform: scaleY(0.3); }
.pulse i:nth-child(2) { animation-delay: 0.12s; }
.pulse i:nth-child(3) { animation-delay: 0.24s; }
.pulse i:nth-child(4) { animation-delay: 0.36s; }
.pulse i:nth-child(5) { animation-delay: 0.48s; }
@keyframes pulse { 0%, 100% { transform: scaleY(0.3); opacity: 0.5; } 50% { transform: scaleY(1); opacity: 1; } }

/* Video card */
.video { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 26px; align-items: start; margin-top: 8px; }
.stage { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); position: relative; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.poster { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #000; position: relative; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.86; transition: opacity 0.2s; }
.poster:hover img { opacity: 1; }
.poster-play { position: absolute; inset: 0; margin: auto; width: 62px; height: 62px; border-radius: 50%; background: var(--accent); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); }
.poster-play::after { content: ""; position: absolute; left: 25px; top: 19px; border-left: 19px solid var(--accent-ink); border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
a.poster { text-decoration: none; }
.poster-note { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.88)); color: #fff; font-size: 14px; line-height: 1.35; text-align: center; }
.poster-note b { display: block; color: var(--accent); font-weight: 650; margin-top: 2px; }
.video-meta h2 { font-size: clamp(20px, 2.6vw, 26px); line-height: 1.22; letter-spacing: -0.02em; text-wrap: balance; }
.video-meta > .muted { margin-top: 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 20px; }
.stats dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.stats dd { font: 600 24px/1.2 var(--mono); letter-spacing: -0.02em; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.btn { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px; font-size: 14px; font-weight: 550; transition: border-color 0.15s, background 0.15s; }
a.btn { text-decoration: none; display: inline-block; }
.btn-primary { border-color: var(--accent); color: var(--accent); }
.btn:hover { border-color: var(--muted); background: var(--surface-2); }

/* Timeline */
.timeline-wrap { margin-top: 30px; }
.timeline { position: relative; height: 64px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.tick { position: absolute; bottom: 0; width: 9px; margin-left: -4px; padding: 0; border: 0; background: none; height: 100%; }
.tick::after { content: ""; position: absolute; left: 3px; bottom: 0; width: 3px; border-radius: 2px 2px 0 0; background: var(--accent); height: var(--h, 30%); opacity: var(--o, 0.6); transition: opacity 0.12s, width 0.12s, left 0.12s; }
.tick:hover::after, .tick.on::after { opacity: 1; width: 5px; left: 2px; }
.tick.on::after { background: var(--text); }
.tick.dim::after { opacity: 0.12; }
.chapter-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); pointer-events: none; }
.timeline-scale { display: flex; justify-content: space-between; margin-top: 6px; font: 12px var(--mono); color: var(--muted); }

/* Insight */
.insight { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.insight h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 650; }
.insight-pending { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: spark 1.2s ease-in-out infinite; }
@keyframes spark { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 50% { transform: scale(1.15); opacity: 1; } }
.overview { margin-top: 10px; font-size: 18px; line-height: 1.5; max-width: 780px; text-wrap: pretty; }
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 20px; }
.highlight { text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 13px 15px; transition: border-color 0.15s, transform 0.15s; }
.highlight:hover { border-color: var(--accent); transform: translateY(-1px); }
.highlight b { display: block; font: 600 15px var(--mono); color: var(--accent); }
.highlight strong { display: block; margin-top: 3px; font-weight: 620; line-height: 1.3; }
.highlight span { display: block; margin-top: 5px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.themes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.theme { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 14px; }
.theme:hover { border-color: var(--accent); color: var(--accent); }

/* Moments */
.moments { margin-top: 36px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.toolbar h3 { font-size: 21px; letter-spacing: -0.02em; }
.toolbar-controls { display: flex; gap: 8px; align-items: center; }
#filter { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 180px; font-size: 14px; }
#filter:focus { outline: 0; border-color: var(--accent); }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 5px 11px; font-size: 14px; color: var(--muted); font-weight: 550; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 11px; font-size: 13px; color: var(--muted); text-transform: capitalize; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip i { font-style: normal; opacity: 0.7; margin-left: 5px; font-family: var(--mono); font-size: 12px; }

.list { margin-top: 16px; border-top: 1px solid var(--line); }
.moment { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 4px 18px; padding: 15px 12px 15px 14px; border-bottom: 1px solid var(--line); position: relative; scroll-margin-top: 16px; transition: background 0.15s; }
.moment::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: calc(var(--heat, 0) * 0.9); }
.moment:hover, .moment.on { background: var(--surface); }
.moment.on::before { opacity: 1; background: var(--text); }
.time { align-self: start; justify-self: start; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 5px 9px; font: 600 15px var(--mono); color: var(--accent); min-width: 66px; text-align: center; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.time:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.m-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.m-title { font-weight: 620; font-size: 16.5px; line-height: 1.35; overflow-wrap: anywhere; }
.m-title.quote { font-weight: 450; }
.m-cat { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; white-space: nowrap; }
.m-summary { color: var(--muted); margin-top: 3px; font-size: 15px; overflow-wrap: anywhere; }
.moment details { margin-top: 7px; font-size: 14px; }
.moment summary { cursor: pointer; color: var(--muted); width: fit-content; }
.moment summary:hover { color: var(--text); }
.quotes { margin-top: 8px; display: grid; gap: 7px; }
.quotes li { border-left: 2px solid var(--line); padding-left: 11px; color: var(--muted); overflow-wrap: anywhere; }
.quotes li span { font: 12px var(--mono); margin-left: 8px; opacity: 0.8; white-space: nowrap; }
.m-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 13px; }
.m-count { font: 600 14px var(--mono); }
.m-count small { font-weight: 400; color: var(--muted); font-size: 12px; }
.m-side a, .m-side button { color: var(--muted); background: none; border: 0; padding: 0; font-size: 13px; text-decoration: none; }
.m-side a:hover, .m-side button:hover { color: var(--accent); }
.empty { padding: 34px 0; color: var(--muted); text-align: center; }

/* Chapters */
.chapters { margin-top: 28px; }
.chapters summary { cursor: pointer; font-weight: 600; }
.chapters ol { margin-top: 12px; display: grid; gap: 2px; }
.chapters li button { display: flex; gap: 14px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 6px 8px; }
.chapters li button:hover { background: var(--surface); }
.chapters li b { font: 600 14px var(--mono); color: var(--accent); min-width: 62px; }

/* How it works */
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.how div { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.how b { font: 600 13px var(--mono); color: var(--accent); }
.how h3 { margin-top: 8px; font-size: 17px; letter-spacing: -0.01em; }
.how p { margin-top: 6px; color: var(--muted); font-size: 15px; }

.footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 550; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); z-index: 10; }

@media (max-width: 760px) {
  .video { grid-template-columns: 1fr; gap: 18px; }
  .how { grid-template-columns: 1fr; }
  .search { flex-direction: column; }
  .search button { padding: 13px; }
  .moment { grid-template-columns: 70px minmax(0, 1fr); }
  .m-side { grid-column: 2; flex-direction: row; align-items: center; gap: 14px; margin-top: 4px; }
  .toolbar-controls { width: 100%; }
  #filter { flex: 1; width: auto; }
  .stats { gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
