/* ============================================================
   StudyAI — Main Stylesheet
   Theme: Clean academic, white + dark blue, Bricolage Grotesque
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300;12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css');

/* ---- VARIABLES ---- */
:root {
  --bg: #ffffff;
  --bg-off: #f8f9fc;
  --surface: #f2f4f9;
  --surface2: #e8ecf5;
  --border: #dde2f0;
  --border-light: #eef0f8;

  --navy: #0a1f4e;
  --navy-mid: #112660;
  --navy-light: #1a3580;
  --accent: #1e4fd8;
  --accent-hover: #1a43c0;
  --accent-muted: #e8eefa;
  --accent-muted2: #d4ddf8;

  --text: #08112e;
  --text-2: #3a4a72;
  --text-3: #7a8ab0;
  --text-4: #a8b4d0;

  --success: #0d9158;
  --success-bg: #edfaf4;
  --danger: #d42b2b;
  --danger-bg: #fef2f2;
  --warning: #c47a0a;
  --warning-bg: #fff8ed;
  --info: #0070c9;
  --info-bg: #e8f4fd;

  --sidebar-w: 268px;
  --topbar-h: 58px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(10,31,78,0.06);
  --shadow: 0 2px 8px rgba(10,31,78,0.08), 0 1px 2px rgba(10,31,78,0.05);
  --shadow-md: 0 4px 16px rgba(10,31,78,0.1), 0 1px 4px rgba(10,31,78,0.06);
  --shadow-lg: 0 8px 32px rgba(10,31,78,0.14), 0 2px 8px rgba(10,31,78,0.07);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Bricolage Grotesque', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.logo-mark {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #fff;
}
.logo-text { font-size: 1.05rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.logo-beta {
  margin-left: auto;
  font-size: 0.62rem; font-weight: 700;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  padding: 2px 7px; border-radius: 10px;
  letter-spacing: 0.05em;
}

/* Workspaces */
.sb-section { padding: 16px 14px 10px; flex-shrink: 0; }
.sb-label {
  font-size: 0.65rem; font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0 6px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.sb-label-btn {
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.1);
  border: none; border-radius: 5px;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.sb-label-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

.ws-list { display: flex; flex-direction: column; gap: 1px; max-height: 180px; overflow-y: auto; }
.ws-item {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem; font-weight: 500;
  transition: all 0.15s;
  position: relative;
  border: none; background: none; text-align: left; width: 100%;
}
.ws-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.ws-item.active { background: rgba(255,255,255,0.13); color: #fff; }
.ws-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 55%;
  background: #60a5fa; border-radius: 2px;
}
.ws-item i { font-size: 15px; flex-shrink: 0; opacity: 0.7; }
.ws-item.active i { opacity: 1; }
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-file-count {
  font-size: 0.68rem; font-weight: 700;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  padding: 1px 6px; border-radius: 8px;
  flex-shrink: 0;
}
.ws-del {
  opacity: 0; width: 20px; height: 20px;
  background: none; border: none;
  color: rgba(255,255,255,0.4); font-size: 13px;
  border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.ws-item:hover .ws-del { opacity: 1; }
.ws-del:hover { background: rgba(220,38,38,0.3); color: #fca5a5; }

.ws-add-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px dashed rgba(255,255,255,0.18);
  background: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem; font-weight: 500;
  width: 100%; text-align: left;
  transition: all 0.15s;
  margin-top: 6px;
}
.ws-add-btn:hover { border-color: rgba(255,255,255,0.35); color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.06); }
.ws-add-btn i { font-size: 15px; }

/* Nav */
.sb-nav { padding: 6px 14px; flex: 1; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-item i { font-size: 18px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.65rem; font-weight: 800;
  background: #3b82f6;
  color: #fff; padding: 1px 6px; border-radius: 8px;
}

.sb-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.api-key-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255,255,255,0.06);
  font-size: 0.78rem; color: rgba(255,255,255,0.5);
  cursor: pointer; border: none; width: 100%; text-align: left;
  transition: all 0.15s;
}
.api-key-row:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); }
.api-key-row i { font-size: 15px; }
.api-key-status {
  margin-left: auto;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
}
.api-key-status.connected { background: #22c55e; }

/* ================================================================
   MAIN LAYOUT
   ================================================================ */
.main {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 14px;
  flex-shrink: 0; background: var(--bg);
  z-index: 10;
}
.menu-btn {
  display: none;
  background: none; border: none;
  font-size: 20px; color: var(--text-2);
  border-radius: 8px; padding: 4px;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.topbar-ws {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  background: var(--accent-muted);
  border-radius: 6px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--accent);
  max-width: 200px; overflow: hidden;
}
.topbar-ws i { font-size: 14px; flex-shrink: 0; }
.topbar-ws span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================
   VIEWS
   ================================================================ */
.view { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.view.active { display: flex; }

/* ================================================================
   CHAT VIEW
   ================================================================ */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 28px 20px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}

/* Message bubbles */
.msg { display: flex; gap: 10px; max-width: 800px; animation: msgIn 0.25s ease; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.msg-av {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; margin-top: 2px;
}
.msg.ai .msg-av { background: var(--navy); color: #fff; }
.msg.user .msg-av { background: var(--accent-muted); color: var(--accent); }

.msg-content { display: flex; flex-direction: column; gap: 4px; max-width: calc(100% - 44px); }
.msg-name { font-size: 0.7rem; font-weight: 700; color: var(--text-3); padding: 0 4px; }
.msg.user .msg-name { text-align: right; }

.msg-bubble {
  padding: 12px 16px;
  font-size: 0.9rem; line-height: 1.7;
}
.msg.ai .msg-bubble {
  background: var(--bg-off);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 2px;
  color: var(--text);
}
.msg.user .msg-bubble {
  background: var(--navy);
  color: #fff;
  border-radius: 12px 12px 2px 12px;
}



/* Source badge */
.msg-source {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.7rem; color: var(--text-3);
  padding: 0 4px;
}
.msg-source i { font-size: 11px; }
.msg-source span { font-style: italic; }

/* Typing */
.typing-dot-wrap {
  display: flex; gap: 5px; align-items: center;
  padding: 14px 18px;
  background: var(--bg-off); border: 1px solid var(--border);
  border-radius: 12px 12px 12px 2px; width: fit-content;
}
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: td 1.3s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes td { 0%,60%,100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-7px); opacity: 1; } }

/* Welcome */
.chat-welcome {
  max-width: 680px;
  padding: 8px 0;
}
.welcome-head {
  margin-bottom: 20px;
}
.welcome-head h2 { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -0.02em; }
.welcome-head p { font-size: 0.88rem; color: var(--text-2); line-height: 1.6; }

.suggestion-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 16px;
}
.sug-chip {
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem; font-weight: 500; color: var(--text-2);
  cursor: pointer; text-align: left;
  transition: all 0.15s;
  display: flex; align-items: flex-start; gap: 8px;
  line-height: 1.4;
}
.sug-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.sug-chip i { font-size: 15px; margin-top: 1px; flex-shrink: 0; color: var(--text-3); }
.sug-chip:hover i { color: var(--accent); }

