/* ============================================
   EXPLAINABLES · CLASS 6 · RAINBOW THEME
   ============================================ */

/* Settings-driven overrides */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
body.high-contrast { filter: contrast(1.25); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c6-bg: #0a0015;
  --c6-surface: #110022;
  --c6-border: #2a0050;
  --c6-text: #fff0ff;
  --c6-muted: #9966bb;
  --r1: #ff6ec7; --r2: #ff9d3e; --r3: #ffe066; --r4: #6eff91; --r5: #6ecfff; --r6: #c56eff;
  --font: 'Nunito', sans-serif;
  --font-display: 'Fredoka One', cursive;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --radius: 18px;
  --tr: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light mode */
.light-mode {
  --c6-bg: #fff5ff;
  --c6-surface: #ffe8ff;
  --c6-border: #ffaaee;
  --c6-text: #220033;
  --c6-muted: #883399;
}
.light-mode .sidebar { background: rgba(255,230,255,0.97) !important; }
.light-mode .sidebar * { color: #220033 !important; }
.light-mode .sb-brand { color: #660066 !important; }
.light-mode .sidebar-toggle-btn { color: #440044 !important; }
.light-mode .new-chat-btn { background: rgba(180,0,180,0.1) !important; border-color: rgba(200,0,200,0.35) !important; color: #440044 !important; }
.light-mode .sidebar-search input { background: rgba(180,0,180,0.05) !important; border-color: rgba(200,0,200,0.3) !important; color: #220033 !important; }
.light-mode .sidebar-search input::placeholder { color: #883399 !important; }
.light-mode .sb-bottom-btn { background: rgba(180,0,180,0.06) !important; border-color: rgba(200,0,200,0.2) !important; color: #220033 !important; }
.light-mode .sb-bottom-btn:hover { background: rgba(180,0,180,0.14) !important; }
.light-mode .chat-item:hover { background: rgba(180,0,180,0.08) !important; }
.light-mode .user-row:hover { background: rgba(180,0,180,0.08) !important; }
.light-mode .user-name, .light-mode .user-email { color: #220033 !important; }
.light-mode .user-email { color: #883399 !important; }
.light-mode .user-menu { background: rgba(255,230,255,0.99) !important; border-color: rgba(200,0,200,0.3) !important; }
.light-mode .user-menu button { color: #220033 !important; }
.light-mode .chat-history-label { color: #660066 !important; }
.light-mode .chat-title { color: #220033 !important; }
.light-mode .lib-section-label { color: #660066 !important; }
.light-mode .lib-item { color: #220033 !important; }
.light-mode .lib-link { color: #660066 !important; }
.light-mode .topbar { background: rgba(255,230,255,0.92) !important; border-bottom-color: rgba(200,0,200,0.2) !important; }
.light-mode .brand-text, .light-mode .brand-sub { color: #440044 !important; }
.light-mode .top-icon-btn { border-color: rgba(200,0,200,0.25) !important; color: #440044 !important; }

/* ---- CURSOR ---- */
html { cursor: none !important; }
* { cursor: inherit !important; }
.cursor-glow {
  position: fixed;
  width: 30px; height: 30px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  background: conic-gradient(#ff6ec7, #ffe066, #6eff91, #6ecfff, #c56eff, #ff6ec7);
  
  opacity: 0.8;
  top: 0; left: 0;
  will-change: transform;
  contain: layout size style;
  transform: translate(-50%, -50%);
}
.cursor-trail {
  position: fixed;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  pointer-events: none;
  z-index: 9998;
  top: 0; left: 0;
  will-change: transform;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}

/* ---- GLITTER ---- */
.glitter-container { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.glitter {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: glitterFall 3s linear infinite;
  pointer-events: none;
}
@keyframes glitterFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---- BG CANVAS ---- */
#bgCanvas { contain: strict;  position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---- MUTE BTN ---- */
.mute-btn {
  position: fixed;
  top: 70px; right: 130px;
  z-index: 500;
  background: rgba(255,110,199,0.15);
  border: 1px solid var(--r1);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s;
  box-shadow: 0 0 12px var(--r1);
}
.mute-btn:hover { transform: scale(1.15); box-shadow: 0 0 24px var(--r1); }

/* ── LAYOUT ───────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--c6-bg);
  color: var(--c6-text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  position: relative;
}

/* ── SIDEBAR ──────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(17, 0, 34, 0.92);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--c6-border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--tr);
  overflow: hidden;
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,110,199,0.05) 0%, rgba(198,110,255,0.05) 100%);
  pointer-events: none;
}
.left-sidebar { left: 0; border-right: 1px solid var(--c6-border); }
.right-sidebar { right: 0; border-left: 1px solid var(--c6-border); }

.sidebar.collapsed-left { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar.collapsed-right { transform: translateX(var(--sidebar-w)); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--c6-border);
}
.sidebar-logo { display: flex; align-items: center; gap: 8px; }
.sb-logo-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  animation: logoRainbow 4s linear infinite;
}
@keyframes logoRainbow {
  0% { filter: hue-rotate(0deg) brightness(1.2); }
  100% { filter: hue-rotate(360deg) brightness(1.2); }
}
.sb-brand {
  font-family: var(--font-display);
  font-size: 18px;
  background: linear-gradient(90deg, var(--r1), var(--r3), var(--r5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-toggle-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--c6-border);
  border-radius: 8px;
  color: var(--c6-muted);
  width: 44px; height: 44px; /* was 28×28 — raised to WCAG AA 44px minimum */
  font-size: 14px;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle-btn:hover { background: rgba(255,110,199,0.15); color: var(--r1); border-color: var(--r1); }

.new-chat-btn {
  margin: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--r1), var(--r6));
  border: none;
  border-radius: 12px;
  color: white;
  font-family: var(--font-display);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.3s var(--tr), opacity 0.3s var(--tr), box-shadow 0.3s var(--tr);
  box-shadow: 0 4px 20px rgba(255,110,199,0.3);
}
.new-chat-btn:hover { transform: scale(1.03); box-shadow: 0 8px 30px rgba(255,110,199,0.5); }

.sidebar-search { padding: 8px 12px; }
.sidebar-search input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--c6-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--c6-text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.sidebar-search input:focus { border-color: var(--r1); box-shadow: 0 0 0 3px rgba(255,110,199,0.15); }

.chat-history { flex: 1; overflow-y: auto; padding: 8px; }
.chat-history::-webkit-scrollbar { width: 4px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--r6); border-radius: 4px; }

.history-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c6-muted);
  padding: 8px 4px 4px;
}
.chat-history-item {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--c6-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  margin-bottom: 2px;
}
.chat-history-item:hover { background: rgba(255,110,199,0.1); }
.chat-history-item.active { background: rgba(255,110,199,0.15); border-left: 3px solid var(--r1); }
.chat-hist-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-hist-actions { display: none; gap: 4px; }
.chat-history-item:hover .chat-hist-actions { display: flex; }
.chat-hist-actions button {
  background: none; border: none; font-size: 14px; padding: 2px; border-radius: 4px;
  transition: background 0.2s;
}
.chat-hist-actions button:hover { background: rgba(255,255,255,0.1); }

.sidebar-bottom { padding: 12px; border-top: 1px solid var(--c6-border); display: flex; flex-direction: column; gap: 8px; }
.sb-bottom-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}
.upgrade-btn {
  background: linear-gradient(135deg, rgba(255,110,199,0.15), rgba(198,110,255,0.15));
  border-color: rgba(255,110,199,0.3);
  color: var(--r1);
}
.upgrade-btn:hover { border-color: var(--r1); box-shadow: 0 0 15px rgba(255,110,199,0.3); }
.settings-btn { background: rgba(255,255,255,0.04); color: var(--c6-muted); }
.settings-btn:hover { background: rgba(255,255,255,0.08); color: var(--c6-text); }

.user-profile-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  transition: background 0.2s;
}
.user-profile-btn:hover { background: rgba(255,255,255,0.06); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--r1), var(--r6));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { display: block; font-size: 11px; color: var(--c6-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chevron { font-size: 10px; color: var(--c6-muted); }
.user-menu {
  background: rgba(17,0,34,0.95);
  border: 1px solid var(--c6-border);
  border-radius: 10px;
  padding: 6px;
}
.user-menu button { display: block; width: 100%; padding: 8px 12px; border: none; background: none; color: var(--c6-text); font-size: 13px; text-align: left; border-radius: 7px; transition: background 0.2s; }
.user-menu button:hover { background: rgba(255,110,199,0.12); }

/* ── COLLAPSED SIDEBAR BUTTONS ───────── */
.sidebar-collapsed-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 150;
  width: 44px; height: 60px; /* was 36px wide — raised to WCAG AA 44px minimum */
  border-radius: 0 10px 10px 0;
  background: rgba(17,0,34,0.9);
  border: 1px solid var(--c6-border);
  border-left: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s;
  box-shadow: 4px 0 20px rgba(255,110,199,0.2);
  display: none;
}
.left-collapsed { left: 0; border-radius: 0 10px 10px 0; }
.right-collapsed { right: 0; border-radius: 10px 0 0 10px; border-right: none; border-left: 1px solid var(--c6-border); box-shadow: -4px 0 20px rgba(198,110,255,0.2); }
.sidebar-collapsed-btn:hover { box-shadow: 0 0 20px rgba(255,110,199,0.4); }

/* ── MAIN AREA ────────────────────────── */
.main-area {
  position: fixed;
  left: var(--sidebar-w);
  right: var(--sidebar-w);
  top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  transition: left 0.4s var(--tr), right 0.4s var(--tr);
  z-index: 10;
}

/* ── TOP BAR ──────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(10,0,21,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c6-border);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.top-left { display: flex; align-items: center; gap: 10px; }
.top-explainables { font-family: var(--font-display); font-size: 20px; background: linear-gradient(90deg, var(--r1), var(--r3), var(--r5)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.top-sub { font-size: 12px; color: var(--c6-muted); }
.top-right { display: flex; align-items: center; gap: 10px; }
.questions-left {
  font-size: 12px; color: var(--r3);
  background: rgba(255,224,102,0.1);
  border: 1px solid rgba(255,224,102,0.3);
  border-radius: 20px; padding: 5px 12px;
  display: flex; align-items: center; gap: 4px;
}
.top-icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--c6-border);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s var(--tr), opacity 0.25s var(--tr), box-shadow 0.25s var(--tr);
  position: relative;
}
.top-icon-btn:hover {
  background: rgba(255,110,199,0.15);
  border-color: var(--r1);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255,110,199,0.4);
}
.top-login-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--r1), var(--r6));
  border: none;
  border-radius: 20px;
  color: white;
  font-family: var(--font-display);
  font-size: 13px;
  transition: transform 0.3s var(--tr), opacity 0.3s var(--tr), box-shadow 0.3s var(--tr);
  box-shadow: 0 4px 15px rgba(255,110,199,0.3);
}
.top-login-btn:hover { transform: scale(1.05); box-shadow: 0 6px 25px rgba(255,110,199,0.5); }

/* ── HOME SCREEN ──────────────────────── */
.home-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  position: relative;
  z-index: 5;
}
.home-logo-area { text-align: center; margin-bottom: 36px; }
.home-logo-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}
.home-logo-img {
  width: 90px; height: 90px;
  border-radius: 50%;
  filter: drop-shadow(0 0 30px rgba(255,110,199,0.7));
  animation: homeLogoBounce 3s ease infinite;
}
@keyframes homeLogoBounce {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 30px rgba(255,110,199,0.7)); }
  50% { transform: translateY(-12px) scale(1.05); filter: drop-shadow(0 0 50px rgba(198,110,255,0.9)); }
}
.home-logo-rings {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 2px solid rgba(255,110,199,0.3);
  animation: ringPulse 2s ease infinite;
}
@keyframes ringPulse {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}
.greeting-subtitle {
  font-size: 14px;
  background: linear-gradient(90deg, var(--r1), var(--r3), var(--r5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  font-weight: 700;
  animation: subRotate 6s linear infinite;
}
@keyframes subRotate {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(180deg); }
}
.greeting-main {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  background: linear-gradient(135deg, #fff, var(--r1), var(--r5), #fff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: greetShimmer 4s linear infinite;
}
@keyframes greetShimmer {
  to { background-position: 200% center; }
}

.suggestion-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; max-width: 700px;
}
.chip {
  padding: 10px 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,110,199,0.25);
  border-radius: 50px;
  font-size: 13px;
  color: var(--c6-text);
  font-family: var(--font);
  font-weight: 600;
  transition: transform 0.3s var(--tr), opacity 0.3s var(--tr), box-shadow 0.3s var(--tr);
  white-space: nowrap;
}
.chip:hover {
  background: rgba(255,110,199,0.15);
  border-color: var(--r1);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(255,110,199,0.3);
  color: var(--r1);
}

/* ── CHAT SECTION ─────────────────────── */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.chat-messages {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--r6); border-radius: 5px; }

/* Messages */
.msg { display: flex; gap: 10px; animation: msgIn 0.4s var(--tr) both; max-width: 80%; }
@keyframes msgIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.msg.user { flex-direction: row-reverse; align-self: flex-end; }
.msg.bot { align-self: flex-start; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.msg.user .msg-avatar { background: linear-gradient(135deg, var(--r1), var(--r6)); }
.msg.bot .msg-avatar { background: rgba(255,255,255,0.08); }

.msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, rgba(255,110,199,0.25), rgba(198,110,255,0.25));
  border: 1px solid rgba(255,110,199,0.3);
  border-top-right-radius: 4px;
  color: var(--c6-text);
}
.msg.bot .msg-bubble {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--c6-border);
  border-top-left-radius: 4px;
}

.msg-bubble strong { color: var(--r1); }
.msg-bubble em { color: var(--r5); font-style: italic; }
.msg-bubble u { text-decoration-color: var(--r3); }

/* Message actions — always visible below bot answers */
.msg-actions {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-top: 8px;
  opacity: 1;
  transition: opacity 0.2s;
}
/* User messages: only show actions on hover */
.msg.user .msg-actions { opacity: 0; }
.msg.user:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  padding: 4px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--c6-border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--c6-muted);
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  position: relative;
}
.msg-action-btn:hover { background: rgba(255,110,199,0.12); color: var(--r1); border-color: var(--r1); }
.msg-action-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}

/* Thinking indicator */
.thinking-indicator {
  display: flex; gap: 8px; align-items: center;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--c6-border);
  border-radius: 18px;
  color: var(--c6-muted);
  font-size: 13px;
  font-style: italic;
  animation: msgIn 0.4s var(--tr) both;
  align-self: flex-start;
  max-width: 70%;
}
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--r1);
  animation: dotBounce 1.2s ease infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; background: var(--r3); }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; background: var(--r5); }
