*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #d6700a;
  --primary-light: #f59b3a;
  --primary-bg: rgba(214,112,10,0.09);
  --bg-app: #fdfcf9;
  --bg-page: #f8f7f5;
  --text-dark: #1a1a2e;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: rgba(214,112,10,0.1);
}

::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; }

body {
  font-family: 'Lexend', sans-serif;
  background: var(--bg-app);
  min-height: 100dvh;
}

/* PAGE SYSTEM */
.page { display: none; flex-direction: column; min-height: 100dvh; width: 100%; max-width: 430px; margin: 0 auto; }
.page.active { display: flex; }

/* ── HOME TOP BAR ── */
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  background: var(--bg-app);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(214,112,10,0.07);
}
.home-topbar-logo { color: var(--primary); font-size: 22px; display: flex; }
.home-topbar-title { color: var(--text-dark); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; flex: 1; text-align: center; }
.home-topbar-menu { color: #64748b; background: none; border: none; cursor: pointer; display: flex; }

/* ── PROGRESS CARD ── */
.progress-wrapper { padding: 16px; }
.progress-card {
  background: white;
  border-radius: 1rem;
  padding: 16px 18px;
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(214,112,10,0.06);
}
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-label { color: var(--text-dark); font-size: 0.9rem; font-weight: 600; }
.progress-pct { color: var(--primary); font-size: 0.9rem; font-weight: 700; }
.progress-track { height: 10px; border-radius: 9999px; background: rgba(214,112,10,0.15); overflow: hidden; }
.progress-fill { height: 10px; border-radius: 9999px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); width: 1%; }
.progress-text { color: var(--text-muted); font-size: 0.78rem; line-height: 1.5; margin-top: 10px; }

/* ── SECTION TITLE ── */
.section-title { color: var(--text-dark); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; padding: 16px 16px 8px; }

/* ── MODULE CARDS ── */
.modules-list { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 40px; }

.module-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fffdf9;
  padding: 14px;
  border-radius: 1rem;
  border: 1.5px solid rgba(214,112,10,0.07);
  cursor: pointer;
  transition: all 0.18s ease;
}
.module-card:hover { border-color: rgba(214,112,10,0.22); box-shadow: 0 4px 16px rgba(214,112,10,0.08); transform: translateY(-1px); }
.module-card:active { transform: scale(0.985); }

.module-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  border-radius: 14px;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  color: var(--primary);
  font-size: 30px;
}
.module-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.module-name { color: var(--text-dark); font-size: 0.95rem; font-weight: 700; line-height: 1.3; }
.module-desc { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; }
.module-chevron { color: var(--primary); flex-shrink: 0; font-size: 22px; }

/* ── EXERCISE PAGE HEADER ── */
.ex-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(248,247,245,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: rgba(214,112,10,0.08);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  color: var(--text-dark);
}
.back-btn:hover { background: rgba(214,112,10,0.18); }
.ex-header-title { color: var(--text-dark); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.ex-header-sub { color: var(--text-muted); font-size: 0.73rem; margin-top: 1px; }

/* ── EXERCISE CARDS ── */
.ex-main { display: flex; flex-direction: column; gap: 14px; padding: 16px; flex: 1; }

.exercise-card {
  background: white;
  border-radius: 1rem;
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: all 0.18s ease;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.exercise-card:hover { box-shadow: 0 4px 16px rgba(214,112,10,0.1); transform: translateY(-1px); }
.exercise-card.locked { filter: blur(1.5px); opacity: 0.55; pointer-events: none; user-select: none; }

.card-stripe { height: 5px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.card-stripe-gray { height: 5px; background: #e2e8f0; }

.card-body { padding: 14px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.card-top-left { display: flex; flex-direction: column; }

.card-title { color: var(--text-dark); font-size: 1rem; font-weight: 700; }
.card-time { display: flex; align-items: center; gap: 3px; color: var(--text-faint); font-size: 0.75rem; font-weight: 500; flex-shrink: 0; margin-left: 8px; }
.card-desc { color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; margin-bottom: 14px; }

.card-locked-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-locked-title { color: var(--text-faint); font-size: 1rem; font-weight: 700; }
.card-locked-sub { color: var(--text-faint); font-size: 0.82rem; }

/* ── DOWNLOAD BUTTON ── */
.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.75rem;
  padding: 12px 20px;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(214,112,10,0.25);
}
.btn-download:hover { background: #bf6208; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(214,112,10,0.35); }
.btn-download:active { transform: scale(0.98); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  transition: transform 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
