:root {
  --ink: #eef2e8;
  --muted: #96a198;
  --faint: #66716a;
  --paper: #0c110f;
  --panel: #121916;
  --panel-2: #17201c;
  --line: #2a352f;
  --line-bright: #3d4b43;
  --acid: #b6f36b;
  --acid-deep: #7cab45;
  --good: #74e39b;
  --bad: #ff6b6b;
  --neutral: #718078;
  --accent: var(--acid);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% -15%, rgba(182, 243, 107, .11), transparent 34rem),
    radial-gradient(circle at -10% 40%, rgba(75, 117, 94, .12), transparent 32rem),
    var(--paper);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--acid); text-decoration: none; }
a:hover { text-decoration: underline; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  z-index: 10;
}

.masthead {
  height: 66px;
  padding: 0 clamp(18px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(105, 123, 113, .28);
  background: rgba(12, 17, 15, .82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 8;
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  height: 34px;
  min-width: 50px;
  padding: 0 10px;
  border: 1px solid var(--acid-deep);
  border-radius: 7px;
  color: var(--acid);
  font-weight: 800;
  letter-spacing: .13em;
  font-size: .78rem;
}
.brand-divider { width: 1px; height: 20px; background: var(--line-bright); }
.brand-name { color: #cbd3cd; font-size: .9rem; letter-spacing: .02em; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 14px rgba(182,243,107,.8); }

main { width: min(1540px, calc(100% - clamp(28px, 6vw, 96px))); margin: 0 auto; padding: 64px 0 90px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(420px, .85fr); gap: 48px; align-items: end; }
.eyebrow, .section-label {
  margin: 0 0 12px;
  color: var(--acid);
  font-size: .71rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .16em;
}
h1 { margin: 0; max-width: 920px; font-size: clamp(2.35rem, 5.3vw, 5.4rem); line-height: .96; letter-spacing: -.055em; font-weight: 680; }
.subtitle { margin: 23px 0 0; max-width: 760px; color: var(--muted); font-size: clamp(1rem, 1.25vw, 1.18rem); line-height: 1.65; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.summary-item { min-height: 92px; padding: 17px 19px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(18,25,22,.58); }
.summary-item span { color: var(--faint); font-size: .66rem; text-transform: uppercase; letter-spacing: .13em; }
.summary-item strong { display: block; margin-top: 9px; font-size: 1.55rem; font-weight: 620; letter-spacing: -.03em; }
.summary-item small { color: var(--muted); font-size: .75rem; }

.study-contract { margin: 42px 0 54px; min-height: 54px; display: flex; align-items: center; gap: 15px; padding: 13px 18px; border: 1px solid rgba(182,243,107,.25); background: rgba(182,243,107,.045); border-radius: 11px; }
.study-contract p { margin: 0; flex: 1; color: #c4cec6; font-size: .86rem; }
.study-contract a { font-size: .77rem; white-space: nowrap; }
.contract-icon { color: var(--acid); font-size: 1.25rem; }

.variant-header { display: flex; justify-content: space-between; gap: 25px; align-items: end; border-bottom: 1px solid var(--line); }
.variant-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.variant-tab { position: relative; border: 0; border-radius: 8px 8px 0 0; background: transparent; padding: 12px 15px 14px; color: var(--muted); cursor: pointer; text-align: left; transition: color .16s, background .16s; }
.variant-tab:hover { color: var(--ink); background: rgba(255,255,255,.025); }
.variant-tab.active { color: var(--ink); background: var(--panel); }
.variant-tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent); }
.variant-tab b { display: block; font-size: .84rem; font-weight: 620; }
.variant-tab span { display: block; margin-top: 3px; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.view-controls { display: flex; gap: 6px; padding-bottom: 8px; }
.icon-button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 11px; cursor: pointer; color: var(--muted); font-size: .78rem; }
.icon-button:hover, .icon-button.active { color: var(--ink); border-color: var(--line-bright); background: var(--panel-2); }
.variant-note { margin: 18px 0 24px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(18,25,22,.7); }
.variant-note .badge { padding: 5px 8px; border-radius: 5px; color: #0d130f; background: var(--accent); font-size: .64rem; font-weight: 800; letter-spacing: .09em; }
.variant-note p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.variant-note strong { color: var(--ink); font-weight: 600; }
.variant-note .input { color: var(--faint); font-size: .72rem; text-align: right; }

.world-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.world-card { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden; transition: transform .16s, border-color .16s; }
.world-card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.video-shell { position: relative; background: #030504; aspect-ratio: 16 / 9; overflow: hidden; }
.video-shell video { width: 100%; height: 100%; display: block; object-fit: contain; background: #030504; }
.separate-media-stage { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 9px 9px 31px; background: #050806; }
.media-panel { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #030504; }
.media-panel figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; color: var(--muted); background: #101612; font-size: .61rem; text-transform: uppercase; letter-spacing: .07em; }
.media-panel figcaption b { color: var(--accent); font-size: .56rem; letter-spacing: .12em; white-space: nowrap; }
.media-panel video { width: 100%; height: 100%; display: block; object-fit: contain; background: #030504; }
.separate-input-note { position: absolute; right: 11px; bottom: 9px; color: var(--faint); font-size: .58rem; text-transform: uppercase; letter-spacing: .09em; }
.world-index { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 6px 8px; border-radius: 5px; background: rgba(6,9,7,.78); backdrop-filter: blur(8px); font-size: .67rem; font-weight: 700; letter-spacing: .08em; }
.separate-media-stage > .world-index { top: auto; bottom: 7px; left: 10px; }
.world-body { padding: 14px 15px 15px; }
.world-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.world-line h3 { margin: 0; font-size: .91rem; font-weight: 610; }
.world-line button { border: 0; background: transparent; color: var(--acid); cursor: pointer; font-size: .74rem; }
.meta-line { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.outcome { color: var(--ink); }

.timeline-wrap { margin-top: 13px; }
.timeline-label { display: flex; justify-content: space-between; color: var(--faint); font-size: .61rem; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 6px; }
.timeline { position: relative; min-height: 15px; background: #090d0b; border: 1px solid #263029; border-radius: 4px; overflow: hidden; }
.timeline.empty::after { content: "Awaiting labels"; position: absolute; inset: 0; display: grid; place-items: center; color: #59635d; font-size: .55rem; letter-spacing: .12em; text-transform: uppercase; }
.interval { position: absolute; height: 8px; border-radius: 2px; cursor: pointer; opacity: .94; }
.interval.good { background: var(--good); }
.interval.bad { background: var(--bad); }
.interval.neutral { background: var(--neutral); }
.playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: white; box-shadow: 0 0 4px rgba(255,255,255,.8); transform: translateX(-.5px); pointer-events: none; }

.review-panel { margin: 15px -15px -15px; padding: 0; border: 0; border-top: 1px solid var(--line); background: #0e1411; }
.review-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; color: var(--ink); list-style: none; cursor: pointer; }
.review-panel > summary::-webkit-details-marker { display: none; }
.review-panel > summary::after { content: "+"; color: var(--accent); font-size: 1rem; line-height: 1; }
.review-panel[open] > summary::after { content: "−"; }
.review-panel > summary > span:first-child { display: flex; align-items: baseline; gap: 9px; }
.review-panel > summary strong { font-size: .76rem; font-weight: 650; }
.review-panel > summary small { color: var(--faint); font-size: .62rem; }
.review-summary { margin-left: auto; color: var(--muted); font-size: .65rem; text-align: right; }
.review-list { display: grid; gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.review-form { display: grid; gap: 9px; padding: 13px 15px 14px; background: #101713; }
.reviewer-line { display: flex; align-items: center; gap: 8px; }
.reviewer-line strong { font-size: .74rem; font-weight: 650; }
.reviewer-avatar { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--line)); border-radius: 50%; color: var(--accent); font-size: .63rem; font-weight: 800; }
.rating-field { display: flex; align-items: center; gap: 7px; margin-left: auto; color: var(--faint); font-size: .61rem; }
.rating-field select { min-width: 88px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel-2); font-size: .67rem; }
.review-form textarea { width: 100%; min-height: 65px; resize: vertical; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; color: var(--ink); background: #090e0b; font-size: .72rem; line-height: 1.45; }
.review-form textarea:focus, .rating-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent); }
.review-form textarea::placeholder { color: #59645d; }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.save-state { overflow: hidden; color: var(--faint); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.review-actions button { flex: 0 0 auto; padding: 6px 11px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 6px; color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); cursor: pointer; font-size: .67rem; font-weight: 650; }
.review-actions button:hover { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); }
.review-actions button:disabled { cursor: wait; opacity: .55; }

.focus-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, .68fr); gap: 20px; }
.focus-media, .inspector { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.focus-media .video-shell { aspect-ratio: 16 / 9; }
.focus-caption { padding: 16px 18px 18px; }
.focus-caption .review-panel { margin: 18px -18px -18px; }
.focus-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.world-button { min-width: 42px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 8px; color: var(--muted); cursor: pointer; font-size: .72rem; }
.world-button:hover, .world-button.active { color: #0d130f; background: var(--accent); border-color: var(--accent); }
.inspector { padding: 19px; max-height: calc(100vh - 160px); overflow: auto; }
.inspector h2 { margin: 0; font-size: 1.1rem; font-weight: 620; }
.inspector .lede { margin: 8px 0 20px; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.empty-state { padding: 18px; border: 1px dashed var(--line-bright); border-radius: 9px; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.legend { display: flex; gap: 14px; margin: 14px 0; color: var(--muted); font-size: .67rem; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.interval-list { display: grid; gap: 8px; }
.interval-card { width: 100%; border: 1px solid var(--line); border-left: 3px solid var(--neutral); background: #0f1512; border-radius: 7px; padding: 10px 11px; color: var(--muted); text-align: left; cursor: pointer; }
.interval-card.good { border-left-color: var(--good); }
.interval-card.bad { border-left-color: var(--bad); }
.interval-card strong { display: block; color: var(--ink); font-size: .76rem; margin-bottom: 4px; }
.interval-card span { font-size: .7rem; line-height: 1.4; }
details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
summary { cursor: pointer; color: #cbd5ce; font-size: .78rem; }
pre { white-space: pre-wrap; word-break: break-word; color: #9fac9f; font: .68rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.error { border: 1px solid rgba(255,107,107,.4); color: #ffb1b1; background: rgba(255,107,107,.06); border-radius: 10px; padding: 20px; }
.loading-card { display: flex; gap: 8px; padding: 50px; justify-content: center; }
.loading-card span { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); animation: bounce 1s infinite alternate; }
.loading-card span:nth-child(2) { animation-delay: .15s; }
.loading-card span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { transform: translateY(-9px); opacity: .4; } }

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  .focus-layout { grid-template-columns: 1fr; }
  .inspector { max-height: none; }
}

@media (max-width: 760px) {
  main { width: min(100% - 28px, 1540px); padding-top: 38px; }
  .brand-divider, .brand-name, .status-pill { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .study-contract { align-items: flex-start; flex-wrap: wrap; }
  .study-contract a { margin-left: 30px; }
  .variant-header { align-items: stretch; flex-direction: column; }
  .view-controls { align-self: flex-end; }
  .world-grid { grid-template-columns: 1fr; }
  .separate-media-stage { grid-template-columns: 1fr; padding-bottom: 48px; }
  .separate-input-note { left: 11px; right: 11px; bottom: 25px; }
  .variant-note { grid-template-columns: auto 1fr; }
  .variant-note .input { grid-column: 2; text-align: left; }
  .icon-button span { display: none; }
}
