/* SwingCheck: light by default, dark when the system is. */
:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #eef0eb;
  --text: #1a1d19;
  --muted: #5f665d;
  --border: #dfe2db;
  --accent: #2b7a47;
  --accent-soft: #e3f0e7;
  --accent-text: #ffffff;
  --ok: #2b8a4b;
  --warn: #b77a14;
  --flag: #c23d36;
  --ok-soft: #e4f2e8;
  --warn-soft: #fbf0dc;
  --flag-soft: #fbe5e3;
  --error: #8a9087;
  --radius: 12px;
  --radius-sm: 8px;
  /* Brand (branding/swingcheck-brand-guide.pdf), the same in light and dark */
  --deep: #123824;
  --deep-2: #1d5a37;
  --bright: #4fb06d;
  --on-deep: #ffffff;
  --on-deep-soft: rgba(255, 255, 255, 0.72);
  --on-deep-line: rgba(255, 255, 255, 0.14);
  --plane: #ff9f43;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.05), 0 4px 14px rgba(20, 30, 20, 0.05);
  --focus: 0 0 0 3px rgba(43, 122, 71, 0.35);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111311;
    --surface: #1a1d1a;
    --surface-2: #232723;
    --text: #e9ece7;
    --muted: #9ca398;
    --border: #2e332e;
    --accent: #4fb06d;
    --accent-soft: #1d3324;
    --accent-text: #0c140e;
    --ok: #58b874;
    --warn: #e3a83f;
    --flag: #ee6b63;
    --ok-soft: #1c3022;
    --warn-soft: #362a14;
    --flag-soft: #3a1d1b;
    --error: #8e948b;
    --shadow: none;
    --focus: 0 0 0 3px rgba(79, 176, 109, 0.45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--deep);
  color: var(--on-deep);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 19px; text-decoration: none; letter-spacing: -0.035em; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { display: inline-flex; align-items: center; gap: 7px; }
