/* =================================================================================================
   C++ Prep — dark, mobile-first UI
   Phone  (< 1024px): top tab bar, stacked panels, sticky search, full-screen reader & bottom sheets
   Laptop (≥ 1024px): brand + pill tabs, sticky sidebar (stats / filters / TOC) + wide content column
   ================================================================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #0a0e16;
  --bg-2: #0d121c;
  --surface: #111827;
  --surface-2: #161f30;
  --surface-3: #1d283d;
  --elev: #1a2334;
  --border: rgba(148, 163, 184, 0.13);
  --border-2: rgba(148, 163, 184, 0.24);
  --text: #e8edf6;
  --text-2: #b4bdcd;
  --text-3: #7f8aa0;

  --accent: #7aa2ff;
  --accent-2: #a78bfa;
  --accent-ink: #0a1024;
  --accent-soft: rgba(122, 162, 255, 0.13);
  --accent-line: rgba(122, 162, 255, 0.42);
  --green: #34d399;
  --green-ink: #052e1f;
  --green-soft: rgba(52, 211, 153, 0.12);
  --green-line: rgba(52, 211, 153, 0.45);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --amber-line: rgba(251, 191, 36, 0.45);
  --red: #f87171;
  --red-ink: #2a0808;
  --red-soft: rgba(248, 113, 113, 0.11);
  --red-line: rgba(248, 113, 113, 0.48);
  --code-bg: #0b111d;

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

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --maxw: 1400px;
  --gutter: 16px;
  --hdr: 58px;
  --fs-read: 16.5px;
  --ring-a: var(--accent);
  --ring-b: var(--accent-2);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}
:root[data-fs="s"] { --fs-read: 15px; }
:root[data-fs="m"] { --fs-read: 16.5px; }
:root[data-fs="l"] { --fs-read: 18px; }
:root[data-fs="xl"] { --fs-read: 19.5px; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr) + 80px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 8% -12%, rgba(122, 162, 255, 0.11), transparent 62%),
    radial-gradient(800px 480px at 105% 0%, rgba(167, 139, 250, 0.08), transparent 60%),
    radial-gradient(700px 500px at 50% 115%, rgba(52, 211, 153, 0.04), transparent 60%);
}
body.no-scroll { overflow: hidden; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
a { color: var(--accent); }
::selection { background: rgba(122, 162, 255, 0.35); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border-2); border-bottom-width: 2px; background: var(--surface-2);
  font: 600 0.78em/1.5 var(--mono); color: var(--text-2); text-align: center;
}
code { font-family: var(--mono); }
mark { background: rgba(251, 191, 36, 0.3); color: #fff4d6; border-radius: 3px; padding: 0 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 10px; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; }
.noscript, .fatal { max-width: 560px; margin: 60px auto; padding: 28px; text-align: center; color: var(--text-2); }
.fatal .ic { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--amber); }
.fatal code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

@media (min-width: 1024px) { .mobile-only { display: none !important; } }
@media (max-width: 1023.98px) { .desktop-only { display: none !important; } }

/* ---------- App bar & tabs ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: rgba(10, 14, 22, 0.86);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.appbar-inner {
  display: flex; align-items: center; gap: 4px;
  max-width: var(--maxw); margin: 0 auto;
  height: 60px;
  padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
}
.brand { display: none; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand img { border-radius: 9px; box-shadow: 0 6px 18px -6px rgba(122, 162, 255, 0.55); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 16px; letter-spacing: -0.01em; }
.brand-text small { font-size: 11.5px; color: var(--text-3); font-weight: 600; }

.tabs { position: relative; display: flex; flex: 1; min-width: 0; height: 100%; }
.tab {
  position: relative; z-index: 1; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 5px 1px 7px; border: 0; background: none; cursor: pointer;
  color: #8b96ab; font: 650 11px/1 var(--font); letter-spacing: 0.01em;
  transition: color 0.2s;
}
/* Phone: the active tab's icon sits in a glowing pill (clear at a glance, easy to thumb). */
.tab-ic {
  display: grid; place-items: center; width: 50px; height: 28px; border-radius: 999px;
  transition: background 0.28s var(--ease), box-shadow 0.28s var(--ease), transform 0.2s var(--ease);
}
.tab .ic { width: 20px; height: 20px; transition: color 0.2s, transform 0.25s var(--ease); }
.tab:hover { color: var(--text-2); }
.tab:active .tab-ic { transform: scale(0.93); }
.tab.active { color: #fff; }
.tab.active .lbl-short { font-weight: 800; }
.tab.active .tab-ic {
  background: linear-gradient(135deg, rgba(122, 162, 255, 0.34), rgba(167, 139, 250, 0.28));
  box-shadow: inset 0 0 0 1px rgba(160, 188, 255, 0.45), 0 6px 16px -6px rgba(122, 162, 255, 0.85);
}
.tab.active .ic { color: #eef3ff; }
.tab .lbl-long, .tab .tab-badge { display: none; }
.lbl-short { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-ink {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0; display: none;
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
  pointer-events: none;
}
.tab-ink::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 34px; height: 3px; transform: translateX(-50%);
  border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(122, 162, 255, 0.6);
}
.appbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.appbar .install-btn { display: none; }

@media (min-width: 640px) {
  .tab { flex-direction: row; gap: 8px; font-size: 13.5px; border-radius: 10px; }
  .tab .ic { width: 18px; height: 18px; }
  .tab-ic, .tab.active .tab-ic { width: auto; height: auto; background: none; box-shadow: none; }
  .tab.active { background: rgba(122, 162, 255, 0.1); }
  .tab.active .ic { color: var(--accent); }
  .tab-ink { display: block; }
  .tab-ink::after { width: 60%; }
}
@media (min-width: 1024px) {
  .appbar-inner { height: 66px; gap: 20px; padding: 0 28px; }
  .brand { display: flex; }
  .tabs {
    flex: none; height: 46px; margin: 0 auto; padding: 4px;
    background: rgba(17, 24, 39, 0.7); border: 1px solid var(--border); border-radius: 14px;
  }
  .tab { flex: none; padding: 0 14px; border-radius: 10px; font-size: 14px; gap: 8px; color: #93a0b6; }
  .tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
  .tab.active, .tab.active:hover { background: transparent; color: #fff; }
  .tab.active .ic { color: #cddcff; }
  .tab .tab-badge:not([hidden]) {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px;
    background: rgba(255, 255, 255, 0.06); color: var(--text-3); font: 650 11px var(--mono);
  }
  .tab.active .tab-badge { background: rgba(255, 255, 255, 0.16); color: #fff; }
  /* Laptop: the active tab is a gradient pill that glides between tabs. */
  .tab-ink {
    top: 4px; bottom: 4px; height: auto; border-radius: 10px;
    background: linear-gradient(135deg, rgba(122, 162, 255, 0.34), rgba(167, 139, 250, 0.28));
    box-shadow: inset 0 0 0 1px rgba(160, 188, 255, 0.45), 0 8px 22px -10px rgba(122, 162, 255, 0.95);
  }
  .tab-ink::after { display: none; }
  .appbar .install-btn:not([hidden]) { display: inline-flex; }
}
/* Five tabs: full names only where there is room for them. */
@media (min-width: 1440px) {
  .tab { padding: 0 16px; gap: 9px; }
  .tab .lbl-short { display: none; }
  .tab .lbl-long { display: inline; }
}

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) calc(110px + env(safe-area-inset-bottom)); outline: none; }
.view.active { animation: viewIn 0.28s var(--ease); }
.layout { display: block; }
.pane-main { min-width: 0; }
.hero { padding: 18px 0 10px; }
.hero h1 { margin: 0; font-size: 21px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 750; }
.hero p { margin: 4px 0 0; color: var(--text-3); font-size: 13.5px; }

@media (min-width: 1024px) {
  main { padding: 0 28px 72px; }
  .layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
  .layout-concepts { grid-template-columns: 340px minmax(0, 1fr); }
  .pane-side {
    position: sticky; top: var(--hdr);
    max-height: calc(100vh - var(--hdr)); max-height: calc(100dvh - var(--hdr));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 6px 6px 28px 2px; margin-right: -6px;
    scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
  }
  .pane-main { padding-top: 14px; }
  .hero { padding: 22px 0 14px; }
  .hero h1 { font-size: 23px; }
}
@media (min-width: 1280px) {
  .layout { grid-template-columns: 320px minmax(0, 1fr); gap: 40px; }
  .layout-concepts { grid-template-columns: 360px minmax(0, 1fr); }
}

/* Toolbar (sticky search) */
.toolbar {
  position: sticky; top: var(--hdr); z-index: 30;
  margin: 0 calc(-1 * var(--gutter)); padding: 10px var(--gutter);
  background: rgba(10, 14, 22, 0.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.toolbar-row { display: flex; gap: 10px; align-items: center; }
.toolbar-row .search { flex: 1; min-width: 0; }
@media (min-width: 1024px) {
  .toolbar { margin: 0; padding: 10px 0 12px; background: linear-gradient(var(--bg) 78%, rgba(10, 14, 22, 0)); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .pane-side .toolbar { top: -6px; padding-top: 12px; }
}

/* Search box */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px;
  color: var(--text-3); cursor: text; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-2); color: var(--accent); }
.search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none;
  color: var(--text); font-size: 16px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd { display: none; }
.search-clear { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--text-3); cursor: pointer; }
.search-clear:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
@media (min-width: 1024px) {
  .search { height: 46px; }
  .search input { font-size: 15px; }
  .search-kbd { display: inline-block; margin-right: 6px; }
  .search:focus-within .search-kbd, .search-clear:not([hidden]) ~ .search-kbd { display: none; }
}
.search-clear:not([hidden]) + .search-kbd { display: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.chips-scroll {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 2px; scroll-padding: 0 var(--gutter);
}
.chips-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 1024px) { .chips-scroll { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding: 0; } }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-2); font: 600 13px var(--font); white-space: nowrap; cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: #d7e3ff; }
.chip .n { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); color: var(--text-3); font: 650 11px/1.6 var(--mono); text-align: center; }
.chip[aria-pressed="true"] .n { background: rgba(122, 162, 255, 0.2); color: #cbdcff; }
.chip-wrong[aria-pressed="true"] { background: var(--red-soft); border-color: var(--red-line); color: #fecaca; }
.chip-correct[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green-line); color: #a7f3d0; }
.chip-bookmarked[aria-pressed="true"] { background: var(--amber-soft); border-color: var(--amber-line); color: #fde68a; }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-2); flex: none; }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: none;
  color: var(--text-3); font: 650 13px var(--font); cursor: pointer; transition: background 0.18s, color 0.18s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.seg-diff .s-easy[aria-pressed="true"] { color: #6ee7b7; background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green-line); }
.seg-diff .s-medium[aria-pressed="true"] { color: #fcd34d; background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-line); }
.seg-diff .s-hard[aria-pressed="true"] { color: #fca5a5; background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-line); }
.seg-mode button { height: 40px; }
@media (max-width: 480px) { .seg-mode span { display: none; } .seg-mode button { padding: 0 11px; } }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--text-2); font: 600 13.5px var(--font); white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 42px; height: 25px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-2); transition: background 0.2s, border-color 0.2s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #93a0b8; transition: transform 0.25s var(--ease), background 0.2s; }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(17px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font: 650 14px var(--font);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s, box-shadow 0.18s, filter 0.18s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, #7aa2ff, #9d8bff); color: var(--accent-ink); box-shadow: 0 10px 24px -12px rgba(122, 162, 255, 0.8); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-soft { background: var(--accent-soft); color: #d2e0ff; border-color: var(--accent-line); }
.btn-soft:hover { background: rgba(122, 162, 255, 0.2); }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn-danger { background: var(--red); color: var(--red-ink); }
.btn-danger-soft { background: var(--red-soft); color: #fecaca; border-color: var(--red-line); }
.btn-danger-soft:hover { background: rgba(248, 113, 113, 0.18); }
.btn-sm { height: 36px; padding: 0 13px; border-radius: 10px; font-size: 13px; gap: 7px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.icon-btn { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn .ic { width: 21px; height: 21px; }
.menu-btn { color: var(--text-2); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--accent); font: 650 13px var(--font); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn .ic { width: 15px; height: 15px; }
.results-line { margin: 0 0 12px; color: var(--text-3); font-size: 13px; }
.results-line b { color: var(--text-2); }

/* ---------- Stat cards / rings / bars ---------- */
.stat-card {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
  padding: 14px; margin-bottom: 12px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(122, 162, 255, 0.09), rgba(167, 139, 250, 0.04) 45%, transparent 80%), var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.stat-row { display: flex; align-items: center; gap: 14px; width: 100%; }
.stat-text { min-width: 0; flex: 1; }
.stat-big { display: flex; align-items: baseline; gap: 4px; }
.stat-big b { font-size: 28px; line-height: 1; font-weight: 800; letter-spacing: -0.02em; }
.stat-big span { color: var(--text-3); font-weight: 650; font-size: 15px; }
.stat-label { margin-top: 3px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.ring { position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: rgba(148, 163, 184, 0.14); }
.ring-bar { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font: 750 13px var(--mono); color: var(--text); }
.ring-d { --ring-a: #34d399; --ring-b: #7aa2ff; }
.ring-m { --ring-a: #34d399; --ring-b: #a3e635; }
.bar { position: relative; width: 100%; height: 8px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.6s var(--ease); }
.d-stat .bar > span { background: linear-gradient(90deg, #34d399, #7aa2ff); }
.bar-split > span { border-radius: 0; }
.bar-split .sb-ok { background: var(--green); }
.bar-split .sb-bad { background: var(--red); }
.c-stat .stat-imp { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 6px 10px; border-radius: 10px; background: var(--amber-soft); color: #fcd34d; font-size: 12px; font-weight: 650; }
.c-stat .stat-imp .ic { width: 14px; height: 14px; }
.c-stat .stat-imp b { font: 750 13px var(--mono); }
.c-stat .stat-imp span { color: rgba(252, 211, 77, 0.75); }
.diff-break { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.db { display: grid; grid-template-columns: 1fr auto; gap: 5px 6px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); }
.db-name { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--text-2); }
.db .dot { width: 7px; height: 7px; border-radius: 50%; }
.db-num { font: 700 12px var(--mono); color: var(--text); }
.mini-bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: 99px; transition: width 0.6s var(--ease); }
@media (min-width: 1024px) {
  /* Narrow sidebar: one row per difficulty — name · bar · count */
  .diff-break { grid-template-columns: 1fr; gap: 6px; }
  .db { grid-template-columns: 78px 1fr 44px; gap: 10px; padding: 7px 10px; }
  .db .mini-bar { grid-column: auto; order: 2; }
  .db .db-num { order: 3; text-align: right; }
}
.db-easy .dot, .db-easy .mini-bar span { background: var(--green); }
.db-medium .dot, .db-medium .mini-bar span { background: var(--amber); }
.db-hard .dot, .db-hard .mini-bar span { background: var(--red); }
.m-score .score-line { font-size: 15px; color: var(--text-2); font-weight: 600; }
.m-score .score-line b { font: 800 24px/1 var(--font); color: var(--text); letter-spacing: -0.02em; display: inline-block; }
.m-score .score-line b.ok { color: var(--green); }
.m-score .sep { color: var(--text-3); margin: 0 4px; font-weight: 400; }
.bump { animation: bump 0.45s var(--ease); }

/* Side navigation (desktop) */
.side-nav { margin-top: 6px; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 14px 4px 8px; color: var(--text-3); font: 750 11.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; }
.side-head small { font-size: 10.5px; letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
.side-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; width: 100%;
  padding: 9px 10px; margin-bottom: 2px; border: 1px solid transparent; border-radius: 11px; background: none;
  color: var(--text-2); font: 600 13.5px/1.35 var(--font); text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.side-row:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.side-row.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.sr-num { min-width: 26px; height: 24px; padding: 0 5px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); color: var(--text-3); font: 700 11.5px var(--mono); }
.sr-num .ic { width: 14px; height: 14px; }
.side-row.active .sr-num { background: rgba(122, 162, 255, 0.2); color: var(--accent); }
.sr-title { min-width: 0; }
.sr-count { font: 650 11.5px var(--mono); color: var(--text-3); white-space: nowrap; }
.sr-count.full { color: var(--green); }
#m-topics .side-row { grid-template-columns: 1fr auto; }
.sr-bar { grid-column: 1 / -1; display: flex; height: 3px; border-radius: 99px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.sr-bar .ok { background: var(--green); }
.sr-bar .bad { background: var(--red); }
.side-tip { display: flex; gap: 8px; align-items: flex-start; margin: 14px 2px 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.side-tip .ic { width: 15px; height: 15px; margin-top: 2px; }
.side-tip span .ic { display: inline; vertical-align: -2px; width: 14px; height: 14px; }

/* Empty states */
.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty-ic { width: 56px; height: 56px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.empty-ic .ic { width: 26px; height: 26px; }
.empty-ic.big { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(135deg, rgba(122, 162, 255, 0.18), rgba(167, 139, 250, 0.12)); color: var(--accent); }
.empty-ic.big .ic { width: 32px; height: 32px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty p { max-width: 440px; margin: 0 auto 16px; font-size: 14px; line-height: 1.6; }
.empty-hero { padding: 40px 20px 50px; border: 1px dashed var(--border-2); border-radius: 20px; background: rgba(17, 24, 39, 0.5); }

/* =================================================================================================
   Tab 1 — Concepts
   ================================================================================================= */
.c-stat { flex-wrap: nowrap; }
.continue-card {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin: 0 0 12px;
  border: 1px solid var(--accent-line); border-radius: 14px; cursor: pointer; text-align: left; color: var(--text);
  background: linear-gradient(120deg, rgba(122, 162, 255, 0.14), rgba(167, 139, 250, 0.08));
}
.cc-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; background: rgba(122, 162, 255, 0.18); color: var(--accent); }
.cc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cc-text small { color: var(--text-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cc-text b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card > .ic { color: var(--text-3); }

.toc .results-line { margin-top: 2px; }
.toc-sec { margin-bottom: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.toc-sec-head {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 13px 14px; border: 0; background: none;
  color: var(--text); font: 700 15px/1.3 var(--font); text-align: left; cursor: pointer;
}
.toc-sec-head:hover { background: rgba(255, 255, 255, 0.025); }
.sec-num { flex: none; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font: 750 13px var(--mono); }
.toc-sec.practice .sec-num { background: rgba(167, 139, 250, 0.14); color: var(--accent-2); }
.sec-title { flex: 1; min-width: 0; }
.sec-prog { flex: none; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-3); font: 650 11.5px var(--mono); }
.sec-prog.full { background: var(--green-soft); color: var(--green); }
.toc-sec-head .chev { color: var(--text-3); transition: transform 0.28s var(--ease); }
.toc-sec.collapsed .chev { transform: rotate(-90deg); }
.toc-list-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.3s var(--ease); }
.toc-sec.collapsed .toc-list-wrap { grid-template-rows: 0fr; }
.toc-list { min-height: 0; overflow: hidden; border-top: 1px solid var(--border); transition: border-color 0.3s; }
.toc-sec.collapsed .toc-list { border-top-color: transparent; }
.star-s { margin-left: 6px; color: var(--amber); font-size: 0.85em; }

.toc-row { position: relative; display: flex; align-items: center; gap: 2px; padding: 0 10px 0 4px; transition: background 0.15s; }
.toc-row + .toc-row { border-top: 1px solid rgba(148, 163, 184, 0.07); }
.toc-row:hover { background: rgba(255, 255, 255, 0.025); }
.toc-row.active { background: var(--accent-soft); }
.toc-row.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.tt-check { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.tt-check .ic {
  box-sizing: border-box; width: 24px; height: 24px; padding: 4px; border-radius: 50%;
  border: 2px solid var(--border-2); color: transparent; stroke-width: 3.4;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.tt-check:hover .ic { border-color: var(--green); }
.tt-check[aria-pressed="true"] .ic { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.tt-file { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent-2); }
.tt-file .ic { width: 18px; height: 18px; }
.tt-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 11px 6px;
  border: 0; background: none; color: var(--text-2); text-align: left; cursor: pointer; font: 550 14.5px/1.4 var(--font);
}
.tt-open:hover, .toc-row.active .tt-open { color: var(--text); }
.tt-title { display: block; }
.tt-num { margin-right: 8px; color: var(--text-3); font: 650 12px var(--mono); }
.toc-row.revised .tt-title > span:not(.tt-num):not(.star-s) { color: var(--text-3); }
.toc-row.revised.active .tt-title > span:not(.tt-num):not(.star-s) { color: var(--text-2); }
.tt-tag { color: var(--accent-2); font-size: 11.5px; font-weight: 650; }
.tt-snip { color: var(--text-3); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt-min { flex: none; color: var(--text-3); font: 600 11px var(--mono); opacity: 0.75; }

/* Reader */
.reader-bar, .reader-dock { display: none; }
.r-progress { position: sticky; top: 0; z-index: 4; height: 3px; margin-bottom: -3px; pointer-events: none; }
.r-progress span { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px rgba(122, 162, 255, 0.6); transition: transform 0.12s linear; }
.r-crumb { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.r-intro { color: var(--text-3); font-weight: 500; }
.r-title { margin: 6px 0 12px; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
.r-num { margin-right: 10px; color: var(--text-3); font: 700 0.72em var(--mono); vertical-align: 0.12em; }
.r-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.pill .ic { width: 14px; height: 14px; }
.pill-star { color: #fcd34d; background: var(--amber-soft); border-color: var(--amber-line); }
.revise-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px 0 12px;
  border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  font: 700 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.12s;
}
.revise-btn .ic { width: 19px; height: 19px; }
.revise-btn:hover { border-color: var(--green-line); color: var(--text); }
.revise-btn:active { transform: scale(0.97); }
.revise-btn.on { background: var(--green-soft); border-color: var(--green-line); color: #6ee7b7; }
.r-revise-top { margin-left: auto; }
.r-end { margin-top: 34px; display: grid; gap: 16px; }
.r-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: var(--radius); border: 1px dashed var(--border-2); background: rgba(17, 24, 39, 0.6); color: var(--text-2); font-weight: 600; }
.r-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.pager:hover { border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-1px); }
.pager.next { text-align: right; align-items: flex-end; }
.pg-dir { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 12.5px; font-weight: 700; }
.pg-title { max-width: 100%; font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1023.98px) {
  .reader {
    position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
    background: var(--bg); transform: translateX(104%); visibility: hidden;
    transition: transform 0.34s var(--ease), visibility 0s linear 0.34s;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  }
  .reader.open { transform: none; visibility: visible; transition: transform 0.34s var(--ease); }
  .reader-bar {
    display: flex; align-items: center; gap: 4px; flex: none;
    padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
    background: rgba(10, 14, 22, 0.95); border-bottom: 1px solid var(--border);
  }
  .rb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
  .rb-title small { color: var(--text-3); font-size: 11.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rb-title b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rb-rev .ic { width: 24px; height: 24px; }
  .rb-rev.on { color: var(--green); }
  .reader-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .reader-inner { padding: 18px var(--gutter) 28px; }
  .reader-dock {
    display: flex; align-items: center; gap: 10px; flex: none;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(10, 14, 22, 0.96); border-top: 1px solid var(--border);
  }
  .dock-btn { width: 50px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 13px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; }
  .dock-btn:disabled { opacity: 0.35; }
  .dock-btn .ic { width: 22px; height: 22px; }
  .dock-revise { flex: 1; height: 46px; border-radius: 13px; font-size: 14.5px; }
  .dock-note { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 13px; font-weight: 600; }
  .r-revise-top, .r-end { display: none; }
  .r-title { font-size: 24px; }
}
@media (min-width: 1024px) {
  .c-main { padding-top: 26px; }
  .reader-inner { max-width: 880px; padding-bottom: 30px; }
  .r-progress { top: var(--hdr); margin: 0 0 18px; height: 3px; border-radius: 3px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
  .r-title { font-size: 32px; }
}

/* Prose (notes content) */
.prose { font-size: var(--fs-read); line-height: 1.72; color: #d5dcea; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0.65em 0; }
.prose b, .prose strong { color: #fff; font-weight: 650; }
.prose a { color: var(--accent); }
.prose ul, .prose ol { margin: 0.6em 0 0.9em; padding-left: 1.35em; }
.prose li { margin: 0.38em 0; padding-left: 0.15em; }
.prose li::marker { color: var(--accent); }
.prose code { padding: 0.12em 0.42em; border-radius: 6px; background: rgba(122, 162, 255, 0.12); color: #c7d7ff; font-size: 0.86em; }
.prose h3, .prose h3.sub { margin: 1.7em 0 0.5em; color: #fff; font-size: 1.08em; font-weight: 750; }
.prose .table-wrap { margin: 1em 0 1.2em; overflow-x: auto; border: 1px solid var(--border-2); border-radius: 14px; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; min-width: 540px; border-collapse: collapse; font-size: 0.88em; line-height: 1.55; }
.prose th, .prose td { padding: 10px 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-2); color: #fff; font-weight: 700; white-space: nowrap; }
.prose .table-wrap[data-cols="2"] table, .prose .table-wrap[data-cols="3"] table { min-width: 0; }
.prose .table-wrap[data-cols="3"] th { white-space: normal; }
.prose .table-wrap[data-cols="2"] td, .prose .table-wrap[data-cols="3"] td { overflow-wrap: anywhere; }
.prose .table-wrap[data-cols="2"] td code, .prose .table-wrap[data-cols="3"] td code { word-break: break-word; }
@media (max-width: 480px) { .prose .table-wrap[data-cols="3"] :is(th, td) { padding: 9px 10px; } }
.prose tr:last-child td { border-bottom: 0; }
.prose tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
.prose td:first-child { color: var(--text); font-weight: 550; }
.prose .box { margin: 1.05em 0; padding: 12px 15px 12px 16px; border-radius: 14px; border: 1px solid; position: relative; }
.prose .box .lbl { display: block; margin-bottom: 3px; font-size: 0.7em; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.prose .box code { background: rgba(255, 255, 255, 0.09); }
.prose .key { background: rgba(122, 162, 255, 0.08); border-color: rgba(122, 162, 255, 0.3); }
.prose .key .lbl { color: #9db9ff; }
.prose .trap { background: rgba(248, 113, 113, 0.07); border-color: rgba(248, 113, 113, 0.3); }
.prose .trap .lbl { color: #ff9e9e; }
.prose .tip { background: rgba(52, 211, 153, 0.07); border-color: rgba(52, 211, 153, 0.28); }
.prose .tip .lbl { color: #6ee7b7; }
.prose pre.diagram {
  margin: 1em 0; padding: 13px 15px; overflow-x: auto; white-space: pre;
  border-radius: 14px; border: 1px dashed var(--border-2); background: var(--code-bg);
  color: #c9d4e8; font: 0.78em/1.55 var(--mono);
}
.prose .star { color: var(--amber); }
.prose .rev { columns: 2 300px; column-gap: 32px; }
.prose .rev h3 { margin: 1.1em 0 0.3em; color: var(--accent); font-size: 1em; break-after: avoid; }
.prose .rev h3:first-child { margin-top: 0; }
.prose .rev ul { margin-top: 0; }
.prose .rev li { break-inside: avoid; }

/* =================================================================================================
   Code blocks + Highlight.js theme
   ================================================================================================= */
.code-block { margin: 1.1em 0; border-radius: 14px; border: 1px solid var(--border-2); background: var(--code-bg); overflow: hidden; box-shadow: 0 10px 30px -20px rgba(0, 0, 0, 0.8); }
.code-head { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.025); color: var(--text-3); font: 600 12px var(--font); }
.code-dots { display: inline-flex; gap: 5px; }
.code-dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a4458; }
.code-dots i:nth-child(1) { background: #f87171aa; }
.code-dots i:nth-child(2) { background: #fbbf24aa; }
.code-dots i:nth-child(3) { background: #34d399aa; }
.code-lang { min-width: 0; color: var(--text-2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-lines { flex: none; color: var(--text-3); font-family: var(--mono); font-size: 11px; }
.code-actions { display: flex; gap: 2px; margin-left: auto; flex: none; }
.code-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: 650 12px var(--font); cursor: pointer; transition: background 0.15s, color 0.15s; }
.code-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.code-btn .ic { width: 15px; height: 15px; }
.code-btn[aria-pressed="true"] { color: var(--accent); }
.code-btn.copied { color: var(--green); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; tab-size: 4; -moz-tab-size: 4; font: calc(var(--fs-read) * 0.8)/1.62 var(--mono); color: #d6deeb; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.code-block pre:focus-visible { outline-offset: -2px; }
.code-block.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-block code { display: block; padding: 0; background: none; color: inherit; font: inherit; }
.code-block[data-lang="plaintext"] pre { color: #c3cde0; }
.prose .code-block code { padding: 0; background: none; color: inherit; font-size: inherit; }
@media (max-width: 600px) {
  .code-btn span, .code-lines { display: none; }
  .code-btn { width: 36px; padding: 0; justify-content: center; }
  .code-block pre { padding: 12px 13px; font-size: calc(var(--fs-read) * 0.76); }
}
.code-compact pre { font-size: calc(var(--fs-read) * 0.78); }

.hljs-comment, .hljs-quote { color: #6f809b; font-style: italic; }
.hljs-keyword, .hljs-selector-tag { color: #c792ea; }
.hljs-type, .hljs-built_in { color: #7fdbca; }
.hljs-literal, .hljs-number { color: #f78c6c; }
.hljs-string, .hljs-regexp, .hljs-char.escape_ { color: #c3e88d; }
.hljs-meta { color: #ffcb6b; }
.hljs-meta .hljs-keyword { color: #ffcb6b; }
.hljs-meta .hljs-string { color: #c3e88d; }
.hljs-title, .hljs-title.function_ { color: #82aaff; }
.hljs-title.class_, .hljs-title.class_.inherited__ { color: #ffcb6b; }
.hljs-params { color: #d6deeb; }
.hljs-variable, .hljs-template-variable { color: #f07178; }
.hljs-operator, .hljs-punctuation { color: #89ddff; }
.hljs-attr, .hljs-attribute, .hljs-property { color: #addb67; }
.hljs-symbol, .hljs-bullet, .hljs-link { color: #f78c6c; }
.hljs-doctag, .hljs-strong, .hljs-section { font-weight: 700; color: #e2e8f5; }
.hljs-emphasis { font-style: italic; }

/* =================================================================================================
   Tab 2 — DSA
   ================================================================================================= */
.d-stat { flex-direction: column; align-items: stretch; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 2px 0 12px; }
.d-random { margin-left: auto; }
@media (max-width: 420px) {
  .seg-diff { width: 100%; }
  .seg-diff button { flex: 1; padding: 0 6px; }
  .d-random { margin-left: auto; }
}
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 22px 2px 10px; }
.group-head:first-child { margin-top: 4px; }
.group-head h2 { margin: 0; font-size: 15.5px; font-weight: 750; letter-spacing: -0.01em; }
.gh-num { min-width: 28px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font: 750 12px var(--mono); }
.gh-note { color: var(--amber); font-size: 12px; font-weight: 650; }
.gh-count { margin-left: auto; color: var(--text-3); font: 650 12px var(--mono); }

.dsa-card {
  position: relative; margin-bottom: 12px; padding: 15px 15px 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.3s, opacity 0.25s, transform 0.25s;
}
.dsa-card:hover { border-color: var(--border-2); }
.dsa-card.done { background: linear-gradient(170deg, rgba(52, 211, 153, 0.07), transparent 55%), var(--surface); border-color: rgba(52, 211, 153, 0.26); }
.dsa-card.open { border-color: var(--accent-line); }
.dsa-card.leaving { opacity: 0; transform: scale(0.97); }
.dsa-card.glow, .call-card.glow { animation: glow 1.6s var(--ease); }
.dsa-row { display: flex; align-items: flex-start; gap: 12px; }
.check {
  flex: none; width: 30px; height: 30px; margin-top: 1px; display: grid; place-items: center;
  border-radius: 10px; border: 2px solid var(--border-2); background: transparent; color: transparent; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.check .ic { width: 17px; height: 17px; stroke-width: 3.4; transform: scale(0.4); transition: transform 0.25s var(--ease); }
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.check.on .ic { transform: scale(1); }
.check.pop { animation: pop 0.4s var(--ease); }
.dsa-main { flex: 1; min-width: 0; }
.dsa-titleline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
.dsa-num { color: var(--text-3); font: 700 12.5px var(--mono); }
.dsa-title { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.dsa-card.done .dsa-title { color: var(--text-2); }
.dsa-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.badge { display: inline-flex; align-items: center; height: 23px; padding: 0 9px; border-radius: 99px; font: 750 11.5px var(--font); letter-spacing: 0.02em; }
.badge-easy { color: #6ee7b7; background: var(--green-soft); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35); }
.badge-medium { color: #fcd34d; background: var(--amber-soft); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35); }
.badge-hard { color: #fca5a5; background: var(--red-soft); box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.38); }
.tag { display: inline-flex; align-items: center; min-height: 23px; padding: 1px 9px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 12px; font-weight: 600; line-height: 1.4; }
.tag code { font-size: 0.92em; color: var(--text-2); }
.dsa-approach { margin: 12px 0 0 42px; color: var(--text-2); font-size: 14.5px; line-height: 1.62; }
.dsa-approach .lbl { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(167, 139, 250, 0.13); color: #c4b5fd; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; vertical-align: 1px; }
.dsa-approach code { padding: 0.08em 0.38em; border-radius: 5px; background: rgba(122, 162, 255, 0.12); color: #c7d7ff; font-size: 0.88em; }
.dsa-cx { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0 42px; }
.cx { display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 11px 0 9px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 12px; font-weight: 600; }
.cx .ic { width: 14px; height: 14px; }
.cx code { color: var(--text); font: 700 12.5px var(--mono); }
.lc-link { display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 11px; border-radius: 9px; border: 1px solid rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.07); color: #fcd34d; font-size: 12.5px; font-weight: 650; text-decoration: none; transition: background 0.15s; }
.lc-link:hover { background: rgba(251, 191, 36, 0.14); }
.lc-link .ic { width: 13px; height: 13px; }
.sol-toggle {
  display: flex; align-items: center; gap: 9px; width: calc(100% - 42px); height: 44px; margin: 14px 0 2px 42px; padding: 0 14px;
  border-radius: 12px; border: 1px dashed var(--accent-line); background: rgba(122, 162, 255, 0.04);
  color: var(--accent); font: 700 14px var(--font); cursor: pointer; transition: background 0.18s, border-color 0.18s;
}
.sol-toggle:hover { background: var(--accent-soft); }
.sol-toggle .chev { margin-left: auto; transition: transform 0.3s var(--ease); }
.dsa-card.open .sol-toggle { border-style: solid; background: var(--accent-soft); }
.dsa-card.open .sol-toggle .chev { transform: rotate(180deg); }
.sol-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.dsa-card.open .sol-wrap { grid-template-rows: 1fr; }
.sol-inner { min-height: 0; overflow: hidden; }
.sol-tabs { display: flex; gap: 6px; padding: 12px 0 4px; overflow-x: auto; scrollbar-width: none; }
.sol-tabs::-webkit-scrollbar { display: none; }
.sol-tab { flex: none; height: 36px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font: 650 13px var(--font); cursor: pointer; transition: background 0.15s, color 0.15s; }
.sol-tab:hover { color: var(--text); }
.sol-tab.active { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.sol-hint { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 -2px; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.sol-hint .ic { width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.sol-pane .code-block { margin: 10px 0 4px; }
.sol-pane .code-block pre { max-height: none; }
@media (max-width: 560px) {
  .dsa-approach, .dsa-cx { margin-left: 0; }
  .sol-toggle { width: 100%; margin-left: 0; }
  .dsa-card { padding: 14px 13px 11px; }
}

/* =================================================================================================
   Tab 3 — MCQ
   ================================================================================================= */
.m-score { flex-direction: column; align-items: stretch; }
.mcq {
  margin-bottom: 14px; padding: 15px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.mcq.correct { border-color: rgba(52, 211, 153, 0.38); }
.mcq.wrong { border-color: rgba(248, 113, 113, 0.38); }
.mcq-head { display: flex; align-items: center; gap: 8px; margin: -4px -6px 8px 0; }
.mcq-num { color: var(--accent); font: 750 12.5px var(--mono); }
.mcq-topic { padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcq-status { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12.5px; font-weight: 750; }
.mcq-status .ic { width: 15px; height: 15px; stroke-width: 3; }
.mcq.correct .mcq-status { color: var(--green); }
.mcq.wrong .mcq-status { color: var(--red); }
.bm { width: 38px; height: 38px; }
.bm .ic { width: 19px; height: 19px; }
.bm.on { color: var(--amber); }
.mcq-q { color: #f2f5fb; font-size: calc(var(--fs-read) * 1.02); font-weight: 650; line-height: 1.55; }
.mcq-q code, .opt-text code, .exp code { padding: 0.08em 0.38em; border-radius: 5px; background: rgba(122, 162, 255, 0.13); color: #c7d7ff; font-size: 0.88em; }
.mcq .code-block { margin: 12px 0 2px; }
.mcq-opts { display: grid; gap: 9px; margin-top: 14px; }
@media (min-width: 700px) { .mcq-opts.short { grid-template-columns: 1fr 1fr; } }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 12px;
  border-radius: 13px; border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--text); font: 500 calc(var(--fs-read) * 0.92)/1.45 var(--font); text-align: left; cursor: pointer;
  transition: background 0.18s, border-color 0.18s, opacity 0.25s, transform 0.12s;
}
.opt:hover { border-color: var(--accent-line); background: #1a2438; }
.opt:active { transform: scale(0.99); }
.opt-key { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-3); color: var(--text-2); font: 750 13px var(--mono); transition: background 0.2s, color 0.2s; }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-mark { flex: none; width: 22px; display: grid; place-items: center; }
.opt-mark .ic { width: 20px; height: 20px; stroke-width: 3; }
.mcq.answered .opt { cursor: default; }
.mcq.answered .opt:hover { border-color: var(--border-2); background: var(--surface-2); }
.mcq.answered .opt:active { transform: none; }
.opt.is-correct, .mcq.answered .opt.is-correct:hover { background: rgba(52, 211, 153, 0.12); border-color: var(--green-line); }
.opt.is-correct .opt-key { background: var(--green); color: var(--green-ink); }
.opt.is-correct .opt-mark { color: var(--green); }
.opt.is-wrong, .mcq.answered .opt.is-wrong:hover { background: rgba(248, 113, 113, 0.1); border-color: var(--red-line); }
.opt.is-wrong .opt-key { background: var(--red); color: var(--red-ink); }
.opt.is-wrong .opt-mark { color: var(--red); }
.opt.is-dim { opacity: 0.5; }
.opt.shake { animation: shake 0.42s; }
.mcq-exp { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.mcq.answered .mcq-exp { grid-template-rows: 1fr; }
.exp-inner { min-height: 0; overflow: hidden; }
.exp { margin-top: 12px; padding: 13px 15px; border-radius: 13px; font-size: calc(var(--fs-read) * 0.9); line-height: 1.62; color: var(--text-2); }
.exp p { margin: 6px 0 8px; }
.exp.ok { background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.25); }
.exp.bad { background: rgba(248, 113, 113, 0.06); border: 1px solid rgba(248, 113, 113, 0.25); }
.exp-head { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.exp-head .ic { width: 19px; height: 19px; }
.exp.ok .exp-head { color: #6ee7b7; }
.exp.bad .exp-head { color: #fca5a5; }
.exp.bad .exp-head b { color: #fff; }

/* Practice mode */
.practice { max-width: 860px; }
.pr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.pr-pos { flex: 1; color: var(--text-2); font-size: 14px; }
.pr-pos b { color: var(--text); font-size: 16px; }
.pr-done { margin-left: 10px; color: var(--text-3); font-size: 12.5px; }
.pr-bar { height: 5px; }
.pr-stage .mcq { margin-bottom: 14px; }
.pr-stage.in-right { animation: inRight 0.3s var(--ease); }
.pr-stage.in-left { animation: inLeft 0.3s var(--ease); }
.pr-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; }
.pr-skip { justify-self: center; }
@media (max-width: 480px) { .pr-skip span { display: none; } .pr-nav .btn { padding: 0 14px; } }
.pr-hint { margin: 14px 0 0; color: var(--text-3); font-size: 12.5px; }

/* =================================================================================================
   Tab 4 — Interview calls
   ================================================================================================= */
.kstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kstat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 11px 11px 10px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  text-align: left; cursor: pointer; transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.kstat:active { transform: scale(0.97); }
.kstat b { font-size: 23px; line-height: 1.1; font-weight: 800; color: var(--text); }
.ks-ic { width: 26px; height: 26px; display: grid; place-items: center; margin-bottom: 4px; border-radius: 8px; background: var(--surface-2); }
.ks-ic .ic { width: 15px; height: 15px; }
.ks-label { max-width: 100%; font-size: 11.5px; font-weight: 650; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-all .ks-ic { color: var(--accent); background: var(--accent-soft); }
.ks-pending .ks-ic { color: var(--amber); background: var(--amber-soft); }
.ks-shortlisted .ks-ic { color: var(--green); background: var(--green-soft); }
.ks-rejected .ks-ic { color: var(--red); background: var(--red-soft); }
.kstat[aria-pressed="true"] { border-color: var(--accent-line); background: linear-gradient(160deg, rgba(122, 162, 255, 0.14), transparent 70%), var(--surface); }
.ks-pending[aria-pressed="true"] { border-color: var(--amber-line); background: linear-gradient(160deg, rgba(251, 191, 36, 0.13), transparent 70%), var(--surface); }
.ks-shortlisted[aria-pressed="true"] { border-color: var(--green-line); background: linear-gradient(160deg, rgba(52, 211, 153, 0.13), transparent 70%), var(--surface); }
.ks-rejected[aria-pressed="true"] { border-color: var(--red-line); background: linear-gradient(160deg, rgba(248, 113, 113, 0.13), transparent 70%), var(--surface); }
@media (min-width: 1024px) { .kstats { grid-template-columns: 1fr 1fr; gap: 10px; } .kstat { padding: 14px; } .kstat b { font-size: 26px; } }
.k-add { margin-top: 4px; height: 48px; }
.select-wrap { position: relative; flex: none; display: inline-flex; align-items: center; }
.select-wrap select {
  -webkit-appearance: none; appearance: none; height: 48px; padding: 0 36px 0 14px; border-radius: 14px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: 600 13.5px var(--font); cursor: pointer;
}
.select-wrap .ic { position: absolute; right: 12px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
@media (min-width: 1024px) { .select-wrap select { height: 46px; } }
@media (max-width: 420px) { .select-wrap select { padding: 0 30px 0 11px; font-size: 13px; } .select-wrap .ic { right: 9px; } }

.calls-grid { display: grid; gap: 12px; }
@media (min-width: 1280px) { .calls-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.calls-grid > .empty { grid-column: 1 / -1; }
.call-card {
  position: relative; padding: 15px 15px 10px 17px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
  overflow: visible; transition: border-color 0.2s, opacity 0.22s, transform 0.22s;
}
.call-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.call-card.st-shortlisted::before { background: var(--green); }
.call-card.st-rejected::before { background: var(--red); }
.call-card:hover { border-color: var(--border-2); }
.call-card.leaving { opacity: 0; transform: translateX(16px); }
.call-top { display: flex; align-items: center; gap: 12px; }
.avatar { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: hsl(var(--h) 55% 20%); color: hsl(var(--h) 90% 80%); font: 800 15px var(--font); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 40% / 0.4); }
.call-id { flex: 1; min-width: 0; }
.company { margin: 0; font-size: 17px; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; }
.role { margin-top: 1px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.status-wrap { position: relative; flex: none; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 10px; border-radius: 99px; border: 1px solid;
  font: 700 12.5px var(--font); cursor: pointer; transition: filter 0.15s;
}
.status-pill:hover { filter: brightness(1.15); }
.status-pill .ic { width: 15px; height: 15px; }
.status-pill .chev { width: 13px; height: 13px; opacity: 0.7; }
.sp-pending { color: #fcd34d; background: var(--amber-soft); border-color: var(--amber-line); }
.sp-shortlisted { color: #6ee7b7; background: var(--green-soft); border-color: var(--green-line); }
.sp-rejected { color: #fca5a5; background: var(--red-soft); border-color: var(--red-line); }
.status-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; padding: 6px;
  border-radius: 14px; background: var(--elev); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top right; transition: opacity 0.15s, transform 0.15s;
}
.status-menu.open { opacity: 1; transform: none; }
.sm-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 650 14px var(--font); text-align: left; cursor: pointer; }
.sm-item:hover, .sm-item:focus-visible { background: rgba(255, 255, 255, 0.06); color: var(--text); outline: none; }
.sm-item .ic { width: 17px; height: 17px; }
.sm-pending .ic:first-child { color: var(--amber); }
.sm-shortlisted .ic:first-child { color: var(--green); }
.sm-rejected .ic:first-child { color: var(--red); }
.sm-check { margin-left: auto; color: var(--accent); }
.call-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 2px; color: var(--text-2); font-size: 13.5px; }
.call-meta > span { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.call-meta .ic { width: 15px; height: 15px; color: var(--text-3); }
.call-meta em { color: var(--text-3); font-style: normal; }
.tag-upcoming { height: 21px; min-height: 0; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-size: 11px; font-weight: 750; }
.call-sec { margin-top: 12px; }
.cs-label { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: var(--text-3); font-size: 11.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.cs-label .ic { width: 14px; height: 14px; }
.cs-label .count { padding: 0 6px; border-radius: 99px; background: var(--surface-2); font: 700 11px/1.6 var(--mono); letter-spacing: 0; }
.q-list { margin: 0; padding-left: 22px; color: var(--text); font-size: 14.5px; line-height: 1.55; }
.q-list li { margin: 4px 0; padding-left: 2px; }
.q-list li::marker { color: var(--accent); font: 700 12px var(--mono); }
.notes { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.clampable { max-height: 7.9em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.call-card.expanded .clampable { max-height: none; -webkit-mask-image: none; mask-image: none; }
.call-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.call-actions .spacer { flex: 1; }
.btn-del:hover { color: #fca5a5; border-color: var(--red-line); background: var(--red-soft); }
@media (max-width: 380px) { .btn-del span { display: none; } }

.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
  width: 60px; height: 60px; display: grid; place-items: center; border: 0; border-radius: 20px; cursor: pointer;
  background: linear-gradient(135deg, #7aa2ff, #a78bfa); color: var(--accent-ink);
  box-shadow: 0 16px 34px -10px rgba(122, 162, 255, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.15s var(--ease);
}
.fab:active { transform: scale(0.93); }
.fab .ic { width: 28px; height: 28px; stroke-width: 2.6; }
body[data-tab="calls"] #toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) { body[data-tab="calls"] #toasts { bottom: 24px; } }

/* =================================================================================================
   Sheets (bottom sheet on phones, dialog on larger screens), forms, menu
   ================================================================================================= */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 12, 0.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.28s; }
.sheet {
  position: relative; display: flex; flex-direction: column; width: 100%; max-height: 92vh; max-height: 92dvh;
  background: var(--surface); border: 1px solid var(--border-2); border-bottom: 0; border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55); transform: translateY(102%); transition: transform 0.32s var(--ease);
  padding-bottom: env(safe-area-inset-bottom); outline: none;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; margin: 9px auto 0; border-radius: 5px; background: var(--border-2); flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 20px; flex: none; }
.sheet-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 18.5px; font-weight: 750; letter-spacing: -0.01em; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 20px 14px; border-top: 1px solid var(--border); flex: none; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 28px; }
  .sheet { max-width: 580px; max-height: 88vh; border-radius: 22px; border-bottom: 1px solid var(--border-2); opacity: 0; transform: translateY(18px) scale(0.98); transition: transform 0.28s var(--ease), opacity 0.22s; padding-bottom: 0; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding: 16px 12px 6px 24px; }
  .sheet-body { padding: 4px 24px 22px; }
  .sheet-foot { padding: 14px 24px 18px; }
  .sheet-foot .btn { flex: none; }
  .sheet-sm .sheet { max-width: 460px; }
  .sheet-form .sheet { max-width: 640px; }
}
.confirm-msg { color: var(--text-2); font-size: 15px; line-height: 1.6; }
.confirm-msg b { color: var(--text); }

/* Forms */
.form .field { margin: 0 0 15px; padding: 0; border: 0; min-width: 0; }
.form label, .form legend { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; padding: 0; color: var(--text-2); font: 650 13.5px var(--font); }
.req { color: var(--red); }
.opt-l { color: var(--text-3); font-size: 12px; font-weight: 500; }
.form input:not([type="radio"]), .form textarea {
  width: 100%; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--bg-2);
  color: var(--text); font: 16px/1.45 var(--font); outline: none; transition: border-color 0.18s, box-shadow 0.18s;
}
.form textarea { resize: vertical; min-height: 96px; }
.form input:focus, .form textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.form input[type="date"] { color-scheme: dark; min-height: 48px; }
.form .field.invalid input { border-color: var(--red-line); box-shadow: 0 0 0 4px var(--red-soft); }
.field-err { margin: 6px 0 0; color: #fca5a5; font-size: 12.5px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr; column-gap: 12px; }
@media (min-width: 520px) { .field-row { grid-template-columns: 1fr 1fr; } }
.status-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.form .ss { position: relative; display: block; margin: 0; min-width: 0; }
.ss input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ss span { display: flex; width: 100%; align-items: center; justify-content: center; gap: 7px; height: 46px; padding: 0 6px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text-2); font: 700 13.5px var(--font); cursor: pointer; transition: background 0.18s, border-color 0.18s, color 0.18s; }
.ss span .ic { width: 16px; height: 16px; }
.ss input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ss-pending input:checked + span { background: var(--amber-soft); border-color: var(--amber-line); color: #fcd34d; }
.ss-shortlisted input:checked + span { background: var(--green-soft); border-color: var(--green-line); color: #6ee7b7; }
.ss-rejected input:checked + span { background: var(--red-soft); border-color: var(--red-line); color: #fca5a5; }
@media (max-width: 380px) { .ss span .ic { display: none; } }
.form-hint { margin: 0; color: var(--text-3); font-size: 12.5px; }

/* Backup & settings menu */
.menu-sec { padding: 16px 0; border-top: 1px solid var(--border); }
.menu-sec:first-child { padding-top: 6px; border-top: 0; }
.menu-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; font-weight: 750; }
.menu-sec h3 .ic { width: 18px; height: 18px; color: var(--accent); }
.danger-zone h3 .ic { color: var(--red); }
.muted { margin: 0 0 12px; color: var(--text-3); font-size: 13.5px; line-height: 1.6; }
.muted b { color: var(--text-2); }
.muted code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); font-size: 0.9em; }
.muted .ic { display: inline; width: 15px; height: 15px; vertical-align: -3px; }
.small { font-size: 12.5px; margin: 10px 0 0; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .mini-stats { grid-template-columns: repeat(4, 1fr); } }
.ms { padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ms b { display: block; font-size: 22px; line-height: 1.15; font-weight: 800; }
.ms b small { color: var(--text-3); font-size: 13px; font-weight: 650; }
.ms span { color: var(--text-3); font-size: 12px; font-weight: 650; }
.ms-c b { color: #a5c0ff; }
.ms-d b { color: #6ee7b7; }
.ms-m b { color: #fcd34d; }
.ms-k b { color: #d8b4fe; }
.btn-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 460px) { .btn-grid { grid-template-columns: 1fr 1fr; } .btn-span { grid-column: 1 / -1; } }
.seg-fs button { min-width: 54px; font-size: 14px; }
.ok-line { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--green); font-weight: 650; }
.about { margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; line-height: 1.8; }
.import-sum { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 8px; }
.import-sum li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.import-sum li .ic { width: 17px; height: 17px; color: var(--accent); }
.import-sum b { color: var(--text); }

/* =================================================================================================
   Toasts, particles, animations
   ================================================================================================= */
#toasts {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(calc(100% - 24px), 460px); transform: translateX(-50%); pointer-events: none;
}
body.reader-open #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
.toast {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 10px 11px 14px; border-radius: 14px; pointer-events: auto;
  background: rgba(27, 36, 54, 0.97); border: 1px solid var(--border-2); box-shadow: var(--shadow); color: var(--text); font-size: 14px; font-weight: 550;
  opacity: 0; transform: translateY(14px) scale(0.98); transition: opacity 0.25s, transform 0.3s var(--ease);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast > .ic { width: 19px; height: 19px; color: var(--accent); }
.toast-success > .ic { color: var(--green); }
.toast-warn > .ic { color: var(--amber); }
.toast-error > .ic { color: var(--red); }
.toast-msg { flex: 1; min-width: 0; line-height: 1.4; }
.toast-action { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font: 750 13px var(--font); cursor: pointer; }
.toast-action:hover { background: rgba(122, 162, 255, 0.24); }
@media (min-width: 1024px) { #toasts { left: auto; right: 24px; bottom: 24px; transform: none; align-items: flex-end; } }

.burst { position: fixed; z-index: 300; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 2px; pointer-events: none; animation: burst 0.75s var(--ease) forwards; }

@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(0.6); opacity: 0; } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(122, 162, 255, 0); } 25% { box-shadow: 0 0 0 5px rgba(122, 162, 255, 0.45); } 100% { box-shadow: 0 0 0 0 rgba(122, 162, 255, 0); } }
@keyframes inRight { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Thin, dark scrollbars on desktop */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #243047; border-radius: 10px; border: 2px solid var(--bg); }
  ::-webkit-scrollbar-thumb:hover { background: #2f3d58; }
  .code-block ::-webkit-scrollbar-thumb, .code-block pre::-webkit-scrollbar-thumb { border-color: var(--code-bg); }
}
