/* Cairn: colours, layout and shared components. */

:root {
  --font-display: Constantia, "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --text-scale: 1;
  --reading-width: 760px;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 272px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121418;
  --sidebar: #0d0f12;
  --panel: #1a1d22;
  --panel-2: #20242a;
  --field: #0f1115;
  --ink: #ece9e1;
  --ink-soft: #c9c6bf;
  --muted: #959ca6;
  --faint: #6b727c;
  --line: #2a2e35;
  --line-hover: #454b55;
  --hover: rgba(255, 255, 255, .06);
  --selected: rgba(255, 255, 255, .10);
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --good: #6fd08c;
  --bad: #f0806a;
  --warn: #e8c05a;
  --info: #7fb4f5;
  --c-drill: #6cc3ea;
  --c-build: #a9d16e;
  --c-project: #e2b45c;
  --c-lesson: #c59be0;
  --code-bg: #0f1115;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ee;
  --sidebar: #ece9e2;
  --panel: #fcfbf8;
  --panel-2: #f3f0ea;
  --field: #ffffff;
  --ink: #1b1f25;
  --ink-soft: #343a43;
  --muted: #69707a;
  --faint: #969ca6;
  --line: #e0dcd3;
  --line-hover: #c9c2b4;
  --hover: rgba(27, 31, 37, .05);
  --selected: rgba(27, 31, 37, .09);
  --shadow: 0 12px 40px rgba(60, 50, 30, .18);
  --good: #23824a;
  --bad: #b8402a;
  --warn: #96690d;
  --info: #2a62b8;
  --c-drill: #1c78a0;
  --c-build: #557a22;
  --c-project: #9a6511;
  --c-lesson: #7b4a93;
  --code-bg: #f7f5f0;
}

