:root {
  --bg: #0b1020;
  --bg-alt: #121933;
  --surface: #171f3f;
  --text: #f6f8ff;
  --muted: #b8c0e2;
  --primary: #4f7dff;
  --primary-strong: #3764ea;
  --line: #2a3668;
  --success: #2ed7a3;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 12px 34px rgba(20, 29, 63, 0.28);
  --shadow-strong: 0 24px 60px rgba(15, 23, 55, 0.48);
}

:root[data-theme="light"] {
  --bg: #eef2ff;
  --bg-alt: #e5ebff;
  --surface: #ffffff;
  --text: #111b3a;
  --muted: #4f5a7f;
  --line: #d1daf8;
}
:root[data-accent="green"] { --primary: #2aa56f; --primary-strong: #1f8659; }
:root[data-accent="purple"] { --primary: #6e5ce6; --primary-strong: #5847cb; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg), #0f1630 35%, var(--bg));
  color: var(--text);
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.container { width: min(1140px, 92%); margin: 0 auto; }
.narrow { width: min(700px, 92%); }
.section { padding: 84px 0; }
.alt { background: rgba(255, 255, 255, 0.02); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.topbar { position: sticky; top: 0; z-index: 20; background: rgba(11, 16, 32, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 12px; }
.brand { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.language-select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 44px; }

.hero { padding: 92px 0 56px; }
.hero-grid { display: grid; gap: 28px; grid-template-columns: 1.3fr 1fr; align-items: stretch; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.12; margin: 12px 0; max-width: 19ch; }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.2rem); margin: 0 0 18px; }
h3 { margin: 0 0 8px; }

.hero-sub { color: var(--muted); max-width: 55ch; margin-bottom: 20px; }
.hero-list { margin: 0 0 18px 18px; padding: 0; color: #d8e2ff; }
.hero-list li { margin-bottom: 8px; }
.pill { background: rgba(79, 125, 255, 0.16); color: #ccdaff; border: 1px solid rgba(79, 125, 255, 0.45); border-radius: 999px; padding: 8px 12px; font-size: 0.85rem; display: inline-block; }
.social-proof { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 0.92rem; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-card { background: radial-gradient(circle at top right, #24357a 10%, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.hero-card, .card, .price-card { box-shadow: var(--shadow-soft); }
.hero-card:hover, .card:hover, .price-card:hover { transform: translateY(-2px); transition: transform 220ms ease, box-shadow 220ms ease; box-shadow: var(--shadow-strong); }
.hero-card ul { margin: 8px 0 0 16px; padding: 0; }
.hero-card li { margin-bottom: 10px; color: var(--muted); }
.trust-badges { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.trust-badges span { font-size: 0.78rem; color: #d3dcff; padding: 6px 10px; border-radius: 999px; border: 1px solid #3a4a83; background: #17224a; }

.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; padding: 10px 14px; text-decoration: none; border: 1px solid transparent; font-weight: 600; cursor: pointer; min-height: 44px; transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.btn-lg { padding: 13px 18px; font-size: 1.02rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-strong); box-shadow: 0 8px 20px rgba(70, 111, 245, 0.45); transform: translateY(-1px); }
.btn-secondary { background: #223167; color: #dbe4ff; border-color: #334385; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }

.card { background: linear-gradient(180deg, #1a2449, #141e40); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.grid-2, .grid-3, .grid-4, .steps, .pricing-grid, .dashboard-grid, .stats-grid { display: grid; gap: 14px; }
.steps { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.pricing-grid { grid-template-columns: repeat(3, 1fr); margin-top: 12px; }
.price-card { background: linear-gradient(180deg, #1b2750, #151f42); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.price-card ul { margin: 12px 0 18px 16px; padding: 0; color: var(--muted); }
.featured { border-color: #5d82ff; box-shadow: 0 0 0 1px rgba(93, 130, 255, 0.35), 0 14px 35px rgba(53, 86, 188, 0.28); transform: translateY(-4px); }
.badge { align-self: flex-start; background: #3f69f7; color: white; border-radius: 999px; padding: 5px 10px; font-size: 0.76rem; margin-bottom: 10px; }
.price { font-size: 2.05rem; margin: 8px 0; font-weight: 800; }
.save { color: var(--success); font-weight: 700; margin-top: -2px; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.microcopy { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }

.footer { border-top: 1px solid var(--line); padding: 24px 0 112px; }
.footer-inner { display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.footer-links { display: flex; gap: 12px; flex-wrap: wrap; }
.footer a { color: #d7e1ff; text-decoration: none; }

.onboarding-page { min-height: 100vh; display: flex; align-items: center; padding: 40px 0; }
.form-card label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-card { border-radius: var(--radius-lg); }
input, select { width: 100%; background: #101a3a; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hidden { display: none !important; }
.step { display: none; }
.step.active { display: block; }
.progress-wrap { margin-bottom: 16px; }
.progress { width: 100%; height: 10px; border-radius: 999px; background: #0f1732; border: 1px solid var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #4f7dff, #2ed7a3); transition: width 240ms ease; }

.dashboard-grid { grid-template-columns: 1.1fr 0.9fr; }
.dashboard-grid .chat { grid-column: 1 / -1; }
.todo-list { margin: 10px 0 0; padding: 0; list-style: none; }
.todo-list li { margin-bottom: 10px; }
.todo-list label { display: flex; gap: 10px; align-items: center; }
.todo-list input[type="checkbox"] { width: 22px; height: 22px; min-width: 22px; accent-color: #4f7dff; }
.todo-list li.completed span { color: #8fd3b8; text-decoration: line-through; }
.todo-list li.completed { animation: taskDone 240ms ease; }
.stats-grid { grid-template-columns: repeat(2, 1fr); }
.stats-grid > div { background: #101a3a; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 4px; }
.stats-grid strong { font-size: 1.4rem; }
.chat-messages { display: grid; gap: 10px; margin-bottom: 12px; }
.bubble { padding: 10px 12px; border-radius: 12px; max-width: 80%; }
.bubble.ai { background: #1a285b; border: 1px solid #2f4492; }
.bubble.user { background: #2a3f87; border: 1px solid #4765d6; margin-left: auto; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-actions .btn { font-size: 0.9rem; }
.bubble-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.timestamp { color: var(--muted); font-size: 0.8rem; }
.apply-btn { min-height: 36px; padding: 6px 10px; }
.applied-note { color: #8fd3b8; font-size: 0.78rem; }
.coach-structured p { margin: 0 0 8px; }
.coach-structured strong { color: #dbe5ff; }
.plan-change-card {
  margin-top: 8px;
  border: 1px solid #5066c6;
  border-radius: 10px;
  padding: 10px;
  background: #1b2a5d;
}
.plan-change-card h4 { margin: 0 0 6px; font-size: 0.9rem; }
.plan-change-card ul { margin: 0; padding-left: 16px; color: #d2dcff; }
.support-layout { display: grid; gap: 14px; }
.support-hero h1 { max-width: 26ch; }
.support-intake { display: grid; gap: 10px; }
.support-intake label { display: grid; gap: 6px; font-weight: 600; }
.tab-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.support-tab.active, .theme-btn.active { border-color: #7b9bff; background: #2a3f87; color: #fff; }
.theme-switch { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.theme-btn { justify-content: flex-start; text-align: left; }
.support-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.support-block { background: #101a3a; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.warning-box, .crisis-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #4a5b99;
  background: #172451;
  color: #dce5ff;
}
.crisis-box.critical {
  border-color: #a35574;
  background: #3a1f31;
  color: #ffddeb;
}
.crisis-box.show { display: block; }
.weekly-calendar {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 10px;
}
.workout-day { border: 1px solid #41569e; }
.workout-day.completed {
  border-color: #43b48f;
  background: linear-gradient(180deg, #1a3a4c, #173242);
}
.workout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.workout-top label { font-size: 0.9rem; color: var(--muted); }
.tag-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid #4d62b4;
  background: #1a2a5a;
  color: #dde5ff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
}
.workout-day .inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.workout-day .inline-actions .btn { min-height: 34px; font-size: 0.85rem; padding: 6px 10px; }
#bestExercisesPanel {
  margin-top: 10px;
  border: 1px solid #4b61b0;
}
#bestExercisesPanel h4 { margin: 0 0 6px; }
#bestExercisesPanel ul { margin: 0; padding-left: 16px; }

.reveal {
  opacity: 0;
  transform: translateY(12px);
}
.in-view {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 420ms ease, transform 420ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #8ab0ff;
  outline-offset: 2px;
}

@keyframes taskDone {
  0% { transform: scale(0.99); }
  100% { transform: scale(1); }
}

.mobile-sticky-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 16, 32, 0.2), rgba(11, 16, 32, 0.92));
  border-top: 1px solid var(--line);
}
.mobile-sticky-cta .btn { width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 920px) {
  .hero-grid, .steps, .grid-4, .grid-3, .pricing-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .featured { transform: none; }
  .hero { padding-top: 64px; }
  .section { padding: 56px 0; }
  .topbar-inner { min-height: 64px; }
  .language-select { max-width: 130px; }
  .hero-cta .btn { width: 100%; }
  .form-actions .btn { flex: 1; }
  .mobile-sticky-cta { display: block; }
  .footer { padding-bottom: 132px; }
  .dashboard-grid .chat { margin-bottom: 40px; }
  .support-grid { grid-template-columns: 1fr; }
  .weekly-calendar { grid-template-columns: 1fr; }
  .bubble { max-width: 100%; }
  .chat-actions .btn { flex: 1 1 calc(50% - 8px); }
}

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