.brand-version { margin-top: 1px; font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--on-deep-soft); }
.brand-version[hidden] { display: none; }
.stage-badge {
  margin-left: 2px; padding: 2px 7px; border: 1px solid var(--bright); border-radius: 999px;
  color: var(--bright); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.topbar .btn.primary { background: var(--bright); border-color: var(--bright); color: var(--deep); }
.topbar a:focus-visible { box-shadow: 0 0 0 3px rgba(79, 176, 109, 0.6); }

main { max-width: 1160px; margin: 0 auto; padding: 24px 20px 72px; }

.site-footer { max-width: 1160px; margin: -40px auto 0; padding: 8px 20px 40px; }
.support-card[hidden] { display: none; }
.legal-line { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.legal-links { display: block; margin-top: 4px; }
.legal-line a { color: inherit; }
.legal { max-width: 720px; }
.legal h1 { margin-bottom: 12px; }
.legal-section { margin-top: 20px; }
.legal-section h2 { margin-bottom: 6px; }
.legal p, .legal li { color: var(--text); }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0; padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.agree input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.support-card { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; align-items: stretch; padding: 20px;
  color: var(--on-deep); background: linear-gradient(160deg, var(--deep-2), var(--deep)); border-radius: var(--radius); }
.support-card h2, .support-card h3, .support-card p { margin: 0; }
.support-card p { font-size: 14px; color: var(--on-deep-soft); }
.support-intro { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.support-intro h2 { font-size: 21px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.2; }
.support-card .support-eyebrow { color: var(--bright); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.support-option { display: flex; flex-direction: column; justify-content: flex-start; gap: 12px 16px; padding: 14px 16px;
  border: 1px solid var(--on-deep-line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05); }
.support-option h3 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.support-option .btn.primary { background: var(--bright); border-color: var(--bright); color: var(--deep); }
.support-option .btn { align-self: flex-start; }
.support-option.qr { flex-direction: row; align-items: flex-start; } /* headings line up across the boxes */
.support-option.qr img { flex: none; width: 120px; height: 120px; border-radius: 4px; }
@media (max-width: 860px) { .support-card { grid-template-columns: 1fr; } }

h1 { font-size: 24px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -0.01em; }
.subtle { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--flag); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.segmented { gap: 0; }
.segmented .btn { border-radius: 0; margin-left: -1px; }
.segmented .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.segmented .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* "⋯" menu */
.menu { position: relative; }
.menu > summary { list-style: none; min-width: 40px; font-size: 18px; line-height: 1; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
}
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--flag); }

/* --- Page structure ------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { min-width: 0; }
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 24px; padding: 26px 28px; border-radius: var(--radius); color: var(--on-deep);
  background: radial-gradient(600px 260px at 50% 130%, rgba(88, 184, 116, 0.32), transparent 70%),
    linear-gradient(160deg, var(--deep-2), var(--deep)); }
.hero > * { position: relative; }
.hero h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; margin: 0 0 4px; }
.hero p { margin: 0; color: var(--on-deep-soft); }
/* Like the support card's eyebrow: the brand's voice, small and bright. */
.hero .hero-eyebrow { margin: 0 0 6px; color: var(--bright); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.hero-count { margin-top: 10px !important; font-size: 13px; }
.private-link { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  margin: -12px 0 20px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.private-link p { margin: 0; font-size: 14px; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@media (max-width: 640px) { .hero-art { display: none; } }
.hero .btn.primary { background: var(--bright); border-color: var(--bright); color: var(--deep); }
/* Actions stay on the right even when they wrap under the title, so the "⋯" menu
   (anchored to its right edge) opens on screen. */
.page-head > .actions { margin-left: auto; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 4px; }
.back:hover { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
details.panel > summary { cursor: pointer; }
details.panel[open] > summary { margin-bottom: 10px; }

.empty {
  text-align: center;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty p { margin: 0 auto 16px; color: var(--muted); max-width: 420px; }

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border-left: 4px solid var(--warn);
  margin-bottom: 16px;
}
.notice.error { background: var(--flag-soft); border-left-color: var(--flag); }
.clip-notes summary { cursor: pointer; font-weight: 600; }
.clip-notes ul { margin: 8px 0 0; padding-left: 18px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--error); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.flag { background: var(--flag); }
.dot.soon { background: transparent; border: 1.5px dashed var(--muted); width: 9px; height: 9px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Scorecard (8 checkpoints) ------------------------------------------- */
.scorecard { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  min-width: 0;
}
button.score-item { cursor: pointer; }
button.score-item:hover { background: var(--surface-2); }
.score-item.current { border-color: var(--accent); background: var(--accent-soft); }
.score-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  background: var(--error);
}
.score-dot.ok { background: var(--ok); }
.score-dot.warn { background: var(--warn); }
.score-dot.flag { background: var(--flag); }
.score-dot.error, .score-dot.missing, .score-dot.soon { background: transparent; color: var(--muted); border: 1.5px dashed var(--muted); }
.score-label { font-size: 11.5px; line-height: 1.2; text-align: center; color: var(--muted); overflow-wrap: anywhere; }
.score-item.current .score-label { color: var(--text); font-weight: 650; }
.scorecard.small { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.scorecard.small .score-item { padding: 0; }
.scorecard.small .score-dot { width: 20px; height: 20px; font-size: 10.5px; }

/* --- Swing summary ------------------------------------------------------- */
.summary { display: flex; flex-direction: column; gap: 14px; }
.summary .panel-head { margin-bottom: 0; }
.tally { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.tally-item { display: inline-flex; align-items: center; gap: 6px; }
.tally-item strong { color: var(--text); }
.focus { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); border-left: 4px solid var(--error); }
.focus.flag { background: var(--flag-soft); border-left-color: var(--flag); }
.focus.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.focus.ok { background: var(--ok-soft); border-left-color: var(--ok); }
.focus-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.focus-title { font-weight: 700; font-size: 16px; margin: 2px 0 4px; }
.focus-line { margin: 0 0 6px; font-size: 15px; }
.focus-line:last-of-type { margin-bottom: 12px; }
.not-marked { margin: 0; }

/* --- Results layout ------------------------------------------------------ */
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 20px; align-items: start; }
.side-col { position: sticky; top: 72px; }

/* Checkpoint stepper */
.step-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-heading { flex: 1; display: flex; gap: 10px; align-items: baseline; justify-content: center; font-size: 16px; }
.step-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.step-frame { display: block; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.step-frame img { display: block; width: 100%; }
.step-media { display: grid; gap: 8px; min-width: 0; }
.legend { font-size: 13px; color: var(--muted); }
.legend summary { cursor: pointer; }
.legend ul { list-style: none; margin: 8px 0 0; padding: 10px 12px; display: grid; gap: 6px;
  background: #1d221c; color: #e8ebe6; border-radius: var(--radius-sm); }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend .legend-note { margin: 8px 0 0; font-size: 12px; }
/* Swatches drawn like the key frames: on a dark chip so the white ones show in light mode. */
.legend .swatch-line { width: 26px; height: 0; border-top: 3px solid; flex: none; }
.legend .swatch-line.status { border-image: linear-gradient(90deg, #50c850 33%, #ffc800 33% 66%, #e63c3c 66%) 1; }
.legend .swatch-line.dashed { border-top: 3px dashed #fff; }
.legend .swatch-line.plane { border-color: #ff00ff; box-shadow: 0 -5px 0 -1px #969696, 0 5px 0 -1px #969696; }
.legend .swatch-line.past { border-color: #00ffff; }
.legend .mark { width: 12px; height: 12px; flex: none; margin: 0 7px; box-sizing: border-box; }
.legend .mark.circle { border-radius: 50%; background: #50c850; outline: 1.5px solid #fff; }
.legend .mark.square { background: #50c850; outline: 1.5px solid #fff; }
.legend .mark.ring { border-radius: 50%; border: 2px solid #fff; width: 14px; height: 14px; margin: 0 6px; }
.empty-frame { aspect-ratio: 9 / 16; display: grid; place-items: center; color: #aaa; font-size: 13px; text-align: center; padding: 12px; }

.verdict {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--error);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.verdict.ok { border-left-color: var(--ok); }
.verdict.warn { border-left-color: var(--warn); }
.verdict.flag { border-left-color: var(--flag); }
.verdict.soon { border-left-color: var(--border); border-left-style: dashed; }
.verdict-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.verdict-head h3 { margin: 0; font-size: 17px; }
.verdict-label { font-weight: 650; margin-top: 4px; }
.verdict-summary { margin: 4px 0 10px; color: var(--muted); }
.status-pill { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; color: #fff; background: var(--error); white-space: nowrap; }
.status-pill.ok { background: var(--ok); }
.status-pill.warn { background: var(--warn); }
.status-pill.flag { background: var(--flag); }
.status-pill.soon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tip { margin: 0 0 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 14px; }
.tip strong { margin-right: 2px; }

/* Measurement rows: dot, label, value; what it means (with the green/red limits) below. */
.rows { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.rows li {
  display: grid;
  grid-template-columns: 10px auto 1fr;
  grid-template-areas: "dot label value" ". note note" ". range range";
  column-gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
/* The row picked as the biggest issue (Work on first). */
.rows li.focus-row { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px; margin: 0 -8px; }
.rows li.focus-row .row-label { color: var(--text); font-weight: 700; }
.rows .dot { grid-area: dot; }
.rows .row-label { grid-area: label; color: var(--muted); }
.rows .row-value { grid-area: value; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.rows .row-note { grid-area: note; font-size: 13px; color: var(--muted); margin-top: 2px; }
.rows .row-note:empty { display: none; }
.rows .row-range { grid-area: range; font-size: 12px; color: var(--muted); margin-top: 2px; display: grid; gap: 1px; }
.rows .rng-good { color: var(--ok); }
.rows .rng-fix { color: var(--flag); }

.result-video { display: block; width: 100%; max-height: 72vh; background: #000; border-radius: var(--radius-sm); }
.phases-panel summary { cursor: pointer; }

.measurements, .phases { width: 100%; border-collapse: collapse; font-size: 14px; }
.measurements th, .measurements td, .phases th, .phases td { padding: 6px 0; border-top: 1px solid var(--border); text-align: left; }
.measurements th, .phases th { font-weight: 500; color: var(--muted); padding-right: 12px; }
.measurements td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.phases td { padding-right: 8px; font-variant-numeric: tabular-nums; }
.phases td:last-child { text-align: right; padding-right: 0; }
.phases + .btn, .phases ~ p { margin-top: 10px; }

.freeze-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.freeze { display: flex; flex-direction: column; gap: 4px; text-decoration: none; font-size: 13px; font-weight: 600; }
.freeze img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }

.adjuster { display: flex; flex-direction: column; gap: 8px; }
.adjuster p { margin: 0; }
.adjust-stage { background: #000; border-radius: var(--radius-sm); display: flex; justify-content: center; }
.adjust-frame { display: block; max-width: 100%; max-height: 50vh; }

/* --- History ------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.12s, border-color 0.12s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .thumb {
  aspect-ratio: 4 / 5;
  background: #0d0f0d center 20% / cover no-repeat;
  display: grid;
  place-items: center;
  color: #aaa;
  font-size: 13px;
}
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card .title { font-weight: 700; overflow-wrap: anywhere; }
.card .meta { display: flex; gap: 4px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.next-step { font-size: 13px; font-weight: 650; color: var(--accent); }

/* --- Upload -------------------------------------------------------------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.chosen { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.file-status { margin-top: 6px; }
.file-ok { color: var(--ok); font-weight: 650; overflow-wrap: anywhere; }
.dropzone-title { font-weight: 650; font-size: 16px; }
#file-input:focus-visible + .dropzone { box-shadow: var(--focus); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.choice:hover { border-color: var(--muted); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice:disabled { cursor: not-allowed; opacity: 0.6; }
.choice:disabled:hover { border-color: var(--border); }
.badge.soon { margin-top: 6px; }

.progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 560px; box-shadow: var(--shadow); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 10px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.3s ease; }
.bar-fill.indeterminate { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) {
  .bar-fill.indeterminate { animation: none; width: 100%; opacity: 0.4; }
  .card, .btn { transition: none; }
}

/* --- Marking ------------------------------------------------------------- */
.mark-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.mark-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mark-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: var(--on-deep);
  background: var(--deep);
  border-radius: var(--radius-sm);
}
/* The instruction: big and high-contrast, with what exactly to click under it. */
.camera-ok { margin: 0; font-size: 14px; font-weight: 600; color: var(--ok); }
.camera-check { margin: 0; }
.camera-check summary { cursor: pointer; font-weight: 700; }
.camera-check ul { margin: 8px 0; padding-left: 18px; font-size: 14px; }
.camera-check li + li { margin-top: 4px; }
.camera-check p { margin: 0; }
.hud-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hud-step { font-size: 12px; font-weight: 700; color: var(--bright); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-next { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.25; }
.hud-next .swatch { width: 18px; height: 18px; border-color: #fff; }
.hud-next .swatch.circle, .hud-next .swatch.square { background: radial-gradient(circle, #fff 0 2.5px, transparent 3px); }
.hud-next.done { color: var(--bright); }
.hud-hint { font-size: 15px; color: var(--on-deep-soft); }
.mark-hud .hud-btn { background: transparent; border-color: var(--on-deep-line); color: var(--on-deep); }
.mark-hud .hud-btn:hover { background: rgba(255, 255, 255, 0.08); }
.mark-hud .hud-btn:disabled { opacity: 0.4; }
.mark-hud .btn.primary { background: var(--bright); border-color: var(--bright); color: var(--deep); }
.mark-hud.flash { animation: hud-flash 0.7s ease-out; }
@keyframes hud-flash { from { box-shadow: 0 0 0 4px var(--bright); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .mark-hud.flash { animation: none; } }
.stage { display: flex; justify-content: center; background: #000; border-radius: var(--radius); overflow: hidden; }
.mark-canvas { display: block; cursor: crosshair; touch-action: none; max-width: 100%; }
.scrub-row { display: flex; align-items: center; gap: 6px; }
.scrub { flex: 1; min-width: 0; accent-color: var(--accent); height: 32px; }
.frame-label { font-variant-numeric: tabular-nums; }
.mark-side .panel h2 { margin-bottom: 4px; }
.step-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.step-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.step-tab:hover { background: var(--surface-2); }
.step-tab.selected { border-color: var(--accent); background: var(--accent-soft); }
.step-tab-state {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1;
}
.step-tab.started .step-tab-state { border-color: var(--accent); color: var(--accent); }
.step-tab.complete .step-tab-state { border-color: var(--ok); background: var(--ok); color: #fff; }
.step-tab.warned .step-tab-state { border-color: var(--warn); background: var(--warn); color: #fff; }
/* Marking: the suggested starting frame, the reference swing, and mark checks. */
.suggested-tag { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.suggested-tag[hidden] { display: none; }
.suggest-note { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.suggest-note[hidden] { display: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent, var(--ok)); text-decoration: underline; cursor: pointer; font: inherit; }
.linkish[hidden] { display: none; }
.ref-frame { margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.ref-frame[hidden] { display: none; }
.ref-frame a { position: relative; display: block; max-width: 220px; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.ref-head { margin-bottom: 8px; }
.ref-tag { position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.7);
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.ref-frame svg { display: block; width: 100%; height: auto; }

.mark-warnings p { margin: 0; }
.mark-warnings p + p { margin-top: 6px; }
.point-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.point-list li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.point-list li.next { border-color: var(--accent); background: var(--accent-soft); }
.point-list li.done .check { color: var(--ok); font-weight: 700; }
.point-list .check { font-size: 13px; color: var(--muted); }
/* Point swatches: the same shapes as on the frame (clubhead circle, hands square, ball ring). */
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text, #1d221c); flex: none; box-sizing: border-box; }
.swatch.circle, .swatch.square { background: radial-gradient(circle, var(--text, #1d221c) 0 2px, transparent 2.5px); }
.swatch.square { border-radius: 2px; }
.mark-side .notice { margin: 0 0 10px; }
.mark-side .actions { margin-bottom: 12px; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 960px) {
  .results-layout { grid-template-columns: 1fr; }
  .side-col { position: static; }
}
@media (max-width: 820px) {
  .mark-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .step-body { grid-template-columns: 1fr; }
  .step-frame { max-width: 360px; width: 100%; margin: 0 auto; }
  .legend { max-width: 360px; width: 100%; margin: 0 auto; }
  .scorecard.labeled { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; }
}
@media (max-width: 560px) {
  main { padding: 16px 14px 56px; }
  .topbar { padding: 8px 14px; }
  h1 { font-size: 21px; }
  .choices { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .body { padding: 8px 10px 10px; }
  .panel { padding: 14px; }
  .keys-hint { display: none; }
  .page-head { align-items: flex-start; }
}
@media (hover: none) {
  .keys-hint { display: none; }
}
.save-hint { margin: 6px 0 0; }
.save-hint:empty { display: none; }
