/* PrepStack — shared design system */
:root {
  --bg: #f5f6fb; --surface: #fff; --surface-2: #f7f8fc; --surface-3: #eef0f7; --line: #e4e7f1; --line-2: #d3d8e8;
  --text: #10132a; --text-2: #363d5a; --muted: #616a87; --faint: #98a0b8;
  --accent: #5b5bd6; --accent-soft: #efefff; --accent-ink: #fff;
  --ok: #047857; --ok-bg: #dcf5ea; --info: #0369a1; --info-bg: #e0f1fb; --warn: #a15c07; --warn-bg: #fff6e5; --warn-line: #f3d9a4;
  --bad: #be123c; --bad-bg: #ffe4ea;
  --code-bg: #f7f8fc; --code-line: #e4e7f1;
  --tk-kw: #7c3aed; --tk-str: #0f7a4f; --tk-num: #b45309; --tk-com: #8a91a8; --tk-fn: #1d4ed8; --tk-type: #be185d;
  --shadow: 0 1px 2px rgba(16, 19, 42, .04), 0 4px 14px rgba(16, 19, 42, .05);
  --shadow-lg: 0 10px 40px rgba(16, 19, 42, .12);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --grad: linear-gradient(135deg, #0ea5e9, #6366f1 50%, #d946ef);
  --radius: 18px;
  color-scheme: light;
}
:root[data-mod="frontend"] { --accent: #2563eb; --accent-soft: #e8f0ff; }
:root[data-mod="backend"] { --accent: #047857; --accent-soft: #e0f6ec; }
:root[data-mod="databases"] { --accent: #c2410c; --accent-soft: #fff0e6; }
:root[data-mod="ai"] { --accent: #9333ea; --accent-soft: #f5ebff; }
:root[data-mod="devops"] { --accent: #0e7490; --accent-soft: #e2f6f9; }
:root[data-mod="cs"] { --accent: #be185d; --accent-soft: #fde8f1; }

:root[data-theme="dark"] {
  --bg: #12141b; --surface: #1b1e27; --surface-2: #20242f; --surface-3: #282d3a; --line: #2d3240; --line-2: #3b4152;
  --text: #e6e8ef; --text-2: #c2c7d3; --muted: #959cae; --faint: #6c7285;
  --accent: #9c9cf5; --accent-soft: #262744; --accent-ink: #10132a;
  --ok: #74d3a8; --ok-bg: #1b3329; --info: #7cc4ea; --info-bg: #1a2d3a; --warn: #e8bf6a; --warn-bg: #2d2819; --warn-line: #4a3f25;
  --bad: #f49aae; --bad-bg: #3a1f28;
  --code-bg: #161921; --code-line: #2a2f3b;
  --tk-kw: #c4a7ff; --tk-str: #8fd6a8; --tk-num: #f0b77a; --tk-com: #737b90; --tk-fn: #8fb5ff; --tk-type: #f29cc4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
:root[data-theme="dark"][data-mod="frontend"] { --accent: #7aa7f5; --accent-soft: #1d2840; }
:root[data-theme="dark"][data-mod="backend"] { --accent: #5fd4a6; --accent-soft: #17322a; }
:root[data-theme="dark"][data-mod="databases"] { --accent: #f0a06a; --accent-soft: #36281e; }
:root[data-theme="dark"][data-mod="ai"] { --accent: #c49bff; --accent-soft: #2d2342; }
:root[data-theme="dark"][data-mod="devops"] { --accent: #6fcbd8; --accent-soft: #19333a; }
:root[data-theme="dark"][data-mod="cs"] { --accent: #f29cc4; --accent-soft: #3a2030; }

* { box-sizing: border-box; }
html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
#app { flex: 1; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; font-weight: 600; } a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── header ── */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex: none; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--grad); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 13px; letter-spacing: -.02em; flex: none; box-shadow: 0 4px 12px rgba(99, 102, 241, .3); }
.brand b { font-size: 16px; letter-spacing: -.02em; font-weight: 800; white-space: nowrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; margin-left: 6px; }
.crumbs a { color: var(--muted); font-weight: 600; white-space: nowrap; } .crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--faint); } .crumbs .here { color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 10px; height: 40px; width: min(320px, 32vw); padding: 0 10px 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--faint); font-size: 14px; cursor: pointer; text-align: left; flex: none; }
.search-btn:hover { border-color: var(--accent); }
.search-btn span:not(.ei) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--surface-2); line-height: 18px; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 16px; flex: none; color: var(--text-2); }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#menu { display: none; }

/* ── footer ── */
footer.foot-w { border-top: 1px solid var(--line); margin-top: 48px; }
.foot { max-width: 1320px; margin: 0 auto; padding: 24px 20px 36px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.foot .made { font-size: 14.5px; font-weight: 700; color: var(--text); }
.heart { color: #e11d48; display: inline-block; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }
.foot nav { display: flex; gap: 14px; flex-wrap: wrap; } .foot nav a { color: var(--muted); }

/* ── shared bits ── */
.mono { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; font-family: var(--mono); font-weight: 800; font-size: 13px; letter-spacing: -.03em; background: var(--m-bg, var(--accent-soft)); color: var(--m-ink, var(--accent)); }
:root[data-theme="dark"] .mono { background: color-mix(in srgb, var(--m-ink, var(--accent)) 26%, var(--surface)); color: color-mix(in srgb, var(--m-ink, var(--accent)) 35%, #fff); }
.mono.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }
.mono.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted); white-space: nowrap; flex: none; }
.pill.basic { background: var(--ok-bg); color: var(--ok); } .pill.mid { background: var(--info-bg); color: var(--info); } .pill.adv { background: var(--bad-bg); color: var(--bad); }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text); text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.sec-h { margin: 52px 2px 18px; }
.sec-h h2 { font-size: clamp(21px, 2.6vw, 26px); letter-spacing: -.025em; font-weight: 800; }
.sec-h p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.grp-h { display: flex; align-items: center; gap: 10px; margin: 30px 2px 12px; }
.grp-h h2 { font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .grp-h h2 { white-space: normal; line-height: 1.5; } .grp-h span { min-width: 24px; } }
.grp-h span { flex: 1; height: 1px; background: var(--line); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(10px); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 650; opacity: 0; transition: .2s; pointer-events: none; z-index: 90; }
.toast.on { opacity: 1; transform: translateX(-50%); }
#totop { position: fixed; right: 18px; bottom: 18px; z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: var(--shadow); }
#totop.on { opacity: 1; pointer-events: auto; }
mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ── home ── */
.page { max-width: 1180px; margin: 0 auto; padding: 0 20px; width: 100%; }
.home-hero { text-align: center; padding: 64px 0 20px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 5px 14px; border-radius: 999px; }
.home-hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.06; letter-spacing: -.045em; font-weight: 800; margin: 18px auto 0; max-width: 880px; text-wrap: balance; }
.home-hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero .lead { font-size: clamp(16px, 2vw, 18.5px); color: var(--muted); max-width: 700px; margin: 18px auto 0; }
.big-search { display: flex; align-items: center; gap: 12px; width: min(640px, 100%); margin: 30px auto 0; height: 58px; padding: 0 14px 0 20px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); color: var(--faint); font-size: 16px; cursor: pointer; box-shadow: var(--shadow-lg); text-align: left; }
.big-search:hover { border-color: var(--accent); }
.big-search span:not(.ei) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--muted); align-items: center; }
.pop a { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.pop a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.hero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 40px; margin-top: 38px; }
.hero-stats div { text-align: center; } .hero-stats b { display: block; font-size: 28px; letter-spacing: -.03em; font-weight: 800; } .hero-stats span { font-size: 13px; color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.step .n { width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.step h3 { font-size: 17px; margin-top: 14px; letter-spacing: -.01em; } .step p { color: var(--muted); font-size: 14.2px; margin-top: 6px; }

.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.mod-card { --mc: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; transition: transform .15s, border-color .15s, box-shadow .15s; position: relative; overflow: hidden; }
.mod-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--mc); }
.mod-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--mc) 45%, var(--line)); box-shadow: var(--shadow-lg); }
.mod-card .hd { display: flex; align-items: center; gap: 14px; }
.mod-card .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--mc) 14%, transparent); flex: none; }
.mod-card h3 { font-size: 19px; letter-spacing: -.02em; } .mod-card h3 a { color: var(--text); } .mod-card h3 a::after { content: ''; position: absolute; inset: 0; }
.mod-card .cnt { font-size: 13px; color: var(--muted); }
.mod-card p { color: var(--text-2); font-size: 14.2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.chip { font-size: 12.5px; font-weight: 650; padding: 3px 10px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; }
a.chip:hover { border-color: var(--mc, var(--accent)); color: var(--mc, var(--accent)); text-decoration: none; }
.chip.soon { color: var(--faint); }
.mod-card .go { font-size: 13.5px; font-weight: 700; color: var(--mc); margin-top: auto; }

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.plan .when { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.plan h3 { font-size: 17px; margin: 6px 0 10px; letter-spacing: -.01em; }
.plan ol { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14.2px; } .plan li { margin: 6px 0; }

.recent { display: flex; gap: 10px; flex-wrap: wrap; }
.recent a { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 16px 8px 8px; color: var(--text); box-shadow: var(--shadow); }
.recent a:hover { border-color: var(--accent); text-decoration: none; }
.recent small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

.feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.feat { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.feat .e { font-size: 20px; line-height: 1.2; } .feat b { display: block; font-size: 14.5px; } .feat span { font-size: 13.5px; color: var(--muted); }

/* ── module hub ── */
.hub-hero { padding: 40px 0 8px; display: flex; gap: 20px; align-items: flex-start; }
.hub-hero .ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 32px; background: var(--accent-soft); flex: none; }
.hub-hero h1 { text-wrap: balance; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.035em; line-height: 1.1; }
.hub-hero p { color: var(--muted); margin-top: 8px; max-width: 760px; font-size: 16px; }
.hub-hero .stats { margin-top: 14px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative; transition: transform .15s, border-color .15s, box-shadow .15s; }
.tcard.ready:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.tcard .hd { display: flex; align-items: center; gap: 12px; }
.tcard h3 { font-size: 16.5px; letter-spacing: -.01em; } .tcard h3 a { color: var(--text); } .tcard h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.tcard p { font-size: 13.8px; color: var(--text-2); flex: 1; }
.tcard .ft { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); min-height: 20px; }
.tcard .ft .bar { flex: 1; }
.tcard.soon { background: var(--surface-2); box-shadow: none; } .tcard.soon .mono { opacity: .55; } .tcard.soon h3 { color: var(--muted); }

/* ── topic layout ── */
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; width: 100%; }
.side { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding: 22px 2px 30px; scrollbar-width: thin; }
.side .g { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 18px 10px 6px; }
.side a.nav { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; color: var(--text-2); font-weight: 550; font-size: 14px; text-decoration: none; line-height: 1.35; }
.side a.nav:hover { background: var(--surface-3); } .side a.nav.cur { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side a.nav .n { width: 22px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); flex: none; }
.side a.nav .d { margin-left: auto; color: var(--ok); font-size: 12px; font-weight: 800; }
.side a.nav.hide { display: none; }
.prog { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.prog .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; } .prog .row span { color: var(--muted); font-size: 12.5px; }
.prog .bar { margin: 8px 0 4px; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.side .back { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 10px 12px; }

main.topic { min-width: 0; padding: 22px 0 20px; }
.t-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px 28px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.t-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); }
.t-hero .hd { display: flex; gap: 16px; align-items: center; }
.t-hero h1 { font-size: clamp(26px, 3.6vw, 36px); letter-spacing: -.035em; font-weight: 800; line-height: 1.1; }
.t-hero .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.t-hero .intro { color: var(--text-2); margin-top: 14px; max-width: 820px; font-size: 15.5px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.stat { font-size: 12.5px; font-weight: 650; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 18px; align-items: center; }
.tb-grp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 3px; background: var(--surface-3); padding: 3px; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button:hover:not(.on) { color: var(--text); }
.tb-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.chip-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 650; cursor: pointer; color: var(--text-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.quiz-note { margin-top: 14px; font-size: 13.8px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); border-left: 4px solid var(--accent); }

/* quick revision */
.quick { margin-top: 18px; background: linear-gradient(180deg, var(--accent-soft), var(--surface) 140px); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.quick h2 { font-size: 18px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.quick h2 small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.quick ol { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: q; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 24px; }
.quick li { counter-increment: q; position: relative; padding-left: 32px; font-size: 14.2px; color: var(--text-2); }
.quick li::before { content: counter(q); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--accent); font-family: var(--mono); }

/* section cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; user-select: none; }
.card-h .num { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 13px; flex: none; }
.card.done .card-h .num { background: var(--ok-bg); color: var(--ok); }
.card-h .ttl { min-width: 0; flex: 1; }
.card-h h3 { font-size: 17px; font-weight: 750; letter-spacing: -.015em; line-height: 1.3; }
.card-h .tl { font-size: 13.2px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:not(.closed) .card-h .tl { display: none; }
.card-h .chev { color: var(--faint); transition: transform .2s; flex: none; width: 16px; text-align: center; }
.card.closed .chev { transform: rotate(-90deg); } .card.closed .card-b { display: none; }
.card-b { padding: 0 20px 18px; }
.tldr { padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); border-left: 4px solid var(--accent); font-size: 15px; color: var(--text); }
.tldr b { color: var(--accent); }
.blk-h { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
ul.pts { margin: 0; padding-left: 20px; } ul.pts li { margin: 6px 0; font-size: 14.5px; color: var(--text-2); } ul.pts li::marker { color: var(--accent); }
.tbl-w { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.6px; min-width: 540px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border-top: 0; background: var(--surface-2); }
.tbl td:first-child { font-weight: 650; color: var(--text); }
.tbl td { color: var(--text-2); }

.code { border: 1px solid var(--code-line); border-radius: 14px; background: var(--code-bg); overflow: hidden; }
.code + .code { margin-top: 10px; }
.code-h { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; border-bottom: 1px solid var(--code-line); font-size: 12px; color: var(--muted); font-weight: 650; }
.code-h .v { color: var(--ok); font-weight: 700; }
.code-h button { margin-left: auto; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 3px 10px; font-size: 12px; font-weight: 650; cursor: pointer; }
.code-h button:hover { border-color: var(--accent); color: var(--accent); }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.8px; line-height: 1.65; tab-size: 2; }
.code pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
.code .out { border-top: 1px dashed var(--code-line); padding: 8px 14px 10px; font-family: var(--mono); font-size: 12.5px; color: var(--ok); white-space: pre-wrap; background: color-mix(in srgb, var(--ok-bg) 35%, var(--code-bg)); }
.code .out::before { content: 'Output'; display: block; font-family: Inter, system-ui, sans-serif; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.tk-kw { color: var(--tk-kw); font-weight: 600; } .tk-str { color: var(--tk-str); } .tk-num { color: var(--tk-num); } .tk-com { color: var(--tk-com); font-style: italic; } .tk-fn { color: var(--tk-fn); } .tk-type { color: var(--tk-type); }

.tips { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 14px; padding: 10px 14px; }
.tips ul { margin: 0; padding-left: 20px; } .tips li { font-size: 14.2px; color: var(--text-2); margin: 4px 0; }
.qa { display: flex; flex-direction: column; gap: 8px; }
.qa details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.qa summary { cursor: pointer; font-weight: 650; font-size: 14.5px; padding: 10px 14px; list-style: none; display: flex; gap: 10px; align-items: flex-start; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: 'Q'; flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11.5px; font-weight: 800; font-family: var(--mono); margin-top: 1px; }
.qa summary::after { content: '+'; margin-left: auto; padding-left: 8px; color: var(--faint); font-weight: 700; font-size: 16px; line-height: 1.3; }
.qa details[open] summary::after { content: '−'; }
.qa .ans { padding: 0 14px 12px 46px; font-size: 14.2px; color: var(--text-2); }
.card-f { display: flex; gap: 8px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.done-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 7px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.done-btn:hover { border-color: var(--ok); color: var(--ok); }
.card.done .done-btn { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.hood-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.hood-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.card-f .f-end { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.card-f .to-top, .card-f .edit-link { font-size: 12.5px; color: var(--muted); }
.card-f .edit-link:hover { color: var(--accent); }
.ai-q { margin-top: 4px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line-2)); background: transparent; color: var(--accent); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.ai-q:hover { background: var(--accent-soft); border-style: solid; }
a.chip-btn { display: inline-block; text-decoration: none; }
.print-only, .hood-print { display: none; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.pager a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; color: var(--text); box-shadow: var(--shadow); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.pager .nx { text-align: right; grid-column: 2; }

/* ── modal (under the hood) ── */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(10, 12, 20, .55); backdrop-filter: blur(3px); }
.sheet { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); }
.sheet-h { position: sticky; top: 0; background: var(--surface); display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); z-index: 1; }
.sheet-h h3 { font-size: 18px; letter-spacing: -.01em; } .sheet-h .impl { font-size: 13.5px; color: var(--accent); font-weight: 650; margin-top: 2px; }
.sheet-h .x { margin-left: auto; }
.sheet-b { padding: 6px 20px 22px; }
.sheet-b h4 { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
pre.diagram { margin: 0; padding: 12px 14px; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 12px; font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: 12.3px; line-height: 1.55; overflow-x: auto; color: var(--text); }
body.modal-open { overflow: hidden; }

/* ── Ask AI dialog ── */
.ai-sheet { width: min(720px, 100%); }
.ai-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 19px; flex: none; }
.ai-sheet #ai-sub { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ai-lead { margin: 12px 0 12px; font-size: 14px; color: var(--text-2); }
.ai-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ai-styles button { text-align: left; border: 1px solid var(--line-2); background: var(--surface); border-radius: 12px; padding: 10px 12px 10px 44px; cursor: pointer; position: relative; color: var(--text); font: inherit; }
.ai-styles button:hover { border-color: var(--accent); }
.ai-styles button.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.ai-styles .ai-s-ic { position: absolute; left: 12px; top: 10px; font-size: 18px; }
.ai-styles b { display: block; font-size: 14px; } .ai-styles small { display: block; font-size: 12.2px; color: var(--muted); line-height: 1.4; margin-top: 1px; }
.ai-lbl { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.ai-txt { width: 100%; min-height: 190px; resize: vertical; border: 1px solid var(--line-2); border-radius: 12px; background: var(--code-bg); color: var(--text); font: 12.8px/1.55 var(--mono); padding: 10px 12px; }
.ai-txt:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.ai-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.ai-copy { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 14px; cursor: pointer; }
.ai-copy:hover { filter: brightness(1.08); }
.ai-or { font-size: 13px; color: var(--muted); }
.ai-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

/* ── pre-rendered content: what crawlers and no-JS readers get; replaced by the app when JS runs ── */
html.js .pre { display: none; }
.pre { max-width: 860px; margin: 0 auto; padding: 32px 20px; }
.pre h1 { font-size: 30px; } .pre h2 { font-size: 20px; margin-top: 28px; } .pre h3 { font-size: 16px; margin: 16px 0 4px; }
.pre li { margin: 4px 0; }

/* ── search palette ── */
.pal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 20, .5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.pal-box { width: min(680px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.pal-top { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pal-top input { flex: 1; height: 56px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16.5px; outline: none; min-width: 0; }
.pal-top input::-webkit-search-cancel-button { display: none; }
.pal-top .esc { cursor: pointer; border: 0; background: none; padding: 0; }
.pal-res { overflow: auto; padding: 6px; overscroll-behavior: contain; }
.pal-grp { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: var(--text); text-decoration: none !important; font-weight: 500; }
.pal-item.on { background: var(--accent-soft); }
.pal-item .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); flex: none; font-size: 14px; }
.pal-item .tx { min-width: 0; flex: 1; }
.pal-item b { display: block; font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .tp { font-size: 11px; font-weight: 700; color: var(--faint); flex: none; }
.pal-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.pal-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }

.scrim { display: none; }

/* ── responsive ── */
@media (max-width: 1020px) {
  .crumbs .m-hide { display: none; }
  .search-btn { width: 40px; padding: 0; justify-content: center; font-size: 16px; } .search-btn span:not(.ei), .search-btn kbd { display: none; }
  .steps, .plans { grid-template-columns: minmax(0, 1fr); }
  .quick ol { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  #menu { display: grid; }
  .wrap { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 14px; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 86vw; max-height: none; background: var(--surface); z-index: 50; padding: 18px 12px 30px; transform: translateX(-105%); transition: transform .25s; border-right: 1px solid var(--line); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 12, 20, .45); z-index: 45; }
  .top-in { padding: 0 14px; gap: 8px; }
  .crumbs { display: none; }
  .page { padding: 0 14px; }
  .t-hero { padding: 20px 18px; border-radius: 18px; }
  .t-hero .hd { gap: 12px; } .t-hero .mono.lg { width: 46px; height: 46px; font-size: 15px; border-radius: 13px; }
  .card-h { padding: 12px 14px; } .card-b { padding: 0 14px 14px; }
  .card-h .pill { display: none; }
  .qa .ans { padding-left: 14px; }
  .code pre { font-size: 12px; }
  .home-hero { padding: 40px 0 14px; }
  .mods, .tgrid { grid-template-columns: minmax(0, 1fr); }
  .hub-hero { padding-top: 28px; gap: 14px; } .hub-hero .ic { width: 52px; height: 52px; font-size: 26px; border-radius: 15px; }
  .pager { grid-template-columns: minmax(0, 1fr); } .pager .nx { grid-column: 1; }
  .modal { padding: 0; place-items: end stretch; } .sheet { max-height: 92vh; border-radius: 20px 20px 0 0; }
  .pal { padding: 0; align-items: stretch; } .pal-box { max-height: none; height: 100%; width: 100%; border-radius: 0; border: 0; }
  .pal-foot { display: none; }
  .sec-h { margin-top: 40px; }
}
@media (max-width: 560px) {
  .ai-styles { grid-template-columns: minmax(0, 1fr); }
  .ai-styles small { display: none; }
  .ai-txt { min-height: 150px; }
  .card-f .f-end { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (max-width: 420px) {
  .toolbar { gap: 10px; } .seg button { padding: 6px 9px; font-size: 12.5px; }
  .hero-stats { gap: 10px 24px; } .hero-stats b { font-size: 22px; }
  .big-search { height: 52px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  .top, .side, .toolbar, .card-f, .pager, footer, #totop, .skip, .scrim, .modal, .toast, .ai-q, .quiz-note, .chev, .pal { display: none !important; }
  .wrap { display: block; padding: 0; max-width: none; } .topic { max-width: none; }
  .t-hero, .card, .quick { box-shadow: none !important; border-color: #d0d5dd !important; }
  .t-hero { padding: 0 0 12px; border: 0 !important; } .t-hero::before { display: none; }
  .print-only { display: block; } .print-src { margin-top: 8px; font-size: 11px; color: #555; }
  .card.closed .card-b, .card .card-b { display: block !important; }
  .card { break-inside: auto; margin-top: 12px; } .card-h { break-after: avoid; }
  .tldr, .code, .tips, .qa details, .tbl-w, .hood-print, pre.diagram, .quick li { break-inside: avoid; }
  .hood-print { display: block; }
  .code pre, pre.diagram { white-space: pre-wrap; word-break: break-word; overflow: visible; }
  .tbl-w { overflow: visible; } table.tbl { min-width: 0; }
  .qa summary::after { content: none; }
  .grp-h { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* skip link (keyboard users) */
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top .15s; }
.skip:focus { top: 12px; }

/* keep code literal: no `===` → ≡ ligatures; no fake-bold emoji eating the following space */
code, pre, kbd, .mono, .diagram { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
html { font-synthesis-weight: none; }
.ei { display: inline-block; width: 1.4em; text-align: center; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 400; line-height: 1; text-indent: 0; font-style: normal; }
.ei.s { margin-right: .25em; }
span.ei { flex: none; }
.ai-copy .ei.s, .edit-link .ei.s, .chip-btn .ei.s { margin-right: .4em; }