/* ---- CHAT INPUT AREA ---- */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  background: var(--bg);
  flex-shrink: 0;
}
.chat-input-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,79,216,0.08);
}

.chat-context-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 0;
  flex-wrap: wrap;
  min-height: 0;
}
.ctx-tag {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: var(--accent-muted);
  border: 1px solid var(--accent-muted2);
  border-radius: 14px;
  font-size: 0.73rem; font-weight: 600;
  color: var(--accent);
}
.ctx-tag i { font-size: 12px; }
.ctx-tag-close {
  background: none; border: none;
  color: var(--accent); font-size: 13px;
  line-height: 1; padding: 0; margin-left: 2px;
  cursor: pointer; opacity: 0.6;
}
.ctx-tag-close:hover { opacity: 1; }

.chat-input-row {
  display: flex; align-items: flex-end; gap: 0;
  padding: 6px 8px 8px;
}
.chat-left-btns { display: flex; align-items: center; gap: 2px; flex-shrink: 0; padding-bottom: 1px; }
.chat-right-btns { display: flex; align-items: center; gap: 4px; flex-shrink: 0; padding-bottom: 1px; }

.cin-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: none;
  color: var(--text-2);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cin-btn:hover { background: var(--border); color: var(--text); }
.cin-btn.accent { background: var(--accent); color: #fff; }
.cin-btn.accent:hover { background: var(--accent-hover); }
.cin-btn-ghost {
  width: 34px; height: 34px;
  border-radius: 50%; border: none;
  background: none;
  color: var(--text-3); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.cin-btn-ghost:hover { background: var(--surface2); color: var(--text-2); }

.chat-textarea {
  flex: 1;
  background: none; border: none; outline: none;
  font-family: inherit; font-size: 0.9rem;
  color: var(--text); line-height: 1.55;
  resize: none; padding: 7px 10px;
  max-height: 160px; min-height: 36px;
}
.chat-textarea::placeholder { color: var(--text-3); }

.chat-toolbar {
  display: flex; gap: 5px; align-items: center;
  padding: 0 14px 10px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.tool-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-2);
  transition: all 0.15s;
}
.tool-chip:hover { background: var(--accent-muted); border-color: var(--accent-muted2); color: var(--accent); }
.tool-chip i { font-size: 13px; }
.tool-chip-divider {
  width: 1px; height: 16px;
  background: var(--border); margin: 0 3px;
}

/* ================================================================
   RESOURCE PICKER DRAWER
   ================================================================ */
.resource-drawer {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
  transform: translateY(10px);
  opacity: 0; pointer-events: none;
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  max-height: 320px;
}
.resource-drawer.open {
  transform: translateY(0);
  opacity: 1; pointer-events: auto;
}
.rd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.rd-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.rd-close {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface); border: none;
  color: var(--text-2); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.rd-body { overflow-y: auto; max-height: 230px; padding: 8px; }
.rd-ws-section { margin-bottom: 4px; }
.rd-ws-name {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-3);
  padding: 6px 8px 4px;
}
.rd-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: background 0.12s;
  border: none; background: none; width: 100%; text-align: left;
}
.rd-file-item:hover { background: var(--accent-muted); }
.rd-file-item.selected { background: var(--accent-muted); }
.rd-file-item.selected .rd-fi-name { color: var(--accent); font-weight: 600; }
.rd-fi-icon {
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
  background: var(--surface);
}
.rd-fi-icon.pdf { background: #fef2f2; color: #dc2626; }
.rd-fi-icon.doc { background: #eff6ff; color: #2563eb; }
.rd-fi-icon.txt { background: #f0fdf4; color: #16a34a; }
.rd-fi-icon.pptx { background: #fff7ed; color: #ea580c; }
.rd-fi-icon.md { background: #fdf4ff; color: #9333ea; }
.rd-fi-icon.default { background: var(--surface2); color: var(--text-2); }
.rd-fi-name { font-size: 0.83rem; font-weight: 500; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-fi-size { font-size: 0.72rem; color: var(--text-3); flex-shrink: 0; }
.rd-fi-check {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0;
}
.rd-file-item.selected .rd-fi-check { opacity: 1; }
.rd-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.rd-empty {
  padding: 24px; text-align: center;
  font-size: 0.83rem; color: var(--text-3);
}
.rd-empty i { font-size: 28px; display: block; margin-bottom: 8px; opacity: 0.4; }

/* ================================================================
   MATERIALS VIEW
   ================================================================ */
.mat-view { padding: 24px 20px; overflow-y: auto; }
.mat-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-heading { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.section-sub { font-size: 0.82rem; color: var(--text-3); margin-top: 2px; }

.ws-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.ws-tab {
  padding: 6px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-2);
  cursor: pointer; transition: all 0.15s;
}
.ws-tab:hover { border-color: var(--accent); color: var(--accent); }
.ws-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.file-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.file-card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.file-card-name { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 4px; word-break: break-word; }
.file-card-meta { font-size: 0.75rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.file-card-meta i { font-size: 12px; }
.file-card-ws {
  position: absolute; top: 12px; right: 12px;
  font-size: 0.66rem; font-weight: 700;
  background: var(--accent-muted);
  color: var(--accent);
  padding: 2px 8px; border-radius: 8px;
}
.file-card-del {
  position: absolute; bottom: 14px; right: 14px;
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--danger); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.file-card:hover .file-card-del { opacity: 1; }

.add-file-card {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 32px 18px;
  cursor: pointer; transition: all 0.15s;
  color: var(--text-3); font-size: 0.83rem; font-weight: 500;
  text-align: center;
}
.add-file-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.add-file-card i { font-size: 28px; }

.mat-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; text-align: center;
}
.empty-icon {
  width: 64px; height: 64px;
  background: var(--accent-muted); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--accent); margin-bottom: 16px;
}
.empty-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 0.84rem; color: var(--text-3); max-width: 300px; line-height: 1.6; margin-bottom: 20px; }

/* ================================================================
   FLASHCARDS VIEW
   ================================================================ */
.fc-list-wrap { flex: 1; overflow-y: auto; padding: 24px 20px; }
.fc-study-wrap { flex: 1; overflow-y: auto; display: none; }

.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fc-item {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.fc-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fc-item-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 2px 8px; border-radius: 5px; margin-bottom: 10px;
}
.fc-item-q { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
.fc-item-a {
  font-size: 0.8rem; color: var(--text-2); line-height: 1.55;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.fc-diff {
  display: inline-flex; align-items: center;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; margin-top: 10px;
}
.fc-diff.easy { background: var(--success-bg); color: var(--success); }
.fc-diff.medium { background: var(--warning-bg); color: var(--warning); }
.fc-diff.hard { background: var(--danger-bg); color: var(--danger); }

/* Study mode */
.fc-study {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px; gap: 20px; min-height: 100%;
}
.fc-meta-row {
  width: 100%; max-width: 560px;
  display: flex; align-items: center; justify-content: space-between;
}
.fc-pbar-wrap { width: 100%; max-width: 560px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.fc-pbar { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.35s; }

.flashcard { width: 100%; max-width: 560px; min-height: 280px; perspective: 1400px; cursor: pointer; }
.fc-inner { position: relative; width: 100%; min-height: 280px; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(.4,0,.2,1); }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: var(--radius-xl);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 36px 32px; text-align: center;
  min-height: 280px;
}
.fc-face-front {
  background: var(--bg);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
.fc-face-back {
  background: var(--navy);
  border-color: var(--navy);
  transform: rotateY(180deg);
  box-shadow: var(--shadow-md);
}
.fc-face-label {
  font-size: 0.68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 18px;
}
.fc-face-front .fc-face-label { color: var(--text-3); }
.fc-face-back .fc-face-label { color: rgba(255,255,255,0.4); }
.fc-face-text { font-size: 1.05rem; font-weight: 500; line-height: 1.65; }
.fc-face-front .fc-face-text { color: var(--text); }
.fc-face-back .fc-face-text { color: #fff; }
.fc-face-hint {
  position: absolute; bottom: 16px;
  font-size: 0.72rem; color: var(--text-3);
  display: flex; align-items: center; gap: 4px;
}
.fc-face-back .fc-face-hint { color: rgba(255,255,255,0.3); }

.fc-actions {
  width: 100%; max-width: 560px;
  display: flex; align-items: center; gap: 10px;
}
.fc-nav {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-2);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.fc-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.fc-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.fc-judge { flex: 1; display: flex; gap: 8px; justify-content: center; }
.fc-got-it {
  flex: 1; max-width: 170px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--success); background: var(--success-bg);
  color: var(--success); font-size: 0.84rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s;
}
.fc-got-it:hover { background: var(--success); color: #fff; }
.fc-review {
  flex: 1; max-width: 170px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--danger); background: var(--danger-bg);
  color: var(--danger); font-size: 0.84rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s;
}
.fc-review:hover { background: var(--danger); color: #fff; }

.fc-stats-row {
  display: flex; gap: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.fc-stat-known { color: var(--success); }
.fc-stat-review { color: var(--danger); }
.fc-stat-total { color: var(--text-3); }

/* ================================================================
   QUIZ VIEW
   ================================================================ */
.quiz-setup-wrap { flex: 1; overflow-y: auto; padding: 24px 20px; }
.quiz-active-wrap { flex: 1; overflow-y: auto; padding: 24px 20px; display: none; }
.quiz-result-wrap { flex: 1; overflow-y: auto; display: none; }

.qz-config {
  max-width: 580px;
  background: var(--bg-off);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin-bottom: 20px;
}
.qz-config-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 20px; letter-spacing: -0.01em; }
.cfg-row { margin-bottom: 18px; }
.cfg-label { font-size: 0.78rem; font-weight: 700; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.cfg-label-val { font-weight: 800; color: var(--accent); }
.cfg-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 0.88rem;
  color: var(--text); background: var(--bg); outline: none;
  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='%237a8ab0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  transition: border-color 0.15s;
}
.cfg-select:focus { border-color: var(--accent); }
.cfg-range { width: 100%; appearance: none; height: 4px; background: var(--border); border-radius: 2px; outline: none; border: none; }
.cfg-range::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; background: var(--accent); border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.cfg-toggle-group { display: flex; gap: 6px; flex-wrap: wrap; }
.cfg-toggle {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-2); background: var(--bg);
  cursor: pointer; transition: all 0.15s;
}
.cfg-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.qz-start-btn {
  width: 100%; max-width: 580px;
  padding: 14px;
  background: var(--navy);
  color: #fff; border: none;
  border-radius: var(--radius-lg);
  font-size: 0.95rem; font-weight: 800;
  letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
}
.qz-start-btn:hover { background: var(--navy-light); }

.qz-active { max-width: 640px; margin: 0 auto; }
.qz-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
}
.qz-pbar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.qz-pbar { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s; }
.qz-counter { font-size: 0.8rem; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.qz-score { font-size: 0.8rem; font-weight: 700; color: var(--success); white-space: nowrap; }
.qz-exit { background: none; border: none; color: var(--text-3); font-size: 20px; }

.qz-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.qz-q-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.qz-q-num { font-size: 0.73rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.qz-q-diff { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.qz-q-topic { font-size: 0.73rem; color: var(--text-3); font-weight: 600; margin-left: auto; }
.qz-q-text { font-size: 1rem; font-weight: 600; line-height: 1.6; color: var(--text); }

.qz-opts { display: flex; flex-direction: column; gap: 9px; }
.qz-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem; font-weight: 500;
  cursor: pointer; color: var(--text);
  transition: all 0.15s;
  background: var(--bg); text-align: left; width: 100%;
  font-family: inherit;
}
.qz-opt:hover:not(.locked) { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.qz-opt.selected { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.qz-opt.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.qz-opt.wrong { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.qz-opt .opt-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; flex-shrink: 0;
  transition: all 0.15s;
}
.qz-opt.correct .opt-badge { background: var(--success); color: #fff; }
.qz-opt.wrong .opt-badge { background: var(--danger); color: #fff; }
.qz-opt.selected .opt-badge { background: var(--accent); color: #fff; }

.qz-explanation {
  background: var(--info-bg);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.84rem; line-height: 1.65;
  color: var(--text-2); display: none;
  margin-bottom: 14px;
  animation: fadeIn 0.2s ease;
}
.qz-explanation.show { display: block; }
.qz-explanation-head { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--info); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.qz-next-btn {
  width: 100%; padding: 13px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
}
.qz-next-btn:hover { background: var(--accent-hover); }

.qz-results-wrap { max-width: 520px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.qz-result-ring {
  position: relative;
  width: 130px; height: 130px; margin: 0 auto 24px;
}
.qz-result-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 10; }
.ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1); }
.qz-result-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.res-score { font-size: 2rem; font-weight: 900; color: var(--navy); letter-spacing: -0.03em; }
.res-pct { font-size: 0.75rem; font-weight: 700; color: var(--text-3); }
.res-title { font-size: 1.35rem; font-weight: 900; color: var(--text); margin-bottom: 6px; letter-spacing: -0.02em; }
.res-sub { font-size: 0.88rem; color: var(--text-2); margin-bottom: 6px; }
.res-grade {
  display: inline-block;
  font-size: 1.1rem; font-weight: 900;
  padding: 6px 20px; border-radius: 24px; margin-bottom: 28px;
}
.res-grade.A { background: var(--success-bg); color: var(--success); }
.res-grade.B { background: var(--info-bg); color: var(--info); }
.res-grade.C { background: var(--warning-bg); color: var(--warning); }
.res-grade.F { background: var(--danger-bg); color: var(--danger); }
.res-btns { display: flex; gap: 10px; justify-content: center; }

/* ================================================================
   NOTES VIEW
   ================================================================ */
.notes-wrap { flex: 1; overflow-y: auto; padding: 24px 20px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.note-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.note-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.note-card-priority {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 5px; margin-bottom: 10px;
}
.note-card-priority.high { background: var(--danger-bg); color: var(--danger); }
.note-card-priority.medium { background: var(--warning-bg); color: var(--warning); }
.note-card-priority.low { background: var(--success-bg); color: var(--success); }
.note-card-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.note-card-body { font-size: 0.82rem; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.note-card-points { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.note-kp {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 0.79rem; color: var(--text-2);
}
.note-kp::before { content: '›'; color: var(--accent); font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.note-exam-tip {
  margin-top: 12px;
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.78rem; color: var(--warning); line-height: 1.5;
}
.note-exam-tip strong { display: block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }

/* ================================================================
   SUMMARY VIEW
   ================================================================ */
.summary-wrap { flex: 1; overflow-y: auto; padding: 24px 20px; }
.summary-card {
  max-width: 760px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow);
}
.sum-overview {
  font-size: 0.95rem; line-height: 1.7; color: var(--text-2);
  padding-bottom: 20px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sum-topic { margin-bottom: 20px; }
.sum-topic-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.sum-topic-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }
.sum-points { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.sum-point {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.85rem; color: var(--text-2); line-height: 1.55;
}
.sum-point::before { content: '•'; color: var(--accent); font-weight: 900; flex-shrink: 0; }
.sum-critical {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.83rem; color: var(--danger); font-weight: 600; line-height: 1.5;
  margin-top: 4px;
}
.sum-critical::before { content: '★'; flex-shrink: 0; }
.sum-top5 {
  background: var(--accent-muted);
  border: 1.5px solid var(--accent-muted2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 20px;
}
.sum-top5-title { font-size: 0.82rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.sum-t5-item {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.85rem; color: var(--text); margin-bottom: 8px; line-height: 1.5;
}
.sum-t5-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 0.72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ================================================================
   MODALS
   ================================================================ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(8,17,46,0.5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 92%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.overlay.open .modal { transform: translateY(0) scale(1); }
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface); border: none;
  color: var(--text-2); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--surface2); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 0 24px 22px; display: flex; gap: 10px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center; cursor: pointer;
  transition: all 0.15s; margin-bottom: 18px;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: var(--accent-muted); }
.drop-zone i { font-size: 40px; color: var(--text-3); display: block; margin-bottom: 12px; }
.drop-zone.drag i { color: var(--accent); }
.drop-zone-text { font-size: 0.88rem; color: var(--text-2); line-height: 1.6; }
.drop-zone-text strong { color: var(--accent); }
.drop-zone-sub { font-size: 0.76rem; color: var(--text-3); margin-top: 4px; }
.drop-zone input[type=file] { display: none; }

.ws-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 0.88rem;
  color: var(--text); background: var(--bg); outline: none;
  margin-bottom: 16px; transition: border-color 0.15s;
}
.ws-input:focus { border-color: var(--accent); }
.ws-input::placeholder { color: var(--text-3); }

.upload-list { display: flex; flex-direction: column; gap: 7px; max-height: 200px; overflow-y: auto; margin-bottom: 4px; }
.ul-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ul-item i { font-size: 18px; flex-shrink: 0; }
.ul-item-name { flex: 1; font-size: 0.84rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ul-item-size { font-size: 0.73rem; color: var(--text-3); flex-shrink: 0; }
.ul-item-del { background: none; border: none; color: var(--text-3); font-size: 15px; flex-shrink: 0; transition: color 0.15s; }
.ul-item-del:hover { color: var(--danger); }

/* API Key modal */
.api-input-wrap {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 4px 14px 4px 4px;
  margin-bottom: 12px; transition: border-color 0.15s;
}
.api-input-wrap:focus-within { border-color: var(--accent); }
.api-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: inherit; font-size: 0.88rem; color: var(--text);
  padding: 8px 10px;
}
.api-eye { background: none; border: none; color: var(--text-3); font-size: 16px; }
.api-note { font-size: 0.78rem; color: var(--text-3); line-height: 1.6; }
.api-note a { color: var(--accent); text-decoration: underline; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius);
  font-size: 0.87rem; font-weight: 700;
  transition: background 0.15s; font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary i { font-size: 16px; }
.btn-navy {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px;
  background: var(--navy); color: #fff; border: none;
  border-radius: var(--radius);
  font-size: 0.87rem; font-weight: 700;
  transition: background 0.15s; font-family: inherit;
}
.btn-navy:hover { background: var(--navy-light); }
.btn-secondary {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px;
  background: var(--bg); color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.87rem; font-weight: 700;
  transition: all 0.15s; font-family: inherit;
}
.btn-secondary:hover { background: var(--accent-muted); }
.btn-ghost {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px;
  background: none; color: var(--text-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.87rem; font-weight: 600;
  transition: all 0.15s; font-family: inherit;
}
.btn-ghost:hover { background: var(--surface); border-color: var(--text-3); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon i { font-size: 17px; }

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy);
  color: #fff; padding: 10px 20px;
  border-radius: 8px; font-size: 0.84rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 999;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast i { font-size: 15px; }

/* Mobile overlay */
.mob-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 90;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mob-overlay.show { display: block; }
  .menu-btn { display: flex; }
  .main { width: 100%; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .fc-study { padding: 20px 14px; }
  .flashcard { min-height: 240px; }
  .fc-inner { min-height: 240px; }
  .fc-face { min-height: 240px; padding: 28px 22px; }
  .qz-results-wrap { padding: 32px 16px; }
  .summary-card { padding: 20px; }
}