@keyframes dotBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.scroll-down-btn {
  position: absolute;
  bottom: 12px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--r1), var(--r6));
  border: none; color: white; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(255,110,199,0.4);
  transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s;
  z-index: 10;
}
.scroll-down-btn:hover { transform: scale(1.1); box-shadow: 0 8px 30px rgba(255,110,199,0.6); }

/* ── INPUT AREA ───────────────────────── */
.chat-input-area {
  position: relative;
  z-index: 1;
  
  padding: 12px 16px;
  border-top: 1px solid var(--c6-border);
  background: rgba(10,0,21,0.95);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.disclaimer {
  font-size: 11px;
  color: var(--c6-muted);
  text-align: center;
  margin-bottom: 10px;
  opacity: 0.7;
}
.exhausted-banner {
  text-align: center;
  padding: 10px;
  background: rgba(255,110,110,0.1);
  border: 1px solid rgba(255,110,110,0.3);
  border-radius: 12px;
  font-size: 13px;
  color: #ff8888;
  margin-bottom: 10px;
}
.input-box-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,110,199,0.3);
  border-radius: 16px;
  padding: 8px 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.input-box-wrap:focus-within {
  border-color: var(--r1);
  box-shadow: 0 0 0 3px rgba(255,110,199,0.15), 0 0 20px rgba(255,110,199,0.1);
}
.input-box {
  flex: 1;
  min-height: 24px;
  max-height: 150px;
  overflow-y: auto;
  font-family: var(--font);
  font-size: 14px;
  color: var(--c6-text);
  outline: none;
  line-height: 1.6;
}
.input-box:empty::before {
  content: attr(data-placeholder);
  color: var(--c6-muted);
  pointer-events: none;
}
.input-action-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--c6-border);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--tr), opacity 0.25s var(--tr), box-shadow 0.25s var(--tr);
  color: var(--c6-muted);
}
.input-action-btn:hover { background: rgba(255,110,199,0.15); border-color: var(--r1); color: var(--r1); transform: scale(1.1); }
.attach-icon { font-size: 20px; font-weight: 300; line-height: 1; }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--r1), var(--r6));
  border: none;
  color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s var(--tr), opacity 0.3s var(--tr), box-shadow 0.3s var(--tr);
  box-shadow: 0 4px 15px rgba(255,110,199,0.3);
}
.send-btn:hover { transform: scale(1.1) rotate(10deg); box-shadow: 0 8px 25px rgba(255,110,199,0.5); }
.send-btn:active { transform: scale(0.95); }

