/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg:        #080a10;
  --surface:   #0f1220;
  --surface2:  #161929;
  --surface3:  #1e2238;
  --border:    #252840;
  --border2:   #2e3355;
  --accent:    #7c6af7;
  --accent-h:  #9580ff;
  --gold:      #f5a623;
  --gold-h:    #ffbb44;
  --text:      #e8eaf0;
  --muted:     #8b90a8;
  --dim:       #505570;
  --green:     #34d399;
  --red:       #f87171;
  --blue:      #60a5fa;
  --r:         10px;
  --r-sm:      6px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --font:      "Inter", system-ui, sans-serif;
  --sidebar-w: 260px;
  --topbar-h:  56px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ── Login ──────────────────────────────────────────────────────── */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(124,106,247,.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 70%, rgba(245,166,35,.08) 0%, transparent 60%),
    var(--bg);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 0 80px rgba(124,106,247,.12), var(--shadow);
}

.login-logo { font-size: 40px; text-align: center; margin-bottom: 10px; }
.login-title { font-size: 26px; font-weight: 800; text-align: center; letter-spacing: -1px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 28px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }

input[type="email"],
input[type="password"],
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.error-msg {
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--red);
  font-size: 12px;
  margin-bottom: 12px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 11px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  margin-top: 8px;
}
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; margin-top: 0; }

.btn-primary-sm {
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary-sm:hover { opacity: .85; }

.btn-outline {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-outline:hover { color: var(--text); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s;
}
.btn-ghost:hover { color: var(--text); }

.btn-generate-all {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--gold), #e8911a);
  color: #111;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s;
  letter-spacing: .3px;
}
.btn-generate-all:hover { opacity: .85; }

.btn-logout {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--dim);
  font-size: 11px;
  cursor: pointer;
  transition: color .15s;
  width: 100%;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ── App Layout ─────────────────────────────────────────────────── */
.app-view {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 20px; }
.logo-text { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }

.sidebar-nav {
  padding: 12px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(124,106,247,.15); color: var(--accent-h); font-weight: 600; }
.nav-icon { font-size: 14px; }

.sidebar-section-label {
  padding: 16px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .8px;
}

/* ── Book Tree ──────────────────────────────────────────────────── */
.book-tree { padding: 0 8px; flex: 1; }

.book-node { margin-bottom: 4px; }

.book-node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  transition: background .12s;
}
.book-node-header:hover { background: var(--surface2); }

.book-toggle { color: var(--dim); font-size: 10px; transition: transform .15s; }
.book-toggle.open { transform: rotate(90deg); }
.book-icon { font-size: 14px; }

.chapter-list { padding: 2px 0 4px 24px; display: none; }
.chapter-list.open { display: block; }

.chapter-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 11.5px;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.chapter-node:hover { background: var(--surface2); color: var(--text); }
.chapter-node.active { background: rgba(124,106,247,.12); color: var(--accent); }

.chapter-dots {
  display: flex;
  gap: 3px;
}
.dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border2);
}
.dot.has-notes { background: var(--accent); }
.dot.has-cards { background: var(--gold); }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.user-email { font-size: 11px; color: var(--dim); margin-bottom: 8px; word-break: break-all; }

/* ── Main ───────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumb { font-size: 13px; color: var(--muted); font-weight: 500; }
.breadcrumb strong { color: var(--text); }

.top-stats { display: flex; gap: 20px; }
.top-stat { font-size: 12px; color: var(--muted); }
.top-stat strong { color: var(--text); }

/* ── Content ────────────────────────────────────────────────────── */
.content-section { padding: 32px 36px; max-width: 1100px; }

.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.section-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ── Stats Grid ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, transform .15s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }

.stat-card-icon { font-size: 22px; }
.stat-card-value { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: var(--text); }
.stat-card-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ── Two column ─────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.widget-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 12px;
}

.widget-list { display: flex; flex-direction: column; gap: 8px; }

