:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d2129;
  --border: #262b36;
  --text: #e6e8ee;
  --muted: #8a93a6;
  --accent: #6aa9ff;
  --accent-2: #ffd166;
  --danger: #ff6b6b;
  --ok: #8bd17c;
  --sepia: #d8a657;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
a { color: var(--accent); }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
header .title { display: flex; align-items: baseline; gap: 14px; }
header h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 0.2px; }
.muted { color: var(--muted); font-size: 12px; font-weight: 400; }

button, .btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 14px; cursor: pointer; font: inherit; font-size: 13px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #0a0d12; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.actions { display: flex; gap: 8px; }

/* ---- Live explorer ---- */
.explorer { background: linear-gradient(180deg, #14171e, #0f1115); border-bottom: 1px solid var(--border); }
.explorer-inner { padding: 20px 24px; }
.explorer h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
#explore-form { display: flex; gap: 8px; flex-wrap: wrap; }
#explore-q {
  flex: 1 1 360px; padding: 9px 13px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 14px;
}
#explore-q:focus { outline: none; border-color: var(--accent); }
#explore-source {
  padding: 9px 12px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px;
}

/* AI summary box */
.ai-summary {
  margin-top: 14px; background: linear-gradient(180deg, rgba(106,169,255,0.08), rgba(106,169,255,0.02));
  border: 1px solid rgba(106,169,255,0.35); border-radius: 10px; padding: 12px 16px;
}
.ai-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-badge { font-weight: 700; font-size: 13px; color: var(--accent); }
.ai-status { font-size: 12px; color: var(--muted); font-style: italic; }
.ai-meta { font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.ai-text { margin: 0; font-size: 14px; line-height: 1.65; }
.ai-note { font-size: 12.5px; color: var(--muted); }

/* For You recommendations */
#foryou { max-width: 1100px; margin: 0 auto; }
.rec-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.rec-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: border-color 0.15s, transform 0.08s;
}
.rec-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.rec-fac { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.rec-name { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.rec-ext { color: var(--muted); font-size: 12px; }
.rec-why { color: var(--muted); font-size: 13px; line-height: 1.55; }
.rec-from { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.from-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-right: 2px; }
.from-chip { font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; color: var(--accent-2); }
.emb-tag { color: var(--ok); }
.rec-card { position: relative; }
.brief-del {
  position: absolute; top: 8px; right: 8px; background: transparent; border: 0;
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 2px 5px; line-height: 1;
}
.brief-del:hover { color: var(--danger); }

/* Curriculum builder */
#curriculum { max-width: 1100px; margin: 0 auto; }
.cur-form { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; }
.cur-form input {
  flex: 1 1 360px; padding: 9px 13px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px;
}
.cur-form input:focus { outline: none; border-color: var(--accent); }

.explore-results {
  margin-top: 16px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.ex-card {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--sepia); border-radius: 8px;
  padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start;
}
.ex-card.clickable { cursor: pointer; }
.ex-card.clickable:hover { border-color: var(--accent); }
.ex-card img { width: 54px; height: 54px; object-fit: cover; border-radius: 5px; flex: 0 0 auto; background: var(--panel-2); }
.ex-card .ex-text { min-width: 0; flex: 1; }
.star-btn {
  background: transparent; border: 0; color: var(--muted); font-size: 17px;
  line-height: 1; cursor: pointer; padding: 0 2px; align-self: flex-start; flex: 0 0 auto;
}
.star-btn:hover, .star-btn.on { color: var(--accent-2); }
.count-badge {
  background: var(--accent-2); color: #0a0d12; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; padding: 0 6px; margin-left: 2px;
}
#preview-save.on { color: var(--accent-2); border-color: rgba(255,209,102,0.5); }
.cached-tag { color: var(--ok); font-size: 11px; }
.ex-card a { color: var(--text); text-decoration: none; font-weight: 600; display: block; }
.ex-card a:hover { color: var(--accent); }
.ex-card .ex-sub { color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.ex-status { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding: 6px 2px; }
.ex-status.err { color: var(--danger); }

/* All-sources grouped layout */
.explore-results.grouped { display: block; }
.ex-group { margin-top: 14px; }
.ex-group-head {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 5px; margin-bottom: 10px;
}
.ex-group-name { font-weight: 700; font-size: 13.5px; }
.ex-group-count {
  font-size: 11px; color: var(--ok); border: 1px solid rgba(139,209,124,0.4);
  border-radius: 999px; padding: 1px 9px;
}
.ex-group-err { font-size: 11px; color: var(--danger); border: 1px solid #5a2730; border-radius: 999px; padding: 1px 9px; }
.ex-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ex-empty { color: var(--muted); font-size: 12.5px; padding: 2px 0 6px; }

/* ---- Category filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 24px 0; }
.chip {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); color: #0a0d12; border-color: var(--accent); font-weight: 600; }
.chip-group-label { flex-basis: 100%; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); font-weight: 700; margin: 8px 0 -2px; }

.faculty-head {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 800;
  color: var(--accent-2); margin: 10px 0 4px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
#guide .faculty-head { margin-top: 26px; }
.fac-count { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0; }

/* ---- Collapsible accordions (directory + field guide) ---- */
.guide-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.guide-toolbar .guide-intro { margin: 0; flex: 1 1 420px; }
.guide-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.fac-acc { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--panel); }
.fac-acc[open] { border-color: #30374a; }
.fac-sum {
  cursor: pointer; padding: 14px 18px; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; list-style: none; user-select: none;
}
.fac-sum::-webkit-details-marker { display: none; }
.fac-sum::before { content: "▸"; color: var(--muted); font-size: 13px; display: inline-block; transition: transform 0.15s; }
.fac-acc[open] > .fac-sum::before { transform: rotate(90deg); }
.fac-sum:hover { color: var(--accent); }
.fac-emoji { font-size: 18px; }
.fac-body { padding: 4px 18px 16px; }
.fac-body .group { margin-bottom: 18px; }
.fac-body .group:last-child { margin-bottom: 4px; }

.guide-cat-h {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted);
  font-weight: 700; margin: 16px 0 2px; border-bottom: 1px solid var(--border); padding-bottom: 5px;
}
.entry-acc { border-top: 1px solid var(--border); }
.entry-acc:first-of-type { border-top: 0; }
.entry-sum {
  cursor: pointer; padding: 11px 2px; display: flex; align-items: baseline; gap: 9px;
  list-style: none; user-select: none; flex-wrap: wrap;
}
.entry-sum::-webkit-details-marker { display: none; }
.entry-sum::before { content: "+"; color: var(--accent-2); font-weight: 700; width: 13px; flex: 0 0 auto; display: inline-block; }
.entry-acc[open] > .entry-sum::before { content: "–"; }
.entry-sum .e-name { font-weight: 600; }
.entry-sum:hover .e-name { color: var(--accent); }
.e-desc { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.entry-body { padding: 2px 4px 16px 24px; font-size: 14px; line-height: 1.7; }
.entry-body p { margin: 0 0 12px; }

main { padding: 18px 24px 70px; }

.group { margin-bottom: 30px; }
.group-head { margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; }
.group-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.group-blurb { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; max-width: 80ch; }
.group-note {
  background: rgba(216,166,87,0.08); border: 1px solid rgba(216,166,87,0.3);
  border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; font-size: 13px; color: var(--text); max-width: 90ch;
}
.group-note b { color: var(--sepia); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sepia);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s, transform 0.08s; cursor: pointer;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: 9px; }
.card .emoji { font-size: 19px; line-height: 1; }
.card .name { font-weight: 600; font-size: 15px; }
.card .desc { color: var(--muted); font-size: 12.5px; }
.card .counts { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.card .counts b { color: var(--text); font-weight: 600; }
.card .api-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.api-chip {
  font-size: 10.5px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; color: var(--muted);
}
.api-chip.live { border-color: rgba(139,209,124,0.5); color: var(--ok); }

.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 30; overflow-y: auto;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  max-width: 760px; width: 100%; padding: 22px 24px; position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 12px; background: var(--panel-2);
  border-radius: 6px; padding: 4px 9px;
}
.modal-body h2 { margin: 0 0 4px; font-size: 20px; }
.modal-body .m-desc { color: var(--muted); margin: 0 0 16px; }
.m-section { margin-bottom: 16px; }
.m-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 0 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.m-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.m-list li { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 11px; }
.m-list a { text-decoration: none; }
.m-list a:hover { text-decoration: underline; }
.m-api { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-api .auth { font-size: 10.5px; border-radius: 5px; padding: 1px 7px; border: 1px solid var(--border); color: var(--muted); }
.m-api .auth.none { color: var(--ok); border-color: rgba(139,209,124,0.4); }
.m-api .auth.key { color: var(--accent-2); border-color: rgba(255,209,102,0.4); }
.m-api .auth.oauth { color: var(--accent); border-color: rgba(106,169,255,0.4); }
.m-api .live-badge { font-size: 10px; color: var(--ok); border: 1px solid rgba(139,209,124,0.5); border-radius: 5px; padding: 1px 6px; }
.m-api .try-btn { margin-left: auto; font-size: 11px; padding: 3px 9px; }
.m-api .note { flex-basis: 100%; color: var(--muted); font-size: 12px; }

/* ---- Field Guide reading view ---- */
#guide { max-width: 1100px; margin: 0 auto; }
.guide-intro { color: var(--muted); font-size: 13px; margin: 4px 0 22px; max-width: 80ch; }
.guide-cat { margin-bottom: 34px; }
.guide-cat > h2 { font-size: 17px; margin: 0 0 2px; }
.guide-cat > .group-blurb { margin-bottom: 18px; }
.entry {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--sepia); border-radius: 10px;
  padding: 18px 22px; margin-bottom: 16px; scroll-margin-top: 80px;
}
.entry h3 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.entry p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; }
.entry p:last-of-type { margin-bottom: 14px; }
.cites { border-top: 1px solid var(--border); padding-top: 12px; }
.cites h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.cites ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.cites li { font-size: 12.5px; line-height: 1.5; }
.cites li .ckind {
  display: inline-block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-right: 6px; vertical-align: 1px;
}
.cites li .ckind.foundational { color: var(--sepia); border-color: rgba(216,166,87,0.4); }
.cites li .ckind.reference { color: var(--accent); border-color: rgba(106,169,255,0.4); }
.cites .verified { color: var(--ok); margin-left: 4px; cursor: help; }
.cites a { word-break: break-word; }
.cites .cnote { color: var(--muted); font-style: italic; }

/* ---- In-app preview drawer ---- */
.preview-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 45; }
.preview {
  position: fixed; top: 0; right: 0; height: 100vh; width: 60vw; min-width: 360px;
  background: var(--panel); border-left: 1px solid var(--border);
  z-index: 46; display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.preview-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.preview-title {
  flex: 1; min-width: 0; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-body { position: relative; flex: 1; background: var(--panel); overflow: hidden; }
.preview-content {
  height: 100%; overflow-y: auto; padding: 24px 30px 70px;
  font-size: 15px; line-height: 1.75; color: var(--text);
}
.preview-content .reader-title { font-size: 23px; line-height: 1.25; margin: 0 0 6px; }
.preview-content .reader-src { margin: 0 0 22px; font-size: 12px; word-break: break-all; }
.preview-content .reader-src a { color: var(--muted); }
.preview-content p { margin: 0 0 15px; }
.preview-content h1, .preview-content h2, .preview-content h3, .preview-content h4 { line-height: 1.3; margin: 24px 0 9px; }
.preview-content a { color: var(--accent); }
.preview-content img { max-width: 100%; height: auto; border-radius: 6px; margin: 10px 0; background: var(--panel-2); }
.preview-content figure { margin: 14px 0; }
.preview-content figcaption { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.preview-content ul, .preview-content ol { padding-left: 22px; margin: 0 0 15px; }
.preview-content li { margin: 0 0 6px; }
.preview-content blockquote { margin: 0 0 15px; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--muted); }
.preview-content pre { white-space: pre-wrap; background: var(--panel-2); padding: 12px; border-radius: 6px; overflow-x: auto; }
.preview-content code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.preview-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 15px; font-size: 13px; }
.preview-content th, .preview-content td { border: 1px solid var(--border); padding: 5px 9px; }
.dd-model {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12px;
}
.dd-content h2 { font-size: 17px; margin: 20px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); color: var(--accent-2); }
.dd-content h2:first-child { margin-top: 0; }
.dd-content h3 { font-size: 14px; margin: 16px 0 6px; }
.dd-content .cite { color: var(--ok); font-size: 12px; font-weight: 600; }
.mk-course {
  margin-left: 10px; font-size: 11px; padding: 2px 9px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px; color: var(--accent);
  cursor: pointer; vertical-align: middle; font-weight: 600;
}
.mk-course:hover { border-color: var(--accent); background: rgba(106,169,255,0.12); }
.mk-all-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin: 0 0 16px;
}
.queue-banner {
  position: fixed; bottom: 18px; left: 18px; z-index: 30;
  background: var(--panel-2); border: 1px solid var(--accent-2); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45); max-width: 70vw;
}
.queue-banner .qstop { font-size: 11px; padding: 2px 9px; margin-left: 8px; }
.dd-content ul { padding-left: 22px; margin: 0 0 14px; }
.dd-content li { margin: 0 0 5px; }
.ai-dd { margin-left: auto; font-size: 12px; padding: 4px 10px; }
.dd-warn { color: var(--accent-2); }

