/* ============================================================================
 * m-cdn Customer Quality Inspector — brand design system (styles.css)
 * Task #284. Matches the m-cdn consoles:
 *   dark canvas #202124, cards neutral-950 #0a0a0a with #3c4043 border,
 *   rounded-xl, soft shadow, accent blue hsl(217 91% 60%), clean sans UI,
 *   mono only for metrics/code.
 * ==========================================================================*/
:root {
  --canvas: #202124;
  --card: #0a0a0a;
  --card-2: #131316;
  --border: #3c4043;
  --border-soft: #2a2c30;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --muted-2: #6b7177;
  --accent: hsl(217 91% 60%);
  --accent-soft: hsl(217 91% 60% / 0.14);
  --green: #34c759;
  --green-bg: rgba(52, 199, 89, 0.12);
  --amber: #ffb020;
  --amber-bg: rgba(255, 176, 32, 0.12);
  --red: #ff453a;
  --red-bg: rgba(255, 69, 58, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { overflow-y: scroll; }  /* always-on scrollbar: prevents periodic layout jump when content height crosses the viewport */
html, body {
  margin: 0; padding: 0; background: var(--canvas); color: var(--text);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.5;
}
.mono { font-family: var(--mono); }
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }

/* ---- top wordmark bar ---- */
.topbar {
  display: flex; align-items: center; gap: 14px; margin-bottom: 28px;
}
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.wordmark .dot {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), hsl(217 91% 72%));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.wordmark .sub { color: var(--muted); font-weight: 500; font-size: 14px; border-left: 1px solid var(--border); padding-left: 14px; }
.topbar .spacer { flex: 1; }
.topbar .pill { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }

/* top-of-page run clock — elapsed count-up since test start + live UTC wall clock */
.run-clock { display: flex; align-items: center; gap: 18px; font-family: var(--mono); }
.run-clock .rc-elapsed { display: flex; align-items: baseline; gap: 7px; }
.run-clock .rc-k { font-size: 9px; color: var(--muted); letter-spacing: 0.1em; }
.run-clock .rc-t { font-size: 20px; font-weight: 750; color: var(--text); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.run-clock .rc-wall { display: flex; align-items: baseline; gap: 7px; font-size: 12px; color: var(--muted); }
.run-clock .rc-dot { color: var(--accent); }
.run-clock .rc-utc { font-variant-numeric: tabular-nums; }
.run-clock .rc-start { font-size: 10px; color: var(--muted-2); }
@media (max-width: 620px) { .run-clock .rc-wall { display: none; } .run-clock .rc-t { font-size: 16px; } .run-clock { gap: 10px; } }

/* ---- hero / landing ---- */
.hero { text-align: center; padding: 30px 0 18px; }
.hero h1 { font-size: 38px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 750; }
.hero h1 .accent { color: var(--accent); }
.hero p.lead { color: var(--muted); font-size: 17px; max-width: 640px; margin: 0 auto 26px; }

.mode-toggle { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 22px; }
.mode-toggle button {
  border: none; background: transparent; color: var(--muted); font-family: var(--font);
  font-size: 14px; font-weight: 600; padding: 9px 20px; border-radius: 999px; cursor: pointer;
}
.mode-toggle button.active { background: var(--accent); color: #06131f; }

/* ---- input cards ---- */
.input-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; max-width: 760px; margin: 0 auto;
}
.input-card .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; text-align: left; }
.input-card label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.input-card input[type="text"] {
  background: var(--card-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; font-family: var(--mono);
}
.input-card input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.btn {
  font-family: var(--font); font-size: 15px; font-weight: 700; padding: 13px 26px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card-2);
  color: var(--text); cursor: pointer; transition: filter .12s;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06131f; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; justify-content: center; }

/* ---- sync opt-in ---- */
.sync { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 14px; text-align: left; }
.sync summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.sync .sync-body { margin-top: 12px; }
.sync .note { color: var(--amber); font-size: 12px; margin-top: 8px; }

