/* System Design Prep — site theme */

:root {
  --bg: #0f1216;
  --bg-elev: #161a20;
  --bg-elev-2: #1c2129;
  --border: #262c36;
  --border-strong: #384051;
  --text: #e6e8ec;
  --text-muted: #9aa3b2;
  --text-dim: #6c7583;
  --accent: #7aa2f7;
  --accent-strong: #a3bffa;
  --success: #7ec98f;
  --warn: #f4b860;
  --danger: #f16b6b;
  --code-bg: #12161c;
  --code-border: #232833;
  --link: #7dd3fc;
  --link-hover: #a5e8ff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Charter", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --content-width: 760px;
  --sidebar-width: 280px;
}

[data-theme="light"] {
  --bg: #fbfaf7;
  --bg-elev: #ffffff;
  --bg-elev-2: #f4f2ec;
  --border: #e5e0d5;
  --border-strong: #c9c2b3;
  --text: #1c1d1f;
  --text-muted: #545965;
  --text-dim: #7a8290;
  --accent: #3b5bdb;
  --accent-strong: #274bc9;
  --success: #2e8b46;
  --warn: #b8760e;
  --danger: #c93636;
  --code-bg: #f4f1ea;
  --code-border: #e2ddd0;
  --link: #2062c9;
  --link-hover: #0d4bb0;
  --shadow: 0 6px 20px rgba(20, 25, 30, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  font-family: var(--font-ui);
  font-size: 14px;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar .brand-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.sidebar .brand-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.sidebar .search {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  margin-bottom: 16px;
}
.sidebar .search:focus { outline: 2px solid var(--accent); }

.sidebar h4 {
  margin: 18px 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li a {
  display: block;
  padding: 6px 10px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  border-left: 2px solid transparent;
}
.sidebar li a:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar li a.active {
  background: var(--bg-elev-2);
  color: var(--accent-strong);
  border-left: 2px solid var(--accent);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: #0b0e13; border-color: var(--accent); font-weight: 600; }

.main {
  padding: 48px 64px;
  max-width: calc(var(--content-width) + 128px);
  margin: 0 auto;
}

.page-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 24px;
  font-family: var(--font-ui);
}

.btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: transform 0.05s ease, background 0.1s ease;
}
.btn:hover { background: var(--bg-elev-2); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #0b0e13; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: rgba(241, 107, 107, 0.4); }
.btn-success { background: var(--success); color: #0b0e13; border-color: var(--success); }

.article h1, .article h2, .article h3, .article h4 {
  font-family: var(--font-ui);
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-top: 2.2em;
  margin-bottom: 0.6em;
}
.article h1 { font-size: 2.2em; margin-top: 0; border-bottom: 2px solid var(--border); padding-bottom: 0.3em; }
.article h2 { font-size: 1.55em; }
.article h3 { font-size: 1.2em; }
.article h4 { font-size: 1em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.article p, .article ul, .article ol { margin: 1em 0; }
.article a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; }
.article a:hover { color: var(--link-hover); border-bottom-color: currentColor; }

.article ul, .article ol { padding-left: 1.5em; }
.article li { margin: 0.25em 0; }

.article blockquote {
  margin: 1.2em 0;
  padding: 0.6em 1.2em;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev-2);
  border-radius: 0 6px 6px 0;
  color: var(--text);
  font-style: italic;
}

.article hr { border: none; height: 1px; background: var(--border); margin: 2.5em 0; }

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--bg-elev);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.article th, .article td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.article th { background: var(--bg-elev-2); font-weight: 600; color: var(--text); }
.article tr:last-child td { border-bottom: none; }
.article tbody tr:hover { background: var(--bg-elev-2); }

.article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--code-border);
}
.article pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 13.5px;
}
.article pre code { background: transparent; border: none; padding: 0; font-size: inherit; }

.callout {
  padding: 14px 18px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev-2);
  margin: 1.4em 0;
  font-family: var(--font-ui);
  font-size: 15px;
}
.callout-title { font-weight: 700; margin-bottom: 4px; color: var(--accent-strong); }
.callout.warn { border-left-color: var(--warn); }
.callout.warn .callout-title { color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }
.callout.danger .callout-title { color: var(--danger); }
.callout.success { border-left-color: var(--success); }
.callout.success .callout-title { color: var(--success); }

.quiz-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.quiz-header h1 { font-family: var(--font-ui); margin: 0 0 6px 0; font-size: 1.8em; letter-spacing: -0.01em; }
.quiz-meta { color: var(--text-muted); font-family: var(--font-ui); font-size: 14px; }

.quiz-progress {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0 20px;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-muted);
}
.progress-bar { flex: 1; height: 6px; background: var(--bg-elev-2); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s ease; }

.question {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}

.question-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 700;
}

