/* cssec — styles. No external fonts or CDNs (strict CSP). */
:root {
  --bg: #0b0f14; --bg-2: #10161d; --surface: #131b24; --surface-2: #1a2430;
  --border: #233040; --text: #dbe4ee; --muted: #8494a7; --heading: #f2f6fa;
  --accent: #3ee6a8; --accent-2: #5cc8ff; --accent-ink: #04130d;
  --warn: #ffb547; --danger: #ff6b6b; --ok: #3ee6a8;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1160px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fb; --bg-2: #eef2f6; --surface: #ffffff; --surface-2: #f1f5f9;
    --border: #dde4ec; --text: #1f2a37; --muted: #5b6b7d; --heading: #0b1520;
    --accent: #0a9e6a; --accent-2: #0b7fc1; --accent-ink: #ffffff;
    --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px -12px rgba(16,24,40,.15);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.wrap-wide { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.inline { display: inline; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.empty { padding: 28px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.logo { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; color: var(--heading); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-prompt { color: var(--accent); }
.cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--accent); vertical-align: -2px; margin-left: 3px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav > a, .linklike { color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); font-size: .95rem; }
.site-nav > a:hover, .linklike:hover { background: var(--surface-2); text-decoration: none; }
.site-nav > a[aria-current] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav-admin { color: var(--warn) !important; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-search input { width: 170px; padding: 7px 12px; font-size: .9rem; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 42px; height: 38px; cursor: pointer; }
.bars, .bars::before, .bars::after { display: block; width: 18px; height: 2px; background: var(--text); margin: 0 auto; position: relative; transition: transform .2s; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; } .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 920px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 12px 20px 18px; max-height: calc(100vh - 64px); overflow-y: auto; }
  .site-nav.is-open { display: flex; }
  .site-nav > a, .linklike { padding: 12px; text-align: left; width: 100%; }
  .nav-search input { width: 100%; margin: 6px 0; padding: 11px 12px; }
  .site-nav .btn { justify-content: center; }
}

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 .95rem/1.2 var(--font); cursor: pointer; transition: filter .15s, transform .05s; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; align-items: center; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; /* prevents iOS zoom */ }
textarea { resize: vertical; line-height: 1.55; }
textarea[data-md] { font-family: var(--mono); font-size: 14px; min-height: 420px; tab-size: 4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.form label, .label { display: block; margin-bottom: 14px; font-size: .9rem; font-weight: 600; color: var(--heading); }
.form label > input, .form label > select, .form label > textarea { margin-top: 6px; font-weight: 400; }
.form label.check, label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text); }
label.check input { margin-top: 5px; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; color: var(--heading); margin-bottom: 10px; float: left; width: 100%; }
legend + * { clear: both; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input[type=text], .inline-form input[type=search], .inline-form select { width: auto; flex: 1 1 160px; }
.w-num { width: 90px !important; flex: 0 0 90px !important; }

/* ---------- Flash ---------- */
.flashes { margin-top: 18px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 10px; border: 1px solid; font-size: .95rem; }
.flash-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.flash-info { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); background: color-mix(in srgb, var(--accent-2) 10%, transparent); }

/* ---------- Hero ---------- */
.hero { border-bottom: 1px solid var(--border); background:
  radial-gradient(800px 400px at 85% -10%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 70%),
  radial-gradient(700px 380px at 5% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%); }
