/* ---------- Tokens ---------- */
:root {
  --bg: #F7F7F4;
  --surface: #FFFFFF;
  --surface-2: #F1F1ED;
  --text: #16161A;
  --muted: #6A6A74;
  --border: #E5E5DF;
  --accent: #5B4CF0;
  --accent-hover: #4A3BE0;
  --accent-soft: #EEEBFF;
  --accent-ink: #FFFFFF;
  --success: #15803D;
  --success-soft: #E6F6EC;
  --danger: #C62828;
  --danger-soft: #FDECEC;
  --warn-soft: #FFF5DC;
  --shadow: 0 1px 2px rgba(16,16,24,.04), 0 10px 30px rgba(16,16,24,.06);
  --shadow-lg: 0 24px 60px rgba(16,16,24,.18);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E11; --surface: #17171B; --surface-2: #212127; --text: #EDEDF1; --muted: #9D9DA8;
    --border: #2B2B32; --accent: #8E83FF; --accent-hover: #A39AFF; --accent-soft: #24204A; --accent-ink: #0E0E11;
    --success: #4ADE80; --success-soft: #10291A; --danger: #F87171; --danger-soft: #2B1414; --warn-soft: #2A2311;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E11; --surface: #17171B; --surface-2: #212127; --text: #EDEDF1; --muted: #9D9DA8;
  --border: #2B2B32; --accent: #8E83FF; --accent-hover: #A39AFF; --accent-soft: #24204A; --accent-ink: #0E0E11;
  --success: #4ADE80; --success-soft: #10291A; --danger: #F87171; --danger-soft: #2B1414; --warn-soft: #2A2311;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; outline: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
p { margin: 0; }
img, svg { display: block; }
.muted { color: var(--muted); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.icon { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border);
}
.topbar-inner { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-weight: 800; font-size: 17px;
}
.brand-chip {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); vertical-align: 2px; margin-left: 2px;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link { padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: 15px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.count { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.icon-btn {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted); list-style: none;
}
.icon-btn:hover { color: var(--text); }
.icon-btn::-webkit-details-marker { display: none; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 44px; width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; gap: 2px;
}
.menu-pop button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; font-size: 14px; }
.menu-pop button:hover, .menu-link:hover { background: var(--surface-2); }
.menu-link { padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }
.menu-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.menu-note { font-size: 12px; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------- Buttons & badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px;
  border-radius: 99px; background: var(--surface-2); color: var(--muted);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge .icon { width: 13px; height: 13px; }

/* ---------- Covers ---------- */
.cover {
  position: relative; aspect-ratio: 4/3; border-radius: var(--radius-sm); overflow: hidden;
  display: grid; place-items: center; color: rgba(255,255,255,.95); isolation: isolate;
}
.cover::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,.7) 0 2px, transparent 3px);
  background-size: 22px 22px;
}
.cover::after {
  content: ""; position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%; right: -18%; bottom: -30%;
  background: rgba(255,255,255,.18); z-index: -1;
}
.cover .icon { width: 44%; height: auto; max-width: 96px; stroke-width: 1.4; filter: drop-shadow(0 8px 16px rgba(0,0,0,.18)); }
.cover-label { position: absolute; left: 14px; bottom: 12px; font-weight: 700; font-size: 13px; letter-spacing: .02em; text-shadow: 0 1px 8px rgba(0,0,0,.2); }
.cover-pdf { background: linear-gradient(140deg, #FBBF24, #F97316 70%, #EA580C); }
.cover-video { background: linear-gradient(140deg, #F472B6, #A855F7 60%, #6D28D9); }
.cover-course { background: linear-gradient(140deg, #2DD4BF, #3B82F6 55%, #4F46E5); }

/* ---------- Storefront ---------- */
.hero { padding: 48px 0 28px; display: flex; gap: 24px; align-items: center; }
.avatar {
  width: 88px; height: 88px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 30px; color: #fff; background: linear-gradient(135deg, #5B4CF0, #C026D3);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border);
}
.hero h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.hero p { color: var(--muted); max-width: 560px; margin-top: 6px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 20px 0 16px; gap: 12px; }
.section-head h2 { font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 14px; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-card .body { padding: 0 6px 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { font-size: 18px; }
.product-card .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.price { font-weight: 700; font-size: 18px; }
.trust { display: flex; flex-wrap: wrap; gap: 22px; padding: 36px 0 56px; color: var(--muted); font-size: 14px; }
.trust span { display: flex; align-items: center; gap: 8px; }

/* ---------- Product page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: 14px; margin: 24px 0 16px; }
.back:hover { color: var(--text); }
.pp { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; padding-bottom: 64px; }
.pp .cover { aspect-ratio: 16/8; border-radius: var(--radius); }
.pp h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 800; margin-top: 24px; }
.pp .lead { font-size: 18px; color: var(--muted); margin-top: 8px; }
.pp h2 { font-size: 20px; margin: 36px 0 14px; }
.benefits { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.benefits li { display: flex; gap: 10px; align-items: flex-start; }
.benefits .icon { color: var(--success); margin-top: 3px; }
.outline { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.outline-mod { padding: 14px 18px; border-top: 1px solid var(--border); }
.outline-mod:first-child { border-top: 0; }
.outline-mod h4 { font-size: 15px; display: flex; justify-content: space-between; gap: 10px; }
.outline-mod ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.outline-mod li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.outline-mod li .grow { flex: 1; }
.outline-mod li a { color: var(--accent); font-weight: 600; }
.buy-card {
  position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.buy-card .price { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.buy-card .price small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; letter-spacing: 0; }
.buy-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; color: var(--muted); }
.buy-list li { display: flex; gap: 10px; align-items: center; }
.quote { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.quote p { font-size: 15px; }
.quote .who { margin-top: 10px; font-size: 13px; color: var(--muted); }
.stars { color: #F59E0B; letter-spacing: 2px; font-size: 14px; }
details.faq { border-top: 1px solid var(--border); padding: 14px 0; }
details.faq:last-child { border-bottom: 1px solid var(--border); }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { color: var(--muted); margin-top: 8px; }

/* ---------- Library ---------- */
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 6px; }
.continue {
  margin: 24px 0; display: flex; align-items: center; gap: 18px; padding: 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 80%); border: 1px solid var(--border);
}
.continue .cover { width: 120px; aspect-ratio: 4/3; flex: none; }
.continue .cover .icon { max-width: 42px; }
.continue .txt { flex: 1; min-width: 0; }
.continue .eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.continue h3 { font-size: 18px; margin-top: 4px; }
.lib-card { cursor: pointer; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.progress-row .progress { flex: 1; }
.empty {
  text-align: center; padding: 64px 16px; border: 1px dashed var(--border); border-radius: var(--radius); margin: 24px 0 64px;
  display: grid; justify-items: center; gap: 12px;
}
.empty .icon { width: 40px; height: 40px; color: var(--muted); }
.orders { margin: 40px 0 64px; }
.orders h2 { font-size: 20px; margin-bottom: 6px; }
.orders > p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
.table th { border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table td.num { font-variant-numeric: tabular-nums; }

/* ---------- Viewer (PDF/Video) ---------- */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; padding-bottom: 64px; align-items: start; }
.viewer h1 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; }
.viewer .sub { color: var(--muted); margin-top: 6px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.file {
  display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.file + .file { margin-top: 10px; }
.file-ico { width: 46px; height: 56px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 800; position: relative; }
.file-ico::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 12px 12px 0; border-style: solid; border-color: var(--bg) var(--bg) color-mix(in srgb, var(--danger) 30%, transparent) color-mix(in srgb, var(--danger) 30%, transparent); }
.file .meta { flex: 1; min-width: 0; }
.file .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta span { font-size: 13px; color: var(--muted); }
.pdf-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 24px; }
.page-thumb {
  aspect-ratio: 1/1.414; background: #fff; color: #16161A; border-radius: 6px; box-shadow: var(--shadow); padding: 12px;
  display: flex; flex-direction: column; gap: 6px; font-size: 7px; overflow: hidden; position: relative;
}
.page-thumb .bar { height: 26%; margin: -12px -12px 6px; background: linear-gradient(140deg, #FBBF24, #F97316); }
.page-thumb .t { font-size: 11px; font-weight: 800; line-height: 1.1; }
.page-thumb .l { height: 4px; background: #E8E8E3; border-radius: 2px; }
.page-thumb .box { border: 1px solid #E2E2DC; border-radius: 3px; height: 18px; }
.page-thumb .wm { position: absolute; bottom: 6px; left: 12px; right: 12px; font-size: 5.5px; color: #9a9a9a; }
.page-thumb.locked { filter: blur(1.5px); opacity: .55; }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 14px; margin-top: 16px; }
.note .icon { margin-top: 2px; }

.video-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: linear-gradient(140deg, #1d1530, #0b0b10); aspect-ratio: 16/9; box-shadow: var(--shadow); }
.video-wrap video { width: 100%; height: 100%; display: block; object-fit: cover; }
.video-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; padding: 20px; font-size: 14px; }
.resume-chip { position: absolute; left: 14px; top: 14px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 99px; backdrop-filter: blur(6px); }
.chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.chapters button {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border-radius: 10px; border: 0; background: none;
}
.chapters button:hover { background: var(--surface-2); }
.chapters button.active { background: var(--accent-soft); color: var(--accent); }
.chapters .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); width: 44px; flex: none; }
.chapters button.active .time { color: var(--accent); }

/* ---------- Course player ---------- */
.course { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.toc { border-right: 1px solid var(--border); background: var(--surface); padding: 20px 14px 40px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; }
.toc-head { padding: 0 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.toc-head h2 { font-size: 17px; margin: 8px 0 12px; }
.toc-mod { margin-top: 14px; }
.toc-mod-title { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toc a {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; font-size: 14px; margin-top: 2px;
}
.toc a:hover { background: var(--surface-2); }
.toc a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc a .dur { margin-left: auto; font-size: 12px; color: var(--muted); }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); flex: none; display: grid; place-items: center; }
.dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.dot.done .icon { width: 12px; height: 12px; stroke-width: 3; }
.lesson { padding: 32px clamp(16px, 4vw, 56px) 80px; max-width: 900px; width: 100%; }
.lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toc-toggle { display: none; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.lesson h1 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 800; margin: 6px 0 22px; }
.prose { font-size: 17px; line-height: 1.7; }
.prose p + p { margin-top: 14px; }
.prose h3 { font-size: 19px; margin: 28px 0 10px; }
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; font-size: 15px; }
.mini-card .n { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; margin-bottom: 10px; }
.mini-card strong { display: block; margin-bottom: 4px; }
.callout { display: flex; gap: 12px; padding: 16px; border-radius: 14px; background: var(--accent-soft); margin: 20px 0; font-size: 15px; }
.callout .icon { color: var(--accent); margin-top: 2px; }
.lesson-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.checklist { display: grid; gap: 8px; margin: 18px 0; }
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.check.on { border-color: color-mix(in srgb, var(--success) 50%, transparent); background: var(--success-soft); }
.check.on span { text-decoration: line-through; color: var(--muted); }
textarea, input[type="email"], input[type="text"] {
  width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 110px; resize: vertical; }
textarea:focus, input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.quiz-q { margin: 22px 0; }
.quiz-q h3 { font-size: 17px; margin-bottom: 10px; }
.opt {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); margin-top: 8px; transition: border-color .15s, background .15s;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt .key { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.opt.correct { border-color: var(--success); background: var(--success-soft); }
.opt.correct .key { background: var(--success); color: #fff; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt.wrong .key { background: var(--danger); color: #fff; }
.opt:disabled { cursor: default; }
.explain { font-size: 14px; color: var(--muted); margin-top: 8px; padding-left: 4px; }
.score { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.score .big { font-size: 28px; font-weight: 800; color: var(--accent); }
.finish-hero { text-align: center; padding: 32px 16px; border-radius: var(--radius); background: linear-gradient(140deg, var(--accent-soft), var(--surface)); border: 1px solid var(--border); }
.finish-hero .trophy { width: 64px; height: 64px; margin: 0 auto 12px; color: var(--accent); }
.locked-box { text-align: center; padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); display: grid; gap: 12px; justify-items: center; }

.comments { margin-top: 44px; }
.comments h2 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.comment .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; background: var(--surface-2); }
.comment .av.creator { background: linear-gradient(135deg, #5B4CF0, #C026D3); color: #fff; }
.comment .who { font-size: 14px; font-weight: 600; }
.comment .who small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.comment p { font-size: 15px; margin-top: 2px; }
.comment-form { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.comment-form textarea { min-height: 48px; height: 48px; }

.preview-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--warn-soft); margin-bottom: 18px; font-size: 14px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(10,10,16,.5); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: fade .2s var(--ease);
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface);
  border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .25s var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.sum { display: flex; gap: 14px; align-items: center; }
.sum .cover { width: 64px; aspect-ratio: 1; flex: none; border-radius: 12px; }
.sum .cover .icon { max-width: 28px; }
.sum .cover::after, .sum .cover::before, .continue .cover::after { display: none; }
.sum .cover-label, .continue .cover-label { display: none; }
.sum strong { display: block; }
.sum span { font-size: 13px; color: var(--muted); }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pay-methods label {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.pay-methods input { accent-color: var(--accent); }
.pay-methods label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.consent { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.legal-box { background: var(--surface-2); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.total { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; }
.small { font-size: 12px; color: var(--muted); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto; }
.success-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; margin: 0 auto; animation: pop .35s var(--ease); }
.success-ico .icon { width: 32px; height: 32px; stroke-width: 2.5; }
.mail {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; font-size: 14px;
}
.mail-head { background: var(--surface-2); padding: 10px 14px; font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.mail-body { padding: 14px; display: grid; gap: 8px; }
.center { text-align: center; }

/* ---------- Toast & confetti ---------- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: rise .25s var(--ease);
}
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
body.in-course .footer { display: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .pp, .viewer { grid-template-columns: 1fr; gap: 24px; }
  .buy-card { position: static; }
  .course { grid-template-columns: 1fr; }
  .toc {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; height: 100vh; width: min(340px, 88vw);
    transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg);
  }
  .toc.open { transform: none; }
  .toc-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(10,10,16,.45); }
  .toc-toggle { display: inline-flex; }
  .cards-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: flex-start; padding-top: 32px; }
  .avatar { width: 72px; height: 72px; font-size: 24px; }
  .brand-text { display: none; }
  .nav-link { padding: 8px; font-size: 14px; }
  .continue { flex-direction: column; align-items: stretch; }
  .continue .cover { width: 100%; aspect-ratio: 16/6; }
  .lesson-actions { flex-direction: column-reverse; }
  .lesson-actions .btn { width: 100%; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-top: 1px solid var(--border); padding: 8px 0; }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 4px 14px; }
  .pay-methods { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; }
}
