:root {
  color-scheme: light;
  --bg: #f8f3e9;
  --ink: #1d2333;
  --muted: #5f6679;
  --line: rgba(29, 35, 51, 0.1);
  --card: rgba(255, 255, 255, 0.82);
  --shadow: 0 28px 70px rgba(29, 35, 51, 0.12);
  --accent: #ff6f3c;
  --accent-soft: #ffe1d3;
  --mint: #73c8a9;
  --navy: #243b7b;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 177, 124, 0.42), transparent 26rem),
    radial-gradient(circle at top right, rgba(115, 200, 169, 0.28), transparent 20rem),
    linear-gradient(180deg, #fff8ef, var(--bg));
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(29, 35, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 35, 51, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
}

.shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero, .stage-panel, .tool-links { position: relative; z-index: 1; }

.hero {
  display: grid;
  gap: 22px;
  align-items: end;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  margin-bottom: 24px;
}

.kicker, .eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 88px);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  font-size: 18px;
  line-height: 1.65;
  color: #4c5468;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-content: start;
}

.hero-badges span, .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 35, 51, 0.08);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(29, 35, 51, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.pill.good { background: #e3f6ec; border-color: rgba(47, 168, 79, 0.4); color: #1c6b3c; }
.pill.bad { background: #fde7e7; border-color: rgba(226, 59, 59, 0.35); color: #96261f; }
.pill.neutral { color: var(--muted); }

.stage-panel {
  padding: 24px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 18px;
}
.stage-toolbar h2 { margin: 0; letter-spacing: -0.03em; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(29, 35, 51, 0.14); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 14px 34px rgba(255, 111, 60, 0.35); }
.button.primary.big { padding: 16px 26px; font-size: 18px; }
.button.ghost { background: rgba(255, 255, 255, 0.7); }
.button.subtle { background: transparent; border-color: transparent; color: var(--muted); text-decoration: underline; }

.fineprint { color: var(--muted); font-size: 13px; line-height: 1.55; }
.fineprint.center { text-align: center; }

/* ------------------------------- scan ---------------------------------- */
.scan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 20px;
}

.camera-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #10141f;
  min-height: 320px;
}
.camera-wrap canvas { display: block; width: 100%; height: auto; }

.cam-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: #dfe5f1;
  padding: 20px;
}
.cam-empty strong { font-size: 20px; }
.cam-empty span { color: #9aa3b7; max-width: 380px; }

.scan-side { display: flex; flex-direction: column; gap: 16px; }

.scan-banner {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 111, 60, 0.35);
}
.scan-banner h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.35; }

.face-progress { display: flex; flex-wrap: wrap; gap: 8px; }
.face-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
}
.face-chip i {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(29, 35, 51, 0.15);
  border: 1px solid rgba(29, 35, 51, 0.2);
}
.face-chip.active { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 111, 60, 0.18); }
.face-chip.done { color: var(--ink); }

.scan-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------ review --------------------------------- */
.review-net {
  display: grid;
  grid-template-areas:
    ".  u  .  ."
    "l  f  r  b"
    ".  d  .  .";
  gap: 14px;
  justify-content: start;
  margin: 18px 0;
}
.net-face { display: flex; flex-direction: column; gap: 6px; }
.net-U { grid-area: u; } .net-L { grid-area: l; } .net-F { grid-area: f; }
.net-R { grid-area: r; } .net-B { grid-area: b; } .net-D { grid-area: d; }
.net-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.net-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}
.sticker {
  border-radius: 8px;
  border: 1px solid rgba(29, 35, 51, 0.35);
  cursor: pointer;
  padding: 0;
}
.sticker:not(:disabled):hover { outline: 3px solid rgba(255, 111, 60, 0.5); }
.sticker.center { cursor: default; box-shadow: inset 0 0 0 3px rgba(29, 35, 51, 0.25); }

