:root {
  --indigo: #4338ca;
  --indigo-deep: #3730a3;
  --indigo-soft: #ede9fe;
  --lav: #ddd9f8;
  --page: #f4f5f7;
  --card: #ffffff;
  --line: #e5e7eb;
  --ink: #111827;
  --grey: #6b7280;
  --grey-2: #9ca3af;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #b45309;
  --warn-bg: #fef3e2;
  --no: #b91c1c;
  --no-bg: #fdecec;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------- top bar */

.bar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  height: 54px;
  background: linear-gradient(90deg, var(--indigo-deep), var(--indigo));
  color: #fff;
}

.brand { display: flex; align-items: center; gap: 9px; }

.mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: #fff;
  color: var(--indigo);
  font-weight: 700;
  font-size: 14px;
}

.word { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }

.tabs { display: flex; gap: 4px; }

.tabs button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tabs button:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.tabs button.on { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 600; }

.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.pill-ghost {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 12.5px;
  font-weight: 500;
}

.chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.toolbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  height: 34px;
  background: #fff;
}

.select-icon { color: var(--grey-2); font-size: 12px; }

.select select {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  height: 32px;
  padding-right: 4px;
  cursor: pointer;
  max-width: 340px;
}

.tool-note { color: var(--grey); font-size: 12.5px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--indigo);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: var(--indigo-deep); }
.btn-primary:disabled { background: var(--grey-2); cursor: default; }
.spark { font-size: 11px; }

.btn-ghost {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--grey);
  font-size: 15px;
  cursor: pointer;
}

.btn-ghost:hover { color: var(--ink); border-color: var(--grey-2); }

/* ------------------------------------------------------------------ main */

main { padding: 16px 18px 64px; display: grid; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
}

.card-head h2 { margin: 0 0 3px; font-size: 15.5px; font-weight: 650; }
.card-head p { margin: 0; color: var(--grey); font-size: 13px; max-width: 70ch; }
.head-right { margin-left: auto; flex: none; }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.no { background: var(--warn-bg); color: var(--warn); }

/* the divided stat strip */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat { padding: 14px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }

.stat-k {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  font-weight: 600;
}

.stat-v {
  margin-top: 5px;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-v.dim { color: var(--grey-2); }
.stat-u { font-size: 13px; color: var(--grey); font-weight: 500; margin-left: 3px; }

/* chart */

.plot { padding: 14px 18px 10px; }
.plot canvas { width: 100%; height: 210px; display: block; }

.plot-legend {
  display: flex;
  gap: 18px;
  padding: 2px 18px 14px;
  color: var(--grey);
  font-size: 12px;
}

.plot-legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 13px; height: 3px; border-radius: 2px; background: var(--indigo); }
.sw.fill { height: 11px; background: var(--lav); border-radius: 3px; }
.sw.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); }

/* the checks table */

.rows { border-top: 1px solid var(--line); }

.row-head {
  display: grid;
  grid-template-columns: 210px 1fr 108px;
  gap: 14px;
  padding: 9px 18px;
  background: #fafafa;
  border-bottom: 1px solid var(--line);
  color: var(--grey);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.row {
  display: grid;
  grid-template-columns: 210px 1fr 108px;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.row:last-child { border-bottom: 0; }
.row-name { font-weight: 550; }
.row-why { color: var(--grey); font-size: 13px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tag.pass { background: var(--ok-bg); color: var(--ok); }
.tag.fail { background: var(--no-bg); color: var(--no); }
.tag.skip { background: #f3f4f6; color: var(--grey-2); }

/* prose blocks for method / limits */

/* Long-form sections read as one narrow column on a phone and two on a desk,
   so a wide window does not leave half the card empty. */
.prose { padding: 4px 18px 20px; max-width: 78ch; }
.prose h3 { font-size: 14px; margin: 20px 0 7px; break-after: avoid; }
.prose h3:first-child { margin-top: 6px; }
.prose p { margin: 0 0 11px; color: #374151; break-inside: avoid; }
.prose ul { margin: 0 0 11px; padding-left: 19px; color: #374151; break-inside: avoid; }

@media (min-width: 1100px) {
  .prose { max-width: none; columns: 2; column-gap: 44px; }
  .prose section { break-inside: avoid; }
  .prose > :first-child { margin-top: 0; }
}
.prose li { margin-bottom: 5px; }
.prose code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.callout {
  break-inside: avoid;
  border-left: 3px solid var(--indigo);
  background: #faf9ff;
  padding: 11px 14px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 13px;
  color: #374151;
}

/* camera panel */

.cam { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 16px 18px; }
.cam video { width: 100%; border-radius: 10px; background: #111827; aspect-ratio: 3/4; object-fit: cover; }
.cam-note { color: var(--grey); font-size: 13px; }
.cam-note strong { color: var(--ink); }

.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; background: var(--indigo); width: 0; }

/* ---------------------------------------------------------- status bar */

.status {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  height: 36px;
  background: #1f2330;
  color: #cbd0dc;
  font-size: 12px;
}

.legend { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.d-ok { background: #4ade80; }
.d-no { background: #f87171; }
.d-beat { background: #a5b4fc; }
.d-win { background: #ddd9f8; }
.status-right { margin-left: auto; color: #8b93a7; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .cam { grid-template-columns: 1fr; }
  .row, .row-head { grid-template-columns: 1fr 84px; }
  .row-why { display: none; }
  .tabs button { padding: 7px 10px; }
  .tool-note { display: none; }
}
