@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0f16;
  --surface: #121824;
  --surface-raised: #1a2231;
  --inset: #0e131c;
  --line: #232c3d;
  --line-strong: #3a4763;
  --text: #edf1f7;
  --text-soft: #a3aec2;
  --accent: #fb923c;
  --accent-hover: #fdba74;
  --accent-ink: #1f1104;
  --accent-soft: rgba(251, 146, 60, 0.12);
  --good: #34d399;
  --fair: #fbbf24;
  --poor: #f87171;
  --metric-hip: #f97316;
  --metric-stability: #ec4899;
  --metric-balance: #3b82f6;
  --metric-feet: #10b981;
  --metric-efficiency: #eab308;
  --metric-posture: #06b6d4;
  --metric-overall: #a78bfa;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --touch: 48px;
  --stage-max-height: 72vh;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 85% -8%, rgba(251, 146, 60, 0.13), transparent 62%),
    radial-gradient(700px 420px at -5% 12%, rgba(59, 130, 246, 0.08), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main { flex: 1; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.1rem;
}

.container-narrow { max-width: 720px; }

.muted { color: var(--text-soft); }
.small { font-size: 0.85rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { top: 1rem; }

.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----- header and footer ----- */

.site-header { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

/* Narrow phones: the brand and the privacy link are what must fit. */
@media (max-width: 400px) {
  .site-nav a[href$="#how-it-works"] { display: none; }
}

.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 0.85rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.site-footer nav { display: flex; gap: 1.25rem; }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--text); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--touch);
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(251, 146, 60, 0.25);
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--accent-ink); }

.btn-secondary {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }

.btn-small {
  min-height: 42px;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.btn-danger {
  background: transparent;
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--poor);
}

.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.1); color: var(--poor); }

.link-button {
  padding: 0.35rem 0.2rem;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover { color: var(--accent-hover); text-decoration: underline; }

/* ----- cards and alerts ----- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card + .card { margin-top: 1rem; }

.card-title {
  margin-bottom: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.card-intro {
  margin: -0.5rem 0 1rem;
  color: var(--text-soft);
  font-size: 0.875rem;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.alert .icon { margin-top: 0.15em; }
.alert-error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.alert-success { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }

progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--line);
  accent-color: var(--accent);
  appearance: none;
  -webkit-appearance: none;
}

progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-full); transition: width 0.4s ease; }
progress::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-full); }

/* ----- landing page ----- */

.hero {
  display: grid;
  justify-items: center;
  gap: 2rem;
  padding: 2.5rem 0 1rem;
}

.hero-intro {
  max-width: 40rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.75rem, 14vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.hero h1 em { font-style: normal; color: var(--accent); }

.hero-tagline {
  margin-top: 0.9rem;
  font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero-lead {
  max-width: 34rem;
  margin: 0.75rem auto 0;
  color: var(--text-soft);
  font-size: 1.05rem;
}

/* The list is centered as a block, with its lines left-aligned so the ticks line up. */
.check-list {
  display: grid;
  gap: 0.6rem;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.check-list .icon { margin-top: 0.15em; color: var(--good); }
.check-list strong { color: var(--text); font-weight: 600; }

.upload-card {
  width: 100%;
  max-width: 36rem;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.3rem;
  margin-bottom: 1.1rem;
  border-radius: var(--radius-full);
  background: var(--inset);
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-raised); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }

.form-stack { display: grid; gap: 1rem; }
.dropzone-pair { display: grid; gap: 0.85rem; }

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--inset);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover, .dropzone.is-dragging, .dropzone:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.has-file { border-style: solid; border-color: var(--line-strong); background: var(--inset); }
.dropzone.is-invalid { border-color: var(--poor); }

/* The real input stays focusable and validated by the browser; the label is what people see and tap. */
.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 150px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
}

.dropzone-pair .dropzone-prompt { min-height: 112px; }
.dropzone-prompt .icon { width: 2rem; height: 2rem; margin-bottom: 0.35rem; color: var(--accent); }
.dropzone-title { font-weight: 600; }
.dropzone-hint { color: var(--text-soft); font-size: 0.85rem; }

.dropzone-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
}