/* ── RIGHT SIDEBAR LIBRARY ──────────── */
.library-content { flex: 1; overflow-y: auto; padding: 8px; }
.lib-section { margin-bottom: 16px; }
.lib-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c6-muted);
  padding: 6px 4px;
  font-weight: 700;
}
.lib-items { display: flex; flex-direction: column; gap: 4px; }
.lib-item {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--c6-text);
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; gap: 8px;
}
.lib-item:hover { border-color: var(--r1); background: rgba(255,110,199,0.08); transform: translateX(4px); }
.lib-link {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--r5);
  background: rgba(110,207,255,0.05);
  border: 1px solid rgba(110,207,255,0.15);
  text-decoration: none;
  display: block;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.lib-link:hover { border-color: var(--r5); background: rgba(110,207,255,0.1); transform: translateX(4px); }

/* ── MODALS ───────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: rgba(17,0,34,0.97);
  border: 1px solid var(--c6-border);
  border-radius: 24px;
  padding: 36px;
  max-width: 500px;
  width: 100%;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s var(--tr);
  box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 40px rgba(255,110,199,0.15);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.06); border: none;
  color: var(--c6-muted); width: 30px; height: 30px;
  border-radius: 50%; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,110,199,0.2); color: var(--r1); }

/* Upgrade */
.upgrade-header { text-align: center; margin-bottom: 24px; }
.upgrade-crown { font-size: 52px; margin-bottom: 12px; animation: crownSpin 3s ease infinite; }
@keyframes crownSpin { 0%,100%{transform:scale(1) rotate(-5deg);} 50%{transform:scale(1.1) rotate(5deg);} }
.upgrade-header h2 { font-family: var(--font-display); font-size: 28px; background: linear-gradient(135deg, var(--r1), var(--r3), var(--r5)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 6px; }
.upgrade-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.uf-item { padding: 10px 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--c6-border); border-radius: 10px; font-size: 14px; }
.upgrade-cta-btn { width: 100%; padding: 16px; background: linear-gradient(135deg, var(--r1), var(--r6)); border: none; border-radius: 14px; color: white; font-family: var(--font-display); font-size: 18px; cursor: pointer; box-shadow: 0 8px 30px rgba(255,110,199,0.4); margin-bottom: 12px; }
.upgrade-cta-btn:hover { transform: scale(1.03); box-shadow: 0 12px 40px rgba(255,110,199,0.6); }
.upgrade-note { text-align: center; font-size: 12px; color: var(--c6-muted); }