.question-type-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.question-type-badge.mcq { color: var(--accent-strong); border-color: rgba(122, 162, 247, 0.3); }
.question-type-badge.tf { color: var(--warn); border-color: rgba(244, 184, 96, 0.3); }
.question-type-badge.short { color: var(--success); border-color: rgba(126, 201, 143, 0.3); }
.question-type-badge.scenario { color: #c7a3ff; border-color: rgba(199, 163, 255, 0.3); }
.question-type-badge.design { color: #ff9ec7; border-color: rgba(255, 158, 199, 0.3); }

.question-prompt {
  font-family: var(--font-body);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  margin: 4px 0 16px;
}
.question-prompt code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--code-border);
  font-size: 0.9em;
}

.options { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  transition: background 0.1s ease, border 0.1s ease, transform 0.05s ease;
}
.option:hover { background: var(--bg-elev-2); border-color: var(--border-strong); }
.option:active { transform: scale(0.995); }
.option .opt-key {
  min-width: 24px; height: 24px; border-radius: 6px;
  background: var(--bg-elev-2); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; border: 1px solid var(--border);
  flex-shrink: 0; margin-top: 1px;
}
.option .opt-text { flex: 1; }

.option.selected { border-color: var(--accent); background: rgba(122, 162, 247, 0.08); }
.option.selected .opt-key { background: var(--accent); color: #0b0e13; border-color: var(--accent); }
.option.correct { border-color: var(--success); background: rgba(126, 201, 143, 0.08); }
.option.correct .opt-key { background: var(--success); color: #0b0e13; border-color: var(--success); }
.option.incorrect { border-color: var(--danger); background: rgba(241, 107, 107, 0.06); }
.option.incorrect .opt-key { background: var(--danger); color: white; border-color: var(--danger); }
.option[disabled] { cursor: default; }

.textarea-wrap { position: relative; }
.textarea {
  width: 100%; min-height: 120px;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
}
.textarea:focus { outline: 2px solid var(--accent); }
.textarea-help {
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

.subquestions {
  padding-left: 1.4em;
  margin: 8px 0 12px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
}
.subquestions li { margin-bottom: 4px; }

.hint-list {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 1.4em;
  margin: 6px 0 0;
}

.explanation {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev-2);
  border-radius: 0 8px 8px 0;
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.6;
  display: none;
}
.explanation.show { display: block; }
.explanation.correct { border-left-color: var(--success); }
.explanation.incorrect { border-left-color: var(--danger); }
.explanation .exp-verdict {
  font-weight: 700; margin-bottom: 6px;
  font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase;
}
.explanation.correct .exp-verdict { color: var(--success); }
.explanation.incorrect .exp-verdict { color: var(--danger); }

.quiz-controls {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.quiz-controls-left, .quiz-controls-right { display: flex; gap: 10px; flex-wrap: wrap; }

.results {
  display: none;
  margin: 24px 0;
  padding: 24px 28px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-family: var(--font-ui);
}
.results.show { display: block; }
.results h2 { margin: 0 0 8px; font-family: var(--font-ui); font-size: 1.5em; }
.score-row { display: flex; align-items: baseline; gap: 12px; margin: 12px 0; }
.score-number { font-size: 3em; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.score-label { color: var(--text-muted); font-size: 14px; }
.score-badge {
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.score-badge.pass { background: var(--success); color: #0b0e13; }
.score-badge.warn { background: var(--warn); color: #0b0e13; }
.score-badge.fail { background: var(--danger); color: #fff; }

.results-note { color: var(--text-muted); font-size: 14px; margin-top: 12px; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text); font-family: var(--font-ui); font-size: 14px;
  z-index: 100; opacity: 0; transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

.home-hero {
  text-align: center;
  padding: 32px 0 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.home-hero h1 {
  font-family: var(--font-ui);
  font-size: 2.6em;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.home-hero p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 600px;
  margin: 8px auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.card {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.08s ease, border 0.1s ease;
  display: block;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card-eyebrow {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-weight: 700;
}
.card-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0 4px;
}
.card-body {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
}
.card-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.card-badge.done { background: var(--success); color: #0b0e13; border-color: var(--success); }
.card-badge.pending { background: var(--warn); color: #0b0e13; border-color: var(--warn); }
.card-badge.upcoming { color: var(--text-dim); }

/* --- DSA Practice ------------------------------------------------------- */

.dsa-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.dsa-header h1 { font-family: var(--font-ui); margin: 0 0 6px 0; font-size: 1.8em; letter-spacing: -0.01em; }
.dsa-header p { color: var(--text-muted); font-family: var(--font-ui); font-size: 14px; margin: 4px 0 0; }

.dsa-overall {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 10px;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-muted);
}
.dsa-overall .progress-bar { flex: 1; height: 8px; }

.dsa-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 12px 0 24px;
  font-family: var(--font-ui);
}
.dsa-toolbar .dsa-filter {
  flex: 1; min-width: 220px;
  padding: 8px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}
.dsa-toolbar .dsa-filter:focus { outline: 2px solid var(--accent); }
.dsa-legend {
  display: inline-flex; gap: 6px; align-items: center;
  color: var(--text-dim); font-size: 12px;
}

.dsa-pattern {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}

.dsa-pattern-header { margin-bottom: 12px; }
.dsa-pattern-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-family: var(--font-ui);
  margin-bottom: 8px;
}
.dsa-pattern-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.005em; }
.dsa-pattern-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.dsa-progress { height: 4px; background: var(--bg-elev-2); border-radius: 999px; overflow: hidden; }
.dsa-progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s ease; }

.dsa-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }

.dsa-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 0.08s ease;
}
.dsa-row:hover { background: var(--bg-elev-2); }
.dsa-row.is-solved .dsa-title { color: var(--text-muted); text-decoration: line-through; }
.dsa-row.is-solved .dsa-num { color: var(--text-dim); }

.dsa-check { display: inline-flex; padding: 6px; cursor: pointer; }
.dsa-check input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.dsa-check-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-elev-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.1s ease, border 0.1s ease;
}
.dsa-check input:focus-visible + .dsa-check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.dsa-check input:checked + .dsa-check-box {
  background: var(--success);
  border-color: var(--success);
}
.dsa-check input:checked + .dsa-check-box::after {
  content: "";
  width: 5px; height: 10px;
  border: solid #0b0e13;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.dsa-link {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 14px;
  min-width: 0;
}
.dsa-link:hover .dsa-title { color: var(--link-hover); }

.dsa-num {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}
.dsa-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsa-ext { color: var(--text-dim); font-size: 12px; margin-left: 4px; }
.dsa-link:hover .dsa-ext { color: var(--link); }

.dsa-diff {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.diff-easy   { color: var(--success); border-color: rgba(126, 201, 143, 0.35); }
.diff-medium { color: var(--warn);    border-color: rgba(244, 184, 96, 0.35); }
.diff-hard   { color: var(--danger);  border-color: rgba(241, 107, 107, 0.35); }

.dsa-premium {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-elev-2);
  color: var(--warn);
  border: 1px solid rgba(244, 184, 96, 0.35);
  white-space: nowrap;
}

/* --- LLD Practice ------------------------------------------------------- */

.dsa-repo-link {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--link);
  text-decoration: none;
  margin-left: 6px;
  border-bottom: 1px dashed transparent;
}
.dsa-repo-link:hover { color: var(--link-hover); border-bottom-color: currentColor; }

.lld-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.lld-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border 0.1s ease, transform 0.08s ease;
}
.lld-card:hover { border-color: var(--border-strong); }

.lld-card-header {
  display: flex; align-items: center; gap: 8px;
}
.lld-card-title {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.005em;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.lld-card.is-reviewed .lld-card-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1px;
}

.lld-patterns { display: flex; flex-wrap: wrap; gap: 6px; }
.lld-pattern {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-family: var(--font-ui);
  background: var(--bg-elev-2);
  color: var(--accent-strong);
  border: 1px solid rgba(122, 162, 247, 0.28);
  white-space: nowrap;
}

.lld-concepts {
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}

.lld-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.lld-actions .btn { font-size: 12.5px; padding: 6px 12px; }

/* Sidebar external-link marker */
.sb-ext { color: var(--text-dim); font-size: 10px; margin-left: 2px; }
.sidebar li a:hover .sb-ext { color: var(--text-muted); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .main { padding: 24px 20px; }
  .dsa-title { white-space: normal; }
  .lld-grid { grid-template-columns: 1fr; }
}

/* Print / PDF styles */
@media print {
  :root {
    --bg: white; --bg-elev: white; --bg-elev-2: #f7f5ef;
    --text: #111; --text-muted: #333; --text-dim: #555;
    --border: #ccc;
    --code-bg: #f3f0e8; --code-border: #ddd;
    --link: #123c8a; --accent: #123c8a;
    --shadow: none;
  }
  html, body { background: white !important; color: black !important; font-size: 12pt; }
  .sidebar, .page-actions, .quiz-controls, .toast, .no-print { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: 100%; }
  .question, .results, .card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  .article a { color: #123c8a !important; text-decoration: underline; }
  .article pre, .article code, .option, .textarea { background: #f7f5ef !important; color: #111 !important; }
  .option { border: 1px solid #ccc !important; }
  .option.correct { background: #e7f5ec !important; }
  .option.incorrect { background: #fbe9e9 !important; }
  h1, h2, h3 { color: #111 !important; page-break-after: avoid; }
  .explanation { display: block !important; background: #f7f5ef !important; color: #111 !important; }

  .dsa-toolbar, .dsa-check, .dsa-ext { display: none !important; }
  .dsa-pattern { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  .dsa-row:hover { background: transparent !important; }
  .dsa-link { color: #111 !important; }
  .dsa-row.is-solved .dsa-title { text-decoration: line-through; color: #555 !important; }

  .lld-grid { display: block !important; }
  .lld-card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; margin-bottom: 12px; }
  .lld-actions { border-top-color: #ddd !important; }
  .lld-pattern { background: #f7f5ef !important; color: #111 !important; border-color: #ddd !important; }
  .sb-ext { display: none !important; }
}
