/* =========================================================
   mbougrine.site — main stylesheet (no build step needed)
   ========================================================= */
:root {
  --brand: #0e7c70;
  --brand-ink: #075a51;
  --brand-soft: #e3f4f1;
  --accent: #f2a516;
  --accent-soft: #fff4dc;
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #1b2230;
  --ink-2: #3a4456;
  --muted: #687285;
  --line: #e2e6ed;
  --line-2: #cfd5df;
  --ok: #1f9d55;
  --ok-soft: #e4f6ec;
  --bad: #d64545;
  --bad-soft: #fde9e9;
  --info: #2f6fd6;
  --info-soft: #e7f0fd;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --violet: #6d4fd8;
  --violet-soft: #efeafd;
  --code-bg: #0f1724;
  --code-ink: #e6edf7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2bb3a3; --brand-ink: #5fd0c2; --brand-soft: #12302d;
    --accent-soft: #3a2c0d; --bg: #0e131b; --card: #161d28; --ink: #e8edf5; --ink-2: #c6cfdc;
    --muted: #8e99ab; --line: #263142; --line-2: #33405484; --ok-soft: #12301f; --bad-soft: #3a1a1a;
    --info-soft: #14243d; --warn-soft: #33270f; --violet-soft: #221a3d; --code-bg: #0a0f17;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; gap: 20px; height: 62px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem; color: var(--ink); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.logo span.tld { color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { color: var(--brand); background: var(--brand-soft); }
.topbar .spacer { flex: 1; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .dropdown { position: absolute; right: 0; top: 46px; min-width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.user-menu .dropdown a, .user-menu .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.user-menu .dropdown a:hover, .user-menu .dropdown button:hover { background: var(--bg); text-decoration: none; }
.user-menu .dropdown .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }
.avatar.sys { background: var(--accent); }
.mobile-nav { display: none; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none !important; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-accent { background: var(--accent); color: #241a02; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-light { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-light:hover { background: rgba(255,255,255,.26); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.error { color: var(--bad); font-size: .85rem; margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; }

/* ---------- Flash ---------- */
.flash { margin: 16px auto 0; padding: 12px 16px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 500; border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card h3 { font-size: 1.02rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #22b39f); border-radius: 99px; }

/* ---------- Landing ---------- */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(242,165,22,.25), transparent 60%), linear-gradient(135deg, #0b5f57 0%, #0e7c70 55%, #14907f 100%); color: #fff; }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding-top: 64px; padding-bottom: 64px; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 800; letter-spacing: -.03em; }
.hero p.lead { font-size: 1.15rem; opacity: .92; max-width: 34em; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-art { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 18px; backdrop-filter: blur(4px); }
.section { padding: 56px 0; }
.section h2 { font-size: 1.7rem; font-weight: 800; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 24px; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; font-size: 1.3rem; }

/* ---------- Course cards ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.course-card { overflow: hidden; display: flex; flex-direction: column; color: inherit; transition: box-shadow .2s, transform .2s; }
.course-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.course-card .cover { aspect-ratio: 16/8; background: linear-gradient(135deg, #0b5f57, #14907f); display: grid; place-items: center; overflow: hidden; }
.course-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-card h3 { margin: 0; font-size: 1.08rem; }
.course-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }

/* ---------- Feed (wall) ---------- */
.feed-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 22px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
.side-card { position: sticky; top: 84px; }
.profile-card { text-align: center; padding: 22px 18px; }
.profile-card .avatar { margin: 0 auto 10px; }
.side-nav { display: flex; flex-direction: column; padding: 8px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; }
.side-nav a:hover { background: var(--bg); text-decoration: none; }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.post { padding: 18px 20px; margin-bottom: 16px; }
.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.post-head .who { font-weight: 700; font-size: .95rem; }
.post-head .when { font-size: .8rem; color: var(--muted); }
.post h3 { font-size: 1.08rem; margin-bottom: 6px; }
.post .body { color: var(--ink-2); white-space: pre-line; }
.post .attach { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: inherit; }
.post .attach:hover { text-decoration: none; border-color: var(--brand); }
.post .attach .thumb { width: 96px; height: 56px; border-radius: 8px; overflow: hidden; flex: none; background: var(--brand); }
.post .attach .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post.pinned { border-color: var(--accent); }
.continue-card { padding: 16px; }
.continue-card + .continue-card { margin-top: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- Course page ---------- */
.course-hero { background: linear-gradient(135deg, #0b5f57 0%, #0e7c70 60%, #14907f 100%); color: #fff; }
.course-hero .container { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; padding-top: 40px; padding-bottom: 40px; align-items: center; }
.course-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; }
.course-hero .sub { font-size: 1.1rem; opacity: .92; }
.course-hero .facts { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0 22px; font-size: .92rem; opacity: .95; }
.course-hero .facts span { display: inline-flex; align-items: center; gap: 6px; }
.course-hero .cover { border-radius: 16px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,.25); background: rgba(255,255,255,.1); }
.course-hero .progress { background: rgba(255,255,255,.25); max-width: 360px; }
.course-hero .progress > span { background: var(--accent); }
.course-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding-top: 32px; padding-bottom: 56px; align-items: start; }
.learn-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.learn-list li { position: relative; padding-left: 28px; }
.learn-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--brand); font-weight: 800; }
.toc-part { margin-bottom: 14px; overflow: hidden; }
.toc-part > header { padding: 16px 20px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); background: var(--card); }
.toc-part .num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.toc-part h3 { margin: 0; font-size: 1.05rem; }
.toc-part.soon { opacity: .75; }
.toc-part.soon .num { background: var(--bg); color: var(--muted); }
.toc-ch { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--ink); border-bottom: 1px solid var(--line); }
.toc-ch:last-child { border-bottom: 0; }
.toc-ch:hover { background: var(--bg); text-decoration: none; }
.toc-ch .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: .7rem; color: #fff; }
.toc-ch.done .dot { background: var(--ok); border-color: var(--ok); }
.toc-ch .t { flex: 1; }
.toc-ch .m { font-size: .82rem; color: var(--muted); }

/* ---------- Chapter reader ---------- */
.reader { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.reader-side { background: var(--card); border-right: 1px solid var(--line); position: sticky; top: 62px; height: calc(100vh - 62px); overflow-y: auto; padding: 18px 0 30px; }
.reader-side .course-t { padding: 0 18px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.reader-side .course-t a { color: var(--ink); font-weight: 700; }
.reader-side .part-t { padding: 14px 18px 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.reader-side a.ch { display: flex; gap: 10px; align-items: flex-start; padding: 8px 18px; color: var(--ink-2); font-size: .92rem; border-left: 3px solid transparent; }
.reader-side a.ch:hover { background: var(--bg); text-decoration: none; }
.reader-side a.ch.current { background: var(--brand-soft); color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; }
.reader-side a.ch .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; margin-top: 2px; display: grid; place-items: center; font-size: .6rem; color: #fff; }
.reader-side a.ch.done .dot { background: var(--ok); border-color: var(--ok); }
.reader-main { padding: 34px 24px 80px; min-width: 0; }
.article { min-width: 0; overflow-wrap: break-word; }
.course-hero .cover img, .course-card .cover img { display: block; }
html, body { overflow-x: hidden; }
.article { max-width: 780px; margin: 0 auto; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.chapter-title { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.chapter-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: 28px; flex-wrap: wrap; }
.side-toggle { display: none; }

/* ---------- Content blocks (prose) ---------- */
.prose { font-size: 1.06rem; line-height: 1.75; color: var(--ink-2); }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 1.5rem; color: var(--ink); margin: 2em 0 .7em; padding-top: .3em; font-weight: 800; scroll-margin-top: 80px; }
.prose h3 { font-size: 1.2rem; color: var(--ink); margin: 1.6em 0 .6em; font-weight: 700; scroll-margin-top: 80px; }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--bg); border: 1px solid var(--line); padding: .1em .38em; border-radius: 6px; color: var(--ink); }
.prose figure { margin: 1.8em 0; }
.prose figure img { display: block; margin: 0 auto; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.prose figcaption { text-align: center; font-size: .88rem; color: var(--muted); margin-top: 10px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose .table-wrap { overflow-x: auto; margin: 1.5em 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--bg); color: var(--ink); font-weight: 700; }
.prose tr:last-child td { border-bottom: 0; }
.prose .table-caption { font-size: .88rem; color: var(--muted); text-align: center; margin-top: -0.8em; margin-bottom: 1.5em; }
.codeblock { margin: 1.5em 0; border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.codeblock .bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: rgba(255,255,255,.06); color: #9fb0c7; font-size: .78rem; font-family: var(--mono); }
.codeblock .bar button { background: none; border: 1px solid rgba(255,255,255,.2); color: #cfd8e6; border-radius: 6px; padding: 2px 9px; cursor: pointer; font-size: .75rem; }
.codeblock pre { margin: 0; padding: 16px; overflow-x: auto; font-family: var(--mono); font-size: .9rem; line-height: 1.6; color: var(--code-ink); }
.codeblock pre code.hljs { background: transparent; padding: 0; }
.math-block { margin: 1.4em 0; overflow-x: auto; text-align: center; padding: 6px 0; }

.callout { margin: 1.6em 0; padding: 16px 18px 16px 18px; border-radius: 12px; border-left: 4px solid; display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.callout .ci { font-size: 1.25rem; line-height: 1.4; }
.callout .ct { font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.info { background: var(--info-soft); border-color: var(--info); }
.callout.tip { background: var(--ok-soft); border-color: var(--ok); }
.callout.warning { background: var(--warn-soft); border-color: var(--accent); }
.callout.remember { background: var(--violet-soft); border-color: var(--violet); }
.callout.definition { background: var(--brand-soft); border-color: var(--brand); }
.callout.objectives { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); }
.callout.summary { background: var(--accent-soft); border-color: var(--accent); }

.steps { counter-reset: step; list-style: none; padding: 0 !important; margin: 1.5em 0; }
.steps li { counter-increment: step; position: relative; padding: 2px 0 14px 50px; margin: 0; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .95rem; }
.steps li::after { content: ""; position: absolute; left: 16px; top: 36px; bottom: 2px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li strong:first-child { display: block; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 1.5em 0; }
.compare > div { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--card); }
.compare h4 { margin: 0 0 8px; font-size: 1.02rem; color: var(--ink); }
.compare ul { margin: 0; font-size: .97rem; }

.video { position: relative; aspect-ratio: 16/9; margin: 1.5em 0; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Quiz ---------- */
.quiz { margin: 2.4em 0 1.6em; padding: 24px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.quiz h2 { margin-top: 0 !important; padding-top: 0 !important; font-size: 1.35rem; }
.quiz .q { padding: 16px 0; border-top: 1px solid var(--line); }
.quiz .q:first-of-type { border-top: 0; }
.quiz .q-text { font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.quiz .opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 7px 0; cursor: pointer; font-size: .98rem; transition: border-color .15s, background .15s; }
.quiz .opt:hover { border-color: var(--brand); }
.quiz .opt input { margin-top: 5px; accent-color: var(--brand); }
.quiz .opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.quiz .opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.quiz .explain { display: none; margin-top: 8px; font-size: .93rem; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.quiz .explain.show { display: block; }
.quiz .result { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 12px; font-weight: 600; }
.quiz .result.show { display: block; }
.quiz .result.good { background: var(--ok-soft); color: var(--ok); }
.quiz .result.meh { background: var(--warn-soft); color: var(--warn); }

/* ---------- Chapter footer ---------- */
.chapter-end { margin-top: 40px; padding: 24px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-align: center; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.pager a:hover { border-color: var(--brand); text-decoration: none; }
.pager a .lbl { font-size: .8rem; color: var(--muted); }
.pager a.next { text-align: right; grid-column: 2; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 440px; padding: 30px; }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .92rem; color: var(--muted); }

/* ---------- Admin ---------- */
.page-head { padding: 28px 0 8px; }
.page-head h1 { font-size: 1.7rem; font-weight: 800; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 14px 0 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px; }
.stat .n { font-size: 1.8rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .88rem; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg); }
.table-scroll { overflow-x: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { width: auto; padding: 7px 10px; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.log { font-family: var(--mono); font-size: .82rem; background: var(--code-bg); color: var(--code-ink); padding: 14px; border-radius: 10px; white-space: pre-wrap; }

footer.site { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .88rem; background: var(--card); }
footer.site .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .feed-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .feed-layout .right-col { display: none; }
}
@media (max-width: 900px) {
  .hero .container, .course-hero .container, .course-body { grid-template-columns: 1fr; }
  .course-hero .cover { max-width: 420px; }
  .features { grid-template-columns: 1fr; }
  .reader { grid-template-columns: minmax(0, 1fr); }
  .reader-side { position: fixed; left: 0; top: 62px; bottom: 0; width: 300px; max-width: 86vw; z-index: 40; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); height: auto; }
  .reader-side.open { transform: translateX(0); }
  .side-toggle { display: inline-flex; margin-bottom: 16px; }
  .reader-main { padding: 22px 16px 70px; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .mobile-nav { display: flex; justify-content: space-around; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--card); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; font-size: .72rem; color: var(--muted); padding: 4px 10px; }
  .mobile-nav a.active { color: var(--brand); }
  .mobile-nav a svg { width: 22px; height: 22px; }
  body.has-mobile-nav { padding-bottom: 64px; }
  .feed-layout { grid-template-columns: 1fr; padding-top: 16px; }
  .feed-layout .left-col { display: none; }
  .learn-list { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .prose { font-size: 1.02rem; }
  .quiz { padding: 18px 16px; }
  .topbar .btn-ghost.hide-sm { display: none; }
}