/* Auth modal class 6 */
.auth-box-6 { max-width: 400px; }
.auth-logo-6 { text-align: center; margin-bottom: 20px; }
.auth-logo-6 img { width: 56px; height: 56px; border-radius: 50%; filter: drop-shadow(0 0 20px rgba(255,110,199,0.6)); animation: homeLogoBounce 3s ease infinite; margin-bottom: 10px; }
.auth-logo-6 h2 { font-family: var(--font-display); font-size: 24px; background: linear-gradient(90deg, var(--r1), var(--r5)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 4px; }
.auth-logo-6 p { color: var(--c6-muted); font-size: 13px; }
.form-group { margin-bottom: 12px; }
.form-group input { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--c6-border); border-radius: 12px; padding: 12px 16px; color: var(--c6-text); font-family: var(--font); font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: var(--r1); box-shadow: 0 0 0 3px rgba(255,110,199,0.1); }
.auth-btn-6 { width: 100%; padding: 13px; background: linear-gradient(135deg, var(--r1), var(--r6)); border: none; border-radius: 12px; color: white; font-family: var(--font-display); font-size: 16px; cursor: pointer; box-shadow: 0 6px 20px rgba(255,110,199,0.3); margin-bottom: 12px; }
.auth-btn-6:hover { transform: scale(1.03); box-shadow: 0 10px 30px rgba(255,110,199,0.5); }
.auth-divider-6 { text-align: center; color: var(--c6-muted); font-size: 12px; position: relative; margin: 10px 0; }
.auth-divider-6::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--c6-border); }
.auth-divider-6 span { background: rgba(17,0,34,0.97); padding: 0 10px; position: relative; }
.google-btn-6 { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; background: rgba(255,255,255,0.05); border: 1px solid var(--c6-border); border-radius: 12px; color: var(--c6-text); font-family: var(--font); font-size: 14px; cursor: pointer; margin-bottom: 12px; }
.google-btn-6:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.auth-switch-6 { text-align: center; font-size: 13px; color: var(--c6-muted); }
.auth-switch-6 a { color: var(--r1); text-decoration: none; font-weight: 700; }

