/* ============ Reset & base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elev: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --brand: #7c3aed;
  --brand-2: #6d28d9;
  --brand-soft: #ede9fe;
  --brand-bg: #f5f3ff;

  --c-nezacato: #94a3b8;
  --c-ucim_se:  #f59e0b;
  --c-zopakovat: #ef4444;
  --c-hotovo:    #10b981;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
a { color: var(--brand-2); }

/* ============ Layout ============ */
#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-2);
  margin: 0;
  letter-spacing: -0.01em;
}
#user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
#user-area input {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
#user-area input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
#user-area button.primary {
  background: var(--brand);
  color: white;
  border: 0;
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 500;
}
#user-area button.primary:hover { background: var(--brand-2); }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: var(--brand-2);
  border-radius: 999px;
  font-weight: 500;
}
.link-btn { background: none; border: 0; color: var(--text-faint); text-decoration: underline; font-size: 13px; }
.link-btn:hover { color: var(--text); }

main { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* Pages (tab content) */
.page { flex: 1; display: flex; overflow: hidden; min-width: 0; min-height: 0; }
.page[hidden] { display: none; }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 3px;
}
.tabs button {
  background: none;
  border: 0;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: white;
  color: var(--brand-2);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Practice page */
.practice-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.practice-wrap > .practice-head,
.practice-wrap > #practice-quiz {
  max-width: 760px;
  margin: 0 auto;
}
.practice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.practice-head h2 { font-size: 22px; margin: 0 0 4px; }
.practice-info { font-size: 13px; color: var(--text-muted); }
.practice-controls { display: flex; align-items: center; gap: 12px; }
#practice-progress {
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .tabs button { padding: 5px 10px; font-size: 13px; }
  .practice-wrap { padding: 14px; }
  .practice-head h2 { font-size: 18px; }
  .practice-info { font-size: 12px; }
}

#sidebar {
  width: 380px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-head input {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.sidebar-head input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

#stats { font-size: 12px; color: var(--text-faint); }
#stats .stats-row { display: flex; justify-content: space-between; align-items: center; }
#stats .progress-track { height: 6px; background: var(--bg-elev); border-radius: 999px; overflow: hidden; margin-top: 6px; }
#stats .progress-fill { height: 100%; background: var(--c-hotovo); border-radius: 999px; transition: width 0.3s; }
#stats .legend { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; }
#stats .legend > span { display: inline-flex; align-items: center; gap: 4px; }

#qlist { flex: 1; overflow-y: auto; }

.okruh-head {
  padding: 12px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.okruh-head .count { float: right; font-weight: 500; color: var(--text-faint); }

.qitem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg-elev);
  cursor: pointer;
  transition: background 0.1s;
}
.qitem:hover { background: var(--bg-elev); }
.qitem.active { background: var(--brand-bg); border-left: 3px solid var(--brand); padding-left: 11px; }
.qitem .num { color: var(--text-faint); font-weight: 600; font-size: 13px; min-width: 22px; padding-top: 2px; }
.qitem .qtxt { flex: 1; min-width: 0; }
.qitem .qtitle { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.35; }
.qitem .qmeta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.qitem .snippet { font-size: 12px; color: var(--text-faint); margin-top: 4px; line-height: 1.4; }