/* ------------------------------- coach ---------------------------------- */
.coach-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.stage-list-panel h4, .net-panel h4 { margin: 0 0 10px; font-size: 15px; }
.stage-list {
  margin: 0; padding: 0;
  list-style: none;
  display: flex; flex-direction: column; gap: 8px;
}
.stage-list li {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.stage-list li.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.stage-list li.done { color: var(--ink); }
.stage-list li.done::after { content: " ✓"; color: var(--mint); font-weight: 900; }

.grip-note {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: #eef7ff;
  border: 1px solid rgba(36, 59, 123, 0.18);
  font-size: 13.5px;
  line-height: 1.5;
}
.grip-note strong { display: block; margin-bottom: 6px; }
.grip-note p { margin: 0; color: #41507a; }

.stage-banner { margin-bottom: 14px; }
.stage-banner h3 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.step-label { margin: 8px 0 0; font-weight: 700; color: var(--navy); }

.move-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(29, 35, 51, 0.12);
  padding: 26px;
  text-align: center;
}
.move-note {
  font-size: clamp(64px, 10vw, 110px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
}
.move-words { margin-top: 10px; font-size: 19px; font-weight: 600; line-height: 1.45; }

.alg-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 18px;
}
.alg-move {
  min-width: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font-weight: 800;
  color: var(--muted);
}
.alg-move.now { background: var(--accent); border-color: transparent; color: #fff; }
.alg-move.past { opacity: 0.45; text-decoration: line-through; }

.coach-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0 8px;
  flex-wrap: wrap;
}

.net-panel canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
}
.verify-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.done-banner {
  margin-top: 20px;
  padding: 26px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: #e3f6ec;
  border: 1px solid rgba(47, 168, 79, 0.4);
}
.done-banner h3 { margin: 0 0 8px; font-size: 30px; }
.done-banner p { margin: 0 0 16px; color: #2b5b40; }

/* ----------------------------- live coach ------------------------------- */
.coach-grid.live {
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr);
}
.camera-col { display: flex; flex-direction: column; gap: 12px; }

.watch-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill.watching { color: var(--navy); background: #eef7ff; border-color: rgba(36, 59, 123, 0.25); }
.pill.watching .eye {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}

.side-chips { display: inline-flex; gap: 6px; }
.side-chip {
  width: 20px; height: 20px;
  border-radius: 6px;
  opacity: 0.25;
  border: 1px solid rgba(29, 35, 51, 0.3);
}
.side-chip.seen { opacity: 1; box-shadow: 0 0 0 2px rgba(115, 200, 169, 0.8); }

.cam-label {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(16, 20, 31, 0.72);
  backdrop-filter: blur(4px);
  color: #fff;
  pointer-events: none;
}
.cam-label strong {
  font-size: 17px;
  letter-spacing: 0.06em;
  color: #ffd21e;
}
.cam-label span { font-size: 14px; color: #dfe5f1; font-weight: 600; }

.hint-box {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #fff8e1;
  border: 1px solid rgba(255, 180, 30, 0.45);
  font-size: 14px;
  line-height: 1.55;
  color: #6b5210;
}

.seen-flash {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-size: 120px;
  font-weight: 900;
  color: #73c8a9;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.seen-flash.pop { animation: pop 0.9s ease-out; }
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

.coach-side { display: flex; flex-direction: column; gap: 16px; }
.stage-list.compact li { cursor: pointer; }
.stage-list.compact li:hover { border-color: var(--accent); }

.checkpoint-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(29, 35, 51, 0.1);
  padding: 20px;
}
.checkpoint-card h3 { margin: 4px 0 8px; font-size: 24px; letter-spacing: -0.02em; }
.checkpoint-text { margin: 0 0 14px; font-size: 15.5px; line-height: 1.6; color: #3d4557; }

.chant-wrap { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.chant-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(36, 59, 123, 0.18);
  background: #f6f9ff;
  padding: 14px;
}
.chant-card h4 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }
.alg-strip.left { justify-content: flex-start; margin-top: 0; margin-bottom: 8px; }
.alg-sep { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 2px; }
.chant-lines { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: #3d4557; }
.chant-lines li.sep { list-style: none; margin-left: -18px; font-weight: 800; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

.coach-controls.left { justify-content: flex-start; margin: 6px 0 10px; }

/* ----------------------------- tool links ------------------------------- */
.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 4px 0;
}
.tool-links a {
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tool-links a:hover { color: var(--ink); border-color: var(--accent); }

/* ----------------------------- responsive ------------------------------- */
@media (max-width: 1020px) {
  .coach-grid { grid-template-columns: 1fr; }
  .scan-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-badges { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .net-grid { grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); }
  .review-net { gap: 8px; }
  .stage-panel { padding: 16px; }
}