.dropzone-file .icon { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.dropzone-file-text { flex: 1; min-width: 0; }
.dropzone-file-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-file-size { color: var(--text-soft); font-size: 0.82rem; }
.dropzone-file-actions { display: flex; gap: 0.6rem; }
.dropzone-file-actions label { cursor: pointer; }

.field-error {
  margin-top: 0.4rem;
  color: #fca5a5;
  font-size: 0.85rem;
}

.upload-progress { display: grid; gap: 0.6rem; }

.upload-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.fine-print {
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.fine-print a { color: var(--text-soft); }
.fine-print a:hover { color: var(--text); }

.section { padding: 3rem 0 0; }

.section-head { max-width: 40rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: clamp(1.4rem, 3.5vw, 1.85rem); }
.section-head p { margin-top: 0.5rem; color: var(--text-soft); }

.steps-grid, .metric-grid {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-card, .metric-card {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.step-card h3, .metric-card h3 { font-size: 1rem; }
.step-card p, .metric-card p { margin-top: 0.4rem; color: var(--text-soft); font-size: 0.9rem; }

.metric-card h3 { display: flex; align-items: center; gap: 0.55rem; }

.metric-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--metric-color, var(--text-soft));
}

.hip_to_wall { --metric-color: var(--metric-hip); }
.stability { --metric-color: var(--metric-stability); }
.balance { --metric-color: var(--metric-balance); }
.foot_pressure { --metric-color: var(--metric-feet); }
.efficiency { --metric-color: var(--metric-efficiency); }
.posture { --metric-color: var(--metric-posture); }
.overall { --metric-color: var(--metric-overall); }

/* ----- processing page ----- */

.status-wrap { padding: 2.5rem 0 0; }

.status-card {
  padding: 1.75rem 1.4rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-icon .icon { width: 28px; height: 28px; }
.status-icon.is-error { background: rgba(248, 113, 113, 0.12); color: var(--poor); }
.status-icon.is-working .icon { animation: spin 1.1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.status-card h1 { font-size: 1.5rem; }
.status-card > p { max-width: 30rem; margin: 0.6rem auto 0; color: var(--text-soft); }

.status-progress { margin: 1.5rem 0 0; text-align: left; }

.status-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.status-progress-row span:last-child { color: var(--text-soft); font-variant-numeric: tabular-nums; }

.stage-list {
  display: grid;
  gap: 0.15rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.stage-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
}

.stage-mark .icon { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.stage.is-done { color: var(--text); }
.stage.is-done .stage-mark { border-color: var(--good); background: var(--good); color: #052e1c; }
.stage.is-done .stage-mark .icon { opacity: 1; }
.stage.is-active { color: var(--text); font-weight: 600; }
.stage.is-active .stage-mark { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* ----- results page ----- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 0 1.25rem;
}

.page-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
.page-head p { margin-top: 0.35rem; color: var(--text-soft); font-size: 0.92rem; }

.results-grid { display: grid; gap: 1rem; }
.results-grid > * { min-width: 0; }

.player-stage {
  position: relative;
  width: 100%;
  max-width: min(100%, calc(var(--stage-max-height) * var(--ratio, 0.5625)));
  aspect-ratio: var(--ratio, 0.5625);
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.player-stage video, .player-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.player-stage video { object-fit: contain; }
.player-stage canvas { pointer-events: none; }

.plain-video {
  display: block;
  width: 100%;
  max-height: 76vh;
  border-radius: var(--radius);
  background: #000;
}

.player-status { margin-top: 0.6rem; color: var(--text-soft); font-size: 0.82rem; }
.player-status:empty { display: none; }
.player-status a { font-weight: 600; }

.live-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--inset);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--metric-color, var(--text-soft));
}

.live-pill strong { min-width: 1.5em; color: var(--text); font-size: 0.85rem; text-align: right; }

.control-label {
  margin: 1rem 0 0.45rem;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.overlay-toggles { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.toggle-chip {
  min-height: 38px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.toggle-chip:hover { border-color: var(--line-strong); color: var(--text); }
.toggle-chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.playback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.select-control {
  flex: 1;
  min-width: 130px;
  min-height: 42px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* smaller text makes iOS zoom the page on focus */
  cursor: pointer;
}

.playback-controls .btn { flex: 1; min-width: 0; white-space: nowrap; }

.frame-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.frame-step .btn { flex: 1; min-width: 0; white-space: nowrap; }

.frame-readout {
  flex: 1.4;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.hint {
  margin-top: 0.75rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.hint a { font-weight: 600; }

.summary {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.score-ring { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 9; }
.score-ring .ring-track { stroke: var(--line); }
.score-ring .ring-value { stroke: var(--rating-color, var(--accent)); stroke-linecap: round; }

.score-ring-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-ring-number small { margin-top: 0.2rem; color: var(--text-soft); font-size: 0.7rem; font-weight: 600; letter-spacing: 0; }

.summary h2 { font-size: 1.15rem; }
.summary p { margin-top: 0.35rem; color: var(--text-soft); font-size: 0.92rem; }
.summary strong { color: var(--text); font-weight: 600; }

.is-good { --rating-color: var(--good); }
.is-fair { --rating-color: var(--fair); }
.is-poor { --rating-color: var(--poor); }

.scores-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.score-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--inset);
}

.score-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.score-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.35rem 0 0.5rem;
}

.score-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.score-value small { margin-left: 0.15rem; color: var(--text-soft); font-size: 0.75rem; font-weight: 500; letter-spacing: 0; }
.score-rating { color: var(--rating-color, var(--text-soft)); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }

.score-bar { display: block; width: 100%; height: 6px; border-radius: var(--radius-full); overflow: hidden; }
.score-bar .bar-track { fill: var(--line); }
.score-bar .bar-value { fill: var(--rating-color, var(--accent)); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.stat-tile {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
}

.stat-label { color: var(--text-soft); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 0.2rem; color: var(--text-soft); font-size: 0.8rem; font-weight: 600; }
.stat-note { margin-top: 0.1rem; color: var(--text-soft); font-size: 0.75rem; }

.event-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }

.event-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.event-item:hover { border-color: var(--fair); }
.event-item strong { color: var(--text); }
.event-time { flex-shrink: 0; min-width: 3.25rem; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.event-play { flex-shrink: 0; margin-left: auto; color: var(--fair); }

.chart-block + .chart-block { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.chart-block h3 { margin-bottom: 0.6rem; font-size: 0.95rem; }
.chart-container { position: relative; height: 250px; }

.chart-message {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text-soft);
  font-size: 0.875rem;
}

.chart-message.is-error { color: #fca5a5; }

.chart-playhead {
  position: absolute;
  display: none;
  width: 2px;
  margin-left: -1px;
  background: rgba(237, 241, 247, 0.7);
  pointer-events: none;
}

details.explainer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  list-style: none;
}

details.explainer summary::-webkit-details-marker { display: none; }
details.explainer summary .icon { color: var(--text-soft); transition: transform 0.2s; }
details.explainer[open] summary .icon { transform: rotate(180deg); }

.definition-list { display: grid; gap: 0.8rem; margin: 1rem 0 0; }
.definition-list dt { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: 600; }
.definition-list dd { margin: 0.15rem 0 0; color: var(--text-soft); font-size: 0.88rem; }

.download-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.download-row .btn { flex: 1 1 auto; }

.privacy-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
}

.privacy-note p { flex: 1 1 18rem; color: var(--text-soft); font-size: 0.88rem; }
.privacy-note .icon { margin-right: 0.2rem; vertical-align: -0.25em; }
.privacy-note .btn .icon { margin-right: 0; vertical-align: baseline; }
.privacy-note strong { color: var(--text); font-weight: 600; }

/* ----- legal and error pages ----- */

.prose { padding: 2rem 0 0; }
.prose h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); }
.prose h2 { margin: 2rem 0 0.6rem; font-size: 1.2rem; }
.prose p, .prose li { color: var(--text-soft); }
.prose p + p { margin-top: 0.8rem; }
.prose ul { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.prose li + li { margin-top: 0.4rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose .updated { margin-top: 0.5rem; font-size: 0.9rem; }

.error-code { color: var(--accent); font-size: 0.9rem; font-weight: 700; letter-spacing: 0.08em; }

/* ----- larger screens ----- */

@media (min-width: 560px) {
  .container { padding: 0 1.5rem; }
  .upload-card { padding: 1.5rem; }
  .card { padding: 1.5rem; }
  .dropzone-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scores-grid, .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-card { padding: 2.25rem; }
  .chart-container { height: 290px; }
}

@media (min-width: 960px) {
  .hero {
    gap: 2.5rem;
    padding: 4rem 0 2rem;
  }

  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section { padding-top: 4.5rem; }
}

/* Portrait videos sit beside the numbers and stay in view while the page scrolls. */
@media (min-width: 1024px) {
  .results-grid.is-portrait {
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
  }

  .results-grid.is-portrait .player-column {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    --stage-max-height: 54vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
