:root {
  --navy: #3d2f5c;
  --navy-2: #5a4a86;
  --ink: #2b2740;
  --muted: #6b6785;
  --mint: #7c62e8;
  --mint-2: #6a4fd8;
  --mint-soft: #efeafe;
  --sky: #5bb8f5;
  --sky-soft: #e4f3fd;
  --grad: linear-gradient(135deg, #c3e7fd 0%, #d9cffc 100%);
  --coral: #e2603f;
  --coral-soft: #fcece6;
  --bg: #f6f5fd;
  --card: #ffffff;
  --line: #e6e3f3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(61, 47, 92, .06), 0 6px 20px rgba(91, 74, 160, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--mint-2); }
button, input, textarea, select { font: inherit; }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) 8px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(246, 245, 253, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 720px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 15px; min-width: 0; }
.brand img { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; transition: transform .05s, background .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--mint); color: #fff; }
.btn-primary:hover { background: var(--mint-2); }
.btn-navy { background: var(--mint); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--navy); cursor: pointer; text-decoration: none; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mint-2); margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* hero */
.hero { background: var(--grad); color: var(--navy); border-radius: 20px; padding: 22px 20px; margin-bottom: 14px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -80px; top: -90px; width: 200px; height: 200px; border-radius: 50%; border: 26px solid rgba(255, 255, 255, .45); }
.hero h1 { color: var(--navy); font-size: 26px; font-weight: 800; position: relative; z-index: 1; }
.hero p { color: #4c4670; margin: 8px 0 0; position: relative; z-index: 1; max-width: 460px; }
.hero .eyebrow { color: var(--mint-2); position: relative; z-index: 1; }

/* progress */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.progress-head b { color: var(--navy); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--mint)); border-radius: 99px; transition: width .4s; }

