/* ==========================================================================
   Coven — mystical community platform · design system
   ========================================================================== */
:root {
  --bg: #0a0913;
  --bg-2: #0f0d1c;
  --surface: #14122a;
  --surface-2: #1b1836;
  --surface-3: #232046;
  --line: rgba(196, 181, 253, 0.12);
  --line-2: rgba(196, 181, 253, 0.2);
  --text: #eeebf8;
  --muted: #aaa5c6;
  --dim: #75709a;
  --violet: #8b5cf6;
  --violet-2: #6d28d9;
  --violet-soft: rgba(139, 92, 246, 0.14);
  --lav: #c4b5fd;
  --indigo: #4f46e5;
  --gold: #d8c08f;
  --gold-soft: rgba(216, 192, 143, 0.14);
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --serif: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 68px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Atmosphere */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 78% -10%, rgba(109, 40, 217, 0.28), transparent 60%),
    radial-gradient(700px 500px at 0% 20%, rgba(79, 70, 229, 0.14), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(109, 40, 217, 0.16), transparent 60%),
    var(--bg);
}
.sky::after {
  content: ""; position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 67% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 64%, #e9d5ff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 52%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 86%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 55% 38%, #f5e6c4 50%, transparent 51%);
  background-size: 520px 520px;
}

/* Typography */
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
.display { font-family: var(--serif); font-weight: 500; font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.02; letter-spacing: -0.02em; }
.h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.01em; }
.h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.h3 { font-size: 1.05rem; font-weight: 650; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.gold { color: var(--gold); }
.lav { color: var(--lav); }

/* Layout */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.page { padding: calc(var(--nav-h) + 28px) 0 80px; min-height: 100vh; }
.section { padding: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sticky { position: sticky; top: calc(var(--nav-h) + 20px); }

/* Cards */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card.pad { padding: 20px; }
.card.hover { transition: transform 0.35s var(--ease), border-color 0.25s ease, box-shadow 0.35s ease; }
.card.hover:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 24px 50px -28px rgba(109, 40, 217, 0.55); }
.glass { background: rgba(20, 18, 42, 0.62); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: transform 0.2s var(--ease), background 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(196, 181, 253, 0.35); }
.btn:active { transform: scale(0.97); }
.btn svg.i { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: transparent; color: #fff; box-shadow: 0 10px 28px -12px rgba(139, 92, 246, 0.8); }
.btn-primary:hover { background: linear-gradient(135deg, #9b70fa, #7c3aed); border-color: transparent; }
.btn-gold { background: linear-gradient(135deg, #e7d3a6, #c6a96c); border-color: transparent; color: #241b06; }
.btn-gold:hover { background: linear-gradient(135deg, #efdeb6, #d0b47a); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: transparent; }
.btn-danger { color: #fecaca; border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn.is-on { background: var(--violet-soft); border-color: rgba(139, 92, 246, 0.55); color: var(--lav); }

/* Chips, badges, tabs */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: all 0.2s ease; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.is-active { background: var(--violet-soft); border-color: rgba(139, 92, 246, 0.5); color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 650; letter-spacing: 0.02em; background: var(--violet-soft); color: var(--lav); border: 1px solid rgba(139, 92, 246, 0.3); white-space: nowrap; }
.badge svg.i { width: 12px; height: 12px; }
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: rgba(216, 192, 143, 0.35); }
.badge.green { background: rgba(74, 222, 128, 0.12); color: #86efac; border-color: rgba(74, 222, 128, 0.3); }
.badge.red { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.badge.amber { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
.badge.plain { background: rgba(255, 255, 255, 0.05); color: var(--muted); border-color: var(--line); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s ease; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.underline-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.underline-tabs::-webkit-scrollbar { display: none; }
.utab { padding: 12px 0; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.utab.is-active { color: var(--text); border-bottom-color: var(--gold); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.off { background: var(--dim); }

/* Avatars */
.av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; position: relative; background: linear-gradient(135deg, #8b5cf6, #4f46e5); box-shadow: 0 0 0 2px var(--bg-2); }
.av.sm { width: 30px; height: 30px; font-size: 11px; }
.av.xs { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.av.xl { width: 112px; height: 112px; font-size: 34px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px rgba(216, 192, 143, 0.5); }
.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.av .on { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.av-stack { display: flex; }
.av-stack .av { margin-left: -8px; }
.av-stack .av:first-child { margin-left: 0; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(10, 9, 19, 0.6); color: var(--text); font: inherit; font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15); }
.search-box { position: relative; }
.search-box svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search-box .input { padding-left: 42px; border-radius: 999px; }
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line-2); transition: background 0.25s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #cfcbe3; transition: transform 0.3s var(--ease), background 0.25s; }
.switch input:checked + span { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.check { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: all 0.15s; }
.check svg.i { width: 13px; height: 13px; stroke-width: 2.4; opacity: 0; }
.check.is-on { background: var(--violet); border-color: var(--violet); }
.check.is-on svg.i { opacity: 1; color: #fff; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.segmented button { height: 32px; padding: 0 12px; border: 0; background: none; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.is-active { background: var(--surface-3); color: var(--text); }

/* Progress */
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #d8c08f); }

/* ---------------------------------------------------------------- nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--nav-h);
  background: rgba(10, 9, 19, 0.72); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { height: 100%; display: flex; align-items: center; gap: 24px; max-width: 1360px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: 0.02em; }
.logo-mark { width: 34px; height: 34px; color: var(--gold); }
.logo b { color: var(--gold); font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 550; transition: color 0.2s, background 0.2s; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-link.is-active { color: var(--text); background: rgba(139, 92, 246, 0.14); }
.nav-link .ext { width: 13px; height: 13px; opacity: 0.6; }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); border: 1px solid transparent; background: none; cursor: pointer; transition: all 0.2s; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.icon-btn .count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--gold); color: #241b06; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.nav-menu-btn { display: none; }

/* Mobile drawer + tab bar */
.drawer-bg { position: fixed; inset: 0; z-index: 80; background: rgba(5, 4, 12, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 81; width: min(320px, 86vw); background: var(--bg-2); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform 0.4s var(--ease); padding: 20px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-bg { opacity: 1; pointer-events: auto; }
.drawer .nav-link { height: 46px; font-size: 15px; border-radius: 12px; }
.tabbar { display: none; position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(10, 9, 19, 0.92); border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 10.5px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.tabbar a.is-active { color: var(--gold); }
.tabbar a svg.i { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; padding: calc(var(--nav-h) + 56px) 0 40px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 520px; margin: 20px 0 30px; line-height: 1.6; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 560px; margin-left: auto; width: 100%; }
.hero-art svg { width: 100%; height: 100%; overflow: visible; }
.hero-art .spin { transform-origin: 300px 300px; animation: spin 140s linear infinite; }
.hero-art .spin-rev { transform-origin: 300px 300px; animation: spin 220s linear infinite reverse; }
.hero-art .pulse { animation: pulse 5s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.hero-stats { display: flex; gap: 32px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--text); }
.hero-stats span { font-size: 13px; color: var(--dim); }

/* Topic cards */
.topic { padding: 22px; display: flex; flex-direction: column; gap: 12px; min-height: 190px; position: relative; overflow: hidden; cursor: pointer; }
.topic::after { content: ""; position: absolute; width: 220px; height: 220px; right: -90px; top: -90px; border-radius: 50%; background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 70%); opacity: 0; transition: opacity 0.4s ease; }
.topic:hover::after { opacity: 1; }
.topic-icon { width: 52px; height: 52px; color: var(--gold); transition: transform 0.5s var(--ease); }
.topic:hover .topic-icon { transform: rotate(-8deg) scale(1.06); }
.topic .h3 { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.topic p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.topic .meta { margin-top: auto; font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; }

/* Content cards (feed) */
.cover { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.cover svg { width: 100%; height: 100%; display: block; }
.cover .type { position: absolute; top: 12px; left: 12px; }
.post { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.post .title { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.post .title:hover { color: var(--lav); }
.post .excerpt { color: var(--muted); font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.byline { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.byline b { color: var(--text); font-weight: 600; }
.actions { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; -webkit-tap-highlight-color: transparent; }
.act:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.act svg.i { width: 18px; height: 18px; }
.act.is-on { color: #f9a8d4; }
.act.is-on svg.i { fill: currentColor; }
.act.save.is-on { color: var(--gold); }
.act.pop svg.i { animation: pop 0.4s var(--ease); }
@keyframes pop { 40% { transform: scale(1.35); } }
.feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.feed .post.wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: center; }
.feed .post.wide .cover { aspect-ratio: 4 / 3; }

/* Widgets */
.widget { padding: 18px; }
.widget h4 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; font-weight: 650; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; padding-top: 0; }
.moon-widget { display: flex; align-items: center; gap: 16px; }
.moon-widget svg { width: 64px; height: 64px; }

/* ---------------------------------------------------------------- story page */
.story-cover { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 21 / 9; margin-bottom: 36px; border: 1px solid var(--line); }
.story-cover svg { width: 100%; height: 100%; display: block; }
.reader { max-width: 720px; margin: 0 auto; }
.reader h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.3rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -0.015em; }
.reader .sub { font-family: var(--serif); font-size: 1.45rem; color: var(--muted); margin: 14px 0 26px; font-style: italic; line-height: 1.35; }
.prose { font-family: var(--serif); font-size: 1.32rem; line-height: 1.75; color: #ddd8ee; }
.prose p { margin: 0 0 1.25em; }
.prose p:first-of-type::first-letter { float: left; font-size: 4.2em; line-height: 0.82; padding: 6px 10px 0 0; color: var(--gold); font-weight: 600; }
.prose h2 { font-size: 1.9rem; margin: 1.6em 0 0.6em; color: var(--text); }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--gold); font-style: italic; color: var(--text); font-size: 1.45rem; }
.story-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 36px; flex-wrap: wrap; }
.read-progress { position: fixed; top: var(--nav-h); left: 0; height: 2px; background: linear-gradient(90deg, #8b5cf6, var(--gold)); z-index: 59; width: 0; transition: width 0.1s linear; }
.comment { display: flex; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- community */
.comm-cover { height: 96px; border-radius: 12px 12px 0 0; overflow: hidden; margin: -1px -1px 0; }
.comm-cover svg { width: 100%; height: 100%; display: block; }
.comm-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-top: -30px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--gold); box-shadow: 0 0 0 4px var(--surface); }
.comm-icon svg { width: 30px; height: 30px; }
.comm-head { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.comm-head .banner { height: 220px; }
.comm-head .banner svg { width: 100%; height: 100%; display: block; }
.thread { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 16px 18px; align-items: start; border-top: 1px solid var(--line); transition: background 0.2s; }
.thread:first-child { border-top: 0; }
.thread:hover { background: rgba(255, 255, 255, 0.02); }
.thread .t { font-weight: 650; font-size: 15.5px; line-height: 1.35; }
.thread .t:hover { color: var(--lav); }
.thread .stat { text-align: right; font-size: 12px; color: var(--dim); white-space: nowrap; }
.thread .stat b { display: block; font-size: 16px; color: var(--text); }

/* ---------------------------------------------------------------- learn */
.course .cover { aspect-ratio: 16 / 10; border-radius: 12px 12px 0 0; margin: -1px -1px 0; }
.course .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.course .title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; line-height: 1.15; }
.lesson { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid transparent; transition: all 0.2s; cursor: pointer; }
.lesson:hover { background: rgba(255, 255, 255, 0.03); }
.lesson .num { font-family: var(--serif); font-size: 1.3rem; color: var(--dim); width: 30px; }
.lesson .state { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); flex-shrink: 0; }
.lesson .state svg.i { width: 15px; height: 15px; }
.lesson.done .state { background: rgba(74, 222, 128, 0.14); border-color: rgba(74, 222, 128, 0.4); color: #86efac; }
.lesson.current { background: var(--violet-soft); border-color: rgba(139, 92, 246, 0.45); }
.lesson.current .state { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.2); }
.lesson.locked { opacity: 0.55; cursor: default; }
.ring { width: 120px; height: 120px; }

/* ---------------------------------------------------------------- grimoire */
.grim { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.grim-nav a { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 550; cursor: pointer; }
.grim-nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.grim-nav a.is-active { background: var(--violet-soft); color: var(--text); }
.grim-nav a .n { margin-left: auto; font-size: 12px; color: var(--dim); }
.entry { padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.entry .title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.entry .excerpt { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.entry.paper { background: linear-gradient(180deg, rgba(216, 192, 143, 0.06), transparent 60%), var(--surface); }

/* ---------------------------------------------------------------- profile */
.prof-banner { height: 240px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.prof-banner svg { width: 100%; height: 100%; display: block; }
.prof-head { display: flex; align-items: flex-start; gap: 22px; margin: 0 28px; flex-wrap: wrap; }
.prof-head > .av.xl { margin-top: -56px; flex-shrink: 0; }
.prof-head .prof-name { flex: 1; min-width: 220px; padding-top: 14px; }
.prof-head .prof-actions { padding-top: 14px; }
.prof-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.prof-stats b { font-size: 20px; display: block; }
.prof-stats span { font-size: 12.5px; color: var(--dim); }
.achv { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.achv .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }

/* ---------------------------------------------------------------- messages */
.msg-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - var(--nav-h) - 56px); min-height: 520px; overflow: hidden; }
.msg-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.msg-list .scroll { overflow-y: auto; flex: 1; padding: 6px; }
.conv { display: flex; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; align-items: center; }
.conv:hover { background: rgba(255, 255, 255, 0.03); }
.conv.is-active { background: var(--violet-soft); }
.conv .last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .unread { min-width: 20px; height: 20px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(460px, 78%); padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; background: var(--surface-3); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, #7c3aed, #5b21b6); border-color: transparent; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-top: 4px; }
.bubble .meta svg.i { width: 14px; height: 14px; color: #a5f3fc; }
.bubble.media { padding: 6px; }
.bubble.media .cover { aspect-ratio: 4 / 3; width: 260px; max-width: 100%; }
.typing { display: inline-flex; gap: 4px; padding: 12px 16px; border-radius: 18px; background: var(--surface-3); align-self: flex-start; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.composer { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer .input { border-radius: 999px; }

/* ---------------------------------------------------------------- notifications */
.notif { display: flex; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--line); align-items: flex-start; }
.notif:first-child { border-top: 0; }
.notif.unread { background: linear-gradient(90deg, rgba(139, 92, 246, 0.08), transparent 70%); }
.notif .kind { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; position: absolute; right: -6px; bottom: -6px; border: 2px solid var(--surface); }
.notif .kind svg.i { width: 13px; height: 13px; stroke-width: 2; }

/* ---------------------------------------------------------------- plans */
.plan { padding: 26px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.plan .price { font-family: var(--serif); font-size: 3rem; font-weight: 600; line-height: 1; }
.plan .price small { font-family: var(--sans); font-size: 14px; color: var(--dim); font-weight: 500; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--muted); }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li svg.i { width: 18px; height: 18px; color: var(--gold); margin-top: 2px; }
.plan.featured { border-color: rgba(216, 192, 143, 0.5); background: radial-gradient(400px 200px at 50% 0%, rgba(216, 192, 143, 0.12), transparent 70%), linear-gradient(180deg, rgba(139, 92, 246, 0.12), transparent 50%), var(--surface); box-shadow: 0 30px 70px -40px rgba(216, 192, 143, 0.5); }
.plan .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }

/* ---------------------------------------------------------------- AI oracle */
.oracle-fab { position: fixed; right: 22px; bottom: 22px; z-index: 56; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(216, 192, 143, 0.5); background: radial-gradient(circle at 30% 25%, #9b70fa, #4c1d95); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 16px 36px -10px rgba(139, 92, 246, 0.8); transition: transform 0.3s var(--ease); }
.oracle-fab:hover { transform: scale(1.06) rotate(-6deg); }
.oracle-fab svg.i { width: 26px; height: 26px; }
.oracle { position: fixed; right: 22px; bottom: 92px; z-index: 57; width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 140px)); display: flex; flex-direction: column; opacity: 0; transform: translateY(12px) scale(0.97); pointer-events: none; transition: all 0.35s var(--ease); transform-origin: bottom right; }
.oracle.is-open { opacity: 1; transform: none; pointer-events: auto; }
.oracle .o-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.oracle .o-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- modal / toast */
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(5, 4, 12, 0.7); display: grid; place-items: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.modal-bg.is-open { opacity: 1; pointer-events: auto; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; transform: translateY(16px) scale(0.98); transition: transform 0.35s var(--ease); }
.modal-bg.is-open .modal { transform: none; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 95; transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; transition: all 0.35s var(--ease); pointer-events: none; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8); }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast svg.i { color: var(--gold); }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 48px 0 40px; margin-top: 40px; color: var(--muted); font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 28px; }
.footer h5 { margin: 0 0 12px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); }
.footer a { display: block; padding: 4px 0; color: var(--muted); }
.footer a:hover { color: var(--text); }
.lang-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.lang-pick select { appearance: none; -webkit-appearance: none; height: 32px; padding: 0 30px 0 12px; border-radius: 8px; border: 1px solid var(--line-2); font: inherit; cursor: pointer;
  background: rgba(255, 255, 255, 0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cfc8e6' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center; color: inherit; }
.lang-pick select:focus { outline: none; border-color: rgba(216, 180, 90, 0.7); }
.lang-pick option { color: #1a1630; background: #fff; }

/* ==========================================================================
   AdminCP
   ========================================================================== */
.admin { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.a-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 14px 30px; scrollbar-width: thin; }
.a-side .logo { padding: 4px 8px 18px; font-size: 22px; }
.a-group { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); padding: 16px 10px 6px; font-weight: 650; }
.a-link { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 10px; color: var(--muted); font-size: 13.5px; font-weight: 550; transition: all 0.15s; }
.a-link svg.i { width: 18px; height: 18px; }
.a-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.a-link.is-active { color: var(--text); background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.04)); box-shadow: inset 2px 0 0 var(--gold); }
.a-link .n { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.a-main { min-width: 0; display: flex; flex-direction: column; }
.a-top { position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(10, 9, 19, 0.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.a-top .search-box { flex: 1; max-width: 420px; }
.a-content { padding: 26px 24px 60px; display: flex; flex-direction: column; gap: 20px; }
.a-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.a-title h1 { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .lbl svg.i { width: 15px; height: 15px; color: var(--lav); }
.kpi .val { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.kpi .delta { font-size: 12px; font-weight: 600; color: #86efac; }
.kpi .delta.down { color: #fca5a5; }
.kpi .spark { height: 30px; width: 100%; }
.chart { width: 100%; height: 240px; display: block; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); font-weight: 650; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: rgba(255, 255, 255, 0.015); }
table.t tr:last-child td { border-bottom: 0; }
.feature-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.feature-row:first-child { border-top: 0; }
.feature-row .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--violet-soft); color: var(--lav); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.perm-grid { display: grid; grid-template-columns: 180px repeat(6, minmax(70px, 1fr)); }
.perm-grid > div { padding: 11px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; font-size: 13px; }
.perm-grid .hd { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); font-weight: 650; justify-content: center; text-align: center; }
.perm-grid .grp { grid-column: 1 / -1; background: rgba(255, 255, 255, 0.02); font-weight: 700; color: var(--gold); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.perm-grid .c { justify-content: center; }
.health { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.health:first-child { border-top: 0; }
.maint-preview { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-2); aspect-ratio: 16 / 10; position: relative; display: grid; place-items: center; text-align: center; padding: 24px; background: radial-gradient(500px 300px at 50% 30%, rgba(139, 92, 246, 0.35), transparent 70%), var(--bg); }
.countdown { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.countdown div { min-width: 64px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); }
.countdown b { display: block; font-family: var(--serif); font-size: 1.8rem; line-height: 1; }
.countdown span { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.a-menu-btn { display: none; }

/* ---------------------------------------------------------------- reveal */
.rv { opacity: 0; transform: translateY(16px); animation: rv 0.7s var(--ease) forwards; }
@keyframes rv { to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-link span.lbl-lg { display: none; }
}
@media (max-width: 1080px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: grid; }
  .nav .wrap { gap: 12px; }
  .nav-actions { margin-left: auto; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > aside { display: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .a-side { position: fixed; z-index: 81; left: 0; top: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform 0.4s var(--ease); }
  body.drawer-open .a-side { transform: none; }
  .a-menu-btn { display: grid; }
  .perm-grid { grid-template-columns: 150px repeat(6, minmax(64px, 1fr)); min-width: 600px; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 380px; margin: 0 auto; order: -1; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed { grid-template-columns: minmax(0, 1fr); }
  .feed .post.wide { grid-template-columns: minmax(0, 1fr); }
  .grim { grid-template-columns: minmax(0, 1fr); }
  .grim-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .grim-nav a { white-space: nowrap; flex-shrink: 0; }
  .grim-nav a .n { display: none; }
  .msg-app { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--nav-h) - var(--tab-h) - 40px); }
  .msg-app.show-chat .msg-list { display: none; }
  .msg-app:not(.show-chat) .chat { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  :root { --nav-h: 60px; }
  .wrap { padding: 0 16px; }
  .page { padding: calc(var(--nav-h) + 18px) 0 calc(var(--tab-h) + 40px + var(--safe-b)); }
  .tabbar { display: flex; }
  .nav-actions .hide-sm { display: none; }
  .logo { font-size: 22px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .topic { padding: 16px; min-height: 0; }
  .topic .h3 { font-size: 1.25rem; }
  .topic p { display: none; }
  .topic-icon { width: 40px; height: 40px; }
  .section { padding: 40px 0; }
  .hero { padding-top: calc(var(--nav-h) + 20px); }
  .hero p.lead { font-size: 16px; }
  .hero .row .btn { flex: 1 1 100%; }
  .hero-stats { gap: 20px; }
  .story-cover { aspect-ratio: 16 / 10; border-radius: var(--r); margin-bottom: 24px; }
  .prose { font-size: 1.2rem; }
  .prof-banner { height: 160px; }
  .prof-head { margin: 0 8px; gap: 12px; }
  .prof-head > .av.xl { margin-top: -46px; }
  .prof-head .prof-name { padding-top: 6px; min-width: 0; }
  .prof-head .prof-actions { padding-top: 0; width: 100%; }
  .av.xl { width: 92px; height: 92px; font-size: 28px; }
  .thread { grid-template-columns: auto minmax(0, 1fr); }
  .thread .stat { display: none; }
  .oracle-fab { bottom: calc(var(--tab-h) + 16px + var(--safe-b)); right: 16px; width: 52px; height: 52px; }
  .oracle { bottom: calc(var(--tab-h) + 80px + var(--safe-b)); right: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .a-top { padding: 0 14px; }
  .a-top .search-box { display: none; }
  .a-content { padding: 18px 14px 50px; }
  .a-title h1 { font-size: 1.7rem; }
  .kpi .val { font-size: 20px; }
  .feature-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .feature-row .cfg { grid-column: 2 / -1; justify-self: start; }
  table.t.responsive thead { display: none; }
  table.t.responsive tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; }
  table.t.responsive td::before { content: attr(data-l); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); font-weight: 650; }
  table.t.responsive td:first-child::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rv { opacity: 1; transform: none; }
}
@media (max-width: 640px) { .hide-xs { display: none !important; } }

/* Header user menu */
.umenu { position: relative; }
.umenu-trigger { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 3px 12px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; transition: border-color .2s, background .2s; -webkit-tap-highlight-color: transparent; }
.umenu-trigger:hover, .umenu.is-open .umenu-trigger { border-color: rgba(216,192,143,.5); background: rgba(255,255,255,.07); }
.umenu-trigger .av { box-shadow: 0 0 0 2px rgba(216,192,143,.55); }
.umenu-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu-caret { width: 16px; height: 16px; color: var(--dim); transition: transform .2s; }
.umenu.is-open .umenu-caret { transform: rotate(180deg); }
.umenu-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 260px; padding: 8px; display: none; z-index: 70; box-shadow: 0 24px 50px -16px rgba(0,0,0,.8); }
.umenu.is-open .umenu-panel { display: block; animation: rv .25s var(--ease) both; }
.umenu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.umenu-head > div { display: flex; flex-direction: column; min-width: 0; }
.umenu-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 550; }
.umenu-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.umenu-item svg.i { width: 18px; height: 18px; }
.umenu-item.danger { color: #fca5a5; }
.umenu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
@media (max-width: 640px) { .umenu-name { display: none; } .umenu-trigger { padding: 3px; } .umenu-caret { display: none; } .umenu-panel { position: fixed; right: 12px; top: calc(var(--nav-h) + 6px); } }

/* AdminCP menu icons (shared menu uses Font Awesome) */
.a-link i.fa-solid { width: 18px; text-align: center; font-size: 14px; opacity: 0.9; flex-shrink: 0; }
.a-link.is-active i.fa-solid { color: var(--gold); opacity: 1; }


/* ==========================================================================
   PORTAL "Mystic Classic" — same identity as the forum: night-sky bars,
   parchment (light) or starry night (dark), gold hairlines, EB Garamond.
   Flat: no glow, no gradients on controls, no decorative motion.
   Scoped to public pages (the AdminCP has its own layer).
   ========================================================================== */
:root { --serif: "EB Garamond", Georgia, "Times New Roman", serif; }
html[data-theme="light"] body:not([data-area="admin"]) {
  color-scheme: light;
  --bg: #f3eee3; --bg-2: #fffdf8; --surface: #fffdf8; --surface-2: #faf6ec; --surface-3: #f3ecdc;
  --line: #e6dcc7; --line-2: #d6caaf; --text: #2a2438; --muted: #6a6176; --dim: #8b8296;
  --violet: #4a3a9c; --violet-2: #3b2e80; --violet-soft: #ece8f7; --lav: #4a3a9c; --indigo: #4a3a9c;
  --gold: #96711a; --gold-soft: #f8edd2; --green: #1f8a4c; --red: #c53030; --amber: #b7791f;
  --shadow: 0 1px 2px rgba(60, 40, 10, 0.06);
  --cv-btn: #4a3a9c; --cv-btn-hover: #3b2e80;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
}
html[data-theme="dark"] body:not([data-area="admin"]) {
  --bg: #100e1a; --bg-2: #161322; --surface: #1a1727; --surface-2: #211d31; --surface-3: #2a2540;
  --line: #2f2a45; --line-2: #3d3757; --text: #ebe6f5; --muted: #aaa3c2; --dim: #7f7898;
  --lav: #c9bdff; --violet-soft: #2a2747; --gold: #d8b45a; --gold-soft: #2e2818;
  --shadow: none;
  --cv-btn: #6a58d6; --cv-btn-hover: #5a49c2;
  background-color: var(--bg);
}
body:not([data-area="admin"]) {
  --cv-stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='18' r='.8' opacity='.55'/%3E%3Ccircle cx='58' cy='64' r='.6' opacity='.4'/%3E%3Ccircle cx='97' cy='22' r='1' opacity='.6'/%3E%3Ccircle cx='142' cy='88' r='.7' opacity='.45'/%3E%3Ccircle cx='181' cy='36' r='.6' opacity='.5'/%3E%3Ccircle cx='219' cy='74' r='.9' opacity='.55'/%3E%3Ccircle cx='31' cy='101' r='.6' opacity='.35'/%3E%3Ccircle cx='121' cy='112' r='.5' opacity='.35'/%3E%3C/g%3E%3Cg fill='%23e9cf8a'%3E%3Ccircle cx='76' cy='40' r='.8' opacity='.6'/%3E%3Ccircle cx='166' cy='58' r='.7' opacity='.5'/%3E%3C/g%3E%3C/svg%3E");
}
/* Atmosphere: static. Light = parchment only; dark = faint fixed stars. */
html[data-theme="light"] body:not([data-area="admin"]) .sky { display: none; }
html[data-theme="dark"] body:not([data-area="admin"]) .sky { background: var(--bg) var(--cv-stars); }
html[data-theme="dark"] body:not([data-area="admin"]) .sky::after { display: none; }

/* Night-sky navigation bar (both themes) with a gold hairline */
body:not([data-area="admin"]) .nav {
  background: #17132e var(--cv-stars); backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 0; box-shadow: inset 0 -1px 0 rgba(216, 180, 90, 0.45);
}
body:not([data-area="admin"]) .nav .logo { color: #fff; }
body:not([data-area="admin"]) .nav .logo b, body:not([data-area="admin"]) .nav .logo-mark { color: #e2c372; }
body:not([data-area="admin"]) .nav-link { border-radius: 6px; color: #cfc8e6; }
body:not([data-area="admin"]) .nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
body:not([data-area="admin"]) .nav-link.is-active { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 -2px 0 #e2c372; }
body:not([data-area="admin"]) .nav .icon-btn { color: #cfc8e6; border-radius: 6px; }
body:not([data-area="admin"]) .nav .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); border-color: transparent; }
body:not([data-area="admin"]) .nav .btn:not(.btn-primary):not(.btn-gold) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
body:not([data-area="admin"]) .nav .btn:not(.btn-primary):not(.btn-gold):hover { background: rgba(255, 255, 255, 0.1); }
body:not([data-area="admin"]) .nav .umenu-trigger, body:not([data-area="admin"]) .nav [data-act="umenu"] { color: #fff; }

/* Type */
body:not([data-area="admin"]) h1, body:not([data-area="admin"]) h2, body:not([data-area="admin"]) .serif { letter-spacing: 0; }
body:not([data-area="admin"]) .prose { color: var(--text); font-size: 1.22rem; }

/* Cards and controls: flat, small radius */
body:not([data-area="admin"]) .card { background: var(--surface); background-image: none; border-radius: 8px; box-shadow: var(--shadow); }
body:not([data-area="admin"]) .card.hover:hover { transform: none; box-shadow: var(--shadow); border-color: var(--gold); }
body:not([data-area="admin"]) .btn { border-radius: 6px; background: var(--surface); border-color: var(--line-2); color: var(--text); box-shadow: none; transform: none; }
body:not([data-area="admin"]) .btn:hover { background: var(--surface-2); border-color: var(--line-2); }
body:not([data-area="admin"]) .btn:active { transform: none; }
body:not([data-area="admin"]) .btn-primary { background: var(--cv-btn); border-color: var(--cv-btn); color: #fff; box-shadow: inset 0 0 0 1px rgba(233, 207, 138, 0.35); }
body:not([data-area="admin"]) .btn-primary:hover { background: var(--cv-btn-hover); border-color: var(--cv-btn-hover); color: #fff; }
body:not([data-area="admin"]) .btn-gold { background: #e2c372; border-color: #e2c372; color: #241a00; }
body:not([data-area="admin"]) .btn-gold:hover { background: #ecd28b; border-color: #ecd28b; }
body:not([data-area="admin"]) .btn-ghost { background: transparent; border-color: transparent; }
body:not([data-area="admin"]) .chip { border-radius: 6px; background: var(--surface); }
body:not([data-area="admin"]) .chip.is-on, body:not([data-area="admin"]) .chip.is-active { background: var(--violet-soft); color: var(--lav); border-color: var(--lav); }
body:not([data-area="admin"]) .tabs, body:not([data-area="admin"]) .segmented { border-radius: 6px; background: var(--surface-2); }
body:not([data-area="admin"]) .tab { border-radius: 4px; }
body:not([data-area="admin"]) .badge { border-radius: 4px; }
body:not([data-area="admin"]) .input, body:not([data-area="admin"]) .select, body:not([data-area="admin"]) .textarea { border-radius: 6px; background: var(--bg-2); }
body:not([data-area="admin"]) .progress > i { background: var(--gold); }
body:not([data-area="admin"]) .switch input:checked + span { background: var(--cv-btn); }

/* Light theme: fix colours that assumed a dark background */
html[data-theme="light"] body:not([data-area="admin"]) .badge.green { color: #1f6f3f; background: #e3f4ea; }
html[data-theme="light"] body:not([data-area="admin"]) .badge.red { color: #a12626; background: #fbe6e6; }
html[data-theme="light"] body:not([data-area="admin"]) .badge.amber { color: #8a5a00; background: #fbf0d5; }
html[data-theme="light"] body:not([data-area="admin"]) .badge.plain { background: var(--surface-2); }
html[data-theme="light"] body:not([data-area="admin"]) .btn-danger { color: #a12626; background: #fbe6e6; border-color: #f0c2c2; }
html[data-theme="light"] body:not([data-area="admin"]) .lesson.done .state { color: #1f6f3f; background: #e3f4ea; }
html[data-theme="light"] body:not([data-area="admin"]) .umenu-item.danger { color: #a12626; }
html[data-theme="light"] body:not([data-area="admin"]) .progress { background: var(--surface-3); }
html[data-theme="light"] body:not([data-area="admin"]) .drawer { background: var(--bg-2); }
html[data-theme="light"] body:not([data-area="admin"]) .drawer .nav-link { color: var(--text); }
html[data-theme="light"] body:not([data-area="admin"]) .drawer .nav-link.is-active { color: var(--lav); background: var(--violet-soft); box-shadow: inset 3px 0 0 var(--gold); }
html[data-theme="light"] body:not([data-area="admin"]) .drawer .logo { color: var(--text); }

/* Mobile tab bar: solid */
body:not([data-area="admin"]) .tabbar { background: var(--bg-2); box-shadow: 0 -1px 0 var(--line); border-top: 0; }
body:not([data-area="admin"]) .tabbar a.is-active { color: var(--lav); }
html[data-theme="dark"] body:not([data-area="admin"]) .tabbar a.is-active { color: var(--gold); }

/* Footer: night strip like the forum */
body:not([data-area="admin"]) .footer { background: #17132e var(--cv-stars); border-top: 0; box-shadow: inset 0 1px 0 rgba(216, 180, 90, 0.45); color: #b9b2d3; }
body:not([data-area="admin"]) .footer h5 { color: #fff; }
body:not([data-area="admin"]) .footer a { color: #cfc8e6; }
body:not([data-area="admin"]) .footer a:hover { color: #e9cf8a; }
body:not([data-area="admin"]) .footer .logo { color: #fff; }
body:not([data-area="admin"]) .footer .muted { color: #b9b2d3; }
body:not([data-area="admin"]) .footer .lang-pick { color: #cfc8e6; }
body:not([data-area="admin"]) .footer .lang-pick select { border-color: rgba(207, 200, 230, 0.25); }

/* Hero artwork: still, not spinning */
body:not([data-area="admin"]) .hero-art .spin, body:not([data-area="admin"]) .hero-art .spin-rev, body:not([data-area="admin"]) .hero-art .pulse { animation: none; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art { color: var(--lav); }
/* Light theme: the artwork's colours are drawn for a night sky; repaint it
   for parchment. The moon's shadow disc matches the solid glow behind it so
   it reads as a crescent rather than a black hole. */
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-g0,
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-g1 { stop-color: #e6def2; stop-opacity: 1; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-g2 { stop-color: #ebe5f1; stop-opacity: 0.55; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-g3 { stop-color: #f3eee3; stop-opacity: 0; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-shadow { fill: #e6def2; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-rays { stroke: rgba(150, 113, 26, 0.3); }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-ring { stroke: rgba(74, 58, 156, 0.35); }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-num { fill: #96711a; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-gold,
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-stars,
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-spark { fill: #a8822a; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-lines { stroke: #a8822a; stroke-opacity: 0.6; }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-ph { fill: #e6def2; stroke: rgba(150, 113, 26, 0.55); }
html[data-theme="light"] body:not([data-area="admin"]) .hero-art .ha-ph-lit { fill: #d9b968; }

/* Theme toggle icons */
.cv-theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .cv-theme-toggle .fa-sun { display: inline-block; }
html[data-theme="dark"] .cv-theme-toggle .fa-moon { display: none; }

/* ==== AdminCP light theme (Facebook / Invision style); dark via the toggle ==== */
html[data-theme="light"] body[data-area="admin"] {
  color-scheme: light;
  --bg: #f0f2f5; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #f5f6f8; --surface-3: #e9ebee;
  --line: rgba(0, 0, 0, 0.09); --line-2: rgba(0, 0, 0, 0.16);
  --text: #1c1e21; --muted: #65676b; --dim: #8a8d91;
  --lav: #5b4fe0; --violet-soft: rgba(91, 79, 224, 0.1); --gold: #b45309; --gold-soft: rgba(245, 158, 11, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.02);
  background: var(--bg);
}
html[data-theme="light"] body[data-area="admin"] .sky { display: none; }
html[data-theme="light"] body[data-area="admin"] .card { background: #fff; }
html[data-theme="light"] body[data-area="admin"] .a-side { background: #fff; box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04); }
html[data-theme="light"] body[data-area="admin"] .a-top { background: rgba(255, 255, 255, 0.92); }
html[data-theme="light"] body[data-area="admin"] .a-link:hover { background: #f0f2f5; }
html[data-theme="light"] body[data-area="admin"] .a-link.is-active { background: rgba(91, 79, 224, 0.1); color: #5b4fe0; box-shadow: inset 3px 0 0 #5b4fe0; }
html[data-theme="light"] body[data-area="admin"] .a-link.is-active i.fa-solid { color: #5b4fe0; }
html[data-theme="light"] body[data-area="admin"] .logo-mark { color: #5b4fe0; }
html[data-theme="light"] body[data-area="admin"] .logo b { color: #5b4fe0; }
html[data-theme="light"] body[data-area="admin"] .btn { background: #e4e6eb; border-color: transparent; color: #050505; }
html[data-theme="light"] body[data-area="admin"] .btn:hover { background: #d8dadf; border-color: transparent; }
html[data-theme="light"] body[data-area="admin"] .btn-primary { background: linear-gradient(135deg, #6d4aff, #1d6fe0); color: #fff; box-shadow: 0 6px 16px -8px rgba(29, 111, 224, 0.6); }
html[data-theme="light"] body[data-area="admin"] .btn-ghost { background: transparent; }
html[data-theme="light"] body[data-area="admin"] .btn-danger { background: #fee2e2; color: #b91c1c; }
html[data-theme="light"] body[data-area="admin"] .input, html[data-theme="light"] body[data-area="admin"] .select, html[data-theme="light"] body[data-area="admin"] .textarea { background: #fff; border-color: #ccd0d5; color: var(--text); }
html[data-theme="light"] body[data-area="admin"] .input:focus, html[data-theme="light"] body[data-area="admin"] .select:focus, html[data-theme="light"] body[data-area="admin"] .textarea:focus { border-color: #5b4fe0; box-shadow: 0 0 0 3px rgba(91, 79, 224, 0.15); }
html[data-theme="light"] body[data-area="admin"] .chip, html[data-theme="light"] body[data-area="admin"] .tabs, html[data-theme="light"] body[data-area="admin"] .segmented, html[data-theme="light"] body[data-area="admin"] .check { background: #f0f2f5; }
html[data-theme="light"] body[data-area="admin"] .tab.is-active { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
html[data-theme="light"] body[data-area="admin"] .badge.plain { background: #f0f2f5; }
html[data-theme="light"] body[data-area="admin"] .badge.green { color: #15803d; }
html[data-theme="light"] body[data-area="admin"] .badge.amber { color: #b45309; }
html[data-theme="light"] body[data-area="admin"] .badge.red { color: #b91c1c; }
html[data-theme="light"] body[data-area="admin"] .kpi .lbl svg.i { color: #5b4fe0; }
html[data-theme="light"] body[data-area="admin"] .kpi .delta { color: #15803d; }
.cv-theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .cv-theme-toggle .fa-sun { display: inline-block; }
html[data-theme="dark"] .cv-theme-toggle .fa-moon { display: none; }

/* ==========================================================================
   AdminCP "Classic" — flat, Invision-AdminCP style (same on portal + forum)
   ========================================================================== */
html[data-theme] body[data-area="admin"] { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; }
html[data-theme="light"] body[data-area="admin"] {
  --bg: #f3eee3; --surface: #fffdf8; --surface-2: #faf6ec; --surface-3: #f3ecdc;
  --line: #e6dcc7; --line-2: #d6caaf; --text: #2a2438; --muted: #6a6176; --dim: #8b8296;
  --lav: #4c3db5; --violet-soft: #eeecfa; --gold: #9a6a08; --gold-soft: #fbf3e0;
  --card-bg: #fffdf8; --input-bg: #ffffff; --border: #e1d7c1; --accent: #4a3a9c; --accent-2: #4a3a9c;
  --primary: #4a3a9c; --primary-light: #eeecfa;
  --shadow: 0 1px 1px rgba(16, 24, 40, 0.04); --admin-shadow: 0 1px 1px rgba(16, 24, 40, 0.04);
  --cv-side: #1c1838; --cv-side-text: #d8d2ee; --cv-side-dim: #9a93c4; --cv-primary: #4a3a9c; --cv-primary-hover: #3b2e80;
  background: var(--bg);
}
html[data-theme="dark"] body[data-area="admin"] {
  --bg: #15141c; --bg-2: #1a1922; --surface: #1e1d28; --surface-2: #24232f; --surface-3: #2a2937;
  --line: #2e2d40; --line-2: #3a3950; --text: #e6e6ee; --muted: #a2a1b4; --dim: #7d7c90;
  --lav: #b9b0ff; --violet-soft: #2a2747; --gold: #e0b04a; --gold-soft: #2e2818;
  --card-bg: #1e1d28; --input-bg: #15141c; --border: #33324a; --accent: #8f83ff; --accent-2: #a9b4ff;
  --primary: #6c5ce7; --primary-light: #2a2747;
  --shadow: none; --admin-shadow: none;
  --cv-side: #13111f; --cv-side-text: #c3c0dc; --cv-side-dim: #7f7b9e; --cv-primary: #6c5ce7; --cv-primary-hover: #5b4bd6;
  background: var(--bg);
}
html[data-theme] body[data-area="admin"] .sky, html[data-theme] body[data-area="admin"] .cv-sky { display: none; }

/* Sidebar: dark navy rail like the Invision AdminCP */
html[data-theme] body[data-area="admin"] .a-side { background: var(--cv-side); border-right: 0; box-shadow: none; padding: 14px 10px 30px; }
html[data-theme] body[data-area="admin"] .a-side .logo { color: #fff; font-family: inherit; font-size: 19px; font-weight: 700; letter-spacing: 0; padding: 4px 8px 14px; }
html[data-theme] body[data-area="admin"] .a-side .logo b { color: #f0c04a; font-weight: 700; }
html[data-theme] body[data-area="admin"] .a-side .logo-mark { color: #f0c04a; width: 30px; height: 30px; }
html[data-theme] body[data-area="admin"] .a-side .badge.plain, html[data-theme] body[data-area="admin"] .a-side .cv-badge { background: rgba(255, 255, 255, 0.1); border: 0; color: #fff; border-radius: 3px; font-family: inherit; }
html[data-theme] body[data-area="admin"] .a-group { color: var(--cv-side-dim); font-size: 10.5px; letter-spacing: 0.1em; padding: 14px 10px 5px; }
html[data-theme] body[data-area="admin"] .a-link { height: 34px; border-radius: 4px; color: var(--cv-side-text); font-size: 13.5px; font-weight: 500; }
html[data-theme] body[data-area="admin"] .a-link i, html[data-theme] body[data-area="admin"] .a-link i.fa-solid { color: var(--cv-side-dim); opacity: 1; }
html[data-theme] body[data-area="admin"] .a-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
html[data-theme] body[data-area="admin"] .a-link:hover i { color: #fff; }
html[data-theme] body[data-area="admin"] .a-link.is-active { background: var(--cv-primary); color: #fff; box-shadow: none; }
html[data-theme] body[data-area="admin"] .a-link.is-active i, html[data-theme] body[data-area="admin"] .a-link.is-active i.fa-solid { color: #fff; }
html[data-theme] body[data-area="admin"] .a-side a.a-link { color: var(--cv-side-text); }
html[data-theme] body[data-area="admin"] .a-side a.a-link.is-active { color: #fff; }

/* Top bar */
html[data-theme] body[data-area="admin"] .a-top { height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-theme] body[data-area="admin"] .a-top b.serif, html[data-theme] body[data-area="admin"] .a-top__title { font-family: inherit !important; font-size: 16px !important; font-weight: 700; color: var(--text); }
html[data-theme] body[data-area="admin"] .icon-btn { border-radius: 4px; }
html[data-theme] body[data-area="admin"] .cv-search { border-radius: 4px; height: 34px; background: var(--surface-2); border: 1px solid var(--line); }

/* Content */
html[data-theme] body[data-area="admin"] .a-content { animation: none; }
html[data-theme] body[data-area="admin"] .a-title h1, html[data-theme] body[data-area="admin"] .page-title, html[data-theme] body[data-area="admin"] .a-content > h1, html[data-theme] body[data-area="admin"] .a-content h1:first-child,
html[data-theme] body[data-area="admin"] .serif { font-family: inherit !important; font-weight: 700; letter-spacing: 0; }
html[data-theme] body[data-area="admin"] .a-title h1, html[data-theme] body[data-area="admin"] .page-title, html[data-theme] body[data-area="admin"] .a-content h1 { font-family: "EB Garamond", Georgia, serif !important; font-size: 30px !important; font-weight: 600; line-height: 1.2; }
html[data-theme] body[data-area="admin"] .a-side { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='18' r='.8' opacity='.45'/%3E%3Ccircle cx='97' cy='22' r='1' opacity='.5'/%3E%3Ccircle cx='181' cy='36' r='.6' opacity='.4'/%3E%3Ccircle cx='142' cy='88' r='.7' opacity='.35'/%3E%3Ccircle cx='31' cy='101' r='.6' opacity='.3'/%3E%3C/g%3E%3Cg fill='%23e9cf8a'%3E%3Ccircle cx='76' cy='40' r='.8' opacity='.55'/%3E%3C/g%3E%3C/svg%3E"); box-shadow: inset -1px 0 0 rgba(216, 180, 90, 0.3); }
html[data-theme] body[data-area="admin"] .a-side .logo { font-family: "EB Garamond", Georgia, serif; font-size: 24px; font-weight: 600; }
html[data-theme] body[data-area="admin"] .a-link.is-active { box-shadow: inset 3px 0 0 #e2c372; }
html[data-theme] body[data-area="admin"] .card, html[data-theme] body[data-area="admin"] .stat-card, html[data-theme] body[data-area="admin"] .admin-card {
  background: var(--surface); background-image: none; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
}
html[data-theme] body[data-area="admin"] .card.hover:hover { transform: none; box-shadow: var(--shadow); border-color: var(--line-2); }
html[data-theme] body[data-area="admin"] .kpi .val { font-size: 22px; }
html[data-theme] body[data-area="admin"] .kpi .lbl svg.i, html[data-theme] body[data-area="admin"] .card-heading i, html[data-theme] body[data-area="admin"] .stat-card i { color: var(--lav); }

/* Buttons: flat, 4px */
html[data-theme] body[data-area="admin"] .btn {
  border-radius: 4px !important; background: var(--surface); background-image: none; border: 1px solid var(--line-2);
  color: var(--text); box-shadow: none; font-weight: 600; transform: none;
}
html[data-theme] body[data-area="admin"] .btn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
html[data-theme] body[data-area="admin"] .btn:active { transform: none; }
html[data-theme] body[data-area="admin"] .btn-primary, html[data-theme] body[data-area="admin"] .btn.btn-primary {
  background: var(--cv-primary) !important; background-image: none !important; border-color: var(--cv-primary) !important; color: #fff !important; box-shadow: none !important;
}
html[data-theme] body[data-area="admin"] .btn-primary:hover, html[data-theme] body[data-area="admin"] .btn.btn-primary:hover { background: var(--cv-primary-hover) !important; border-color: var(--cv-primary-hover) !important; }
html[data-theme] body[data-area="admin"] .btn-danger, html[data-theme] body[data-area="admin"] .btn.btn-danger { background: #c53030 !important; border-color: #c53030 !important; color: #fff !important; }
html[data-theme] body[data-area="admin"] .btn-success, html[data-theme] body[data-area="admin"] .btn.btn-success { background: #1f8a4c !important; border-color: #1f8a4c !important; color: #fff !important; }
html[data-theme] body[data-area="admin"] .btn-ghost { background: transparent; border-color: transparent; }
html[data-theme] body[data-area="admin"] .btn-gold { background: #f0c04a; border-color: #f0c04a; color: #2a1f00; }

/* Inputs, chips, tabs, badges */
html[data-theme] body[data-area="admin"] .input, html[data-theme] body[data-area="admin"] .select, html[data-theme] body[data-area="admin"] .textarea,
html[data-theme] body[data-area="admin"] input[type="text"], html[data-theme] body[data-area="admin"] input[type="email"], html[data-theme] body[data-area="admin"] input[type="number"], html[data-theme] body[data-area="admin"] input[type="url"],
html[data-theme] body[data-area="admin"] input[type="password"], html[data-theme] body[data-area="admin"] input[type="search"], html[data-theme] body[data-area="admin"] input[type="date"], html[data-theme] body[data-area="admin"] select, html[data-theme] body[data-area="admin"] textarea {
  border-radius: 4px; background: var(--input-bg, var(--surface)); border: 1px solid var(--line-2); color: var(--text); box-shadow: none;
}
html[data-theme] body[data-area="admin"] .input:focus, html[data-theme] body[data-area="admin"] .select:focus, html[data-theme] body[data-area="admin"] .textarea:focus, html[data-theme] body[data-area="admin"] input:focus, html[data-theme] body[data-area="admin"] select:focus, html[data-theme] body[data-area="admin"] textarea:focus {
  border-color: var(--cv-primary); box-shadow: 0 0 0 2px var(--violet-soft); outline: none;
}
html[data-theme] body[data-area="admin"] .chip, html[data-theme] body[data-area="admin"] .tabs, html[data-theme] body[data-area="admin"] .segmented { border-radius: 4px; }
html[data-theme] body[data-area="admin"] .tab { border-radius: 3px; }
html[data-theme] body[data-area="admin"] .badge { border-radius: 3px; }
html[data-theme] body[data-area="admin"] .av { box-shadow: none; }

/* Phones: category tree, tables and toolbars never overflow */
@media (max-width: 720px) {
  html[data-theme] body[data-area="admin"] .cat-tree-row { margin-left: 0; padding: 12px 8px; gap: 8px; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: start; border-radius: 0; }
  html[data-theme] body[data-area="admin"] .cat-tree-children { margin-left: 6px; padding-left: 8px; }
  html[data-theme] body[data-area="admin"] .cat-tree-actions { grid-column: 1 / -1; width: auto; margin: 4px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  html[data-theme] body[data-area="admin"] .cat-tree-actions .btn, html[data-theme] body[data-area="admin"] .cat-tree-actions form, html[data-theme] body[data-area="admin"] .cat-tree-actions a { width: 100%; min-height: 32px; padding: 0 6px; font-size: 12px; justify-content: center; }
  html[data-theme] body[data-area="admin"] .cat-tree-actions form .btn { width: 100%; }
  html[data-theme] body[data-area="admin"] .cat-tree-desc { max-width: 100%; white-space: normal; }
  html[data-theme] body[data-area="admin"] .a-content > .card, html[data-theme] body[data-area="admin"] .a-content .card { padding: 12px; }
  html[data-theme] body[data-area="admin"] .a-content { padding: 16px 12px 50px !important; }
  html[data-theme] body[data-area="admin"] .au-filters > * { flex: 0 0 auto !important; width: 100%; }
  html[data-theme] body[data-area="admin"] .au-search i { top: 50%; transform: translateY(-50%); }
  html[data-theme] body[data-area="admin"] .flex-between { flex-wrap: wrap; gap: 10px; }
  html[data-theme] body[data-area="admin"] .a-content table:not(.au-table) { display: block; max-width: 100%; overflow-x: auto; }
  html[data-theme] body[data-area="admin"] .a-content pre { max-width: 100%; overflow-x: auto; }
  html[data-theme] body[data-area="admin"] .a-content img { max-width: 100%; height: auto; }
  html[data-theme] body[data-area="admin"] .form-row { grid-template-columns: minmax(0, 1fr) !important; flex-direction: column; }
  html[data-theme] body[data-area="admin"] .a-title h1, html[data-theme] body[data-area="admin"] .page-title, html[data-theme] body[data-area="admin"] .a-content > h1 { font-size: 22px !important; }
}

/* Avatars: the photo always fills the circle exactly (no stretching) */
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; border-radius: 50%; }

/* Cover images: fixed frame, photo fills it (no giant portrait images) */
.cover { display: block; flex-shrink: 0; }
.cover > img, .story-cover > img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: cover; }
.story-cover { position: relative; }
#homeBlog .cover, #blogGrid .cover { aspect-ratio: 16 / 10; }

/* Tablet: two columns */
@media (max-width: 1080px) {
  #homeBlog.g3, #blogGrid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones: latest articles become a swipeable row; the blog list becomes compact rows */
@media (max-width: 720px) {
  #homeBlog.g3 {
    display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%;
    overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 6px;
    margin-right: -16px; padding-right: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #homeBlog.g3::-webkit-scrollbar { display: none; }
  #homeBlog > .card { scroll-snap-align: start; }
  #homeBlog .course .title { font-size: 1.2rem; }

  #blogGrid.g3 { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #blogGrid > .course { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: stretch; }
  #blogGrid > .course .cover { aspect-ratio: auto; height: 100%; min-height: 112px; border-radius: 8px 0 0 8px; margin: 0; }
  #blogGrid > .course .cover .type { top: 6px; left: 6px; font-size: 9.5px; height: 18px; padding: 0 6px; }
  #blogGrid > .course .body { padding: 10px 12px; gap: 5px; }
  #blogGrid > .course .title { font-size: 1.08rem; line-height: 1.2; }
  #blogGrid > .course .body .muted { -webkit-line-clamp: 2 !important; font-size: 12.5px; }
}

/* ==========================================================================
   Layout polish (desktop + phone)
   ========================================================================== */
/* Hero: give the copy enough width for all three buttons on one line */
.hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.hero .btn-lg { padding: 0 20px; white-space: nowrap; }
.hero .btn-lg.btn-ghost { padding: 0 12px; }
/* Plan buttons: long labels (e.g. Greek) wrap inside the button, not past it */
.plan .btn { white-space: normal; height: auto; min-height: 44px; padding: 10px 16px; line-height: 1.25; text-align: center; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
  /* Smaller artwork so the title and buttons show on the first screen */
  .hero-art { max-width: 240px; }
  .hero .btn-lg { white-space: normal; }
  /* Stats as one tidy card */
  .hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; margin-top: 28px; padding: 16px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: center; }
  .hero-stats b { font-size: 24px; line-height: 1.1; }
  .hero-stats span { font-size: 12px; }
  .hero-stats > div:nth-child(5) { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
  .hero-stats > div:nth-child(5) b { font-size: 18px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  /* Subjects: two per row instead of five tall cards */
  #homeSubjects.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #homeSubjects > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  #homeSubjects .topic { padding: 14px; gap: 8px; }
  #homeSubjects .topic .h3 { font-size: 1.15rem; }
  #homeSubjects .topic .meta { font-size: 11.5px; line-height: 1.35; }
  #homeSubjects .topic .meta svg { display: none; }
  /* Footer: brand on top, link columns two across */
  .footer { padding: 36px 0 calc(var(--tab-h) + 24px + var(--safe-b)); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* Column counts that used to be set once by JS at page load (so they broke
   when the window was resized or rotated); CSS now follows the screen. */
@media (min-width: 1081px) { #forumSec .split { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (min-width: 861px) { #homePlans.g3 { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); } }
.plan-grid { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); align-items: stretch; }
@media (max-width: 1080px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }

/* AdminCP grids (also used to be fixed once by JS at load) */
#dashK { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#acK { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#dashG { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
#cGrid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1180px) { #acK { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1080px) { #dashG, #cGrid, #secGrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  #dashK, #acK { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashL { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Blog: reading actions, comments, writing
   ========================================================================== */
.blog-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -6px 0 18px; }
.blog-nav:empty { display: none; }
.blog-nav .chips { flex: 1; min-width: 0; }
.blog-nav .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.blog-empty { text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 20px; }
.blog-status-note { max-width: 720px; margin: 0 auto 16px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: 8px; font-size: 13.5px; color: var(--muted); }
.blog-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 0; }
.blog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.blog-act { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.blog-act:hover { border-color: var(--gold); }
.blog-act .i { width: 17px; height: 17px; }
.blog-act.is-on { color: var(--lav); background: var(--violet-soft); border-color: var(--lav); }
.blog-act[data-react="like"].is-on { color: #c2385a; background: rgba(194, 56, 90, 0.1); border-color: rgba(194, 56, 90, 0.5); }
.blog-act[data-react="like"].is-on .i { fill: currentColor; }
.blog-comments { margin-top: 32px; }
.blog-comments h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.blog-cform { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.blog-cform .textarea { min-height: 84px; }
.blog-comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.blog-comment__body { flex: 1; min-width: 0; }
.blog-comment__body p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.blog-comment__del { margin-left: auto; border: 0; background: none; color: var(--dim); cursor: pointer; padding: 4px; border-radius: 6px; }
.blog-comment__del:hover { color: var(--red); background: var(--surface-2); }
.blog-comment__del .i { width: 15px; height: 15px; }
.prose .locked-note, .blog-body hidefornotregistered { display: block; margin: 1em 0; padding: 14px 16px; border: 1px dashed var(--gold); border-radius: 8px; background: var(--gold-soft); color: var(--muted); font-size: 0.95em; }
.blog-body hidefornotregistered::before { content: "Members only"; display: block; margin-bottom: 6px; font: 700 11px/1 var(--sans, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }

/* My posts / review lists */
.blog-rows { padding: 0; overflow: hidden; }
.blog-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.blog-row:first-child { border-top: 0; }
.blog-row__thumb { flex: none; width: 72px; height: 54px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--gold); }
.blog-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.blog-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.blog-row__title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blog-row__title:hover { color: var(--lav); }
.blog-row__main .row .i { width: 13px; height: 13px; vertical-align: -2px; }
.blog-row__acts { flex: none; display: flex; gap: 6px; }

/* Editor */
.blog-editor { max-width: 780px; margin: 0 auto; }
.blog-cover-pick { position: relative; aspect-ratio: 16 / 6; border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; margin-bottom: 18px; transition: border-color .15s; }
.blog-cover-pick:hover, .blog-cover-pick:focus-visible { border-color: var(--gold); outline: none; }
.blog-cover-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.blog-cover-pick__hint { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text); }
.blog-cover-pick__x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.blog-cover-pick.is-busy { opacity: .6; pointer-events: none; }
.blog-title-input { width: 100%; border: 0; background: transparent; color: var(--text); font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.1; padding: 4px 0; outline: none; }
.blog-excerpt-input { width: 100%; border: 0; background: transparent; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 1.3rem; line-height: 1.4; resize: none; padding: 6px 0 12px; outline: none; }
.blog-title-input::placeholder, .blog-excerpt-input::placeholder { color: var(--dim); }
.blog-toolbar { position: sticky; top: calc(var(--nav-h) + 6px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.blog-toolbar button { min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 700 14px/1 var(--sans, inherit); cursor: pointer; display: inline-grid; place-items: center; }
.blog-toolbar button:hover { background: var(--surface-2); color: var(--lav); }
.blog-toolbar button .i { width: 16px; height: 16px; }
.blog-toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.blog-body { min-height: 320px; padding: 18px 2px; outline: none; }
.blog-body:empty::before { content: attr(data-placeholder); color: var(--dim); font-style: italic; }
.blog-body img { max-width: 100%; height: auto; border-radius: 6px; }
.blog-meta { margin-top: 10px; }
.blog-editor__bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .blog-nav { flex-direction: column; align-items: stretch; }
  .blog-nav .chips { flex-wrap: nowrap; overflow-x: auto; }
  .blog-nav > .btn { justify-content: center; }
  .blog-act span { display: none; }
  .blog-row { flex-wrap: wrap; padding: 12px; }
  .blog-row__thumb { width: 56px; height: 44px; }
  .blog-row__main { flex-basis: calc(100% - 72px); }
  .blog-row__acts { width: 100%; justify-content: flex-end; }
  .blog-cover-pick { aspect-ratio: 16 / 8; }
  .blog-toolbar { top: calc(var(--nav-h) + 4px); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .blog-toolbar::-webkit-scrollbar { display: none; }
  .blog-toolbar button { flex: none; }
  .blog-editor__bar { bottom: calc(var(--tab-h) + var(--safe-b)); }
  .blog-editor__bar > .row { flex: 1; justify-content: flex-end; }
}
.course .body .row svg.i { width: 13px; height: 13px; }

/* ==========================================================================
   Blog on phones: nothing scrolls sideways except the category chips,
   tabs fit the screen, articles in a 2-column card grid
   ========================================================================== */
@media (max-width: 640px) {
  .blog-nav { flex-direction: column; align-items: stretch; gap: 10px; }
  .blog-nav > * { min-width: 0; max-width: 100%; }
  .blog-nav .chips {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px;
    width: 100%; overflow: visible; flex-wrap: nowrap;
  }
  .blog-nav .chip {
    flex-direction: column; justify-content: center; gap: 4px; height: auto; min-height: 56px; padding: 8px 2px;
    font-size: 10.5px; line-height: 1.15; letter-spacing: -0.01em; text-align: center; border-radius: 10px; min-width: 0; white-space: normal;
  }
  .blog-nav .chip .i { width: 18px; height: 18px; }
  .blog-nav .chip .badge { position: absolute; top: 4px; right: 4px; height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; }
  .blog-nav .chip { position: relative; }
  .blog-nav > .btn { width: 100%; justify-content: center; }

  /* Category chips: the one row that scrolls sideways, edge to edge */
  #blogCats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 2px; scrollbar-width: none; }
  #blogCats::-webkit-scrollbar { display: none; }
  #blogCats .chip { flex: none; }

  #blogGrid.g3, #blogRows > .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #blogGrid > .course, #blogRows > .grid > .course { display: flex; flex-direction: column; border-radius: 12px; }
  #blogGrid > .course .cover, #blogRows > .grid > .course .cover {
    aspect-ratio: 4 / 3; height: auto; min-height: 0; margin: 0; border-radius: 12px 12px 0 0;
  }
  #blogGrid > .course .cover .type, #blogRows > .grid > .course .cover .type { top: 6px; left: 6px; font-size: 9.5px; height: 18px; padding: 0 6px; }
  #blogGrid > .course .body, #blogRows > .grid > .course .body { padding: 10px 10px 12px; gap: 6px; flex: 1; }
  #blogGrid > .course .title, #blogRows > .grid > .course .title {
    font-size: 1.02rem; line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  #blogGrid > .course .body .muted, #blogRows > .grid > .course .body .muted { display: none !important; }
  #blogGrid > .course .body > .row, #blogRows > .grid > .course .body > .row { margin-top: auto; flex-wrap: wrap; gap: 2px 8px !important; font-size: 11px; line-height: 1.3; }

  /* Newest article: a wide featured card */
  #blogGrid > .course:first-child { grid-column: 1 / -1; }
  #blogGrid > .course:first-child .cover { aspect-ratio: 16 / 9; }
  #blogGrid > .course:first-child .body { padding: 14px 14px 16px; }
  #blogGrid > .course:first-child .title { font-size: 1.3rem; -webkit-line-clamp: 2; }
  #blogGrid > .course:first-child .body .muted { display: -webkit-box !important; -webkit-line-clamp: 2 !important; font-size: 13px; }
  #blogGrid > .course:first-child .body > .row { font-size: 12px; }
  #blogGrid > .card:only-child:not(.course) { grid-column: 1 / -1; }
}

/* ==========================================================================
   Membership plans: button under the price, folded feature lists
   ========================================================================== */
.plan { gap: 14px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-head .badge { display: inline-flex; align-items: center; gap: 4px; }
.plan-head .badge svg.i { width: 11px; height: 11px; }
.plan .price { font-size: 2.7rem; }
.plan-note { margin: -4px 0 0; font-size: 13.5px; color: var(--muted); }
.plan-cta .btn { width: 100%; justify-content: center; }
.plan-cta [aria-disabled="true"] { pointer-events: none; opacity: .8; }
.plan-incl { padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.plan .plan-list { gap: 9px; font-size: 13.5px; line-height: 1.4; }
.plan .plan-list li svg.i { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.plan .plan-more { margin-top: -4px; }
.plan-toggle { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 0; border: 0; background: none; color: var(--lav); font: 600 13px/1.2 inherit; cursor: pointer; }
.plan-toggle svg.i { width: 15px; height: 15px; transition: transform .2s ease; }
.plan-toggle.is-open svg.i { transform: rotate(180deg); }
.plan.is-current { border-color: color-mix(in srgb, var(--green, #1f8a4c) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--green, #1f8a4c) 30%, transparent); }
.plan-grid { align-items: start; }
@media (min-width: 1081px) { .plan-grid { align-items: stretch; } }
.plan .plan-extra { padding-top: 10px; border-top: 1px dashed var(--line); }
.plan .plan-list[hidden] { display: none; }

/* Member discount on plan cards (portal) */
.plan-deal { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 7px 11px; border-radius: 10px;
  font-size: 12.5px; color: #15803d; background: rgba(34, 197, 94, .12); border: 1px dashed rgba(34, 197, 94, .45); }
html[data-theme="dark"] .plan-deal { color: #4ade80; }
.plan-deal svg.i { width: 14px; height: 14px; flex: none; }
.plan-deal span { font-weight: 600; }
.plan-deal b { margin-left: auto; font-weight: 800; }
.plan-was { margin: -6px 0 -10px; font-size: 15px; color: var(--dim); text-decoration: line-through; }

/* Discount v2: old price beside the new one, tag underneath */
.plan .price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.plan .price .price-was { font-family: var(--sans, inherit); font-size: 16px; font-weight: 600; color: var(--dim); text-decoration-thickness: 1.5px; }
.plan .price small { flex-basis: auto; }
.plan .plan-deal { display: flex; align-items: center; gap: 10px; margin: -4px 0 0; padding: 9px 12px; border-radius: 12px;
  background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .35); color: inherit; }
.plan .plan-deal > svg.i { flex: none; width: 30px; height: 30px; padding: 7px; border-radius: 9px; color: #fff; background: #22c55e; }
.plan-deal__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.plan-deal__txt b { margin: 0 !important; font-size: 13.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-deal__txt span { font-size: 12.5px; font-weight: 700; color: #15803d; }
html[data-theme="dark"] .plan-deal__txt span { color: #4ade80; }
.plan .price .price-now { white-space: nowrap; }
.plan-deal__txt span s { font-weight: 600; color: var(--dim); text-decoration-thickness: 1.5px; }
.plan .plan-deal { flex-wrap: nowrap; align-items: center; }
.plan .plan-deal__txt { flex: 1; }
.plan .plan-deal__txt > span { white-space: normal; line-height: 1.4; }
