/* POC A — video view: frames -> find -> decode -> vote */

/* only one pane visible at a time */
.demo-pane { display: none; }
.demo-pane.is-active { display: block; }

/* view switcher in the top bar */
.view-tabs { display: flex; gap: 6px; margin-left: 18px; }
/* These read as plain grey text before — every tab now carries a border and
   full-strength ink so it is obviously a control, and the selected one is
   filled and green-edged so the difference is unmistakable. */
.view-tab {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; white-space: nowrap;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  background: var(--bg, #fff); color: var(--ink, #222);
  border: 1px solid var(--border, #d5d5d5); transition: all 0.15s ease;
}
.view-tab:hover { border-color: #3ecb84; transform: translateY(-1px); }
.view-tab:focus-visible { outline: 2px solid #3ecb84; outline-offset: 2px; }
.view-tab.is-on {
  color: #1d7a4c;
  border-color: #3ecb84;
  background: rgba(62, 203, 132, 0.12);
  box-shadow: 0 0 0 1px #3ecb84 inset;
}

/* The top bar is one flex row of logo | tabs | status. Adding the tabs pushed
   it past the viewport on narrow screens, so let it wrap and drop the tabs onto
   their own line rather than overflowing the page sideways. */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .view-tabs { margin-left: 0; order: 3; width: 100%; }
}

/* frame stage — the box overlay sits exactly on the frame */
.vid-stage { position: relative; display: inline-block; line-height: 0; }
/* One canvas draws the frame (blitted out of the segment's sprite sheet) and
   the box on top of it. The factory clip is portrait 2160x4096, so cap the
   height or a tall frame pushes the rest of the page off screen. */
.vid-stage canvas {
  max-width: 100%; max-height: 460px; width: auto; height: auto;
  border-radius: 8px; display: block; background: var(--field, #f1f1f1);
}
.vid-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: "JetBrains Mono", monospace; font-size: 0.72rem;
  color: var(--ink-faint, #8a8a8a); background: var(--field, #f1f1f1);
  border-radius: 8px;
}
.vid-loading[hidden] { display: none; }

/* clip picker */
.clip-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.clip-chip {
  font-family: "JetBrains Mono", monospace; font-size: 0.64rem;
  letter-spacing: 0.03em; padding: 6px 11px; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--ink-faint, #8a8a8a);
  border: 1px solid var(--border, #ddd); transition: all 0.15s ease;
}
.clip-chip:hover { color: var(--ink, #222); border-color: #3ecb84; }
.clip-chip.is-on { color: var(--ink, #222); background: var(--field, #f4f4f4); border-color: #3ecb84; }

/* transport */
.vid-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.vid-btn {
  width: 38px; height: 38px; flex: none; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border, #ddd); background: var(--field, #f4f4f4);
  color: var(--ink, #222); display: grid; place-items: center;
}
.vid-btn:hover { border-color: #3ecb84; }
.vid-scrub { flex: 1; accent-color: #3ecb84; }
.vid-frame-label {
  font-family: "JetBrains Mono", monospace; font-size: 0.72rem;
  opacity: 0.75; white-space: nowrap; min-width: 128px; text-align: right;
}

/* which piece of the montage is on screen */
.seg-title {
  margin-top: 14px; font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink, #222); opacity: 0.9;
}

/* per-frame verdict strip under the player */
.frame-verdict {
  margin-top: 10px; font-family: "JetBrains Mono", monospace; font-size: 0.78rem;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border, #ddd);
  display: flex; align-items: center; gap: 10px; min-height: 38px;
}
.frame-verdict .fv-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #b9b9b9; }
.frame-verdict.ok { border-color: rgba(62,203,132,0.45); background: rgba(62,203,132,0.08); }
.frame-verdict.ok .fv-dot { background: #3ecb84; }
.frame-verdict.bad { border-color: rgba(224,162,60,0.5); background: rgba(224,162,60,0.1); }
.frame-verdict.bad .fv-dot { background: #e0a23c; }
.frame-verdict .fv-note { opacity: 0.75; font-size: 0.7rem; }

/* timeline of reads across the clip */
.readline { display: flex; gap: 2px; margin-top: 12px; height: 26px; align-items: flex-end; }
.readline i {
  flex: 1; background: var(--border, #e3e3e3); border-radius: 2px;
  height: 8px; cursor: pointer; font-style: normal; transition: height 0.12s ease;
}
.readline i.hit { background: #3ecb84; height: 20px; }
.readline i.miss-vote { background: #e0a23c; height: 26px; }
.readline i.cur { outline: 2px solid var(--ink, #333); outline-offset: 1px; }
/* where one clip's segment ends and the next begins */
.readline i.brk { margin-left: 8px; box-shadow: -4px 0 0 0 var(--border, #ccc); }

/* vote table */
.vote-table { width: 100%; border-collapse: collapse; font-family: "JetBrains Mono", monospace; font-size: 0.78rem; }
.vote-table th.num { text-align: right; padding-right: 16px; }
.vote-table th {
  text-align: left; font-weight: 500; font-size: 0.64rem; text-transform: uppercase;
  letter-spacing: 0.06em; opacity: 0.55; padding-bottom: 8px;
}
.vote-table td { padding: 7px 0; border-top: 1px solid var(--border, #eee); }
.vote-table td.num { text-align: right; padding-right: 16px; white-space: nowrap; }
.vote-table tr.grp td {
  padding-top: 16px; font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.06em; opacity: 0.55; border-top: none;
}
/* the segment the reel is currently playing */
.vote-table tr.on td { background: rgba(62,203,132,0.09); }
.vote-table tr.grp.on td { opacity: 0.95; }
.vote-table tr.win td { color: #2e9e63; }
.vote-table tr.lose td { color: #b8791f; text-decoration: line-through; text-decoration-thickness: 1px; }
.vote-table tr.lose td.why { text-decoration: none; opacity: 0.8; }

.agreement {
  margin-top: 14px; font-family: "JetBrains Mono", monospace; font-size: 0.72rem;
  display: flex; align-items: center; gap: 10px;
}
.agreement .bar { flex: 1; height: 6px; background: var(--border, #e3e3e3); border-radius: 4px; overflow: hidden; }
.agreement .bar span { display: block; height: 100%; background: #3ecb84; }

.why-note {
  margin-top: 12px; font-size: 0.78rem; line-height: 1.6; opacity: 0.8;
}
.why-note b { font-family: "JetBrains Mono", monospace; font-size: 0.74rem; }

.src-credit { font-size: 0.7rem; opacity: 0.6; margin-top: 10px; }
.src-credit a { color: inherit; }

.viewonly-tag {
  display: inline-block; font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; margin-left: 8px; vertical-align: middle;
  background: rgba(110,110,240,0.13); color: #5a5ad0; border: 1px solid rgba(110,110,240,0.35);
}

/* A QR payload is a URL, not a 13-digit number. At 1.7rem monospace it is one
   unbreakable 487px word, which forced the whole column wider than the
   viewport — so let long values wrap and set them smaller. */
.tin-display .val-ok {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.tin-display .val-ok.is-long {
  font-size: 1.05rem;
  line-height: 1.35;
}

/* ── fitting the whole reel above the fold ──────────────────────────────────
   The decoded value is what the viewer is here for, so it sits in the hero.
   The rest of this block buys back the vertical space that made them scroll. */
.demo-pane[data-view="video"] .hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  margin-bottom: 10px;
}
.demo-pane[data-view="video"] .hero .lede { margin-bottom: 14px; }
.demo-pane[data-view="video"] .clip-chips { margin-top: 10px; }
.demo-pane[data-view="video"] .vid-controls { margin-top: 12px; }
.demo-pane[data-view="video"] .seg-title { margin-top: 12px; }
.demo-pane[data-view="video"] .readline { margin-top: 10px; }
.demo-pane[data-view="video"] .hint { margin-top: 8px; }

.hero-result {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid #3ecb84;
  border-radius: 10px;
  background: rgba(62, 203, 132, 0.07);
}
.hero-result .tin-display { margin: 0; }
.hero-result .agreement { margin-top: 10px; }
.hero-result .val-ok {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  line-height: 1.1;
}