/* lesson list */
.lessons { list-style: none; margin: 0; padding: 0; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row.locked { opacity: .55; }
.lesson-row .st { flex: 0 0 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; background: var(--line); color: var(--navy); }
.lesson-row.done .st { background: var(--sky); color: #fff; }
.lesson-row.current .st { background: var(--mint); color: #fff; box-shadow: 0 0 0 4px var(--sky-soft); }
.lesson-row .tx { flex: 1; min-width: 0; }
.lesson-row .t { font-weight: 600; color: var(--navy); }
.lesson-row .s { font-size: 14px; color: var(--muted); }
.lesson-row .meta { font-size: 13px; color: var(--muted); text-align: right; flex: 0 0 auto; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--mint-soft); color: var(--mint-2); margin-left: 6px; vertical-align: 2px; }

/* paywall */
.paywall { background: linear-gradient(160deg, #d9cffc 0%, #c3e7fd 100%); color: var(--navy); border-radius: 20px; padding: 22px 20px; margin-bottom: 14px; }
.paywall h2 { color: var(--navy); font-size: 22px; }
.paywall p { color: #4c4670; margin: 8px 0 16px; }
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tiers.one { grid-template-columns: 1fr; max-width: 380px; }
.tier { background: rgba(255, 255, 255, .75); border: 1px solid rgba(124, 98, 232, .18); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tier .p { font-size: 26px; font-weight: 800; color: var(--navy); }
.tier .n { font-weight: 600; color: var(--navy); }
.tier ul { margin: 2px 0 8px; padding-left: 18px; color: #4c4670; font-size: 13px; }
.tier .btn { margin-top: auto; }
.paywall .note { font-size: 13px; color: #5d5880; margin: 12px 0 0; }
@media (max-width: 420px) { .tiers { grid-template-columns: 1fr; } }

/* lesson page */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 4px 0 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.lesson-title { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.lesson-sub { color: var(--muted); margin: 0 0 16px; }
.video { position: relative; border-radius: 16px; overflow: hidden; background: #1e1830; aspect-ratio: 16 / 9; margin-bottom: 14px; }
.video.vertical { aspect-ratio: 9 / 16; width: min(100%, max(240px, calc((100vh - 300px) * 9 / 16))); margin-left: auto; margin-right: auto; }
@supports (height: 100svh) { .video.vertical { width: min(100%, max(240px, calc((100svh - 300px) * 9 / 16))); } }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #c9dbe7; text-align: center; padding: 20px; gap: 6px; }
.watermark { position: absolute; z-index: 3; pointer-events: none; color: rgba(106, 79, 216, .2); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-shadow: 0 0 2px rgba(255, 255, 255, .25); transition: top 1.5s, left 1.5s; white-space: nowrap; }
.section { margin-bottom: 14px; }
.section h3 { font-size: 18px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.checklist li:last-child { border-bottom: 0; }
.checklist .box { flex: 0 0 22px; height: 22px; border-radius: 6px; border: 2px solid var(--mint); margin-top: 1px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
.checklist li.on .box { background: var(--mint); }
.checklist li.on span { color: var(--muted); }
.materials a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--navy); font-weight: 600; margin-bottom: 8px; }
.materials a .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--mint-soft); color: var(--mint-2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
textarea, input[type=text], input[type=email], input[type=url], input[type=number], select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; color: var(--ink); outline: none; }
textarea:focus, input:focus, select:focus { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
textarea { min-height: 110px; resize: vertical; }
.sub-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.sub-item .when { font-size: 12px; color: var(--muted); }
.reply { background: var(--mint-soft); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.reply b { color: var(--navy); }
.lockbox { text-align: center; padding: 30px 20px; }
.lockbox .big { font-size: 40px; }

/* sticky next bar */
.nextbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(245, 247, 249, 0), rgba(245, 247, 249, .96) 30%); }
.nextbar-in { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }
.nextbar .btn-primary { flex: 1; }
.host-badge .nextbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.host-badge .foot { padding-bottom: 180px; }
.host-badge .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* login */
.auth { max-width: 420px; margin: 20px auto; }
.auth h1 { font-size: 26px; margin-bottom: 8px; }
.field { margin: 14px 0; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.code-input { font-size: 24px; letter-spacing: .3em; text-align: center; font-weight: 700; }

/* install hint */
.install { display: flex; gap: 12px; align-items: flex-start; background: var(--sky-soft); border-radius: 14px; padding: 14px; margin-bottom: 14px; font-size: 14px; }
.install b { color: var(--navy); }
.install .x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }

/* admin */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.tabs button.on { background: var(--mint); color: #fff; border-color: var(--mint); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; word-break: break-word; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--mint-soft); color: var(--mint-2); white-space: nowrap; }
.pill.navy { background: var(--sky-soft); color: #2f6fa0; }
.pill.coral { background: var(--coral-soft); color: var(--coral); }
.stack > * + * { margin-top: 10px; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 99px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow); }

/* footer: offer + support links (card payments need them visible) */
.foot { max-width: 720px; margin: 0 auto; padding: 8px 16px 120px; text-align: center; font-size: 13px; color: var(--muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.foot div { flex-basis: 100%; }
.paywall .note a { color: var(--mint-2); }
/* terms page */
.terms h2 { margin: 0 0 6px; }
.terms h3 { font-size: 16px; margin: 20px 0 6px; color: var(--navy); }
.terms p { margin: 0 0 8px; line-height: 1.55; }

/* course review */
.stars { display: flex; gap: 4px; }
.stars button { font-size: 42px; line-height: 1; background: none; border: 0; color: #dcd6ef; cursor: pointer; padding: 2px 3px; transition: transform .12s, color .12s; }
.stars button.on { color: #f5b301; }
.stars button:active { transform: scale(1.18); }
.stars-static { color: #f5b301; font-size: 22px; letter-spacing: 2px; }
.stars-static i { color: #dcd6ef; font-style: normal; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--mint); }
.gifts-card{border:1.5px dashed #d9cffc;background:linear-gradient(135deg,#fbf9ff,#fff)}
/* badges */
.badges-card .progress-head h3 { margin: 0; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; margin-top: 12px; }
.badge { text-align: center; }
.medal { width: 62px; height: 62px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative;
  background: radial-gradient(circle at 28% 22%, rgba(255,255,255,.6) 0 7%, transparent 8%), linear-gradient(145deg, var(--a), var(--b));
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--b), 0 6px 14px -4px rgba(61, 47, 92, .35); }
.medal span { font-size: 28px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.badge .bn { margin-top: 9px; font-size: 12.5px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.badge:not(.on) .medal { background: #eeecf6; box-shadow: 0 0 0 4px #fff, 0 0 0 6px #e2dff0; }
.badge:not(.on) .medal span { font-size: 20px; opacity: .55; filter: grayscale(1); }
.badge:not(.on) .bn { color: #a6a2bd; font-weight: 600; }
.badge-pop { position: fixed; inset: 0; z-index: 50; background: rgba(43, 39, 64, .55); display: flex; align-items: center; justify-content: center; padding: 24px; animation: popfade .25s ease; overflow: hidden; }
.pop-card { background: #fff; border-radius: 22px; padding: 26px 22px 20px; width: 100%; max-width: 340px; text-align: center; position: relative; z-index: 1; animation: popin .45s cubic-bezier(.2, 1.4, .4, 1); }
.pop-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mint-2); margin-bottom: 16px; }
.medal.big { width: 104px; height: 104px; margin-bottom: 18px; animation: wobble 1.2s ease .3s; }
.medal.big span { font-size: 48px; }
.pop-card h2 { font-size: 22px; }
.pop-card p { margin: 6px 0 18px; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes popfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg) scale(1.06); } 60% { transform: rotate(8deg); } }

/* reviews for visitors */
.pub-rev .rv-sum { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.pub-rev .rv-sum > b { font-size: 26px; color: var(--navy); line-height: 1; }
.pub-rev .rv { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pub-rev .rv:last-of-type { border-bottom: 0; }
.pub-rev .rv-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pub-rev .rv-name { font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 2px; }
.pub-rev .rv-top .stars-static, .rv-mini .stars-static, .rv-sum .stars-static { font-size: 17px; letter-spacing: 1px; }
.pub-rev .prose { font-size: 15px; }
.rv-mini { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .7); color: var(--navy); cursor: pointer; font-size: 14px; }
.rv-mini .cnt { color: #5d5880; text-decoration: underline; text-underline-offset: 3px; }
