/* =============================================================================================
   QA → AI Engineer Roadmap — styles
   Design tokens first; light theme by default, dark via [data-theme="dark"].
   ============================================================================================= */
:root {
  color-scheme: light;
  --font-scale: 1;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-read: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --surface-3: #e2e8e5;
  --border: #dbe2de;
  --border-strong: #c3cdc8;
  --control-border: #76867f;
  --text: #14211c;
  --text-2: #33433d;
  --muted: #56665f;
  --accent: #0f6b57;
  --accent-hover: #0a5545;
  --accent-soft: #e2f1eb;
  --accent-text: #0a5545;
  --on-accent: #ffffff;
  --link: #0d6652;
  --focus: #1d8f73;
  --success: #1b7f48;
  --success-soft: #e3f4ea;
  --warn: #a8540a;
  --warn-soft: #fbf1e4;
  --danger: #b4232f;
  --danger-soft: #fcecee;
  --info: #22607e;
  --info-soft: #e8f1f5;
  --today-dot: #b45309;

  --code-bg: #f6f8f7;
  --code-head: #edf1ef;
  --code-inline-bg: #edf1ef;
  --code-inline-text: #7a3410;

  --learn: #2b7fa8;
  --build: #0f6b57;
  --blank: #e11d48;
  --dsa: #a855f7;
  --career: #c07a12;
  --log: #3d8a7e;
  --drill: #ec4899;

  /* phase colours (white text on them stays above 4.5:1) */
  --p-1: #66756e;
  --p0: #2f6690;
  --p1: #1d7375;
  --p2: #5b5794;
  --p3: #0f6b57;
  --p4: #94570f;
  --p5: #9e4058;
  --p6: #3e5f8a;
  --p7: #8a4b2d;

  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(20, 33, 28, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .16);
  --radius: 10px;
  --radius-sm: 8px;
  --topbar-h: 60px;
  --sidebar-w: 292px;
  --read-w: 860px;
  accent-color: var(--accent);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1412;
  --surface: #131c19;
  --surface-2: #18231f;
  --surface-3: #1f2c27;
  --border: #26352f;
  --border-strong: #34463e;
  --control-border: #6a7d75;
  --text: #e3ebe7;
  --text-2: #bfcbc5;
  --muted: #8d9d96;
  --accent: #5dc9a8;
  --accent-hover: #7ad7ba;
  --accent-soft: #15302a;
  --accent-text: #9fe2cc;
  --on-accent: #05221a;
  --link: #7ad7ba;
  --focus: #5dc9a8;
  --success: #5ccf8e;
  --success-soft: #112a1d;
  --warn: #fbbf24;
  --warn-soft: #2b2111;
  --danger: #fb7185;
  --danger-soft: #2c1219;
  --info: #8cc8e3;
  --info-soft: #10242d;
  --today-dot: #f59e0b;
  --code-bg: #0f1714;
  --code-head: #141e1a;
  --code-inline-bg: #1b2622;
  --code-inline-text: #fdba74;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, .55);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 64px); }
html.nav-lock, html.nav-lock body { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(16px * var(--font-scale));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: .06em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
#main:focus, #main h1:focus { outline: none; }
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
svg.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.18em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 100; font-weight: 650; }
.skip-link:focus { left: 8px; }
.noscript { padding: 2rem; text-align: center; }
.boot { padding: 4rem 2rem; color: var(--muted); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ layout */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 750; font-size: .98rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.topbar-search { flex: 1; display: flex; justify-content: center; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 10px; text-decoration: none;
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .label { font-size: .86rem; font-weight: 600; }
.menu-btn { display: none; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 30;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 14px 10px calc(40px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.main { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 24px) 32px 96px; min-height: 100vh; outline: none; }
.page { max-width: 1180px; margin: 0 auto; }
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 29; }

@media (max-width: 1023px) {
  .menu-btn { display: inline-flex; }
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); width: min(88vw, 320px); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  body.nav-open .timer-fab, body.nav-open .timer-panel { visibility: hidden; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 16px) max(16px, env(safe-area-inset-right)) 120px max(16px, env(safe-area-inset-left)); }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  .brand { display: none; }
  .icon-btn .label { display: none; }
  .topbar { gap: 6px; padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
}

/* ------------------------------------------------------------------ sidebar nav */
.nav-section { margin: 6px 0 14px; }
.nav-heading { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-size: .9rem; line-height: 1.3;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav-link .ico { width: 18px; height: 18px; opacity: .85; }
.nav-link .wk { flex: none; width: 30px; font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-link.active .wk { color: var(--accent-text); }
.nav-link .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link .now { font-size: .66rem; font-weight: 800; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 1px 7px; }
.status-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--control-border); }
.status-dot.partial { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.status-dot.done { border-color: var(--success); background: var(--success); }
.phase-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px; font-size: .84rem; font-weight: 700; color: var(--text);
}
.phase-group > summary::-webkit-details-marker { display: none; }
.phase-group > summary:hover { background: var(--surface-2); }
.phase-group .pg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-group > summary .chev { transition: transform .15s; color: var(--muted); width: 16px; height: 16px; }
.phase-group[open] > summary .chev { transform: rotate(90deg); }
.phase-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.phase-group .mini-bar { width: 38px; height: 5px; border-radius: 9px; background: var(--surface-3); overflow: hidden; flex: none; }
.phase-group .mini-bar > span { display: block; height: 100%; background: var(--success); }
.phase-weeks { padding: 2px 0 6px 10px; }
.nav-buffer { font-style: italic; }

/* ------------------------------------------------------------------ search */
.search { position: relative; width: min(560px, 100%); }
.search input {
  width: 100%; height: 40px; padding: 0 44px 0 38px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: .93rem;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--focus); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); cursor: pointer; }
