:root {
  --ink: #0d0b09;
  --panel: #17140f;
  --panel-2: #1f1b15;
  --line: #2f2a22;
  --cream: #f4f0e8;
  --muted: #9d968a;
  --gold: #e0be7d;
  --red: #ec2830;
  --green: #6fbf8b;
  --amber: #e8b04b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.01em; }

.lede { margin: 0; max-width: 62ch; color: var(--muted); font-size: 14px; }
.lede strong { color: var(--cream); font-weight: 600; }
.lede em { font-style: normal; color: var(--gold); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 36px 28px 26px;
  border-bottom: 1px solid var(--line);
}

.header-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.button {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { border-color: var(--gold); }
.button-primary { background: var(--gold); border-color: var(--gold); color: #1a1206; }
.button-primary:hover { filter: brightness(1.08); }

.icon-button {
  background: none; border: 0; color: var(--muted);
  font-size: 30px; line-height: 1; cursor: pointer; padding: 0 6px;
}
.icon-button:hover { color: var(--cream); }

.save-state { margin: 0; font-size: 12px; color: var(--muted); min-height: 1.2em; flex-basis: 100%; }

main { padding: 24px 28px 72px; }

.summary {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px;
}
.summary div {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; min-width: 104px;
}
.summary span { display: block; font-size: 24px; font-weight: 700; }
.summary small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

.notice {
  margin: 0 0 20px; padding: 11px 14px;
  background: rgba(224, 190, 125, 0.08);
  border: 1px solid rgba(224, 190, 125, 0.3);
  border-radius: 8px; font-size: 13px; color: #d9cfb8;
}

.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center;
  margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.toolbar label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.toolbar select {
  display: block; margin-top: 4px; background: var(--panel-2); color: var(--cream);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font: inherit; font-size: 14px;
}

.set-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.set-tabs button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 15px; cursor: pointer;
}
.set-tabs button:hover { color: var(--cream); }
.set-tabs button.is-active { background: var(--gold); border-color: var(--gold); color: #1a1206; }

.board {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; text-align: left; padding: 0;
  color: inherit; font: inherit; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--gold); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* One tile height for both ratios so a mixed 9:16 + 4:5 grid stays on a baseline.
   The frame is letterboxed rather than cropped — a cropped thumbnail would hide
   exactly the top and bottom margins this board exists to judge. */
.card-media { position: relative; background: #000; line-height: 0; height: 300px; }
.card-media img { width: 100%; height: 100%; display: block; object-fit: contain; }
.card-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 34px; text-shadow: 0 2px 14px rgba(0,0,0,0.7);
}
.card-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(13,11,9,0.82); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
}
.card-duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(13,11,9,0.82); border-radius: 5px; padding: 2px 7px; font-size: 11px;
}

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-meta { margin: 0; font-size: 12px; color: var(--muted); }

.pill {
  align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; border-radius: 999px; padding: 3px 9px;
  border: 1px solid var(--line); color: var(--muted);
}
.pill-keep { color: var(--green); border-color: rgba(111,191,139,0.5); }
.pill-revise { color: var(--amber); border-color: rgba(232,176,75,0.5); }
.pill-reject { color: var(--red); border-color: rgba(236,40,48,0.5); }

/* ---------- viewer ---------- */

.viewer {
  border: 0; padding: 0; background: transparent;
  width: min(1360px, 96vw); max-width: 96vw; max-height: 94vh; color: var(--cream);
}
.viewer::backdrop { background: rgba(4,3,2,0.88); }

.viewer-shell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  max-height: 94vh; display: flex; flex-direction: column; overflow: hidden;
}

.viewer-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.viewer-header h2 { margin: 0; font-size: 19px; }

.viewer-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 372px;
  gap: 0; overflow: hidden; min-height: 0;
}

.video-column {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 22px 22px; min-width: 0; overflow: auto;
}

