:root {
  --bg: #141414; --surface: #1e1e1e; --surface-2: #262626; --border: #303030; --axis: #474747;
  --text: #efefef; --text-2: #9c9c9c; --accent: #338ced; --good: #3fb950; --warning: #d29922; --critical: #f85149;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
b { font-weight: 600; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

.top { padding: 22px 20px 6px; max-width: 1100px; margin: 0 auto; }
.brand { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.claim { color: var(--text-2); margin-top: 2px; }
.claim b { color: var(--text); }

main { max-width: 1100px; margin: 0 auto; padding: 12px 20px 30px; display: grid; gap: 16px; }
#result { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.hint { color: var(--text-2); font-size: 13px; margin-top: 8px; }

.fields { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.fields label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.input { color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.optional { font-size: 11px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
input[type="number"] {
  width: 110px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 16px;
}
.stored { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }

button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer;
}
button:hover { border-color: rgba(255, 255, 255, 0.3); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.big { padding: 12px 22px; font-size: 16px; font-weight: 600; }
button.ghost { background: transparent; }
button.small { padding: 2px 8px; font-size: 12px; margin-left: 6px; }
button.on { border-color: var(--accent); color: #fff; background: rgba(51, 140, 237, 0.22); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.howto { margin-top: 14px; }
.howto summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.howto ol { margin: 8px 0 0 20px; display: grid; gap: 6px; font-size: 14px; }

.progress-box { margin-top: 14px; }
.stage { font-size: 14px; margin-bottom: 6px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.error { margin-top: 14px; color: var(--critical); font-size: 14px; }

/* The two heights */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
details.height { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
details.height summary { list-style: none; cursor: pointer; }
details.height summary::-webkit-details-marker { display: none; }
.height .label { color: var(--text-2); font-size: 13px; }
.height .value { font-size: 60px; font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; }
.height .value small { font-size: 22px; font-weight: 500; color: var(--text-2); margin-left: 6px; letter-spacing: 0; }
.height.missing .value { color: var(--text-2); }
.height .sub { font-size: 13px; }
.height .conf { font-size: 12px; color: var(--text-2); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.help { font-size: 11px; color: var(--accent); margin-left: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-2); }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); } .dot.critical { background: var(--critical); }
.explain { margin-top: 10px; display: grid; gap: 6px; font-size: 13px; }
.explain .row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.explain .k { color: var(--text-2); }
.explain .careful .k { color: var(--warning); }
.calib { font-size: 14px; display: grid; gap: 8px; align-content: start; }
details.extra { margin-top: 10px; padding: 6px 4px; border-top: 1px solid var(--border); }
details.extra summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }

.flags { display: grid; gap: 4px; margin-top: 12px; }
.flag { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--text-2); }
.flag .icon { font-weight: 700; }
.flag.warning .icon { color: var(--warning); } .flag.critical .icon { color: var(--critical); }
.flag b { color: var(--text); }

/* Video with skeleton */
.video-wrap { position: relative; line-height: 0; max-width: 720px; }
.video-wrap video { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; }
.video-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 6px; }
.controls .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* Key moments */
.moments { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.moment { cursor: pointer; max-width: 280px; }
.moment canvas { width: 100%; border-radius: 8px; background: #000; display: block; }
.moment figcaption { margin-top: 6px; font-size: 12px; }
.moment .name { font-weight: 600; }
.moment .lines { color: var(--text-2); }

/* Joint table */
.table-wrap { overflow-x: auto; }
table.values { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.values th, table.values td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
table.values th:first-child, table.values td:first-child { text-align: left; }
table.values th { color: var(--text-2); font-weight: 500; font-size: 12px; }

/* Charts */
.chart { margin-top: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chart-head h3 { font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.swatch.far { opacity: 0.6; height: 2px; }
.chart-foot { color: var(--text-2); font-size: 11px; margin-top: 2px; }

footer { max-width: 1100px; margin: 0 auto; padding: 10px 20px 40px; color: var(--text-2); font-size: 12px; display: grid; gap: 6px; }

@media (max-width: 560px) {
  .height .value { font-size: 48px; }
  main { padding: 10px 12px 24px; }
  .card { padding: 14px; }
}
