:root {
  --bg: #0b0d0c;
  --surface: #131714;
  --surface-2: #191e1a;
  --line: #273029;
  --text: #f6f8f6;
  --muted: #9ca69f;
  --accent: #a7ff4f;
  --accent-2: #d7ffb1;
  --danger: #ff8b8b;
  --shadow: 0 20px 60px rgba(0,0,0,.32);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}
button, input, video { font: inherit; }
a { color: inherit; }

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .12;
  pointer-events: none;
  z-index: -1;
}
.ambient-one { width: 420px; height: 420px; background: var(--accent); top: -170px; right: -100px; }
.ambient-two { width: 360px; height: 360px; background: #38ff91; bottom: 0; left: -180px; opacity: .07; }

.wrap { width: min(1040px, calc(100% - 32px)); margin-inline: auto; }
.hero { padding: 54px 0 32px; }
.hero-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(40px, 7vw, 72px); line-height: .98; letter-spacing: -.045em; }
h1 span { font-size: .72em; }
.hero-copy { max-width: 640px; margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.api-badge { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--line); background: rgba(19,23,20,.7); border-radius: 999px; color: var(--muted); font-size: 13px; }
.api-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffcb68; box-shadow: 0 0 0 4px rgba(255,203,104,.08); }
.api-badge.online .api-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(167,255,79,.09); }
.api-badge.offline .api-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,139,139,.08); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 5px; gap: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; position: sticky; top: 10px; z-index: 10; box-shadow: 0 10px 35px rgba(0,0,0,.24); }
.tab { border: 0; color: var(--muted); background: transparent; min-height: 48px; border-radius: 12px; cursor: pointer; font-weight: 800; transition: .2s ease; }
.tab:hover { color: var(--text); background: #1d231e; }
.tab.active { color: #071006; background: var(--accent); }

.summary { margin: 22px 0 14px; padding: 18px 20px; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(167,255,79,.08), rgba(19,23,20,.74)); border-radius: var(--radius); }
.summary-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.summary h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.summary p { margin: 5px 0 0; color: var(--muted); }
.progress { color: var(--accent); font-size: 13px; font-weight: 800; white-space: nowrap; }

.workout-list { display: grid; gap: 12px; }
.exercise-card { border: 1px solid var(--line); background: rgba(19,23,20,.9); border-radius: var(--radius); padding: 17px; transition: border-color .2s ease, transform .2s ease, opacity .2s ease; }
.exercise-card:hover { border-color: #3b493e; transform: translateY(-1px); }
.exercise-card.completed { opacity: .66; }
.exercise-card.completed .exercise-name { text-decoration: line-through; text-decoration-thickness: 1px; }
.card-head { display: grid; grid-template-columns: 46px 1fr auto; align-items: start; gap: 13px; }
.index-pill { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); font-weight: 900; }
.exercise-name { margin: 0; font-size: 18px; line-height: 1.22; }
.prescription { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.done-button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.done-button:hover { border-color: var(--accent); color: var(--accent); }
.exercise-card.completed .done-button { background: var(--accent); border-color: var(--accent); color: #081006; }

.movements { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); display: grid; gap: 9px; }
.movement { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 45px; }
.movement-info { min-width: 0; }
.movement-label { display: block; font-weight: 720; font-size: 14px; }
.movement-note { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.video-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; border: 0; background: #242c25; color: var(--accent-2); padding: 10px 12px; border-radius: 11px; font-size: 12px; font-weight: 850; cursor: pointer; transition: .2s ease; }
.video-button:hover { background: var(--accent); color: #071006; }
.video-button::before { content: "▶"; font-size: 9px; }

.notice { margin-top: 20px; padding: 16px 18px; color: var(--muted); background: #111411; border: 1px dashed #313a32; border-radius: 16px; font-size: 13px; }
.notice strong { color: var(--text); }
.footer { padding: 30px 0 50px; color: #707970; font-size: 12px; text-align: center; }
.footer a { color: #9eaa9f; }

.video-modal { border: 0; padding: 0; color: var(--text); background: transparent; max-width: none; max-height: none; width: min(760px, calc(100% - 24px)); }
.video-modal::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(6px); }
.modal-shell { background: #101310; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; gap: 20px; padding: 20px 20px 15px; }
.modal-head h2 { margin: 0; font-size: 24px; }
.modal-match { min-height: 20px; margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.close-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 26px; line-height: 1; cursor: pointer; }
.media-stage { position: relative; min-height: 340px; display: grid; place-items: center; background: #050605; overflow: hidden; }
.media-stage video, .media-stage img { display: none; width: 100%; max-height: 65vh; object-fit: contain; background: #050605; }
.loader { display: grid; place-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.loader span { width: 34px; height: 34px; border: 3px solid #2a322b; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-media { display: none; text-align: center; padding: 40px 22px; color: var(--muted); }
.empty-media strong { display: block; color: var(--text); margin-top: 10px; }
.empty-media p { max-width: 430px; margin: 7px auto 0; }
.empty-icon { width: 60px; height: 60px; border-radius: 50%; margin: auto; display: grid; place-items: center; background: #1b211c; color: var(--accent); }
.modal-info { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px 20px; }
.attribution { margin: 0; color: var(--muted); font-size: 11px; }
.source-link { flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 800; text-decoration: none; }

@media (max-width: 680px) {
  .hero { padding-top: 36px; }
  .hero-inner { align-items: flex-start; flex-direction: column; }
  .api-badge { margin-top: -4px; }
  .wrap { width: min(100% - 22px, 1040px); }
  .tabs { top: 6px; }
  .summary-top { align-items: flex-start; }
  .card-head { grid-template-columns: 42px 1fr auto; gap: 10px; }
  .index-pill { width: 42px; height: 42px; }
  .exercise-name { font-size: 16px; }
  .movement { align-items: flex-start; }
  .video-button { padding: 9px 10px; }
  .media-stage { min-height: 280px; }
  .modal-info { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