/* ---- running layout ---- */
.hidden { display: none !important; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin: 6px 0 18px; }
.section-head h2 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.section-head .stream-url { color: var(--muted); font-size: 13px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.section-head .spacer { flex: 1; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; margin-right: 7px; box-shadow: 0 0 0 0 rgba(255,69,58,0.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,69,58,0.45);} 70% { box-shadow: 0 0 0 8px rgba(255,69,58,0);} 100% { box-shadow: 0 0 0 0 rgba(255,69,58,0);} }
.live-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---- "Serving via: <CDN>" — prominent, always-visible in the section head ---- */
.serving-via {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 5px 13px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.serving-via .sv-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.serving-via .sv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.serving-via .sv-cdn { font-weight: 750; }
.serving-via .sv-switches { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ---- viewer-side Simulation panel (DEMO) ---- */
.sim-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  background: var(--card); border: 1px dashed var(--amber); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 11px 16px; margin-bottom: 16px;
}
.sim-pill {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber);
  border-radius: 999px; padding: 4px 11px; white-space: nowrap;
}
.sim-hint { font-size: 12.5px; color: var(--muted); }
.sim-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.sim-btn {
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  cursor: pointer; transition: filter .12s, background .12s, border-color .12s;
}
.sim-btn:hover { filter: brightness(1.15); }
.sim-btn.active { background: var(--amber); border-color: var(--amber); color: #1a1300; }
.sim-btn[data-sim="clean"].active { background: var(--green); border-color: var(--green); color: #04210f; }
.sim-spacer { flex: 1; }
.sim-viewer { display: inline-flex; align-items: center; gap: 8px; }
.sim-viewer-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.sim-viewer-input {
  font-size: 12.5px; padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card-2); color: var(--text); width: 130px;
}
.sim-viewer-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- compact vantage strip (single line, top of Assess) ---- */
.vantage-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 9px 16px; margin-bottom: 16px; font-size: 12.5px;
}
.vantage-strip .vs-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.vantage-strip .vs-badge.green { color: var(--green); background: var(--green-bg); }
.vantage-strip .vs-badge.amber { color: var(--amber); background: var(--amber-bg); }
.vantage-strip .vs-badge.red { color: var(--red); background: var(--red-bg); }
.vantage-strip .vs-badge.na { color: var(--muted); background: rgba(255,255,255,0.05); }
.vantage-strip .vs-item { color: var(--text); }
.vantage-strip .vs-item .vs-k { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em; margin-right: 3px; }

/* ---- measure hero: [ player | bandwidth graph + key metric squares ] (compact) ----
 * The product owner's "empty-space fix": when the player is small (default), the
 * empty horizontal space beside it is filled with the throughput graph + metric
 * squares. The existing theater toggle flips `.theater` to stack them BELOW the
 * full-width player. */
.measure-hero {
  display: grid; grid-template-columns: 480px 1fr; gap: 22px; align-items: stretch;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 22px;
}
.measure-hero .video-wrap { width: 100%; align-self: start; }
.measure-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.video-mini { width: 100%; aspect-ratio: 16 / 9; height: auto; background: #000; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }

/* VLC-style media-information panel under the player */
.media-info { margin-top: 12px; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; }
.media-info .mi-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 8px; }
.mi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.mi-cell { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--border-soft); min-width: 0; }
.mi-cell .mi-k { font-size: 11px; color: var(--muted-2); white-space: nowrap; flex: none; }
.mi-cell .mi-v { font-size: 12px; font-family: var(--mono); color: var(--text); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 760px) { .mi-grid { grid-template-columns: 1fr; } }

/* bandwidth/throughput graph */
.bw-graph { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; }
/* nowrap + clip so the head stays exactly one line — when text inside grows
   (e.g. the segment count gains a digit every ~2s) a wrapping head would
   change card height and reflow the whole page (the periodic "jump"). */