.hero-inner { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 72px; }
.eyebrow { font-family: var(--mono); font-size: .82rem; color: var(--accent); letter-spacing: .02em; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.5rem); }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 1.13rem; color: var(--muted); max-width: 62ch; }
.terminal { background: #070a0e; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.terminal-bar { display: flex; gap: 7px; align-items: center; padding: 10px 14px; background: #0e141b; border-bottom: 1px solid #1c2733; }
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; } .terminal-bar i:nth-child(2) { background: #febc2e; } .terminal-bar i:nth-child(3) { background: #28c840; }
.terminal-bar span { margin-left: 8px; font: .78rem var(--mono); color: #6c7a89; }
.terminal pre { margin: 0; padding: 18px 20px; font-size: .9rem; line-height: 1.7; color: #c9d6e2; overflow-x: auto; }
.t-p { color: #3ee6a8; } .t-o { color: #e8eef4; } .t-d { color: #5cc8ff; }

/* ---------- Sections / grids / cards ---------- */
.section { padding-top: 56px; padding-bottom: 8px; }
.section.band { background: var(--bg-2); border-block: 1px solid var(--border); padding-bottom: 48px; margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-topics { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-bottom: 48px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 4px 0 2px; } .card h3 a { color: var(--heading); } .card p { margin: 0; }
.card-media img, .cover-fallback { aspect-ratio: 16/9; width: 100%; object-fit: cover; }
.cover-fallback { display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, var(--surface-2)), color-mix(in srgb, var(--accent-2) 25%, var(--surface-2))); }
.cover-fallback span { font: 700 2.4rem var(--mono); color: var(--heading); opacity: .8; }
.post-card, .project-card, .course-card { transition: border-color .15s, transform .15s; }
.post-card:hover, .project-card:hover, .course-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.project-card.is-featured { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-block; font: 600 .75rem/1 var(--mono); padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.chip-alt { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.level { font: .72rem var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.level-beginner { color: var(--ok); } .level-intermediate { color: var(--warn); } .level-advanced { color: var(--danger); }
.price { margin-left: auto; font-weight: 700; color: var(--heading); }
.stack { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0 0; }
.stack li { font: .75rem var(--mono); padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }

.topic { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: border-color .15s, transform .15s; }
.topic:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.topic strong { color: var(--heading); font-size: 1.05rem; }
.topic-count { margin-top: auto; font: .78rem var(--mono); color: var(--accent); }
.topic-icon { width: 36px; height: 36px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); display: grid; place-items: center; font: 700 .95rem var(--mono); color: var(--accent); }
.icon-net::before { content: "⇄"; } .icon-code::before { content: "</>"; font-size: .75rem; } .icon-chip::before { content: "▦"; }
.icon-win::before { content: "⊞"; } .icon-term::before { content: ">_"; font-size: .8rem; } .icon-lock::before { content: "🔒︎"; font-size: .85rem; } .icon-bolt::before { content: "⚡︎"; }

.row-item { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--border); }
.row-item a strong { color: var(--heading); }

/* ---------- Page heads / sidebars ---------- */
.page-head { padding-top: 48px; padding-bottom: 24px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--accent); }
.with-sidebar { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; padding-bottom: 56px; }
.side-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); display: flex; justify-content: space-between; }
.side-nav a:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a[aria-current] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.count { font: .78rem var(--mono); color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; margin: 32px 0; }

/* ---------- Articles ---------- */
.article-layout { max-width: 820px; padding-top: 40px; padding-bottom: 40px; }
.article-layout.has-toc { max-width: var(--wrap); display: grid; grid-template-columns: minmax(0, 1fr) 240px; column-gap: 48px; }
.article-layout.has-toc > :not(.toc) { grid-column: 1; }
.article-layout.has-toc .toc { grid-column: 2; grid-row: 1 / span 4; }
.article-head { margin-bottom: 24px; }
.article-cover { border-radius: var(--radius); margin-bottom: 28px; border: 1px solid var(--border); }
.toc { position: sticky; top: 84px; align-self: start; font-size: .88rem; }
.toc summary { font-weight: 700; color: var(--heading); cursor: pointer; margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 4px 12px; color: var(--muted); }
.toc li a:hover { color: var(--accent); text-decoration: none; }
.toc .toc-l3 a { padding-left: 24px; }
.article-foot { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tags a { font: .85rem var(--mono); }

.prose { font-size: 1.04rem; overflow-wrap: break-word; }
.prose h2 { margin-top: 2em; padding-top: .2em; }
.prose h3 { margin-top: 1.6em; }
.prose h2, .prose h3, .prose h4 { position: relative; }
.prose .anchor { position: absolute; left: -1em; color: var(--muted); opacity: 0; font-weight: 400; }
.prose :is(h2, h3, h4):hover .anchor { opacity: 1; text-decoration: none; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .3em 0; }
.prose li > input[type=checkbox] { accent-color: var(--accent); margin-right: 6px; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); margin: 1.2em 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0; }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 3px solid var(--border); color: var(--muted); }
.prose :not(pre) > code { font-size: .88em; padding: .15em .4em; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--heading); }
.code { margin: 1.3em 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #0a0e13; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #0f151c; border-bottom: 1px solid #1c2733; font: .75rem var(--mono); color: #7d8c9c; }
.copy { background: none; border: 1px solid #2a3644; color: #9fb0c2; border-radius: 4px; padding: 2px 8px; font: inherit; cursor: pointer; }
.copy:hover { color: #3ee6a8; border-color: #3ee6a8; }
.code pre { margin: 0; padding: 16px; overflow-x: auto; font-size: .87rem; line-height: 1.6; color: #d4dde6; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: var(--heading); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.callout { margin: 1.4em 0; padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: .3em; }
.callout-tip { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 7%, transparent); }
.callout-tip .callout-title { color: var(--ok); }
.callout-note, .callout-info { border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); background: color-mix(in srgb, var(--accent-2) 7%, transparent); }
.callout-note .callout-title, .callout-info .callout-title { color: var(--accent-2); }
.callout-warning { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.callout-warning .callout-title { color: var(--warn); }
.callout-danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.callout-danger .callout-title { color: var(--danger); }

.blog-list { list-style: none; padding: 0; margin: 0; }
.blog-list li { padding: 26px 0; border-bottom: 1px solid var(--border); }
.blog-list h2 { margin: 4px 0 8px; font-size: 1.45rem; } .blog-list h2 a { color: var(--heading); }
.search-big { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- Courses ---------- */
.course-hero { background: var(--bg-2); border-bottom: 1px solid var(--border); }
.course-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; padding-top: 44px; padding-bottom: 44px; align-items: start; }
.buy-box { position: sticky; top: 84px; }
.buy-box img { aspect-ratio: 16/9; object-fit: cover; }
.price-big { font-size: 1.8rem; font-weight: 800; color: var(--heading); margin: 0 0 6px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0 10px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.course-body { max-width: 860px; margin-left: max(20px, calc((100% - var(--wrap)) / 2 + 20px)); padding-top: 36px; padding-bottom: 56px; }
.module { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
.module summary { padding: 14px 16px; cursor: pointer; font-weight: 600; color: var(--heading); display: flex; gap: 10px; align-items: center; }
.module summary .muted { margin-left: auto; font-weight: 400; }
.module-n { font: .8rem var(--mono); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.lessons { list-style: none; margin: 0; padding: 0 16px 10px; }
.lessons li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0 9px 26px; border-top: 1px solid var(--border); position: relative; }
.lessons li::before { content: "○"; position: absolute; left: 2px; color: var(--muted); }
.lessons li.is-done::before { content: "●"; color: var(--accent); }
.locked { color: var(--muted); } .locked::after { content: " 🔒︎"; font-size: .8em; }
.my-course { margin-bottom: 12px; color: var(--text); } .my-course:hover { text-decoration: none; border-color: var(--accent); }

.lesson-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; padding-top: 32px; padding-bottom: 56px; }
.lesson-nav { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: .9rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.lesson-nav summary { font-weight: 700; cursor: pointer; }
.lesson-nav summary a { color: var(--heading); }
.lesson-nav .module-title { margin: 14px 0 4px; font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lesson-nav ol { list-style: none; padding: 0; margin: 0; }
.lesson-nav li a { display: block; padding: 5px 8px 5px 22px; color: var(--text); border-radius: 4px; position: relative; }
.lesson-nav li a::before { content: "○"; position: absolute; left: 4px; color: var(--muted); }
.lesson-nav li.is-done a::before { content: "●"; color: var(--accent); }
.lesson-nav li.is-current a { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.lesson-main { max-width: 820px; }
.video { position: relative; aspect-ratio: 16/9; margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 20px; }
.lesson-pager { display: flex; justify-content: space-between; gap: 16px; }

/* ---------- Auth ---------- */
.auth { max-width: 440px; padding-top: 56px; padding-bottom: 72px; }
.auth h1 { font-size: 1.7rem; }

/* ---------- Errors ---------- */
.error-code { font: 800 5rem/1 var(--mono); color: var(--accent); margin: 20px 0 10px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); margin-top: 48px; }
.footer-inner { display: grid; grid-template-columns: 1.2fr 2fr; gap: 40px; padding-top: 44px; padding-bottom: 28px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.footer-cols h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.footer-cols a { display: block; color: var(--text); padding: 3px 0; font-size: .93rem; }
.footer-bottom { padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--border); font-size: .82rem; }

/* ---------- Admin ---------- */
.admin-main { padding-top: 28px; padding-bottom: 60px; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.admin-head h1 { margin: 0; font-size: 1.8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat b { display: block; font-size: 1.6rem; color: var(--heading); }
.stat span { font-size: .82rem; color: var(--muted); }
.status { font: .72rem var(--mono); text-transform: uppercase; padding: 3px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.status-published, .status-paid { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status-draft, .status-pending { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status-failed, .status-refunded, .status-expired { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor-side { position: sticky; top: 84px; }
.editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.editor textarea { border: 0; border-radius: 0; }
.editor-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.editor-tabs button { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 4px; cursor: pointer; font: 600 .85rem var(--font); }
.editor-tabs button.is-on { background: var(--surface); color: var(--heading); }
.editor-tabs .small { margin-left: auto; padding-right: 6px; }
.editor-preview { padding: 18px 22px 22px 34px; min-height: 420px; background: var(--bg); }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: 1px dashed var(--border); }
.module-admin { margin-bottom: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.media-grid img { aspect-ratio: 4/3; object-fit: cover; }
.media-grid input { font: .75rem var(--mono); padding: 6px 8px; }
.secret { font-size: 1.25rem; letter-spacing: .08em; padding: 14px; background: var(--bg-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); text-align: center; word-break: break-all; }
.narrow-card { max-width: 560px; }
tr.is-disabled td { opacity: .5; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout.has-toc { display: block; max-width: 820px; }
  .toc { position: static; margin-bottom: 24px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
  .toc details:not([open]) summary { margin: 0; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
@media (max-width: 820px) {
  .hero-inner, .course-hero-inner, .two-col, .with-sidebar, .lesson-layout, .footer-inner { grid-template-columns: 1fr; }
  .hero-inner { padding-top: 44px; padding-bottom: 44px; gap: 32px; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: thin; }
  .side-nav a { white-space: nowrap; border: 1px solid var(--border); gap: 6px; }
  .buy-box, .lesson-nav { position: static; max-height: none; }
  .lesson-nav details:not([open]) { margin: 0; }
  .course-body { margin-left: auto; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .grid-3 { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .search-big { flex-direction: column; }
  .terminal pre { font-size: .8rem; }
  .prose .anchor { display: none; }
  .lesson-pager { flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media print {
  .site-header, .site-footer, .toc, .lesson-nav, .copy { display: none !important; }
  body { background: #fff; color: #000; }
}
.al-center { text-align: center !important; } .al-right { text-align: right !important; }
.progress span { width: 0; transition: width .4s; }

/* ---------- Syntax highlighting (Prism, themed to match) ---------- */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #5c6b7a; font-style: italic; }
.token.punctuation { color: #8aa0b4; }
.token.namespace { opacity: .7; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #ff8a8a; }
.token.boolean, .token.number { color: #ffb86b; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #b5e89a; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #7fd4ff; }
.token.atrule, .token.attr-value, .token.keyword { color: #7fd4ff; }
.token.function, .token.class-name { color: #ffd479; }
.token.regex, .token.important, .token.variable { color: #ff9edb; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }
.token.deleted { color: #ff6b6b; }
.token.inserted { color: #3ee6a8; }
@media (prefers-color-scheme: light) {
  .code { background: #0d1117; } /* keep code blocks dark in light mode for contrast */
}

/* ---------- Roadmap (domains + tracks + plan) ---------- */
.nav-start { color: var(--accent) !important; font-weight: 600; }
.rm-plan { position: sticky; top: 72px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.rm-plan-count { background: var(--accent); color: var(--accent-ink); font: 700 .8rem var(--mono); min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 999px; }
.rm-plan-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; flex: 1 1 100%; order: 3; }
.rm-plan-list:empty { display: none; }
.rm-plan-list li { font: .78rem var(--mono); padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.rm-plan-clear { margin-left: auto; color: var(--muted); font-size: .85rem; }
.rm-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.rm-tab { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font: 600 .9rem var(--font); }
.rm-tab:hover { border-color: var(--accent); }
.rm-tab.is-on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--accent); }
.rm-tab .topic-icon { width: 22px; height: 22px; font-size: .7rem; }
.rm-domain { margin-bottom: 40px; scroll-margin-top: 140px; }
.rm-domain-head { margin-bottom: 16px; }
.rm-domain-head h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rm-domain-head .topic-icon { width: 32px; height: 32px; }
.grid-tracks { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.track-card { position: relative; transition: border-color .15s, transform .15s; }
.track-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-2px); }
.track-card.is-picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.track-card h3 { font-size: 1.05rem; margin: 2px 0; padding-right: 32px; }
.track-pick { position: absolute; top: 12px; right: 12px; cursor: pointer; }
.track-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track-star { font-size: 1.4rem; line-height: 1; color: var(--muted); transition: color .15s, transform .1s; display: inline-block; }
.track-pick:hover .track-star { color: var(--accent); }
.track-pick input:checked ~ .track-star { color: var(--accent); }
.track-pick input:checked ~ .track-star::before { content: "★"; }
.track-pick input:checked ~ .track-star { font-size: 0; }
.track-pick input:checked ~ .track-star::before { font-size: 1.4rem; }
.track-pick input:focus-visible ~ .track-star { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 3px; }
.track-read { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; font-size: .9rem; }
.track-read .soon { color: var(--muted); }
.track-read code { font-size: .85em; }
.track-ex { margin-top: 8px; }
.track-ex summary { cursor: pointer; font-size: .85rem; color: var(--accent); font-weight: 600; }
.track-ex ol { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; color: var(--muted); }
.track-ex li { margin: 6px 0; }
.track-ex code, .track-read code { padding: .1em .35em; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--heading); }
.rm-foot { text-align: center; margin: 32px auto 8px; max-width: 640px; }
@media (max-width: 600px) {
  .grid-tracks { grid-template-columns: 1fr; }
  .rm-plan { top: 64px; }
}

/* ---------- Signup puzzle ---------- */
.puzzle { border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.puzzle h2 { font-size: 1rem; margin-bottom: 6px; }
.puzzle summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.puzzle ol { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; color: var(--muted); }
.puzzle code { font-size: .85em; padding: .1em .35em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; color: var(--heading); }

/* ---------- Mobile: kill horizontal overflow ---------- */
html { overflow-x: clip; }
body { overflow-x: clip; max-width: 100%; }
img, svg, video, iframe, pre, table, textarea, input, canvas { max-width: 100%; }
pre, .prose, .rm-card, .card { min-width: 0; }
* { overflow-wrap: break-word; }

/* ---------- Roadmap quizzes ---------- */
.track-done { font: .72rem var(--mono); color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); padding: 2px 7px; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.track-quiz { margin-top: 6px; }
.track-quiz > summary { cursor: pointer; font-size: .85rem; color: var(--accent-2); font-weight: 600; }
.quiz-body { margin-top: 10px; }
.quiz-q { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 10px; }
.quiz-q legend { font-weight: 600; color: var(--heading); padding: 0 6px; font-size: .92rem; }
.quiz-q.is-correct { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.quiz-q.is-wrong { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 6%, transparent); }
.quiz-opt { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; color: var(--text); margin: 6px 0; cursor: pointer; font-size: .92rem; }
.quiz-opt input { margin-top: 4px; accent-color: var(--accent); flex: 0 0 auto; }
.quiz-opt code { font-size: .85em; padding: .05em .3em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; }
.quiz-feedback { margin: 8px 0 0; padding: 8px 10px; font-size: .88rem; color: var(--muted); background: var(--bg-2); border-radius: var(--radius-sm); }
.quiz-feedback code { font-size: .85em; }
.quiz-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.quiz-score { font: 700 .95rem var(--mono); color: var(--muted); }
.quiz-score.is-pass { color: var(--ok); }

/* ---------- Challenges & lab ---------- */
.chal-cat { margin-bottom: 36px; }
.chal-cat h2 { text-transform: capitalize; }
.chal-card { color: var(--text); transition: border-color .15s, transform .15s; }
.chal-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.chal-card.is-solved { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); background: color-mix(in srgb, var(--ok) 5%, transparent); }
.chal-card h3 { font-size: 1.02rem; margin: 4px 0 2px; color: var(--heading); }
.flag-form { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.flag-form input { flex: 1 1 260px; font-family: var(--mono); }
.hint { margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface); }
.hint summary { cursor: pointer; color: var(--accent-2); font-weight: 600; }
.lab-panel { margin-bottom: 24px; }
.lab-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.lab-head h2 { margin: 0; }
.lab-conn { background: #0a0e13; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; }
.lab-conn code { color: var(--accent); font-size: .95rem; }
