/* =====================================================================
   PRETOLS COURSE - STYLES
   Layout: fixed left rail (menu, progress, course outline) beside a
   scrolling prompt library; cards are thumbnail-first like a video app.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #0B0E14;
  --panel: #121722;
  --panel-2: #182030;
  --raise: #1F2839;
  --line: #263044;
  --line-2: #33405A;
  --text: #ECF0F7;
  --muted: #929DB2;
  --faint: #5F6B82;
  --accent: #FFB547;
  --accent-hi: #FFCB78;
  --accent-ink: #1E1405;
  --accent-soft: rgba(255, 181, 71, .14);
  --ok: #45D18E;
  --ok-soft: rgba(69, 209, 142, .14);
  --danger: #FF6B6B;
  --danger-soft: rgba(255, 107, 107, .14);
  --info: #74A7FF;
  --info-soft: rgba(116, 167, 255, .14);
  --shade: rgba(4, 6, 10, .72);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --side-w: 272px;
  --top-h: 64px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); padding: 24px; text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.subtle { background: transparent; color: var(--muted); padding: 0 12px; }
.btn.subtle:hover { color: var(--text); background: var(--panel-2); }
.btn.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(69, 209, 142, .35); }
.btn.danger, .btn.armed { background: var(--danger-soft); color: var(--danger); border-color: rgba(255, 107, 107, .4); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text);
}
.icon-btn:hover { border-color: var(--line-2); }

/* ---------- chips / pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.chip.cat { color: var(--cat, var(--accent)); background: color-mix(in srgb, var(--cat, var(--accent)) 14%, transparent); border-color: color-mix(in srgb, var(--cat, var(--accent)) 30%, transparent); }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(69, 209, 142, .3); }
.chip.warn { color: var(--accent); background: var(--accent-soft); border-color: rgba(255, 181, 71, .3); }
.chip.info { color: var(--info); background: var(--info-soft); border-color: rgba(116, 167, 255, .3); }
.chip.off { color: var(--faint); }
.filter {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-weight: 600; font-size: 13.5px;
}
.filter:hover { color: var(--text); border-color: var(--line-2); }
.filter[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.filter svg.i { width: 15px; height: 15px; }

/* ---------- inputs ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--faint); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.search { position: relative; min-width: 0; }
.search svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 42px; border-radius: 999px; background: var(--panel); border-color: var(--line); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  background: rgba(11, 14, 20, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; margin-right: auto; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { position: relative; width: 36px; height: 36px; flex: none; border-radius: 10px; overflow: hidden; background: var(--accent); display: grid; place-items: center; }
.logo .logo-mark { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--accent-ink); letter-spacing: -.02em; }
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--panel); }
.logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.logo:has(img) { border-radius: 50%; background: var(--panel); }
.logo.lg .logo-mark { font-size: 22px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.community-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ok); background: var(--ok-soft); border: 1px solid rgba(69, 209, 142, .3);
}
.community-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(69, 209, 142, .2); }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: var(--accent-ink); background: var(--accent);
  border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line-2);
}
.avatar.sm { width: 34px; height: 34px; font-size: 13.5px; background: var(--raise); color: var(--text); box-shadow: none; border: 1px solid var(--line-2); }
.user-menu { position: relative; }
.user-menu > button { background: none; border: 0; padding: 0; border-radius: 50%; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
  width: min(290px, calc(100vw - 32px)); padding: 8px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; gap: 2px; }
.menu-head strong { font-size: 15px; }
.menu-head span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.menu-head code { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-sm); border: 0; background: none;
  color: var(--text); font-size: 14px; font-weight: 500; text-align: left;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item[aria-current="true"] { color: var(--accent); }
.menu-label { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }
.sidebar {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px 28px max(14px, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--line); background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 0 10px 8px; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: var(--r-md); color: var(--muted); font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: rgba(255, 181, 71, .25); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side-progress { padding: 14px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); display: grid; gap: 9px; }
.side-progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-progress-top b { font-size: 15px; letter-spacing: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.side-progress small { color: var(--faint); font-size: 12.5px; }
.meter { height: 6px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.done > span { background: var(--ok); }
.outline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.outline a {
  display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) 16px; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-md); border: 1px solid transparent;
}
.outline a:hover { background: var(--panel); }
.outline a[aria-current="page"] { background: var(--panel); border-color: var(--line-2); }
.outline .num { font-family: var(--font-mono); font-size: 11px; color: var(--faint); text-align: center; font-variant-numeric: tabular-nums; }
.outline .mini { width: 64px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; }
.outline .t { display: grid; min-width: 0; }
.outline .t strong { overflow-wrap: anywhere; font-size: 12.5px; font-weight: 700; line-height: 1.25; text-transform: uppercase; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.outline .t small { font-size: 11.5px; color: var(--faint); }
.outline .st { color: var(--faint); display: grid; place-items: center; }
.outline .st.done { color: var(--ok); }
.outline .st svg.i { width: 15px; height: 15px; }
.scrim { display: none; }

.main { min-width: 0; padding: 28px var(--gutter-r) 96px var(--gutter-l); }
.main-inner { max-width: 1240px; margin: 0 auto; display: grid; gap: 28px; }
.demo-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--info-soft); border: 1px dashed rgba(116, 167, 255, .45); color: var(--info); font-size: 13.5px;
}
.demo-strip b { color: var(--text); }

/* ---------- page headers ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head > div { display: grid; gap: 6px; min-width: 0; max-width: 680px; }
.page-head h1, .section-head h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.1; }
.page-head p { color: var(--muted); }
.page-head .search { width: min(340px, 100%); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.section-head > div { display: grid; gap: 4px; }
.section-head h2 { font-size: 24px; line-height: 1.15; }
.section-head p { color: var(--muted); font-size: 14px; }
.section-head .search { width: min(340px, 100%); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .spacer { flex: 1; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center;
  padding: clamp(20px, 3vw, 34px);
  border-radius: 22px; border: 1px solid var(--line);
  background:
    radial-gradient(90% 120% at 0% 0%, rgba(255, 181, 71, .16), transparent 55%),
    radial-gradient(70% 90% at 100% 100%, rgba(116, 167, 255, .10), transparent 60%),
    var(--panel);
}
.hero-copy { display: grid; gap: 14px; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(32px, 4.6vw, 52px); line-height: 1; letter-spacing: -.03em; }
.tagline { font-family: var(--font-mono); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; }
.tagline .tl-label { color: var(--text); }
.tagline .tl-item + .tl-item::before { content: "|"; color: var(--faint); margin-right: 10px; }
.hero-status { color: var(--muted); max-width: 52ch; }
.hero-status b { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.hero-actions .btn.primary { max-width: 100%; }
.hero-actions .btn.primary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library { display: grid; gap: 16px; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.muted b { color: var(--text); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.boot h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--text); }
.boot p { max-width: 46ch; }
.form-row .input { flex: 1 1 240px; width: auto; }
.btn[aria-pressed="true"] svg.i { fill: #FF6B8B; stroke: #FF6B8B; }
.upnext { position: relative; display: block; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-2); aspect-ratio: 16 / 9; max-width: 100%; }
.upnext .thumb-art { position: absolute; inset: 0; }
.upnext-label {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(11, 14, 20, .82); backdrop-filter: blur(6px); border: 1px solid var(--line-2);
}
.upnext-label small { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--accent); }
.upnext-label strong { font-size: 15px; text-transform: uppercase; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); }
.stat-icon.ok { color: var(--ok); background: var(--ok-soft); }
.stat-icon.info { color: var(--info); background: var(--info-soft); }
.stat b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b small { font-size: 14px; color: var(--faint); font-weight: 600; }

/* ---------- thumbnails ---------- */
.thumb-art {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background:
    radial-gradient(110% 95% at 88% 8%, color-mix(in srgb, var(--h1) 60%, transparent), transparent 58%),
    radial-gradient(80% 80% at 0% 100%, color-mix(in srgb, var(--h2) 55%, transparent), transparent 65%),
    linear-gradient(160deg, #161D2B, #0A0D13);
}
.thumb-art img { width: 100%; height: 100%; object-fit: cover; }
.ph { position: absolute; inset: 0; padding: 9% 8%; display: flex; flex-direction: column; justify-content: center; container-type: inline-size; }
.ph-icon { position: absolute; right: -6%; bottom: -14%; width: 52%; height: auto; color: var(--h1); opacity: .2; }
.ph-icon svg.i { width: 100%; height: 100%; stroke-width: 1.4; }
.ph-cat { font-family: var(--font-mono); font-weight: 600; font-size: max(9px, 4.6cqw); letter-spacing: .14em; text-transform: uppercase; color: var(--h1); margin-bottom: 3cqw; }
.ph-title {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: max(15px, calc(var(--fs, 11) * 1cqw)); line-height: .92; letter-spacing: -.02em; color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35); max-width: 82%;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ph-title em { font-style: normal; color: var(--h1); }
.ph-mark { position: absolute; left: 8%; bottom: 7%; font-family: var(--font-mono); font-size: max(8px, 3.4cqw); letter-spacing: .2em; color: rgba(255, 255, 255, .45); }
.shop-row .ph { padding: 8%; }
.shop-row .ph-mark, .shop-row .ph-icon, .shop-row .ph-cat { display: none; }
.shop-row .ph-title, .admin-row .ph-title { font-size: calc(var(--fs, 11) * 1.18cqw); text-shadow: none; }
.outline .ph-title, .outline .ph-cat, .outline .ph-mark { display: none; }
.outline .ph-icon { position: absolute; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: 22px; height: 22px; opacity: .95; }
.outline .ph-icon svg.i { stroke-width: 2; }
.upnext .ph { justify-content: flex-start; padding-top: 8%; }
.upnext .ph-title { font-size: max(15px, calc(var(--fs, 11) * .8cqw)); }

/* ---------- lesson cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
  overflow: hidden; transition: border-color .18s, transform .18s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .thumb { position: relative; display: block; aspect-ratio: 16 / 9; }
.thumb-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.85);
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); opacity: 0; transition: opacity .18s, transform .18s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.thumb-play svg.i { width: 20px; height: 20px; margin-left: 3px; }
.card:hover .thumb-play, .card .thumb:focus-visible .thumb-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.thumb-lock {
  position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 9px; border-radius: 999px; background: rgba(8, 10, 15, .8); border: 1px solid rgba(255, 255, 255, .2);
  color: #fff; font-weight: 700; font-size: 12px;
}
.thumb-lock svg.i { width: 14px; height: 14px; }
.fav {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(11, 14, 20, .6); color: #fff;
  backdrop-filter: blur(4px);
}
.fav svg.i { width: 16px; height: 16px; }
.fav[aria-pressed="true"] { color: #FF6B8B; }
.fav[aria-pressed="true"] svg.i { fill: currentColor; }
.card-body { display: flex; flex-direction: column; gap: 9px; padding: 14px 16px 16px; flex: 1; }
.card-body .chip { align-self: flex-start; }
.card-title { font-size: 15.5px; font-weight: 700; line-height: 1.3; text-transform: uppercase; letter-spacing: .01em; }
.card-title a:hover { color: var(--accent); }
.card-desc { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--faint); font-size: 13px; margin-top: auto; padding-top: 4px; }
.card-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-progress.done { color: var(--ok); }
.card-buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 48px 20px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); color: var(--muted);
}
.empty svg.i { width: 28px; height: 28px; color: var(--faint); }
.empty strong { color: var(--text); font-size: 16px; }

/* ---------- lesson page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; justify-self: start; }
.back:hover { color: var(--text); }
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-width: 100%;
  border-radius: var(--r-lg); overflow: hidden; background: #000; border: 1px solid var(--line);
}
.player-media { position: absolute; inset: 0; }
.player-media iframe, .player-media video, .player-media > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; color: var(--muted); background: radial-gradient(70% 70% at 50% 40%, #1A2232, #07090D); }
.player-empty svg.i { width: 34px; height: 34px; color: var(--faint); }
.player-empty strong { color: var(--text); font-size: 16px; }
.player-empty > span { max-width: 46ch; }
.player:fullscreen { border-radius: 0; border: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
.player:-webkit-full-screen { border-radius: 0; border: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
.fs-btn {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .55); color: #fff;
}
/* watermark: buyer's name + member code + email, so leaked recordings can be traced */
.wm { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; user-select: none; -webkit-user-select: none; }
.wm-tiles {
  position: absolute; inset: -40%; display: grid; grid-template-columns: repeat(4, max-content);
  justify-content: center; align-content: center; gap: 58px 46px; transform: rotate(-24deg);
}
.wm-tiles span { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, .085); white-space: nowrap; }
.wm-float {
  position: absolute; top: 8%; left: 6%;
  font-family: var(--font-mono); font-size: clamp(10px, 1.5vw, 14px); font-weight: 600; white-space: nowrap;
  color: rgba(255, 255, 255, .42); text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  transition: top 1.8s ease, left 1.8s ease;
}
.lesson-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; }
.lesson-head > div:first-child { display: grid; gap: 10px; min-width: 0; max-width: 720px; }
.lesson-head h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(24px, 3vw, 32px); line-height: 1.1; letter-spacing: -.02em; text-transform: uppercase; }
.lesson-head p { color: var(--muted); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.panel { border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; display: grid; gap: 12px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.notes {
  margin: 0; padding: 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto;
}
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pager a { display: grid; gap: 3px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.pager a:hover { border-color: var(--line-2); }
.pager a.next { text-align: right; }
.pager small { color: var(--faint); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.pager strong { font-size: 14px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locked-panel {
  display: grid; justify-items: center; text-align: center; gap: 14px; padding: 44px 22px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: radial-gradient(70% 90% at 50% 0%, rgba(255, 181, 71, .12), transparent 70%), var(--panel);
}
.locked-panel .lock-ring { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.locked-panel .lock-ring svg.i { width: 26px; height: 26px; }
.locked-panel h2 { font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.locked-panel p { color: var(--muted); max-width: 52ch; }
.locked-panel .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- audio + files ---------- */
.audio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.audio-card { display: grid; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.audio-card.playing { border-color: rgba(255, 181, 71, .5); }
.audio-top { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; }
.audio-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.audio-card.sfx .audio-icon { background: var(--info-soft); color: var(--info); }
.audio-top strong { display: block; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.audio-top small { color: var(--faint); font-size: 12.5px; }
.audio-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; background: currentColor; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.file-list { display: grid; gap: 10px; }
.file-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.file-row .audio-icon { width: 44px; height: 44px; }
.file-row strong { display: block; font-size: 15px; }
.file-row p { color: var(--muted); font-size: 13.5px; }

/* ---------- shop ---------- */
.offer {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center;
  padding: clamp(20px, 3vw, 32px); border-radius: 22px; border: 1px solid rgba(255, 181, 71, .35);
  background: radial-gradient(80% 120% at 100% 0%, rgba(255, 181, 71, .18), transparent 60%), var(--panel);
}
.offer h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; }
.offer > div { display: grid; gap: 12px; min-width: 0; }
.offer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.offer li { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.offer li svg.i { color: var(--ok); margin-top: 2px; }
.offer-price { display: grid; gap: 12px; justify-items: start; padding: 20px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); }
.offer-price .big { font-family: var(--font-display); font-weight: 800; font-size: 46px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.offer-price small { color: var(--muted); }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.shop-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 14px 10px 10px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.shop-row .mini { width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; }
.shop-row strong { display: block; font-size: 14px; text-transform: uppercase; line-height: 1.25; }
.shop-row small { color: var(--faint); font-size: 12.5px; }
.shop-row .side { display: grid; justify-items: end; gap: 6px; }

/* ---------- modal + toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px var(--gutter-r) 20px var(--gutter-l); background: var(--shade); backdrop-filter: blur(4px); }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); display: grid; gap: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.15; }
.modal-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; counter-reset: s; }
.steps > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; counter-increment: s; }
.steps > li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; }
.steps > li > div { display: grid; gap: 8px; min-width: 0; }
.copy-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.copy-box > span { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.toast-wrap { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--raise); border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); font-size: 14px; font-weight: 600; animation: toast-in .25s ease; }
.toast.ok { border-color: rgba(69, 209, 142, .45); }
.toast.err { border-color: rgba(255, 107, 107, .5); color: #FFC9C9; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.chat-fab {
  position: fixed; z-index: 35;
  right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.chat-fab svg.i { width: 24px; height: 24px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); overflow-x: auto; max-width: 100%; justify-self: start; }
.tabs button { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 999px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tabs button { display: inline-flex; align-items: center; gap: 7px; }
.tabs button svg.i { width: 16px; height: 16px; }
.tab-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.player-note { color: var(--faint); font-size: 13px; margin-top: -16px; }
.locked-panel b { color: var(--text); }
.admin-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.member-list, .admin-list { display: grid; gap: 10px; }
.member {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1.6fr); gap: 16px; align-items: center;
  padding: 14px 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
}
.member-id { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; }
.member-id > div > strong { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-id > div > span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-head > .admin-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.member-id code, .code { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.member-access { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.owned { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--info-soft); color: var(--info); font-size: 12px; font-weight: 600; max-width: 100%; }
.owned span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owned button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: none; color: inherit; display: grid; place-items: center; flex: none; }
.owned button:hover { background: rgba(116, 167, 255, .25); }
.owned svg.i { width: 12px; height: 12px; }
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.member-actions select.input { min-height: 34px; padding: 4px 10px; font-size: 13px; width: auto; max-width: 190px; border-radius: 999px; }
.admin-row {
  display: grid; grid-template-columns: 34px 88px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 10px 14px 10px 10px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
}
.admin-row.simple { grid-template-columns: 42px minmax(0, 1fr) auto; }
.admin-row .pos { font-family: var(--font-mono); font-size: 12px; color: var(--faint); text-align: center; }
.admin-row .mini { width: 88px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; }
.admin-row strong { display: block; font-size: 14px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.admin-row .acts { display: flex; gap: 6px; }
.admin-row .ph-mark, .admin-row .ph-icon { display: none; }
.admin-row .ph { padding: 8%; }
.admin-row .ph-title { font-size: 13cqw; text-shadow: none; }
.pdf-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r-md); border: 1px dashed var(--line-2); background: var(--bg); }
.pdf-box .chip { text-transform: none; letter-spacing: 0; font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-box .chip svg.i { width: 14px; height: 14px; }
.upload-btn { position: relative; cursor: pointer; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1.2fr) 120px minmax(0, 1.6fr) auto; gap: 10px; align-items: end; }
.inline-form.files { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  padding: 48px max(32px, env(safe-area-inset-left, 0px)) 48px clamp(32px, 6vw, 88px);
  background:
    radial-gradient(70% 60% at 15% 20%, rgba(255, 181, 71, .22), transparent 65%),
    radial-gradient(60% 60% at 90% 90%, rgba(116, 167, 255, .14), transparent 65%),
    var(--panel);
  border-right: 1px solid var(--line);
}
.auth-brand h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(38px, 5vw, 64px); line-height: .95; letter-spacing: -.035em; }
.auth-brand > p { color: var(--muted); font-size: 16px; max-width: 46ch; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth-points li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.auth-points li svg.i { color: var(--accent); margin-top: 2px; }
.auth-points b { color: var(--accent); font-variant-numeric: tabular-nums; }
.auth-side { display: grid; place-items: center; padding: 40px var(--gutter-r) 40px var(--gutter-l); }
.auth-card { width: min(420px, 100%); display: grid; gap: 20px; }
.auth-card h2 { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); margin-top: 4px; }
.auth-card form { display: grid; gap: 14px; }
.auth-switch { color: var(--muted); font-size: 14px; text-align: center; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.form-msg { padding: 10px 14px; border-radius: var(--r-md); font-size: 14px; }
.form-msg.err { background: var(--danger-soft); color: #FFC9C9; border: 1px solid rgba(255, 107, 107, .35); }
.form-msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(69, 209, 142, .35); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .member { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .member-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 80;
    width: min(310px, 86vw); height: 100%;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    background: var(--panel); border-right: 1px solid var(--line-2);
    transform: translateX(-102%); transition: transform .25s ease; visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 75; background: var(--shade); }
  .hero, .offer { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 36px var(--gutter-r) 32px var(--gutter-l); }
  .inline-form, .inline-form.files { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .main { padding-top: 18px; }
  .main-inner { gap: 22px; }
  .community-pill .label { display: none; }
  .community-pill { padding: 0 11px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a.next { text-align: left; }
  .member { grid-template-columns: minmax(0, 1fr); }
  .admin-row { grid-template-columns: 72px minmax(0, 1fr); }
  .admin-row .pos { display: none; }
  .admin-row .mini { width: 72px; }
  .admin-row .acts { grid-column: 1 / -1; }
  .admin-row.simple { grid-template-columns: 42px minmax(0, 1fr); }
  .form-grid, .inline-form, .inline-form.files { grid-template-columns: minmax(0, 1fr); }
  .shop-list { grid-template-columns: minmax(0, 1fr); }
  .shop-row { grid-template-columns: 80px minmax(0, 1fr); }
  .shop-row .mini { width: 80px; }
  .shop-row .side { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: space-between; align-items: center; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr); }
  .file-row .btn { grid-column: 1 / -1; }
  .lesson-actions .btn { flex: 1 1 auto; }
  .modal { padding: 20px; }
  .tabs button { padding: 8px 12px; font-size: 13.5px; }
  .player-empty { gap: 6px; padding: 12px; font-size: 13px; }
  .player-empty > svg.i { display: none; }
  .player-note { margin-top: -12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