.bw-graph-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: nowrap; overflow: hidden; min-height: 18px; }
.bw-graph-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; white-space: nowrap; flex: none; }
.bw-graph-val { font-size: 16px; font-weight: 750; font-family: var(--mono); white-space: nowrap; flex: none; }
.composite-index { margin-left: auto; font-size: 11px; color: var(--muted-2); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bw-graph-canvas { width: 100%; height: 60px; display: block; }

/* key metric squares (neutral, fill space beside the player) */
.metric-squares { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 1040px) { .metric-squares { grid-template-columns: repeat(2, 1fr); } }
/* full-width row below the player + graphs (6 across) */
.metric-squares-row { grid-template-columns: repeat(6, 1fr); margin: 0 0 22px; }
@media (max-width: 1040px) { .metric-squares-row { grid-template-columns: repeat(3, 1fr); } }
.msq { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; min-height: 58px; }
.msq-v { font-size: 18px; font-weight: 750; font-family: var(--mono); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msq-k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* stabilize card heights so per-segment value/text changes don't shift the layout */
.metric { min-height: 122px; }

/* narrow viewport: stack player above the side panel even in compact mode */
@media (max-width: 760px) { .measure-hero { grid-template-columns: 1fr; } }

/* ---- metric grid ---- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; position: relative; box-shadow: var(--shadow);
}
.metric .m-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.metric .m-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.metric .m-value { font-size: 28px; font-weight: 750; font-family: var(--mono); letter-spacing: -0.02em; }
.metric .m-value .unit { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.metric .m-mean { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.4; }
.rating-chip { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.rating-chip.green { color: var(--green); background: var(--green-bg); }
.rating-chip.amber { color: var(--amber); background: var(--amber-bg); }
.rating-chip.red { color: var(--red); background: var(--red-bg); }
.rating-chip.na { color: var(--muted); background: rgba(255,255,255,0.05); }
.weight-tag { font-size: 10px; color: var(--muted-2); font-family: var(--mono); }

/* ---- timeline + waterfall ---- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 22px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.timeline-canvas { width: 100%; height: 38px; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; display: block; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; margin-top: 8px; color: var(--muted); }
.tl-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.waterfall { font-family: var(--mono); font-size: 12px; }
.wf-row { display: grid; grid-template-columns: 120px 56px 1fr 64px; gap: 10px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--border-soft); }
.wf-row .wf-cdn { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-bar-track { background: var(--card-2); border-radius: 4px; height: 14px; overflow: hidden; }
.wf-bar { height: 100%; display: flex; }
.wf-bar .seg-ttfb { background: var(--amber); }
.wf-bar .seg-dl { background: var(--accent); }
.wf-ms { text-align: right; color: var(--muted); }

/* ---- per-segment CDN timeline ---- */
.cdn-tl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cdn-tl-head h3 { margin: 0; }
.cdn-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 5px 12px;
}
.cdn-chip-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.cdn-chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.cdn-chip-name { font-weight: 750; font-size: 13px; }
.cdn-chip-via { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.cdn-ticks-canvas {
  width: 100%; height: 26px; background: var(--card-2);
  border: 1px solid var(--border-soft); border-radius: 8px; display: block;
}
.cdn-time-axis {
  display: flex; justify-content: space-between; font-family: var(--mono);
  font-size: 10px; color: var(--muted-2); margin-top: 4px;
}
.cdn-tl-legend { margin-top: 10px; }
.cdn-tl-muted { color: var(--muted-2); }
.cdn-switch-summary { margin-top: 12px; }
.cdn-switch-count { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cdn-switch-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cdn-sw-row { font-size: 12.5px; font-family: var(--mono); display: flex; align-items: center; gap: 4px; }
.cdn-sw-row .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.cdn-sw-arrow { color: var(--muted); }
.cdn-sw-t { color: var(--muted-2); margin-left: 4px; }
.cdn-cors-note {
  margin-top: 12px; font-size: 12px; color: var(--amber);
  background: var(--amber-bg); border: 1px solid rgba(255, 176, 32, 0.25);
  border-radius: 8px; padding: 9px 12px; line-height: 1.45;
}

/* ---- A/B compare ---- */
.delta-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 22px;
}
.delta-verdict {
  grid-column: 1 / -1; font-size: 21px; font-weight: 750; text-align: center; padding: 8px 0 14px;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; letter-spacing: -0.01em;
}
.delta-verdict .em { color: var(--accent); }
.delta-cell { text-align: center; }
.delta-cell .dl-name { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.delta-cell .dl-val { font-size: 22px; font-weight: 750; font-family: var(--mono); margin-top: 4px; }
.delta-cell.better .dl-val { color: var(--green); }
.delta-cell.worse .dl-val { color: var(--red); }
.delta-cell.neutral .dl-val { color: var(--muted); }
.score-delta-big { font-size: 15px; }

.ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .ab-grid { grid-template-columns: 1fr; } }
.ab-col h4 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ab-col h4 .tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; }
.ab-video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 12px; }
.ab-score { font-size: 40px; font-weight: 800; font-family: var(--mono); letter-spacing: -0.02em; }
.ab-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; font-size: 12.5px; }
.ab-mini { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; }
.ab-mini .k { color: var(--muted); font-size: 11px; }
.ab-mini .v { font-family: var(--mono); font-weight: 700; font-size: 15px; }

