:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #0f1222;
  --muted: #6b7280;
  --primary: #6159ff;
  --primary-600: #4a43e6;
  --accent: #22c55e;
  --border: #e5e7eb;
  --shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}

[data-theme="dark"] {
  --bg: #0b0f1a;
  --card: #101627;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --primary: #7c6cff;
  --primary-600: #6a5bff;
  --accent: #34d399;
  --border: #1f2937;
  --shadow: 0 10px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
button { font: inherit; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(97,89,255,0.15) 0%, transparent 50%),
    radial-gradient(800px 600px at 110% 10%, rgba(34,197,94,0.15) 0%, transparent 50%),
    var(--bg);
  transition: background .3s ease, color .2s ease;
}

.container {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--card), transparent 20%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand { font-weight: 700; }
.userbar { display:flex; align-items:center; gap:8px; }
.badge {
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2ff; color: #1f2a6b; font-weight: 700;
  border: 1px solid var(--border);
}
.hero-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  text-align: center;
}
.hero-title {
  font-size: clamp(28px, 5vw, 44px);
  margin: 0 0 6px;
}
.hero-title span { color: var(--primary); }
.hero-tag { font-size: clamp(16px, 2.4vw, 20px); margin: 0 0 6px; }
.hero-sub { margin: 0 auto; max-width: 720px; }

.features {
  display: grid; gap: 14px; margin-top: 14px;
  grid-template-columns: 1fr; 
}
@media (min-width: 760px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--card);
}
.feature-icon { font-size: 26px; line-height: 1; color: var(--primary); }
.feature-icon svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.feature-title { font-weight: 800; margin-top: 4px; }
.feature-text { color: var(--muted); font-size: 14px; }

/* Lottie adjustments */
.hero-anim { display: grid; place-items: center; }
.hero-lottie { width: min(480px, 80vw); height: auto; }
.icon-lottie { width: 28px; height: 28px; }

/* Scroll reveal */
[data-reveal] { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
[data-reveal].visible { opacity: 1; transform: translateY(0); }

/* Footer strip */
.strip { text-align: center; padding: 16px; }

/* Exercise selection cards */
.exercises { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 760px) { .exercises { grid-template-columns: repeat(3, 1fr); } }
.exercise-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.exercise-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary), var(--border) 70%); }
.exercise-card .emoji { font-size: 26px; line-height: 1; }
.exercise-card .name { font-weight: 800; }
.exercise-card .desc { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  animation: fadeUp .35s ease both;
}

.card-header { margin-bottom: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap { gap: 10px; }

/* Collapsible */
.collapsible { overflow: hidden; }
.collapsible-header { display:flex; align-items:center; justify-content: space-between; cursor: pointer; }
.collapsible-header .chev { transition: transform .2s ease; }
.collapsible.open .collapsible-header .chev { transform: rotate(180deg); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height .3s ease, opacity .25s ease; opacity: .0; }
.collapsible.open .collapsible-content { max-height: 600px; opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 880px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.video-wrap { display: flex; justify-content: center; }
.hidden { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }

.btn-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--border), transparent 60%);
}

.btn-chip {
  background: color-mix(in srgb, var(--primary), #ffffff 85%);
  border-color: color-mix(in srgb, var(--primary), #ffffff 70%);
  color: color-mix(in srgb, var(--primary), #000000 35%);
}
.btn-toggle.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 80%); }

.actions { display: flex; gap: 8px; justify-content: flex-end; }
.actions.center { justify-content: center; }

.table { display: grid; gap: 6px; }
.table-head, .table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.table-head { background: #f3f4f6; font-weight: 600; }
[data-theme="dark"] .table-head { background: #111827; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: #fafafa; border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.stat-number { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; }

.modal {
  border: none;
  padding: 0;
  background: transparent;
}
.modal::backdrop {
  background: rgba(0,0,0,.4);
}
.modal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: min(600px, calc(100% - 32px));
  margin: 10vh auto;
  box-shadow: 0 20px 40px rgba(0,0,0,.1);
}
[data-theme="dark"] .modal-card { background: var(--card); }
.row.gap > * { margin-right: 8px; }

/* Auth */
.auth-card {
  background: linear-gradient(120deg, #ffffff 40%, #f9fafe 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 14px 30px rgba(79,70,229,0.06);
}
[data-theme="dark"] .auth-card { background: linear-gradient(120deg, #0f1629 40%, #0c1222 100%); }
.hero h1 { margin: 0 0 6px; }
.form { margin-top: 10px; }
.field { display: flex; flex-direction: column; min-width: 240px; }
.field label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: #fff; color: var(--text);
}
[data-theme="dark"] .input { background: #0e1425; }

/* Header actions */
.topbar .btn + .badge { margin-left: 4px; }

/* Exercise UI */
.progress { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
[data-theme="dark"] .progress { background: #111827; }
.progress > .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .25s ease; }

.video-wrap { position: relative; }
.floating-controls {
  position: absolute; top: 10px; left: 10px; display: flex; gap: 8px;
  background: color-mix(in srgb, var(--card), transparent 10%);
  border: 1px solid var(--border); padding: 6px; border-radius: 12px; box-shadow: var(--shadow);
}
.floating-controls .btn { padding: 6px 10px; font-size: 12px; }
.mirror { transform: scaleX(-1); }

.rep-info-animated { display: inline-block; }
.rep-info-animated.pulse { animation: pulse .3s ease; }

@keyframes pulse { from { transform: scale(1.0); } 50% { transform: scale(1.08); } to { transform: scale(1.0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