.search .s-ico { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 9px; pointer-events: none; }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
kbd {
  font-family: var(--font-sans); font-size: .72rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface);
}
.search-pop {
  position: absolute; top: 46px; left: 0; right: 0; max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
}
.search-pop .sr { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.search-pop .sr:hover, .search-pop .sr.sel { background: var(--accent-soft); }
.sr-week .sr-title::before { content: "→ "; color: var(--accent-text); }
.sr-title { font-weight: 650; font-size: .92rem; }
.sr-crumb { font-size: .75rem; color: var(--muted); margin-top: 1px; }
.sr-snip { font-size: .83rem; color: var(--text-2); margin-top: 4px; line-height: 1.45; }
.search-pop .sr-more { display: block; text-align: center; padding: 8px; font-size: .84rem; font-weight: 600; }
.search-pop .sr-empty { padding: 14px; color: var(--muted); font-size: .9rem; }
mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] mark { background: #facc15; color: #0b0e1a; }
.search-results { gap: 10px; max-width: var(--read-w); }
.sr-card { display: block; text-decoration: none; color: inherit; padding: 14px 18px; }
.sr-card:hover { border-color: var(--accent); }
@media (max-width: 640px) {
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .search-pop { position: fixed; top: calc(var(--topbar-h) - 4px); left: 8px; right: 8px; max-height: calc(100dvh - var(--topbar-h) - 16px); }
  .search-pop .sr-snip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ------------------------------------------------------------------ generic UI */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; flex: none;
  height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 650; font-size: .92rem; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s, box-shadow .2s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
[data-theme="dark"] .btn-success { color: #04130a; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 9px; gap: 6px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; border-radius: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.pulse { animation: ring 1.4s ease-out 3; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip .ico { width: 13px; height: 13px; margin-left: -2px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.checkpoint { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar.thin { height: 6px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #0ea5e9); transition: width .3s ease; }
.bar.success > span { background: var(--success); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 180px; }
.grid { display: grid; gap: 16px; }
.eyebrow { font-size: .74rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.page-title { font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.2; letter-spacing: -.02em; margin: 4px 0 8px; font-weight: 800; }
.page-sub { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
.section-title { font-size: 1.02rem; margin: 26px 0 10px; letter-spacing: -.01em; }
.crumbs { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); text-decoration: underline; }
.page-crumbs { margin-bottom: 4px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.nf-title { font-size: 1.3rem; color: var(--text); margin: 0 0 6px; }
.banner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px;
  background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
}
.banner > .ico { width: 22px; height: 22px; color: var(--info); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.warn > .ico { color: var(--warn); }
.banner-text { min-width: 0; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .banner { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .banner > .ico { margin-top: 2px; }
  .banner-actions { grid-column: 2; justify-content: flex-start; }
}

/* ------------------------------------------------------------------ dashboard */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff;
  background: radial-gradient(1200px 400px at 0% 0%, #6366f1 0%, transparent 60%), radial-gradient(900px 400px at 100% 100%, #0ea5e9 0%, transparent 55%), #312e81;
  box-shadow: var(--shadow);
}
.hero .eyebrow { color: rgba(255, 255, 255, .82); }
.hero h1 { margin: 6px 0 6px; font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.2; letter-spacing: -.02em; }
.hero p { margin: 0 0 16px; color: rgba(255, 255, 255, .9); max-width: 64ch; }
.hero .btn { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .22); }
.hero .btn-primary { background: #fff; color: #312e81; border-color: #fff; }
.hero .btn-primary:hover { background: #eef0ff; color: #312e81; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hero-meta .chip { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .22); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
.card h2 { font-size: 1.02rem; margin: 0 0 12px; letter-spacing: -.01em; }
.card h2.card-title { margin: 0; }
.card-sub { margin: 6px 0 12px; }
.phase-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) 52px; align-items: center; gap: 10px; padding: 7px 0; text-decoration: none; color: var(--text); }
.phase-row .phase-swatch { width: 12px; height: 12px; }
.phase-row .bar { margin-top: 5px; }
.phase-row:hover .pr-name { color: var(--accent-text); }
.pr-name { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-pct { font-size: .8rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.milestone { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--border); text-decoration: none; color: inherit; }
.milestone:last-child { border-bottom: 0; }
.milestone:hover .ms-text { color: var(--accent-text); }
.ms-date { flex: none; width: 64px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.ms-date span { font-weight: 600; }
.ms-text { font-size: .9rem; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .quick { grid-template-columns: 1fr; } }
.quick a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; color: var(--text); }
.quick a:hover { border-color: var(--accent); }
.quick .qi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.quick .qi svg { width: 20px; height: 20px; }
.quick .qt { display: block; font-weight: 650; font-size: .92rem; }
.quick .qd { display: block; font-size: .78rem; color: var(--muted); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-cell { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 2px; border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--text-2); font-size: .76rem; line-height: 1.3; border: 1px solid transparent; }
.day-cell b { display: block; font-size: .95rem; color: var(--text); }
.day-cell .dc-min { white-space: nowrap; }
.day-cell:hover { border-color: var(--border-strong); }
.day-cell.today { border-color: var(--accent); background: var(--accent-soft); }
.day-cell.done { background: var(--success-soft); color: var(--success); }
.day-cell.free { color: var(--muted); background: transparent; border: 1px dashed var(--border); }

/* ------------------------------------------------------------------ roadmap */
.phase-block { margin: 26px 0; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.phase-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.phase-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.01em; }
.phase-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem; flex: none; }
.week-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.week-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; text-decoration: none; color: var(--text); position: relative; transition: border-color .12s, transform .12s; }
.week-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.week-card.current { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.week-card .wc-top { display: flex; align-items: center; gap: 8px; }
.week-card .wc-n { font-size: .74rem; font-weight: 800; color: var(--muted); letter-spacing: .04em; }
.week-card .wc-title { font-weight: 700; font-size: .96rem; line-height: 1.3; }
.week-card .wc-dates { font-size: .78rem; color: var(--muted); }
.week-card.buffer { background: repeating-linear-gradient(135deg, var(--surface) 0 12px, var(--surface-2) 12px 24px); }

/* ------------------------------------------------------------------ week page */
.week-head { position: relative; overflow: hidden; padding: 22px 24px 18px; margin-bottom: 14px; }
.week-head::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--phase-color, var(--accent)); }
.week-head h1 { margin: 6px 0 8px; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
.week-head .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.week-head .wh-progress { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.week-head .wh-progress .bar { flex: 1; max-width: 360px; }
.week-nav { display: flex; gap: 8px; }

.tabs-wrap { position: sticky; top: var(--topbar-h); z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 8px 0; margin: 0 0 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); scroll-behavior: smooth; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 1 0 auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 64px; padding: 7px 12px; border-radius: 10px; text-decoration: none; color: var(--text-2); font-weight: 650; font-size: .88rem;
}
.tab small { font-size: .68rem; font-weight: 600; color: var(--muted); }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--accent); color: var(--on-accent); }
.tab.active small { color: var(--on-accent); opacity: .9; }
.tab .tdot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; }
.tab .tdot.done { background: var(--success); }
.tab .tdot.today { background: var(--today-dot); }
.tab.active .tdot { background: var(--on-accent); }

.with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 28px; align-items: start; }
.with-toc.no-toc { grid-template-columns: minmax(0, 900px); justify-content: center; }
.col-main { min-width: 0; }
@media (max-width: 1279px) { .with-toc, .with-toc.no-toc { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
.content-card { padding: 28px 34px 30px; }
.content-card.preamble { margin-bottom: 14px; padding-top: 18px; padding-bottom: 18px; }
.readable { max-width: var(--read-w); }
@media (max-width: 640px) { .content-card { padding: 18px 16px 22px; border-radius: 12px; } }
.toc { position: sticky; top: calc(var(--topbar-h) + 84px); max-height: calc(100vh - var(--topbar-h) - 110px); overflow-y: auto; font-size: .84rem; padding: 4px 0; scrollbar-width: thin; }
.toc .toc-title { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px 12px; }
.toc a { display: block; padding: 5px 12px; border-left: 2px solid var(--border); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a.lvl-3 { padding-left: 24px; }
.toc a:hover { color: var(--text); border-left-color: var(--border-strong); }
.toc a.active { color: var(--accent-text); border-left-color: var(--accent); font-weight: 650; }
.day-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 18px; padding: 16px 18px; }
.day-actions .timer-row { gap: 8px; padding-top: 12px; border-top: 1px dashed var(--border); }
.timer-row-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.day-actions .nav-row { gap: 8px; }
.notes-card { margin-top: 14px; }
.notes-card > summary { cursor: pointer; padding: 12px 16px; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notes-card > summary::-webkit-details-marker { display: none; }
.notes-card > summary .ico { color: var(--accent-text); }
.notes-card textarea.field { display: block; width: calc(100% - 32px); margin: 0 16px 6px; }   /* beats textarea.field's width: 100% */
.notes-card #note-status { padding: 0 16px 12px; min-height: 1.2em; }
.v5-summary { margin: 0 0 16px; }
.v5-summary > summary { cursor: pointer; padding: 12px 16px; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 10px; }
.v5-summary > summary .ico { width: 18px; height: 18px; color: var(--accent-text); }
.v5-summary > summary::-webkit-details-marker { display: none; }
.v5-summary > summary::after { content: "Show"; margin-left: auto; font-size: .78rem; color: var(--accent-text); font-weight: 700; }
.v5-summary[open] > summary::after { content: "Hide"; }
.v5-summary .prose { padding: 0 22px 18px; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ prose (rendered markdown) */
.prose { color: var(--text-2); font-size: 1rem; line-height: 1.72; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); line-height: 1.3; letter-spacing: -.012em; scroll-margin-top: calc(var(--topbar-h) + 70px); }
.prose h1 { font-size: 1.8rem; margin: 0 0 .8rem; }
.prose h2 { font-size: 1.5rem; margin: 2.2rem 0 .9rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.18rem; margin: 2rem 0 .7rem; }
.prose h4 { font-size: 1.02rem; margin: 1.5rem 0 .5rem; }
.prose p { margin: .75rem 0; }
.prose p.prompt-label { display: none; }
.prose p.h-sub { font-size: 1.06rem; margin: 2rem 0 .6rem; scroll-margin-top: calc(var(--topbar-h) + 70px); }
.prose p.h-sub strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.45rem; margin: .6rem 0; }
.prose li { margin: .32rem 0; }
.prose li > ul, .prose li > ol { margin: .25rem 0; }
.prose li > p { margin: .35rem 0; }
.prose strong { color: var(--text); font-weight: 680; }
.prose a { word-break: break-word; }
.prose a.xref { color: inherit; text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, var(--accent) 65%, transparent); text-decoration-thickness: 1.5px; }
.prose a.xref:hover { color: var(--accent-text); text-decoration-style: solid; }
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .86em; background: var(--code-inline-bg); color: var(--code-inline-text);
  padding: .12em .38em; border-radius: 6px; white-space: break-spaces; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.prose :is(h1, h2, h3, h4) code { color: inherit; font-size: .82em; background: var(--surface-3); }
.prose a code { color: inherit; }
.prose blockquote { margin: 1rem 0; padding: .7rem 1rem; border-left: 4px solid var(--border-strong); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--text-2); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose blockquote.callout-note { border-left-color: var(--info); background: var(--info-soft); }
.prose hr { margin: 2rem 0; }
.prose > hr:last-child { display: none; }
.prose .h-anchor { opacity: 0; margin-left: .3rem; padding: 0 .25rem; font-size: .8em; text-decoration: none; color: var(--muted); }
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor, .prose h4:hover .h-anchor, .prose .h-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .prose .h-anchor { opacity: .45; padding: 0 .5rem; } }
.lvl { display: inline-block; font-size: .72em; font-weight: 750; padding: .1em .6em; border-radius: 999px; margin-right: .4em; vertical-align: .1em; white-space: nowrap; }
.lvl-can-do-unaided { background: var(--success-soft); color: var(--success); }
.lvl-can-explain { background: var(--accent-soft); color: var(--accent-text); }
.lvl-aware-of { background: var(--surface-3); color: var(--text-2); }