.preview-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; background: var(--panel);
}
@media (max-width: 720px) { .preview { width: 100vw; } }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 16px; font-size: 13px; z-index: 40;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); max-width: 80vw;
}
.hidden { display: none !important; }

/* ---- Authoritative, consistent typography for ALL generated docs in the drawer
   (course, degree, briefing). Defined last so it wins over the overlapping
   .preview-content rules; gives every doc the same vertical rhythm. ---- */
.dd-content { font-size: 15px; line-height: 1.7; }
.dd-content > :first-child { margin-top: 0 !important; }
.dd-content h1 { font-size: 22px; line-height: 1.25; margin: 26px 0 12px; color: var(--text); }
.dd-content h2 { font-size: 18px; line-height: 1.3; margin: 26px 0 10px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border); color: var(--accent-2); }
.dd-content h3 { font-size: 15px; line-height: 1.35; margin: 20px 0 7px; color: var(--text); font-weight: 700; }
.dd-content p { margin: 0 0 14px; }
.dd-content ul, .dd-content ol { padding-left: 24px; margin: 0 0 14px; }
.dd-content li { margin: 0 0 6px; }
.dd-content li > p { margin: 0 0 6px; }
.dd-content strong { font-weight: 700; color: var(--text); }
.dd-content em { font-style: italic; }
.dd-content .cite { color: var(--ok); font-size: 12px; font-weight: 600; }
.dd-content blockquote { margin: 0 0 14px; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--muted); }
.dd-content code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.dd-content pre { white-space: pre-wrap; background: var(--panel-2); padding: 12px; border-radius: 6px; overflow-x: auto; margin: 0 0 14px; }
.dd-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.dd-content th, .dd-content td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; }
.dd-content hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