/* Settings */
.settings-box-6 { max-width: 600px; max-height: 80vh; overflow-y: auto; }
.settings-title-6 { font-family: var(--font-display); font-size: 24px; margin-bottom: 16px; background: linear-gradient(90deg, var(--r1), var(--r5)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.settings-tabs-6 { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.stab { padding: 8px 16px; border-radius: 20px; border: 1px solid var(--c6-border); background: transparent; color: var(--c6-muted); font-family: var(--font); font-size: 13px; font-weight: 700; transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s; }
.stab.active { background: linear-gradient(135deg, rgba(255,110,199,0.2), rgba(198,110,255,0.2)); border-color: var(--r1); color: var(--r1); }
.stab:hover:not(.active) { border-color: var(--c6-muted); color: var(--c6-text); }
.settings-content-6 { font-size: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--c6-border); gap: 12px; }
.setting-row:last-child { border-bottom: none; }
.setting-info h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.setting-info p { font-size: 12px; color: var(--c6-muted); }
.toggle-switch { width: 44px; height: 24px; border-radius: 12px; background: var(--c6-border); position: relative; cursor: pointer; flex-shrink: 0; }
.toggle-switch.on { background: linear-gradient(90deg, var(--r1), var(--r6)); }
.toggle-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: transform 0.3s; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.toggle-switch.on::after { transform: translateX(20px); }

/* Break reminder */
.break-reminder {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
}
.break-inner {
  background: linear-gradient(135deg, rgba(17,0,34,0.98), rgba(30,0,60,0.98));
  border: 1px solid rgba(255,110,199,0.3);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 40px rgba(255,110,199,0.2);
}
.break-emoji { font-size: 64px; margin-bottom: 16px; animation: homeLogoBounce 2s ease infinite; }
.break-inner h3 { font-family: var(--font-display); font-size: 24px; background: linear-gradient(90deg, var(--r1), var(--r5)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 12px; }
.break-inner p { font-size: 14px; color: var(--c6-muted); margin-bottom: 24px; line-height: 1.6; }
.break-inner button { padding: 13px 28px; background: linear-gradient(135deg, var(--r1), var(--r6)); border: none; border-radius: 50px; color: white; font-family: var(--font-display); font-size: 16px; cursor: pointer; transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s; }
.break-inner button:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(255,110,199,0.5); }

/* Toast */
.toast-6 {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(17,0,34,0.97);
  border: 1px solid rgba(255,110,199,0.3);
  color: var(--r1);
  padding: 12px 24px;
  border-radius: 50px; font-size: 14px;
  font-weight: 700;
  z-index: 5000; opacity: 0; pointer-events: none;
  backdrop-filter: blur(20px);
  transition: transform 0.35s var(--tr), opacity 0.35s var(--tr), box-shadow 0.35s var(--tr);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 20px rgba(255,110,199,0.2);
}
.toast-6.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Fireworks */
.fireworks-container { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.firework { position: absolute; width: 6px; height: 6px; border-radius: 50%; animation: fireworkExplode 1s ease-out forwards; }
@keyframes fireworkExplode { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(0) translate(var(--tx), var(--ty)); opacity: 0; } }

/* Utility */
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* YouTube card */
.yt-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,0,0,0.08);
  border: 1px solid rgba(255,100,100,0.25);
  border-radius: 12px;
  text-decoration: none;
  color: var(--c6-text);
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  margin-top: 8px;
}
.yt-card:hover { border-color: #ff4444; transform: translateX(4px); box-shadow: 0 4px 15px rgba(255,68,68,0.2); }
.yt-thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; }
.yt-info { flex: 1; }
.yt-title { font-size: 12px; font-weight: 700; display: block; margin-bottom: 2px; }
.yt-meta { font-size: 10px; color: var(--c6-muted); }

