/* ── App shell ─────────────────────────────────────────────── */
#app { min-height: 0; }

/* ── CTA in hero ──────────────────────────────────────────── */
#hero-cta { margin-top: 48px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0a0e17;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.01em;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary.full-width { width: 100%; justify-content: center; margin-top: 32px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover { border-color: var(--fg-muted); color: var(--fg-primary); }

.btn-ghost {
  display: block; width: 100%;
  background: transparent; border: none;
  color: var(--fg-muted);
  font-size: 0.95rem;
  padding: 12px;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-ghost:hover { color: var(--fg-secondary); }

.btn-arrow { font-size: 1.1rem; }

.cta-note {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 14px;
  text-align: center;
}

/* ── Assessment overlay ───────────────────────────────────── */
.assessment-overlay, .loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  overflow-y: auto;
}

.assessment-card, .loading-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  overflow: hidden;
}

.assessment-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  background: none; border: none;
  color: var(--fg-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  transition: color 0.2s;
}
.back-btn:hover { color: var(--fg-primary); }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.step-counter {
  font-size: 0.8rem;
  color: var(--fg-muted);
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
}

.step-body {
  padding: 36px 28px 32px;
}
.step-icon {
  font-size: 2.4rem;
  margin-bottom: 16px;
}
.step-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.2;
}
.step-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* ── Form fields ──────────────────────────────────────────── */
.field-group { margin-bottom: 24px; }
.field-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rrx-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-card);
  outline: none;
  cursor: pointer;
}
.rrx-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  transition: box-shadow 0.2s;
}
.rrx-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.25);
}

.slider-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.rrx-select, .rrx-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-primary);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.rrx-select:focus, .rrx-input:focus {
  border-color: rgba(245, 158, 11, 0.4);
}

.rrx-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-primary);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  resize: vertical;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  transition: border-color 0.2s;
}
.rrx-textarea:focus { border-color: rgba(245, 158, 11, 0.4); }
.rrx-textarea::placeholder, .rrx-input::placeholder { color: var(--fg-muted); }

/* ── Chips ────────────────────────────────────────────────── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.chip:hover { border-color: rgba(245, 158, 11, 0.3); color: var(--fg-primary); }
.chip-selected {
  background: var(--accent-glow);
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--accent);
}

/* ── Loading screen ───────────────────────────────────────── */
.loading-card {
  text-align: center;
  padding: 56px 36px;
}
.loading-card h2 { margin-bottom: 12px; font-size: 1.5rem; }
.loading-sub { color: var(--fg-muted); font-size: 0.9rem; margin-bottom: 36px; }

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 32px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps { text-align: left; }
.loading-step {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  margin-bottom: 4px;
  transition: all 0.3s;
}
.loading-step.active {
  color: var(--fg-primary);
  background: var(--bg-card);
  padding-left: 20px;
}
.loading-step.done {
  color: var(--accent);
}
.loading-step.done::before { content: '✓ '; }
.loading-step.active::before { content: '→ '; color: var(--accent); }

/* ── Protocol page ────────────────────────────────────────── */
.protocol-page {
  min-height: 100vh;
  background: var(--bg-deep);
}

.protocol-loading {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}

.protocol-header {
  position: sticky; top: 0;
  background: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  padding: 0 24px;
}
.protocol-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.protocol-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-primary);
}
.protocol-nav { display: flex; gap: 8px; }
.nav-btn {
  background: none; border: none;
  color: var(--fg-muted);
  font-size: 0.9rem; font-weight: 500;
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.nav-btn:hover { color: var(--fg-primary); background: var(--bg-card); }
.nav-btn.active { color: var(--accent); background: var(--accent-glow); }
.nav-btn.secondary { color: var(--fg-muted); font-size: 0.82rem; }

.protocol-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ── Protocol hero row ────────────────────────────────────── */
.protocol-hero {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.protocol-hero-text { flex: 1; min-width: 260px; }
.protocol-hero-text h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
}
.protocol-summary { color: var(--fg-secondary); font-size: 0.95rem; line-height: 1.65; }

.score-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 5px 14px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 4px;
}

.checkin-done-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.82rem;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 5px 14px;
  border-radius: 100px;
}

/* Recovery score ring */
.recovery-score-ring {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: conic-gradient(var(--score-color) var(--score-pct, 60%), var(--bg-card) 0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.recovery-score-ring::before {
  content: '';
  position: absolute;
  width: 82px; height: 82px;
  background: var(--bg-deep);
  border-radius: 50%;
}
.score-inner {
  position: relative; z-index: 1;
  text-align: center;
}
.score-num {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem; font-weight: 700;
  line-height: 1;
}
.score-label-sm {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Modality panels ──────────────────────────────────────── */
.modalities-grid-v {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.modality-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.3s;
}
.modality-panel:hover { border-color: rgba(148, 163, 184, 0.15); }
.modality-complete { border-color: rgba(34, 197, 94, 0.2); }
.modality-complete .modality-progress { color: #22c55e; }

.modality-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 20px;
}
.modality-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }
.modality-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 4px;
}
.modality-headline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-primary);
  line-height: 1.3;
}
.modality-progress {
  margin-left: auto;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ── Task list ────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.task-item {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.task-item:hover { border-color: rgba(245, 158, 11, 0.2); }
.task-done {
  opacity: 0.6;
  background: rgba(34, 197, 94, 0.04);
  border-color: rgba(34, 197, 94, 0.15);
}

.task-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #22c55e;
  background: var(--task-done, transparent);
  transition: all 0.2s;
}
.task-done .task-check {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.task-content { flex: 1; min-width: 0; }
.task-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: 5px;
}
.task-duration {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
  margin-left: 8px;
  font-family: 'Space Grotesk', sans-serif;
}
.task-instruction {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.modality-tip {
  font-size: 0.83rem;
  color: var(--fg-secondary);
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-glow);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  line-height: 1.55;
  margin-top: 4px;
}

/* ── Protocol footer CTA ──────────────────────────────────── */
.protocol-footer-cta {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding-top: 8px;
}

/* ── Check-in form ────────────────────────────────────────── */
.checkin-card {
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
}
.checkin-card h1 { font-size: 1.8rem; margin-bottom: 10px; }

.checkin-task-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}
.checkin-task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--fg-secondary);
}
.checkin-task-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.task-modality-tag {
  margin-left: auto;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-muted);
  font-family: 'Space Grotesk', sans-serif;
}

/* ── Toast ────────────────────────────────────────────────── */
.rrx-toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-primary);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.9rem;
  z-index: 999;
  pointer-events: none;
  animation: fadeInUp 0.3s ease;
  white-space: nowrap;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Error card ───────────────────────────────────────────── */
.error-card {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
  color: var(--fg-secondary);
}
.error-card a { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .modalities-grid-v { grid-template-columns: 1fr; }
  .protocol-hero { gap: 24px; }
}
@media (max-width: 600px) {
  .protocol-header { padding: 0 16px; }
  .protocol-main { padding: 32px 16px 60px; }
  .checkin-card { padding: 28px 20px; border-radius: 16px; }
  .step-body { padding: 28px 20px 24px; }
  .protocol-footer-cta { flex-direction: column; }
  .nav-btn.secondary { display: none; }
}
