:root {
  --bg: #0b0b0c;
  --panel: #121214;
  --line: #232327;
  --ink: #f2f2f0;
  --dim: #8b8b93;
  --accent: #e8ff43;
  --grid-min: 260px;
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--dim); }

/* ---------- views / tabs ---------- */
.view { display: none; }
.view.show { display: block; }

.tabs { display: flex; gap: 2px; }
.tab {
  padding: 7px 13px; cursor: pointer; font-size: 12px; letter-spacing: .04em;
  background: var(--panel); color: var(--dim); border: 1px solid var(--line);
}
.tab:hover { color: var(--ink); }
.tab.on { color: #0b0b0c; background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- analyse hero ---------- */
.hero { max-width: 900px; margin: 0 auto; padding: 92px 20px 44px; text-align: center; }
/* scales with the viewport: the fixed 30px read as a caption on a wide screen */
.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 5.4vw, 68px);
  line-height: 1.04;
  letter-spacing: -.025em;
  font-weight: 700;
  text-wrap: balance;
}
.lede {
  color: var(--dim); font-size: clamp(14px, 1.35vw, 17px); line-height: 1.55;
  margin: 0 auto 30px; max-width: 640px; text-wrap: balance;
}

.paste { display: flex; margin: 0 auto 14px; max-width: 720px; }
.paste input {
  flex: 1; padding: 16px 18px; font-size: clamp(14px, 1.2vw, 16px); outline: none;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-right: none;
}
.paste input:focus { border-color: #3a3a42; }
.paste input::placeholder { color: #5c5c64; }
.paste button {
  padding: 0 28px; cursor: pointer; font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 700; letter-spacing: .04em;
  background: var(--accent); color: #0b0b0c; border: 1px solid var(--accent);
}
.paste button:disabled { opacity: .5; cursor: default; }

.examples { font-size: 12px; color: #5c5c64; }
.ex {
  background: none; border: none; border-bottom: 1px dashed #44444c;
  color: var(--dim); cursor: pointer; font-size: 12px; padding: 0 2px; margin: 0 4px;
}
.ex:hover { color: var(--accent); border-color: var(--accent); }

.progress { margin-top: 26px; text-align: left; }
.bar { height: 2px; background: var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .5s ease; }
#progress-text { padding-top: 8px; }
.failed {
  margin-top: 18px; padding: 10px 12px; font-size: 13px;
  color: #ffb4b4; background: #251a1c; border: 1px solid #3a2427; text-align: left;
}

/* ---------- report ---------- */
#report { max-width: 1080px; margin: 0 auto; padding: 0 20px 70px; }
.report-head { padding: 22px 0 8px; border-top: 1px solid var(--line); }
.report-head h2 { margin: 0 0 6px; font-size: 20px; }
.headline { margin: 0 0 16px; color: var(--accent); font-size: 14px; }

.metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.metric {
  padding: 9px 13px; background: var(--panel); border: 1px solid var(--line); min-width: 92px;
}
.metric b { display: block; font-size: 17px; font-weight: 600; }
.metric span {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #5c5c64;
}

.curve { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin-bottom: 6px; }
.curve i { flex: 1; background: #2c2c33; min-height: 2px; }

.tblock { padding: 22px 0; border-top: 1px solid var(--line); }
.tblock header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tblock h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.tblock h3 .count {
  margin-left: 10px; font-size: 11px; font-weight: 400; color: var(--dim);
  font-family: ui-monospace, Menlo, monospace;
}
.ghost {
  padding: 7px 12px; cursor: pointer; font-size: 11px; letter-spacing: .04em;
  background: none; color: var(--accent); border: 1px solid rgba(232,255,67,.35);
}
.ghost:hover { background: rgba(232,255,67,.09); }

.moments { display: flex; flex-wrap: wrap; gap: 8px; }
.moment {
  position: relative; width: 152px; height: 86px; padding: 0; cursor: pointer;
  background: #000; border: 1px solid var(--line); overflow: hidden;
}
.moment:hover { border-color: var(--accent); }
.moment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.moment .at {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 5px 3px;
  font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: #e8e8e4;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.related { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.rel-title {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: #5c5c64; margin-bottom: 8px;
}
.recipe-wrap { margin-top: 16px; }
.recipe-wrap summary {
  cursor: pointer; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.recipe-wrap .recipe { max-height: none; }

/* ---------- ask / interpretation / reel / profile / pacing ---------- */
.interpretation {
  max-width: 1080px; margin: 0 auto 4px; padding: 10px 20px; font-size: 13px;
}
.interpretation .dim { color: var(--dim); }
.crumb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.reel { padding: 14px 0 20px; }
.reel-meta { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.reel video { width: 100%; max-width: 760px; background: #000; border: 1px solid var(--line); }

.profile { padding: 6px 0 22px; }
.profile h2 { margin: 0 0 8px; font-size: 19px; }
.freq { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.chip {
  padding: 4px 9px; font-size: 11px; color: var(--dim);
  background: var(--panel); border: 1px solid var(--line);
}
.chip b { color: var(--ink); }
.dim { color: var(--dim); }

.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable th {
  text-align: left; padding: 8px 10px; font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: #5c5c64; border-bottom: 1px solid var(--line);
}
.ptable td { padding: 8px 10px; border-bottom: 1px solid #1a1a1e; }
.ptable td.num { font-family: ui-monospace, Menlo, monospace; color: var(--dim); }
.ptable tr:hover td { background: #16161a; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 20px;
  background: rgba(11,11,12,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.wordmark {
  font-weight: 700; letter-spacing: .14em; font-size: 15px;
  text-transform: uppercase; white-space: nowrap;
}
.wordmark span { color: var(--accent); }

.searchwrap { display: flex; max-width: 1080px; margin: 20px auto 0; padding: 0 20px; }
#search {
  flex: 1; padding: 9px 12px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-right: none;
  font-size: 13px; outline: none;
}
#search:focus { border-color: #34343a; }
#search::placeholder { color: #5c5c64; }
#searchbtn {
  padding: 0 14px; cursor: pointer;
  background: var(--accent); color: #0b0b0c;
  border: 1px solid var(--accent); font-size: 15px; font-weight: 700;
}
.stats { margin-left: auto; font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--dim); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 210px 1fr; align-items: start; }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } .rail { display: none; } }

.rail {
  position: sticky; top: 49px;
  padding: 18px 0 40px;
  border-right: 1px solid var(--line);
  max-height: calc(100vh - 49px); overflow-y: auto;
}
.rail-title {
  padding: 0 18px 8px; margin-top: 14px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #5c5c64;
}
.rail ul { list-style: none; margin: 0 0 10px; padding: 0; }
.rail li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 18px; cursor: pointer; color: var(--dim);
  border-left: 2px solid transparent;
}
.rail li:hover { color: var(--ink); background: #16161a; }
.rail li.on { color: var(--ink); border-left-color: var(--accent); background: #16161a; }
.rail li .n { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #5c5c64; }
.videolist li { font-size: 12px; }

main { padding: 18px 20px 60px; min-width: 0; }
.crumb {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: #5c5c64; margin-bottom: 12px;
}

/* ---------- clip grid ---------- */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
}
.card {
  position: relative; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  aspect-ratio: 16 / 9; overflow: hidden;
}
.card:hover { border-color: #3a3a42; }
.card img, .card video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: #000;
}
.card video { position: absolute; inset: 0; opacity: 0; transition: opacity .18s; }
.card.playing video { opacity: 1; }
.card .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #3a3a42; font-family: ui-monospace, Menlo, monospace; font-size: 11px;
}
.card .tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 7px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(11,11,12,.82); color: var(--accent); border: 1px solid rgba(232,255,67,.3);
}
.card .foot {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  padding: 18px 8px 7px; font-size: 11px; line-height: 1.3;
  background: linear-gradient(transparent, rgba(11,11,12,.93));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .at { color: var(--dim); font-family: ui-monospace, Menlo, monospace; }

.empty { padding: 40px 0; color: var(--dim); }

/* ---------- detail sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6,6,7,.86); backdrop-filter: blur(6px);
  overflow-y: auto; padding: 40px 20px;
}
.sheet-inner {
  position: relative; margin: 0 auto; max-width: 1080px;
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px;
  background: var(--panel); border: 1px solid var(--line); padding: 22px;
}
@media (max-width: 900px) { .sheet-inner { grid-template-columns: 1fr; } }
.close {
  position: absolute; top: -30px; right: 0;
  background: none; border: none; color: var(--dim); font-size: 18px; cursor: pointer;
}
.sheet-player video { width: 100%; background: #000; border: 1px solid var(--line); }
.sheet-meta { min-width: 0; }
.sheet-meta .tag {
  display: inline-block; padding: 3px 8px; margin-bottom: 10px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(232,255,67,.35);
}
.sheet-meta h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.evidence { color: var(--dim); font-size: 13px; margin: 12px 0; }
.source { display: inline-block; font-size: 12px; color: var(--accent); margin-bottom: 14px; }
.source:hover { text-decoration: underline; }
/* an explicit display value beats the [hidden] default, so restate it */
[hidden] { display: none !important; }

.recipe {
  margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line);
  max-height: 46vh; overflow-y: auto; font-size: 13px;
}
.recipe h1 { font-size: 15px; margin: 0 0 10px; }
.recipe h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 18px 0 6px; }
.recipe p, .recipe li { color: #c9c9cf; }
.recipe ol, .recipe ul { padding-left: 20px; margin: 6px 0; }
.recipe code {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  background: #1b1b1f; padding: 1px 4px;
}
.recipe pre {
  background: #08080a; border: 1px solid var(--line); padding: 10px;
  overflow-x: auto; font-size: 11.5px; line-height: 1.5;
}
.recipe pre code { background: none; padding: 0; }
.recipe em { color: var(--dim); }

/* a thumbnail that will not load should read as empty, not as a broken file */
.moment img.broken, .card img.broken { visibility: hidden; }

/* ---------- public gallery ---------- */
.gallery-wrap { max-width: 1080px; margin: 0 auto; padding: 34px 20px 70px; border-top: 1px solid var(--line); }
.gallery-head h2 { margin: 0 0 4px; font-size: 16px; }
.gallery-head p { margin: 0 0 18px; color: var(--dim); font-size: 13px; }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.gcard {
  padding: 0; cursor: pointer; text-align: left; overflow: hidden;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
}
.gcard:hover { border-color: var(--accent); }
.gcard img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; }
.gcard .placeholder {
  width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center;
  color: #3a3a42; font-family: ui-monospace, Menlo, monospace;
}
.gmeta { padding: 9px 10px 11px; display: grid; gap: 4px; }
.gmeta b {
  font-size: 12.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gchips { display: flex; flex-wrap: wrap; gap: 4px; }
.gchips i {
  font-style: normal; font-size: 10px; padding: 2px 5px; color: var(--dim);
  background: #1b1b1f; border: 1px solid var(--line);
}

/* ---------- page chrome for routed views ---------- */
.pagehead {
  max-width: 1080px; margin: 0 auto; padding: 18px 20px 0;
  display: flex; align-items: center; gap: 18px;
}
.back { font-size: 12px; color: var(--dim); border-bottom: 1px dashed #44444c; }
.back:hover { color: var(--accent); border-color: var(--accent); }
.pagehead .progress { flex: 1; margin-top: 0; }
#view-creator #creator-out { max-width: 1080px; margin: 0 auto; padding: 10px 20px 70px; }
a.tab { display: inline-block; text-decoration: none; }

/* ---------- library insights strip (VideoDB aggregate) ---------- */
.insights { max-width: 1080px; margin: 6px auto 0; padding: 12px 20px 4px; }
.ins-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.ins-head b { font-size: 13px; font-weight: 600; }
.ins-bars { display: grid; gap: 5px; }
.ins-row { display: grid; grid-template-columns: 108px 1fr 34px 108px; align-items: center; gap: 10px; }
.ins-label { font-size: 12px; color: var(--dim); }
.ins-bar { height: 6px; background: #1b1b1f; border: 1px solid var(--line); }
.ins-bar i { display: block; height: 100%; background: var(--accent); }
.ins-n { font-family: ui-monospace, Menlo, monospace; font-size: 11px; text-align: right; }
.ins-conf { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: #5c5c64; }