/* ===== Knowledge-base feature views (Ask / Major / Study / Map / Library) ===== */
.view-lead { color: var(--muted); font-size: 13.5px; max-width: 760px; margin: 2px 0 16px; line-height: 1.5; }
.ask-form, .builder-form { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.ask-form input[type=text], .builder-form input[type=text] {
  flex: 1; min-width: 280px; padding: 10px 12px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.ask-examples { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.ask-q { font-weight: 650; font-size: 15px; margin: 14px 0 8px; padding: 10px 14px;
  background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 6px; }
.ask-answer { max-width: 820px; }

/* Library / bibliography */
.lib-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.lib-controls input { flex: 1; min-width: 240px; padding: 8px 11px; background: var(--panel-2);
  color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; }
.lib-fac { margin: 18px 0 6px; }
.lib-list { list-style: none; padding: 0; margin: 0; }
.lib-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.45; }
.lib-list .lib-field { color: var(--muted); font-size: 11.5px; }

/* Study / flashcards */
.flashcard { max-width: 640px; margin: 18px auto; min-height: 200px; padding: 26px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; font-size: 17px; line-height: 1.5; }
.flashcard .fc-side { width: 100%; }
.flashcard .fc-hint { color: var(--muted); font-size: 12px; margin-top: 14px; }
.study-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.quiz-q { max-width: 680px; margin: 16px auto; }
.quiz-opt { display: block; width: 100%; text-align: left; padding: 10px 14px; margin: 6px 0;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 14px; }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.correct { border-color: #3fb950; background: rgba(63,185,80,.12); }
.quiz-opt.wrong { border-color: #f85149; background: rgba(248,81,73,.12); }

/* Concept map */
#map-canvas { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); display: block; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0; font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