.widget-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.widget-item:hover { border-color: var(--accent); }
.widget-item-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.widget-item-meta { font-size: 11px; color: var(--muted); }

/* ── Chapter header ─────────────────────────────────────────────── */
.chapter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.chapter-book-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}

.chapter-title-h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
}

.chapter-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.word-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ── Tab bar ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Tab toolbar ────────────────────────────────────────────────── */
.tab-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.status-text { font-size: 12px; color: var(--dim); }
.kbd-hint { font-size: 11px; color: var(--dim); margin-left: auto; }

/* ── Loader ─────────────────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--muted);
}
.empty-icon { font-size: 40px; }
.empty-state p { font-size: 14px; }

/* ── Notes ──────────────────────────────────────────────────────── */
.notes-body { display: flex; flex-direction: column; gap: 28px; }

.note-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .15s;
}
.note-section:hover { border-color: var(--border2); }

.note-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.note-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent);
}

.add-annotation-btn {
  font-size: 11px;
  color: var(--dim);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.add-annotation-btn:hover { color: var(--gold); border-color: var(--gold); }

.note-section-body { padding: 16px 18px; }

/* Summary */
.summary-text { font-size: 14px; color: var(--text); line-height: 1.7; }

/* Key points */
.key-points { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.key-point {
  display: flex;
  gap: 10px;
  font-size: 13px;
  line-height: 1.55;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.key-point:hover { background: var(--surface2); }
.key-point::before { content: "›"; color: var(--accent); font-weight: 900; flex-shrink: 0; font-size: 16px; line-height: 1.3; }

/* Pearls */
.pearl-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pearl {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(245,166,35,.07);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}
.pearl-icon { color: var(--gold); flex-shrink: 0; }

/* Terms */
.terms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.term-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  transition: border-color .15s;
}
.term-card:hover { border-color: var(--accent); }
.term-name { font-weight: 700; color: var(--accent); font-size: 13px; margin-bottom: 4px; }
.term-def { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Hooks */
.hooks-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hook {
  background: rgba(124,106,247,.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 10px 12px;
  font-size: 13px;
  font-style: italic;
  color: var(--text);
}

/* Annotations */
.annotations-area { padding: 10px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.annotation-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.5;
  border-left: 3px solid;
  position: relative;
}
.annotation-card.amber { background: rgba(245,166,35,.08); border-left-color: var(--gold); }
.annotation-card.violet { background: rgba(124,106,247,.08); border-left-color: var(--accent); }
.annotation-card.teal { background: rgba(52,211,153,.08); border-left-color: var(--green); }
.annotation-card.rose { background: rgba(248,113,113,.08); border-left-color: var(--red); }
.annotation-text { flex: 1; color: var(--text); }
.annotation-delete { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12px; padding: 0 4px; }
.annotation-delete:hover { color: var(--red); }

/* ── Flashcards ─────────────────────────────────────────────────── */
.flashcards-body { max-width: 640px; margin: 0 auto; }

.flashcard {
  perspective: 1200px;
  height: 260px;
  margin-bottom: 20px;
  cursor: pointer;
  outline: none;
}

.fc-inner {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.fc-inner.flipped { transform: rotateY(180deg); }

.fc-front, .fc-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.fc-front {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border2);
}
.fc-back {
  background: linear-gradient(135deg, #141630, #1a1f3a);
  border: 1px solid var(--accent);
  transform: rotateY(180deg);
}
.fc-front p, .fc-back p { font-size: 16px; line-height: 1.6; color: var(--text); }
.fc-tap { font-size: 11px; color: var(--dim); margin-top: 12px; position: absolute; bottom: 14px; }

.fc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fc-prog { font-size: 13px; color: var(--muted); font-weight: 600; }

.fc-rating { text-align: center; margin-bottom: 10px; }
.rating-label { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.rating-row { display: flex; gap: 10px; justify-content: center; }

.rate-btn {
  flex: 1;
  max-width: 120px;
  padding: 9px 0;
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.rate-again { background: rgba(248,113,113,.1); color: var(--red); border-color: rgba(248,113,113,.3); }
.rate-good  { background: rgba(245,166,35,.1); color: var(--gold); border-color: rgba(245,166,35,.3); }
.rate-easy  { background: rgba(52,211,153,.1); color: var(--green); border-color: rgba(52,211,153,.3); }
.rate-btn:hover { opacity: .75; }

.due-info { text-align: center; font-size: 11px; color: var(--dim); }

/* ── Quiz ───────────────────────────────────────────────────────── */
.select-sm {
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.quiz-body { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }

.quiz-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  transition: border-color .15s;
}
.q-label { font-size: 10px; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.q-text { font-size: 14px; color: var(--text); margin-bottom: 14px; line-height: 1.5; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.q-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: border-color .12s, background .12s;
}
.q-opt:hover { border-color: var(--accent); }
.q-opt.selected { border-color: var(--accent); background: rgba(124,106,247,.12); }
.q-opt.correct  { border-color: var(--green); background: rgba(52,211,153,.1); }
.q-opt.wrong    { border-color: var(--red); background: rgba(248,113,113,.1); }
.opt-key { font-weight: 800; color: var(--accent); min-width: 16px; flex-shrink: 0; }

.q-explanation {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(52,211,153,.06);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: none;
}
.q-explanation.show { display: block; }

.quiz-submit-row { display: flex; justify-content: flex-end; margin-top: 8px; }

/* Quiz Results */
.quiz-results { max-width: 760px; }

.score-banner {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 28px;
  text-align: center;
  margin-bottom: 24px;
}
.score-circle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  margin-bottom: 12px;
}
.score-num { font-size: 28px; font-weight: 900; color: var(--accent); }
.score-pct { font-size: 12px; color: var(--muted); }
.score-msg { font-size: 14px; color: var(--muted); }

.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}
.review-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}
.badge-ok { background: rgba(52,211,153,.15); color: var(--green); }
.badge-bad { background: rgba(248,113,113,.15); color: var(--red); }
.review-q { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.review-exp { font-size: 12px; color: var(--muted); }

/* ── Stats tab ──────────────────────────────────────────────────── */
.stats-body { display: flex; flex-direction: column; gap: 20px; max-width: 700px; }

.stat-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
}
.stat-row h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }

.progress-bar-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.progress-label { font-size: 12px; color: var(--muted); min-width: 100px; }
.progress-track { flex: 1; height: 6px; background: var(--surface2); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; transition: width .5s ease; }
.progress-fill.violet { background: var(--accent); }
.progress-fill.gold { background: var(--gold); }
.progress-fill.green { background: var(--green); }
.progress-val { font-size: 12px; color: var(--text); font-weight: 600; min-width: 30px; text-align: right; }

.quiz-history-list { display: flex; flex-direction: column; gap: 8px; }
.quiz-hist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.quiz-hist-score { font-weight: 700; color: var(--text); }

/* ── Annotation Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 24px;
  width: min(440px, 94vw);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-close:hover { color: var(--text); }

.color-picker { display: flex; gap: 10px; margin-bottom: 14px; }
.color-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s;
}
.color-dot:hover, .color-dot.active { transform: scale(1.2); border-color: #fff; }
.color-dot.amber { background: var(--gold); }
.color-dot.violet { background: var(--accent); }
.color-dot.teal { background: var(--green); }
.color-dot.rose { background: var(--red); }

.annotation-textarea {
  resize: vertical;
  min-height: 90px;
  margin-bottom: 14px;
}

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  white-space: nowrap;
  animation: fadeUp .2s ease;
  pointer-events: none;
}
@keyframes fadeUp {
  from { opacity:0; transform: translate(-50%, 10px); }
  to   { opacity:1; transform: translate(-50%, 0); }
}
