/* LabLevelUp - design system
   One set of tokens drives everything. Light is the base; dark overrides the tokens only.
   Sections: tokens, base, layout, navigation, components, forms, tables, grid, questions,
   practical tests, diagrams, admin, utilities. */

/* ======================================================================== tokens */
:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --side-bg: #ffffff;
  --cyan: #0891b2;
  --orange: #ea580c;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e9edf5;
  --line: #e3e7ef;
  --line-strong: #cfd6e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;

  --primary: #4f46e5;          /* indigo */
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --primary-ink: #ffffff;
  --violet: #7c3aed;           /* "next" / highlights */
  --violet-soft: #f3edff;
  --good: #16a34a;  --good-soft: #e9f8ef;
  --bad: #dc2626;   --bad-soft: #fdeeee;
  --warn: #d97706;  --warn-soft: #fff6e6;
  --info: #0284c7;  --info-soft: #e9f5fd;
  --gold: #eab308; --silver: #94a3b8; --bronze: #c2703d;

  --code-bg: #f7f8fc;
  --console-bg: #0f1424;
  --console-text: #d6f5e0;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .12);
  --ring: 0 0 0 3px rgba(79, 70, 229, .22);

  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Cascadia Mono", ui-monospace, Consolas, monospace;

  /* old names still used by a few templates */
  --panel: var(--surface); --panel2: var(--surface-2); --accent: var(--primary); --accent2: var(--violet);
}

:root[data-theme="dark"] {
  --side-bg: linear-gradient(180deg, #16133a 0%, #0f1024 55%, #1b1446 100%);
  --cyan: #22d3ee;
  --orange: #fb923c;
  color-scheme: dark;
  --bg: #0b0d14;
  --surface: #121521;
  --surface-2: #181c2b;
  --surface-3: #20253a;
  --line: #252a3c;
  --line-strong: #333a52;
  --text: #e7e9f2;
  --text-2: #c3c8d8;
  --muted: #929ab0;

  --primary: #7c7cff;
  --primary-hover: #9393ff;
  --primary-soft: #1e1f45;
  --primary-ink: #0b0d14;
  --violet: #a78bfa;
  --violet-soft: #251d45;
  --good: #34d399;  --good-soft: #0f2a22;
  --bad: #f87171;   --bad-soft: #2f1518;
  --warn: #fbbf24;  --warn-soft: #2d2410;
  --info: #38bdf8;  --info-soft: #0e2433;
  --gold: #facc15; --silver: #a8b3c7; --bronze: #d48a55;

  --code-bg: #0e1120;
  --console-bg: #080a12;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
  --ring: 0 0 0 3px rgba(124, 124, 255, .3);
}

/* ======================================================================== base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--text); letter-spacing: -.02em; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 750; margin: 6px 0 18px; }
h1 .muted { font-size: 17px; font-weight: 500; letter-spacing: 0; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; color: var(--text-2); }
p { margin: 0 0 12px; }
ul, ol { padding-left: 22px; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px; }
pre code { background: none; border: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.muted { color: var(--muted); }
details summary { cursor: pointer; color: var(--primary); font-weight: 550; }
details summary::marker { color: var(--muted); }

/* ======================================================================== layout */
.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 24px 72px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 14px; margin-bottom: 18px; }
.row { display: flex; gap: 10px; margin: 12px 0; align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 6px; }
.actions, p.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
form.inline { display: inline; margin: 0; }
@media (max-width: 640px) {
  .wrap { padding: 18px 16px 56px; }
  h1 { font-size: 24px; }
  .row { flex-direction: column; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ======================================================================== navigation */
nav.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 24px; background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
nav.top .brand { display: inline-flex; align-items: center; gap: 9px; margin-right: 14px; color: var(--text);
  font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -.02em; text-decoration: none; }
nav.top .brand b { color: var(--primary); font-weight: 800; }
nav.top .brand .logo { width: 28px; height: 28px; flex: none; }
nav.top a.link { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-weight: 550; font-size: 14.5px; padding: 7px 12px; border-radius: 999px;
  text-decoration: none; transition: background .15s, color .15s; }
nav.top a.link:hover { background: var(--surface-2); color: var(--text); }
nav.top a.link.on { background: var(--primary-soft); color: var(--primary); }
nav.top .spacer { flex: 1; }
nav.top .avatar { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 550; font-size: 14px;
  padding: 4px 10px 4px 4px; border-radius: 999px; text-decoration: none; }
nav.top .avatar:hover { background: var(--surface-2); text-decoration: none; }
nav.top .avatar i { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-ink);
  display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: 13px; }
.themebtn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1; transition: background .15s, border-color .15s; }
.themebtn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.pill b { color: var(--primary); font-weight: 800; }
.pill.urgent { border-color: var(--bad); background: var(--bad-soft); } .pill.urgent b { color: var(--bad); }
@media (max-width: 1000px) { nav.top .avatar span { display: none; } nav.top .avatar { padding-right: 4px; } }
@media (max-width: 760px) {
  nav.top { padding: 8px 14px; }
  nav.top .brand { margin-right: 4px; }
  nav.top .brand .word { display: none; }
  nav.top a.link { padding: 6px 9px; font-size: 14px; }
}

/* tabs (grid topics, admin sections, reference) */
.tabs, .admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding: 4px; width: fit-content; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.tab { padding: 7px 15px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; border: 0;
  transition: background .15s, color .15s; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ======================================================================== components */
.card, .qcard, details.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow);
}
details.card > summary { color: var(--text); font-weight: 650; }
.card { overflow-x: auto; }   /* wide tables scroll inside their card instead of spilling out */
.prac-work .sticky { overflow-x: visible; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .num { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin: 4px 0 2px; }
.stat .num .muted { font-weight: 600; }
.stat .xpbar + .lbl, .stat .num + .lbl { text-transform: none; letter-spacing: 0; font-weight: 500; margin-top: 4px; }

.xpbar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.xpbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--violet)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: var(--primary-ink); border: 1px solid transparent; border-radius: 10px;
  padding: 9px 18px; font: 650 14.5px/1.3 var(--font); cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background .15s, transform .05s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.tag.completed { background: var(--good-soft); color: var(--good); }
.tag.revoked { background: var(--bad-soft); color: var(--bad); }
.tag.available { background: var(--violet-soft); color: var(--violet); }
.tag.locked, .tag.capped { background: var(--surface-2); color: var(--muted); }

.medal { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.medal.gold { background: var(--gold); } .medal.silver { background: var(--silver); } .medal.bronze { background: var(--bronze); }

.flash, .banner {
  display: block; padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-sm); border-left: 4px solid var(--line-strong);
}
.flash.error { border-left-color: var(--bad); background: var(--bad-soft); color: var(--text); }
.flash.ok { border-left-color: var(--good); background: var(--good-soft); color: var(--text); }
.flash.info, .banner.info { border-left-color: var(--info); background: var(--info-soft); color: var(--text); }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-left-color: var(--bad); background: var(--bad-soft);
  color: var(--text); font-weight: 550; }
.banner.info { display: block; }
.banner .btn { margin-left: auto; }

.auth { max-width: 440px; margin: 48px auto; }
.auth h1 { font-size: 26px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.badge { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px; opacity: .55; background: var(--surface-2); }
.badge.earned { opacity: 1; border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 16%, var(--surface)), var(--surface)); }
.badge .bname { font-weight: 700; } .badge .bhow { font-size: 12.5px; color: var(--muted); }
.topic-card { transition: box-shadow .2s, transform .2s; }
.topic-card:hover { box-shadow: var(--shadow-lg); }
.topic-card.needs-repair { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.topic-card .actions { flex-wrap: wrap; }
.assign { padding: 12px 0; border-bottom: 1px solid var(--line); }
.assign:last-of-type { border-bottom: 0; }
.assign.late strong { color: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; } .kv dd { margin: 0; }
.ok-dot { color: var(--good); } .bad-dot { color: var(--bad); } .warn-dot { color: var(--warn); }

/* ======================================================================== forms */
label { display: block; margin: 12px 0 6px; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=email], select, textarea {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; font: 15px/1.4 var(--font); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[readonly] { background: var(--surface-2); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 17px; height: 17px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); margin: 10px 0; font-weight: 500; font-size: 14.5px; }
.check input { width: auto; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; } .checks .opt { padding: 7px 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 16px; margin: 14px 0; background: var(--surface-2); }
legend { color: var(--text-2); font-weight: 650; font-size: 13.5px; padding: 0 6px; }
.assignform { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; align-items: end; }
.assignform label { margin-top: 0; }
.codebox { font-family: var(--mono); font-size: 24px; letter-spacing: 6px; text-align: center; }
.qedit textarea.code { font-family: var(--mono); min-height: 0; }

/* ======================================================================== tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
th:first-child { border-top-left-radius: 10px; } th:last-child { border-top-right-radius: 10px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
tr.me td { background: var(--primary-soft) !important; font-weight: 700; }
table.heat { width: auto; border-spacing: 3px; }
table.heat th { background: none; padding: 2px; font-size: 10.5px; text-align: center; min-width: 18px; }
table.heat td { padding: 2px 10px 2px 0; border: 0; white-space: nowrap; font-size: 13.5px; }
.heat td.cell { width: 18px; min-width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; }
.heat .completed { background: var(--primary); } .heat .placed { background: color-mix(in srgb, var(--primary) 45%, var(--surface)); }
.heat .revoked { background: var(--bad); } .heat .none { background: var(--surface-3); }
.heat tr:hover td { background: inherit; }
.pctbar { position: relative; background: var(--surface-3); border-radius: 99px; height: 20px; overflow: hidden; }
.pctbar i { display: block; height: 100%; border-radius: 99px; }
.pctbar i.low { background: var(--bad); } .pctbar i.mid { background: var(--warn); } .pctbar i.high { background: var(--good); }
.pctbar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 20px; color: var(--text); font-weight: 700; }
table.ref pre { margin: 0; font-family: var(--mono); font-size: 13px; white-space: pre; }
table.ref td { vertical-align: top; } table.ref.compact td, table.ref.compact th { padding: 5px 10px; }
table.key td { padding: 8px 10px; } table.key td.tick { width: 28px; font-weight: 800; text-align: center; }
table.key td.mk { text-align: right; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
table.key td.mk input { width: 72px; display: inline-block; padding: 5px 8px; }
table.key tr.ok td.tick { color: var(--good); } table.key tr.no td.tick { color: var(--bad); }
table.key tr.part td.tick, table.key tr.manual td.tick { color: var(--warn); }
table.key tr.ok td { background: color-mix(in srgb, var(--good-soft) 70%, transparent); }
table.key tr.no td { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }

/* ======================================================================== skill grid */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 4px 0 14px; color: var(--muted); font-size: 13.5px; }
.gridwrap {
  overflow-x: auto; padding: 14px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--line-strong) 70%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