/* heading accents */
.prose h3.h-learn, .prose h3.h-build, .prose h3.h-blank, .prose h3.h-dsa, .prose h3.h-career, .prose h3.h-log, .prose h3.h-drill, .prose h3.h-agent, .prose h3.h-locked, .prose h3.h-post, .prose h3.h-block {
  padding: .45rem .8rem; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--border-strong);
}
.prose h3.h-learn { border-left-color: var(--learn); }
.prose h3.h-build { border-left-color: var(--build); }
.prose h3.h-blank { border-left-color: var(--blank); }
.prose h3.h-dsa { border-left-color: var(--dsa); }
.prose h3.h-career { border-left-color: var(--career); }
.prose h3.h-log { border-left-color: var(--log); }
.prose h3.h-drill { border-left-color: var(--drill); }
.prose h3.h-agent { border-left-color: var(--build); }
.prose h3.h-locked { border-left-color: var(--danger); }
.prose h3.h-post { border-left-color: var(--career); }
.prose h3.h-block { border-left-color: var(--accent); }

/* tables (with scroll shadows when they're wider than the card) */
.table-wrap {
  overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 12px;
  background:
    linear-gradient(90deg, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .16), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .16), transparent) right / 12px 100% no-repeat scroll;
}
.prose table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.prose th, .prose td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 700; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
@media (max-width: 640px) { .prose th { white-space: normal; min-width: 6ch; } .prose table { font-size: .84rem; } }