/* ---- vantage point validity card ---- */
.vantage-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 22px;
}
.vantage-card .v-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.vantage-card .v-title { font-size: 14px; font-weight: 700; }
.vantage-card .v-badge {
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.vantage-card .v-badge.green { color: var(--green); background: var(--green-bg); }
.vantage-card .v-badge.amber { color: var(--amber); background: var(--amber-bg); }
.vantage-card .v-badge.red { color: var(--red); background: var(--red-bg); }
.vantage-card .v-badge.na { color: var(--muted); background: rgba(255,255,255,0.05); }
.vantage-card .v-guidance { font-size: 13.5px; color: var(--text); margin: 8px 0 14px; line-height: 1.45; }
.vantage-card .v-guidance.warn { color: var(--amber); font-weight: 600; }
.vantage-card .v-guidance.bad { color: var(--red); font-weight: 600; }
.vantage-card .v-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px;
  border-top: 1px solid var(--border-soft); padding-top: 12px;
}
.vantage-card .v-cell .vk { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.vantage-card .v-cell .vv { font-size: 14px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.vantage-card .v-cell .vv .heur { color: var(--muted-2); font-weight: 400; font-size: 11px; }

.measured-note { font-size: 12px; color: var(--muted-2); text-align: center; margin: 4px 0 18px; }
.measured-note .badge { background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 2px 8px; font-weight: 600; }

/* ---- log ---- */
.log { max-height: 220px; overflow-y: auto; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.log .row { padding: 2px 6px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.log .row .t { color: var(--muted-2); }
.log .row.cdn_change { background: var(--amber-bg); }
.log .row.err { background: var(--red-bg); }
.log .row.steering { background: var(--accent-soft); }

/* ---- theater toggle (player expand) ---- */
.video-wrap { position: relative; width: 100%; }
.theater-toggle {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-family: var(--font); font-size: 11px; font-weight: 600;
  color: var(--text); background: rgba(10,10,10,0.78); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px; cursor: pointer; backdrop-filter: blur(4px);
}
.theater-toggle:hover { filter: brightness(1.25); }
.theater-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #06131f; }
/* When theater is ON, the measure-hero stacks: full-width 16:9 player on top, the
 * bandwidth graph + key metric squares drop BELOW it (the empty-space-fix in reverse). */
.measure-hero.theater {
  display: block;
}
.measure-hero.theater .video-wrap { width: 100%; }
.measure-hero.theater .video-mini { width: 100%; aspect-ratio: 16 / 9; }
.measure-hero.theater .measure-side { margin-top: 18px; }
/* below the full-width player, lay the squares out wide */
.measure-hero.theater .metric-squares { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 900px) { .measure-hero.theater .metric-squares { grid-template-columns: repeat(3, 1fr); } }

/* ---- advanced (pro) panels ---- */
.adv-head {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-2); margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft);
}
details.panel.adv > summary { cursor: pointer; list-style: none; display: flex; align-items: center; }
details.panel.adv > summary::-webkit-details-marker { display: none; }
details.panel.adv > summary h3 { margin: 0; display: flex; align-items: baseline; gap: 10px; width: 100%; }
details.panel.adv > summary::before {
  content: "▸"; color: var(--muted); margin-right: 10px; font-size: 12px; transition: transform .15s;
}
details.panel.adv[open] > summary::before { content: "▾"; }
.adv-sub { font-size: 11px; font-weight: 500; color: var(--muted-2); text-transform: none; letter-spacing: 0; }
.adv-mini-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 8px; }

/* sparklines */
.spark-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0 6px; }
@media (max-width: 700px) { .spark-row { grid-template-columns: 1fr; } }
.spark-cell { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; }
.spark-label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 4px; }
.spark-val { font-family: var(--mono); font-weight: 700; color: var(--text); }
.sparkline { width: 100%; height: 44px; display: block; }

/* dense data tables (segments, codecs) */
.seg-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 8px; margin-top: 10px; }
.seg-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.seg-table thead th {
  position: sticky; top: 0; background: var(--card-2); color: var(--muted); text-align: left;
  font-weight: 600; padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1;
}
.seg-table th.num, .seg-table td.num { text-align: right; }
.seg-table tbody td { padding: 5px 9px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.seg-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.seg-table .st-ok { color: var(--green); }
.seg-table .st-warn { color: var(--amber); }
.seg-table .st-err { color: var(--red); }
.seg-table .cache-hit { color: var(--green); }
.seg-table .cache-miss { color: var(--amber); }
.seg-table tr.active-level td { background: var(--accent-soft); }
.seg-table tr.active-level td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cdn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* codec active summary */
.codec-active { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 4px; }
.codec-active .ca-cell { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 11px; }
.codec-active .ca-k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.codec-active .ca-v { font-size: 14px; font-weight: 700; font-family: var(--mono); margin-top: 3px; word-break: break-word; }
.audio-tracks { margin-top: 12px; font-size: 12px; color: var(--muted); }
.audio-tracks .at-chip { display: inline-block; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 3px 10px; margin: 3px 6px 3px 0; font-family: var(--mono); }

/* ABR ladder + switch history */
.abr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .abr-grid { grid-template-columns: 1fr; } }
.abr-ladder .abr-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 6px 10px; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 6px;
  font-family: var(--mono); font-size: 12px; background: var(--card-2);
}
.abr-ladder .abr-row.active { border-color: var(--accent); background: var(--accent-soft); }
.abr-ladder .abr-row .abr-meta { color: var(--muted); font-size: 11px; }
.abr-ladder .abr-row .abr-active-tag { font-size: 9px; font-weight: 700; color: var(--accent); text-transform: uppercase; }
.switch-history { max-height: 280px; overflow-y: auto; font-family: var(--mono); font-size: 12px; }
.switch-history .sw-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--border-soft); }
.switch-history .sw-t { color: var(--muted-2); }
.switch-history .sw-up { color: var(--green); }
.switch-history .sw-down { color: var(--amber); }
.switch-history .sw-init { color: var(--muted); }