svg.sphere { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.sphere .path { stroke: var(--surface-3); stroke-width: 7; fill: none; stroke-linecap: round; }
.sphere .path.lit { stroke: var(--primary); stroke-width: 7; filter: none; opacity: .85; }
.sphere .node { cursor: pointer; }
.sphere .node circle.core { stroke-width: 3; transition: stroke-width .15s, transform .15s; }
.sphere .node.completed circle.core { fill: var(--primary); stroke: color-mix(in srgb, var(--primary) 70%, #fff); filter: none; }
.sphere .node.completed text.num { fill: var(--primary-ink); }
.sphere .node.available circle.core { fill: var(--surface); stroke: var(--violet); stroke-width: 4; animation: pulse 1.8s ease-in-out infinite; }
.sphere .node.available text.num { fill: var(--violet); }
.sphere .node.revoked circle.core { fill: var(--bad-soft); stroke: var(--bad); stroke-dasharray: 6 4; }
.sphere .node.revoked text.num { fill: var(--bad); }
.sphere .node.locked circle.core { fill: var(--surface-2); stroke: var(--line-strong); }
.sphere .node.capped circle.core { fill: var(--surface); stroke: var(--line); }
.sphere .node.locked text.num, .sphere .node.capped text.num { fill: var(--muted); }
.sphere .node.capped text.num, .sphere .node.capped text.lbl { fill-opacity: .55; }
.sphere .node text.num { font: 800 18px var(--font); fill: var(--text); text-anchor: middle; }
.sphere .node text.lbl { font: 650 13px var(--font); fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.sphere .node.locked text.lbl, .sphere .node.capped text.lbl { fill: var(--muted); }
.sphere .node:hover circle.core { stroke-width: 5; }
.sphere .band { font: 800 11px var(--font); fill: var(--muted); letter-spacing: .12em; }
.sphere .gate { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 5 5; }
.sphere .gatelbl { font: 700 12px var(--font); fill: var(--warn); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.sphere .node.boss circle.core { stroke-width: 5; }
.sphere .node.boss circle.ring { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 4 5; }
.sphere .node.boss text.num { font-size: 22px; }
@keyframes pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .sphere .node.available circle.core { animation: none; } * { transition: none !important; } }

/* ======================================================================== questions */
#qbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3); border: 2px solid transparent; transition: transform .15s; }
.dot.now { background: var(--surface); border-color: var(--violet); transform: scale(1.25); }
.dot.ok { background: var(--good); } .dot.bad { background: var(--bad); } .dot.done { background: var(--muted); }
.qcard { padding: 26px; }
.qtype { display: inline-block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800;
  color: var(--violet); background: var(--violet-soft); padding: 3px 10px; border-radius: 99px; margin-bottom: 10px; }
.prompt { white-space: pre-wrap; font-size: 17px; line-height: 1.55; color: var(--text); font-weight: 500; }
textarea.code, pre.codeview, pre.output, textarea.inputs, textarea.answer, input.answer, pre.lesson { font-family: var(--mono); font-size: 14.5px; }
textarea.code { min-height: 200px; tab-size: 4; }
pre.codeview, pre.lesson { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; line-height: 1.55; color: var(--text); }
pre.output { background: var(--console-bg); color: var(--console-text); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; min-height: 48px; white-space: pre-wrap; line-height: 1.5; }
pre.output.err { color: #ffb4b4; }
.options { display: grid; gap: 8px; margin: 14px 0; }
.opt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); cursor: pointer; color: var(--text); margin: 0; font-weight: 500; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--ring); }
.opt code { background: none; border: 0; padding: 0; }
.feedback { margin-top: 14px; }
.feedback.good { color: var(--good); } .feedback.bad { color: var(--bad); }
.feedback .event { margin-top: 8px; color: var(--warn); font-weight: 650; }
.detail { margin-top: 10px; color: var(--text); }
.detail .dlabel { color: var(--muted); font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 4px; }
.detail pre { margin: 0; white-space: pre-wrap; }
.detail .why { margin: 0; }
.hint { display: none; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text); }
.hint.show { display: block; }
.finish { margin-top: 18px; padding: 26px; border-radius: var(--radius-lg); text-align: center; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.finish h2 { font-size: 24px; }
.finish.good { background: linear-gradient(180deg, var(--good-soft), var(--surface)); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.finish.bad { background: linear-gradient(180deg, var(--warn-soft), var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.cm-holder { border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.cm-holder .CodeMirror { height: 260px; font-family: var(--mono); font-size: 14.5px; line-height: 1.55; }
.cm-holder.short .CodeMirror { height: 130px; }
.cm-holder.tall .CodeMirror { height: 460px; }
.reorder { display: grid; gap: 8px; margin: 12px 0; }
.ritem { display: flex; gap: 8px; align-items: stretch; border-radius: var(--radius); }
.ritem.over .rtext { border-color: var(--primary); box-shadow: var(--ring); }
.rleft { flex: 0 0 34%; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 650; }
.rtext { flex: 1; padding: 11px 13px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  cursor: grab; white-space: pre-wrap; box-shadow: var(--shadow-sm); }
.reorder.mono .rtext { font-family: var(--mono); white-space: pre; overflow-x: auto; }
.rtext.dragging { opacity: .45; }
.rtext:focus { outline: none; box-shadow: var(--ring); border-color: var(--primary); }
.rbtn { background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); border-radius: var(--radius-sm); width: 38px; cursor: pointer; }
.rbtn:hover { color: var(--primary); border-color: var(--primary); }
table.trace { width: auto; margin: 12px 0; } table.trace th { background: var(--surface-2); }
table.trace td { padding: 4px; border: 1px solid var(--line); } table.trace input { width: 112px; font-family: var(--mono); }
table.trace input.given { opacity: .75; }
.selfmark { margin-top: 12px; display: grid; gap: 8px; }
.labels { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin: 12px 0; }
.labels label { margin: 0; display: flex; gap: 10px; align-items: center; color: var(--text); }
.labels .num { background: var(--violet); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; flex: none; font-size: 13px; }

/* ======================================================================== practical tests */
.prac { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
.prac .card { margin-bottom: 18px; }
.prac-work .sticky { position: sticky; top: 76px; }
@media (max-width: 900px) { .prac { grid-template-columns: 1fr; } .prac-work .sticky { position: static; } }
pre.tasktext { white-space: pre-wrap; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; margin: 0 0 12px; color: var(--text-2); }

/* ======================================================================== diagrams */
.dgwrap { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 12px 0; }
svg.diagram { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram .dg-shape, .diagram .dg-icon > * { fill: var(--surface); stroke: var(--text-2); stroke-width: 1.6; }
.diagram .dg-icon line, .diagram .dg-icon path[fill=none] { fill: none; }
.diagram .dg-head-row { fill: var(--surface-3); stroke: var(--text-2); stroke-width: 1.6; }
.diagram .dg-line { stroke: var(--text-2); stroke-width: 1.6; fill: none; }
.diagram .dg-thick { stroke-width: 2.2; }
.diagram .dg-head { fill: var(--text-2); }
.diagram .dg-zone { fill: none; stroke: var(--muted); stroke-dasharray: 6 5; }
.diagram .dg-text { fill: var(--text); font: 14px var(--font); }
.diagram .dg-small { font-size: 12.5px; } .diagram .dg-bold { font-weight: 700; } .diagram .dg-key { fill: var(--violet); font-weight: 800; }
.diagram .dg-blank circle { fill: var(--violet); stroke: none; } .diagram .dg-blank text { fill: #fff; font-weight: 800; }

/* ======================================================================== reference, login, MFA, admin */
.refsec ul { padding-left: 20px; } .refsec li { margin: 5px 0; }
.ssobox select { margin-bottom: 10px; }
.ssogroup { display: grid; gap: 8px; margin: 8px 0; }
.ssobtn { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 11px 16px; }
.ssoicon { font-weight: 800; width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); }
.sso-microsoft .ssoicon { color: #0078d4; } .sso-google .ssoicon { color: #ea4335; }
.qr { background: #fff; padding: 14px; border-radius: var(--radius); width: max-content; margin: 12px 0; border: 1px solid var(--line); }
.qr svg { display: block; }
.secretkey { word-break: break-all; }
.backupcodes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.backupcodes code { font-size: 16px; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); text-align: center; }
.card code, .stat code { overflow-wrap: anywhere; word-break: break-word; }

/* ======================================================================== print */
@media print {
  nav.top, .side, .topstrip, .themebtn, .btn { display: none !important; }
  .shell { margin-left: 0 !important; }
  body { background: #fff !important; color: #000; }
  .card, .stat { box-shadow: none; border-color: #ccc; }
}
form > p:has(> .btn), form > p:has(> button) { margin-top: 18px; }

/* code editor (CodeMirror) - coloured from the design tokens so it follows light / dark */
.cm-s-skillgrid.CodeMirror { background: var(--code-bg); color: var(--text); }
.cm-s-skillgrid .CodeMirror-gutters { background: var(--surface-2); border-right: 1px solid var(--line); }
.cm-s-skillgrid .CodeMirror-linenumber { color: var(--muted); }
.cm-s-skillgrid .CodeMirror-cursor { border-left: 2px solid var(--primary); }
.cm-s-skillgrid .CodeMirror-selected, .cm-s-skillgrid .CodeMirror-focused .CodeMirror-selected { background: var(--primary-soft); }
.cm-s-skillgrid .CodeMirror-matchingbracket { color: var(--good) !important; text-decoration: underline; }
.cm-s-skillgrid .cm-keyword { color: #7c3aed; font-weight: 600; } .cm-s-skillgrid .cm-builtin { color: #0369a1; }
.cm-s-skillgrid .cm-string { color: #15803d; } .cm-s-skillgrid .cm-number { color: #c2410c; }
.cm-s-skillgrid .cm-comment { color: var(--muted); font-style: italic; } .cm-s-skillgrid .cm-def { color: #1d4ed8; font-weight: 600; }
.cm-s-skillgrid .cm-variable-2, .cm-s-skillgrid .cm-property { color: #0f766e; } .cm-s-skillgrid .cm-operator { color: var(--text-2); }
[data-theme="dark"] .cm-s-skillgrid .cm-keyword { color: var(--a-light); } [data-theme="dark"] .cm-s-skillgrid .cm-builtin { color: #7dd3fc; }
[data-theme="dark"] .cm-s-skillgrid .cm-string { color: #86efac; } [data-theme="dark"] .cm-s-skillgrid .cm-number { color: #fdba74; }
[data-theme="dark"] .cm-s-skillgrid .cm-def { color: #93c5fd; } [data-theme="dark"] .cm-s-skillgrid .cm-variable-2,
[data-theme="dark"] .cm-s-skillgrid .cm-property { color: #5eead4; }
/* show code exactly as typed: no ligatures (e.g. != must not turn into a single "not equal" sign) */
code, pre, textarea, .CodeMirror, .codebox, input.answer, table.trace input, .reorder.mono .rtext { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

/* ======================================================================== categories, Revision, Skill Checker */
.cattabs .tab.rev { color: var(--violet); }
.cattabs .tab.rev.on { color: var(--violet); }
.rev-card { display: flex; flex-direction: column; }
.rev-card > form, .rev-card > .actions { margin-top: auto; }
.rev-kicker, .cb-kicker { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); margin-bottom: 4px; }
.rev-main { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); background: linear-gradient(160deg, var(--primary-soft), var(--surface) 60%); }
.rev-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.rev-topics form { margin: 0; }
.rev-topic { border-style: dashed; }
.checkbar { display: flex; flex-direction: column; gap: 2px; max-width: 420px; margin-bottom: 8px; }
.checkbar .xpbar { margin: 2px 0 0; }

/* Learn bubble on the grid */
.sphere .learn circle.core { fill: var(--violet-soft); stroke: var(--violet); stroke-width: 4; }
.sphere .learn text.num { font: 800 20px var(--font); fill: var(--violet); text-anchor: middle; }
.sphere .learn text.lbl { font: 750 13px var(--font); fill: var(--violet); text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.sphere .learn:hover circle.core { stroke-width: 6; }
.sphere .path.learnpath { stroke: var(--violet); stroke-dasharray: 2 10; stroke-width: 5; opacity: .6; }

/* ======================================================================== course book */
.cb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cb-head h1 { margin-bottom: 14px; }
.cb-tools { display: flex; gap: 8px; margin-bottom: 18px; }
.cb-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.cb-nav { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-sm); }
.cb-nav input[type=search] { width: 100%; margin-bottom: 8px; }
.cb-band { margin-bottom: 10px; }
.cb-band.beyond { opacity: .75; }
.cb-band-h { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px 4px; }
.cb-band-h .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.cb-link { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; color: var(--text-2); font-size: 14px; line-height: 1.3; text-decoration: none; }
.cb-link:hover { background: var(--surface-2); text-decoration: none; }
.cb-link.on { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.cb-link .n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; font-size: 11.5px; font-weight: 750; color: var(--muted); }
.cb-link.on .n { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.cb-link.prac .n { color: var(--gold); }
.cb-page-head { margin-bottom: 16px; }
.cb-page-head h2 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.02em; }
.cb-summary { color: var(--text-2); font-size: 16.5px; }
.cb-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.cb-h { margin: 0 0 12px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.cb-h::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cb-what .cb-h { color: var(--primary); } .cb-how .cb-h { color: var(--info); } .cb-see .cb-h { color: var(--violet); }
.cb-ex .cb-h { color: var(--good); } .cb-watch .cb-h { color: var(--bad); } .cb-act .cb-h { color: var(--warn); } .cb-check .cb-h { color: var(--text-2); }
.cb-lead { font-size: 18px; line-height: 1.55; color: var(--text); }
.cb-lead p:last-child, .cb-prose p:last-child { margin-bottom: 0; }
.cb-prose { font-size: 15.5px; }
.cb-prose h4 { margin: 14px 0 6px; font-size: 15px; }
.cb-prose table, table.cb-table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.cb-prose td, .cb-prose th, table.cb-table td, table.cb-table th { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.cb-prose th, table.cb-table th { background: var(--surface-2); font-weight: 650; }
.cb-prose pre, pre.cb-code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto;
  font: 14px/1.5 var(--mono); margin: 6px 0; white-space: pre; }
.cb-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 14px 0 0; }
.cb-words > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.cb-words dt { font-weight: 750; color: var(--primary); } .cb-words dd { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.cb-example { margin-bottom: 14px; } .cb-example:last-child { margin-bottom: 0; }
.cb-ex-title { font-weight: 650; margin-bottom: 4px; } .cb-ex-note { color: var(--muted); font-size: 14px; margin-top: 4px; }
textarea.cb-edit { width: 100%; font: 14px/1.5 var(--mono); background: var(--code-bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; tab-size: 4; resize: vertical; white-space: pre; }
textarea.cb-inputs { width: 100%; font: 13.5px var(--mono); }
.cb-inrow { display: grid; grid-template-columns: 50px 1fr; gap: 8px; align-items: start; margin-top: 6px; } .cb-inrow label { padding-top: 6px; font-size: 13px; color: var(--muted); }
.cb-run { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.cb-out { margin-top: 8px; background: var(--console-bg); color: var(--console-text); border-radius: var(--radius-sm); padding: 10px 12px; font: 13.5px/1.5 var(--mono); white-space: pre-wrap; overflow-x: auto; }
.cb-out.err { color: #fca5a5; }
.cb-out table.cb-table { color: var(--console-text); } .cb-out table.cb-table th { background: rgba(255,255,255,.08); color: #fff; } .cb-out table.cb-table td, .cb-out table.cb-table th { border-color: rgba(255,255,255,.15); }
.cb-mistakes li { margin-bottom: 6px; }
.cb-act-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 16px; }
.cb-checks { padding-left: 22px; } .cb-checks li { margin-bottom: 12px; } .cb-checks .q { font-weight: 550; }
.cb-checks details summary { font-size: 13.5px; } .cb-checks .a { background: var(--good-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 6px; }
.cb-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }
body.teach .side, body.teach .topstrip, body.teach nav.top, body.teach .cb-nav, body.teach .cattabs, body.teach .cb-head h1, body.teach .cb-page-head .btn, body.teach #cb-print { display: none; }
body.teach .wrap { max-width: 1400px; }
body.teach .cb-layout { display: block; } body.teach .wrap { padding-left: 32px; padding-right: 32px; } body.teach .cb-main, body.teach .cb-page { min-width: 0; max-width: 100%; }
body.teach .cb-main { font-size: 125%; }
body.teach .cb-page-head h2 { font-size: 44px; } body.teach .cb-lead { font-size: 26px; } body.teach .cb-prose, body.teach .cb-summary { font-size: 21px; }
body.teach .cb-prose pre, body.teach pre.cb-code, body.teach textarea.cb-edit { font-size: 19px; }
body.teach .cb-head { position: fixed; top: 10px; right: 16px; z-index: 30; } body.teach .cb-head .cb-kicker { display: none; }
@media (max-width: 860px) { .cb-layout { grid-template-columns: 1fr; } .cb-nav { position: static; max-height: 260px; } }
@media print {
  .cb-nav, .cattabs, .cb-tools, .cb-pager, .cb-run, .wd .wd-row { display: none !important; }
  .cb-layout { display: block; } .cb-sec { break-inside: avoid; box-shadow: none; }
}

/* interactive parts */
.wd { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--surface); }
.wd:last-child { margin-bottom: 0; }
.wd-title { font-weight: 700; margin-bottom: 10px; }
.wd-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.wd-row label { font-size: 14px; color: var(--text-2); }
.wd-row input[type=text], .wd-row input[type=number], .wd-row select { width: auto; min-width: 0; }
.wd-row input[type=range] { width: 200px; padding: 0; }
.wd-scroll { overflow-x: auto; }
.wd-diagram { overflow-x: auto; }
.wd textarea { width: 100%; }
.small { font-size: 13px; } .mono { font-family: var(--mono); }
.good { color: var(--good); } .bad { color: var(--bad); }
/* steps */
.st-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.st-dot { width: 26px; height: 6px; border-radius: 4px; border: 0; background: var(--surface-3); cursor: pointer; padding: 0; }
.st-dot.on { background: var(--violet); }
.st-h { font-weight: 750; font-size: 17px; margin-bottom: 6px; }
.st-body { min-height: 90px; }
.nf-t { display: inline-block; vertical-align: top; margin: 0 14px 10px 0; } .nf-name { font-weight: 700; font-size: 13px; color: var(--violet); }
/* sorter */
.so-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.so-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.so-card.ok { border-color: var(--good); background: var(--good-soft); } .so-card.bad { border-color: var(--bad); background: var(--bad-soft); }
.so-t { font-weight: 600; margin-bottom: 8px; }
.so-choices { display: flex; gap: 6px; flex-wrap: wrap; }
.so-choices .btn.right { border-color: var(--good); color: var(--good); opacity: 1; } .so-choices .btn.wrong { border-color: var(--bad); color: var(--bad); opacity: 1; }
.so-why { font-size: 13.5px; margin-top: 8px; color: var(--text-2); }
/* trace */
.tr-wrap { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 1.3fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .tr-wrap { grid-template-columns: 1fr; } }
.tr-code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 0; font: 14px/1.6 var(--mono); }
.tr-line { display: flex; gap: 10px; padding: 0 10px; white-space: pre; } .tr-line .ln { color: var(--muted); width: 18px; text-align: right; flex: none; }
.tr-line code { background: none; border: 0; padding: 0; font-size: inherit; }
.tr-line.now { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.tr-table td.chg { background: color-mix(in srgb, var(--warn) 22%, transparent); font-weight: 700; }
.tr-table tr.now td { border-top: 2px solid var(--warn); } .tr-table td.out { font-family: var(--mono); white-space: pre; }
.tr-table td { font-family: var(--mono); font-size: 13.5px; }
/* binary */
.bi-row { display: flex; gap: 6px; flex-wrap: wrap; }
.bi-bit { width: 54px; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--surface); padding: 6px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; color: var(--text); }
.bi-bit .pv { font-size: 12px; color: var(--muted); } .bi-bit .bv { font: 800 24px var(--mono); }
.bi-bit.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); } .bi-bit.on .pv { color: var(--primary-ink); opacity: .8; }
.bi-sum { margin: 8px 0; font-family: var(--mono); }
.bi-out { display: flex; gap: 22px; flex-wrap: wrap; font-size: 18px; }
.bi-type { width: 9em !important; }
/* ip */
.ip-octets { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.ip-oct { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; flex-direction: column; align-items: center; background: var(--surface-2); }
.ip-oct b { font-size: 20px; } .ip-oct code { font-size: 14px; }
/* subnet */
.sn-bits { display: flex; flex-wrap: wrap; gap: 2px; margin: 10px 0; font: 700 14px var(--mono); }
.sn-b { width: 20px; text-align: center; border-radius: 4px; padding: 3px 0; }
.sn-b.gap { margin-right: 8px; }
.sn-b.n { background: var(--primary); color: var(--primary-ink); } .sn-b.s { background: var(--warn); color: #111; } .sn-b.h { background: var(--surface-3); color: var(--text-2); }
.sn-legend { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .sn-legend .sn-b { display: inline-block; }
.sn-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.sn-facts > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; }
.sn-facts span { font-size: 12.5px; } .sn-facts b { font-size: 17px; font-family: var(--mono); }
.sn-map { display: grid; gap: 4px; margin: 10px 0; transition: all .3s; }
.sn-cell { border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-radius: 6px; min-height: 40px; font: 11.5px var(--mono);
  cursor: pointer; color: var(--text); padding: 4px; overflow: hidden; animation: grow .35s ease; }
.sn-cell.on { background: var(--warn); color: #111; font-weight: 700; }
.sn-more { grid-column: 1 / -1; font-size: 13px; }
@keyframes grow { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* packets */
.pk-svg { width: 100%; max-width: 640px; height: auto; display: block; }
.pk-link { stroke: var(--line-strong); stroke-width: 3; }
.pk-node { fill: var(--surface-2); stroke: var(--text-2); stroke-width: 1.5; } .pk-end { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 2; }
.pk-label { font: 600 10.5px var(--font); fill: var(--text); }
.pk-dot rect { fill: var(--warn); stroke: #fff; stroke-width: 1.5; } .pk-dot text { font: 800 12px var(--font); fill: #111; }
.pk-dot.lost rect { fill: var(--bad); }
.pk-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pk-p { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12.5px; }
.pk-p .h { display: block; background: var(--surface-3); padding: 2px 8px; color: var(--text-2); } .pk-p code { display: block; padding: 4px 8px; border: 0; border-radius: 0; }
.pk-got code { font-size: 15px; }
/* speed */
.sp-big { font-size: 30px; font-weight: 800; color: var(--primary); }
/* layers */
.ly-grid { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 16px; }
@media (max-width: 700px) { .ly-grid { grid-template-columns: 1fr; } }
.ly-stack { display: flex; flex-direction: column; gap: 4px; }
.ly-layer { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 8px 10px; cursor: pointer; color: var(--text); display: flex; flex-direction: column; }
.ly-layer span { font-size: 12px; } .ly-layer.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); } .ly-layer.on span { color: var(--primary-ink); }
.ly-layer.past { border-left: 4px solid var(--primary); }
.ly-wrap { padding: 6px 0 12px; overflow-x: auto; }
.ly-box { display: inline-flex; align-items: stretch; border: 2px solid var(--violet); border-radius: 8px; padding: 4px; gap: 4px; background: var(--violet-soft); }
.ly-hdr { writing-mode: horizontal-tb; font-size: 12px; font-weight: 700; color: var(--violet); padding: 6px; display: flex; align-items: center; }
.ly-data { padding: 10px 18px; background: var(--primary); color: var(--primary-ink); border-radius: 6px; font-weight: 800; display: flex; align-items: center; }
/* ciphers */
.cz-rows { font: 700 14px var(--mono); overflow-x: auto; margin: 8px 0; }
.cz-row { display: flex; gap: 2px; } .cz-row span { width: 22px; text-align: center; padding: 3px 0; background: var(--surface-2); border-radius: 4px; margin-bottom: 2px; }
.cz-row.sh span { background: var(--primary-soft); color: var(--primary); }
.cz-out div { margin: 4px 0; } .cz-out code { font-size: 15px; }
.fq-chart { display: flex; gap: 2px; height: 130px; align-items: flex-end; margin: 10px 0 4px; overflow-x: auto; }
.fq-col { position: relative; width: 22px; height: 100%; display: flex; align-items: flex-end; justify-content: center; flex: none; }
.fq-col span { position: absolute; bottom: -18px; font: 700 11px var(--mono); }
.fq-bar { position: absolute; bottom: 0; left: 2px; width: 9px; background: var(--primary); border-radius: 3px 3px 0 0; }
.fq-eng { position: absolute; bottom: 0; right: 2px; width: 9px; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 3px 3px 0 0; }
.fq-key { margin-top: 22px; font-size: 13px; } .fq-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; } .fq-sw.a { background: var(--primary); } .fq-sw.b { background: var(--surface-3); border: 1px solid var(--line-strong); }
table.vg td { text-align: center; font-family: var(--mono); }
/* hash */
.hs-hex { display: block; font-size: 15px; word-break: break-all; padding: 8px 10px; margin-top: 8px; }
.hs-hex .chg { color: var(--bad); font-weight: 800; }
/* password */
.pw-meter { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; margin: 10px 0; }
.pw-meter i { display: block; height: 100%; transition: width .3s; }
.pw-meter.s0 i { width: 10%; background: var(--bad); } .pw-meter.s1 i { width: 30%; background: var(--bad); } .pw-meter.s2 i { width: 55%; background: var(--warn); }
.pw-meter.s3 i { width: 80%; background: var(--good); } .pw-meter.s4 i { width: 100%; background: var(--good); }
/* logic */
.lg-grid { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
@media (max-width: 600px) { .lg-grid { grid-template-columns: 1fr; } }
.lg-view { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lg-ins { display: flex; flex-direction: column; gap: 6px; }
.lg-sw { border: 2px solid var(--line-strong); border-radius: 10px; padding: 8px 14px; font: 800 16px var(--mono); background: var(--surface-2); cursor: pointer; color: var(--text); }
.lg-sw.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.lg-gate { border: 2px solid var(--text-2); border-radius: 8px 40px 40px 8px; padding: 18px 26px; font-weight: 800; font-size: 18px; }
.lg-lamp { border-radius: 999px; padding: 10px 16px; font-weight: 800; background: var(--surface-3); color: var(--muted); }
.lg-lamp.on { background: var(--good); color: #fff; box-shadow: 0 0 18px color-mix(in srgb, var(--good) 60%, transparent); }
.lg-py { flex-basis: 100%; }
.lg-tt tr.now td { background: var(--primary-soft); }
/* sort + search */
.so-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; margin: 10px 0; }
.so-bar { flex: 1; background: var(--surface-3); border-radius: 6px 6px 0 0; display: flex; align-items: flex-start; justify-content: center; transition: height .2s; min-width: 24px; }
.so-bar span { font: 700 13px var(--mono); margin-top: 4px; }
.so-bar.cmp { background: var(--warn); } .so-bar.swp { background: var(--bad); color: #fff; } .so-bar.done { background: var(--good); color: #fff; }
.so-note { min-height: 1.6em; font-weight: 600; }
.se-cells { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.se-cell { width: 46px; border: 1px solid var(--line-strong); border-radius: 8px; text-align: center; padding: 4px 0; font: 700 16px var(--mono); background: var(--surface); transition: opacity .2s; }
.se-cell small { display: block; font: 500 10px var(--font); color: var(--muted); }
.se-cell.seen { background: color-mix(in srgb, var(--warn) 30%, var(--surface)); } .se-cell.found { background: var(--good); color: #fff; } .se-cell.found small { color: #fff; }
.se-cell.out { opacity: .25; }
.bo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 700px) { .bo-grid { grid-template-columns: 1fr; } }
.bo-svg { width: 100%; height: auto; } .bo-axis { stroke: var(--line-strong); stroke-width: 1.5; } .bo-t { font: 11px var(--font); fill: var(--muted); }
.bo-line { fill: none; stroke-width: 3; } .bo-line.c1, .bo-sw.c1 { stroke: var(--good); background: var(--good); } .bo-line.c2, .bo-sw.c2 { stroke: var(--info); background: var(--info); }
.bo-line.c3, .bo-sw.c3 { stroke: var(--warn); background: var(--warn); } .bo-line.c4, .bo-sw.c4 { stroke: var(--bad); background: var(--bad); }
.bo-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
/* range, index, grid */
.rg-vals, .ix-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rg-vals span { background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 6px 12px; font: 800 16px var(--mono); }
.ix-cell { border: 1px solid var(--line-strong); border-radius: 8px; min-width: 52px; text-align: center; padding: 2px 8px; display: flex; flex-direction: column; background: var(--surface); }
.ix-cell span { font: 700 15px var(--mono); padding: 4px 0; } .ix-cell small { font-size: 11px; color: var(--muted); } .ix-cell small.neg { color: var(--violet); }
.ix-cell.on { background: var(--primary); border-color: var(--primary); } .ix-cell.on span, .ix-cell.on small { color: var(--primary-ink); }
table.g2-table { border-collapse: separate; border-spacing: 4px; }
table.g2-table td { width: 56px; height: 44px; text-align: center; border: 1px solid var(--line-strong); border-radius: 8px; font: 700 16px var(--mono); cursor: pointer; background: var(--surface); }
table.g2-table td.line { background: var(--primary-soft); } table.g2-table td.on { background: var(--primary); color: var(--primary-ink); }
table.g2-table th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px; }
table.g2-table .tot { color: var(--violet); background: none; border-style: dashed; cursor: default; }
/* stats */
.st-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: end; }
@media (max-width: 700px) { .st-grid { grid-template-columns: 1fr; } }
.st-chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-bottom: 18px; }
.st-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.st-bar { width: 100%; background: linear-gradient(var(--violet), var(--primary)); border-radius: 4px 4px 0 0; }
.st-col span { position: absolute; bottom: -18px; font-size: 10.5px; color: var(--muted); }
/* phish */
.ph-mail { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; background: var(--surface-2); line-height: 1.8; }
.ph-part { cursor: pointer; border-radius: 4px; padding: 1px 2px; } .ph-part:hover { background: var(--surface-3); }
.ph-part.blk { display: block; } .ph-part.hit { background: var(--bad-soft); outline: 2px solid var(--bad); } .ph-part.miss { opacity: .55; }
.ph-why p { margin: 4px 0; font-size: 14px; }

/* ---- course hub: course cards on the dashboard and the course page ---- */
a.course-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
a.course-card:hover { transform: translateY(-2px); }
a.course-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.course-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.course-head h2 { margin: 0; }
.course-head .pct { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--primary); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 2px; }
.mini-stats > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.mini-stats b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stats b .muted { font-weight: 600; font-size: 13px; }
.mini-stats span:not(.medal):not(.muted) { display: block; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.course-next { margin: 6px 0 0; }
.course-next.bad { color: var(--bad); }
.course-open { margin-top: auto; padding-top: 8px; font-weight: 650; color: var(--primary); }
.crumbs { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.crumbs a { color: var(--muted); }
.medals-num { display: flex; gap: 14px; font-size: 22px; }
.course-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .course-actions { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .course-actions { grid-template-columns: 1fr; } }
.course-tile, .course-tile > button { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.course-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: box-shadow .2s, transform .2s; margin: 0; }
.course-tile > button { all: unset; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.course-tile > button[disabled] { cursor: not-allowed; opacity: .55; }
a.course-tile:hover, form.course-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.course-tile:focus-visible, .course-tile > button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.course-tile .kicker { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.course-tile strong { font-size: 17px; }
.course-tile .muted { font-size: 13.5px; }
.course-tile.primary { background: linear-gradient(135deg, var(--primary), var(--violet)); border-color: transparent; color: #fff; }
.course-tile.primary .kicker, .course-tile.primary .muted { color: rgba(255,255,255,.85); }
.course-tile.off { opacity: .7; box-shadow: none; }
.card.needs-repair { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }

/* ---- course book: syllabus points and in-depth sections ---- */
.cb-syl { margin-top: 12px; font-size: 14px; }
.cb-syl summary { cursor: pointer; color: var(--muted); font-weight: 650; }
.cb-syl ul { margin: 8px 0 0; padding-left: 0; list-style: none; }
.cb-syl li { margin: 4px 0; }
.cb-syl-id { display: inline-block; font-size: 11.5px; font-weight: 700; font-family: var(--font-mono, monospace); color: var(--primary);
  background: var(--violet-soft); border-radius: 6px; padding: 1px 6px; margin-right: 6px; }
.cb-deep .cb-h { color: var(--primary); }
.cb-deep-item + .cb-deep-item { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.cb-deep-h { margin: 0 0 4px; font-size: 17px; }
.cb-deep-pts { margin-bottom: 8px; }
.cb-prose .cb-tip { background: var(--surface-2); border-left: 3px solid var(--primary); padding: 8px 12px; border-radius: 6px; font-size: 14.5px; }
.cb-case { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 10px; padding: 12px 16px; margin: 12px 0; background: var(--surface-2); }
.cb-case-h { font-weight: 750; margin-bottom: 6px; }
.cb-prose { overflow-x: auto; }
.syl-table td { vertical-align: top; }
.syl-topic { font-size: 12.5px; }
.tag.syl-covered { background: var(--good-soft); color: var(--good); }
.tag.syl-taught { background: var(--violet-soft); color: var(--violet); }
.tag.syl-gap { background: var(--bad-soft); color: var(--bad); }
.tag.syl-planned { background: var(--surface-2); color: var(--muted); }

/* ---- course book: section tabs ---- */
.cb-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 16px; position: sticky; top: 0; z-index: 2;
  background: var(--bg, var(--surface)); padding-top: 6px; }
.cb-tab { appearance: none; border: 0; background: none; font: inherit; font-weight: 650; color: var(--muted); padding: 9px 14px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.cb-tab:hover { color: var(--text); background: var(--surface-2); }
.cb-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.cb-tab-n { font-size: 11.5px; background: var(--surface-2); color: var(--muted); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.cb-tab[aria-selected="true"] .cb-tab-n { background: var(--violet-soft); color: var(--primary); }
.cb-panel:empty { display: none; }
@media print { .cb-tabs { display: none !important; } .cb-panel[hidden] { display: block !important; } }

/* ======================================================================== assessment */
.checks .check { margin: 0; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); }
.small { font-size: 13px; }
td.bad, .bad-text { color: var(--bad); font-weight: 600; }
input[type=file] { display: block; width: 100%; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--text-2); font: 14px var(--font); }
.files { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.files li a { font-weight: 600; word-break: break-all; }
.files li .muted { font-size: 12.5px; }
.files li form { margin-left: auto; }
.prose-text { white-space: pre-wrap; line-height: 1.55; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 14px; }
.markbox { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start; }
@media (max-width: 640px) { .markbox { grid-template-columns: 1fr; } }
.bigmark { font-size: 30px; font-weight: 800; }

/* nav icons */
nav.top a.link .ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* grid key popup */
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row h1 { margin-bottom: 0; }
.keybtn { display: inline-flex; align-items: center; gap: 6px; }
.gridkey[popover] { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 18px 50px rgba(0,0,0,.18); padding: 18px 20px; width: min(360px, calc(100vw - 32px)); }
.gridkey[popover]::backdrop { background: rgba(15, 23, 42, .25); }
.gridkey h2 { margin: 0 0 10px; font-size: 18px; }
.gridkey ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14.5px; }
.gridkey li { display: flex; align-items: center; gap: 10px; }
.gridkey .sym { width: 92px; flex: none; display: flex; justify-content: flex-start; }
.gridkey .gate-sample { display: inline-block; width: 40px; border-top: 3px dashed var(--gold); }
.gridkey .close { float: right; }

/* ======================================================================== sidebar layout */
:root[data-theme="dark"] { --line: #282d40; --text: #e8eaf2; --surface-2: #171b2b; --surface-3: #20253a; }
.side { position: fixed; top: 0; bottom: 0; left: 0; width: 232px; z-index: 40; display: flex; flex-direction: column;
  padding: 18px 14px 16px; background: var(--side-bg); border-right: 1px solid var(--line); overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-display);
  font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--violet); font-weight: 800; }
.brand .logo { width: 32px; height: 32px; flex: none; }
.side-links { display: grid; gap: 4px; }
.side a.link { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px; color: var(--text-2);
  font-weight: 600; font-size: 15px; text-decoration: none; transition: background .15s, color .15s; }
.side a.link .ico { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side a.link:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--text); }
.side a.link.on { background: var(--grad); color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--violet) 35%, transparent); }
.level-panel { margin-top: auto; padding-top: 18px; text-align: center; }
.level-panel .peak { width: 100%; height: auto; display: block; margin-bottom: 4px; }
.level-panel .lvl { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text); }
.level-panel .lvl-sub { font-size: 12.5px; color: var(--muted); }
.level-panel .xpbar { margin: 8px 10px 4px; }
.shell { margin-left: 232px; min-height: 100vh; display: flex; flex-direction: column; }
.shell > .wrap { width: 100%; max-width: 1280px; padding: 6px 28px 56px; margin: 0 auto; }
.shell > .wrap.full { max-width: none; }  /* the dashboard uses the whole width */
@media (max-width: 960px) { .shell > .wrap { padding: 6px 16px 48px; } }
.topstrip { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.topstrip .spacer { flex: 1; }
.topstrip .avatar { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-size: 14px;
  padding: 3px 10px 3px 3px; border-radius: 999px; text-decoration: none; }
.topstrip .avatar:hover { background: var(--surface-2); }
.topstrip .avatar i { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff; display: grid; place-items: center; font-style: normal; font-weight: 800; }
.topstrip .logout { display: inline-flex; align-items: center; gap: 7px; }
.topstrip .logout .ico, .xp-pill .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xp-pill { text-decoration: none; color: var(--text-2); border-color: color-mix(in srgb, var(--violet) 45%, var(--line));
  background: color-mix(in srgb, var(--violet) 14%, var(--surface)); padding: 6px 14px; font-weight: 650; }
.xp-pill .ico { color: var(--violet); }
.xp-pill:hover { text-decoration: none; }
.iconbtn { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; place-items: center; padding: 0; }
.iconbtn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mobile-brand { display: none; }
.side-scrim { display: none; }
@media (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); width: 260px; }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 7, 15, .5); }
  .shell { margin-left: 0; }
  .iconbtn { display: inline-grid; }
  .mobile-brand { display: inline-flex; }
  .mobile-brand .word { font-size: 17px; }
  .topstrip { padding: 10px 16px; }
  .topstrip .avatar span, .topstrip .logout span { display: none; }
}
@media (max-width: 520px) { .mobile-brand .word { display: none; } .xp-pill { padding: 5px 10px; } }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ======================================================================== top bar extras */
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.tb-greet h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.15; }
.tb-greet p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.topstrip:has(.tb-greet) { padding-top: 16px; padding-bottom: 12px; }
.tb-sep { width: 1px; height: 26px; background: var(--line-strong); margin: 0 4px; }
.themebtn.switch { width: auto; height: 38px; display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-strong); }
.themebtn.switch .ico { width: 30px; height: 30px; padding: 6px; border-radius: 9px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; color: var(--muted); transition: background .15s, color .15s; }
:root[data-theme="dark"] .themebtn.switch .moon, :root[data-theme="light"] .themebtn.switch .sun { background: var(--violet); color: #fff; }
.themebtn.switch .moon path { fill: currentColor; stroke: none; }
.topstrip .avatar i { width: 40px; height: 40px; }
.topstrip .avatar span { display: none; }
.topstrip .logout { padding: 9px 14px; border-radius: 11px; font-size: 14px; }
.xp-pill { padding: 8px 16px; border-radius: 12px; font-size: 15px; }
.xp-pill .ico { width: 18px; height: 18px; fill: var(--gold); stroke: var(--gold); }
.xp-pill b { color: var(--violet); }
@media (max-width: 960px) { .tb-greet, .tb-sep { display: none; } }

/* ======================================================================== dashboard (student) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.c-indigo { color: #6366f1; } .c-cyan { color: var(--cyan); } .c-gold { color: var(--gold); } .c-orange { color: var(--orange); }
.c-violet { color: var(--violet); } .c-good { color: var(--good); } .c-blue { color: #38bdf8; }
.db-head-mobile { display: none; }
.db-head-mobile h1 { margin: 0; font-size: 26px; } .db-head-mobile p { color: var(--muted); margin: 0 0 16px; }
@media (max-width: 960px) { .db-head-mobile { display: block; } }
.db-stats .ico, .db-card .ico, .db-course .ico, .db-banner .ico, .db-empty .ico { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* stats */
.db-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.db-stat { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-radius: 16px; min-height: 132px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); }
.db-stat.hl { border: 1.5px solid color-mix(in srgb, var(--violet) 80%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--violet) 14%, var(--surface)), var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent), 0 8px 26px color-mix(in srgb, var(--violet) 16%, transparent); }
.db-stat-ic { flex: none; display: grid; place-items: center; align-self: flex-start; margin-top: 4px; }
.db-stat-ic .ico { width: 44px; height: 44px; stroke-width: 1.7; }
.db-stat-ic.c-cyan .ico, .db-stat-ic.c-blue .ico { stroke-width: 2.1; }
.db-stat-body { min-width: 0; flex: 1; }
.db-stat .lbl { color: var(--text-2); font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.db-stat .num { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 2px 0 4px; }
.db-stat .num small { font-size: 20px; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.db-stat .cap { color: var(--text-2); font-size: 13.5px; }
.db-stat .xpbar { margin: 4px 0 8px; height: 9px; }
@media (max-width: 1300px) { .db-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .db-stat { padding: 14px; gap: 10px; min-height: 0; } .db-stat-ic .ico { width: 30px; height: 30px; } .db-stat .num { font-size: 24px; }
}

/* banner */
.db-banner { display: flex; align-items: center; gap: 20px; padding: 18px 22px 18px 26px; margin-bottom: 18px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--bad) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 22%, var(--surface)), color-mix(in srgb, var(--violet) 10%, var(--surface)) 70%, var(--surface)); }
.db-banner-ic .ico { width: 46px; height: 46px; color: #f87171; stroke-width: 1.8; }
.db-banner > div { flex: 1; min-width: 0; }
.db-banner h2 { margin: 0 0 2px; font-size: 21px; }
.db-banner p { margin: 0; color: var(--text-2); }
@media (max-width: 700px) { .db-banner { flex-wrap: wrap; gap: 12px; } .db-banner .btn { width: 100%; justify-content: center; } }
.btn.grad { background: var(--grad); color: #fff; border: 0; display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: 11px; font-weight: 650; box-shadow: 0 6px 18px color-mix(in srgb, var(--violet) 30%, transparent); }
.btn.grad:hover { filter: brightness(1.08); }
.btn.outline { background: transparent; color: var(--text); border: 1px solid var(--line-strong); display: inline-flex; align-items: center;
  gap: 9px; padding: 10px 16px; border-radius: 11px; font-weight: 650; box-shadow: none; }
.btn.outline:hover { background: var(--surface-2); }
.btn.grad .ico, .btn.outline .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* cards */
.db-card { padding: 20px 22px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(170deg, var(--surface-2), var(--surface)); min-width: 0; }
.db-card.dashed { border: 1.5px dashed var(--line-strong); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.db-card-h { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.db-card-h > .ico { width: 30px; height: 30px; flex: none; }
.db-card-h h2 { margin: 2px 0 0; font-size: 21px; font-weight: 750; }
.db-card-h h2 .muted { font-weight: 500; margin-left: 6px; }
.db-card-h p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.db-text { color: var(--text-2); font-size: 15px; margin: 0 0 14px; }
.db-empty { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 14px 2px; border-top: 1px solid var(--line); }
.db-empty .ico { width: 28px; height: 28px; flex: none; }

/* assignments + courses row */
.db-row { display: grid; grid-template-columns: minmax(300px, 1.75fr) repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; align-items: stretch; }
@media (max-width: 1500px) { .db-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } .db-assign { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .db-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .db-row { grid-template-columns: 1fr; } }
.db-arow { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-top: 1px solid var(--line); }
.db-arow-ic { width: 26px; height: 26px; flex: none; color: var(--text-2); }
.db-arow-main { flex: 1; min-width: 0; }
.db-arow-title { font-weight: 600; font-size: 14.5px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-arow-title a { color: var(--text); }
.db-arow-bar { display: flex; align-items: center; gap: 12px; }
.db-arow-bar .xpbar { flex: 1; margin: 0; height: 7px; }
.db-arow-bar span { font-size: 13px; color: var(--text-2); min-width: 34px; }
.spill { display: inline-block; white-space: nowrap; font-size: 12.5px; font-weight: 650; padding: 5px 11px; border-radius: 9px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line-strong); }
.spill.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.spill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.spill.info { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #60a5fa; border-color: color-mix(in srgb, #3b82f6 45%, transparent); }
:root[data-theme="light"] .spill.info { color: #1d4ed8; }

/* course cards */
.t-python { --tc: #eab308; } .t-networks { --tc: #38bdf8; } .t-cyber { --tc: #34d399; } .t-databases { --tc: #60a5fa; }
.db-course { position: relative; display: flex; flex-direction: column; padding: 18px 18px 0; border-radius: 16px; overflow: hidden; min-width: 0;
  border: 1px solid color-mix(in srgb, var(--violet) 30%, var(--line));
  background: linear-gradient(170deg, color-mix(in srgb, var(--violet) 9%, var(--surface)), var(--surface));
  transition: transform .18s ease, border-color .18s, box-shadow .18s; }
.db-course:hover { transform: translateY(-2px); border-color: var(--violet); box-shadow: 0 10px 28px color-mix(in srgb, var(--violet) 20%, transparent); }
.db-course.repair { border-color: color-mix(in srgb, var(--bad) 65%, transparent); }
.db-course-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.db-topic-ic .ico { width: 46px; height: 46px; color: var(--tc); stroke-width: 1.8; }
.db-pct { font-size: 14px; font-weight: 750; color: var(--text); padding: 4px 11px; border-radius: 9px;
  background: color-mix(in srgb, var(--violet) 22%, var(--surface)); }
.db-course h3 { margin: 0 0 6px; font-size: 18.5px; font-weight: 750; line-height: 1.2; color: var(--text); }
.db-course-link { color: inherit; }
.db-course-link::after { content: ""; position: absolute; inset: 0; }
.db-course-link:hover { text-decoration: none; }
.db-course-link:focus-visible { box-shadow: none; } .db-course:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }
.db-blurb { font-size: 12.5px; color: var(--text-2); line-height: 1.45; margin: 0 0 12px; min-height: 36px; }
.db-course .xpbar { height: 7px; margin: 0 0 12px; }
.db-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.db-mini > div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-3) 70%, transparent); border: 1px solid var(--line); }
.db-mini .ico { width: 20px; height: 20px; color: var(--text); }
.db-mini b { font-size: 13.5px; font-weight: 700; }
.db-step { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--violet);
  margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-step.bad { color: var(--bad); }
.db-step .ico { width: 14px; height: 14px; flex: none; }
.db-open { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: auto -18px 0;
  padding: 13px; font-weight: 650; font-size: 15px; color: var(--violet); background: color-mix(in srgb, var(--violet) 16%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--violet) 25%, var(--line)); }
:root[data-theme="dark"] .db-open { color: var(--a-light); }
.db-open:hover { text-decoration: none; background: color-mix(in srgb, var(--violet) 26%, var(--surface)); }
.db-open .ico { width: 17px; height: 17px; }

/* bottom row */
.db-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.85fr); gap: 18px; align-items: stretch; }
@media (max-width: 1250px) { .db-bottom { grid-template-columns: 1fr 1fr; } .db-badges { grid-column: 1 / -1; } }
@media (max-width: 700px) { .db-bottom { grid-template-columns: 1fr; } }
.db-callout { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 14.5px; }
.db-callout .ico { width: 20px; height: 20px; flex: none; }
.db-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.db-btns form { margin: 0; }
.db-tasks .db-btns { margin-top: 12px; }
.db-task { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--text); }
.db-task + .db-task { margin-top: 8px; }
.db-task:hover { text-decoration: none; border-color: var(--violet); }
.db-task .ico { width: 22px; height: 22px; flex: none; color: var(--violet); }
.db-task > span:not(.spill) { flex: 1; min-width: 0; }
.db-task strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-task small { color: var(--muted); font-size: 12.5px; }
.db-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  padding: 26px 16px; border: 1.5px dashed var(--line-strong); border-radius: 12px; color: var(--text-2); font-size: 14.5px; min-height: 150px; }
.db-dropzone:hover { text-decoration: none; border-color: var(--violet); }
.db-dropzone .ico { width: 40px; height: 40px; color: var(--violet); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* badges: shields */
.db-badges .db-card-h > .ico { color: var(--text); }
.db-badge-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px 10px; justify-items: center; padding-top: 4px; }
@media (max-width: 700px) { .db-badge-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 420px) { .db-badge-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.db-badge { --bc: #8a91a8; position: relative; width: 100%; max-width: 70px; aspect-ratio: 64 / 72; display: grid; place-items: center;
  transition: transform .15s; outline: none; }
.db-badge:hover, .db-badge:focus-visible { transform: translateY(-3px) scale(1.04); }
.db-badge:focus-visible .db-shield path { stroke-width: 4; }
.db-shield { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-shield path { fill: color-mix(in srgb, var(--surface-3) 85%, transparent); stroke: color-mix(in srgb, var(--bc) 70%, transparent); stroke-width: 2.6; }
.db-badge-ic { position: relative; color: var(--bc); }
.db-badge-ic .ico { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.db-badge.b-gold { --bc: #fbbf24; } .db-badge.b-silver { --bc: #cbd5e1; } .db-badge.b-bronze { --bc: #e0915a; }
.db-badge.b-green { --bc: #34d399; } .db-badge.b-violet { --bc: var(--a-light); }
.db-badge.earned .db-shield path { fill: color-mix(in srgb, var(--bc) 22%, var(--surface)); stroke: var(--bc); stroke-width: 3.2; }
.db-badge.earned .db-shield { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--bc) 45%, transparent)); }
.db-badge.earned .db-badge-ic .ico path[fill], .db-badge.earned .db-badge-ic .ico circle[fill] { fill: currentColor; }
.db-badge-tick { position: absolute; right: 2%; bottom: 8%; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bc); color: #111; box-shadow: 0 0 0 2px var(--surface); }
.db-badge-tick .ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.db-badge:not(.earned) { opacity: .75; }
@media (prefers-reduced-motion: reduce) { .db-course, .db-badge { transition: none; } .db-course:hover, .db-badge:hover, .db-badge:focus-visible { transform: none; } }

/* dashboard fills the window height: the bottom row stretches to the bottom edge */
.shell > .wrap.full { flex: 1; display: flex; flex-direction: column; }
.wrap.full > .db-bottom { flex: 1; min-height: 260px; max-height: 560px; }
.db-bottom > .db-card { display: flex; flex-direction: column; }
.db-rev .db-btns, .db-tasks .db-btns { margin-top: auto; padding-top: 12px; }
.db-tasks .db-dropzone { flex: 1; }
.db-badges .db-badge-grid { flex: 1; align-content: space-evenly; }
.wrap.full > .db-row { flex: 1; min-height: 330px; max-height: 520px; }
.db-course .db-mini { margin-top: auto; }   /* extra height opens up above the stats, so the card stays balanced */
.db-course .db-blurb { font-size: 13px; }
.db-assign { display: flex; flex-direction: column; }
.db-assign .db-arow { padding: 15px 2px; }
@media (max-width: 1250px) { .wrap.full > .db-bottom { flex: none; } }

/* ======================================================================== SITE-WIDE DESIGN SYSTEM
   (ChatGPT spec: dark gamified style from the dashboard applied to every page. Shared components only.) */
:root { --input-bg: #ffffff; --input-line: #cfd6e3; --th-bg: #f2f4f9; --row-hover: #f6f7fb;
  --card-bg: linear-gradient(170deg, #ffffff, #fbfbfe); }
:root[data-theme="dark"] { --input-bg: #1a1e2d; --input-line: #343a50; --th-bg: #1a1e2d; --row-hover: #1b2030;
  --card-bg: linear-gradient(170deg, #161a29, #121521); }
body { font-size: 14.5px; line-height: 1.55; }

/* page header */
.wrap h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 6px; }
.wrap h1 + p.muted, .wrap h1 + .muted, .wrap h1 + .lead { font-size: 14px; margin-bottom: 20px; }
.wrap > h1:not(:has(+ p)) { margin-bottom: 20px; }
.crumbs { font-size: 12.5px; margin: 0 0 6px; }
.crumbs a:hover { color: var(--violet); }
.wrap > p:first-child > a:only-child { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }  /* "← back" links */
.wrap > p:first-child > a:only-child:hover { color: var(--violet); text-decoration: none; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; }

/* cards */
.card, .qcard, details.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.18); }
:root[data-theme="light"] .card, :root[data-theme="light"] .qcard { box-shadow: var(--shadow-sm); }
.card > h2:first-child, .qcard > h2:first-child { margin-bottom: 14px; }
a.card:hover, .card.interactive:hover { border-color: var(--violet); transform: translateY(-2px); text-decoration: none; }
.card.dashed { border-style: dashed; border-width: 1.5px; border-color: var(--line-strong); }
.card[style*="border-color: var(--bad)"] { border-left-width: 4px; }
.grid2 { gap: 16px; }
.stat { background: var(--card-bg); border-radius: 16px; }

/* tables */
.card > table:not(.heat):not(.trace), .card table:not(.heat):not(.trace):not(.g2-table):not(.vg) { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th { background: var(--th-bg); color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .05em; padding: 11px 14px; }
td { padding: 12px 14px; font-size: 14px; }
tr:last-child > td { border-bottom: 0; }
tbody tr:hover > td, table:not(.heat):not(.trace):not(.g2-table):not(.key) tr:has(td):hover > td { background: var(--row-hover); }
td { font-variant-numeric: tabular-nums; }

/* forms */
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=email],
input[type=search], select, textarea {
  background-color: var(--input-bg); border: 1px solid var(--input-line); border-radius: 10px; padding: 10px 12px; font-size: 14px; min-height: 42px; color: var(--text); }
textarea { min-height: 120px; resize: vertical; }
textarea.code, textarea.cb-edit, textarea.inputs, textarea.cb-inputs { min-height: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 2px color-mix(in srgb, var(--violet) 45%, transparent); }
label { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--violet); width: 18px; height: 18px; }
input[type=file] { border: 1.5px dashed color-mix(in srgb, var(--violet) 55%, var(--line-strong)); background: color-mix(in srgb, var(--violet) 6%, var(--input-bg));
  border-radius: 12px; padding: 16px; cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 12px; border: 0; border-radius: 9px; padding: 8px 14px; background: var(--grad); color: #fff; font: 650 13.5px var(--font); cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { opacity: .5; }
fieldset { border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* tabs */
.tabs, .admin-nav { gap: 6px; padding: 5px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--line); flex-wrap: wrap; }
.tab, .admin-nav a { padding: 9px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tab:hover, .admin-nav a:hover { color: var(--text); background: var(--row-hover); text-decoration: none; }
.tab.on, .admin-nav a.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--violet) 30%, transparent); }
.cattabs .tab.rev { color: var(--violet); } .cattabs .tab.rev.on { color: #fff; }
@media (max-width: 700px) { .tabs, .admin-nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; } .tab { white-space: nowrap; } }

/* buttons */
.btn { min-height: 42px; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 650; background: var(--grad); color: #fff; border: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--violet) 22%, transparent); }
.btn:hover { background: var(--grad); filter: brightness(1.08); }
.btn.ghost, .btn.outline { background: transparent; color: var(--text); border: 1px solid var(--input-line); box-shadow: none; }
.btn.ghost:hover, .btn.outline:hover { background: var(--row-hover); filter: none; border-color: var(--violet); }
.btn.danger { background: var(--bad); box-shadow: none; } .btn.danger:hover { filter: brightness(1.1); background: var(--bad); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.themebtn.switch, .iconbtn { box-shadow: none; }

/* status pills */
.tag { font-size: 11.5px; font-weight: 650; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; }
.tag.completed { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.tag.revoked { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.tag.available { background: color-mix(in srgb, var(--violet) 18%, transparent); color: var(--violet); border-color: color-mix(in srgb, var(--violet) 35%, transparent); }
.tag.locked, .tag.capped { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
:root[data-theme="dark"] .tag.available { color: var(--a-light); }

/* alerts */
.flash, .banner { border-radius: 12px; font-size: 14px; padding: 13px 16px 13px 46px; position: relative; border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  background: var(--card-bg); }
.flash::before, .banner::before { content: ""; position: absolute; left: 16px; top: 14px; width: 18px; height: 18px; border-radius: 50%;
  background: currentColor; -webkit-mask: var(--alert-ic) center / contain no-repeat; mask: var(--alert-ic) center / contain no-repeat; color: var(--info); }
.flash { --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm1 15h-2v-6h2Zm0-8h-2V7h2Z'/%3E%3C/svg%3E"); }
.flash.ok { --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.5 14.5-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4Z'/%3E%3C/svg%3E"); }
.flash.error, .banner { --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 21h22Zm1 15h-2v-2h2Zm0-4h-2V9h2Z'/%3E%3C/svg%3E"); }
.flash.ok { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--surface)); } .flash.ok::before { color: var(--good); }
.flash.error { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); } .flash.error::before { color: var(--bad); }
.flash.info, .banner.info { border-left-color: var(--info); background: color-mix(in srgb, var(--info) 9%, var(--surface)); }
.banner { border-color: color-mix(in srgb, var(--bad) 50%, transparent); border-left-color: var(--bad);
  background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 18%, var(--surface)), color-mix(in srgb, var(--violet) 8%, var(--surface))); }
.banner::before { color: #f87171; }
.banner.info::before { color: var(--info); }

/* ------------------------------------------------ page-specific notes */
/* login / join: centred 420px card with the brand */
.auth { max-width: 420px; margin: 56px auto; padding: 28px; }
body:not(.has-side) nav.top { background: transparent; border-bottom: 0; }
body:not(.has-side) .wrap { max-width: 1160px; }

/* skill grid: dark canvas */
.gridwrap { border-radius: 16px; border: 1px solid var(--line); background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 0) 0 0 / 22px 22px, var(--card-bg); }

/* course book: left list + reading panel */
.cb-nav { background: var(--card-bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; }
.cb-link { border-radius: 10px; }
.cb-link.on, .cb-link[aria-current] { background: var(--grad) !important; color: #fff !important; }
.cb-link.on .n, .cb-link[aria-current] .n { background: rgba(255,255,255,.25); color: #fff; }
.cb-page { background: var(--card-bg); border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px; }
.cb-prose { max-width: 900px; }

/* code: editor, output and code samples */
pre.codeview, pre.lesson, pre.cb-code, .CodeMirror { border-radius: 12px !important; border: 1px solid var(--line) !important; }
pre.output, .console { border-radius: 12px; border: 1px solid var(--line); }

/* question / challenge cards */
.qcard { border-left: 4px solid var(--violet); }
body:not(.has-side) { background: radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--violet) 22%, transparent), transparent 70%), var(--bg); min-height: 100vh; }
.auth form .btn:not(.ghost) { width: 100%; }
.auth h1 { text-align: center; margin-bottom: 18px; }

/* ======================================================================== topic tabs in the top bar (grid, revision, assessment) */
.cattabs .tab { display: inline-flex; align-items: center; gap: 8px; }
.cattabs .tab .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cattabs .tab:not(.on) .ico { color: var(--tc, currentColor); }
.cattabs .tab.on .ico { color: #fff; }
.tb-tabs { min-width: 0; }
.tb-tabs .tabs { margin: 0; flex-wrap: nowrap; gap: 2px; padding: 4px; }
.tb-tabs .tab { padding: 8px 13px; font-size: 13.5px; white-space: nowrap; }
.tb-tabs .tab + .tab { position: relative; }
.tabs-inline { display: none; }
@media (max-width: 1760px) { .tb-tabs { display: none; } .tabs-inline { display: block; } }
.topstrip .logout, .xp-pill { white-space: nowrap; flex: none; }
.tabs-inline .tabs { margin-bottom: 14px; }

/* ======================================================================== skill grid page */
.gp-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 4px 0 20px; }
.gp-ic .ico { width: 64px; height: 64px; color: var(--tc); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 4px 14px color-mix(in srgb, var(--tc) 35%, transparent)); }
.gp-title { flex: 1; min-width: 260px; }
.gp-title h1 { margin: 0; font-size: 30px; }
.gp-title p { margin: 2px 0 8px; color: var(--text-2); font-size: 15px; }
.gp-prog { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.gp-prog .xpbar { width: 200px; margin: 0; }
.gp-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.gp-actions .btn .ico, .gp-side .btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gp-side .btn .ico path[fill] { fill: currentColor; stroke: none; }

.gp-main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
@media (max-width: 1200px) { .gp-main { grid-template-columns: 1fr; } .gp-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
.gp-main .gridwrap { padding: 18px 10px; margin: 0; }
.gp-side { display: grid; gap: 16px; }
.gp-card { padding: 18px 20px; }
.gp-card .db-card-h { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.gp-card .db-card-h h2 { font-size: 19px; margin: 0; }
.gp-card .db-card-h .ico { width: 26px; height: 26px; }

.gp-progress { display: flex; align-items: center; gap: 22px; }
.ring { width: 124px; height: 124px; flex: none; }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ring-fg { fill: none; stroke: url(#ringGrad) var(--violet); stroke: var(--violet); stroke-width: 11; stroke-linecap: round; }
.ring text { font: 800 28px var(--font-display); fill: var(--text); }
.gp-progress ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 15px; color: var(--text-2); }
.gp-progress li { display: flex; align-items: center; gap: 10px; }
.gp-progress li b { color: var(--text); }
.gp-progress .ico { width: 24px; height: 24px; flex: none; }

.gp-skill { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.gp-num { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 12px; font: 800 26px var(--font-display);
  border: 2px solid var(--violet); color: var(--text); background: color-mix(in srgb, var(--violet) 12%, transparent); }
.gp-num .ico { width: 28px; height: 28px; }
.gp-skill strong { display: block; font-size: 19px; }
.gp-skill p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.btn.block { width: 100%; justify-content: center; font-size: 16px; padding: 13px; }
.gp-next { border-color: color-mix(in srgb, var(--violet) 45%, var(--line)); }

.gp-repair { border-color: color-mix(in srgb, var(--bad) 55%, transparent);
  background: linear-gradient(170deg, color-mix(in srgb, var(--bad) 14%, var(--surface)), var(--surface)); }
.gp-repair .db-card-h { border-bottom: 0; padding-bottom: 0; margin-bottom: 8px; }
.gp-repair .db-card-h .ico { color: #f87171; }
.gp-repair-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; }
.gp-count { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: #fff;
  font-size: 12.5px; font-weight: 800; margin-right: 6px; }
.gp-repair .btn.outline { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.gp-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.gp-key summary { list-style: none; cursor: pointer; }
.gp-key summary::-webkit-details-marker { display: none; }
.gp-key summary .db-card-h { position: relative; }
.gp-key summary .db-card-h::after { content: ""; position: absolute; right: 4px; top: 8px; width: 9px; height: 9px; border: solid var(--text-2);
  border-width: 2px 2px 0 0; transform: rotate(-45deg); transition: transform .15s; }
.gp-key:not([open]) summary .db-card-h { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.gp-key:not([open]) summary .db-card-h::after { transform: rotate(135deg); top: 4px; }
.gp-key ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; font-size: 14px; color: var(--text-2); }
.gp-key li { display: flex; align-items: center; gap: 12px; }
.gp-key li b { color: var(--text); }
.k { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 800; }
.k .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.k-done { background: var(--good); color: #fff; }
.k-avail { border: 3px solid var(--violet); }
.k-lock { color: var(--text-2); background: var(--surface-3); }
.k-rev { background: var(--bad); color: #fff; }
.k-boss { border: 2px dashed var(--gold); color: var(--gold); }
.k-learn { border: 2px solid var(--violet); color: var(--violet); }
.k-medals { width: auto; gap: 3px; display: flex; border-radius: 0; }
.k-medals .m { width: 14px; height: 14px; border-radius: 50%; display: block; }
.k-medals .m.gold { background: var(--gold); } .k-medals .m.silver { background: var(--silver); } .k-medals .m.bronze { background: var(--bronze); }
.k-gate { border-radius: 0; height: 0; border-top: 3px dashed var(--gold); }

/* bubbles */
.sphere .node text.lbl { fill: var(--text); font-size: 13.5px; stroke: var(--bg); }
.sphere .node.locked text.lbl, .sphere .node.capped text.lbl { fill: var(--text-2); }
.sphere .path { stroke: color-mix(in srgb, var(--violet) 22%, var(--surface-3)); }
.sphere .path.lit { stroke: url(#doneGrad); stroke: var(--violet); }
.sphere .node.completed circle.core { fill: url(#doneGrad); stroke: var(--a-light); }
.sphere .node.completed text.num { fill: #fff; }
.sphere .node.available circle.core { fill: color-mix(in srgb, var(--violet) 10%, var(--surface)); stroke: var(--violet); stroke-width: 4; animation: none; }
.sphere .node.available text.num { fill: var(--text); }
.sphere .node.next circle.core { fill: url(#nextGrad); stroke: var(--a-light); stroke-width: 4; }
.sphere .node.next text.num { fill: #fff; font-size: 24px; }
.sphere .nexttag { fill: var(--violet); }
.sphere .nexttxt { font: 800 11px var(--font); fill: #fff; text-anchor: middle; letter-spacing: .06em; }
.sphere .node.locked circle.core, .sphere .node.capped circle.core { fill: color-mix(in srgb, var(--surface-3) 80%, var(--bg)); stroke: color-mix(in srgb, var(--muted) 45%, transparent); }
.sphere .node.locked text.num, .sphere .node.capped text.num { fill: var(--text); font-size: 16px; }
.sphere .lock rect { fill: var(--text-2); } .sphere .lock path { fill: none; stroke: var(--text-2); stroke-width: 2; }
.sphere .node.boss circle.core { fill: color-mix(in srgb, var(--gold) 8%, var(--surface)); stroke: var(--gold); stroke-width: 3; stroke-dasharray: 6 5; }
.sphere .node.boss.completed circle.core { fill: color-mix(in srgb, var(--gold) 28%, var(--surface)); stroke-dasharray: none; }
.sphere .node.boss circle.ring { stroke: color-mix(in srgb, var(--gold) 45%, transparent); stroke-dasharray: 3 6; }
.sphere .node.boss text.star { fill: var(--gold); font-size: 26px; }
.sphere .node.revoked circle.core { fill: color-mix(in srgb, var(--bad) 22%, var(--surface)); stroke: var(--bad); stroke-dasharray: none; }
.sphere .node.revoked text.num { fill: #fff; }
.sphere .donedot { fill: var(--good); stroke: var(--surface); stroke-width: 2.5; }
.sphere .donetick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sphere .medaldot { stroke: var(--surface); stroke-width: 2.5; }
.sphere .learn circle.core { fill: color-mix(in srgb, var(--violet) 18%, var(--surface)); stroke: var(--violet); stroke-width: 4; }
.sphere .learn text.lbl { fill: var(--text); }
.sphere .node:hover circle.core { stroke-width: 5; }
.sphere .band { fill: var(--muted); }

/* ======================================================================== course book (ChatGPT mock-up) */
.cb-head { align-items: center; margin-bottom: 18px; }
.cb-kicker { color: var(--violet); font-weight: 800; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; }
:root[data-theme="dark"] .cb-kicker { color: var(--a-light); }
.cb-title-row { display: flex; align-items: center; gap: 18px; margin-top: 4px; }
.cb-topic-ic .ico { width: 58px; height: 58px; color: var(--tc); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 4px 14px color-mix(in srgb, var(--tc) 35%, transparent)); }
.cb-head h1 { margin: 0; font-size: 30px; }
.cb-sub { margin: 2px 0 0; color: var(--text-2); font-size: 15.5px; }
.cb-tools { margin: 0; gap: 12px; }
.cb-tools .btn .ico, .cb-pager .btn .ico, .cb-page-head .btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cb-page-head .btn .ico path[fill] { fill: currentColor; stroke: none; }
.ico.flip { transform: scaleX(-1); }

/* full-width segmented topic tabs */
.cb-topics { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; margin-bottom: 20px; }
.cb-topics .tab { justify-content: center; padding: 13px 14px; border-radius: 0; font-size: 15px; gap: 12px; position: relative; }
.cb-topics .tab .ico { width: 24px; height: 24px; }
.cb-topics .tab + .tab::before { content: ""; position: absolute; left: 0; top: 25%; bottom: 25%; width: 1px; background: var(--line); }
.cb-topics .tab.on { border-radius: 14px; } .cb-topics .tab.on::before, .cb-topics .tab.on + .tab::before { display: none; }
@media (max-width: 900px) { .cb-topics { display: flex; overflow-x: auto; } .cb-topics .tab { flex: none; } }

/* left column */
.cb-layout { grid-template-columns: 340px minmax(0, 1fr); gap: 20px; }
@media (max-width: 1100px) { .cb-layout { grid-template-columns: 270px minmax(0, 1fr); } }
@media (max-width: 760px) { .cb-layout { grid-template-columns: 1fr; } .cb-nav { position: static; max-height: 320px; } }
.cb-nav { padding: 14px 12px; top: 84px; max-height: calc(100vh - 104px); }
.cb-progress { display: flex; gap: 14px; align-items: center; padding: 6px 6px 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.cb-progress-ic { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: color-mix(in srgb, var(--violet) 18%, var(--surface)); color: var(--a-light); }
.cb-progress-ic .ico { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.cb-progress > div { flex: 1; min-width: 0; }
.cb-progress-top { display: flex; justify-content: space-between; font-size: 15px; }
.cb-progress .xpbar { margin: 8px 0 6px; }
.cb-progress small { color: var(--text-2); font-size: 12.5px; }
.cb-find { position: relative; display: block; margin: 0 0 12px; }
.cb-find .ico { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.cb-find input { padding-left: 40px; margin: 0 !important; }
.cb-link { padding: 9px 10px; font-size: 15px; gap: 14px; color: var(--text); border-bottom: 1px solid var(--line); border-radius: 0; }
.cb-link:hover { background: var(--row-hover); border-radius: 10px; }
.cb-link.on, .cb-link[aria-current] { border-radius: 10px; border-bottom-color: transparent; font-weight: 700; }
.cb-link .n { width: 28px; height: 28px; font-size: 12.5px; font-weight: 700; background: transparent; border: 1.5px solid var(--line-strong); color: var(--text); }
.cb-link.on .n { border-color: rgba(255,255,255,.7); background: transparent; }
.cb-link.prac .n { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }

/* reading panel */
.cb-page { padding: 22px 24px; }
.cb-page-head { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 18px; }
.cb-page-ic { width: 82px; height: 82px; flex: none; display: grid; place-items: center; border-radius: 16px; border: 2px solid var(--violet);
  background: color-mix(in srgb, var(--violet) 14%, var(--surface)); color: var(--a-light); box-shadow: 0 6px 22px color-mix(in srgb, var(--violet) 25%, transparent); }
.cb-page-ic .ico { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cb-page-ic.prac { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.cb-page-ic.prac .ico path[fill] { fill: currentColor; }
.cb-page-head h2 { font-size: 30px; font-weight: 800; margin: 2px 0 4px; }
.cb-summary { font-size: 15.5px; margin-bottom: 14px; }
@media (max-width: 600px) { .cb-page-ic { width: 56px; height: 56px; } .cb-page-ic .ico { width: 30px; height: 30px; } .cb-page-head { gap: 14px; } }

.cb-tabs { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, transparent); border-radius: 10px 10px 0 0; padding: 0 6px; gap: 10px; }
.cb-tab { padding: 11px 22px; font-size: 15px; color: var(--text-2); border-bottom: 3px solid transparent; }
.cb-tab[aria-selected="true"] { color: var(--a-light); border-bottom-color: var(--violet); }
:root[data-theme="light"] .cb-tab[aria-selected="true"] { color: var(--violet); }
.cb-tab-n { background: color-mix(in srgb, var(--violet) 25%, transparent) !important; color: var(--text) !important; }

/* sections with icons */
.cb-sec { display: flex; gap: 16px; align-items: flex-start; background: color-mix(in srgb, var(--surface-2) 55%, transparent); border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 18px 20px; box-shadow: none; }
.cb-sec-ic { flex: none; padding-top: 2px; color: var(--violet); }
.cb-sec-ic .ico { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cb-sec-ic .ico path[fill], .cb-sec-ic .ico circle[fill] { fill: currentColor; }
:root[data-theme="dark"] .cb-sec-ic { color: var(--a-light); }
.cb-sec-body { flex: 1; min-width: 0; }
.cb-h { font-size: 20px; font-weight: 800; text-transform: none; letter-spacing: -.01em; color: var(--text) !important; margin: 0 0 6px; }
.cb-h::before { display: none; }
.cb-lead { font-size: 15.5px; }
.cb-prose { font-size: 15px; }
.cb-prose ul li::marker, .cb-mistakes li::marker { color: var(--violet); }
.cb-words { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cb-words > div { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--surface-3) 50%, transparent); border: 1px solid var(--line-strong); }
.cb-word-ic { flex: none; color: var(--a-light); }
.cb-word-ic .ico { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cb-words dt { color: var(--text); font-size: 15px; }
.cb-words dd { font-size: 13px; }
.cb-watch { border-color: color-mix(in srgb, var(--bad) 60%, transparent); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.cb-watch .cb-sec-ic { color: #ef4444 !important; }
.cb-watch .cb-sec-ic .ico path[fill] { fill: currentColor; fill-opacity: 1; } .cb-watch .cb-sec-ic .ico path:not([fill]) { stroke: #fff; }
.cb-watch .cb-mistakes li::marker { color: #f87171; }
.cb-prose code, .cb-lead code, .cb-words code, .cb-mistakes code, .cb-summary code { background: color-mix(in srgb, var(--violet) 14%, var(--surface)); border-color: color-mix(in srgb, var(--violet) 30%, var(--line)); }
.cb-pager { margin-top: 18px; }
.cb-pager .btn { min-height: 46px; padding: 11px 20px; }

/* breathing room on the left and right: grows with the screen (48px on small laptops, up to 160px on big monitors) */
.shell > .wrap { padding-left: clamp(48px, 8vw, 160px); padding-right: clamp(48px, 8vw, 160px); }
.topstrip { padding-left: clamp(48px, 8vw, 160px); padding-right: clamp(48px, 8vw, 160px); }
@media (max-width: 960px) { .shell > .wrap, .topstrip { padding-left: 16px; padding-right: 16px; } }

/* interactive tables in the course book keep their own compact size (not the full-width site table style) */
table.g2-table, table.vg, table.trace { width: auto; }
table.g2-table th { background: none; padding: 0 10px 0 0; text-align: right; white-space: nowrap; border: 0; }
table.g2-table tr:first-child th { text-align: center; padding: 0 0 4px; }
table.g2-table td, table.g2-table th { border-bottom-width: 1px; }
table.g2-table th.tot { border: 1px dashed var(--violet); border-radius: 8px; padding: 4px 8px; text-align: center; }
table.g2-table tr:hover > td { background: inherit; }
table.g2-table td.line { background: var(--primary-soft); } table.g2-table td.on { background: var(--primary); color: #fff; }
.cb-words { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }   /* cards stretch to fill the row */


/* ======================================================================== ACCENT COLOURS (Settings > Appearance)
   Every accent sets: a1 (links, text), a2 (highlights), g1/g2 (gradient buttons, white text on top), a-light (soft tints on dark). */
:root { --a1: #4f46e5; --a2: #7c3aed; --g1: #4f46e5; --g2: #7c3aed; --a-light: #a78bfa; }
:root[data-theme="dark"] { --a1: #7c7cff; --a2: #a78bfa; --g1: #6d4aff; --g2: #8b5cf6; --a-light: #c4b5fd; }
:root[data-accent="blue"] { --a1: #2563eb; --a2: #0284c7; --g1: #2563eb; --g2: #0891b2; --a-light: #60a5fa; }
:root[data-theme="dark"][data-accent="blue"] { --a1: #60a5fa; --a2: #38bdf8; --g1: #2563eb; --g2: #0891b2; --a-light: #93c5fd; }
:root[data-accent="teal"] { --a1: #0f766e; --a2: #0891b2; --g1: #0d9488; --g2: #0891b2; --a-light: #2dd4bf; }
:root[data-theme="dark"][data-accent="teal"] { --a1: #2dd4bf; --a2: #22d3ee; --g1: #0d9488; --g2: #0891b2; --a-light: #5eead4; }
:root[data-accent="green"] { --a1: #15803d; --a2: #16a34a; --g1: #16a34a; --g2: #4d7c0f; --a-light: #4ade80; }
:root[data-theme="dark"][data-accent="green"] { --a1: #4ade80; --a2: #86efac; --g1: #16a34a; --g2: #4d7c0f; --a-light: #86efac; }
:root[data-accent="orange"] { --a1: #c2410c; --a2: #ea580c; --g1: #ea580c; --g2: #d97706; --a-light: #fb923c; }
:root[data-theme="dark"][data-accent="orange"] { --a1: #fb923c; --a2: #fdba74; --g1: #ea580c; --g2: #c2410c; --a-light: #fdba74; }
:root[data-accent="pink"] { --a1: #be185d; --a2: #c026d3; --g1: #db2777; --g2: #c026d3; --a-light: #f472b6; }
:root[data-theme="dark"][data-accent="pink"] { --a1: #f472b6; --a2: #e879f9; --g1: #db2777; --g2: #a21caf; --a-light: #f9a8d4; }
:root, :root[data-theme="dark"] {
  --primary: var(--a1); --primary-hover: var(--a2); --violet: var(--a2);
  --primary-soft: color-mix(in srgb, var(--a1) 13%, var(--surface)); --violet-soft: color-mix(in srgb, var(--a2) 14%, var(--surface));
  --grad: linear-gradient(90deg, var(--g1), var(--g2)); --primary-ink: #ffffff;
  --ring: 0 0 0 3px color-mix(in srgb, var(--a1) 30%, transparent);
}
:root[data-theme="dark"] { --side-bg: linear-gradient(180deg, color-mix(in srgb, var(--g1) 20%, #0b0d14) 0%, #0f1024 55%, color-mix(in srgb, var(--g2) 22%, #0b0d14) 100%); }

/* Settings > Appearance */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.mode-pick, .accent-pick { border: 0; padding: 0; margin: 14px 0 6px; background: none; display: flex; flex-wrap: wrap; gap: 12px; }
.mode-pick legend, .accent-pick legend { font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.mode-opt, .accent-opt { margin: 0; cursor: pointer; position: relative; }
.mode-opt input, .accent-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 132px; padding: 10px 10px 12px; border-radius: 14px;
  border: 2px solid var(--line-strong); font-size: 13.5px; font-weight: 650; color: var(--text); }
.mode-card .ico { display: none; }
.mode-prev { width: 100%; height: 62px; border-radius: 9px; display: grid; grid-template-columns: 26% 1fr; grid-template-rows: 1fr 1fr; gap: 4px; padding: 5px; }
.mode-prev i { border-radius: 4px; } .mode-prev i:first-child { grid-row: 1 / 3; }
.mode-light .mode-prev { background: #eef1f7; } .mode-light .mode-prev i { background: #ffffff; } .mode-light .mode-prev i:first-child { background: var(--g1); }
.mode-dark .mode-prev { background: #0b0d14; } .mode-dark .mode-prev i { background: #1a1e2d; } .mode-dark .mode-prev i:first-child { background: var(--g1); }
.mode-system .mode-prev { background: linear-gradient(135deg, #eef1f7 50%, #0b0d14 50%); } .mode-system .mode-prev i { background: color-mix(in srgb, #888 40%, transparent); } .mode-system .mode-prev i:first-child { background: var(--g1); }
.mode-opt input:checked + .mode-card, .accent-opt input:checked + .swatch { border-color: var(--a1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 30%, transparent); }
.mode-opt input:focus-visible + .mode-card, .accent-opt input:focus-visible + .swatch { outline: 2px solid var(--a1); outline-offset: 2px; }
.accent-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); width: 76px; text-align: center; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.swatch[data-swatch="violet"] { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.swatch[data-swatch="blue"] { background: linear-gradient(135deg, #2563eb, #0891b2); }
.swatch[data-swatch="teal"] { background: linear-gradient(135deg, #0d9488, #0891b2); }
.swatch[data-swatch="green"] { background: linear-gradient(135deg, #16a34a, #4d7c0f); }
.swatch[data-swatch="orange"] { background: linear-gradient(135deg, #ea580c, #d97706); }
.swatch[data-swatch="pink"] { background: linear-gradient(135deg, #db2777, #c026d3); }

/* ======================================================================== SLIM SIDEBAR (icons, labels on hover) */
.side { width: 84px; padding: 16px 12px; align-items: center; }
.shell { margin-left: 84px; }
.side-head { padding: 0 0 18px; justify-content: center; }
.side .brand .word { display: none; }
.side .brand .logo { width: 46px; height: 46px; }
.side-links, .side-foot { width: 100%; justify-items: center; gap: 10px; }
.side-foot { border-top: 0; padding-top: 0; }
.side-foot form { margin: 0; width: 100%; display: flex; justify-content: center; }
.side a.link, .side button.link { position: relative; width: 52px; height: 52px; padding: 0; justify-content: center; border-radius: 14px;
  background: none; border: 0; color: var(--text-2); cursor: pointer; font: inherit; display: flex; align-items: center; }
:root[data-theme="dark"] .side a.link, :root[data-theme="dark"] .side button.link { color: color-mix(in srgb, #fff 80%, transparent); }
.side a.link .ico, .side button.link .ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side a.link:hover, .side button.link:hover { background: color-mix(in srgb, var(--a1) 16%, transparent); color: var(--text); }
.side a.link.on { background: var(--grad); color: #fff; }
/* the label becomes a tooltip */
.side a.link > span, .side button.link > span { position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%) translateX(-4px);
  white-space: nowrap; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 650; padding: 6px 10px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 50; box-shadow: var(--shadow); }
.side a.link:hover > span, .side a.link:focus-visible > span, .side button.link:hover > span, .side button.link:focus-visible > span { opacity: 1; transform: translateY(-50%); }
.side { overflow: visible; }
:root[data-theme="light"] .side { background: linear-gradient(180deg, color-mix(in srgb, var(--g1) 92%, #1e1b4b), color-mix(in srgb, var(--g2) 75%, #1e1b4b)); border-right: 0; }
:root[data-theme="light"] .side a.link, :root[data-theme="light"] .side button.link { color: rgba(255,255,255,.85); }
:root[data-theme="light"] .side a.link:hover, :root[data-theme="light"] .side button.link:hover { background: rgba(255,255,255,.14); color: #fff; }
:root[data-theme="light"] .side a.link.on { background: rgba(255,255,255,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
@media (max-width: 960px) {
  .side { width: 260px; align-items: stretch; overflow-y: auto; }
  .side-head { justify-content: space-between; }
  .side .brand .word { display: inline; }
  .side-links, .side-foot { justify-items: stretch; }
  .side a.link, .side button.link { width: 100%; height: auto; padding: 11px 14px; justify-content: flex-start; gap: 13px; }
  .side a.link > span, .side button.link > span { position: static; opacity: 1; transform: none; background: none; color: inherit; padding: 0; box-shadow: none; font-size: 15px; }
  .shell { margin-left: 0; }
}

/* ======================================================================== TOP BAR: search, bell, profile */
.topstrip { gap: 14px; padding-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tb-tabs { display: none !important; } .tabs-inline { display: block !important; }
.tb-search { position: relative; flex: 0 1 560px; min-width: 0; display: flex; align-items: center; }
.tb-search > .ico { position: absolute; left: 16px; width: 20px; height: 20px; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.tb-search input { width: 100%; min-height: 46px; padding: 10px 92px 10px 48px; border-radius: 14px; background: var(--input-bg); font-size: 15px; }
.tb-search kbd { position: absolute; right: 10px; font: 600 12.5px var(--font); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 3px 8px; pointer-events: none; }
.tb-search input:focus + kbd { opacity: 0; }
.tb-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow-y: auto; }
.tb-results a { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.tb-results a small { color: var(--muted); font-size: 12.5px; }
.tb-results a.on, .tb-results a:hover { background: color-mix(in srgb, var(--a1) 14%, transparent); }
.tb-results p { margin: 8px 12px; }
.xp-pill { min-height: 46px; padding: 8px 18px; border-radius: 14px; font-size: 16px; font-weight: 750; color: var(--a1);
  background: color-mix(in srgb, var(--a1) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--a1) 22%, var(--line)); }
.xp-pill b { color: inherit; }
.xp-pill .ico { width: 20px; height: 20px; }
.tb-menu { position: relative; }
.tb-menu > summary { list-style: none; cursor: pointer; }
.tb-menu > summary::-webkit-details-marker { display: none; }
.bellbtn { display: inline-grid !important; width: 46px; height: 46px; border-radius: 14px; position: relative; }
.bellbtn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell-dot { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--a1);
  color: #fff; font: 800 11px/19px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.tb-profile > summary { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 99px; }
.tb-profile > summary:hover { background: var(--surface-2); }
.topstrip .avatar i { width: 44px; height: 44px; font-size: 17px; background: var(--grad); }
.topstrip .avatar span { display: inline; font-size: 16px; font-weight: 650; color: var(--text); }
.tb-profile .chev { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; transform: rotate(90deg); }
.tb-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 330px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; }
.tb-profile .tb-pop { width: 250px; }
.tb-pop-h { font-weight: 750; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tb-pop-h small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.note { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.note:hover { background: var(--row-hover); text-decoration: none; }
.note .ico { width: 22px; height: 22px; color: var(--a1); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.note.overdue .ico { color: var(--bad); } .note.marks .ico { color: var(--gold); }
.note b { display: block; font-size: 13.5px; } .note small { color: var(--text-2); font-size: 12.5px; }
.note time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.note.new { background: color-mix(in srgb, var(--a1) 9%, transparent); }
.note-empty { padding: 8px 10px; margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text); font: 600 14px var(--font);
  background: none; border: 0; cursor: pointer; text-decoration: none; min-height: 0; height: auto; justify-content: flex-start; box-shadow: none; }
.menu-item:hover { background: var(--row-hover); text-decoration: none; }
.menu-item .ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-pop form { margin: 0; }
.menu-item.themebtn .ico { padding: 0; background: none !important; color: inherit !important; width: 19px; height: 19px; }
:root[data-theme="dark"] .menu-item.themebtn .moon, :root[data-theme="light"] .menu-item.themebtn .sun { display: none; }
@media (max-width: 960px) {
  .tb-search { flex: 1 1 auto; } .tb-search kbd { display: none; } .tb-search input { padding-right: 12px; }
  .topstrip .avatar span, .tb-profile .chev { display: none; }
}
@media (max-width: 620px) { .tb-search { display: none; } .xp-pill { min-height: 40px; padding: 6px 12px; font-size: 14px; } }

/* ======================================================================== DASHBOARD v3 */
.c-accent { color: var(--a1); }
.dv-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin: 10px 0 26px; }
.dv-hello h1 { margin: 0; font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.dv-hello p { margin: 4px 0 0; font-size: 18px; color: var(--text-2); }
.dv-stats { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; }
.dv-stats li { display: flex; align-items: center; gap: 12px; padding: 4px 24px; }
.dv-stats li + li { border-left: 1px solid var(--line-strong); }
.dv-stats .ico { width: 36px; height: 36px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dv-stats .ico path[fill], .dv-stats .ico circle[fill] { fill: currentColor; }
.dv-stats small { display: block; font-size: 14px; color: var(--text-2); }
.dv-stats b { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; }
.dv-level .xpbar { width: 140px; margin: 6px 0 4px; }
@media (max-width: 1300px) { .dv-stats li { padding: 4px 16px; } .dv-level .xpbar { width: 110px; } }
@media (max-width: 760px) { .dv-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
  .dv-stats li { border: 1px solid var(--line) !important; border-radius: 14px; padding: 10px 12px; } .dv-stats .dv-level { grid-column: 1 / -1; }
  .dv-hello h1 { font-size: 28px; } .dv-hello p { font-size: 15px; } }

.dv-courses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
@media (max-width: 1250px) { .dv-courses { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .dv-courses { grid-template-columns: 1fr; } }
.k-python { --cc: #7c3aed; } .k-networks { --cc: #0ea5e9; } .k-cyber { --cc: #16a34a; } .k-databases { --cc: #f97316; }
.dv-course { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 26px 24px 22px; border-radius: 22px; min-height: 230px;
  border: 1px solid color-mix(in srgb, var(--cc) 22%, var(--line));
  background: radial-gradient(120% 90% at 100% 100%, color-mix(in srgb, var(--cc) 22%, transparent) 0, transparent 55%),
              linear-gradient(135deg, color-mix(in srgb, var(--cc) 9%, var(--surface)), color-mix(in srgb, var(--cc) 4%, var(--surface)));
  box-shadow: 0 8px 26px color-mix(in srgb, var(--cc) 10%, transparent); transition: transform .18s, box-shadow .18s; }
.dv-course:hover { transform: translateY(-3px); box-shadow: 0 14px 34px color-mix(in srgb, var(--cc) 20%, transparent); }
.dv-course.repair { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.dv-course-top { display: flex; gap: 18px; align-items: flex-start; }
.dv-course-ic .ico { width: 64px; height: 64px; color: var(--cc); fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dv-course h3 { margin: 0 0 6px; font-size: 22px; font-weight: 800; line-height: 1.15; color: var(--text); }
.dv-course p { margin: 0; font-size: 14.5px; color: var(--text-2); }
.dv-course-link { color: inherit; } .dv-course-link:hover { text-decoration: none; }
.dv-course-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.dv-course:focus-within { outline: 3px solid var(--cc); outline-offset: 2px; }
.dv-repair { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--bad); }
.dv-repair .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.dv-course-foot { margin-top: auto; display: flex; align-items: flex-end; gap: 16px; }
.dv-course-foot > div { flex: 1; min-width: 0; }
.dv-pct { display: block; font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1; margin-bottom: 14px; color: var(--text); }
.dv-bar { height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--cc) 14%, var(--surface-3)); overflow: hidden; }
.dv-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 80%, #fff), var(--cc)); }
.dv-go { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--cc);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--cc) 20%, transparent); }
.dv-go .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.dv-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 22px; margin-bottom: 22px; align-items: stretch; }
.dv-row2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1250px) { .dv-row { grid-template-columns: 1fr 1fr; } .dv-row > .dv-next { grid-column: 1 / -1; } .dv-row2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .dv-row { grid-template-columns: 1fr; } }
.dv-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; box-shadow: 0 6px 22px rgba(15, 23, 42, .06); min-width: 0; }
:root[data-theme="dark"] .dv-card { background: var(--card-bg); box-shadow: none; }
.dv-card-h { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.dv-card-h .ico { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dv-card-h h2 { margin: 0; font-size: 24px; font-weight: 800; }
.dv-card-h h2 .muted { font-size: 17px; font-weight: 500; margin-left: 4px; }
.dv-next-box { display: flex; gap: 22px; align-items: center; padding: 22px; border-radius: 18px;
  background: radial-gradient(90% 90% at 100% 100%, color-mix(in srgb, var(--a1) 18%, transparent), transparent 60%), color-mix(in srgb, var(--a1) 7%, var(--surface)); }
.dv-next-ic { width: 96px; height: 86px; flex: none; display: grid; place-items: center; border-radius: 18px; background: var(--grad); color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--a1) 30%, transparent); }
.dv-next-ic .ico { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.dv-next-box small { font-size: 15px; color: var(--text-2); }
.dv-next-box h3 { margin: 2px 0 6px; font-size: 26px; font-weight: 800; line-height: 1.15; }
.dv-next-box p { margin: 0 0 14px; font-size: 15px; color: var(--text-2); }
.dv-next-box .btn { font-size: 17px; padding: 12px 24px; }
.dv-next-box .btn .ico, .dv-card .btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dv-next-box .btn .ico path[fill] { fill: currentColor; stroke: none; }
@media (max-width: 520px) { .dv-next-box { flex-direction: column; align-items: flex-start; } }
.dv-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 14px; align-items: center; padding: 12px 2px; border-top: 1px solid var(--line); }
.dv-item-ic { width: 26px; height: 26px; color: var(--text-2); fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dv-item b { display: block; font-size: 16px; } .dv-item b a { color: var(--text); }
.dv-item small { color: var(--text-2); font-size: 14px; }
.dv-item .spill { font-size: 13.5px; padding: 5px 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 5px; }
.dv-item .spill .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; }
.dv-act { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 11px 2px; font-size: 15px; }
.dv-act + .dv-act { border-top: 1px solid var(--line); }
.dv-act .ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dv-act .ico path[fill], .dv-act .ico circle[fill] { fill: currentColor; }
.tone-good { color: var(--good); } .tone-accent { color: var(--a1); }
.dv-act time { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.dv-card .db-badge-grid { padding-top: 6px; }

/* badges button + popup (top bar) */
.badge-btn { min-height: 46px; padding: 8px 16px; border-radius: 14px; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  background: color-mix(in srgb, var(--gold) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); }
.badge-btn:hover { border-color: var(--gold); }
.badge-btn .ico { width: 20px; height: 20px; color: var(--gold); fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.badge-btn .ico path[fill] { fill: currentColor; }
.tb-pop.bp-pop { width: min(560px, calc(100vw - 32px)); padding: 10px 12px 14px; max-height: 70vh; overflow-y: auto; right: auto; left: 50%; transform: translateX(-50%); }
.bp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 10px; padding-top: 6px; }
.bp-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.bp-item .db-badge { width: 60px; max-width: 60px; }
.bp-item b { font-size: 13px; }
.bp-item small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.bp-item:not(.got) b { color: var(--text-2); }
@media (max-width: 620px) { .bp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .badge-btn span { display: none; } .tb-pop.bp-pop { position: fixed; top: 70px; } }

/* search dialog (opened from the sidebar or Ctrl+K) */
.search-dlg { width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 14px; border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: visible; }
.search-dlg::backdrop { background: rgba(5, 7, 15, .55); backdrop-filter: blur(3px); }
.search-dlg .tb-search { flex: none; width: 100%; }
.search-dlg .tb-search input { min-height: 54px; font-size: 17px; padding-right: 64px; }
.search-dlg .tb-search kbd { display: inline; }
.search-dlg .tb-results { position: static; margin-top: 10px; box-shadow: none; border: 0; padding: 0; max-height: 55vh; }
.search-dlg .tb-results a { padding: 11px 14px; }
@media (max-width: 960px) { .side .link#sg-search-open { order: -1; } }
@media (max-width: 620px) { .search-dlg .tb-search { display: flex; } .search-dlg { margin-top: 70px; } }
.search-dlg .tb-search { display: block; position: relative; }
.search-dlg .tb-search > .ico { top: 27px; transform: translateY(-50%); }
.search-dlg .tb-search kbd { position: absolute; right: 12px; top: 27px; transform: translateY(-50%); }
.search-dlg .tb-results { width: 100%; }

/* dashboard: one header row = greeting | XP + Badges | stats | bell + profile (no separate top bar) */
.topstrip.dash { position: static; border-bottom: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  padding-top: 22px; padding-bottom: 8px; flex-wrap: wrap; row-gap: 14px; }
.topstrip.dash > .menubtn { order: 0; } .topstrip.dash > .mobile-brand { order: 1; }
.topstrip.dash > .dv-hello { order: 2; }
.topstrip.dash > .spacer { order: 3; }
.topstrip.dash > .xp-pill { order: 4; }
.topstrip.dash > .tb-badges { order: 5; }
.topstrip.dash > .dv-stats { order: 6; margin: 0 4px; }
.topstrip.dash > .tb-bell { order: 7; }
.topstrip.dash > .tb-profile { order: 8; }
.topstrip.dash .dv-hello h1 { margin: 0; font-size: 34px; font-weight: 800; white-space: nowrap; }
.topstrip.dash .dv-stats li { padding: 4px 18px; }
@media (max-width: 1500px) { .topstrip.dash > .dv-stats { order: 9; flex-basis: 100%; justify-content: flex-end; } }
@media (max-width: 960px) { .topstrip.dash .dv-hello { display: none; } .topstrip.dash > .dv-stats { justify-content: flex-start; } }
/* dashboard header order: greeting | stats | bell | Badges | profile (badges and profile at the end of the row) */
.topstrip.dash > .dv-stats { order: 4; }
.topstrip.dash > .tb-bell { order: 5; }
.topstrip.dash > .tb-badges { order: 6; }
.topstrip.dash > .tb-profile { order: 7; }
@media (max-width: 1500px) { .topstrip.dash > .dv-stats { order: 9; } }

/* Stats button + popup; header order: greeting | Level | Stats | Badges | bell | profile */
.stat-btn { min-height: 46px; padding: 8px 16px; border-radius: 14px; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  background: color-mix(in srgb, var(--a1) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--a1) 30%, var(--line)); }
.stat-btn:hover { border-color: var(--a1); }
.stat-btn .ico { width: 20px; height: 20px; color: var(--a1); fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tb-pop.sp-pop { width: min(460px, calc(100vw - 32px)); padding: 10px 12px 14px; right: auto; left: 50%; transform: translateX(-50%); }
.sp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 6px; }
.sp-tile { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.sp-tile .ico { width: 32px; height: 32px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sp-tile .ico path[fill], .sp-tile .ico circle[fill] { fill: currentColor; }
.sp-tile small { display: block; font-size: 12.5px; color: var(--text-2); }
.sp-tile b { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; }
.sp-tile span { display: block; font-size: 11.5px; color: var(--muted); }
.sp-topics { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sp-topic { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.sp-topic .dv-bar { height: 8px; }
.sp-topic b { font-size: 12.5px; color: var(--text-2); }
.topstrip.dash > .tb-stats { order: 5; }
.topstrip.dash > .tb-badges { order: 6; }
.topstrip.dash > .tb-bell { order: 7; }
.topstrip.dash > .tb-profile { order: 8; }
.topstrip.dash > .dv-stats { order: 4; }
@media (max-width: 1500px) { .topstrip.dash > .dv-stats { order: 4; flex-basis: auto; } }
@media (max-width: 760px) { .topstrip.dash > .dv-stats { display: flex; width: auto; } .topstrip.dash .dv-stats .dv-level { grid-column: auto; } }
@media (max-width: 620px) { .stat-btn span { display: none; } .tb-pop.sp-pop { position: fixed; top: 70px; } }

/* ======================================================================== AUTO-HIDING SIDEBAR (all pages except the dashboard) */
.sg-crest { display: none; }
@media (min-width: 961px) {
  .side { transition: transform .3s cubic-bezier(.16, 1, .3, 1), box-shadow .3s; }
  .shell { transition: margin-left .3s cubic-bezier(.16, 1, .3, 1); }
  html.sg-min .side { transform: translateX(-105%); visibility: hidden; transition: transform .3s cubic-bezier(.16, 1, .3, 1), visibility 0s .3s; }
  html.sg-min .shell { margin-left: 0; }
  html.sg-min.sg-open .side { transform: none; visibility: visible; z-index: 1000; box-shadow: 0 16px 40px -10px rgba(5, 7, 15, .45);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
  html.sg-min .side .brand { visibility: hidden; }          /* the corner tile takes the logo's place */
  html.sg-min.sg-open::after { content: ""; position: fixed; inset: 0; z-index: 999; background: rgba(5, 7, 15, .25); }
  .sg-crest { position: fixed; top: 14px; left: 14px; z-index: 1001; width: 50px; height: 50px; padding: 0; place-items: center; cursor: pointer;
    border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 6px 16px -6px rgba(5, 7, 15, .35); }
  .sg-crest svg { width: 34px; height: 34px; }
  .sg-crest:hover { border-color: var(--a1); }
  .sg-crest:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }
  html.sg-min .sg-crest { display: grid; }
  html.sg-min.sg-open .sg-crest { top: 16px; left: 17px; }
  /* keep the page centred when the sidebar is hidden: same space on both sides of the top bar and the content */
  html.sg-min .topstrip, html.sg-min .shell > .wrap { padding-left: max(clamp(48px, 8vw, 160px), 84px); padding-right: max(clamp(48px, 8vw, 160px), 84px); }
  html.sg-instant .side, html.sg-instant .shell { transition: none !important; }
}
@media (prefers-reduced-motion: reduce) { .side, .shell { transition: none !important; } }
@media print { .sg-crest { display: none !important; } }

.toggle-pick { border: 0; padding: 0; margin: 14px 0 6px; background: none; }
.toggle-pick legend { font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 4px; padding: 0; }
.toggle-pick .check { margin: 4px 0; }
.toggle-pick p { margin: 2px 0 0 27px; }

/* Skill Checker bubble on the grid (after Learn) */
.sphere .checker circle.core { fill: color-mix(in srgb, var(--a1) 14%, var(--surface)); stroke: var(--a1); stroke-width: 4; }
.sphere .checker .ck-ic circle { stroke: var(--a-light); } .sphere .checker .ck-ic .dot { fill: var(--a-light); }
.sphere .checker.ck-open circle.core, .sphere .checker.ck-running circle.core { fill: url(#nextGrad); stroke: var(--a-light); }
.sphere .checker.ck-open .ck-ic circle, .sphere .checker.ck-running .ck-ic circle { stroke: #fff; } .sphere .checker.ck-open .ck-ic .dot, .sphere .checker.ck-running .ck-ic .dot { fill: #fff; }
.sphere .checker.ck-done circle.core { fill: url(#doneGrad); stroke: var(--a-light); }
.sphere .checker.ck-done .ck-ic circle { stroke: #fff; } .sphere .checker.ck-done .ck-ic .dot { fill: #fff; }
.sphere .checker.ck-closed circle.core { fill: color-mix(in srgb, var(--surface-3) 80%, var(--bg)); stroke: color-mix(in srgb, var(--muted) 45%, transparent); }
.sphere .checker.ck-closed .ck-ic circle { stroke: var(--text-2); } .sphere .checker.ck-closed .ck-ic .dot { fill: var(--text-2); }
.sphere .checker text.lbl { font: 750 13.5px var(--font); fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.sphere .checker text.sublbl { font: 600 11.5px var(--font); fill: var(--text-2); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.sphere .path.checkpath { stroke-dasharray: 2 10; stroke-width: 5; }
.sphere .path.checkpath.lit { stroke-dasharray: none; }
.k-check { border: 2px solid var(--a1); color: var(--a1); }

/* ======================================================================== COURSE PAGE (matches the dashboard) */
.cp-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  padding: 30px 32px; margin: 6px 0 22px; border-radius: 24px; border: 1px solid color-mix(in srgb, var(--cc) 25%, var(--line));
  background: radial-gradient(70% 120% at 100% 100%, color-mix(in srgb, var(--cc) 24%, transparent) 0, transparent 60%),
              linear-gradient(135deg, color-mix(in srgb, var(--cc) 11%, var(--surface)), color-mix(in srgb, var(--cc) 4%, var(--surface)));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--cc) 12%, transparent); }
.cp-hero-main { display: flex; align-items: center; gap: 26px; flex: 1 1 420px; min-width: 0; }
.cp-hero-ic .ico { width: 88px; height: 88px; color: var(--cc); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 6px 16px color-mix(in srgb, var(--cc) 35%, transparent)); }
.cp-hero-text { flex: 1; min-width: 0; }
.cp-hero h1 { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.cp-hero-text > p { margin: 4px 0 16px; font-size: 17px; color: var(--text-2); }
.cp-prog { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 18px; max-width: 520px; }
.cp-prog .dv-pct { margin: 0; font-size: 40px; grid-row: 1 / 3; }
.cp-prog small { color: var(--text-2); font-size: 14px; }
.cp-facts { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.cp-facts li { display: flex; gap: 12px; align-items: center; padding: 14px 18px; min-width: 170px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.cp-facts .ico { width: 32px; height: 32px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cp-facts .ico path[fill], .cp-facts .ico circle[fill] { fill: currentColor; }
.cp-facts small { display: block; font-size: 13px; color: var(--text-2); }
.cp-facts b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.cp-facts span { display: block; font-size: 12px; color: var(--muted); }
.cp-medals { display: flex !important; gap: 12px; }
.cp-medals span { display: inline-flex !important; align-items: center; gap: 5px; font-size: 20px; color: var(--text); }
.cp-medals .m { width: 15px; height: 15px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.cp-medals .m.gold { background: var(--gold); } .cp-medals .m.silver { background: var(--silver); } .cp-medals .m.bronze { background: var(--bronze); }
@media (max-width: 700px) { .cp-hero { padding: 22px 20px; } .cp-hero-ic .ico { width: 58px; height: 58px; } .cp-hero h1 { font-size: 28px; }
  .cp-facts li { flex: 1 1 140px; min-width: 0; } }

.cp-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 22px; align-items: stretch; }
@media (max-width: 900px) { .cp-row { grid-template-columns: 1fr; } }
.cp-num { font: 800 40px var(--font-display); }
.cp-links { display: grid; gap: 18px; }
.cp-link { position: relative; display: flex; align-items: center; gap: 18px; padding: 22px 22px; border-radius: 20px; color: var(--text); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--cc) 22%, var(--line));
  background: radial-gradient(90% 120% at 100% 100%, color-mix(in srgb, var(--cc) 16%, transparent), transparent 60%), var(--surface);
  transition: transform .18s, box-shadow .18s; }
.cp-link:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 12px 28px color-mix(in srgb, var(--cc) 18%, transparent); }
.cp-link-ic { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 16px; color: var(--cc);
  background: color-mix(in srgb, var(--cc) 14%, var(--surface)); }
.cp-link-ic .ico { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cp-link > span:nth-child(2) { flex: 1; min-width: 0; }
.cp-link b { display: block; font-size: 19px; font-weight: 800; }
.cp-link small { display: block; font-size: 14px; color: var(--text-2); }
.cp-link .dv-go { width: 46px; height: 46px; }
.cp-back { margin: 2px 0 14px; }
.cp-back .btn .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
a.cp-learn { display: block; color: var(--text); text-decoration: none; transition: transform .18s, box-shadow .18s; }
a.cp-learn:hover { transform: translateY(-3px); box-shadow: 0 12px 28px color-mix(in srgb, var(--cc) 16%, transparent); text-decoration: none; }
a.cp-learn .btn { pointer-events: none; }

/* skill grid header: progress icons beside the title; grid uses the full width unless a repair is needed */
.gp-title-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.gp-chips { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.gp-chips li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 15px; }
.gp-chips b { font-weight: 800; }
.gp-chips .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.gp-chips .ico path[fill], .gp-chips .ico circle[fill] { fill: currentColor; }
.mini-ring { width: 26px; height: 26px; }
.mini-ring .ring-bg { stroke-width: 5; } .mini-ring .ring-fg { stroke-width: 5; }
.gp-main.no-side { grid-template-columns: minmax(0, 1fr); }

/* skill grid: the dotted background hugs the grid instead of filling the page */
.gp-main .gridwrap { width: fit-content; max-width: 100%; margin: 0 auto; padding: 4px 6px; overflow-x: auto; }
.gp-main .gridwrap svg.sphere { margin: 0; }

/* skill grid: title + back button in the top bar; progress chips at the top of the grid panel */
.tb-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tb-title h1 { margin: 0; font-size: 26px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-back { display: inline-flex; align-items: center; gap: 6px; }
.tb-back .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tb-title-ic .ico { width: 36px; height: 36px; color: var(--tc); fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }
@media (max-width: 960px) { .tb-title h1 { font-size: 19px; } .tb-title-ic { display: none; } }
@media (max-width: 520px) { .tb-back { padding: 6px 10px; } .tb-title h1 { font-size: 16px; } }
.gp-chips-in { justify-content: center; padding: 14px 10px 2px; }
.gp-main { margin-top: 10px; }

/* ======================================================================== COURSE BOOK: contents list + preview, one page per bubble */
.tb-topic-pick { width: auto; min-height: 36px; padding: 6px 34px 6px 12px; font-size: 14px; border-radius: 10px; }
.cbl { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 22px; align-items: start; max-width: 1400px; margin: 6px auto 0; }
@media (max-width: 960px) { .cbl { grid-template-columns: 1fr; } .cbl-preview { display: none; } }
.cbl-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cbl-tools .cb-find { flex: 1 1 260px; margin: 0; }
.cbl-count { font-size: 14px; color: var(--text-2); font-weight: 600; }
.cbl .cb-band { margin-bottom: 14px; }
.cbl .cb-band-h { padding: 6px 4px; }
.cbl-row { display: flex !important; align-items: center; gap: 16px; padding: 14px 16px !important; margin-bottom: 10px; border-radius: 16px !important;
  border: 1px solid var(--line) !important; background: var(--card-bg) !important; color: var(--text) !important; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s; }
.cbl-row:hover { border-color: color-mix(in srgb, var(--a1) 45%, var(--line)) !important; transform: translateY(-1px); }
.cbl-row.picked { border-color: var(--a1) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--a1) 30%, transparent); background: color-mix(in srgb, var(--a1) 7%, var(--surface)) !important; }
.cbl-row:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }
.cbl-row .n { width: 40px !important; height: 40px !important; flex: none; border-radius: 12px !important; font-size: 15px !important; font-weight: 800;
  background: color-mix(in srgb, var(--tc, var(--a1)) 14%, var(--surface)) !important; color: var(--tc, var(--a1)) !important; border: 0 !important; display: grid !important; place-items: center; }
.cbl-row.is-completed .n { background: color-mix(in srgb, var(--good) 18%, var(--surface)) !important; color: var(--good) !important; }
.cbl-row.is-locked .n, .cbl-row.is-capped .n { background: var(--surface-3) !important; color: var(--muted) !important; }
.cbl-text { flex: 1; min-width: 0; }
.cbl-text b { display: block; font-size: 17px; font-weight: 750; }
.cbl-text small { display: block; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbl-st { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2); }
.cbl-st .ico { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.cbl-st.st-completed { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.cbl-st.st-available { background: color-mix(in srgb, var(--a1) 18%, transparent); color: var(--a1); }
.cbl-st.st-revoked { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
:root[data-theme="dark"] .cbl-st.st-available { color: var(--a-light); }
.cbl-open { flex: none; color: var(--a1) !important; background: color-mix(in srgb, var(--a1) 8%, transparent) !important; border-color: color-mix(in srgb, var(--a1) 25%, var(--line)) !important; }
:root[data-theme="dark"] .cbl-open { color: var(--a-light) !important; }
@media (max-width: 600px) { .cbl-st { display: none; } .cbl-text small { white-space: normal; } }
.cbl-preview { position: sticky; top: 90px; }
.cbl-card { padding: 28px 26px; border-radius: 22px; border: 1px solid var(--line); background:
  radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--tc, var(--a1)) 16%, transparent), transparent 70%), var(--card-bg); }
.cbl-card .cb-page-ic { width: 96px; height: 96px; margin: 0 auto 18px; }
.cbl-card .cb-page-ic .ico { width: 52px; height: 52px; }
.cbl-card h2 { font-size: 28px; font-weight: 800; margin: 4px 0 8px; }
.cbl-card p { color: var(--text-2); font-size: 15.5px; margin: 0 0 14px; }
.cbl-tags { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.cbl-tags li { font-size: 12.5px; font-weight: 650; padding: 4px 10px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.cbl-tags li:first-child { background: color-mix(in srgb, var(--a1) 16%, transparent); color: var(--a1); }
:root[data-theme="dark"] .cbl-tags li:first-child { color: var(--a-light); }
.cbl-card .btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* one page */
.cb-main-single { max-width: 1100px; margin: 6px auto 0; }
.cb-main-single .cb-page-head { align-items: flex-start; }
.cb-main-single .cb-page-head > div:nth-child(2) { flex: 1; min-width: 0; }
.cb-main-single .cb-tools { margin: 0; flex: none; }
.cb-main-single .cb-tools .btn .ico { width: 16px; height: 16px; }
@media (max-width: 700px) { .cb-main-single .cb-tools { display: none; } }
body.teach .cb-main-single { max-width: none; }
.cbl { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }   /* list only (no preview panel) */

/* ======================================================================== COURSE BOOK PAGE: spacing, pictures, activity */
.cb-main-single .cb-page { padding: 30px 34px; }
.cb-main-single .cb-page-head { margin-bottom: 26px; gap: 26px; }
.cb-main-single .cb-sec { padding: 24px 26px; margin-bottom: 22px; gap: 20px; }
.cb-main-single .cb-h { margin-bottom: 12px; }
.cb-main-single .cb-prose, .cb-main-single .cb-lead { max-width: none; font-size: 16px; line-height: 1.75; }
.cb-main-single .cb-prose p, .cb-main-single .cb-lead p { margin-bottom: 14px; }
.cb-main-single .cb-prose li, .cb-main-single .cb-mistakes li { margin-bottom: 10px; line-height: 1.7; }
.cb-main-single .cb-words { margin-top: 20px; gap: 14px; }
.cb-main-single .cb-tabs { position: static; margin-bottom: 22px; }
/* inline code never splits across two lines (it was cutting print("3 + 4") in half) */
.cb-page :not(pre) > code { white-space: nowrap; }
.cb-page .cb-prose, .cb-page .cb-sec-body { overflow-wrap: anywhere; }
@media (max-width: 700px) { .cb-main-single .cb-page { padding: 18px 16px; } .cb-main-single .cb-sec { padding: 16px; flex-direction: column; gap: 8px; } }
.cb-gate { margin: 8px 0 0; font-size: 13.5px; color: var(--text-2); }

/* pictures */
.cb-fig { margin: 22px 0 6px; padding: 18px 18px 12px; border-radius: 16px; background: color-mix(in srgb, var(--surface-3) 45%, transparent); border: 1px solid var(--line); }
.cb-fig svg { display: block; width: 100%; height: auto; max-width: 640px; margin: 0 auto; }
.cb-fig figcaption { text-align: center; font-size: 14px; color: var(--text-2); margin-top: 10px; }
.cb-fig .f-code { fill: var(--code-bg); stroke: var(--line-strong); stroke-width: 1.5; }
.cb-fig .f-screen { fill: #0b0f1a; stroke: var(--line-strong); stroke-width: 1.5; }
.cb-fig .f-mono { font: 600 22px var(--mono); fill: var(--text); }
.cb-fig .f-fn { fill: var(--a-light); } .cb-fig .f-br { fill: var(--text-2); } .cb-fig .f-str { fill: #4ade80; } .cb-fig .f-num { fill: var(--muted); font-size: 16px; }
:root[data-theme="light"] .cb-fig .f-str { fill: #15803d; } :root[data-theme="light"] .cb-fig .f-fn { fill: var(--a1); }
.cb-fig .f-out { font: 600 18px var(--mono); fill: #d6f5e0; }
.cb-fig .f-cursor { fill: #d6f5e0; opacity: .8; }
.cb-fig .f-dot1 { fill: #f87171; } .cb-fig .f-dot2 { fill: #fbbf24; } .cb-fig .f-dot3 { fill: #4ade80; }
.cb-fig .f-lbl { font: 650 14px var(--font); fill: var(--text-2); }
.cb-fig .f-line { stroke: var(--a1); stroke-width: 2; fill: none; } .cb-fig .f-dash { stroke-dasharray: 5 4; }
.cb-fig .f-arrow { stroke: var(--a1); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* rule cards in "How it works" */
.cb-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.cb-rule { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--surface-3) 45%, transparent); }
.cb-rule b { display: block; font-size: 15.5px; margin-bottom: 6px; }
.cb-rule p { margin: 0 !important; font-size: 15px; line-height: 1.7; }

/* the activity */
.cb-task { border-color: color-mix(in srgb, var(--a1) 45%, var(--line)) !important; background: color-mix(in srgb, var(--a1) 6%, var(--surface)) !important; }
.cb-task-state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; font-weight: 650; font-size: 14px;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); margin: 0 0 14px; }
.cb-task-state.done { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.cb-task-state .ico, .cb-task-done .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cb-task-box { margin-top: 18px; }
.cb-task-code { width: 100%; min-height: 220px !important; }
.cb-task-box .cb-run { margin: 12px 0; }
.cb-task-box .btn .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cb-task-box .btn .ico path[fill] { fill: currentColor; stroke: none; }
.cb-task-checks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.cb-task-checks li { position: relative; padding: 10px 12px 10px 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; }
.cb-task-checks li::before { content: ""; position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; border: 2px solid var(--line-strong); }
.cb-task-checks li.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.cb-task-checks li.ok::before { border-color: var(--good); background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.cb-task-checks li.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.cb-task-checks li.no::before { border-color: var(--bad); }
.cb-task-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--good) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }
.cb-task-done b { color: var(--text); }
.cb-task-done .btn { margin-left: auto; }
.cb-tab-n.req { background: color-mix(in srgb, var(--warn) 18%, transparent) !important; color: var(--warn) !important; }
.cb-tab-n.done { background: color-mix(in srgb, var(--good) 18%, transparent) !important; color: var(--good) !important; }
.cbl-text small { white-space: normal; }   /* list summaries wrap instead of being cut off */
.cb-task-done[hidden], .cb-out[hidden], .cb-task-state[hidden] { display: none !important; }

/* course book page: title and summary on one line; the green tick when the activity and check are both done */
.cb-titlerow { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin: 2px 0 14px; }
.cb-titlerow h2 { margin: 0 !important; }
.cb-titlerow .cb-summary { margin: 0; font-size: 16px; color: var(--text-2); }
.cb-done-tick { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--good); color: #fff; align-self: center;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }
.cb-done-tick .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.cb-done-tick.small { width: 20px; height: 20px; vertical-align: -3px; margin-left: 6px; box-shadow: none; }
.cb-done-tick.small .ico { width: 12px; height: 12px; }
.cb-done-tick[hidden] { display: none !important; }

/* check questions with typed answers */
.cb-quiz .cb-checks { padding-left: 24px; }
.cb-quiz .cb-checks li { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.cb-quiz .cb-checks li.ok { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.cb-quiz .cb-checks li.no { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.cb-quiz .q { margin-bottom: 10px; font-size: 15.5px; }
.cb-quiz input.answer { max-width: 420px; font-family: var(--mono); }
.cb-q-fb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 14.5px; color: var(--good); font-weight: 650; }
.cb-q-fb span { font-weight: 400; color: var(--text-2); }
.cb-q-fb.no { color: var(--bad); }
.cb-q-fb .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cb-q-fb[hidden] { display: none !important; }
.cb-quiz-foot { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.cb-quiz-foot .btn .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cb-quiz-score { font-weight: 700; color: var(--text-2); }

/* course book page: title + summary in the top bar; a slim toolbar above the tabs */
.tb-title .tb-sub { margin: 0; font-size: 15px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-title .cb-done-tick { width: 26px; height: 26px; flex: none; }
.topstrip > .tb-title { flex: 1 1 auto; }
@media (max-width: 1100px) { .tb-title .tb-sub { display: none; } }
.cb-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cb-toolbar .spacer { flex: 1; }
.cb-toolbar .btn .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cb-toolbar .btn .ico path[fill] { fill: currentColor; stroke: none; }
body.teach .cb-toolbar { position: fixed; top: 10px; right: 16px; z-index: 30; margin: 0; }
body.teach .cb-toolbar .btn.grad { display: none; }

/* Skill grid tab: locked until the activity and check are right, then shows the bubble's status */
.cb-tab .cb-lock .ico { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.cb-tab .cb-lock[hidden] { display: none; }
.cb-tab[data-locked] { opacity: .55; cursor: not-allowed; }
.cb-tab.unlocked { animation: cb-pop .5s ease; color: var(--good) !important; }
@keyframes cb-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.cb-tab.shake { animation: cb-shake .35s ease; }
@keyframes cb-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .cb-tab.unlocked, .cb-tab.shake { animation: none; } }
.cb-status-row { display: flex; align-items: stretch; gap: 16px; flex-wrap: wrap; margin: 6px 0 16px; }
.cb-status-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 150px; padding: 16px 18px;
  border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; }
.cb-status-badge .ico { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cb-status-badge .ico path[fill], .cb-status-badge .ico circle[fill] { fill: currentColor; }
.st-completed .cb-status-badge { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background: color-mix(in srgb, var(--good) 9%, var(--surface)); }
.st-revoked .cb-status-badge { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 9%, var(--surface)); }
.st-available .cb-status-badge { color: var(--a1); border-color: color-mix(in srgb, var(--a1) 45%, var(--line)); background: color-mix(in srgb, var(--a1) 9%, var(--surface)); }
:root[data-theme="dark"] .st-available .cb-status-badge { color: var(--a-light); }
.cb-status-badge b { color: var(--text); }
.cb-mastery { flex: 1 1 280px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.cb-mastery-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cb-mastery-top span:first-child { color: var(--text-2); font-weight: 650; }
.cb-mastery-top b { font-size: 20px; }
.cb-medal { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; padding: 4px 12px; border-radius: 99px; background: var(--surface-3); }
.cb-medal i { width: 14px; height: 14px; border-radius: 50%; }
.cb-medal.gold i { background: var(--gold); } .cb-medal.silver i { background: var(--silver); } .cb-medal.bronze i { background: var(--bronze); }
.cb-medal.none { color: var(--muted); font-weight: 600; }
.cb-mbar { --cc: var(--gold); height: 10px; }
.cb-mastery small { display: block; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.cb-strikes { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 14px 16px; border-radius: 16px; color: var(--bad); font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.cb-strikes .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.cb-strikes small { color: var(--text-2); font-weight: 500; }
.cb-status-msg { font-size: 15.5px; color: var(--text-2); margin: 0 0 16px; }
.cb-status-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.cb-status-btns form { margin: 0; }
.cb-status-btns .btn .ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cb-status-btns .btn .ico path[fill] { fill: currentColor; stroke: none; }

/* Full screen (and Print / Practise) sit at the right-hand end of the tab bar */
.cb-tabbar { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-radius: 10px 10px 0 0; margin: 0 0 22px; padding-right: 8px; }
.cb-tabbar .cb-tabs { flex: 1; min-width: 0; margin: 0 !important; border-bottom: 0; background: none; }
.cb-tabbar .cb-toolbar { flex: none; margin: 0; gap: 8px; }
.cb-toolbar.alone { justify-content: flex-end; }
@media (max-width: 700px) { .cb-tabbar { flex-wrap: wrap; } .cb-tabbar .cb-toolbar { width: 100%; justify-content: flex-end; padding-bottom: 8px; } }
body.teach .cb-tabbar .cb-toolbar { position: fixed; top: 10px; right: 16px; z-index: 30; }

/* more picture building blocks (course book figures) */
.cb-fig .f-box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.cb-fig .f-boxa { fill: color-mix(in srgb, var(--a1) 14%, var(--surface)); stroke: var(--a1); stroke-width: 2; }
.cb-fig .f-good { fill: color-mix(in srgb, var(--good) 16%, var(--surface)); stroke: var(--good); stroke-width: 2; }
.cb-fig .f-bad { fill: color-mix(in srgb, var(--bad) 16%, var(--surface)); stroke: var(--bad); stroke-width: 2; }
.cb-fig .f-warn { fill: color-mix(in srgb, var(--warn) 16%, var(--surface)); stroke: var(--warn); stroke-width: 2; }
.cb-fig .f-txt { font: 600 15px var(--font); fill: var(--text); }
.cb-fig .f-title { font: 800 16px var(--font); fill: var(--text); }
.cb-fig .f-small { font: 600 12.5px var(--font); fill: var(--text-2); }
.cb-fig .f-acc { fill: var(--a1); } .cb-fig .f-acctxt { fill: var(--a1); font: 700 15px var(--font); }
:root[data-theme="dark"] .cb-fig .f-acctxt { fill: var(--a-light); }
.cb-fig .f-goodtxt { fill: var(--good); font: 700 15px var(--font); } .cb-fig .f-badtxt { fill: var(--bad); font: 700 15px var(--font); }
.cb-fig .f-wire { stroke: var(--text-2); stroke-width: 2; fill: none; }

/* "See it in 3D" button on a course book page */
.cb-lab-btn { display: flex; align-items: center; gap: 16px; margin: 18px 0 4px; padding: 16px 20px; border-radius: 16px; text-decoration: none; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--a1) 45%, var(--line)); background: linear-gradient(110deg, color-mix(in srgb, var(--a1) 18%, var(--surface)), var(--surface)); }
.cb-lab-btn:hover { text-decoration: none; border-color: var(--a1); transform: translateY(-1px); }
.cb-lab-ic { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--grad); color: #fff; }
.cb-lab-btn .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cb-lab-btn > span:nth-child(2) { flex: 1; }
.cb-lab-btn b { display: block; font-size: 17px; } .cb-lab-btn small { color: var(--text-2); font-size: 14px; }
.cb-lab-btn > .ico { color: var(--a1); }

/* ======================================================================== 3D LAB PAGE */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; height: calc(100vh - 110px); min-height: 520px; margin-top: 6px; }
@media (max-width: 1000px) { .lab { grid-template-columns: 1fr; height: auto; } .lab-stage { height: 62vh; min-height: 380px; } }
.lab-stage { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.lab-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.lab-stage canvas:active { cursor: grabbing; }
.lab-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lab-label { position: absolute; left: 0; top: 0; white-space: nowrap; font: 700 12.5px var(--font); color: #fff; padding: 4px 10px; border-radius: 99px;
  background: rgba(20, 18, 51, .78); border: 1px solid rgba(255,255,255,.18); transition: opacity .25s; }
.lab-label.g-wired { border-color: #38bdf8; } .lab-label.g-wireless { border-color: #a78bfa; } .lab-label.g-mobile { border-color: #fbbf24; }
.lab-label.dim { opacity: .25; }
.lab-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 13px; font-weight: 650; color: #fff; background: rgba(20, 18, 51, .7);
  padding: 6px 14px; border-radius: 99px; pointer-events: none; transition: opacity .4s; }
.lab-hint.gone { opacity: 0; }
.lab-fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 30px; color: var(--text-2); }
.lab-fallback[hidden] { display: none; }
.lab-panel { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.lab-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--line); }
.lab-mode { border: 0; background: none; color: var(--text-2); font: 650 14px var(--font); padding: 9px 4px; border-radius: 10px; cursor: pointer; }
.lab-mode:hover { color: var(--text); background: var(--row-hover); }
.lab-mode.on { background: var(--grad); color: #fff; }
.lab-info, .lab-try { padding: 18px 20px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--line); }
.lab-info h2 { margin: 0 0 8px; font-size: 20px; } .lab-info p { color: var(--text-2); font-size: 14.5px; line-height: 1.6; margin: 0 0 12px; }
.lab-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lab-facts li { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.lab-facts > li > b { display: block; font-size: 13px; color: var(--a1); margin-bottom: 2px; }
:root[data-theme="dark"] .lab-facts > li > b { color: var(--a-light); }
.lab-try h3 { margin: 0 0 10px; font-size: 16px; color: var(--text); }
.lab-row { display: flex; justify-content: space-between; margin: 0 0 6px; }
.lab-try input[type=range] { width: 100%; accent-color: var(--a1); }
.lab-check { margin: 10px 0 0; font-size: 14px; }
.lab-meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.lab-meters > div { padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.lab-meters small { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 4px; }
.lab-meters b { font-size: 20px; }
.lab-bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.lab-bars i { width: 7px; border-radius: 2px; background: var(--surface-3); }
.lab-bars i:nth-child(1) { height: 25%; } .lab-bars i:nth-child(2) { height: 50%; } .lab-bars i:nth-child(3) { height: 75%; } .lab-bars i:nth-child(4) { height: 100%; }
.lab-bars i.on { background: var(--good); }
.lab-note { font-size: 13.5px; color: var(--text-2); min-height: 40px; margin: 0 0 12px; }
.lab-btns { display: flex; gap: 8px; }
.lab-btns .btn .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.lab-btns .btn .ico path[fill] { fill: currentColor; stroke: none; }
.wrap.lab-main { padding-bottom: 20px; }

/* 3D lab: speed tests */
.lab-meters { grid-template-columns: repeat(2, 1fr); }
.lab-speed { padding: 18px 20px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--line); }
.lab-speed h3 { margin: 0 0 4px; font-size: 16px; }
.lab-speed > p { margin: 0 0 12px; }
.lab-tests { display: grid; gap: 10px; margin-bottom: 12px; }
.lab-test { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--kc, var(--a1)); }
.lab-test.k-wired { --kc: #38bdf8; } .lab-test.k-laptop, .lab-test.k-phone { --kc: #a78bfa; } .lab-test.k-mobile { --kc: #fbbf24; }
.lab-test-top { display: flex; align-items: center; gap: 8px; }
.lab-test-top b { font-size: 14.5px; } .lab-test-top small { color: var(--muted); font-size: 12.5px; }
.lab-test-top .btn { margin-left: auto; min-height: 30px; padding: 4px 10px; }
.lab-test-top .btn .ico, .lab-speed > .btn .ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.lab-test-top .btn .ico path[fill], .lab-speed > .btn .ico path[fill] { fill: currentColor; stroke: none; }
.lab-gauge { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 8px; }
.lab-gauge i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--kc, var(--a1)), color-mix(in srgb, var(--kc, var(--a1)) 60%, #fff)); transition: width .1s linear; }
.lab-test-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.lab-test-out small { display: block; font-size: 11px; color: var(--muted); }
.lab-test-out b { font-size: 15px; font-variant-numeric: tabular-nums; }
.lab-test-note { margin: 8px 0 0; font-size: 12.5px; color: var(--text-2); min-height: 0; }
.lab-test-note:empty { display: none; }
.lab-test.slow .lab-test-out b:first-of-type, .lab-test.slow [data-down] { color: var(--warn); }
.lab-test.fail [data-down] { color: var(--bad); }
.lab-speed > .btn { width: 100%; justify-content: center; }

/* ---- 3D labs: shared bits used by every lab panel ---- */
.lab-other { margin-left: 6px; }
.lab-label.pkt { font-size: 11px; padding: 2px 8px; border-color: var(--a1); }
.lab-label.big { font-size: 14px; padding: 6px 12px; }
.lab-label.good { border-color: #22c55e; } .lab-label.bad { border-color: #ef4444; } .lab-label.warn { border-color: #f59e0b; }
.lab-label.c-blue { border-color: #38bdf8; } .lab-label.c-violet { border-color: #a78bfa; } .lab-label.c-pink { border-color: #f472b6; } .lab-label.c-amber { border-color: #fbbf24; }
.lab-card { padding: 18px 20px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--line); }
.lab-card h3 { margin: 0 0 10px; font-size: 16px; color: var(--text); }
.lab-card > p { font-size: 14px; color: var(--text-2); margin: 0 0 10px; line-height: 1.55; }
.lab-print { margin: 0; padding: 12px 14px; border-radius: 12px; background: #0f0d26; color: #d6d3ff; border: 1px solid var(--line);
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.lab-print .k { color: #93c5fd; } .lab-print .v { color: #fde68a; } .lab-print .g { color: #86efac; } .lab-print .b { color: #fca5a5; } .lab-print .m { color: #a5a3c8; }
.lab-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.lab-palette button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 650 13px var(--font); cursor: pointer; }
.lab-palette button:hover { border-color: var(--a1); }
.lab-palette button.on { background: var(--grad); color: #fff; border-color: transparent; }
.lab-palette svg { width: 34px; height: 26px; }
.lab-steps { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lab-stepinfo { font-size: 14px; color: var(--text-2); margin: 10px 0 0; min-height: 42px; line-height: 1.5; }
.lab-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lab-table th, .lab-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.lab-table th { color: var(--text-2); font-weight: 650; background: var(--th-bg); }
.lab-table tr.on td { background: color-mix(in srgb, var(--a1) 18%, transparent); }
.lab-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--text-2); }
.lab-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lab-panel select, .lab-panel input[type=text], .lab-panel input[type=number] { width: 100%; }
.lab-panel .lab-meters b.good { color: var(--good); } .lab-panel .lab-meters b.bad { color: var(--bad); }

.lab-print .k, .lab-print .v, .lab-print .g, .lab-print .b, .lab-print .m { width: auto; height: auto; display: inline; border-radius: 0; font-weight: inherit; flex: initial; place-items: initial; }
.lab-scroll { overflow-x: auto; max-width: 100%; }
.lab-panel .lab-table th, .lab-panel .lab-table td { padding: 5px 6px; }
.cb-lab-intro { color: var(--text-2); margin: 0 0 6px; }
.cb-lab-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.cb-lab-btn.small { margin: 0; padding: 12px 14px; gap: 12px; }
.cb-lab-btn.small b { font-size: 15px; } .cb-lab-btn.small small { font-size: 13px; }
.cb-lab-btn.small .cb-lab-ic { width: 36px; height: 36px; }

/* ---- lab side panel: collapsible sections, one open at a time ---- */
.lab-panel > .lab-modes { order: -2; }
.lab-panel > .lab-how { order: -1; margin: -4px 4px 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.lab-panel > .lab-how b { color: var(--text); }
.lab-acc { padding: 0 !important; }
.lab-acc > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; border-radius: 18px; }
.lab-acc > summary::-webkit-details-marker { display: none; }
.lab-acc > summary:hover { background: var(--row-hover); }
.lab-acc > summary:focus-visible { outline: 2px solid var(--a1); outline-offset: -2px; }
.lab-acc > summary h2, .lab-acc > summary h3 { margin: 0 !important; font-size: 16px !important; flex: 1; min-width: 0; color: var(--text); }
.lab-acc[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.lab-chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.lab-acc[open] > summary .lab-chev { transform: rotate(90deg); stroke: var(--a1); }
.lab-acc-body { padding: 2px 18px 18px; min-width: 0; }
.lab-acc-body > p { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.lab-acc-body > p:first-child { margin-top: 0; }
.lab-acc-body > p#lab-info-text { font-size: 14.5px; line-height: 1.6; margin: 0 0 12px; }
.lab-panel select, .lab-panel input[type=text], .lab-panel input[type=number] { max-width: 100%; box-sizing: border-box; }
.lab-panel .lab-print { max-width: 100%; box-sizing: border-box; }
.lab-panel { overflow-x: hidden; }

/* ---- Lab tab: one shiny lab card ---- */
.cb-lab-card { display: flex; align-items: center; gap: 22px; padding: 22px 24px; border-radius: 20px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--a1) 14%, var(--card-bg)), var(--card-bg) 60%); border: 1px solid color-mix(in srgb, var(--a1) 35%, var(--line));
  box-shadow: 0 10px 30px -18px var(--a1); transition: transform .15s, box-shadow .15s, border-color .15s; }
.cb-lab-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--a1); box-shadow: 0 16px 36px -16px var(--a1); }
.cb-lab-tile { position: relative; flex: none; width: 92px; height: 92px; border-radius: 24px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.45), transparent 45%), linear-gradient(145deg, var(--a1), var(--a2, #4f46e5) 70%, #1e1b4b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -8px 18px rgba(0,0,0,.25), 0 10px 22px -8px var(--a1); }
.cb-lab-tile::before { content: ""; position: absolute; inset: 0 0 52% 0; border-radius: 24px 24px 50% 50% / 24px 24px 14px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0)); pointer-events: none; }
.cb-flask { width: 72px; height: 72px; position: relative; z-index: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.cb-shine { position: absolute; top: -40%; left: -60%; width: 40%; height: 180%; transform: rotate(25deg); pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0)); animation: cbShine 3.6s ease-in-out infinite; }
@keyframes cbShine { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
.cb-bub { animation: cbBub 2.4s ease-in infinite; } .cb-bub.b2 { animation-delay: .8s; } .cb-bub.b3 { animation-delay: 1.5s; }
@keyframes cbBub { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-9px); opacity: 0; } }
.cb-lab-card:hover .cb-shine { animation-duration: 1.4s; }
@media (prefers-reduced-motion: reduce) { .cb-shine, .cb-bub { animation: none; } .cb-shine { display: none; } }
.cb-lab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cb-lab-text small { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--a1); }
:root[data-theme="dark"] .cb-lab-text small { color: var(--a-light); }
.cb-lab-text b { font-size: 21px; } .cb-lab-text > span { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.cb-lab-go { flex: none; } .cb-lab-go .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; }
@media (max-width: 640px) { .cb-lab-card { flex-wrap: wrap; } .cb-lab-go { width: 100%; justify-content: center; } }
.cb-tab-flask .ico { width: 15px; height: 15px; margin: 0 5px -2px 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- light mode: a little more contrast between the page, cards, lines and muted text ---- */
:root[data-theme="light"] {
  --bg: #e8ebf1; --surface: #ffffff; --surface-2: #eef1f6; --surface-3: #dde2eb;
  --line: #d2d8e2; --line-strong: #b4bdcc; --text: #0b1220; --text-2: #243045; --muted: #4f5b70;
  --input-line: #b4bdcc; --th-bg: #e6eaf1; --row-hover: #edf0f6; --card-bg: #ffffff; --code-bg: #f1f3f8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08), 0 2px 8px rgba(15, 23, 42, .06);
}
:root[data-theme="light"] .card, :root[data-theme="light"] .qcard, :root[data-theme="light"] .cb-sec,
:root[data-theme="light"] .lab-card, :root[data-theme="light"] .lab-info, :root[data-theme="light"] .lab-try, :root[data-theme="light"] .lab-speed,
:root[data-theme="light"] .lab-acc, :root[data-theme="light"] .bl-acc { box-shadow: var(--shadow-sm); border-color: var(--line); }
:root[data-theme="light"] .lab-stage { background: #dfe3ea; border-color: var(--line-strong); }
:root[data-theme="light"] .lab-meters > div, :root[data-theme="light"] .lab-facts li, :root[data-theme="light"] .lab-test,
:root[data-theme="light"] .lab-palette button { background: var(--surface-2); border-color: var(--line); }
:root[data-theme="light"] .lab-palette button:hover { border-color: var(--a1); }
:root[data-theme="light"] .lab-palette button.on { background: var(--grad); }
:root[data-theme="light"] .lab-modes { background: var(--surface-3); }
:root[data-theme="light"] .lab-bars i { background: #c4cad5; }
:root[data-theme="light"] .lab-acc > summary:hover, :root[data-theme="light"] .bl-acc > summary:hover { background: var(--surface-2); }
:root[data-theme="light"] .lab-bars i.on { background: var(--good); }

/* ---- labs: wide layout, panel floating over the 3D view, full screen (trial on TCP vs UDP) ---- */
.shell > .wrap.lab-max { max-width: none; padding: 2px 14px 12px; }
.lab-max .lab { height: calc(100vh - 74px); min-height: 480px; margin-top: 0; }
.lab.lab-overlay { display: block; position: relative; border-radius: 20px; overflow: hidden; }
.lab-overlay > .lab-stage { position: absolute; inset: 0; border-radius: 20px; }
.lab-overlay > .lab-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 340px; z-index: 4; gap: 8px; padding: 10px;
  border-radius: 18px; background: color-mix(in srgb, var(--bg) 62%, transparent); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: transform .25s ease, opacity .25s ease; }
.lab-overlay .lab-panel .lab-acc, .lab-overlay .lab-panel .lab-card, .lab-overlay .lab-panel .lab-try, .lab-overlay .lab-panel .lab-info {
  background: color-mix(in srgb, var(--surface) 78%, transparent); }
.lab-overlay.panel-hidden > .lab-panel { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.lab-overlay.is-fs, .lab-overlay.fs-fake { border-radius: 0; height: 100vh; width: 100vw; }
.lab-overlay.fs-fake { position: fixed; inset: 0; z-index: 1000; }
.lab-overlay.is-fs > .lab-stage, .lab-overlay.fs-fake > .lab-stage { border-radius: 0; border: 0; }
.lab-tools { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; gap: 6px; }
.lab-tool { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(20, 18, 51, .72); color: #fff; font: 650 13px var(--font); cursor: pointer; backdrop-filter: blur(4px); }
.lab-tool:hover { background: rgba(20, 18, 51, .9); border-color: rgba(255,255,255,.5); }
.lab-tool:focus-visible { outline: 2px solid var(--a-light); outline-offset: 2px; }
.lab-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#lab-fs .fs-off, .is-fs #lab-fs .fs-on, .fs-fake #lab-fs .fs-on { display: none; }
.is-fs #lab-fs .fs-off, .fs-fake #lab-fs .fs-off { display: block; }
.lab-overlay .lab-hint { left: calc(50% - 176px); }
.lab-overlay.panel-hidden .lab-hint { left: 50%; }
@media (max-width: 1000px) {
  .lab-max .lab.lab-overlay { height: auto; display: grid; grid-template-columns: 1fr; overflow: visible; }
  .lab-overlay > .lab-stage { position: relative; height: 62vh; min-height: 380px; }
  .lab-overlay > .lab-panel { position: static; width: auto; background: none; border: 0; box-shadow: none; padding: 0; backdrop-filter: none; }
  #lab-panel-btn { display: none; }
}

/* ---- formatting fixes (overflow sweep) ---- */
.dv-course-top > div { min-width: 0; }
.dv-course h3 { font-size: clamp(15px, 1.12vw, 21px); overflow-wrap: break-word; }
@media (max-width: 1600px) { .dv-course-top { gap: 12px; } .dv-course-ic .ico { width: 40px; height: 40px; } }
.tb-pop.bp-pop, .tb-pop.sp-pop { left: auto; right: 0; transform: none; }
.cb-prose th { white-space: nowrap; }
.cb-prose pre { max-width: 100%; overflow-x: auto; }
.cb-prose code { overflow-wrap: anywhere; }
.tb-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tb-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 700px) {
  .cb-sec { padding: 16px 14px; gap: 10px; }
  .cb-sec-ic { display: none; }
  .cb-prose table, .cb-sec table { display: block; max-width: 100%; overflow-x: auto; }
  .cb-task-box, .cb-sec-body > * { max-width: 100%; }
  .cp-hero { padding: 20px 18px; gap: 16px; }
  .cp-hero-main { gap: 14px; flex-basis: 100%; }
  .cp-hero-ic .ico { width: 56px; height: 56px; }
  .cp-hero h1 { font-size: 24px; overflow-wrap: anywhere; }
  .cp-facts { width: 100%; }
  .cp-facts li { min-width: 0; flex: 1 1 140px; padding: 10px 12px; }
  .tb-topic-pick { max-width: 42vw; }
  .tb-title { min-width: 0; }
}
.cb-panel, .cb-panel > *, .cb-main, .cb-page { min-width: 0; }
.cb-task-checks { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
@media (max-width: 620px) { .tb-pop.bp-pop, .tb-pop.sp-pop { left: 50%; right: auto; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); } }
@media (max-width: 700px) { .cp-facts { flex-direction: column; } .cp-facts li { flex: none; width: 100%; box-sizing: border-box; } }
@media (max-width: 860px) { .cb-layout { grid-template-columns: minmax(0, 1fr); } }
.cb-prose :not(pre) > code, .cb-sec-body :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
.cb-sec-body pre { max-width: 100%; overflow-x: auto; }
@media (max-width: 700px) { .cb-page { padding: 16px 14px; } }
@media (max-width: 700px) { .cb-sec { display: block; } .cb-sec-body { width: 100%; } }
@media (max-width: 700px) { table.ref, .card > table { display: block; max-width: 100%; overflow-x: auto; } }

/* Revision and Assessment: keep the category tabs on one line (scroll sideways on narrow screens),
   topic buttons two to a row, and the course book links side by side. Lab pages fit the screen exactly. */
.cattabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
.cattabs .tab { white-space: nowrap; flex: none; }
.rev-topics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rev-topics form, .rev-topics .btn { width: 100%; }
.rev-topics .btn { justify-content: center; }
.rev-links { flex-wrap: nowrap; }
.lab-max .lab { height: calc(100vh - 93px); }

/* Dashboard: each course is a full-width row with its own stats */
.dv-courses.dv-rows { grid-template-columns: 1fr; gap: 14px; }
.dv-rows .dv-course { display: grid; grid-template-columns: minmax(230px, 1.1fr) minmax(0, 3fr) minmax(170px, .9fr); align-items: center;
  gap: 24px; min-height: 0; padding: 20px 24px; }
.dv-rows .dv-course:hover { transform: translateY(-2px); }
.dv-rows .dv-course-top { align-items: center; gap: 16px; }
.dv-rows .dv-course-ic .ico { width: 48px; height: 48px; }
.dv-rows .dv-course h3 { font-size: 20px; margin-bottom: 2px; }
.dv-rows .dv-repair { margin-top: 6px; }
.dv-cstats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 10px; }
.dv-cstats li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--cc) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cc) 16%, var(--line)); }
.dv-cstats li > div { min-width: 0; }
.dv-cstats .ico { flex: none; width: 22px; height: 22px; color: var(--cc); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dv-cstats small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dv-cstats b { display: block; font-size: 17px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-cstats b span { font-size: 13px; font-weight: 600; color: var(--muted); }
.dv-cstats li.wide b { font-size: 15px; }
.dv-medals { display: flex !important; align-items: center; gap: 4px; font-size: 15px !important; }
.dv-medals .m { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-left: 4px; }
.dv-medals .m:first-child { margin-left: 0; }
.dv-medals .m.gold { background: var(--gold); } .dv-medals .m.silver { background: var(--silver); } .dv-medals .m.bronze { background: var(--bronze); }
.dv-rows .dv-course-foot { margin-top: 0; align-items: center; }
.dv-rows .dv-pct { font-size: 28px; margin-bottom: 10px; }
.dv-rows .dv-go { width: 46px; height: 46px; }
@media (max-width: 1450px) { .dv-cstats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .dv-cstats li.wide { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .dv-rows .dv-course { grid-template-columns: 1fr; gap: 16px; } }
@media (max-width: 640px) { .dv-cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dv-medals .m { flex: none; }
.dv-cstats li.wide { position: relative; z-index: 2; padding: 0; }
.dv-cstats li.wide > .ico, .dv-cstats li.wide > div { margin: 10px 0 10px 12px; }
.dv-next-link { display: flex; align-items: center; gap: 10px; width: 100%; height: 100%; padding: 10px 12px; border-radius: 14px; color: inherit; min-width: 0; }
.dv-next-link > div { min-width: 0; }
.dv-next-link:hover { text-decoration: none; background: color-mix(in srgb, var(--cc) 14%, transparent); }
.dv-cstats li.fix { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.dv-cstats li.fix .ico, .dv-cstats li.fix small { color: var(--bad); }
.dv-cstats b.dv-medals { overflow: visible; gap: 3px; font-size: 14.5px !important; }
.dv-medals .m { width: 9px; height: 9px; margin-left: 3px; }
@media (min-width: 1451px) { .dv-cstats { grid-template-columns: minmax(0, 2.3fr) repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1451px) { .dv-cstats { grid-template-columns: minmax(0, 2.3fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr); } }
/* Dashboard rows without the Next bubble tile: four stat tiles */
.dv-cstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1451px) { .dv-cstats { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr); } }
.dv-rows .dv-course { grid-template-columns: minmax(230px, 1.1fr) minmax(0, 2.4fr) minmax(170px, .9fr); }
@media (max-width: 1100px) { .dv-rows .dv-course { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .dv-cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1101px) and (max-width: 1450px) {
  .dv-rows .dv-course { grid-template-columns: minmax(190px, 1fr) minmax(0, 2.9fr) minmax(140px, .75fr); gap: 18px; }
  .dv-cstats { gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.25fr); }
  .dv-cstats li { padding: 9px 10px; gap: 8px; }
  .dv-cstats .ico { width: 18px; height: 18px; }
  .dv-cstats small { font-size: 10.5px; letter-spacing: .02em; }
  .dv-cstats b { font-size: 16px; }
}
@media (min-width: 1251px) and (max-width: 1450px) {
  .dv-rows .dv-course { grid-template-columns: minmax(225px, 1.05fr) minmax(0, 2.7fr) minmax(130px, .6fr); }
  .dv-rows .dv-course h3 { font-size: 19px; }
}
@media (max-width: 1250px) {
  .dv-rows .dv-course { grid-template-columns: 1fr; gap: 16px; }
  .dv-cstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) { .dv-cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .dv-cstats li { padding: 9px 9px; gap: 7px; } .dv-cstats .ico { width: 17px; height: 17px; } .dv-cstats b.dv-medals { font-size: 13px !important; gap: 2px; } .dv-medals .m { margin-left: 2px; } }
/* Narrow screens: the page title (with its Back button) gets its own line under the top-bar buttons,
   instead of being squeezed down to a letter or two. */
@media (max-width: 1200px) {
  .topstrip:has(> .tb-title) { flex-wrap: wrap; row-gap: 10px; }
  .topstrip > .tb-title { order: 20; flex: 1 1 100%; min-width: 0; }
  .topstrip > .tb-title h1 { font-size: 20px; }
}

/* Course page as rows (Programming first): Learn, Skill grid, Revision */
.cp-rows { display: grid; gap: 16px; }
.cp-row-link { padding: 24px 26px; gap: 22px; }
.cp-row-link .cp-link-ic { width: 64px; height: 64px; }
.cp-row-link .cp-link-ic .ico { width: 32px; height: 32px; }
.cp-row-link b { font-size: 21px; }
.cp-row-link small { font-size: 15px; margin-top: 2px; }
.cp-row-btn { flex: none; pointer-events: none; }
.cp-row-btn + .dv-go { display: none; }
@media (max-width: 700px) {
  .cp-row-link { padding: 18px; gap: 14px; }
  .cp-row-link .cp-link-ic { width: 50px; height: 50px; }
  .cp-row-btn { display: none; } .cp-row-btn + .dv-go { display: grid; }
}
@media (max-width: 700px) { .cp-rows .cp-row-link .cp-row-btn { display: none; } }

/* Course page: Learn, Skill grid, Revision and Daily challenge, two by two */
.cp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cp-grid .cp-row-link { height: 100%; min-height: 150px; }
.cp-daily-form { margin: 0; display: flex; }
.cp-daily-form button.cp-link { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.cp-daily-form button.cp-link:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.cp-daily-form button.cp-link.done .cp-link-ic { color: var(--good); }
.cp-grid .dv-go { display: grid; }
@media (max-width: 800px) { .cp-grid { grid-template-columns: 1fr; } .cp-grid .cp-row-link { min-height: 0; } }

/* Course page stats row (above Learn), using the dashboard's stat tiles */
.dv-cstats.cp-stats { grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr); gap: 14px; margin: 0 0 18px; }
.cp-stats li { padding: 16px 18px; gap: 14px; border-radius: 18px; }
.cp-stats .ico { width: 26px; height: 26px; }
.cp-stats b { font-size: 22px; }
.cp-stats b span { font-size: 14px; }
.cp-stats b.dv-medals { font-size: 18px !important; }
.cp-stat-prog > div { flex: 1; }
.cp-stat-prog .dv-bar { height: 8px; margin-top: 6px; }
@media (max-width: 1250px) { .dv-cstats.cp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cp-stat-prog { grid-column: 1 / -1; } }
@media (max-width: 640px) { .dv-cstats.cp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-stats li { padding: 12px; gap: 10px; } .cp-stats b { font-size: 19px; } }

/* ======================================================================== course booklet */
.bk-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 6px; }
.bk-bar p { margin: 0; flex: 1 1 320px; }
.bk-howto { margin: 0 0 18px; }
.bk { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 44px 52px; }
:root[data-theme="dark"] .bk { background: var(--card-bg, var(--surface)); }
.bk-cover { text-align: center; padding: 30px 0 36px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.bk-cover-ic .ico { width: 72px; height: 72px; color: var(--tc, var(--primary)); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bk-cover h1 { font-size: 40px; margin: 6px 0 8px; }
.bk-cover p { color: var(--text-2); margin: 0; }
.bk-kicker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--violet); }
.bk-toc h2 { font-size: 24px; } .bk-toc h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bk-toc ol { margin: 0; padding-left: 28px; columns: 2; column-gap: 32px; } .bk-toc li { margin-bottom: 4px; break-inside: avoid; }
.bk-sec { padding-top: 34px; margin-top: 34px; border-top: 1px solid var(--line); }
.bk-sec-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.bk-num { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: var(--primary-soft); color: var(--primary); }
.bk-num .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.bk-sec h2 { font-size: 26px; margin: 2px 0 4px; }
.bk-summary { margin: 0; color: var(--text-2); }
.bk-sec h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin: 22px 0 8px; }
.bk-sec h4 { margin: 14px 0 6px; }
.bk-lead { font-size: 17px; }
.bk-fig { margin: 14px 0; } .bk-fig svg { max-width: 100%; height: auto; }
.bk-words { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } .bk-words dt { font-weight: 750; } .bk-words dd { margin: 0; }
.bk-code { white-space: pre-wrap; }
.bk-ex-title { font-weight: 650; margin-top: 10px; } .bk-note { color: var(--muted); font-size: 14px; }
.bk-watch li, .bk-checks li { margin-bottom: 6px; }
@media (max-width: 700px) { .bk { padding: 24px 18px; border-radius: 16px; } .bk-cover h1 { font-size: 30px; } .bk-toc ol { columns: 1; } }
@media print {
  .bk-bar, .bk-howto { display: none !important; }
  .shell > .wrap { padding: 0 !important; max-width: none !important; }
  .bk { border: 0; padding: 0; max-width: none; background: #fff !important; }
  .bk-cover { break-after: page; border: 0; padding-top: 30vh; }
  .bk-toc { break-after: page; }
  .bk-sec { break-before: page; border-top: 0; margin-top: 0; padding-top: 0; }
  .bk-sec h3, .bk-sec h4, .bk-sec-head { break-after: avoid; }
  .bk-code, .bk-fig, .bk-words, .bk-checks li { break-inside: avoid; }
  .bk a { color: inherit; text-decoration: none; }
}

/* ======================================================================== sandbox */
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 14px; }
.sb-head p { margin: 0; flex: 1 1 320px; }
.sb-modes { margin: 0; } .sb-modes .tab { display: inline-flex; align-items: center; gap: 7px; }
.sb-modes .tab .ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 1000px) { .sb { grid-template-columns: 1fr; } }
.sb .card { margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sb-tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.sb-tools label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.sb-tools select { width: auto; max-width: 100%; }
.sb-tools .spacer { flex: 1; }
.sb-code .cm-holder .CodeMirror { height: 380px; }
.sb-plain { width: 100%; min-height: 380px; font: 14.5px/1.55 var(--mono); }
.sb-in-label { font-size: 14px; font-weight: 600; }
.sb-input { width: 100%; font: 14px/1.5 var(--mono); }
.sb-run { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sb-run kbd { font: 12px var(--mono); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-2); }
.sb-out-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sb-out { flex: 1; min-height: 240px; max-height: 560px; overflow: auto; background: var(--console-bg); color: var(--console-text); border-radius: var(--radius-sm);
  padding: 12px 14px; font: 14px/1.55 var(--mono); white-space: pre-wrap; }
.sb-out.err { color: #fca5a5; }
.sb-out .muted { color: #8a93a8; }
.sb-out table.cb-table { color: var(--console-text); white-space: normal; margin: 0 0 6px; } .sb-out table.cb-table th { background: rgba(255,255,255,.08); color: #fff; }
.sb-out table.cb-table td, .sb-out table.cb-table th { border-color: rgba(255,255,255,.15); }
.sb-schema pre { white-space: pre-wrap; font: 12.5px/1.5 var(--mono); margin: 8px 0 0; }
.cbl-extra { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin: 0 0 12px; }
.cbl-extra .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media print { .bk-prose > *, .bk-prose figure, .bk-prose table, .bk-prose pre, .bk-prose li { break-inside: avoid; } }

/* ======================================================================== topic page: stats bar and six cards */
.cp-statbar { padding: 14px; border-radius: 24px; border: 1px solid var(--line); margin-bottom: 26px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cp-statbar .dv-cstats.cp-stats { margin: 0; }
.cp-statbar .cp-stats li { background: var(--surface); border-color: var(--line); padding: 18px 20px; }
:root[data-theme="dark"] .cp-statbar .cp-stats li { background: #151a2a; }
.cp-statbar .cp-stats .ico { color: #8b5cf6; width: 30px; height: 30px; }
.cp-statbar .cp-stats small { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.cp-statbar .cp-stats b { font-size: 26px; }
.cp-statbar .cp-stat-prog { background: linear-gradient(120deg, color-mix(in srgb, #7c3aed 38%, var(--surface)), color-mix(in srgb, #7c3aed 14%, var(--surface))) !important;
  border-color: color-mix(in srgb, #8b5cf6 55%, transparent) !important; }
.cp-statbar .cp-stat-prog .dv-bar { height: 9px; background: color-mix(in srgb, #8b5cf6 25%, transparent); }
.cp-statbar .cp-stat-prog .dv-bar i { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.cp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 1250px) { .cp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cp-cards { grid-template-columns: 1fr; gap: 16px; } }
.c-learn { --k: #22c55e; } .c-grid { --k: #0ea5e9; } .c-revise { --k: #a855f7; }
.c-challenge { --k: #eab308; } .c-booklet { --k: #14b8a6; } .c-sandbox { --k: #ec4899; }
.cp-card-form { margin: 0; display: flex; }
.cp-card { position: relative; overflow: hidden; display: grid; grid-template-columns: 52px minmax(0, 1fr) 42%; grid-template-rows: auto auto 1fr;
  column-gap: 14px; align-content: start; min-height: 196px; padding: 22px 22px 22px 24px; border-radius: 22px; width: 100%;
  color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--k) 70%, transparent);
  background: radial-gradient(80% 90% at 85% 55%, color-mix(in srgb, var(--k) 34%, transparent), transparent 70%),
              linear-gradient(135deg, color-mix(in srgb, var(--k) 20%, var(--surface)), color-mix(in srgb, var(--k) 6%, var(--surface)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--k) 15%, transparent), 0 10px 30px color-mix(in srgb, var(--k) 18%, transparent),
              inset 0 0 24px color-mix(in srgb, var(--k) 12%, transparent);
  transition: transform .18s, box-shadow .18s; }
:root[data-theme="dark"] .cp-card { background: radial-gradient(80% 90% at 85% 55%, color-mix(in srgb, var(--k) 30%, transparent), transparent 70%),
  linear-gradient(135deg, color-mix(in srgb, var(--k) 22%, #0e1220), color-mix(in srgb, var(--k) 6%, #0b0e18)); }
.cp-card:hover { transform: translateY(-3px); text-decoration: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--k) 35%, transparent), 0 16px 40px color-mix(in srgb, var(--k) 32%, transparent),
              inset 0 0 30px color-mix(in srgb, var(--k) 18%, transparent); }
.cp-card:focus-visible { outline: 3px solid var(--k); outline-offset: 3px; }
.cp-card:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.cp-pill { grid-column: 2 / 3; grid-row: 1; justify-self: start; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 8px; color: color-mix(in srgb, var(--k) 75%, var(--text)); margin-bottom: 8px;
  background: color-mix(in srgb, var(--k) 16%, transparent); border: 1.5px solid color-mix(in srgb, var(--k) 65%, transparent); }
.cp-card-head { grid-column: 1 / 3; grid-row: 2; display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 14px; align-items: center; }
.cp-card-ic { display: grid; place-items: center; }
.cp-card-ic .ico { width: 38px; height: 38px; color: var(--k); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--k) 55%, transparent)); }
.cp-card-head b { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.cp-card-text { grid-column: 2 / 3; grid-row: 3; font-size: 15px; line-height: 1.5; color: var(--text-2); margin-top: 6px; }
.cp-card-text strong { color: var(--text); }
.cp-art { grid-column: 3; grid-row: 1 / 4; align-self: center; justify-self: center; width: 100%; max-width: 170px; pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); transition: transform .25s; }
.cp-art svg { display: block; width: 100%; height: auto; }
.cp-card:hover .cp-art { transform: translateY(-4px) rotate(-2deg); }
.cp-go { position: absolute; right: 16px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(8, 10, 20, .55); border: 1.5px solid color-mix(in srgb, var(--k) 80%, #fff 10%); color: #fff;
  box-shadow: 0 0 14px color-mix(in srgb, var(--k) 45%, transparent); }
:root[data-theme="light"] .cp-go { background: var(--surface); color: var(--k); }
.cp-go .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cp-card.done .cp-card-ic .ico { color: #4ade80; }
@media (max-width: 1450px) and (min-width: 1251px) { .cp-card-head b { font-size: 23px; } .cp-card { grid-template-columns: 46px minmax(0, 1fr) 38%; } .cp-card-head { grid-template-columns: 46px minmax(0, 1fr); } }
@media (max-width: 520px) {
  .cp-card { grid-template-columns: 40px minmax(0, 1fr) 30%; padding: 18px; min-height: 0; column-gap: 10px; }
  .cp-card-head { grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; } .cp-card-head b { font-size: 21px; }
  .cp-card-ic .ico { width: 30px; height: 30px; } .cp-card-text { font-size: 14px; padding-bottom: 34px; }
  .cp-go { width: 36px; height: 36px; right: 12px; bottom: 12px; }
}

/* cards v2: the picture sits on the right, the text gets the rest of the width */
.shell > .wrap.cp-page { max-width: 1800px; }
.cp-card { display: block; padding: 22px 40% 24px 24px; min-height: 188px; }
.cp-pill { display: inline-block; margin: 0 0 8px 54px; }
.cp-card-head { display: flex; align-items: center; gap: 14px; }
.cp-card-ic { width: 40px; flex: none; }
.cp-card-text { display: block; margin: 6px 0 0 54px; }
.cp-art { position: absolute; right: 6%; top: 46%; transform: translateY(-50%); width: 31%; max-width: 180px; }
.cp-card:hover .cp-art { transform: translateY(calc(-50% - 4px)) rotate(-2deg); }
@media (max-width: 1450px) and (min-width: 1251px) { .cp-card { padding-right: 37%; } .cp-card-head b { font-size: 23px; } }
@media (max-width: 520px) {
  .cp-card { padding: 18px 30% 18px 18px; min-height: 0; }
  .cp-pill { margin-left: 44px; } .cp-card-text { margin-left: 44px; padding-bottom: 30px; }
  .cp-card-ic { width: 30px; } .cp-art { width: 26%; right: 4%; }
}
.cp-statbar .cp-stats b { white-space: nowrap; overflow: visible; }
@media (max-width: 1450px) { .cp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-card { padding-right: 38%; } }
@media (max-width: 720px) { .cp-cards { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .cp-card { padding-right: 30%; } }
.cp-statbar .dv-medals { gap: 6px; } .cp-statbar .dv-medals .m { width: 13px; height: 13px; margin-left: 8px; } .cp-statbar .dv-medals .m:first-child { margin-left: 0; }

/* topic page header: icon tile, title and subtitle, with wave lines */
.cp-hero2 { position: relative; display: flex; align-items: center; gap: 28px; padding: 22px 26px 26px; margin: 0 0 18px; overflow: hidden; border-radius: 24px; }
.cp-waves { position: absolute; right: 0; top: 0; width: 70%; height: 100%; pointer-events: none; }
/* waves draw themselves in from left to right when the page loads, one strand after another */
.cp-waves path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: cp-wave-draw 1.6s cubic-bezier(.22, .61, .36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes cp-wave-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .cp-waves path { animation: none; stroke-dashoffset: 0; } }
.cp-hero2-ic { position: relative; flex: none; width: 108px; height: 108px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1e3a8a, #0f172a); border: 1.5px solid rgba(96, 165, 250, .35);
  box-shadow: 0 12px 30px rgba(37, 99, 235, .35), inset 0 0 22px rgba(96, 165, 250, .25); }
.cp-hero2-ic .ico { width: 58px; height: 58px; fill: none; stroke: #fbbf24; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, .45)); }
.cp-hero2-text { position: relative; min-width: 0; }
.cp-hero2-kicker { display: block; font-size: 17px; font-weight: 600; color: var(--text-2); }
.cp-hero2 h2 { margin: 2px 0 6px; font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--text); }
.cp-hero2 p { margin: 0; font-size: 19px; color: var(--text-2); }
:root[data-theme="light"] .cp-hero2-ic { background: linear-gradient(145deg, #2563eb, #1e3a8a); }
@media (max-width: 720px) {
  .cp-hero2 { gap: 16px; padding: 12px 4px 16px; } .cp-waves { width: 100%; opacity: .6; }
  .cp-hero2-ic { width: 70px; height: 70px; border-radius: 18px; } .cp-hero2-ic .ico { width: 38px; height: 38px; }
  .cp-hero2 h2 { font-size: 28px; } .cp-hero2 p { font-size: 15px; } .cp-hero2-kicker { font-size: 14px; }
}

/* ---- topic page header motifs (one per topic; Python keeps the waves) ---- */
.cp-motif { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 32%); mask-image: linear-gradient(90deg, transparent 0, #000 32%); }
.cp-motif path { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
@keyframes cp-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cp-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
/* Networks */
.cp-net .cpn-link { fill: none; stroke: #38bdf8; stroke-opacity: .45; stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: cp-wave-draw .9s ease-out forwards; animation-delay: calc(var(--i) * 60ms); }
.cp-net .cpn-node { opacity: 0; transform-box: fill-box; transform-origin: center; animation: cp-pop .5s cubic-bezier(.3, 1.6, .5, 1) forwards; animation-delay: calc(300ms + var(--i) * 70ms); }
.cp-net .core { fill: #0ea5e9; stroke: #bae6fd; stroke-width: 1.5; }
.cp-net .ring { fill: none; stroke: #38bdf8; stroke-width: 1.2; }
.cp-net .cpn-pkt { fill: #e0f2fe; filter: drop-shadow(0 0 4px #38bdf8); opacity: 0; animation: cp-fade-in .3s 1.6s forwards; }
.cp-net .cpn-pkt.alt { fill: #a78bfa; filter: drop-shadow(0 0 4px #a78bfa); }
/* Cyber security */
.cp-cyber .cpc-hex { fill: #34d399; fill-opacity: .05; stroke: #34d399; stroke-opacity: .28; stroke-width: 1; opacity: 0;
  animation: cp-fade-in .5s ease forwards, cpc-scan 4.2s linear infinite; animation-delay: calc(var(--d) * 1ms), calc(var(--s) * 1ms); }
.cp-cyber .cpc-hex.hot { fill-opacity: .16; stroke-opacity: .55; }
@keyframes cpc-scan { 0%, 6% { fill-opacity: .55; stroke-opacity: .95; } 22%, 100% { fill-opacity: .05; stroke-opacity: .28; } }
.cp-cyber .cpc-beam { opacity: 0; animation: cp-fade-in .6s 1s forwards; }
/* Database management */
.cp-db .cpd-table { opacity: 0; animation: cp-fade-in .6s ease forwards; animation-delay: calc(var(--i) * 220ms); }
.cp-db .cpd-frame { fill: #60a5fa; fill-opacity: .05; stroke: #60a5fa; stroke-opacity: .35; }
.cp-db .cpd-head { fill: #818cf8; fill-opacity: .7; }
.cp-db .cpd-cell { fill: #60a5fa; fill-opacity: .22; opacity: 0; animation: cp-fade-in .35s ease forwards; animation-delay: calc(400ms + var(--j) * 35ms); }
.cp-db .cpd-cell.key { fill: #fbbf24; fill-opacity: .55; }
.cp-db .cpd-scan { fill: #bfdbfe; fill-opacity: .16; stroke: #93c5fd; stroke-opacity: .7; }
.cp-db .cpd-join { fill: none; stroke: #a78bfa; stroke-width: 2; stroke-linecap: round; stroke-dasharray: .06 .05; stroke-dashoffset: 1; opacity: 0;
  animation: cp-fade-in .5s 1.3s forwards, cpd-flow 2.4s linear infinite; }
@keyframes cpd-flow { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cp-motif *, .cp-motif .cpc-hex, .cp-motif .cpd-join { animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
}

/* ---- a topic's Revision page ---- */
.rv-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1250px) { .rv-cards { grid-template-columns: 1fr; } }
.rv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 1100px) { .rv-row { grid-template-columns: 1fr; } }
.rv-row .db-card-h > .ico { color: var(--primary); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rv-list, .rv-tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rv-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); }
.rv-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--primary-soft); color: var(--primary); }
.rv-t { min-width: 0; } .rv-t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-t small { color: var(--muted); font-size: 12.5px; }
.rv-strike { color: var(--bad); font-weight: 700; }
.rv-tests a { display: grid; grid-template-columns: 110px minmax(60px, 1fr) 64px 50px 18px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.rv-tests a:hover { border-color: var(--primary); }
.rv-tests .ico { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.rv-date { color: var(--text-2); }
.rv-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .rv-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--violet)); border-radius: 99px; }
.rv-pct { font-weight: 800; text-align: right; } .rv-pct.good { color: var(--good); } .rv-pct.mid { color: var(--warn); } .rv-pct.low { color: var(--bad); }
.rv-cards.rv-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .rv-cards.rv-two { grid-template-columns: 1fr; } }
.rv-row.rv-one { grid-template-columns: 1fr; }
.rv-cards.rv-solo { grid-template-columns: minmax(0, 1fr); }

/* ---- practice test settings (topic Revision page) ---- */
.rv-testform { display: grid; gap: 18px; }
.rv-settings .db-card-h > .ico { color: var(--primary); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rv-count { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.rv-count input[type=range] { width: 260px; accent-color: var(--primary); }
.rv-count output { font-size: 22px; font-weight: 800; min-width: 2ch; color: var(--primary); }
.rv-pick { padding-top: 12px; }
.rv-pick-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; } .rv-pick-bar .spacer { flex: 1; }
.rv-group { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; background: var(--surface); }
.rv-group summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.rv-group summary::-webkit-details-marker { display: none; }
.rv-group summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.rv-group[open] summary::after { transform: rotate(180deg); }
.rv-group ul { list-style: none; margin: 0; padding: 0 12px 10px 12px; display: grid; gap: 2px; }
.rv-group li label { display: grid; grid-template-columns: 20px auto minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 6px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.rv-group li label:hover { background: var(--surface-2); }
.rv-group li input { accent-color: var(--primary); }
.rv-pid { font: 700 11.5px var(--mono); color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.rv-pn { white-space: nowrap; }
.rv-gcheck input { accent-color: var(--primary); }

/* ---- practice tests laid out like a WACE exam paper ---- */
.wace-cover { background: #fff; color: #111; border: 1px solid #cfd3dc; border-radius: 10px; padding: 18px 22px; margin-bottom: 14px; font-family: Arial, Helvetica, sans-serif; }
.wace-cover-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; letter-spacing: .02em; font-size: 13px; }
.wace-cover h1 { font-size: 24px; margin: 8px 0 12px; color: #111; }
.wace-structure { border-collapse: collapse; margin: 6px 0 10px; font-size: 13.5px; }
.wace-structure th, .wace-structure td { border: 1px solid #111; padding: 6px 12px; text-align: center; }
.wace-structure th { font-weight: 700; background: #f3f4f6; }
.qcard.wace { background: #fff; color: #111; border: 1px solid #cfd3dc; border-radius: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.5; padding: 22px 26px; }
.qcard.wace .wace-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; margin-bottom: 10px; }
.qcard.wace .wace-h b { font-weight: 700; } .qcard.wace .wace-h span { font-weight: 400; }
.qcard.wace .prompt { color: #111; white-space: pre-line; }
.qcard.wace .codeview, .qcard.wace pre { background: #fff; color: #111; border: 0; padding: 4px 0 4px 18px; font: 14px/1.55 "Courier New", Consolas, monospace; white-space: pre-wrap; }
.qcard.wace table.trace th, .qcard.wace table.trace td, .qcard.wace table th, .qcard.wace table td { border: 1px solid #111; color: #111; }
.qcard.wace table.trace th { background: #fff; font-weight: 700; }
.qcard.wace .options label, .qcard.wace .opt { color: #111; }
.qcard.wace input[type=text], .qcard.wace textarea, .qcard.wace select { background: #fff; color: #111; border-color: #9ca3af; }
/* written answers sit on ruled lines, like the answer booklet */
.qcard.wace textarea.lined { border: 0; border-radius: 0; padding: 0 2px; line-height: 32px; font: 15px/32px Arial, Helvetica, sans-serif; resize: vertical;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #9ca3af 31px, #9ca3af 32px); box-shadow: none; outline-offset: 4px; }
.qcard.wace .selfmark { border-top: 1px dashed #9ca3af; margin-top: 10px; padding-top: 10px; }
.qcard.wace .muted { color: #4b5563; }

.ssobtn .ms-logo { flex: none; }

/* ---- Settings page and profile menu (tidied) ---- */
.appearance { container-type: inline-size; }
.mode-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-pick .mode-opt { display: block; }
.mode-pick .mode-card { width: auto; height: 100%; box-sizing: border-box; justify-content: flex-start; text-align: center; line-height: 1.25; }
.accent-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 6px; }
.accent-pick .accent-opt { width: auto; line-height: 1.25; }
@container (max-width: 470px) { .accent-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.acct-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 6px 0 0; }
.acct-facts dt { color: var(--muted); font-size: 13.5px; }
.acct-facts dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.acct-sec { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.acct-sec h3 { font-size: 16px; margin: 0 0 8px; }
.acct-sec p { margin: 6px 0; }
.acct-sec .pw-form p { margin-top: 12px; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.menu-item.theme-toggle .tg { margin-left: auto; flex: none; width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong);
  position: relative; transition: background .15s; }
.menu-item.theme-toggle .tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform .15s; }
.menu-item.theme-toggle[aria-checked="true"] .tg { background: var(--a1); }
.menu-item.theme-toggle[aria-checked="true"] .tg::after { transform: translateX(16px); }
.menu-item.theme-toggle:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }

/* ---- bubble (skill) page ---- */
.sk { max-width: 1040px; }
.sk-hero { display: flex; align-items: center; gap: 22px; padding: 24px 26px; border-radius: 22px; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--tc) 35%, var(--line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--tc) 16%, var(--surface)), var(--surface) 65%); box-shadow: var(--shadow-sm); }
.sk-bubble { flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font: 800 30px var(--font); color: #fff;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tc) 55%, #fff), var(--tc) 70%); box-shadow: 0 0 0 5px color-mix(in srgb, var(--tc) 22%, transparent), 0 10px 24px -10px var(--tc); }
.sk-bubble .ico { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.sk-locked .sk-bubble, .sk-capped .sk-bubble { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.sk-hero-text { flex: 1; min-width: 0; }
.sk-kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sk-hero h2 { margin: 4px 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.sk-hero p { margin: 0; color: var(--text-2); font-size: 15px; }
.sk-state { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px; font-weight: 750; font-size: 14px;
  background: color-mix(in srgb, var(--a1) 14%, transparent); color: var(--a1); }
:root[data-theme="dark"] .sk-state { color: var(--a-light); }
.sk-completed .sk-state { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.sk-revoked .sk-state { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.sk-locked .sk-state, .sk-capped .sk-state { background: var(--surface-3); color: var(--muted); }
.sk-state .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sk-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .sk-grid { grid-template-columns: minmax(0, 1fr); } .sk-hero { flex-wrap: wrap; } }
.sk-card { padding: 22px 24px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.sk-h { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sk-h h3 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; }
.sk-h-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--tc);
  background: color-mix(in srgb, var(--tc) 15%, transparent); }
.sk-h-ic .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.sk-lead { margin: 0 0 16px; font-size: 15px; color: var(--text-2); }
.sk-sub { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sk-code { margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; background: var(--code-bg); border: 1px solid var(--line); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; }
.sk-book .ico, .sk-go .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.sk-go .ico path[fill] { fill: currentColor; stroke: none; }
.sk-facts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sk-facts li { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.sk-facts b { display: block; font-size: 22px; font-weight: 800; line-height: 1.15; }
.sk-facts small { color: var(--muted); font-size: 13px; }
.sk-note { margin: 0 0 14px; color: var(--text-2); font-size: 14.5px; }
.sk-medal { padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; color: #1f1300; }
.sk-medal.gold { background: var(--gold); } .sk-medal.silver { background: var(--silver); } .sk-medal.bronze { background: var(--bronze); color: #fff; }
.sk-progress { margin: 0 0 14px; }
.sk-progress-l { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; }
.sk-bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.sk-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.sk-gate { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 14px; border-radius: 14px; font-size: 14px;
  background: color-mix(in srgb, var(--info) 12%, transparent); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); }
.sk-gate .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: var(--info); stroke-width: 2.2; }
.sk-go { width: 100%; justify-content: center; padding-top: 11px; padding-bottom: 11px; font-size: 15px; }
.sk-action form { margin: 0; }
/* both bubble-page cards the same height, with their buttons lined up along the bottom */
.sk-grid { align-items: stretch; }
.sk-card { display: flex; flex-direction: column; }
.sk-card > .sk-book, .sk-action > .sk-go, .sk-action > form { margin-top: auto; }
.sk-book { align-self: flex-start; }
.sk-card > .sk-code { margin-bottom: 18px; }
.sk-book.btn { padding-top: 11px; padding-bottom: 11px; font-size: 14.5px; }
/* bubble page v2: topic-style header, stats and cards */
.sk { max-width: none; }
.sk-hero2 .sk-state { position: relative; z-index: 1; margin-left: auto; align-self: flex-start; }
.sk-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sk-cards .cp-card.done .cp-pill { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.sk-cards .sk-off { opacity: .6; cursor: not-allowed; }
.sk-cards .sk-off .cp-go { display: none; }
.dv-cstats.cp-stats.sk-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sk-stats .cp-stat-prog { grid-column: auto; }
@media (max-width: 640px) { .dv-cstats.cp-stats.sk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cp-cards.sk-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sk-cards .cp-card { padding-right: 34%; } }

/* ---- Stats page ---- */
.st-title-ic .ico { color: var(--a1); }
:root[data-theme="dark"] .st-title-ic .ico { color: var(--a-light); }
.st-top { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.6fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .st-top { grid-template-columns: 1fr; } }
.st-level { display: flex; align-items: center; gap: 20px; padding: 22px 24px; border-radius: 22px; color: #fff; background: var(--grad); box-shadow: 0 14px 30px -18px var(--a1); }
.st-level-badge { flex: none; width: 88px; height: 88px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.45); }
.st-level-badge small { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.st-level-badge b { font-size: 34px; line-height: 1; font-weight: 800; }
.st-level-text { flex: 1; min-width: 0; }
.st-level-text h2 { margin: 0 0 10px; font-size: 26px; color: #fff; }
.st-level-text p { margin: 8px 0 0; font-size: 14px; opacity: .9; }
.st-xpbar { background: rgba(255,255,255,.25) !important; height: 10px; }
.st-xpbar i { background: #fff !important; }
.st-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.st-tiles li { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-width: 0; }
.st-tiles .ico { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.st-tiles small { display: block; font-size: 13px; color: var(--text-2); }
.st-tiles b { font-size: 22px; font-weight: 800; }
.st-tiles b span { font-size: 14px; font-weight: 600; color: var(--muted); }
.st-tiles b.dv-medals { font-size: 18px; }
.st-note { display: block; font-size: 12px; color: var(--muted); }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .st-row { grid-template-columns: minmax(0, 1fr); } }
.st-card { padding: 20px 22px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-width: 0; }
.st-h { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.st-h h3 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; }
.st-h-ic { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--a1); background: color-mix(in srgb, var(--a1) 14%, transparent); }
:root[data-theme="dark"] .st-h-ic { color: var(--a-light); }
.st-h-ic.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.st-h-ic .ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.st-chart { width: 100%; height: auto; display: block; }
.st-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.st-right { fill: var(--good); } .st-wrong { fill: var(--bad); opacity: .8; } .st-none { fill: var(--surface-3); }
.st-day { font: 600 11px var(--font); fill: var(--muted); } .st-day.today { fill: var(--text); font-weight: 800; }
.st-empty { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.st-topics ul, .st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-topics a, .st-list a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; color: var(--text); text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.st-topics a:hover, .st-list a:hover { border-color: var(--a1); transform: translateY(-1px); text-decoration: none; }
.st-t-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--tc); background: color-mix(in srgb, var(--tc) 15%, transparent); }
.st-t-ic .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.st-t-main b { font-size: 15px; }
.st-t-main small { font-size: 12.5px; color: var(--muted); }
.st-t-main .dv-bar { height: 7px; }
.st-t-pct { font-size: 18px; font-weight: 800; flex: none; }
.st-rank { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-3); }
.st-rank .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.st-l-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-l-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-l-main small { font-size: 12.5px; color: var(--muted); }
.st-l-val { font-weight: 800; font-size: 15px; flex: none; }
.st-list li.bad .st-rank { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.st-list li.bad .st-l-val { color: var(--bad); }

/* ---- Badges page ---- */
.bg-title-ic .ico { color: var(--gold); }
.bg-hero { display: flex; align-items: center; gap: 26px; padding: 24px 28px; margin-bottom: 16px; border-radius: 22px; color: #fff;
  background: linear-gradient(120deg, #b45309, #eab308 55%, #fde68a); box-shadow: 0 14px 30px -18px #b45309; }
.bg-hero-ring { flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.28) 0); }
.bg-hero-ring span { width: 82px; height: 82px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: #b45309; }
.bg-hero-ring b { font-size: 30px; line-height: 1; font-weight: 800; } .bg-hero-ring small { font-size: 12px; opacity: .9; }
.bg-hero-text h2 { margin: 0 0 6px; font-size: 26px; color: #fff; } .bg-hero-text p { margin: 0; font-size: 15px; opacity: .95; }
.bg-card { padding: 20px 22px; margin-bottom: 16px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.bg-group-n { font-weight: 800; color: var(--text-2); }
.bg-group-text { margin: -4px 0 14px; color: var(--text-2); font-size: 14px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.bg-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 14px 16px; border-radius: 18px;
  background: var(--surface-2); border: 1px solid var(--line); }
.bg-item.got { background: color-mix(in srgb, var(--gold) 10%, var(--surface-2)); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.bg-item .db-badge { width: 84px; max-width: 84px; margin-bottom: 4px; }
.bg-item b { font-size: 15px; } .bg-item small { font-size: 12.5px; color: var(--muted); line-height: 1.35; min-height: 2.7em; }
.bg-item:not(.got) b { color: var(--text-2); }
.bg-item .dv-bar, .bg-next .dv-bar { width: 100%; height: 7px; margin-top: 4px; }
.bg-count { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.bg-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12.5px; font-weight: 750; color: var(--muted); }
.bg-status.got { color: var(--good); }
.bg-status .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.bg-next-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .bg-next-list { grid-template-columns: minmax(0, 1fr); } }
.bg-next-list li { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.bg-next-list li > div:last-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bg-next-list b { font-size: 15px; } .bg-next-list small { font-size: 12.5px; color: var(--muted); }
.bg-art-sm.db-badge { width: 56px; max-width: 56px; flex: none; }
@media (max-width: 640px) { .bg-hero { flex-direction: column; text-align: center; } .bg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bg-page .dv-bar { display: block; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .bg-page .dv-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #eab308, #f59e0b); }

/* ---- LabLevelUp brand: light "LabLevel", gold "Up" ---- */
.brand .word { font-weight: 400; letter-spacing: .01em; }
.brand b { font-weight: 700; color: #d4a23a; background: linear-gradient(135deg, #f7dc84, #d4a23a 55%, #9c7425); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
:root[data-theme="light"] .brand b { background: linear-gradient(135deg, #c9952e, #9c7425); -webkit-background-clip: text; background-clip: text; }