/* code blocks */
.code-block { margin: 1rem 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px 5px 14px; background: var(--code-head); border-bottom: 1px solid var(--border); }
.code-lang { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: .76rem; font-weight: 700;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.copy-btn.copied { border-color: var(--success); color: var(--success); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: .84rem; line-height: 1.6; tab-size: 4; color: var(--text); background: transparent; }
.code-block pre code { font-family: inherit; white-space: pre; }
.code-block.wrap pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.hl { background: transparent !important; }
.code-block .hl .err { border: 0 !important; color: inherit !important; background: transparent !important; }

/* prompt cards */
.prompt-card {
  margin: 1.1rem 0; border-radius: 14px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)) 0%, var(--surface) 70%);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow-sm);
}
.prompt-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border)); }
.prompt-icon { font-size: 1.1rem; flex: none; }
.prompt-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.prompt-title { font-weight: 700; color: var(--text); font-size: .9rem; }
.prompt-sub { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.prompt-kind { font-size: .7rem; font-weight: 750; letter-spacing: .03em; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; flex: none; }
.prompt-card .copy-btn { background: var(--accent); border-color: var(--accent); color: var(--on-accent); flex: none; }
.prompt-card .copy-btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.prompt-card .copy-btn.copied { background: var(--success); border-color: var(--success); color: #fff; }
[data-theme="dark"] .prompt-card .copy-btn.copied { color: #04130a; }
.prompt-body { margin: 0; padding: 14px 16px 16px; white-space: pre-wrap; word-break: break-word; font-family: var(--font-sans); font-size: .92rem; line-height: 1.62; color: var(--text); }
.prompt-body code { font-family: inherit; }
@media (max-width: 640px) { .prompt-kind { display: none; } }

/* details (answers) */
.prose details { margin: .9rem 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.prose details > summary { cursor: pointer; padding: .6rem .9rem; font-weight: 650; color: var(--accent-text); list-style: none; display: flex; align-items: center; gap: .5rem; }
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before { content: "▸"; transition: transform .15s; display: inline-block; }
.prose details[open] > summary::before { transform: rotate(90deg); }
.prose details > :not(summary) { margin-left: .9rem; margin-right: .9rem; }
.prose details[open] { padding-bottom: .3rem; }

/* task checkboxes */
.prose ul.contains-task-list { padding-left: .2rem; list-style: none; }
.prose li.task-list-item { list-style: none; display: block; position: relative; padding-left: 2rem; border-radius: 8px; cursor: pointer; }
.prose li.task-list-item:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.prose li.task-list-item > .task-cb { position: absolute; left: .35rem; top: .28rem; }
.task-cb {
  appearance: none; -webkit-appearance: none; width: 19px; height: 19px; margin: 0; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--control-border); background: var(--surface); display: inline-grid; place-content: center; vertical-align: -3px;
  transition: background .12s, border-color .12s;
}
.task-cb::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s; }
.task-cb:checked { background: var(--success); border-color: var(--success); }
.task-cb:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
[data-theme="dark"] .task-cb::after { border-color: #04130a; }
.prose li.task-list-item.checked { color: var(--muted); }
.prose li.task-list-item.checked > :not(ul):not(ol) { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

/* callouts: the bold lead paragraph and the list that follows it read as one box */
.prose .callout { padding: .7rem 1rem; border-radius: 12px; border-left: 4px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.prose .callout:has(+ ul), .prose .callout:has(+ ol) { border-radius: 12px 12px 0 0; margin-bottom: 0; }
.prose .callout + ul, .prose .callout + ol { margin-top: 0; padding: .3rem 1rem .7rem 2.2rem; border-left: 4px solid var(--border-strong); border-radius: 0 0 12px 12px; background: var(--surface-2); }
.prose .callout + ul.contains-task-list { padding-left: .9rem; }
.prose :is(.callout-done, .callout-done + ul, .callout-done + ol) { background: var(--success-soft); border-left-color: var(--success); }
.prose :is(.callout-stuck, .callout-stuck + ul, .callout-stuck + ol) { background: var(--warn-soft); border-left-color: var(--warn); }
.prose :is(.callout-expect, .callout-expect + ul, .callout-expect + ol) { background: var(--info-soft); border-left-color: var(--info); }
.prose :is(.callout-commit, .callout-commit + ul, .callout-commit + ol) { background: var(--surface-2); border-left-color: var(--muted); }
.prose .callout-commit { font-size: .92rem; }
.prose :is(.callout-check, .callout-check + ul, .callout-check + ol) { background: color-mix(in srgb, var(--dsa) 9%, var(--surface)); border-left-color: var(--dsa); }
.prose :is(.callout-goal, .callout-goal + ul, .callout-goal + ol) { background: var(--accent-soft); border-left-color: var(--accent); color: var(--text); }
.prose :is(.callout-notes, .callout-notes + ul, .callout-notes + ol) { background: color-mix(in srgb, var(--log) 9%, var(--surface)); border-left-color: var(--log); }
.prose :is(.callout-minimum, .callout-minimum + ul, .callout-minimum + ol) { background: color-mix(in srgb, var(--career) 10%, var(--surface)); border-left-color: var(--career); }
.prose :is(.callout-pass, .callout-pass + ul, .callout-pass + ol) { background: var(--accent-soft); border-left-color: var(--accent); color: var(--text); }
.prose .callout-pass { font-weight: 600; }
.prose :is(.callout-ramp, .callout-ramp + ul, .callout-ramp + ol) { background: var(--surface-2); border-left-color: var(--build); }
.prose :is(.callout-cut, .callout-cut + ul, .callout-cut + ol) { background: var(--danger-soft); border-left-color: var(--danger); }
.prose .callout-goal + .callout-goal { margin-top: 0; border-radius: 0; }
.time-badge {
  display: inline-block; padding: .08em .55em; margin-right: .3em; border-radius: 999px; font-size: .78em; font-weight: 750;
  background: var(--accent-soft); color: var(--accent-text); vertical-align: .08em; white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ prompt library */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 16px; }
.filter-chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.filter-chip:hover { border-color: var(--accent); }
.filter-chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filter-chip .n { opacity: .85; font-weight: 600; margin-left: 4px; }
.field { height: 40px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 12px; font-size: .92rem; }
.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
textarea.field { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 84px; width: 100%; font-family: var(--font-sans); }
textarea.field.mono { font-family: var(--font-mono); font-size: .8rem; }
.prompt-list { display: grid; gap: 12px; max-width: 920px; }
.pl-item { padding: 0; overflow: hidden; }
.pl-item .prompt-card { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.pl-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); padding: 8px 14px 0; }
.pl-meta .pl-kind { display: none; }
.pl-item .prompt-body.clamp { max-height: 15.5em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.pl-foot { display: flex; gap: 8px; padding: 0 14px 12px; }
.more-row { text-align: center; margin-top: 16px; max-width: 920px; }
@media (max-width: 640px) {
  .pl-meta .pl-kind { display: inline-flex; }
  .chip-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; scroll-snap-type: x proximity; }
  .chip-scroll::-webkit-scrollbar { display: none; }
  .chip-scroll > * { flex: none; scroll-snap-align: start; }
}

/* ------------------------------------------------------------------ settings / logs */
.form-grid { display: grid; gap: 20px; max-width: 760px; }
.form-row > label, .form-row > .label { display: block; font-weight: 650; font-size: .92rem; margin-bottom: 6px; }
.form-row .check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.form-row .check-row input { width: 18px; height: 18px; }
.form-row .hint { font-size: .82rem; color: var(--muted); margin-top: 8px; max-width: 70ch; }
.settings-card { margin-top: 16px; }
.settings-card h2 { margin-top: 0; }
.code-transfer { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.code-transfer > summary { cursor: pointer; font-weight: 650; font-size: .9rem; color: var(--accent-text); }
.code-transfer textarea { margin: 6px 0 10px; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 650; font-size: .86rem; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.log-card { padding: 18px 20px; margin-top: 18px; }
.log-card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.log-card > p { margin: 0; }
.log-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 700px) { .log-grid { grid-template-columns: 1fr; } }
.log-grid label { font-size: .82rem; font-weight: 700; color: var(--text-2); display: block; margin-bottom: 4px; }
.log-actions { margin-top: 12px; }
.log-row { text-decoration: none; color: inherit; }
.log-row:hover { border-color: var(--accent); }
.log-row .small { margin-top: 8px; }

/* ------------------------------------------------------------------ timer */
.timer-fab {
  position: fixed; right: calc(18px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 45;
  height: 52px; min-width: 52px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-weight: 750; box-shadow: var(--shadow-lg); font-variant-numeric: tabular-nums;
}
.timer-fab svg { width: 22px; height: 22px; }
.timer-fab.idle { padding: 0; }
.timer-fab.running { background: #0f766e; color: #fff; }
.timer-fab.ended { background: var(--danger); color: #fff; animation: pulse 1.2s ease-in-out 4; }
[data-theme="dark"] .timer-fab.ended { color: #1a0509; }
.timer-fab .t-x { width: 16px; height: 16px; opacity: .85; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.timer-panel {
  position: fixed; right: calc(18px + env(safe-area-inset-right)); bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 46; width: min(340px, calc(100vw - 36px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 16px;
}
.timer-title { margin: 0 0 2px; font-size: 1rem; }
.timer-display { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; text-align: center; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.timer-label { text-align: center; color: var(--muted); font-size: .84rem; min-height: 1.2em; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.presets button { height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: .84rem; }
.presets button:hover { border-color: var(--accent); }
.timer-controls { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.timer-panel .t-min { width: 84px; }
.timer-panel #t-notify { margin-top: 8px; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
[data-theme="dark"] .toast { background: #e7eaf1; color: #0b0e1a; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ misc pages */
.strategy-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 10px 0 24px; }
.strategy-list a { padding: 14px 16px; text-decoration: none; color: var(--text); font-weight: 650; font-size: .93rem; display: flex; gap: 10px; align-items: flex-start; }
.strategy-list a:hover { border-color: var(--accent); }
.strategy-list .sl-k { flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: .8rem; font-weight: 800; }
.kbd-help { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; align-items: center; }
.footer-note { margin-top: 28px; font-size: .8rem; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ dark-mode contrast fixes */
[data-theme="dark"] .prompt-card .copy-btn:hover { color: #0b0e1a; }

/* ------------------------------------------------------------------ touch devices */
@media (hover: none) { .kbd-card, .search kbd { display: none; } }
@media (max-width: 1023px), (pointer: coarse) {
  .search input, .field, textarea.field, select.field { font-size: max(16px, 1rem); }     /* no iOS zoom on focus */
}
@media (pointer: coarse) {
  .icon-btn { height: 44px; min-width: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { height: 40px; }
  .copy-btn { height: 36px; padding: 0 14px; }
  .filter-chip { padding: 10px 14px; }
  .seg button { padding: 11px 16px; }
  .presets button { height: 44px; }
  .nav-link { padding: 11px 12px; }
  .phase-group > summary { padding: 12px; }
  .crumbs a, .pl-meta a { display: inline-block; padding: 8px 0; }
  .task-cb { width: 24px; height: 24px; }
  .prose li.task-list-item { padding-left: 2.4rem; }
  .prose li.task-list-item > .task-cb { top: .15rem; }
}

/* ------------------------------------------------------------------ phones */
@media (max-width: 640px) {
  .page-title { font-size: 1.5rem; }
  .week-head { padding: 14px 16px 12px; }
  .week-head h1 { font-size: 1.3rem; margin: 4px 0 6px; }
  .week-head .meta { margin-bottom: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .week-head .meta::-webkit-scrollbar { display: none; }
  .week-head .meta .chip.accent { display: none; }
  .week-head .wh-row { gap: 8px; }
  .week-head .wh-progress { min-width: 0; flex: 1 1 100%; }
  .week-head .week-nav, .week-head #week-done-btn { display: none; }      /* the tabs and the bottom nav cover these on phones */
  .tabs-wrap { padding: 4px 0; margin-bottom: 10px; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .tab { min-width: 54px; padding: 5px 10px; }
  .tab small { font-size: .62rem; }
  .day-cell { font-size: .68rem; padding: 6px 1px; }
  .day-cell b { font-size: .92rem; }
  .hero { padding: 20px 18px; }
  .hero .btn-lg { height: 44px; padding: 0 16px; font-size: .95rem; }
  .banner { padding: 12px 14px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .timer-fab:not(.running):not(.ended) { height: 44px; min-width: 44px; opacity: .92; }
  body:not([data-route="week"]):not([data-route="buffers"]):not([data-route="home"]) .timer-fab.idle { display: none; }
  .page-sub { font-size: .92rem; }
  .day-actions { padding: 14px; }
}

/* ------------------------------------------------------------------ motion + print */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .sidebar, .tabs-wrap, .toc, .timer-fab, .timer-panel, .day-actions, .notes-card, .copy-btn, .week-nav, .scrim, .toast, .skip-link, .banner { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; }
  .content-card { padding: 0; }
  .prose details > :not(summary) { display: block !important; }
  .code-block, .prompt-card { break-inside: avoid; }
  .code-block pre code { white-space: pre-wrap; }
}

/* =============================================================================================
   Identity pass — "test run": pine pass-colour, Charter for reading, flat bordered surfaces,
   no tracked-caps labels; the one bold element is the run-history matrix on the dashboard.
   ============================================================================================= */
.eyebrow { text-transform: none; letter-spacing: 0; font-size: .86rem; font-weight: 650; color: var(--accent-text); }
.page > .eyebrow { display: none; }                         /* the page title already says where you are */
.nav-heading, .toc .toc-title { text-transform: none; letter-spacing: 0; font-size: .8rem; font-weight: 700; color: var(--muted); }
.code-lang { font-family: var(--font-sans); text-transform: none; letter-spacing: 0; font-size: .76rem; font-weight: 650; }
.week-card .wc-n { letter-spacing: 0; }
.card { box-shadow: none; }
.btn { border-radius: 8px; }
.btn-lg { border-radius: 10px; }
.tabs { border-radius: 10px; }
.tab { border-radius: 7px; }

/* reading */
.prose { font-family: var(--font-read); font-size: 1.07rem; line-height: 1.7; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose summary, .prose .callout strong:first-child, .prose table, .prose .time-badge, .prose .lvl { font-family: var(--font-sans); }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote, .prose details > p, .prose li > p { max-width: 72ch; }
.prose .prompt-body { font-family: var(--font-sans); }
.prose h2 { border-bottom: 0; padding-bottom: 0; letter-spacing: -.02em; }
.prose h3.h-learn, .prose h3.h-build, .prose h3.h-blank, .prose h3.h-dsa, .prose h3.h-career, .prose h3.h-log, .prose h3.h-drill, .prose h3.h-agent, .prose h3.h-locked, .prose h3.h-post, .prose h3.h-block {
  background: transparent; border-radius: 0; padding: .1rem 0 .1rem .8rem;
}

/* hero: tonight's session, quiet — no gradient wash */
.hero { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 6px solid var(--accent); box-shadow: none; border-radius: var(--radius); }
.hero .eyebrow { color: var(--accent-text); }
.hero h1 { color: var(--text); font-size: clamp(1.5rem, 2.6vw, 2.15rem); }
.hero p { color: var(--text-2); }
.hero .btn { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.hero .btn:hover { background: var(--surface-2); }
.hero .btn-primary, .hero .btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hero .btn-primary:hover { background: var(--accent-hover); }
.hero-meta .chip { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }

/* run history: the plan as a CI build-history matrix */
.run-matrix { padding: 18px 20px 16px; margin: 16px 0; }
.rm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.rm-head h2 { margin: 0; font-size: 1.05rem; }
.rm-summary { margin: 0; color: var(--text-2); font-size: .9rem; }
.rm-summary b { color: var(--text); }
.rm-health { font-weight: 700; }
.rm-health.good { color: var(--success); }
.rm-health.warn { color: var(--warn); }
.rm-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; align-items: start; }
.rm-col { display: grid; grid-template-rows: repeat(7, auto) 14px; gap: 3px; text-decoration: none; border-radius: 4px; padding: 2px 1px 0; position: relative; }
.rm-col:hover { background: var(--surface-2); }
.rm-col.rm-cp::before { content: ""; position: absolute; left: 50%; top: -7px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.rm-cell, .rm-legend i { display: block; width: 100%; aspect-ratio: 1; border-radius: 2px; }
.rm-pass { background: var(--success); }
.rm-miss { background: transparent; box-shadow: inset 0 0 0 1.5px var(--warn); }
.rm-future { background: var(--surface-3); }
.rm-free { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); opacity: .7; }
.rm-today { outline: 2px solid var(--text); outline-offset: 1px; }
.rm-wk { font-size: .62rem; line-height: 14px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.rm-buffer { width: 6px; justify-self: center; margin-top: 2px; height: calc(100% - 16px); background: repeating-linear-gradient(180deg, var(--border-strong) 0 3px, transparent 3px 6px); border-radius: 3px; padding: 0; }
.rm-buffer.rm-now { background: var(--accent); }
.rm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: .78rem; color: var(--muted); }
.rm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rm-legend i { width: 11px; height: 11px; }
.rm-legend .rm-buf { width: 5px; height: 11px; background: repeating-linear-gradient(180deg, var(--border-strong) 0 3px, transparent 3px 5px); }
.rm-cp-key::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
@media (max-width: 640px) {
  .run-matrix { padding: 14px 12px; }
  .rm-grid, .rm-col { gap: 2px; }
  .rm-wk { font-size: .55rem; }
}

/* polish pass */
.pg-n { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .15em; }
.nav-link.active .pg-n, .phase-row:hover .pg-n { color: inherit; }
.log-week { font-size: .86rem; font-weight: 650; color: var(--accent-text); }
.hero .eyebrow { font-weight: 600; color: var(--muted); }
.hero h1 { letter-spacing: -.025em; }
.brand-logo { border-radius: 8px; }
.timer-fab.running { background: var(--text); color: var(--surface); }
@media (max-width: 640px) {
  .rm-grid { grid-auto-columns: 14px; overflow-x: auto; padding: 8px 2px 4px; scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
  .rm-grid .rm-col { padding-left: 0; padding-right: 0; }
}

/* critique fixes: one colour story (pine = pass/accent, amber = behind), quiet code, flat components */
:root {
  --code-inline-text: var(--text);
  --learn: var(--border-strong); --blank: var(--text); --dsa: var(--muted); --drill: var(--muted); --log: var(--muted); --career: var(--muted);
  --info: var(--muted); --info-soft: var(--surface-2);
}
[data-theme="dark"] { --warn: #e0954a; --today-dot: var(--text); }
.search-results { grid-template-columns: minmax(0, 1fr); }
.sr-card { min-width: 0; overflow-wrap: anywhere; }
.phase-swatch { display: none; }
.phase-row { grid-template-columns: minmax(0, 1fr) 52px; }
.phase-num { background: var(--surface) !important; color: var(--text); border: 1px solid var(--border-strong); width: auto; min-width: 34px; padding: 0 6px; }
.week-head::before { background: var(--accent); }
.week-head[style*="--p-1"]::before { background: var(--border-strong); }
.tab .tdot.today { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text); }
.tab.active .tdot.today { background: transparent; box-shadow: inset 0 0 0 1.5px var(--on-accent); }
mark, [data-theme="dark"] mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; box-shadow: inset 0 -2px 0 var(--accent); }
/* code: ink with pine keywords and muted comments, in both themes (beats code.css's stock palettes) */
:root .code-block .hl span { color: var(--text); font-weight: 400; font-style: normal; }
:root .code-block .hl :is(.c, .ch, .cm, .c1, .cs, .cpf, .cp) { color: var(--muted); font-style: italic; }
:root .code-block .hl :is(.k, .kn, .kd, .kc, .kr, .kt, .ow, .gh, .gu, .nt, .nf, .fm) { color: var(--accent-text); font-weight: 600; }
:root .code-block .hl :is(.s, .s1, .s2, .sb, .sd, .sh, .se, .sa, .si) { color: var(--text-2); }
/* prompt cards and copy buttons use the interface face, flat like everything else */
.prose :is(.prompt-head, .code-head, .copy-btn) { font-family: var(--font-sans); }
.prompt-card { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius); box-shadow: none; }
.prompt-head { border-bottom-color: var(--border); background: var(--accent-soft); }
.with-toc.no-toc { justify-content: start; }
#kind-filters, #kind-filters + .filters { max-width: 920px; }
.timer-fab { box-shadow: none; border: 1px solid color-mix(in srgb, var(--text) 20%, var(--accent)); }
.timer-fab.idle { height: 44px; min-width: 44px; }
.toc { padding-bottom: 64px; }
.ms-date { text-transform: none; }
[data-theme="dark"] .seg button.on { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
@media (max-width: 640px) {
  .seg { display: flex; flex-wrap: nowrap; }
  .seg button { flex: 1 1 0; min-width: 0; padding-inline: 6px; }
  .chip-scroll { scroll-padding-inline: 16px; }
  .filters select.field { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  body:not([data-route="week"]):not([data-route="buffers"]) .timer-fab.idle { display: none; }
}
