:root {
  --bg: #141414;
  --surface: #1f1f1e;
  --surface-2: #2c2c2a;
  --line: #2c2c2a;
  --text: #f1efe8;
  --muted: #8f8d86;
  --accent: #d85a30;
  --accent-soft: #f0997b;
  --accent-deep: #4a1b0c;
  --success: #5dcaa5;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }

.screen { flex: 1; padding: 16px 16px 96px; }
.screen.no-nav { padding-bottom: 24px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.h2 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 50px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 16px;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn[aria-busy="true"] { opacity: 0.7; pointer-events: none; }

/* loading */
.loader { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.reel { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* top bar */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-height: 32px; }
.back { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; }

/* continue card */
.continue { margin-top: 18px; border-radius: var(--radius); overflow: hidden; background: var(--surface); text-align: left; width: 100%; display: block; }
.poster { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; position: relative; }
.poster .play { width: 56px; height: 56px; border-radius: 50%; background: rgba(0, 0, 0, 0.35); display: flex; align-items: center; justify-content: center; color: var(--accent-soft); }
.poster .play .icon { width: 26px; height: 26px; }
.poster .badge { position: absolute; top: 10px; left: 10px; font-size: 12px; background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 6px; }
.continue .body { padding: 12px 14px 14px; }
.eyebrow { color: var(--accent-soft); font-size: 12px; font-weight: 500; }
.title { font-weight: 600; font-size: 16px; }

.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 2px; }

/* module posters row */
.row { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.mposter { flex: 0 0 128px; height: 176px; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; position: relative; }
.mposter .num { font-size: 30px; font-weight: 700; opacity: 0.35; line-height: 1; }
.mposter .name { font-weight: 600; font-size: 14px; }
.mposter .meta { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.mposter.soon { filter: saturate(0.3); }
.mposter .lock { position: absolute; top: 10px; right: 10px; opacity: 0.8; }

/* lists */
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; text-align: left; }
.item + .item { border-top: 0.5px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .sub { font-size: 13px; color: var(--muted); }
.state { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); flex-shrink: 0; color: var(--muted); }
.state.done { background: rgba(93, 202, 165, 0.15); color: var(--success); }
.state.next { background: var(--accent-deep); color: var(--accent-soft); }
.state .icon { width: 16px; height: 16px; }
.item[disabled] { opacity: 0.45; cursor: default; }

/* module header */
.mhead { border-radius: var(--radius); padding: 18px 16px; margin-bottom: 16px; }

/* lesson */
.video { border-radius: var(--radius); overflow: hidden; margin: 0 -4px 16px; }
.video .poster { background: #0b0b0b; }
.video .note { padding: 0 16px; text-align: center; font-size: 13px; color: var(--muted); }
.block { background: var(--surface); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.block h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent-soft); font-weight: 600; }
.block p { margin: 0; }
.block ul { margin: 0; padding-left: 18px; }
.block li + li { margin-top: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.file + .file { border-top: 0.5px solid var(--line); }

/* paywall */
.hero { border-radius: 18px; padding: 22px 18px; background: var(--accent-deep); margin-bottom: 18px; position: relative; overflow: hidden; }
.hero .strip { display: flex; gap: 6px; margin-bottom: 18px; }
.hero .strip span { flex: 1; height: 54px; border-radius: 6px; }
.notice { background: var(--surface); border-left: 3px solid var(--accent); padding: 12px 14px; margin-bottom: 16px; }
.perks { list-style: none; padding: 0; margin: 0 0 18px; }
.perks li { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; }
.perks .icon { color: var(--accent-soft); width: 18px; height: 18px; margin-top: 2px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.plan { background: var(--surface); border-radius: 12px; padding: 14px; text-align: left; border: 1.5px solid transparent; position: relative; }
.plan.sel { border-color: var(--accent); }
.plan .price { font-size: 19px; font-weight: 700; margin-top: 4px; }
.plan .tag { position: absolute; top: -9px; right: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }

/* profile */
.pcard { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-deep); color: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-size: 20px; font-weight: 700; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: rgba(93, 202, 165, 0.15); color: var(--success); }
.pill.bad { background: rgba(216, 90, 48, 0.18); color: var(--accent-soft); }
.demo { margin-top: 24px; border: 1px dashed var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.seg { display: flex; gap: 6px; margin-top: 8px; }
.seg button { flex: 1; height: 34px; border-radius: 8px; background: var(--surface); font-size: 13px; }
.seg button.on { background: var(--accent); color: #fff; }

/* bottom nav */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; background: rgba(20, 20, 20, 0.94); backdrop-filter: blur(12px);
  border-top: 0.5px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.nav button.on { color: var(--accent-soft); }
.nav .icon { width: 22px; height: 22px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--surface-2); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90%; text-align: center; z-index: 10; }