.video-stage {
  background: #000; border: 1px solid var(--line); border-radius: 10px;
  display: grid; place-items: center; padding: 16px; overflow: auto; min-height: 340px;
}

.video-frame { position: relative; line-height: 0; }
.video-frame video { display: block; width: 100%; height: 100%; background: #000; }

/* Meta placement-safe overlay. Percentages are set per-master from the render's
   own metrics, so the bands mark exactly the boundary the render targeted. */
.safe-overlay { position: absolute; inset: 0; pointer-events: none; }
.safe-band { position: absolute; background: rgba(236, 40, 48, 0.24); }
.safe-band span {
  position: absolute; left: 8px; font-size: 10px; line-height: 1.4; letter-spacing: 0.06em;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.9); font-weight: 700; white-space: nowrap;
}
.safe-band-top { top: 0; left: 0; right: 0; }
.safe-band-top span { bottom: 3px; }
.safe-band-bottom { bottom: 0; left: 0; right: 0; }
.safe-band-bottom span { top: 3px; }
.safe-band-left { top: 0; bottom: 0; left: 0; }
.safe-band-right { top: 0; bottom: 0; right: 0; }
.safe-core { position: absolute; border: 1px dashed rgba(255, 248, 238, 0.85); }

.view-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button {
  background: var(--panel-2); border: 0; border-right: 1px solid var(--line);
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 13px; cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button.is-active { background: var(--gold); color: #1a1206; }

.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--red); width: 16px; height: 16px; }

.viewer-nav { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }

.inspector {
  border-left: 1px solid var(--line); background: var(--panel-2);
  padding: 18px 20px 26px; overflow: auto; display: flex; flex-direction: column; gap: 18px;
}

.spec-heading {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin-bottom: 10px;
}
.spec-heading strong { font-size: 15px; color: var(--gold); letter-spacing: 0; }

.specs { margin: 0; display: grid; gap: 7px; }
.specs div { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; }
.specs dt { color: var(--muted); margin: 0; }
.specs dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.copy-block p { margin: 0 0 12px; display: grid; gap: 3px; }
.copy-block span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.copy-block strong { font-weight: 500; font-size: 13px; line-height: 1.5; }

.beats summary, .history summary {
  cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.beats ol, .history ol { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; }
.beats b { color: var(--gold); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.review-form h3 { margin: 0 0 10px; font-size: 14px; }
.decision-group { display: flex; gap: 8px; margin-bottom: 12px; }
.decision-group button {
  flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 9px 0; cursor: pointer;
}
.decision-group button:hover { color: var(--cream); }
.decision-group button.is-active[data-decision="keep"] { background: var(--green); border-color: var(--green); color: #06210f; }
.decision-group button.is-active[data-decision="revise"] { background: var(--amber); border-color: var(--amber); color: #2a1c02; }
.decision-group button.is-active[data-decision="reject"] { background: var(--red); border-color: var(--red); color: #fff; }

.review-form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.review-form textarea {
  width: 100%; background: var(--panel); color: var(--cream); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; font: inherit; font-size: 13px; resize: vertical; margin-bottom: 10px;
}
.review-form textarea:focus { outline: 1px solid var(--gold); border-color: var(--gold); }

.history li { color: var(--muted); }
.history b { color: var(--cream); }

@media (max-width: 1000px) {
  .viewer { width: 100vw; max-width: 100vw; max-height: 100vh; }
  .viewer-shell { border-radius: 0; border: 0; max-height: 100vh; height: 100vh; }
  .viewer-layout { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .video-column { overflow: visible; }
  .video-stage { min-height: 0; padding: 10px; }
}

@media (max-width: 640px) {
  .site-header { padding: 24px 16px 20px; }
  main { padding: 18px 16px 56px; }
  .board { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
  .card-media { height: 210px; }
  h1 { font-size: 21px; }
  .viewer-header { padding: 14px 16px; }
  .video-column { padding: 14px 16px 18px; }
  .inspector { padding: 16px; }
}