/* Status pill — small badge */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.status-pill.nezacato  { background: #f1f5f9; color: #475569; }
.status-pill.nezacato::before  { background: var(--c-nezacato); }
.status-pill.ucim_se   { background: #fef3c7; color: #92400e; }
.status-pill.ucim_se::before   { background: var(--c-ucim_se); }
.status-pill.zopakovat { background: #fee2e2; color: #991b1b; }
.status-pill.zopakovat::before { background: var(--c-zopakovat); }
.status-pill.hotovo    { background: #d1fae5; color: #065f46; }
.status-pill.hotovo::before    { background: var(--c-hotovo); }

/* ============ Detail pane ============ */
#detail {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

#welcome { padding: 60px 40px; display: flex; justify-content: center; }
#welcome[hidden] { display: none; }
.welcome-card {
  position: relative;
  max-width: 600px;
  background: var(--bg-card);
  padding: 30px 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.welcome-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.15s;
}
.welcome-close:hover { background: var(--bg-elev); color: var(--text); }
.welcome-card h2 { margin: 0 0 8px; font-size: 22px; }
.welcome-card p  { color: var(--text-muted); margin-bottom: 16px; }
.welcome-card ul { color: var(--text-muted); padding-left: 18px; line-height: 1.9; }

.detail-wrap { max-width: 880px; margin: 0 auto; padding: 28px 28px 80px; }

.q-header {
  margin-bottom: 20px;
}
.q-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.q-breadcrumb .okruh-tag {
  background: var(--brand-soft);
  color: var(--brand-2);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.q-title { font-size: 26px; font-weight: 700; margin: 0 0 14px; line-height: 1.25; letter-spacing: -0.01em; }

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.status-buttons button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.status-buttons button:hover { border-color: var(--text-faint); background: var(--bg-elev); }
.status-buttons button.active.nezacato  { background: #f1f5f9; color: #334155; border-color: #94a3b8; }
.status-buttons button.active.ucim_se   { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.status-buttons button.active.zopakovat { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.status-buttons button.active.hotovo    { background: #d1fae5; color: #065f46; border-color: #10b981; }
.status-buttons button::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-buttons button.nezacato::before  { background: var(--c-nezacato); }
.status-buttons button.ucim_se::before   { background: var(--c-ucim_se); }
.status-buttons button.zopakovat::before { background: var(--c-zopakovat); }
.status-buttons button.hotovo::before    { background: var(--c-hotovo); }

/* ============ Markdown content (.prose) ============ */
.prose { color: var(--text); }
.prose > blockquote:first-of-type {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 18px;
  color: var(--text-muted);
  font-style: normal;
}
.prose > blockquote:first-of-type strong { color: var(--text); }
.prose > blockquote:first-of-type p { margin: 4px 0; }

.prose h1 { display: none; } /* hidden — title shown in header */
.prose h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 28px 0 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  color: var(--text);
}
.prose h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 22px 0 8px;
  color: var(--text);
}
.prose p, .prose ul, .prose ol {
  margin: 10px 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { font-weight: 600; color: var(--text); }
.prose em { font-style: italic; }
.prose a { color: var(--brand-2); text-decoration: underline; }
.prose a:hover { color: var(--brand); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.prose code {
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--brand-2);
}
.prose pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  margin: 14px 0;
}
.prose pre code { background: none; color: inherit; padding: 0; }

.prose blockquote {
  border-left: 3px solid var(--border-strong);
  padding: 4px 0 4px 14px;
  margin: 12px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Tables */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.prose th, .prose td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.prose th { background: var(--bg-elev); font-weight: 600; font-size: 13px; color: var(--text); }
.prose tr:last-child td { border-bottom: 0; }
.prose tr:nth-child(even) td { background: #fafbfc; }

/* TL;DR box — bílá s jemně žlutým nádechem, příjemná na čtení */
.prose .tldr {
  background: #fffdf5;
  border: 1px solid #f3e4b1;
  border-left: 4px solid #eab308;
  border-radius: 10px;
  padding: 18px 24px;
  margin: 0 0 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.prose .tldr > p:first-child,
.prose .tldr > p:first-child strong,
.prose .tldr > strong:first-child {
  font-size: 13px;
  font-weight: 700;
  color: #854d0e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.prose .tldr > p:first-child {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3e4b1;
}
.prose .tldr p { margin: 8px 0; color: var(--text); font-size: 14.5px; }
.prose .tldr p > strong:first-child {
  display: inline-block;
  color: #854d0e;
  font-weight: 700;
  margin-top: 10px;
}
.prose .tldr ul {
  margin: 6px 0 10px;
  padding-left: 22px;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.65;
}
.prose .tldr ul li { margin: 3px 0; }
.prose .tldr ul li strong { color: #1e293b; font-weight: 600; }

/* Doplněno mimo výpisky — content NOT from the source DOCX */
.prose .addition {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 3px solid #0284c7;
  border-radius: 8px;
  padding: 14px 18px 10px;
  margin: 12px 0;
  position: relative;
}
.prose .addition::before {
  content: "+ Doplněno mimo výpisky";
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #bae6fd;
}
.prose .addition > :first-child { margin-top: 0; }
.prose .addition > :last-child { margin-bottom: 0; }
.prose .addition p,
.prose .addition ul,
.prose .addition ol {
  color: #0c4a6e;
}

/* Mini quiz */
.quiz-block { margin: 24px 0; }
.quiz-card {
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  border: 1px solid #c4b5fd;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 18px 22px;
}
.quiz-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quiz-q {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 14px;
  line-height: 1.45;
}
.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-option {
  text-align: left;
  padding: 10px 14px;
  background: white;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.45;
}
.quiz-option:hover:not(:disabled) { background: #f5f3ff; border-color: var(--brand); }
.quiz-option:disabled { cursor: default; opacity: 0.95; }
.quiz-option.correct { background: #d1fae5; border-color: #10b981; color: #065f46; font-weight: 500; }
.quiz-option.wrong { background: #fee2e2; border-color: #ef4444; color: #991b1b; font-weight: 500; }
.quiz-feedback {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.55;
}
.quiz-feedback.ok  { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.quiz-feedback.bad { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.quiz-feedback strong { display: inline-block; margin-right: 6px; }
.quiz-actions { margin-top: 14px; }
.quiz-btn-primary {
  background: var(--brand);
  color: white;
  border: 0;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.quiz-btn-primary:hover { background: var(--brand-2); }
.quiz-score-card { text-align: center; padding: 20px 16px; }
.quiz-score-card .quiz-score {
  font-size: 36px;
  font-weight: 800;
  color: var(--brand-2);
  margin: 10px 0;
}
.quiz-score-card .quiz-score-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .quiz-card { padding: 14px 16px; }
  .quiz-q { font-size: 14.5px; }
  .quiz-option { font-size: 13.5px; padding: 9px 12px; }
}

/* Mermaid container */
.mermaid-wrap {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin: 16px 0;
  text-align: center;
  overflow-x: auto;
}
.mermaid-wrap svg { max-width: 100%; height: auto; }
.mermaid-err {
  background: #fee2e2;
  border: 1px solid #ef4444;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  font-size: 13px;
  color: #991b1b;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
}

/* Notes section */
.notes-card {
  margin-top: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.notes-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.notes-card textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.notes-card textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.notes-card textarea:disabled { background: var(--bg-elev); color: var(--text-faint); cursor: not-allowed; }
#notes-status { font-size: 12px; color: var(--text-faint); margin-top: 6px; min-height: 14px; }
#notes-status.ok  { color: var(--c-hotovo); }
#notes-status.bad { color: var(--c-zopakovat); }
#notes-status .link-btn { color: var(--c-zopakovat); }

/* ============ Status filters ============ */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.12s;
}
.filter-chip:hover { border-color: var(--border-strong); background: var(--bg-elev); }
.filter-chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); }
.filter-chip .fc-count {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
}
.filter-chip.active .fc-count { color: var(--brand-2); }
/* Tint the dot per status so the chips read at a glance. */
.filter-chip.nezacato::before,
.filter-chip.ucim_se::before,
.filter-chip.zopakovat::before,
.filter-chip.hotovo::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.filter-chip.nezacato::before  { background: var(--c-nezacato); }
.filter-chip.ucim_se::before   { background: var(--c-ucim_se); }
.filter-chip.zopakovat::before { background: var(--c-zopakovat); }
.filter-chip.hotovo::before    { background: var(--c-hotovo); }

/* ============ Review-next button ============ */
.review-next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.review-next-btn:hover:not(:disabled) { background: var(--brand-2); }
.review-next-btn:disabled { background: var(--border-strong); cursor: not-allowed; opacity: 0.7; }
.review-next-btn .rn-badge {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 100;
  max-width: min(90vw, 420px);
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok  { background: #065f46; }
.toast.bad { background: #991b1b; }

/* ============ Shortcuts modal ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 30px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-card h2 { margin: 0 0 16px; font-size: 20px; }
.shortcuts-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.shortcuts-table td { padding: 7px 6px; border-bottom: 1px solid var(--bg-elev); color: var(--text-muted); }
.shortcuts-table tr:last-child td { border-bottom: 0; }
.shortcuts-table td:first-child { white-space: nowrap; width: 1%; }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-elev);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
}

/* Search results */
.search-snippet {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ Mobile nav (hidden on desktop) ============ */
#mobile-nav {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
#mobile-qselect {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 15px;
  background: white;
  color: var(--text);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
#mobile-qselect:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ============ Mobile ============ */
@media (max-width: 768px) {
  body { font-size: 14.5px; }

  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  #user-area input { width: 110px; padding: 6px 8px; font-size: 13px; }
  #user-area button.primary { padding: 6px 10px; font-size: 13px; }
  .user-chip { font-size: 13px; padding: 3px 8px; }

  main { flex-direction: column; overflow: visible; height: auto; }
  #app { height: 100vh; }
  .page { flex-direction: column; }
  #sidebar { display: none; }
  #mobile-nav { display: block; }

  #welcome { padding: 20px 12px; }
  .welcome-card { padding: 20px 18px; }
  .welcome-card h2 { font-size: 18px; }

  #detail { width: 100%; flex: 1; min-height: 0; }
  .detail-wrap { padding: 14px 14px 80px; max-width: 100%; }

  .q-breadcrumb { font-size: 12px; gap: 6px; margin-bottom: 2px; }
  .q-title { font-size: 20px; margin-bottom: 10px; }

  .status-buttons { gap: 4px; margin-bottom: 14px; }
  .status-buttons button { padding: 6px 10px; font-size: 12px; }

  .prose h2 { font-size: 16px; padding: 8px 12px; margin: 18px 0 10px; }
  .prose h3 { font-size: 15px; margin: 16px 0 6px; }
  .prose p, .prose ul, .prose ol { font-size: 14px; line-height: 1.6; }
  .prose ul, .prose ol { padding-left: 20px; }
  .prose table { font-size: 13px; }
  .prose th, .prose td { padding: 6px 8px; }

  .prose .tldr { padding: 14px 16px 10px; margin-bottom: 16px; border-radius: 8px; }
  .prose .tldr ul { font-size: 13.5px; padding-left: 20px; }
  .prose .tldr p { font-size: 13.5px; }

  .prose .addition { padding: 12px 14px 8px; margin: 10px 0; }
  .prose .addition::before { font-size: 10px; margin-bottom: 6px; padding-bottom: 4px; }

  .mermaid-wrap { padding: 12px; margin: 12px 0; }

  .notes-card { padding: 14px 16px; margin-top: 22px; }
  .notes-card textarea { min-height: 120px; font-size: 14px; padding: 10px; }
}

@media (max-width: 420px) {
  .topbar h1 { font-size: 14px; }
  #user-area input { width: 90px; }
  .q-title { font-size: 18px; }
  .status-buttons button { padding: 5px 8px; font-size: 11px; }
}