/* Responsive */
@media (max-width: 900px) {
  .right-sidebar { transform: translateX(var(--sidebar-w)); }
  #rightCollapsed { display: flex; }
  .main-area { right: 0; }
}
@media (max-width: 600px) {
  :root { --sidebar-w: 240px; }
  .left-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  #leftCollapsed { display: flex; }
  .main-area { left: 0; }
  .top-explainables { font-size: 16px; }
}


/* ═══════════════════════════════════════════════════════
   FEATURES MODULE STYLES — sticky notes, flashcards etc
   ═══════════════════════════════════════════════════════ */
@keyframes stickyPanelIn {
  from { opacity:0; transform:scale(0.85) translateY(20px); }
  to   { opacity:1; transform:scale(1)    translateY(0);    }
}

/* Sticky note fold effect */
.sticky-note::before {
  content:'';position:absolute;top:0;right:0;width:0;height:0;
  border-style:solid;border-width:0 14px 14px 0;
  border-color:transparent rgba(0,0,0,0.25) transparent transparent;
}

/* Typing indicator */
.typing-indicator-feat {
  align-self:flex-start;
}

/* Streak badge animation */
#streakBadge:hover { transform:scale(1.08); }

/* Feature action buttons hover */
button[onclick*="shareAsImageCard"]:hover,
button[onclick*="generateFlashcard"]:hover,
button[onclick*="readAloud"]:hover {
  opacity:0.85;
  transform:translateY(-1px);
}

