/*
 * AFCBANKS AI Football Lab.
 *
 * The Lab uses the shared AFCBANKS black, deep-navy and yellow design language.
 */
:root {
  --paper: #101b2b;
  --bone: #080f1b;
  --ink: #f4f7fb;
  --mut: #a9b8ca;
  --line: #2b3e58;
  --orange: #ffd21f;
  --coral: #ffe36a;
  --ok: #1d9a6c;
  --warn: #b8860b;
  --bad: #c8322b;
  --shadow: 0 1px 2px #0005, 0 8px 24px #0005;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.12; margin: 0; letter-spacing: -0.02em; }

/* ------------------------------------------------------------------- chrome */

.labnav {
  position: sticky; top: 0; z-index: 30;
  background: #101b2bf2; backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.labnav-in {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 18px; max-width: 1560px; margin: auto;
}
.labnav .logo { font-weight: 950; letter-spacing: 0.07em; display: flex; align-items: center; gap: 10px; }
.labnav .logo .onair-mark { width: 44px; height: auto; flex: none; }
.labnav .logo span { display: flex; flex-direction: column; line-height: 1.05; }
.labnav .logo b {
  background: linear-gradient(95deg, var(--orange), var(--coral));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.labnav nav { display: flex; gap: 14px; margin-left: auto; font-size: 0.88rem; font-weight: 650; }
.labnav nav a { color: var(--mut); padding: 4px 0; border-bottom: 2px solid transparent; }
.labnav nav a:hover { color: var(--ink); }
.labnav nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }

.eyebrow {
  font-size: 0.7rem; font-weight: 850; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--coral);
}

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  border-radius: 99px; padding: 3px 9px; border: 1px solid var(--line);
  background: var(--paper); color: var(--mut); white-space: nowrap;
}
.badge.sim { border-color: #e2b23c; background: #fdf6e3; color: #8a6400; }
.badge.live { border-color: #9fd9c0; background: #eefaf4; color: var(--ok); }
.badge.premium { border-color: #ffc3bf; background: #fff2f1; color: var(--coral); }
.badge.free { border-color: #cfe6da; background: #f2faf6; color: var(--ok); }
.badge.private { border-color: var(--line); background: var(--bone); }
.badge.state { border-color: #ffd2bd; background: #fff4ee; color: #a5460f; }
.badge.done { border-color: #9fd9c0; background: #eefaf4; color: var(--ok); }
.badge.failed { border-color: #f3b9b6; background: #fdf1f0; color: var(--bad); }

/* A simulated-output notice, used wherever mock data is displayed. */
.simbar {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fdf6e3; border: 1px solid #ecd8a3; border-left: 4px solid #e2b23c;
  border-radius: 10px; padding: 11px 14px; font-size: 0.86rem; color: #6b5200;
}
.simbar b { display: block; }

/* ------------------------------------------------------------------ buttons */

.btn {
  font: inherit; font-weight: 700; font-size: 0.86rem;
  border-radius: 9px; padding: 8px 13px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.btn:hover:not(:disabled) { border-color: #d4ccc3; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(95deg, var(--orange), var(--coral));
  border-color: transparent; color: #fff;
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #f3b9b6; }
.btn.sm { font-size: 0.78rem; padding: 5px 9px; }

input, select, textarea {
  font: inherit; font-size: 0.88rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f36f2155; outline-offset: 1px; }
label { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--mut); margin: 0 0 4px; }
.field { margin: 0 0 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}
.muted { color: var(--mut); }
.small { font-size: 0.82rem; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* --------------------------------------------------------------- workspace */

.shell { max-width: 1560px; margin: auto; padding: 14px; }

/* Left navigation, centre stage, right tools, timeline underneath. */
.workspace {
  display: grid; gap: 12px;
  grid-template-columns: 236px minmax(0, 1fr) 320px;
  grid-template-areas: "left stage right" "left timeline right";
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: start;
}
.wleft { grid-area: left; }
.wstage { grid-area: stage; min-width: 0; }
.wright { grid-area: right; }
.wtimeline { grid-area: timeline; min-width: 0; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 12px; }
.phead {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 0.72rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mut);
}
.pbody { padding: 12px; }
.pbody.tight { padding: 8px; }
.scroll { max-height: 320px; overflow: auto; }

.navlist { list-style: none; margin: 0; padding: 6px; }
.navlist button {
  display: flex; width: 100%; align-items: center; gap: 8px; justify-content: space-between;
  font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: 9px; padding: 8px 10px; color: var(--ink);
}
.navlist button:hover { background: var(--bone); }
.navlist button[aria-selected="true"] { background: #fff1ea; color: #a5460f; font-weight: 750; }
.navlist .count { font-size: 0.74rem; color: var(--mut); }
.dot { width: 9px; height: 9px; border-radius: 99px; flex: none; }

/* ------------------------------------------------------------------- stage */

.stagebar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.seg { display: inline-flex; background: var(--bone); border-radius: 9px; padding: 2px; }
.seg button {
  font: inherit; font-size: 0.78rem; font-weight: 750; border: 0; background: transparent;
  color: var(--mut); border-radius: 7px; padding: 5px 11px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

.views { display: grid; gap: 10px; padding: 10px; }
.views.split { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .views.split { grid-template-columns: 1fr; } }

/* The canvas sits exactly over the video so annotation coordinates are one space. */
/* The wrap takes the video's own aspect ratio (set from its metadata), so the
   picture fills it exactly and the canvas covers the picture, not letterbox bars. */
.videowrap {
  position: relative; background: #0c0b0a; border-radius: 11px; overflow: hidden;
  aspect-ratio: var(--video-ar, 16 / 9); width: min(100%, calc(72vh * var(--video-arn, 1.7778)));
  margin-inline: auto;
}
.videowrap video { display: block; width: 100%; height: 100%; object-fit: fill; background: #0c0b0a; }
.videowrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.videowrap .empty {
  aspect-ratio: 16 / 9; display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center; color: #d8d2cc; text-align: center; padding: 20px;
}
.boardwrap { position: relative; background: #2f7d4f; border-radius: 11px; overflow: hidden; }
.boardwrap canvas { display: block; width: 100%; aspect-ratio: 105 / 68; touch-action: none; }

.controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px; border-top: 1px solid var(--line);
}
.controls .clock { font-size: 0.82rem; color: var(--mut); min-width: 96px; }
.scrub { flex: 1 1 180px; }
input[type="range"] { accent-color: var(--orange); padding: 0; }

/* ---------------------------------------------------------------- timeline */

.tl { padding: 10px 12px 14px; }
.tlbar {
  position: relative; height: 46px; background: var(--bone);
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden; cursor: pointer;
}
.tlclip {
  position: absolute; top: 6px; height: 34px; border-radius: 5px; min-width: 3px;
  border: 1px solid #ffffff80; opacity: 0.85;
}
.tlclip:hover { opacity: 1; }
.tlhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.tlticks { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--mut); margin-top: 4px; }

.eventrow {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: 9px; font-size: 0.85rem;
}
.eventrow:hover { background: var(--bone); }
.eventrow .grow { flex: 1; min-width: 0; }
.eventrow .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------- tools */

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; font: inherit; font-size: 0.74rem; font-weight: 850; letter-spacing: 0.06em;
  text-transform: uppercase; background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--mut); padding: 11px 4px; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); }

.toolgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.toolgrid button {
  font: inherit; font-size: 0.7rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); border-radius: 9px;
  padding: 9px 4px; color: var(--ink); line-height: 1.2;
}
.toolgrid button[aria-pressed="true"] { border-color: var(--orange); background: #fff1ea; color: #a5460f; }

.playerrow {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  font: inherit; font-size: 0.85rem; cursor: pointer;
  background: transparent; border: 0; border-radius: 9px; padding: 7px 8px; color: var(--ink);
}
.playerrow:hover { background: var(--bone); }
.playerrow[aria-selected="true"] { background: #fff1ea; }
.playerrow .who { flex: 1; min-width: 0; }
.playerrow .who b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playerrow .who span { display: block; font-size: 0.74rem; color: var(--mut); }
.conf { font-size: 0.72rem; color: var(--mut); font-variant-numeric: tabular-nums; }

/* The AI processing rows: label, bar, value. */
.stagerow { display: grid; grid-template-columns: 1fr 78px 44px; gap: 8px; align-items: center; font-size: 0.82rem; padding: 3px 0; }
.bar { height: 6px; border-radius: 99px; background: var(--bone); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(95deg, var(--orange), var(--coral)); }
.stagerow .val { text-align: right; font-size: 0.76rem; color: var(--mut); font-variant-numeric: tabular-nums; }
.stagerow .val.done { color: var(--ok); font-weight: 800; }

.metrics { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 0.83rem; }
.metrics dt { color: var(--mut); }
.metrics dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; }

/* ------------------------------------------------------------------ queue */

.qitem { display: flex; gap: 10px; padding: 9px; border-top: 1px solid var(--line); }
.qitem:first-child { border-top: 0; }
.qthumb { width: 62px; height: 46px; border-radius: 7px; object-fit: cover; background: var(--bone); flex: none; }
.qmeta { flex: 1; min-width: 0; font-size: 0.8rem; }
.qmeta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qstatus { font-size: 0.74rem; color: var(--mut); }
.qstatus.bad { color: var(--bad); }
.qstatus.good { color: var(--ok); }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.tile b { display: block; font-size: 1.7rem; font-weight: 900; letter-spacing: -0.03em; }
.tile span { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--mut); }

.notice { padding: 12px 14px; border-radius: 11px; font-size: 0.87rem; border: 1px solid var(--line); background: var(--paper); }
.notice.bad { border-color: #f3b9b6; background: #fdf1f0; color: #8d211c; }
.notice.warn { border-color: #f0d28a; background: #fdf8ea; color: #7a5300; }
.notice.good { border-color: #9fd9c0; background: #eefaf4; color: #14684a; }

/* ------------------------------------------------------------------ public */

.hero { max-width: 1100px; margin: auto; padding: 46px 20px 10px; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); letter-spacing: -0.045em; margin: 10px 0; }
.hero p { color: var(--mut); max-width: 640px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.acard { overflow: hidden; display: flex; flex-direction: column; }
.acard .shot { aspect-ratio: 16 / 9; background: #0c0b0a; display: block; width: 100%; object-fit: cover; }
.acard .lock {
  aspect-ratio: 16 / 9; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; text-align: center; padding: 16px;
  background: linear-gradient(140deg, #fff4ee, #fff1ea); color: #a5460f;
}
.acard .in { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.acard h3 { font-size: 1.02rem; }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "timeline" "right" "left";
  }
}
@media (max-width: 700px) {
  .shell { padding: 8px; }
  .labnav-in { padding: 10px 12px; gap: 10px; }
  .labnav nav { gap: 10px; font-size: 0.8rem; }

  /* Video first: the stage stays put and the tool panels become a bottom sheet. */
  .wright {
    position: sticky; bottom: 0; z-index: 20;
    background: var(--paper); border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0; box-shadow: 0 -8px 24px #16130f14;
  }
  .wright .scroll { max-height: 42vh; }
  .toolgrid { grid-template-columns: repeat(4, 1fr); }
  /* The event list scrolls sideways under the video on a phone. */
  .tlscroll { overflow-x: auto; }
  .tlbar { min-width: 620px; }
  .btn { padding: 9px 13px; }
  .playerrow, .navlist button, .eventrow { padding-top: 10px; padding-bottom: 10px; }
}

/* Events search, replay and presentation. */
.eventrow.playing { outline: 2px solid var(--accent, #f36f21); border-radius: 8px; }
.present {
  position: fixed; inset: 0; z-index: 80; background: #0c0b0aef; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 18px; color: #fff;
}
/* In a presentation the moved video wrap sizes to the screen, keeping the file's shape. */
.present .videowrap { width: min(96vw, calc(74vh * var(--video-arn, 1.7778))); }
.present .bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.present .title { font-weight: 800; font-size: 1.1rem; text-align: center; }
.present .muted { color: #cfc6bd; }


/* Events Vector and Top Events Library — retain the Lab's original light theme. */
.lab-vector{margin:0 0 12px;padding:12px;background:var(--paper);border:1px solid var(--line);border-radius:12px;color:var(--ink);box-shadow:var(--shadow)}
.lab-vector-head,.lab-events-head,.lab-vector-foot{display:flex;align-items:center;justify-content:space-between;gap:8px}
.lab-vector-head b,.lab-events-head b{font-size:.78rem;font-weight:800;letter-spacing:.04em}
.lab-vector-head span,.lab-vector-foot{font-size:.68rem;color:var(--mut)}
.lab-pitch{display:block;width:100%;height:auto;max-height:190px;margin:9px 0 6px;border-radius:7px;background:#e8f0e8;border:1px solid #d7e2d7}
.lab-vector-foot{margin-bottom:10px}
.lab-events-head{padding-top:9px;border-top:1px solid var(--line)}
.lab-event-mini{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 8px;margin-top:5px;border:1px solid var(--line);border-radius:7px;background:var(--bone);color:var(--ink);text-align:left;font:inherit;cursor:pointer}
.lab-event-mini:hover{border-color:var(--orange);background:#fff1e9}
.lab-event-mini span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.72rem}
.lab-event-mini time{flex:none;color:#b84d12;font-size:.68rem;font-variant-numeric:tabular-nums}

/* Customer-facing AI Lab plan introduction (v2.9). */
.lab-plans{max-width:1180px;margin:0 auto 34px;padding:0 24px;display:grid;grid-template-columns:1.15fr .85fr;gap:18px}
.lab-plan{border:1px solid var(--line);border-radius:20px;background:linear-gradient(145deg,#111d2e,#0b1422);padding:26px;box-shadow:0 18px 50px #0003}
.lab-plan h2,.lab-plan h3{margin:7px 0 10px;color:var(--text)}
.lab-plan p{color:var(--mut);line-height:1.65}
.lab-plan .price{font-size:clamp(2.2rem,5vw,3.5rem);font-weight:850;letter-spacing:-.05em;color:#fff}
.lab-plan .price small{font-size:.95rem;font-weight:600;color:var(--mut);letter-spacing:0}
.lab-plan .plan-tag{display:inline-flex;border:1px solid #e8c54766;background:#e8c54716;color:#f4d75e;border-radius:999px;padding:6px 11px;font-size:.72rem;font-weight:800;letter-spacing:.09em;text-transform:uppercase}
.lab-plan ul{padding-left:19px;color:#dce5f2;line-height:1.9}
.lab-plan .plan-action{display:inline-flex;align-items:center;justify-content:center;margin-top:12px;padding:12px 18px;border-radius:10px;background:#f2d34f;color:#101827;text-decoration:none;font-weight:850}
.lab-plan .plan-action.secondary{background:transparent;border:1px solid #f2d34f88;color:#f2d34f}
.lab-plan .plan-foot{font-size:.82rem;color:#91a4bc;margin-top:12px}
.lab-plan .plan-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}
.lab-plan .plan-stat{padding:13px;border:1px solid var(--line);border-radius:12px;background:#091321}
.lab-plan .plan-stat b{display:block;color:#fff;font-size:1.2rem}
.lab-plan .plan-stat span{color:var(--mut);font-size:.8rem}
@media(max-width:760px){.lab-plans{grid-template-columns:1fr;padding:0 16px}.lab-plan{padding:21px}.lab-plan .plan-grid{grid-template-columns:1fr 1fr}}

/* Section headings in the Match and Highlights tabs. */
.h4x{margin:14px 0 6px;font-size:.8rem;letter-spacing:.07em;text-transform:uppercase;color:var(--mut)}
/* The workspace's right panel holds six tabs: let them wrap instead of widening the page. */
#w-right .tabs { flex-wrap: wrap; }
#w-right .tabs button { flex: 1 1 auto; }
#w-right .pbody { min-width: 0; }
#w-right [id^="ko-"] { min-width: 7.5em; font-variant-numeric: tabular-nums; }

/* Thumbnail filmstrip above the timeline bar. */
.filmstrip { position: relative; height: 46px; margin: 0 0 6px; overflow: hidden; border-radius: 6px; background: #000; }
.filmstrip img { position: absolute; top: 0; height: 46px; width: auto; transform: translateX(-50%); cursor: pointer; opacity: 0.9; }
.filmstrip img:hover { opacity: 1; outline: 2px solid var(--orange); z-index: 1; }

/* ---------------------------------------------------- football intelligence */
.fi-nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 10px; }
.fi-nav button {
  border: 1px solid var(--line); background: transparent; color: var(--mut); border-radius: 999px;
  padding: 4px 11px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.fi-nav button[aria-selected="true"] { background: var(--orange); border-color: var(--orange); color: #111827; font-weight: 700; }
.fi-adv { margin-left: auto; font-size: 12px; color: var(--mut); display: flex; gap: 5px; align-items: center; }
.fi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fi-chip {
  display: inline-flex; flex-direction: column; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; line-height: 1.25; background: #0b1524;
}
.fi-chip small { font-size: 10px; font-weight: 500; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.fi-chip.ok { border-color: #1d9a6c99; }
.fi-chip.warn { border-color: #b8860b99; }
.fi-h { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--coral); }
.fi-h small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.fi-k { margin: 10px 0 4px; font-size: 12.5px; color: var(--ink); }
.fi-k small { color: var(--mut); font-weight: 400; }
.fi-k.interp { color: var(--coral); }
.fi-list { margin: 0; padding-left: 18px; font-size: 13px; }
.fi-list li { margin: 3px 0; }
.fi-limits li { color: var(--mut); }
.fi-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #0b1524; }
.fi-card > b { font-size: 13.5px; }
.fi-card-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fi-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fi-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.fi-stats div { background: #101b2b; border-radius: 7px; padding: 5px 7px; }
.fi-stats small { display: block; font-size: 10.5px; color: var(--mut); }
.fi-stats b { font-size: 15px; }
.fi-stats em { font-style: normal; font-size: 11px; color: var(--mut); }
.fi-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.fi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 6px 0; }
.fi-grid label, .fi-seg label { display: flex; flex-direction: column; gap: 2px; }
.fi-seg textarea { width: 100%; resize: vertical; font: inherit; font-size: 13px; }
.fi-moment { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.fi-moment.open { border-color: var(--orange); }
.fi-moment-head {
  width: 100%; display: flex; gap: 8px; align-items: center; text-align: left; background: #0b1524; color: var(--ink);
  border: 0; padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.fi-moment-head time { font-variant-numeric: tabular-nums; color: var(--coral); font-weight: 700; }
.fi-moment-head span:nth-child(2) { flex: 1; }
.fi-moment-body { padding: 4px 12px 12px; }
.fi-table { overflow-x: auto; }
.fi-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fi-table th, .fi-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fi-pitch { width: 100%; display: block; margin-top: 6px; }
.fi-seg { border-top: 1px solid var(--line); padding: 8px 0; display: grid; gap: 5px; }
.fi-seg-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fi-seg-tools { margin-left: auto; display: flex; gap: 8px; }
.fi-seg[data-kind="freeze"] .fi-seg-head b { color: #7fc8ff; }
.fi-seg[data-kind="slow"] .fi-seg-head b { color: var(--coral); }
.fi-anns { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.fi-anns label { flex-direction: row; align-items: center; gap: 4px; }
.fi-warn { color: #ffb4ae; }
.fi-empty { padding: 10px 2px; }
.linkish { background: none; border: 0; padding: 0; color: var(--coral); font: inherit; cursor: pointer; text-decoration: underline; }
.linkish:disabled { color: var(--mut); text-decoration: none; cursor: default; }
.fi-caption {
  position: absolute; left: 3%; right: 3%; bottom: 4%; z-index: 3; pointer-events: none;
  background: #080f1bdd; border-left: 5px solid var(--orange); border-radius: 10px;
  padding: 8px 14px; font-size: clamp(13px, 1.9vw, 20px); font-weight: 600; color: #fff;
}
.fi-caption[data-kind="title"], .fi-caption[data-kind="outro"] { top: 38%; bottom: auto; text-align: center; font-size: clamp(16px, 2.6vw, 30px); border-left: 0; border-bottom: 4px solid var(--orange); }
@media (max-width: 700px) {
  .fi-stats { grid-template-columns: 1fr 1fr; }
  .fi-grid { grid-template-columns: 1fr; }
  .fi-adv { margin-left: 0; }
}

.fi-poss { display: flex; height: 26px; border-radius: 7px; overflow: hidden; margin: 8px 0 4px; font-size: 12px; font-weight: 700; }
.fi-poss span { display: flex; align-items: center; justify-content: center; color: #fff; white-space: nowrap; overflow: hidden; }

/* Phones: logo on its own row, the page links in a scrollable row beneath. */
@media (max-width: 620px) {
  .labnav-in { flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px; }
  .labnav .logo .onair-mark { width: 38px; }
  .labnav nav { margin-left: 0; width: 100%; overflow-x: auto; gap: 18px; white-space: nowrap; scrollbar-width: none; }
  .labnav nav::-webkit-scrollbar { display: none; }
}

/* Player controls: the button row is a wrapper only on phones; elsewhere its buttons sit
   in the control bar as before (play … +5s, clock, scrub, speed, tag). */
.controls .ctlrow { display: contents; }
.controls #w-play, .controls #w-back, .controls #w-frame-back, .controls #w-frame-fwd, .controls #w-fwd { order: 1; }
.controls .clock { order: 2; }
.controls .scrub { order: 3; }
.controls #w-rate { order: 4; }
.controls #w-tag { order: 5; }

/* ------------------------------------------------------------ phones (v7.3.2) ----
   The old bottom sheet (.wright sticky to the bottom) covered the video and its
   controls. On a phone the page now stacks: video (kept in view while you work,
   when the screen is tall enough) → tools → timeline → workspace list. */
@media (max-width: 700px) {
  .labnav { position: static; }
  .wright {
    position: static; z-index: auto; box-shadow: none; border-top: 0;
    border-radius: 0; background: transparent;
  }
  #w-right { display: flex; flex-direction: column; gap: 10px; }
  #w-right > .lab-vector { order: 2; margin: 0; }
  #w-right > .panel { order: 1; }
  .wright .pbody.scroll { max-height: none; overflow: visible; }
  .lab-pitch { max-height: 34vh; width: 100%; }

  .stagebar { gap: 6px; padding: 6px 8px; }
  .views { padding: 6px; }
  /* Controls: the scrub bar and clock on top, then the buttons (wrapping, nothing hidden). */
  .controls { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 8px; }
  .controls .scrub { grid-column: 1; grid-row: 1; width: 100%; margin: 0; height: 28px; }
  .controls .clock { grid-column: 2; grid-row: 1; min-width: 0; font-size: .74rem; white-space: nowrap; }
  .controls .ctlrow { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 6px; }
  .controls .ctlrow > * { flex: 1 0 auto; order: 0; }
  .controls .btn { padding: 8px 11px; min-height: 40px; }
  .controls select { min-height: 40px; }
  #w-play { min-width: 64px; }
  #w-tag { color: #1a1110; font-weight: 800; }
  .workspace { grid-template-areas: "stage" "right" "timeline" "left"; }

  /* Tool tabs: all seven visible (three per row), with full-size touch targets. */
  #w-right .tabs { flex-wrap: wrap; }
  #w-right .tabs button { flex: 1 1 30%; min-width: 0; padding: 13px 6px; font-size: .74rem; letter-spacing: .04em; }

  /* Comfortable touch sizes inside the tools. */
  #w-right input, #w-right select, #w-right textarea { font-size: 16px; min-height: 42px; }
  #w-right .btn.sm { min-height: 38px; }
  .toolgrid { grid-template-columns: repeat(3, 1fr); }
  .toolgrid button { min-height: 44px; }
}
/* Tall phones: the video and its controls stay at the top while you scroll the tools. */
@media (max-width: 700px) and (min-height: 760px) {
  .wstage { position: sticky; top: 0; z-index: 15; background: var(--bg, #070b12); padding-bottom: 6px; }
}

/* Phone: Match tab rows wrap instead of running off the right edge. */
@media (max-width:700px){
  #w-right .pbody{overflow-x:hidden}
  #w-right .row{flex-wrap:wrap}
  #w-right input,#w-right select,#w-right textarea{min-width:0;max-width:100%;box-sizing:border-box}
  #w-right .row > input,#w-right .row > select{flex:1 1 140px}
  #w-right .row > .btn{flex:1 0 auto}
  #w-right table{display:block;max-width:100%;overflow-x:auto}
  #w-right code,#w-right p,#w-right label{overflow-wrap:anywhere}
}

/* Phone, compact (v7.3.2b): the video takes about a third of the screen so the tools stay visible. */
.phone-only { display: none; }
@media (max-width: 700px) {
  .phone-only { display: inline-flex; }
  .stagebar { gap: 4px; padding: 4px 6px; font-size: .78rem; }
  .stagebar .btn.sm { padding: 5px 8px; min-height: 30px; font-size: .74rem; }
  .stagebar .seg button { padding: 5px 8px; font-size: .74rem; }
  .views { padding: 4px; gap: 4px; }
  .videowrap { width: min(100%, calc(30vh * var(--video-arn, 1.7778))); }
  .views.split { grid-template-columns: 1fr 1fr; }
  .views.split .videowrap { width: min(100%, calc(22vh * var(--video-arn, 1.7778))); }
  .views.split .boardwrap canvas { max-height: 22vh; }
  .boardwrap canvas { max-height: 30vh; object-fit: contain; }
  .controls { gap: 4px 8px; padding: 4px 6px; }
  .controls .scrub { height: 22px; }
  .controls .ctlrow { flex-wrap: nowrap; gap: 4px; }
  .controls .ctlrow > * { flex: 1 1 auto; min-width: 0; }
  .controls .btn, .controls select { padding: 4px 6px; min-height: 32px; font-size: .74rem; }
  #w-play { min-width: 0; }
  #w-rate { flex: 0 1 52px; }
  #w-tag { flex: 1.4 1 auto; white-space: nowrap; }
  #w-right .tabs button { padding: 9px 4px; font-size: .68rem; flex-basis: 24%; }
  .lab-pitch { max-height: 26vh; }
}
@media (max-width: 700px) and (min-height: 600px) {
  .wstage { position: sticky; top: 0; z-index: 15; background: var(--bg, #070b12); padding-bottom: 2px; }
}
.pc-view .phone-only { display: inline-flex; }

/* Quick naming under the video (tap a player, pick his name). */
.quickname { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line, #243046); font-size: .82rem; }
.quickname[hidden] { display: none; }
/* Quick tags (one key per action for a chosen player) */
.quicktag { padding: 6px 8px; border-top: 1px solid var(--line, #243046); font-size: .82rem; }
.quicktag[hidden] { display: none; }
.quicktag .qt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quicktag .qt-row select { flex: 1 1 180px; min-width: 0; font-size: 16px; min-height: 36px; }
.quicktag .qt-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.quicktag .qt-key { border: 1px solid var(--line, #2b3a4f); background: #121c2a; color: inherit; border-radius: 6px; padding: 4px 7px; font-size: .78rem; cursor: pointer; }
.quicktag .qt-key:hover { border-color: #f6c400; }
.quicktag kbd { font: 700 .72rem ui-monospace, monospace; background: #f6c400; color: #111; border-radius: 3px; padding: 0 4px; margin-right: 3px; }
.quicktag .qt-note { margin: 6px 0 0; color: var(--mut, #8fa0b3); font-size: .75rem; }
.quickname .qn-label, .quickname .grow { flex: 1 1 100%; min-width: 0; }
.quickname select { flex: 1 1 160px; min-width: 0; font-size: 16px; min-height: 38px; }
.quickname .btn { min-height: 38px; }
/* Radios and checkboxes keep their own size inside the tools (they were stretched to full width on phones). */
#w-right input[type="radio"], #w-right input[type="checkbox"] { width: auto; flex: 0 0 auto; min-height: 0; min-width: 0; margin: 0 6px 0 0; }
#w-right label.eventrow { display: flex; align-items: center; gap: 6px; }
#w-right label.eventrow .grow { flex: 1 1 auto; min-width: 0; }

/* Reports (v7.4) */
.rp-pitch { width: 100%; height: auto; display: block; margin: 6px 0; }
.rp-pitch .rp-dot { cursor: pointer; }
.rp-bars { width: 100%; height: auto; display: block; margin-top: 6px; }
.rp-table-wrap { overflow-x: auto; margin-top: 6px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.rp-table th, .rp-table td { padding: 5px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
.rp-table th .linkish { font: inherit; font-weight: 700; }
.rp-table .fi-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rp-teams td { font-variant-numeric: tabular-nums; }