/* accent colours: [name] -> dark / light */
html[data-theme="dark"]  { --accent: #e2b45c; }
html[data-theme="light"] { --accent: #9a6511; }
html[data-theme="dark"][data-accent="teal"]   { --accent: #4fcfb4; }
html[data-theme="light"][data-accent="teal"]  { --accent: #0f7b6c; }
html[data-theme="dark"][data-accent="rose"]   { --accent: #f08db6; }
html[data-theme="light"][data-accent="rose"]  { --accent: #ad3f6c; }
html[data-theme="dark"][data-accent="blue"]   { --accent: #8fa9f5; }
html[data-theme="light"][data-accent="blue"]  { --accent: #3f5fb5; }
html[data-theme="dark"][data-accent="iron"]   { --accent: #aebbc8; }
html[data-theme="light"][data-accent="iron"]  { --accent: #4f5d6b; }
html[data-theme="dark"][data-accent="ember"]  { --accent: #f08a5d; }
html[data-theme="light"][data-accent="ember"] { --accent: #b4441f; }
html { --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent); --accent-ink: color-mix(in srgb, var(--accent) 12%, #14110a); }
html[data-theme="light"] { --accent-ink: #ffffff; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: calc(14.5px * var(--text-scale));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink) 36%, transparent); background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- boot ---------- */
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-mark { width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(160deg, #c8902e, #8a570c); animation: pulse 1.4s ease-in-out infinite; }
.boot-text { font-family: var(--font-display); font-size: 22px; color: var(--muted); letter-spacing: .02em; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

/* ---------- shell ---------- */
#app { height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
#app.sidebar-hidden { grid-template-columns: minmax(0, 1fr); }
#app.sidebar-hidden .sidebar { display: none; }

.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 12px; cursor: pointer; }
.brand-tile { width: 36px; height: 36px; border-radius: 9px; flex: none; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #fff), color-mix(in srgb, var(--accent) 62%, #000)); display: grid; place-items: center; color: #16130c; }
.brand-tile svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--font-display); font-size: 21px; line-height: 1.1; }
.brand-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-top: 3px; }

.side-search { margin: 4px 14px 10px; display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--muted); cursor: pointer; font-size: 13px; }
.side-search:hover { border-color: var(--line-hover); color: var(--ink-soft); }
.side-search kbd { margin-left: auto; }
.side-search svg { width: 15px; height: 15px; flex: none; }
.side-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 14px 10px; }

.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 16px; min-height: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink-soft); cursor: pointer; font-size: 13.5px; position: relative; text-decoration: none; }
.nav-item:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.nav-item.active { background: var(--selected); color: var(--ink); }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.nav-item.active svg { color: var(--accent); }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

.side-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; }
.side-course { display: flex; align-items: center; gap: 10px; padding: 14px 10px 8px; }
.side-course .glyph { font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 3px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.side-course .name { font-family: var(--font-display); font-size: 16px; }
.side-course .pct { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }

.ms-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 4px; cursor: pointer; border-radius: 8px; user-select: none; }
.ms-head:hover { background: var(--hover); }
.ms-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ms, var(--accent)); flex: none; }
.ms-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ms, var(--accent)); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-meta { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.ms-head svg { width: 12px; height: 12px; color: var(--faint); transition: transform .18s var(--ease); }
.ms-head.open svg { transform: rotate(90deg); }
.ms-lessons { padding: 2px 0 6px 6px; }
.lesson-link { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: none; position: relative; }
.lesson-link:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.lesson-link.active { background: var(--selected); color: var(--ink); }
.lesson-link .tick { width: 13px; height: 13px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-hover); display: grid; place-items: center; }
.lesson-link .tick svg { width: 9px; height: 9px; display: none; }
.lesson-link.done .tick { background: color-mix(in srgb, var(--ms, var(--good)) 85%, transparent); border-color: transparent; color: #101216; }
.lesson-link.done .tick svg { display: block; }
.lesson-link.part .tick { border-color: var(--ms, var(--accent)); background: conic-gradient(var(--ms, var(--accent)) var(--p, 50%), transparent 0); }
.lesson-link span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 6px; }
.side-foot .streak { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-right: auto; padding-left: 4px; }
.side-foot .streak svg { width: 15px; height: 15px; color: var(--accent); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 16px; height: 16px; }

#main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
#view { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
#view.flush { overflow: hidden; display: flex; flex-direction: column; }
.page { max-width: 1080px; margin: 0 auto; padding: 44px 48px 96px; }
.page.narrow { max-width: calc(var(--reading-width) + 96px); }
.page.wide { max-width: 1280px; }
.fade-in { animation: fadeIn .28s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
html[data-anim="off"] * { animation: none !important; transition: none !important; }

/* ---------- type ---------- */
.eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); }
.display { font-family: var(--font-display); font-weight: 400; font-size: calc(38px * var(--text-scale)); line-height: 1.12; margin: 8px 0 14px; letter-spacing: -.005em; }
.display.small { font-size: calc(28px * var(--text-scale)); }
.lede { font-size: calc(16px * var(--text-scale)); color: var(--ink-soft); max-width: 720px; line-height: 1.65; }
h2.section { font-family: var(--font-display); font-weight: 400; font-size: calc(22px * var(--text-scale)); margin: 44px 0 14px; display: flex; align-items: baseline; gap: 12px; }
h2.section .aside { font-family: var(--font-body); font-size: 12.5px; color: var(--muted); margin-left: auto; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 13.5px; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s, transform .08s; }
.btn:hover { border-color: var(--line-hover); background: var(--panel-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.good { background: var(--good); border-color: var(--good); color: #0c1a10; font-weight: 600; }
html[data-theme="light"] .btn.good { color: #fff; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel-2); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

input[type="text"], input[type="number"], textarea, select { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; outline: none; }
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; width: 100%; line-height: 1.55; }
input[type="range"] { accent-color: var(--accent); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; cursor: pointer; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 12px; background: var(--selected); border: 1px solid var(--line); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease), background .15s; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }

/* ---------- cards and chips ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card.link { cursor: pointer; transition: border-color .15s, transform .15s var(--ease); text-decoration: none; color: inherit; display: block; }
.card.link:hover { border-color: var(--line-hover); transform: translateY(-1px); text-decoration: none; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } .page { padding: 28px 20px 80px; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; padding: 3px 8px; border-radius: 20px; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent); white-space: nowrap; }
.chip svg { width: 11px; height: 11px; }
.chip.drill { --c: var(--c-drill); } .chip.build { --c: var(--c-build); } .chip.project { --c: var(--c-project); } .chip.lesson { --c: var(--c-lesson); }
.chip.good { --c: var(--good); } .chip.bad { --c: var(--bad); } .chip.warn { --c: var(--warn); }
.level { display: inline-flex; gap: 3px; align-items: center; }
.level i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-hover); }
.level i.on { background: var(--accent); }

.bar { height: 6px; border-radius: 6px; background: var(--selected); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--accent)); transition: width .5s var(--ease); }
.ring { --size: 46px; width: var(--size); height: var(--size); flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .track { stroke: var(--selected); }
.ring .fill { stroke: var(--c, var(--accent)); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.1; }
.stat span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat small { color: var(--muted); font-size: 12.5px; }

/* ---------- lists ---------- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); text-decoration: none; }
.list-row .num { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); width: 38px; flex: none; }
.list-row .title { font-size: 14.5px; }
.list-row .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.status-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-hover); flex: none; display: grid; place-items: center; }
.status-dot svg { width: 11px; height: 11px; display: none; }
.status-dot.passed { background: var(--good); border-color: var(--good); color: #0c1a10; }
.status-dot.passed svg { display: block; }
.status-dot.tried { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 25%, transparent); }

.empty { text-align: center; color: var(--muted); padding: 56px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 20px; color: var(--ink); margin: 0 0 6px; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-top: 26px; }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }
.continue { display: flex; flex-direction: column; gap: 14px; background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 12%, var(--panel)), var(--panel) 60%); }
.continue .where { font-family: var(--font-display); font-size: 24px; line-height: 1.2; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; }
.heat i { width: 11px; height: 11px; border-radius: 3px; background: var(--selected); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.heat i[data-l="4"] { background: var(--accent); }
.heat i.future { opacity: .25; }

.course-card { position: relative; overflow: hidden; }
.course-card .glyph { font-family: var(--font-mono); font-weight: 700; font-size: 13px; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--cc, var(--accent)) 18%, transparent); color: var(--cc, var(--accent)); flex: none; }
.course-card.planned { opacity: .72; }
.course-card.planned:hover { opacity: 1; }

/* ---------- trail (course roadmap) ---------- */
.trail { position: relative; margin-top: 8px; }
.trail-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 0 6px; position: relative; }
.trail-rail { position: relative; display: flex; justify-content: center; }
.trail-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.trail-item:first-child .trail-rail::before { top: 34px; }
.trail-item:last-child .trail-rail::before { bottom: calc(100% - 34px); }
.trail-node { position: relative; margin-top: 22px; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ms); display: grid; place-items: center; font-family: var(--font-mono); font-size: 10px; color: var(--ms); z-index: 1; }
.trail-node.done { background: var(--ms); color: #101216; }
.trail-card { margin: 8px 0; display: flex; align-items: center; gap: 18px; border-left: 3px solid var(--ms); }
.trail-card .t { font-family: var(--font-display); font-size: 20px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 50; display: grid; place-items: start center; padding-top: 12vh; animation: fadeIn .15s; }
html[data-theme="light"] .overlay { background: rgba(40, 34, 20, .32); }
.palette { width: min(640px, 92vw); background: var(--panel); border: 1px solid var(--line-hover); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 16px 18px; font-size: 16px; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette-item.on { background: var(--selected); }
.palette-item .grow { min-width: 0; flex: 1; }
.palette-item .t { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-foot { border-top: 1px solid var(--line); padding: 8px 14px; display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }

.modal { width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--line-hover); border-radius: 14px; box-shadow: var(--shadow); padding: 24px 26px; }
.modal h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0 0 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

#toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--panel-2); border: 1px solid var(--line-hover); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13.5px; animation: toastIn .25s var(--ease); max-width: 380px; }
.toast.good { border-left-color: var(--good); } .toast.bad { border-left-color: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- settings ---------- */
.setting { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .grow { flex: 1; min-width: 0; }
.setting .name { font-size: 14.5px; }
.setting .hint { font-size: 12.5px; color: var(--muted); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--sw); }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--panel) inset; }

/* ---------- review cards ---------- */
.flash { max-width: 680px; margin: 26px auto 0; }
.flash-card { min-height: 260px; display: flex; flex-direction: column; justify-content: center; padding: 34px 38px; }
.flash-q { font-family: var(--font-display); font-size: 24px; line-height: 1.35; }
.flash-a { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 26px 0 20px; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 8px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--c, var(--warn)) 45%, transparent); background: color-mix(in srgb, var(--c, var(--warn)) 9%, transparent); font-size: 13.5px; }
.banner svg { width: 18px; height: 18px; color: var(--c, var(--warn)); flex: none; }

/* ---------- home and courses (redesign) ---------- */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.home-head .display { margin-bottom: 4px; }
.announce { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; margin-bottom: 22px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--info) 40%, transparent); background: color-mix(in srgb, var(--info) 9%, var(--panel)); }
.announce svg { width: 18px; height: 18px; color: var(--info); flex: none; margin-top: 2px; }
.announce b { display: block; font-size: 12px; letter-spacing: .04em; color: var(--info); margin-bottom: 2px; }
.announce span { font-size: 14px; white-space: pre-wrap; }
.quick-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.qc-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.qc-icon svg { width: 19px; height: 19px; }
.quick-card h3 { margin: 0; }
.home-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 40px; }
@container view (max-width: 980px) { .home-split { grid-template-columns: 1fr; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-family: var(--font-display); font-weight: 400; font-size: 20px; margin: 0; }
.card-head .muted { font-size: 12.5px; }
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 8px; font-size: 11px; color: var(--faint); }
.heat-legend span { margin: 0 4px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--selected); }
.heat-legend i[data-l="1"] { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.heat-legend i[data-l="2"] { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.heat-legend i[data-l="3"] { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.heat-legend i[data-l="4"] { background: var(--accent); }
.activity-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.activity-stats .stat b { font-size: 24px; }
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); opacity: .62; }
.badge.earned { opacity: 1; border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.badge-icon { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--selected); color: var(--muted); }
.badge.earned .badge-icon { background: var(--accent); color: var(--accent-ink); }
.badge-icon svg { width: 16px; height: 16px; }
.badge-text { display: flex; flex-direction: column; min-width: 0; }
.badge-text b { font-size: 13px; font-weight: 600; }
.badge-text span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-bar { grid-column: 2; height: 3px; border-radius: 3px; background: var(--selected); overflow: hidden; margin-top: 5px; }
.badge-bar i { display: block; height: 100%; background: var(--accent); }
@container view (max-width: 520px) { .badges { grid-template-columns: 1fr; } .activity-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.more-card { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; border-style: dashed; background: transparent; }
.more-card > svg { width: 20px; height: 20px; color: var(--muted); margin-bottom: 6px; }
.course-facts { gap: 6px; margin-top: 12px; }