/* Scrollbar in deck modal */
#plannerList::-webkit-scrollbar { width:4px; }
#plannerList::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.15);border-radius:2px; }

/* Voice lang options hover */
.vlang-opt:hover { background:rgba(255,255,255,0.06) !important; }

.light-mode .msg-bubble { color: #220033 !important; background: rgba(180,0,180,0.06) !important; border-color: rgba(180,0,180,0.2) !important; }
.light-mode .msg.user .msg-bubble { background: rgba(150,0,200,0.1) !important; }
.light-mode .msg-bubble strong { color: #550055 !important; }
.light-mode .input-area { background: rgba(255,225,255,0.85) !important; }
.light-mode #chatInput { color: #220033 !important; }
.light-mode .mab { color: #883399 !important; }

/* ═══ FOCUS MODE CURSOR FIX ═══ */
body.focus-mode * { cursor: auto !important; }


/* ═══════════════════════════════════════════════════════
   PERFORMANCE CRITICAL OVERRIDES  (perf-fix applied)
   GPU compositing, paint containment, rAF-ready cursors
═══════════════════════════════════════════════════════ */

/* Cursor: position via JS transform, not left/top */
.cursor-glow, .cursor-trail,
/* cursor position handled by JS transform only */

/* Canvas: isolated GPU layer, no repaints */
canvas {
  position: fixed;
  will-change: transform;
  contain: strict;
  transform: translateZ(0);
  image-rendering: pixelated;
}

/* Sidebars: transform-only animation */
.sidebar, .left-sidebar, .right-sidebar,
[class*="sidebar-8"], [class*="sidebar-9"], [class*="sidebar-10"],
[class*="sb-left"], [class*="sb-right"],
[class*="left-sb"], [class*="right-sb"] {
  will-change: transform;
  transform: translateZ(0);
  contain: layout style;
  /* Reduce blur cost */
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* Modals: lightweight */
.modal-overlay, [class*="modal-8"],
[class*="modal-9"], [class*="modal-10"] {
  will-change: opacity;
  contain: layout style;
}

/* Topbar: GPU layer */
.top-bar, .topbar, [class*="topbar-"] {
  transform: translateZ(0);
  contain: layout style;
  /* Less expensive blur */
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

/* Input area */
.chat-input-area, [class*="input-area-"] {
  transform: translateZ(0);
  will-change: auto;
  /* Remove blur entirely from input area */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Glitter — contained to its own layer */
.glitter-container, [id="glitterContainer"] {
  contain: strict;
  overflow: hidden;
}
.glitter {
  will-change: transform, opacity;
  contain: layout size style;
}

/* Logo animation: use transform only, not filter */
.sb-logo-img, [class*="sb-logo-img"] {
  will-change: filter;
  contain: layout;
  animation-duration: 6s !important;
}

/* Home logo: snap animation */
.home-logo-img, [class*="home-logo"] {
  will-change: transform;
  contain: layout;
}

/* Chat messages: content containment */
.chat-messages, [class*="chat-msgs"],
[class*="msgs-"], [class*="-messages"] {
  contain: content;
  overflow-anchor: auto;
}

/* Buttons: fast GPU-composited hover */
button {
  transform: translateZ(0);
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbars: thin and performant */
* {
  scrollbar-width: thin;
}

/* Reduce excessive animations */
.glitter { animation-duration: 3s; }

/* Aurora beams - transform only */
.aurora-beam {
  will-change: transform, opacity;
  contain: layout style;
}
.aurora-container {
  contain: strict;
  overflow: hidden;
}

/* Particles */
.particle {
  will-change: transform, opacity;
  contain: layout size style;
}

/* Utility */
.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* ── Chat Background Canvas ── */
.chat-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}


/* ── CHAT CANVAS BACKGROUND ─────────────────────────────── */
/* Canvas sits at z-index:0; everything else must be ≥1      */
#chatCanvas6 { position:absolute; inset:0; z-index:0; pointer-events:none; }
.top-bar        { position:relative; z-index:20; }
.home-screen    { position:relative; z-index:2; }
.chat-section   { position:relative; z-index:2; }
.chat-input-area{ position:relative; z-index:5; }
.right-sidebar  { z-index:15; }
/* Ensure message bubbles have readable solid backgrounds */
.msg.bot .msg-bubble {
  background: rgba(22,8,48,0.88) !important;
  backdrop-filter: blur(8px);
}
.msg.user .msg-bubble {
  background: rgba(140,40,210,0.22) !important;
  backdrop-filter: blur(8px);
}
/* Action buttons always visible */
.msg-action-btn, .msg-feat-btns button {
  background: rgba(22,8,48,0.82) !important;
  border: 1px solid rgba(180,80,255,0.35) !important;
  color: #d4a0ff !important;
}