/* manifest inspector */
.manifest-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.manifest-tags .mt-chip {
  font-size: 11px; font-family: var(--mono); padding: 4px 10px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--border-soft); color: var(--muted);
}
.manifest-tags .mt-chip.on { color: var(--green); border-color: var(--green); }
.manifest-tags .mt-chip.warn { color: var(--amber); border-color: var(--amber); }
.manifest-tags .mt-chip b { color: var(--text); }
.manifest-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .manifest-cols { grid-template-columns: 1fr; } }
.manifest-pre {
  background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--text);
  max-height: 340px; overflow: auto; white-space: pre; margin: 0;
}

/* ---- cookie + terms consent gate (landing, before Analyze) ---- */
.consent-gate { max-width: 760px; margin: 0 auto 14px; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1.5; }
.consent-check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.consent-check a { color: var(--accent); }

/* ---- DRM notice ---- */
.drm-banner {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px;
  background: var(--amber-bg); border: 1px solid var(--amber);
  border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 13px; line-height: 1.5;
}
.drm-banner .drm-ico { font-size: 18px; line-height: 1.2; }
.drm-banner strong { color: var(--amber); }

/* ---- feedback card ---- */
.feedback-card h3 { margin: 0 0 10px; }
.fb-stars { display: flex; gap: 4px; margin-bottom: 10px; }
.fb-stars .fb-star { background: none; border: none; cursor: pointer; font-size: 26px; line-height: 1; color: #3c4043; padding: 0 2px; transition: color .1s; }
.fb-stars .fb-star.on { color: #fbbc04; }
.fb-text { width: 100%; box-sizing: border-box; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; color: var(--text); padding: 10px; font-size: 13px; font-family: inherit; resize: vertical; margin-bottom: 10px; }
.fb-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fb-email { flex: 1; min-width: 220px; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 8px; color: var(--text); padding: 9px 11px; font-size: 13px; }
.fb-thanks { margin-top: 10px; color: var(--green); font-size: 13px; font-weight: 600; }

/* ---- mobile / phone viewers ---- */
@media (max-width: 760px) {
  /* let the running-section header wrap instead of overflowing */
  .section-head { flex-wrap: wrap; gap: 8px 12px; }
  .section-head .stream-url { max-width: 100%; flex-basis: 100%; }
  .section-head .spacer { display: none; }
  /* action buttons: full-row, easy thumb targets */
  .section-head .btn { flex: 1 1 auto; min-width: 88px; }
  .vantage-strip { flex-wrap: wrap; gap: 6px 10px; }
}
@media (max-width: 600px) {
  .wrap { padding: 18px 14px 48px; }
  .hero { padding: 18px 0 12px; }
  .hero h1 { font-size: 27px; }
  .hero p.lead { font-size: 15px; }
  .measure-hero { padding: 14px; gap: 14px; }
  /* 6-up key-metric row → 2-up on a phone (3 was too cramped) */
  .metric-squares-row { grid-template-columns: repeat(2, 1fr); }
  .metric-squares { grid-template-columns: repeat(2, 1fr); }
  /* one column for the full metric grid */
  .metric-grid { grid-template-columns: 1fr; }
  .input-card { padding: 16px; }
}

/* ---- print / share report ---- */
@media print {
  body { background: #fff; color: #111; }
  .no-print { display: none !important; }
  .panel, .metric, .measure-hero, .vantage-strip, .delta-bar { box-shadow: none; border-color: #ccc; background: #fff; }
  .wrap { max-width: none; }
}
