/* ==========================================================================
   Abhaya by Vidhyapath — Premium AI Learning Companion
   Design system: Deep Indigo × Warm Amber × Soft White
   Font: Plus Jakarta Sans (Google Fonts)
   ========================================================================== */

/* ---------- 1. CSS Variables ---------- */
:root {
  --sb-banner-h:   0px; /* live height of #systemBanner when visible — keeps
                           .nav-float-bar from overlapping it, see _checkSystemBanner() */
  --bg:            #F8F7FF;
  --surface:       #ffffff;
  --primary:       #4F46E5;
  --primary-2:     #3730A3;
  --primary-glow:  rgba(79,70,229,.12);
  --primary-light: #EEF2FF;
  --accent:        #F59E0B;
  --accent-2:      #F97316;
  --success:       #10B981;
  --ink:           #1E1B4B;
  --ink-2:         #6B7280;
  --muted:         #9CA3AF;
  --border:        #E5E7EB;
  --border-soft:   rgba(79,70,229,.15);
  --bot-bg:        #EEF2FF;
  --user-bg:       #4F46E5;
  --user-ink:      #ffffff;
  --shadow:        0 4px 24px rgba(79,70,229,.10);
  --shadow-card:   0 2px 12px rgba(0,0,0,.06), 0 0 0 1px rgba(79,70,229,.06);
  --radius:        16px;
  --radius-sm:     10px;
  --safe-bot:      env(safe-area-inset-bottom, 0px);
}

/* ---------- 2. Reset & Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Noto Sans", "Noto Sans Telugu", "Noto Sans Devanagari", sans-serif;
  overscroll-behavior: contain;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- 2b. System Banner (emergency flash message) ---------- */
.system-banner {
  flex-shrink: 0; width: 100%; padding: 9px 14px;
  font-size: 12.5px; font-weight: 700; line-height: 1.4;
  display: flex; align-items: flex-start; gap: 8px;
  border-bottom: 1px solid transparent;
}
.system-banner .sb-icon { flex-shrink: 0; font-size: 14px; line-height: 1.3; }
.system-banner .sb-text { flex: 1; }
.system-banner.sb-info     { background: #EFF6FF; color: #1E3A8A; border-bottom-color: #BFDBFE; }
.system-banner.sb-warning  { background: #FFFBEB; color: #92400E; border-bottom-color: #FDE68A; }
.system-banner.sb-critical { background: #FEF2F2; color: #991B1B; border-bottom-color: #FECACA; }

/* ---------- 3. App Bar ---------- */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4F46E5 0%, #6D28D9 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(79,70,229,.30);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-img {
  width: 32px; height: 32px;
  object-fit: contain; flex-shrink: 0;
  display: inline-block; border-radius: 6px;
}
.title  { font-weight: 700; font-size: 15px; line-height: 1.1; letter-spacing: -.2px; }
.abhaya-title { font-weight: 800; letter-spacing: -.3px; display: flex; align-items: center; gap: 6px; }
.subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.bar-actions { display: flex; align-items: center; gap: 6px; }
.settings-btn {
  background: rgba(255,255,255,.15);
  border: none; color: white; font-size: 20px;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  transition: background .15s;
}
.settings-btn:hover   { background: rgba(255,255,255,.25); }
.settings-btn:active  { background: rgba(255,255,255,.35); }
.settings-btn:disabled { opacity: .32; cursor: default; }
.settings-btn:disabled:hover, .settings-btn:disabled:active { background: rgba(255,255,255,.15); }
.nav-back-btn, .nav-fwd-btn { font-size: 15px; }

/* Floating Back/Forward pill — iframe-mode equivalent of the app-bar pair
   above (hidden by default; shown only when body.in-iframe, right where the
   app-bar itself gets hidden — see the iframe-mode rules further down). */
.nav-float-bar {
  display: none;
  position: fixed; top: calc(10px + var(--sb-banner-h, 0px)); left: 10px; z-index: 55;
  transition: top .2s ease;
  gap: 4px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 4px; box-shadow: 0 4px 14px rgba(15,23,42,.16);
  border: 1px solid var(--border-soft, rgba(0,0,0,.06));
}
.nav-float-btn {
  background: transparent; border: none; color: var(--primary);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 14px; transition: background .15s;
}
.nav-float-btn:hover  { background: var(--primary-light); }
.nav-float-btn:active { transform: scale(.92); }
.nav-float-btn:disabled { opacity: .3; cursor: default; }
.nav-float-btn:disabled:hover { background: transparent; }
body.theme-dark .nav-float-bar { background: rgba(30,27,75,.92); border-color: rgba(255,255,255,.10); }
body.theme-dark .nav-float-btn { color: #A5B4FC; }
body.theme-dark .nav-float-btn:hover { background: rgba(129,140,248,.18); }
#voiceToggleBtn       { transition: opacity .2s; }
#voiceToggleBtn.voice-off { opacity: .45; }
.settings-btn.speaking {
  animation: voice-pulse 1.2s ease-in-out infinite;
  color: rgba(255,255,255,.9);
}
@keyframes voice-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.55; transform:scale(.88); }
}

/* ---------- 4. Settings Drawer ---------- */
.drawer {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 20;
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.drawer[hidden] { display: none; }
.drawer-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.drawer h2 { margin: 0 0 12px; font-size: 18px; }
.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
/* A settings row that states a fact rather than offering a choice (the voice —
   Abhaya is female). Reads like the disabled selects it replaced, without
   pretending to be interactive. */
.field-static {
  margin: 0; padding: 9px 12px;
  border: 1px solid var(--border, #e5e7eb); border-radius: 10px;
  background: #f8fafc; color: var(--ink-2, #475569);
  font-size: 14px; font-weight: 600;
}
.field select, .field input {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: white;
}
.primary {
  background: linear-gradient(135deg, var(--primary), #6D28D9);
  color: white; border: none; padding: 12px 16px;
  border-radius: 10px; font-weight: 600; cursor: pointer;
  width: 100%; margin-top: 4px; font: inherit; font-weight: 700;
}
.primary:active { background: var(--primary-2); }
.ghost {
  background: transparent; color: var(--primary);
  border: 1px solid var(--border); padding: 10px 16px;
  border-radius: 10px; width: 100%; margin-top: 8px; cursor: pointer; font: inherit;
}

/* ---------- 5. Split View Layout ---------- */
.split-view {
  flex: 1;
  display: flex; flex-direction: row;
  overflow: hidden; min-height: 0;
}
.split-left {
  width: 220px;
  min-width: 200px; max-width: 55%;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.split-divider {
  width: 6px; flex-shrink: 0;
  cursor: col-resize;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  user-select: none; transition: background .15s; z-index: 5;
}
.split-divider:hover, .split-divider.dragging { background: var(--primary); }
.divider-grip {
  font-size: 11px; color: var(--ink-2);
  writing-mode: vertical-rl; letter-spacing: -2px; pointer-events: none;
}
.split-divider:hover .divider-grip,
.split-divider.dragging .divider-grip { color: white; }
.split-right {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}
.split-right .composer { position: static; }

/* ---------- 6. Sidebar (sb-* classes) ---------- */
.sidebar-persistent {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-persistent::-webkit-scrollbar { display: none; }

/* Brand row */
.sb-brand {
  display: flex;
  align-items: center; gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid #F3F4F6;
  flex-shrink: 0;
}
.sb-logo-ring {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg,#4F46E5,#6D28D9);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(79,70,229,.30);
  flex-shrink: 0;
}
.sb-logo-img { width:22px;height:22px;object-fit:contain;filter:brightness(0) invert(1); }
.sb-brand-name { font-size:15px;font-weight:800;color:#1E1B4B;line-height:1.1; }
.sb-brand-sub  { font-size:11px;color:#9CA3AF;font-weight:500;margin-top:1px; }

/* Sections */
.sb-section { padding: 10px 8px 2px; }
.sb-section-label {
  font-size:10px;font-weight:700;color:#9CA3AF;
  text-transform:uppercase;letter-spacing:.6px;
  padding: 2px 6px 6px;
}

/* Nav items */
.sb-nav { display:flex;flex-direction:column;gap:2px; }
.sb-nav-item {
  display:flex;align-items:center;gap:9px;
  width:100%;padding:8px 10px;
  border:none;border-radius:10px;
  background:transparent;font-family:inherit;
  font-size:13px;font-weight:600;color:#6B7280;
  cursor:pointer;text-align:left;text-decoration:none;
  transition:background .12s,color .12s;
}
.sb-nav-item:hover { background:#EEF2FF;color:#4F46E5; }
.sb-nav-item.active {
  background:#EEF2FF;color:#4F46E5;font-weight:700;
  box-shadow:inset 3px 0 0 #4F46E5;
}
.sb-nav-muted .sb-nav-item { font-size:12px;font-weight:500;color:#9CA3AF;padding:6px 10px; }
.sb-nav-muted .sb-nav-item:hover { color:#4F46E5;background:#EEF2FF; }
.sb-nav-icon { font-size:16px;flex-shrink:0;width:20px;text-align:center; }

/* Streak card */
.sb-streak-card {
  margin: 10px 10px 6px;
  background: linear-gradient(135deg,#EEF2FF,#F5F3FF);
  border: 1px solid rgba(79,70,229,.15);
  border-radius: 14px;
  padding: 12px 14px;
  flex-shrink: 0;
}
.sb-streak-header { font-size:12px;font-weight:700;color:#4F46E5;margin-bottom:6px; }
.sb-streak-days   { font-size:28px;font-weight:800;color:#1E1B4B;line-height:1; }
.sb-streak-label  { font-size:11px;color:#9CA3AF;font-weight:600;margin-bottom:8px; }
.sb-streak-bars   { display:flex;gap:3px;align-items:flex-end;height:22px; }
.sb-bar {
  flex:1;border-radius:3px;background:#C7D2FE;
  transition:height .3s;
}
.sb-bar-1{height:30%} .sb-bar-2{height:55%} .sb-bar-3{height:40%}
.sb-bar-4{height:70%} .sb-bar-5{height:60%} .sb-bar-6{height:85%}
.sb-bar-7{height:100%;background:#4F46E5}

/* Upload card */
.sb-upload-card {
  display:flex;align-items:center;gap:10px;
  margin: 6px 10px 14px;
  padding: 12px;
  background: white;
  border: 1.5px solid #E5E7EB;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.sb-upload-icon  { font-size:22px;flex-shrink:0; }
.sb-upload-text  { flex:1;min-width:0; }
.sb-upload-title { font-size:12px;font-weight:700;color:#1E1B4B;line-height:1.2; }
.sb-upload-sub   { font-size:10px;color:#9CA3AF;font-weight:500;margin-top:1px; }
.sb-upload-btn {
  width:28px;height:28px;border-radius:50%;
  background:linear-gradient(135deg,#4F46E5,#6D28D9);
  color:white;border:none;font-size:14px;
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  flex-shrink:0; transition:transform .1s;
}
.sb-upload-btn:hover { transform: scale(1.08); }

/* Hide on mobile */
@media (max-width: 719px) { .sidebar-persistent { display: none; } }

/* Welcome-screen streak chip (13 Aug 2026) — the mobile-visible replacement for
   the streak card that lives in the sidebar above, which is hidden below 720px.
   Deliberately quiet: one line, no card, no border competing with the intent
   cards underneath it. */
.welcome-streak {
  display: inline-block;
  margin: 6px auto 2px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

/* ---------- 7. Homework Checklist ---------- */
.checklist {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 6px 12px 8px;
}
.checklist[hidden] { display: none; }
.split-left .checklist { position: static; overflow-y: auto; flex: 1; }
.split-left .checklist-items { max-height: none; }
.checklist-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 4px 0;
}
.checklist-title    { font-size: 13px; font-weight: 700; color: var(--primary); }
.checklist-progress {
  font-size: 12px; color: var(--primary);
  background: var(--primary-light); padding: 2px 8px;
  border-radius: 999px; margin-left: auto; margin-right: 6px;
}
.checklist-toggle {
  border: none; background: transparent;
  font-size: 14px; color: var(--ink-2); cursor: pointer; padding: 2px 6px;
}
.checklist-items {
  list-style: none; margin: 4px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 220px; overflow-y: auto;
}
.checklist.collapsed .checklist-items { display: none; }
.chk-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; padding: 4px 6px;
  border-radius: 8px; background: #f8fafc; border: 1px solid var(--border);
}
.chk-item.chk-active { background: #FEF9EC; border-color: #FCD34D; font-weight: 600; }
.chk-item.chk-done   { background: #D1FAE5; border-color: #6EE7B7; color: #047857; text-decoration: line-through; }
.chk-dot {
  flex-shrink: 0; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; font-weight: 700;
  background: white; border: 1px solid var(--border);
}
.chk-active .chk-dot { background: var(--accent);   color: white; border-color: var(--accent); }
.chk-done   .chk-dot { background: var(--success); color: white; border-color: var(--success); }
.chk-text { flex: 1; line-height: 1.3; }
.chk-start-btn {
  flex-shrink: 0; border: none;
  background: #f0fdf4; color: #16a34a;
  border: 1px solid #86efac; border-radius: 20px;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  cursor: pointer; white-space: nowrap;
}
.chk-start-btn:hover { background: #dcfce7; }

/* ---------- 8. Chat Area ---------- */
.chat {
  flex: 1; padding: 16px 12px 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}

/* ---------- 9. Welcome Screen ---------- */
.welcome {
  text-align: left;
  padding: 20px 24px 12px;
  color: var(--ink-2);
}
#welcomeHeading {
  font-size: 22px; font-weight: 800; color: var(--ink);
  margin: 0 0 6px; letter-spacing: -.3px;
}
.welcome p#welcomeSubtext {
  font-size: 13px; color: var(--ink-2);
  line-height: 1.6; margin: 0 0 4px;
}
.welcome em { color: var(--primary); font-style: normal; font-weight: 700; }

/* Welcome search bar */
.welcome-search {
  display: flex; align-items: center; gap: 10px;
  background: white; border: 1.5px solid #E5E7EB;
  border-radius: 999px; padding: 10px 14px;
  margin: 8px 0 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  transition: border-color .2s, box-shadow .2s;
  cursor: text;
}
.welcome-search:focus-within {
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.welcome-search-icon  { font-size:18px;flex-shrink:0;color:#9CA3AF; }
.welcome-search-input {
  flex:1;border:none;outline:none;font:inherit;
  font-size:14px;color:#1E1B4B;background:transparent;
}
.welcome-search-input::placeholder { color:#9CA3AF; }
.welcome-search-btn {
  width:36px;height:36px;border-radius:50%;
  background:linear-gradient(135deg,#4F46E5,#6D28D9);
  color:white;border:none;font-size:16px;
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  flex-shrink:0; box-shadow:0 2px 8px rgba(79,70,229,.35);
}

/* ---------- 10. Language Picker ---------- */
.lang-picker {
  display: flex; gap: 10px; justify-content: center;
  margin: 0 0 20px; flex-wrap: wrap;
}
.lang-btn {
  flex: 1; min-width: 88px; max-width: 130px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 13px 8px 11px;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--ink-2); display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  transition: all .2s; box-shadow: var(--shadow-card);
}
.lang-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,70,229,.15); }
.lang-icon {
  font-size: 24px; font-weight: 800; line-height: 1;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Noto Sans Telugu", "Noto Sans Devanagari", sans-serif;
}
.lang-btn.active {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), 0 4px 16px rgba(79,70,229,.20);
  transform: translateY(-1px);
}
.lang-btn:active { transform: scale(.97); }

/* ---------- 11. Subject Picker & Cards ---------- */
.subject-picker { margin: 12px 0 8px; }
.subject-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.subject-picker-label {
  font-size: 14px; font-weight: 800; color: var(--ink);
  letter-spacing: -.2px;
}
.subject-view-all {
  font-size: 12px; font-weight: 600; color: var(--primary);
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 3px;
  opacity: .8; transition: opacity .15s;
}
.subject-view-all:hover { opacity: 1; }

.subject-row {
  display: flex; flex-wrap: wrap;
  gap: 10px; justify-content: flex-start;
  margin-bottom: 4px;
}
/* Subject card — icon, name, description */
.subject-pill {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 14px 10px 12px;
  min-width: 82px; max-width: 120px; flex: 1;
  background: white; border: 1.5px solid #E5E7EB;
  border-radius: 16px; font: inherit;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  gap: 5px;
}
.subject-pill:hover {
  border-color: #4F46E5;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(79,70,229,.15);
}
.subject-pill.active {
  border-color: #4F46E5;
  background: #EEF2FF;
  box-shadow: 0 0 0 3px rgba(79,70,229,.15), 0 6px 20px rgba(79,70,229,.15);
  transform: translateY(-3px);
}
.subject-pill:active { transform: scale(.96); }
/* Icon, name, description spans inside each pill */
.sp-icon { font-size: 28px; line-height: 1; }
.sp-name {
  font-size: 13px; font-weight: 700; color: #374151; line-height: 1.2;
}
.subject-pill.active .sp-name { color: #4F46E5; }
.sp-desc {
  font-size: 10px; font-weight: 500; color: #9CA3AF; line-height: 1.4;
  white-space: pre-line;
}

/* Chapter chips */
.chapter-row {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start;
  margin-top: 10px;
}
.chapter-chip {
  background: var(--primary-light);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px; padding: 5px 13px;
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--primary); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chapter-chip.active { background: var(--primary); border-color: var(--primary); color: white; }
.chapter-chip:active  { background: #C7D2FE; }

/* ---------- 12. Feature Cards ---------- */
.feature-cards {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-top: 14px; text-align: left;
}
.feature-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 36px 14px 12px; background: white;
  border: 1.5px solid #E5E7EB; border-radius: 14px;
  cursor: pointer; font: inherit; text-align: left;
  transition: all .2s; box-shadow: 0 1px 4px rgba(0,0,0,.04);
  position: relative;
}
.feature-card:hover:not(.fc-inactive) {
  border-color: #4F46E5;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79,70,229,.12);
}
/* Inactive state — no subject selected yet */
.feature-card.fc-inactive {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}
.feature-card.fc-inactive .fc-arrow {
  background: #F3F4F6; color: #9CA3AF;
}
/* Active state — subject selected */
.feature-card.fc-active {
  border-color: #C7D2FE;
  background: linear-gradient(135deg, #FAFAFE 0%, #F0F3FF 100%);
}
.feature-card.fc-active .fc-sub {
  color: #4F46E5; font-weight: 600;
}
.fc-text { flex: 1; min-width: 0; }
.fc-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; margin-top: 1px;
}
.fc-icon-blue   { background: #EFF6FF; }
.fc-icon-green  { background: #ECFDF5; }
.fc-icon-purple { background: #F5F3FF; }
.fc-icon-amber  { background: #FFFBEB; }
.fc-title { font-size:13px;font-weight:700;color:#1E1B4B;line-height:1.3;margin-bottom:3px; }
.fc-sub   { font-size:11px;color:#9CA3AF;font-weight:500;line-height:1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-arrow {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: #EEF2FF; color: #4F46E5;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- 13. Quick Questions / Suggest Chips ---------- */
.suggest-section-label {
  font-size: 14px; font-weight: 800; color: var(--ink);
  margin: 16px 0 8px; letter-spacing: -.2px;
}
.suggest {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: flex-start;
  margin: 0 0 4px;
}
.suggest button {
  background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: 999px; padding: 9px 16px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--primary); cursor: pointer;
  transition: all .15s; box-shadow: var(--shadow-card);
}
.suggest button:hover {
  background: var(--primary-light); border-color: var(--primary);
  transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79,70,229,.15);
}
.suggest button:active { transform: scale(.96); }

/* ---------- 14. Mode Picker & Tab Bar ---------- */
/* Mode picker — hidden (tabs handle navigation) */
.mode-picker    { display: none !important; }
/* Mode tab bar — visible at top of right panel, above language buttons */
.mode-tab-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 8px;
  background: #fff;
  border-bottom: 1px solid #ede9fe;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.mode-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 24px;
  border: 2px solid #e0e7ff;
  background: #f8f7ff;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.3;
}
.mode-tab:hover {
  border-color: #4F46E5;
  color: #4F46E5;
  background: #eef2ff;
  transform: translateY(-1px);
}
.mode-tab.active {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(79,70,229,0.35);
}
.mode-tab-icon { font-size: 15px; }
.mode-tab-label { font-size: 13px; }

/* Mode card styles (kept for possible JS toggle use) */
.mode-card {
  flex: 1; max-width: 130px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 18px;
  padding: 14px 8px 12px; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center; position: relative;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .15s;
  box-shadow: var(--shadow-card);
}
.mode-card:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,.15); }
.mode-card:active { transform: scale(.97); }
.mode-card[data-mode="homework"].active {
  background: linear-gradient(135deg,#EEF2FF,#E0E7FF);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), 0 4px 16px rgba(79,70,229,.20);
}
.mode-card[data-mode="learn"].active {
  background: linear-gradient(135deg,#F5F3FF,#EDE9FE);
  border-color: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124,58,237,.12), 0 4px 16px rgba(124,58,237,.20);
}
.mode-card[data-mode="project"].active {
  background: linear-gradient(135deg,#FFFBEB,#FEF3C7);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12), 0 4px 16px rgba(245,158,11,.20);
}
.mode-icon  { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); }
.mode-label { font-size: 12px; font-weight: 800; color: var(--ink-2); line-height: 1.2; }
.mode-card.active .mode-label { color: var(--primary); }
.mode-card[data-mode="project"].active .mode-label { color: #92400e; }
.mode-desc  { font-size: 10px; color: var(--muted); line-height: 1.35; }
.mode-consent-tag {
  position: absolute; top: -9px; right: -4px;
  background: linear-gradient(135deg,#FEF3C7,#FDE68A);
  color: #92400e; border: 1px solid #FCD34D;
  border-radius: 999px; font-size: 9px; font-weight: 700;
  padding: 2px 7px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
}
.mode-card.consent-given .mode-consent-tag { display: none; }

/* Parent consent panel */
.consent-panel {
  background: #fef9ec; border: 1.5px solid #fcd34d;
  border-radius: 14px; padding: 14px 16px;
  margin: -6px 0 12px; text-align: left; animation: pop .18s ease-out;
}
.consent-panel[hidden] { display: none; }
.consent-title { font-size: 13px; font-weight: 700; color: #92400e; margin: 0 0 6px; }
.consent-text  { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: 0 0 10px; }
.consent-check-label {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: var(--ink); cursor: pointer; margin-bottom: 12px;
}
.consent-check-label input { margin-top: 2px; flex-shrink: 0; }
.consent-actions { display: flex; gap: 8px; }
.small-btn { padding: 8px 12px; font-size: 12px; border-radius: 8px; }

/* ---------- 15. Homework Upload CTA ---------- */
.hw-upload-cta {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 2px dashed rgba(79,70,229,.35);
  border-radius: 18px; padding: 18px 22px;
  margin: 14px 0 4px; cursor: pointer; font: inherit;
  text-align: left; transition: all .2s;
  box-shadow: 0 2px 12px rgba(79,70,229,.08);
}
.hw-upload-cta:hover {
  background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(79,70,229,.20);
  transform: translateY(-1px);
}
.hw-upload-cta:active { transform: scale(.98); }
.learn-cta {
  background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  border-color: rgba(124,58,237,.35);
}
.learn-cta:hover { background: linear-gradient(135deg, #EDE9FE 0%, #DDD6FE 100%); }
.learn-cta .hw-cta-title { color: #6D28D9; }
.project-cta {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border-color: rgba(245,158,11,.45);
}
.project-cta:hover { background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); }
.project-cta .hw-cta-title { color: #92400e; }
.hw-cta-icon  { font-size: 40px; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); }
.hw-cta-body  { flex: 1; }
.hw-cta-title { font-size: 15px; font-weight: 800; color: var(--primary); margin-bottom: 3px; }
.hw-cta-sub   { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* ---------- 15b. Homework Intent Toggle (Guide me / Check my work) ---------- */
.hw-intent-toggle { width: 100%; margin: 12px 0 4px; }
.hw-intent-label {
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin: 0 0 10px; text-align: center; letter-spacing: .01em;
}
.hw-intent-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .hw-intent-cards { grid-template-columns: 1fr 1fr; } }
.hw-intent-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 14px 10px;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); text-align: center;
  transition: all .18s; box-shadow: var(--shadow-card);
}
.hw-intent-btn:hover {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,70,229,.15);
}
.hw-intent-btn:active { transform: scale(.97); }
.hw-intent-btn.active {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); font-weight: 800;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.hw-intent-icon { font-size: 22px; }
.hw-intent-text { line-height: 1.3; }
@media (max-width: 400px) { .hw-intent-cards { grid-template-columns: 1fr; } }

/* 16 Jul 2026: make the SELECTED intent unmistakable — each card gets its own
   accent colour (matching its step-2 panel below) plus a ✓ badge. */
.hw-intent-btn { position: relative; }
.hw-intent-btn.active::after {
  content: "✓";
  position: absolute; top: 6px; right: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.hw-intent-btn[data-intent="verify"].active {
  border-color: #16A34A; background: #F0FDF4; color: #15803D;
  box-shadow: 0 0 0 2px rgba(22,163,74,.25);
}
.hw-intent-btn[data-intent="verify"].active::after { background: #16A34A; }
.hw-intent-btn[data-intent="oral"].active {
  border-color: #DB2777; background: #FDF2F8; color: #BE185D;
  box-shadow: 0 0 0 2px rgba(219,39,119,.22);
}
.hw-intent-btn[data-intent="oral"].active::after { background: #DB2777; }

/* ---------- 15b-ii. Intent step-2 chooser (16 Jul 2026) ----------
   Rendered by _renderHwStep2() in app.js. Same visual language as the
   sidebar tools' entry chooser (.oral-tp-card) so students recognise it,
   with a per-intent accent so each choice looks clearly different. */
.hw-step2 {
  width: 100%; margin: 10px 0 4px;
  border: 1.5px solid var(--border); border-radius: 16px;
  padding: 14px 14px 12px;
  background: var(--surface);
  animation: hw-step2-in .28s ease-out both;
}
@keyframes hw-step2-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.hw-step2-hint {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  color: var(--ink); text-align: center;
}
/* Wizard step-2 header: the chosen intent as a chip + a "⟲ Change" way back.
   Replaces the whole 3-card grid once a choice is made (16 Jul feedback). */
.hw-step2-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.hw-step2-sel {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  font-size: 13.5px; font-weight: 800; color: var(--ink);
  background: rgba(255,255,255,.72); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
}
.hw-step2-selchk {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.hw-step2--guide  .hw-step2-sel { border-color: rgba(79,70,229,.45);  color: #4F46E5; }
.hw-step2--verify .hw-step2-sel { border-color: rgba(22,163,74,.45);  color: #15803D; }
.hw-step2--verify .hw-step2-selchk { background: #16A34A; }
.hw-step2--oral   .hw-step2-sel { border-color: rgba(219,39,119,.45); color: #BE185D; }
.hw-step2--oral   .hw-step2-selchk { background: #DB2777; }
.hw-step2-change {
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; flex-shrink: 0;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.hw-step2-change:hover  { border-color: var(--primary); color: var(--primary); }
.hw-step2-change:active { transform: scale(.96); }
@media (max-width: 640px) {
  .hw-step2-sel    { font-size: 12px; padding: 5px 10px; }
  .hw-step2-change { font-size: 11px; padding: 5px 10px; }
}
.hw-step2-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hw-step2--oral .hw-step2-cards { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
  .hw-step2-cards, .hw-step2--oral .hw-step2-cards { grid-template-columns: 1fr; }
  .hw-step2 { padding: 12px 10px 10px; }
}
.hw-step2-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 13px; padding: 12px 14px;
  cursor: pointer; font: inherit; text-align: left;
  transition: all .15s; box-shadow: var(--shadow-card);
}
.hw-step2-card:hover  { transform: translateY(-1px); }
.hw-step2-card:active { transform: scale(.98); }
.hw-step2-icon { font-size: 26px; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,.10)); }
.hw-step2-body { flex: 1; min-width: 0; }
.hw-step2-body strong { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); margin-bottom: 2px; }
.hw-step2-desc { display: block; font-size: 11.5px; color: var(--ink-2); line-height: 1.45; }
.hw-step2-arrow { font-size: 20px; color: var(--ink-2); opacity: .45; flex-shrink: 0; }
/* per-intent accents — match the active card above */
.hw-step2--guide  { border-color: rgba(79,70,229,.35);  background: linear-gradient(160deg, #EEF2FF 0%, #FDFDFF 65%); }
.hw-step2--guide  .hw-step2-card:hover { border-color: #4F46E5; box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.hw-step2--verify { border-color: rgba(22,163,74,.35);  background: linear-gradient(160deg, #F0FDF4 0%, #FDFFFD 65%); }
.hw-step2--verify .hw-step2-card:hover { border-color: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.hw-step2--oral   { border-color: rgba(219,39,119,.35); background: linear-gradient(160deg, #FDF2F8 0%, #FFFDFE 65%); }
.hw-step2--oral   .hw-step2-card:hover { border-color: #DB2777; box-shadow: 0 0 0 3px rgba(219,39,119,.12); }

/* ---------- 15c. Pending Homework reminder banner ---------- */
.hw-pending-banner {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 10px 0 2px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1.5px solid rgba(245,158,11,.45);
  border-radius: 14px; padding: 11px 12px;
  box-shadow: 0 2px 10px rgba(245,158,11,.10);
}
.hw-pending-icon { font-size: 22px; flex-shrink: 0; }
.hw-pending-body { flex: 1; min-width: 0; }
.hw-pending-title { font-size: 13px; font-weight: 800; color: #92400e; }
.hw-pending-sub   { font-size: 11.5px; color: #92400e; opacity: .85; margin-top: 1px; line-height: 1.35; }
.hw-pending-continue {
  flex-shrink: 0; border: none; border-radius: 10px; padding: 7px 12px;
  background: var(--primary); color: #fff; font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: transform .15s;
}
.hw-pending-continue:hover { transform: translateY(-1px); }
.hw-pending-continue:active { transform: scale(.96); }
.hw-pending-dismiss {
  flex-shrink: 0; border: none; background: transparent; color: #92400e; opacity: .55;
  font-size: 15px; cursor: pointer; padding: 2px 4px; line-height: 1;
}
.hw-pending-dismiss:hover { opacity: 1; }
body.theme-dark .hw-pending-banner {
  background: linear-gradient(135deg, rgba(245,158,11,.14) 0%, rgba(245,158,11,.08) 100%);
  border-color: rgba(245,158,11,.35);
}
body.theme-dark .hw-pending-title,
body.theme-dark .hw-pending-sub,
body.theme-dark .hw-pending-dismiss { color: #FBBF24; }

/* ---------- 15c. Pending photo attachment preview (composer) ---------- */
.attach-preview {
  display: flex; align-items: center; gap: 10px;
  background: var(--primary-light); border: 1.5px solid rgba(79,70,229,.3);
  border-radius: 14px; padding: 8px 10px; margin: 0 0 8px;
}
.attach-preview-img {
  width: 40px; height: 40px; object-fit: cover; border-radius: 8px;
  border: 1px solid rgba(79,70,229,.25); flex-shrink: 0;
}
.attach-preview-label {
  flex: 1; font-size: 12px; color: var(--ink-2); line-height: 1.35;
}
.attach-preview-remove {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(79,70,229,.12); color: var(--primary);
  font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.attach-preview-remove:hover { background: rgba(79,70,229,.22); }

/* ---------- 15d. Oral Test Practice — "type them in instead" link ---------- */
.oral-type-link {
  display: block; width: 100%; text-align: center; margin: 8px 0 0;
  background: none; border: none; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); cursor: pointer; padding: 6px;
  transition: color .15s;
}
.oral-type-link:hover { color: var(--primary); }

/* ---------- 15e. Saved oral test sets ---------- */
.oral-saved-sets-section {
  width: 100%; margin: 12px 0 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 12px 8px;
}
.oral-saved-sets-title {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  margin: 0 0 8px; letter-spacing: .01em;
}
.oral-saved-sets-list { list-style: none; margin: 0; padding: 0; }
.oral-saved-empty { font-size: 12px; color: var(--ink-3); text-align: center; padding: 4px 0; }
.oral-saved-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.oral-saved-item:last-child { border-bottom: none; }
.oral-saved-name { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oral-saved-meta { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.oral-load-set-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.oral-load-set-btn:hover { background: var(--primary-dark, #4338ca); }
.oral-save-set-btn {
  background: none; border: 1.5px solid var(--primary); color: var(--primary);
  border-radius: 8px; font-size: 12px; font-weight: 700; padding: 5px 10px;
  cursor: pointer; transition: background .15s, color .15s; margin: 0 6px;
}
.oral-save-set-btn:hover { background: var(--primary); color: #fff; }

/* ---------- 16. Doubt Picker ---------- */
.doubt-picker       { width: 100%; margin: 12px 0 4px; }
.doubt-picker-label {
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin: 0 0 10px; text-align: center; letter-spacing: .01em;
}
.doubt-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.doubt-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); text-align: left;
  transition: all .18s; box-shadow: var(--shadow-card);
}
.doubt-card:hover {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,70,229,.15);
}
.doubt-card:active { transform: scale(.97); }
.doubt-card.selected {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); font-weight: 800;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.doubt-icon { font-size: 20px; flex-shrink: 0; }
.doubt-text { line-height: 1.35; }
@media (max-width: 400px) { .doubt-cards { grid-template-columns: 1fr; } }

/* ---------- 17. Message Bubbles ---------- */
.bubble {
  max-width: 86%; padding: 10px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap; word-wrap: break-word;
  box-shadow: var(--shadow); animation: pop .14s ease-out;
}
.bubble.bot {
  background: var(--bot-bg); align-self: flex-start;
  border-bottom-left-radius: 4px; color: var(--ink);
}
.bubble.user {
  background: var(--user-bg); color: var(--user-ink);
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.bubble img { display: block; max-width: 220px; margin-top: 6px; border-radius: 8px; }
.bubble.thinking { background: var(--bot-bg); color: var(--ink-2); font-style: italic; }
.thinking .dot {
  display: inline-block; width: 6px; height: 6px;
  margin: 0 1px; background: var(--primary); border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out both;
}
.thinking .dot:nth-child(2) { animation-delay: .2s; }
.thinking .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity:.25; } 40% { opacity:1; } }

/* Speaker button */
.bubble .speaker-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 8px; margin-left: -4px;
  width: 32px; height: 32px; border: 1px solid var(--border);
  background: white; color: var(--primary); border-radius: 999px;
  font-size: 15px; cursor: pointer; padding: 0;
}
.bubble .speaker-btn:active { background: var(--bot-bg); }

/* Rich bubble extras */
.bubble.rich { padding: 10px 12px 12px; }
.bubble.bot.pause {
  background: #fffbeb; border: 2px solid #f59e0b;
  box-shadow: 0 4px 16px rgba(245,158,11,.25);
}
.pause-banner {
  background: #f59e0b; color: white; font-weight: 700;
  font-size: 12px; letter-spacing: .3px; padding: 6px 10px;
  border-radius: 8px; margin: -4px -4px 8px; text-align: center;
}
.bubble.rich .bubble-text { margin-top: 6px; white-space: pre-wrap; }
.bot-ribbon {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.subject-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 6px; background: white;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
}
.subject-chip .subject-emoji { font-size: 14px; line-height: 1; }
.subject-chip .subject-name  { letter-spacing: .2px; }
.encour-strip {
  font-size: 12px; color: var(--ink-2);
  background: rgba(79,70,229,.06); border-left: 3px solid var(--primary);
  padding: 5px 10px; border-radius: 6px; margin-bottom: 6px;
}
.hint-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  letter-spacing: .3px; padding: 3px 9px;
  border-radius: 999px; text-transform: uppercase;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid rgba(79,70,229,.25);
}
.hint-badge.hint-1 { background: #EFF6FF;  color: #1D4ED8; border-color: rgba(29,78,216,.20); }
.hint-badge.hint-2 { background: #ECFDF5;  color: #047857; border-color: rgba(4,120,87,.20); }
.hint-badge.hint-3 { background: #FEF9EC;  color: #B45309; border-color: rgba(180,83,9,.20); }
.hint-badge.hint-4 { background: #FFF1F2;  color: #BE123C; border-color: rgba(190,18,60,.20); }
.hint-badge.hint-checked { background: #ECFDF5; color: #047857; border-color: rgba(4,120,87,.20); }
.viz-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.viz {
  margin: 0; background: white; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; text-align: center; max-width: 100%;
}
.viz svg { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; }
.viz figcaption { font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.viz.viz-eq {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Cambria Math", Cambria, "Times New Roman", serif;
  font-size: 18px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); border: 2px dashed var(--primary);
  padding: 8px 14px;
}
.viz.viz-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: linear-gradient(135deg, var(--primary-light) 0%, #FEF9EC 100%);
  border: 1px solid var(--border); padding: 10px 12px; min-width: 0;
}
.viz-card-emoji { font-size: 32px; line-height: 1; flex-shrink: 0; }
.viz.viz-card.viz-card-illustrated { padding: 8px; }
.viz-card-illus {
  flex-shrink: 0; width: 72px; height: 72px;
  border-radius: 8px; overflow: hidden; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.viz-card-illus svg { width: 72px; height: 72px; display: block; }
.viz-card-body  { flex: 1; min-width: 0; }
.viz-card-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.viz-card-hint  { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick-chip {
  font: inherit; font-size: 12.5px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--border);
  background: white; color: var(--ink); cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.quick-chip:active { transform: scale(.96); background: var(--bot-bg); }
.quick-chip.qc-ok   { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.quick-chip.qc-help { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.quick-chip.qc-show { background: #e0f2fe; border-color: #7dd3fc; color: #0369a1; }
.quick-chip.qc-easy { background: #fce7f3; border-color: #f9a8d4; color: #9d174d; }

/* ---------- 18. Composer ---------- */
.composer {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px calc(12px + var(--safe-bot));
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.composer input[type="text"] {
  flex: 1; font: inherit; font-size: 14px;
  padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: 999px; background: var(--bg);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.composer input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--surface);
}
.icon-btn {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--bg); font-size: 20px; cursor: pointer;
  flex-shrink: 0; color: var(--primary);
  transition: background .15s, transform .1s;
}
.icon-btn:hover  { background: var(--primary-light); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.primary {
  background: linear-gradient(135deg, var(--primary), #6D28D9);
  color: white; box-shadow: 0 3px 12px rgba(79,70,229,.40);
}
.icon-btn.primary:hover { box-shadow: 0 4px 18px rgba(79,70,229,.55); transform: scale(1.05); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.icon-btn.recording { background: #dc2626; color: white; animation: pulse 1s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.45); }
  50%      { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

/* ---------- 19. I'm Stuck Escalation Button ---------- */
.stuck-row {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 14px 2px;
  background: var(--surface);
  border-top: 1px solid #FEF3C7;
}
.stuck-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border: 1.5px solid #F59E0B;
  border-radius: 999px; cursor: pointer;
  background: #FFFBEB; color: #92400E;
  font-size: 13px; font-weight: 600; font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(245,158,11,.18);
  white-space: nowrap;
}
.stuck-btn:hover:not(:disabled) {
  background: #FEF3C7;
  box-shadow: 0 3px 12px rgba(245,158,11,.30);
  transform: translateY(-1px);
}
.stuck-btn:active:not(:disabled) { transform: scale(.97); }
.stuck-btn:disabled {
  opacity: .55; cursor: not-allowed; transform: none !important;
  border-color: #D1D5DB; background: #F9FAFB; color: #6B7280;
  box-shadow: none;
}
.stuck-btn.stuck-l2 { border-color: #D97706; background: #FEF3C7; }
.stuck-btn.stuck-l3 {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); box-shadow: 0 2px 8px rgba(79,70,229,.18);
}
.stuck-btn.stuck-l3:hover:not(:disabled) {
  background: #EEF2FF; box-shadow: 0 3px 12px rgba(79,70,229,.28);
}
.stuck-btn.stuck-done {
  border-color: #16A34A; background: #F0FDF4; color: #15803D;
  box-shadow: none;
}
.stuck-dots { display: flex; gap: 4px; margin-left: 2px; }
.stuck-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #F59E0B; opacity: .35;
  transition: opacity .2s, background .2s;
}
.stuck-dot.used { opacity: 1; background: #D97706; }
.stuck-dot.spent { opacity: 1; background: #D1D5DB; }

/* "🔄 New Question" pill — sits alongside the I'm Stuck button.
   Tapping it calls clearConversation() to wipe the chat and reset the
   LangGraph session so Abhaya starts fresh with no prior context. */
.new-question-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px; margin-left: 8px;
  border: 1.5px solid var(--primary); border-radius: 999px; cursor: pointer;
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 600; font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(79,70,229,.15);
  white-space: nowrap;
}
.new-question-btn:hover:not(:disabled) {
  background: #EEF2FF;
  box-shadow: 0 3px 12px rgba(79,70,229,.25);
  transform: translateY(-1px);
}
.new-question-btn:active:not(:disabled) { transform: scale(.97); }
.new-question-btn:disabled {
  opacity: .45; cursor: not-allowed; transform: none !important;
  border-color: #D1D5DB; background: #F9FAFB; color: #6B7280;
  box-shadow: none;
}

/* Oral tracker items inside the left-panel #oralTracker section.
   The section itself already uses .checklist styles via the HTML class attribute
   so only the item-level differences need defining here. */
.oral-tracker-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 10px; font-size: 12px;
  border-bottom: 1px solid rgba(79,70,229,.07);
}
.oral-tracker-icon { flex-shrink: 0; width: 18px; text-align: center; }
.oral-tracker-q    { flex: 1; color: var(--ink); line-height: 1.4; }
.oral-tracker-item.chk-current  { background: #EEF2FF; }
.oral-tracker-item.chk-correct  { background: #F0FDF4; }
.oral-tracker-item.chk-partial  { background: #FEFCE8; }
.oral-tracker-item.chk-wrong    { background: #FEF2F2; }
.oral-tracker-item.chk-skipped  { opacity: .6; }

/* Mobile: keep the stuck row on ONE line — three pills
   (I'm Stuck · New Question · Pause/Resume) share the width without wrapping. */
@media (max-width: 719px) {
  .stuck-row { flex-wrap: nowrap; gap: 6px; padding: 6px 10px 2px; }
  .stuck-btn { font-size: 12px; padding: 7px 12px; gap: 5px; }
  .stuck-dot { width: 6px; height: 6px; }
  .stuck-dots { gap: 3px; margin-left: 0; }
  .new-question-btn { font-size: 11px; padding: 6px 10px; margin-left: 0; gap: 4px; }
}
/* Narrow phones (≤380px): shave further and drop the "stuck" dots so all
   three buttons still fit without horizontal overflow. */
@media (max-width: 380px) {
  .stuck-row { gap: 5px; padding: 6px 8px 2px; }
  .stuck-btn { font-size: 11px; padding: 6px 10px; gap: 4px; }
  .stuck-dots { display: none; }
  .new-question-btn { font-size: 10px; padding: 5px 9px; }
  .stop-speech-btn { font-size: 10px; padding: 5px 9px; gap: 4px; }
}

/* ---------- 20. Status Pill & Overlays ---------- */
.status-pill {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(79,70,229,.95), rgba(109,40,217,.95));
  color: white; font-size: 12px; font-weight: 600;
  padding: 7px 16px; border-radius: 999px; z-index: 8;
  animation: fade .25s ease-out;
  box-shadow: 0 4px 16px rgba(79,70,229,.40);
  backdrop-filter: blur(4px);
}
@keyframes fade {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Pause/Resume speech button */
.stop-speech-btn {
  /* Inline in the stuck row (next to "I'm Stuck") — no longer floats over the
     composer's mic/send. Shown only while Abhaya is speaking. */
  position: static; transform: none; margin-left: 8px;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; background: #dc2626; color: #fff;
  border: none; border-radius: 999px;
  font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(220,38,38,.28);
  animation: stop-btn-pop .18s cubic-bezier(.34,1.56,.64,1) both;
}
.stop-speech-btn[hidden] { display: none; }
.stop-speech-btn:active  { background: #b91c1c; transform: scale(.96); }
@keyframes stop-btn-pop { from { opacity:0; transform:scale(.8); } to { opacity:1; transform:scale(1); } }

/* ---------- 20. Report / History Cards ---------- */
.report-layer {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .2s ease-out;
}
.report-card {
  background: white; border-radius: 16px;
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 14px 40px rgba(15,23,42,.25); animation: pop .25s ease-out;
}
.report-card header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.report-card h2 { margin: 0; font-size: 17px; color: var(--primary); }
.rpt-close {
  background: transparent; border: none; font-size: 26px; line-height: 1;
  color: var(--ink-2); cursor: pointer; padding: 0 4px;
}
.rpt-stats { display: flex; gap: 8px; padding: 14px 18px 10px; }
.rpt-stat  {
  flex: 1; background: var(--primary-light); border: 1px solid var(--border);
  border-radius: 10px; text-align: center; padding: 10px;
}
.rpt-stat b    { display: block; font-size: 22px; color: var(--primary); }
.rpt-stat span { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; }
.rpt-encour {
  margin: 0 18px 8px; padding: 8px 12px;
  background: #fef3c7; border-left: 4px solid var(--accent);
  border-radius: 6px; font-size: 13px; color: #92400e;
}
.rpt-items {
  list-style: none; margin: 0; padding: 4px 18px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.rpt-item {
  display: flex; gap: 8px; font-size: 13px;
  padding: 8px 10px; background: #f8fafc;
  border-radius: 8px; border: 1px solid var(--border);
}
.rpt-item.rpt-done   { background: #d1fae5; border-color: #6ee7b7; }
.rpt-item.rpt-active { background: #fef3c7; border-color: #fcd34d; font-weight: 600; }
.rpt-empty { font-size: 13px; color: var(--ink-2); font-style: italic; padding: 6px; }
.history-card .hist-list {
  list-style: none; margin: 0; padding: 8px 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.hist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 10px;
}
.hist-left  { flex: 1; min-width: 0; }
.hist-when  { font-size: 12px; font-weight: 700; color: var(--primary); }
.hist-sub   { font-size: 11px; color: var(--ink-2); margin: 2px 0; }
.hist-last  {
  font-size: 12px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.hist-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.hist-progress { font-size: 11px; font-weight: 700; background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 999px; }
.hist-resume { background: var(--primary); color: white; border: none; padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.hist-resume:active { background: var(--primary-2); }
.report-card footer { border-top: 1px solid var(--border); padding: 10px 18px; text-align: right; color: var(--ink-2); }

/* ---------- 21. Mode-switch Prompt ---------- */
.mode-switch-prompt {
  align-self: center; width: 100%; max-width: 480px;
  background: var(--surface); border: 2px solid var(--primary);
  border-radius: 16px; padding: 16px 18px; margin: 8px 0;
  box-shadow: var(--shadow); animation: pop .18s ease-out;
}
.msp-title { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.msp-title strong { color: var(--primary); }
.msp-sub   { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: 0 0 14px; }
.msp-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.msp-confirm {
  flex: 1; min-width: 140px; padding: 10px 16px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.msp-confirm:hover  { background: var(--primary-2); }
.msp-cancel {
  flex: 1; min-width: 110px; padding: 10px 16px;
  background: transparent; color: var(--ink-2);
  border: 1.5px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.msp-cancel:hover { border-color: var(--ink-2); color: var(--ink); }

/* ---------- 22. Celebration ---------- */
.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti {
  position: absolute; top: -12px; width: 9px; height: 14px;
  border-radius: 2px; animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}
.celebrate-star {
  position: absolute; top: 30%; left: 50%;
  transform: translate(-50%, -50%);
  background: white; color: var(--primary); font-weight: 700; font-size: 22px;
  padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15,23,42,.18);
  animation: star-pop .5s cubic-bezier(.18,1.6,.5,1) both;
}
@keyframes star-pop {
  from { transform: translate(-50%,-50%) scale(.4); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1);  opacity: 1; }
}

/* ---------- 23. Misc UI Elements ---------- */
.viz-generate-btn {
  display: block; margin: 8px auto 0; padding: 6px 16px;
  background: var(--primary); color: #fff; border: none; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  opacity: .88; transition: opacity .15s, transform .15s;
}
.viz-generate-btn:hover   { opacity: 1; }
.viz-generate-btn:active  { transform: scale(.95); }
.viz-generate-btn:disabled { opacity: .5; cursor: default; }

/* ---------- 24. Animations ---------- */
@keyframes pop  { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 25. Responsive ---------- */
@media (max-width: 719px) {
  .split-view { flex-direction: column; }
  .split-left {
    width: 100% !important; max-width: 100%; min-width: 0;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-shrink: 0; max-height: 190px;
  }
  .sidebar-persistent { display: none; }
  .split-divider      { display: none; }
  .split-left .checklist-items { max-height: 130px; }
  .welcome { text-align: center; padding: 16px; }
  .subject-row { justify-content: center; }
  .feature-cards { grid-template-columns: 1fr; }
  .subject-pill { max-width: 100%; }
  .suggest { justify-content: center; }
}

@media (min-width: 720px) {
  .split-left { width: 220px !important; min-width: 210px; }
  .app-bar    { padding: 14px 24px; }
  .split-right .chat    { padding: 16px 20px 24px; }
  .split-right .composer{ max-width: none; }
}

@media (max-width: 420px) {
  .mode-tab { padding: 7px 12px; font-size: 12px; }
  .mode-tab-label { font-size: 11px; }
}

/* ==========================================================================
   NEW FEATURES: Bookmarks, Badges, Session Summary, Profiles, Toast
   ========================================================================== */

/* ── Bookmark button on bot bubbles ──────────────────────────────────────── */
.bookmark-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 6px; margin-left: 4px;
  width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: 50%;
  background: white; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 0;
  transition: color .15s, border-color .15s, transform .1s;
  flex-shrink: 0;
}
.bookmark-btn:hover { color: var(--accent); border-color: var(--accent); }
.bookmark-btn:active { transform: scale(.9); }
.bookmark-btn.bookmarked { color: var(--accent); border-color: var(--accent); background: #FFFBEB; }

/* ── Notes count badge on sidebar nav ───────────────────────────────────── */
.notes-count-badge, .session-count-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.session-count-badge { background: var(--accent); color: #1E1B4B; font-size: 9px; }

/* ── My Notes panel ─────────────────────────────────────────────────────── */
.notes-panel {
  position: fixed; top: 64px; right: 0; bottom: 0;
  width: 320px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 30;
  box-shadow: -4px 0 20px rgba(0,0,0,.10);
  animation: slide-in-right .2s ease-out;
}
@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.notes-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-size: 14px; font-weight: 700;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  color: #92400E;
}
.notes-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--ink-2); padding: 2px 6px; border-radius: 6px;
}
.notes-close:hover { background: var(--border); }
.notes-body {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.note-item {
  background: #FFFBEB; border: 1px solid #FDE68A;
  border-radius: 12px; padding: 12px;
}
.note-text { font-size: 12.5px; color: var(--ink); line-height: 1.5; margin-bottom: 8px; }
.note-footer {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-2);
}
.note-subject {
  background: var(--primary-light); color: var(--primary);
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.note-date { margin-left: auto; }
.note-del {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px; opacity: .5; transition: opacity .15s;
}
.note-del:hover { opacity: 1; }
.notes-empty {
  text-align: center; padding: 32px 20px;
  font-size: 13px; color: var(--muted); line-height: 1.8;
}

/* ── Badge unlock toast ──────────────────────────────────────────────────── */
.badge-unlock {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #4F46E5, #6D28D9);
  color: white; border-radius: 14px;
  padding: 12px 18px; z-index: 200;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 24px rgba(79,70,229,.40);
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.badge-unlock.bu-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.bu-icon  { font-size: 28px; }
.bu-title { font-size: 11px; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.bu-label { font-size: 15px; font-weight: 800; }

/* ── General toast ───────────────────────────────────────────────────────── */
.toast-notification {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1E1B4B; color: white;
  font-size: 13px; font-weight: 600;
  padding: 9px 18px; border-radius: 999px;
  z-index: 190; opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.toast-notification.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Earned badges row in streak card ────────────────────────────────────── */
.sb-badges-row {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
}
.sb-badge-chip {
  font-size: 18px; line-height: 1;
  cursor: default; filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
  transition: transform .15s;
}
.sb-badge-chip:hover { transform: scale(1.2); }

/* ── Profile switcher ───────────────────────────────────────────────────── */
.sb-profile-switcher {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 4px; flex-wrap: wrap;
}
.profile-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  color: white; font-size: 13px; font-weight: 700;
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, border-color .15s;
  flex-shrink: 0;
}
.profile-avatar:hover { transform: scale(1.1); }
.profile-avatar.pa-active {
  border-color: white;
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.1);
}
.profile-add {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg); border: 2px dashed var(--border);
  color: var(--muted); font-size: 18px; font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s, color .15s;
  flex-shrink: 0; line-height: 1;
}
.profile-add:hover { border-color: var(--primary); color: var(--primary); }

/* ── Modal overlay (Add child + Session summary) ─────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.50);
  z-index: 50; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  animation: fade .2s ease-out;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 400px;
  box-shadow: 0 14px 40px rgba(15,23,42,.25);
  animation: pop .2s ease-out; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; font-size: 20px;
  color: var(--ink-2); cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 10px; }

/* ── Session summary card ────────────────────────────────────────────────── */
.ss-card { max-width: 360px; }
.ss-body { padding: 16px 18px 20px; }
.ss-stats-row { display: flex; gap: 10px; margin-bottom: 14px; }
.ss-stat {
  flex: 1; background: var(--bg); border-radius: 10px;
  padding: 10px; text-align: center;
}
.ss-num   { font-size: 24px; font-weight: 800; color: var(--primary); }
.ss-lbl   { font-size: 10px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.ss-topics { font-size: 12px; color: var(--ink-2); margin-bottom: 8px; line-height: 1.5; }
.ss-topics strong { color: var(--ink); }
.ss-date   { font-size: 11px; color: var(--muted); }


/* ==========================================================================
   TRIAL BADGE + PAYWALL
   ========================================================================== */

/* ── Sidebar trial badge ─────────────────────────────────────────────────── */
.trial-badge {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #DCFCE7, #D1FAE5);
  border: 1px solid #6EE7B7;
  border-radius: 10px; padding: 7px 10px;
  font-size: 11px; font-weight: 700; color: #065F46;
}
.trial-badge-icon { font-size: 14px; flex-shrink: 0; }
.trial-paid { background: linear-gradient(135deg,#EEF2FF,#E0E7FF); border-color:#A5B4FC; color:#3730A3; }

/* ── Paywall overlay ─────────────────────────────────────────────────────── */
.paywall-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .3s ease-out;
}
.paywall-card {
  background: linear-gradient(160deg, #1E1B4B 0%, #312E81 100%);
  border-radius: 24px; padding: 32px 28px;
  width: 100%; max-width: 400px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.50);
  animation: pop .3s ease-out;
}
.paywall-logo {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.paywall-title {
  font-size: 22px; font-weight: 800; color: #fff;
  letter-spacing: -.3px; margin-bottom: 4px;
}
.paywall-title span { color: #A5B4FC; }
.paywall-subtitle { font-size: 13px; color: #C7D2FE; margin-bottom: 20px; }
.paywall-price {
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
  margin-bottom: 20px;
}
.pw-amount { font-size: 42px; font-weight: 800; color: #fff; line-height: 1; }
.pw-period { font-size: 16px; color: #A5B4FC; font-weight: 600; }
.paywall-features {
  list-style: none; margin: 0 0 24px; padding: 0;
  text-align: left; display: flex; flex-direction: column; gap: 8px;
}
.paywall-features li {
  font-size: 13px; color: #E0E7FF; display: flex; align-items: center; gap: 8px;
}
.paywall-cta {
  display: block; background: linear-gradient(135deg,#6366F1,#818CF8);
  color: white; text-decoration: none;
  font-size: 15px; font-weight: 800;
  padding: 14px 24px; border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(99,102,241,.50);
  transition: transform .15s, box-shadow .15s;
}
.paywall-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(99,102,241,.65); }
.paywall-secure { font-size: 11px; color: #818CF8; margin-bottom: 14px; }
.paywall-refresh {
  background: transparent; border: 1px solid rgba(255,255,255,.20);
  color: #C7D2FE; font-size: 12px; font-weight: 600;
  padding: 8px 16px; border-radius: 10px; cursor: pointer; width: 100%;
  transition: background .15s;
}
.paywall-refresh:hover { background: rgba(255,255,255,.08); }

/* ── Desmos graph embed ───────────────────────────────────────────────────── */
.desmos-embed {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.desmos-label {
  font-size: 12px; font-weight: 700; color: var(--primary);
  padding: 7px 12px;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.desmos-iframe {
  width: 100%; height: 280px;
  border: none; display: block;
}
@media (max-width: 480px) { .desmos-iframe { height: 220px; } }

/* ── KaTeX overrides — match Abhaya indigo theme ─────────────────────────── */
.katex { font-size: 1.05em; }
.katex-display { margin: 10px 0; overflow-x: auto; }

/* ── Abhaya avatar animated states ──────────────────────────────────────────
   Three CSS-only states on .sb-logo-ring:
   default = idle (slow glow), .avatar-thinking (fast pulse), .avatar-speaking (wave)
   Triggered by JS when Gemini is processing / TTS is playing.
   Zero cost, works on any network speed.
   ─────────────────────────────────────────────────────────────────────────── */
.sb-logo-ring {
  transition: box-shadow .3s, transform .2s;
}
/* Idle: existing slow glow — no change needed (already set on .sb-logo-ring) */

/* Thinking: fast amber pulse — "Abhaya is processing" */
.sb-logo-ring.avatar-thinking {
  animation: avatar-think 0.7s ease-in-out infinite;
}
@keyframes avatar-think {
  0%,100% { box-shadow: 0 2px 8px rgba(79,70,229,.30); transform: scale(1); }
  50%      { box-shadow: 0 0 0 8px rgba(245,158,11,.30), 0 2px 20px rgba(245,158,11,.40); transform: scale(1.05); }
}

/* Speaking: smooth indigo wave — "Abhaya is talking" */
.sb-logo-ring.avatar-speaking {
  animation: avatar-speak 1.1s ease-in-out infinite;
}
@keyframes avatar-speak {
  0%,100% { box-shadow: 0 0 0 3px rgba(79,70,229,.25), 0 2px 8px rgba(79,70,229,.30); }
  33%      { box-shadow: 0 0 0 6px rgba(79,70,229,.18), 0 2px 16px rgba(79,70,229,.35); }
  66%      { box-shadow: 0 0 0 10px rgba(79,70,229,.08), 0 2px 24px rgba(79,70,229,.25); }
}

/* ── Biology SVG diagrams ────────────────────────────────────────────────── */
.viz-bio {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px 8px;
  text-align: center;
  max-width: 100%;
}
.viz-bio svg { display: block; width: 100%; height: auto; margin: 0 auto 6px; }
.viz-bio figcaption { font-size: 11.5px; color: var(--ink); line-height: 1.5; }

/* ── Weak zone banner ────────────────────────────────────────────────────── */
#weakZoneBanner { animation: pop .2s ease-out; }
.wz-title {
  font-size: 9px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px;
}
.wz-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.wz-chip {
  font-size: 10px; font-weight: 600; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px 7px;
  white-space: nowrap;
}

/* ==========================================================================
   MARKDOWN + MCQ RICH RENDERING
   ========================================================================== */

/* ── Markdown body container ─────────────────────────────────────────────── */
.md-body, .bubble-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}

/* Paragraphs */
.md-p { margin: 0 0 8px; }
.md-p:last-child { margin-bottom: 0; }

/* Headers */
.md-h1 { font-size: 15px; font-weight: 800; color: var(--primary); margin: 10px 0 4px; }
.md-h2 { font-size: 14px; font-weight: 700; color: var(--primary); margin: 8px 0 4px; }
.md-h3 { font-size: 13px; font-weight: 700; color: var(--ink); margin: 6px 0 3px; }

/* Bold and italic inherit from parent but add color for emphasis */
.bubble.bot strong { color: var(--ink); font-weight: 700; }
.bubble.bot em { color: var(--ink-2); font-style: italic; }

/* Inline code */
.md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgba(79,70,229,.08);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(79,70,229,.15);
}

/* Lists */
.md-ul, .md-ol {
  margin: 6px 0 8px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.md-ul li { list-style-type: disc; }
.md-ol li { list-style-type: decimal; }
.md-ul li, .md-ol li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  padding-left: 2px;
}

/* Horizontal rule */
.md-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

/* ── MCQ option cards ────────────────────────────────────────────────────── */
.mcq-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 4px;
  width: 100%;
}
.mcq-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  width: 100%;
}
.mcq-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(2px);
}
.mcq-option.mcq-selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.mcq-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
  transition: all .15s;
}
.mcq-option:hover .mcq-letter,
.mcq-option.mcq-selected .mcq-letter {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
/* Once a choice is sent to Abhaya, lock the card set: selected card stays
   highlighted, the rest dim and lose hover/cursor affordances. */
.mcq-option:disabled {
  cursor: default;
}
.mcq-option:disabled:hover {
  transform: none;
}
.mcq-options.mcq-answered .mcq-option:not(.mcq-selected) {
  opacity: 0.45;
}
.mcq-options.mcq-answered .mcq-option:not(.mcq-selected):hover {
  border-color: var(--border);
  background: var(--surface);
  transform: none;
}
.mcq-text { flex: 1; line-height: 1.4; }

/* ── 3D Molecule Viewer ──────────────────────────────────────────────────── */
.mol3d-container {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #0a0a1a;
}
.mol3d-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #1a1a3e, #0a1628);
  border-bottom: 1px solid rgba(99,102,241,.3);
}
.mol3d-icon { font-size: 16px; }
.mol3d-title { font-size: 13px; font-weight: 700; color: #e0e7ff; flex: 1; }
.mol3d-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: white; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase;
}
.mol3d-viewer { position: relative; }
.mol3d-caption {
  font-size: 10px; color: rgba(148,163,184,.7);
  text-align: center; padding: 5px 8px;
  background: #0a0a1a;
}

/* ==========================================================================
   HUMAN FACE AVATAR — Abhaya portrait with animated state transitions
   Three states: idle (hands folded) → thinking (chin-on-hand) → speaking (gesture)
   ========================================================================== */

/* Avatar panel replaces old sb-brand row */
.avatar-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 14px 12px;
  border-bottom: 1px solid #F3F4F6;
  flex-shrink: 0;
  background: linear-gradient(180deg, #F0EDFF 0%, #FAFAFE 100%);
}

/* Portrait frame — fixed 160×120px in sidebar */
.avatar-portrait {
  position: relative;
  width: 160px;
  height: 140px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(79,70,229,.20), 0 0 0 3px white, 0 0 0 4px rgba(79,70,229,.15);
  flex-shrink: 0;
  margin-bottom: 10px;
}

/* All three avatar images stacked, crossfade between them */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* focus on face */
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}
.avatar-img.active { opacity: 1; }

/* State indicator ring — thin pulse overlay on avatar */
.avatar-state-ring {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 3px solid transparent;
  pointer-events: none;
  transition: border-color .3s, box-shadow .3s;
}

/* Thinking state: amber ring pulse on border */
.avatar-portrait.is-thinking .avatar-state-ring {
  border-color: rgba(245,158,11,.5);
  box-shadow: inset 0 0 20px rgba(245,158,11,.15);
  animation: avatar-ring-think 0.8s ease-in-out infinite;
}
@keyframes avatar-ring-think {
  0%,100% { border-color: rgba(245,158,11,.4); }
  50%      { border-color: rgba(245,158,11,.8); }
}

/* Speaking state: indigo ring soft wave */
.avatar-portrait.is-speaking .avatar-state-ring {
  border-color: rgba(79,70,229,.6);
  box-shadow: inset 0 0 20px rgba(79,70,229,.15);
  animation: avatar-ring-speak 1.2s ease-in-out infinite;
}
@keyframes avatar-ring-speak {
  0%,100% { box-shadow: inset 0 0 16px rgba(79,70,229,.10), 0 0 0 0 rgba(79,70,229,.20); }
  50%      { box-shadow: inset 0 0 28px rgba(79,70,229,.25), 0 0 0 4px rgba(79,70,229,.08); }
}

/* Avatar info below portrait */
.avatar-info { text-align: center; width: 100%; }
.avatar-name {
  font-size: 16px; font-weight: 800; color: #1E1B4B;
  letter-spacing: -.2px; line-height: 1.2; margin-bottom: 2px;
}
.avatar-tagline {
  font-size: 11px; color: #9CA3AF; font-weight: 500; margin-bottom: 6px;
}

/* Live status pill below name */
.avatar-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: white; border: 1px solid #E5E7EB;
  border-radius: 999px; padding: 3px 10px;
  font-size: 10px; font-weight: 600; color: #6B7280;
  transition: background .3s, color .3s;
}
.avatar-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10B981; flex-shrink: 0;
  animation: status-pulse 2.5s ease-in-out infinite;
}
@keyframes status-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(.8); }
}

/* Thinking status */
.avatar-status-pill.is-thinking {
  background: #FEF9EC; border-color: #FCD34D; color: #92400E;
}
.avatar-status-pill.is-thinking .avatar-status-dot { background: #F59E0B; }

/* Speaking status */
.avatar-status-pill.is-speaking {
  background: #EEF2FF; border-color: #A5B4FC; color: #3730A3;
}
.avatar-status-pill.is-speaking .avatar-status-dot { background: #4F46E5; }

/* Mobile: hide avatar panel on small screens */
@media (max-width: 719px) { .avatar-panel { display: none; } }

/* ── Mobile mini-avatar (small face circle next to bot bubbles) ──────────────
   Desktop: full portrait panel in sidebar is the avatar — mini-avatar hidden.
   Mobile phones only: sidebar is hidden — mini-avatar shown per bubble.

   NOTE: CSS media queries cannot reliably distinguish mobile from desktop here
   because the Abhaya iframe on desktop is narrower than 719px, causing
   @media (max-width:719px) to fire even on desktop. pointer:coarse also fires
   on touch-enabled Windows laptops.

   SOLUTION: app.js sets body.show-mini-av ONLY when:
     - navigator.userAgent matches a real mobile OS (Android/iPhone/etc.)  AND
     - window.innerWidth ≤ 500px (real phones max ~430px; iPads start at 768px)
   Desktop browsers (even in narrow iframes) never have mobile UA strings.
   ─────────────────────────────────────────────────────────────────────────── */
.mini-avatar { display: none !important; } /* hidden unless show-mini-av class is set */

.show-mini-av .bubble.bot {
  position: relative;
  margin-left: 46px; /* space for mini-avatar on left */
}
.show-mini-av .mini-avatar {
  display: block !important;
  position: absolute;
  left: -44px;
  top: 6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #4F46E5;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
  transition: opacity 0.3s ease;
}
/* Subtle pulse on the active (most recent) mini-avatar when thinking/speaking */
.show-mini-av .mini-avatar.mini-avatar-active {
  box-shadow: 0 0 0 3px rgba(79,70,229,0.3);
  animation: mini-av-pulse 1.2s ease-in-out infinite;
}
@keyframes mini-av-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(79,70,229,0.25); }
  50%       { box-shadow: 0 0 0 6px rgba(79,70,229,0.08); }
}

/* ==========================================================================
   COMPREHENSIVE VISUAL LIBRARY — Physics, Maths, Geography, Primary
   ========================================================================== */

/* ── Physics Simulations ─────────────────────────────────────────────────── */
.physim-wrap {
  margin-top: 12px;
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 14px;
  overflow: hidden;
  background: #F5F3FF;
  box-shadow: 0 2px 8px rgba(99,102,241,.08);
}
.physim-label {
  font-size: 12px; font-weight: 700; color: #3730A3;
  padding: 8px 12px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border-bottom: 1px solid rgba(99,102,241,.15);
  letter-spacing: 0.01em;
}
.physim-canvas {
  display: block; width: 100%; height: auto;
  cursor: pointer;
}

/* ── Maths Visualizations ────────────────────────────────────────────────── */
.mathviz-wrap {
  margin-top: 12px;
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(124,58,237,.07);
}
.mathviz-label {
  font-size: 12px; font-weight: 700; color: #5B21B6;
  padding: 8px 12px;
  background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  border-bottom: 1px solid rgba(124,58,237,.15);
  letter-spacing: 0.01em;
}

/* 3D CSS shapes */
.shape3d {
  display: flex; align-items: center; justify-content: center;
  height: 130px; perspective: 400px; cursor: pointer;
  background: linear-gradient(135deg, #F5F3FF, #EEF2FF);
  position: relative;
}
.shape3d-name {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; font-size: 11px; font-weight: 700; color: #4F46E5;
}
/* Cube */
.shape3d-cube::before {
  content: '';
  width: 60px; height: 60px;
  background: #4F46E5;
  display: block;
  transform: rotateX(25deg) rotateY(35deg);
  box-shadow: -8px 8px 0 -2px #3730A3, 8px -8px 0 -2px #6366F1;
  animation: rotate3d 4s linear infinite;
}
@keyframes rotate3d {
  from { transform: rotateX(25deg) rotateY(0deg); }
  to   { transform: rotateX(25deg) rotateY(360deg); }
}
/* Sphere */
.shape3d-sphere::before {
  content: '';
  width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #818CF8, #3730A3);
  display: block;
  animation: float3d 2s ease-in-out infinite alternate;
}
@keyframes float3d {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}
/* Cone */
.shape3d-cone::before {
  content: '';
  width: 0; height: 0;
  border-left: 35px solid transparent;
  border-right: 35px solid transparent;
  border-bottom: 90px solid #4F46E5;
  display: block;
  filter: drop-shadow(4px 4px 6px rgba(79,70,229,.4));
  animation: float3d 2s ease-in-out infinite alternate;
}
/* Cylinder */
.shape3d-cylinder::before {
  content: '';
  width: 60px; height: 80px;
  background: linear-gradient(to right, #3730A3, #818CF8, #3730A3);
  border-radius: 50% / 12px;
  display: block;
  animation: float3d 2s ease-in-out infinite alternate;
}
/* Pyramid */
.shape3d-pyramid::before {
  content: '';
  width: 0; height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 80px solid #7C3AED;
  display: block;
  filter: drop-shadow(3px 3px 4px rgba(124,58,237,.4));
  animation: float3d 2s ease-in-out infinite alternate;
}

/* ── Geography Maps ─────────────────────────────────────────────────────── */
.geomap-wrap {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.geomap-title {
  font-size: 12px; font-weight: 700; color: #065F46;
  padding: 7px 12px;
  background: #ECFDF5;
  border-bottom: 1px solid #A7F3D0;
}
.geomap-svg { display: block; width: 100%; height: auto; }
.geomap-note {
  font-size: 10px; color: var(--muted);
  padding: 4px 10px 6px; text-align: center;
}

/* ── Primary Class Visuals ──────────────────────────────────────────────── */
.primary-viz {
  margin-top: 12px;
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 14px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 8px rgba(245,158,11,.07);
}
.pv-label {
  font-size: 12px; font-weight: 700; color: #92400E;
  padding: 8px 12px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border-bottom: 1px solid rgba(245,158,11,.25);
  letter-spacing: 0.01em;
}
.pv-count-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px;
}
.pv-block {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.pv-count-ans {
  font-size: 14px; padding: 4px 12px 10px;
  color: var(--ink-2);
}
.pv-plant { display: block; width: 100%; max-width: 200px; margin: 0 auto; height: auto; }
.pv-shapes-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; justify-content: center;
}
.pv-shape-item {
  text-align: center;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
}

/* Override viz-generate-btn to prevent large circle rendering */
.viz-generate-btn {
  display: inline-flex !important;
  align-items: center !important;
  padding: 5px 12px !important;
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  max-width: 200px !important;
  width: auto !important;
  height: auto !important;
}

/* ==========================================================================
   HOLISTIC UI IMPROVEMENTS — Mobile-first, spacing, readability
   ========================================================================== */

/* ── Mobile: complete layout overhaul ────────────────────────────────────── */
@media (max-width: 719px) {

  /* On mobile, sidebar takes zero height — use bottom nav instead */
  .split-view { flex-direction: column; }
  .split-left {
    display: none !important;   /* hidden on mobile — bottom nav replaces it */
  }
  .split-divider { display: none; }
  .split-right { width: 100%; flex: 1; min-height: 0; }

  /* App bar — more compact on mobile */
  .app-bar { padding: 8px 12px; }
  .abhaya-title { font-size: 14px; }
  .subtitle { font-size: 11px; }
  .settings-btn { width: 36px; height: 36px; font-size: 18px; }

  /* Chat — full screen, more breathing room */
  .chat { padding: 12px 10px 16px; gap: 8px; }
  .bubble { max-width: 92%; padding: 10px 13px; font-size: 14px; line-height: 1.55; }
  .bubble.user { border-radius: 18px 18px 4px 18px; }
  .bubble.bot  { border-radius: 18px 18px 18px 4px; }

  /* Welcome screen — compact on mobile */
  .welcome { padding: 12px 14px 10px; }
  #welcomeHeading { font-size: 18px; }
  .welcome-search { margin: 6px 0 14px; padding: 8px 12px; }
  .subject-row { gap: 6px; }
  .subject-pill { min-width: 72px; padding: 10px 8px 9px; }
  .sp-icon { font-size: 22px; }
  .sp-name { font-size: 11px; }
  .sp-desc { display: none; }  /* hide descriptions on small screens */
  .feature-cards { grid-template-columns: 1fr 1fr; gap: 7px; }
  .feature-card { padding: 10px 10px; }
  .fc-title { font-size: 11.5px; }
  .fc-sub { display: none; }

  /* Composer — full width, comfortable thumb reach */
  .composer {
    padding: 10px 12px calc(10px + var(--safe-bot));
    gap: 6px;
  }
  .composer input[type="text"] { padding: 11px 14px; font-size: 15px; }
  .icon-btn { width: 40px; height: 40px; font-size: 19px; }

  /* Bot bubbles — better readability */
  .bubble.rich { padding: 9px 11px 11px; }
  .bot-ribbon { margin-bottom: 4px; }
  .encour-strip { font-size: 11.5px; padding: 4px 8px; }
  .quick-replies { gap: 5px; margin-top: 8px; flex-wrap: wrap; }
  .quick-chip { font-size: 12px; padding: 5px 10px; }

  /* Visuals — full width on mobile */
  .physim-canvas { height: 180px; }
  .mol3d-viewer { height: 180px !important; }
  .viz svg { max-width: 100%; }
  .geomap-svg { max-height: 200px; }
  .feature-cards { margin-top: 10px; }

  /* Mode tab bar — compact on mobile */
  .mode-tab-bar { gap: 6px; padding: 8px 10px; }

  /* Status pill — move lower to avoid overlap */
  .status-pill { top: 56px; }
}

/* ── Mobile bottom navigation ─────────────────────────────────────────────
   Replaces the left sidebar on mobile. Fixed at bottom, above the composer.
   Shows mode + quick access without eating vertical space.
   ─────────────────────────────────────────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
}
@media (max-width: 719px) {
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 8;
  }
  .mbn-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 10px; border: none; background: transparent;
    font-family: inherit; cursor: pointer; color: var(--muted);
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .3px; transition: color .15s;
    text-decoration: none; min-width: 52px;
  }
  .mbn-item .mbn-icon { font-size: 20px; line-height: 1; }
  .mbn-item.active { color: var(--primary); }
  .mbn-item:active { opacity: .7; }
}

/* ── Desktop: improve spacing and density ─────────────────────────────────── */
@media (min-width: 720px) {
  /* Larger chat bubbles on desktop */
  .bubble { max-width: 80%; }
  .bubble.rich { max-width: 86%; }

  /* Better paragraph spacing */
  .bubble.bot .md-body { line-height: 1.75; }
  .bubble.bot .md-p { margin-bottom: 11px; }

  /* Chat subject/hint ribbon — smaller on desktop */
  .bot-ribbon { margin-bottom: 6px; }

  /* Better viz-row wrapping */
  .viz-row { gap: 14px; }

  /* Concept cards — better on desktop */
  .viz.viz-card { padding: 12px 16px; }
  .viz-card-title { font-size: 13px; }

  /* Suggest chips — slightly larger on desktop */
  .suggest button { font-size: 13px; padding: 8px 16px; }

  /* Welcome heading — larger on desktop */
  #welcomeHeading { font-size: 22px; margin-bottom: 8px; }
  #welcomeSubtext { font-size: 14px; margin-bottom: 18px; }

  /* Subject cards — a bit more breathing room */
  .subject-pill { padding: 14px 10px 12px; }
  .sp-icon { font-size: 30px; }
  .sp-name { font-size: 12px; }

  /* Chat padding */
  .chat { padding: 20px 24px 28px; gap: 14px; }
}

/* ── Global spacing improvements ─────────────────────────────────────────── */
/* Larger line-height for bot responses */
.bubble.bot .md-body { line-height: 1.7; }
.bubble.bot .md-p { margin-bottom: 10px; }

/* MCQ options — better touch targets */
.mcq-option { padding: 11px 14px; min-height: 44px; }
@media (max-width: 719px) {
  .mcq-option { padding: 13px 14px; font-size: 14px; }
  .mcq-letter { width: 28px; height: 28px; font-size: 12px; }
}

/* Quick reply chips — better on mobile */
@media (max-width: 719px) {
  .quick-chip { font-size: 12.5px; padding: 7px 13px; }
}

/* Bot bubble hint badges */
.hint-badge { font-size: 9.5px; padding: 2px 7px; }

/* Subject chip in ribbon */
.subject-chip { font-size: 10px; padding: 2px 7px 2px 5px; }

/* Welcome search — mobile */
@media (max-width: 480px) {
  .welcome-search-input { font-size: 14px; }
  .welcome-search-btn { width: 32px; height: 32px; }
}

/* Desmos embeds — mobile */
@media (max-width: 719px) {
  .desmos-embed { margin-top: 8px; }
  .desmos-iframe { height: 220px; }
}

/* Physim wraps — mobile */
@media (max-width: 719px) {
  .physim-wrap { margin-top: 8px; }
  .mathviz-wrap { margin-top: 8px; }
}

/* ── App bar ultra-compact on mobile ─────────────────────────────────────── */
@media (max-width: 719px) {
  .app-bar {
    padding: 6px 10px;
    min-height: 40px;
  }
  .logo-img { width: 26px; height: 26px; }
  .abhaya-title { font-size: 13px; font-weight: 800; }
  .subtitle { font-size: 10px; }
  .settings-btn { width: 32px; height: 32px; font-size: 16px; }

  /* Chat: more space, less padding overhead */
  .chat { padding: 8px 8px 10px; }
  .welcome { padding: 10px 10px 8px; }

  /* Composer: tighter */
  .composer { padding: 8px 10px calc(8px + var(--safe-bot)); gap: 5px; }
  .composer input[type="text"] { 
    padding: 10px 13px; 
    font-size: 14px;
    border-radius: 999px;
  }

  /* Bottom nav: ultra-thin */
  .mobile-bottom-nav {
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .mbn-item { padding: 3px 6px; font-size: 8px; min-width: 44px; }
  .mbn-item .mbn-icon { font-size: 18px; }

  /* Avatar panel: very compact on mobile if shown */
  .avatar-panel { padding: 8px 10px 6px; }
  .avatar-portrait { width: 100px; height: 88px; }

  /* Bubbles: better proportions */
  .bubble { max-width: 94%; font-size: 13.5px; padding: 9px 12px; }
  .bubble.bot .bubble-text { line-height: 1.6; }

  /* Quick chips: horizontal scroll on mobile */
  .quick-replies {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 6px !important;
  }
  .quick-replies::-webkit-scrollbar { display: none; }
  .quick-chip { white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 6px 11px; }
}

/* ── Ensure body fills viewport correctly on mobile ──────────────────────── */
@media (max-width: 719px) {
  html { height: -webkit-fill-available; }
  body { height: 100dvh; height: -webkit-fill-available; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE HOLISTIC FIX — v3  (June 2026)
   Goal: maximum chat space, minimum chrome, every element earns its pixels.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 719px) {

  /* ── 1. Flex chain — each container must have min-height:0 to shrink ── */
  .split-view  { flex: 1; min-height: 0; flex-direction: column; }
  .split-right { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .chat        { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* ── 2. App bar — remove subtitle, shrink to ~38px ──────────────────── */
  .app-bar { padding: 5px 10px; min-height: 38px; }
  .subtitle { display: none; }           /* "Class 5 · CBSE · English" — hidden on mobile */
  .logo-img { width: 26px; height: 26px; }
  .abhaya-title { font-size: 13px; }
  .settings-btn { width: 30px; height: 30px; font-size: 15px; }
  .bar-actions { gap: 3px; }
  /* Hide history & summary buttons on small screens — keep voice + settings */
  #historyBtn, #summaryBtn { display: none; }

  /* ── 3. Welcome screen — aggressive compaction ───────────────────────── */
  .welcome { padding: 8px 10px 4px; gap: 0; }

  /* Language picker → single-row compact pill strip */
  .lang-picker { flex-wrap: nowrap; gap: 5px; margin: 0 0 6px; }
  .lang-btn {
    flex: 1; min-width: 0; padding: 6px 4px 5px;
    border-radius: 12px; gap: 3px;
  }
  .lang-icon { font-size: 16px; }
  .lang-btn span:last-child { font-size: 10px; font-weight: 700; }

  /* Heading & subtext */
  #welcomeHeading { font-size: 15px; margin: 3px 0 1px; line-height: 1.2; }
  #welcomeSubtext { font-size: 11.5px; margin: 0 0 5px; line-height: 1.35; color: var(--ink-2); }

  /* Welcome search bar */
  .welcome-search { margin: 0 0 6px; padding: 6px 10px; border-radius: 999px; }
  .welcome-search-icon { font-size: 14px; }
  .welcome-search-input { font-size: 13px; }
  .welcome-search-btn { width: 26px; height: 26px; font-size: 13px; }

  /* Subject picker → horizontal scroll row */
  .subject-picker { margin: 0 0 4px; }
  .subject-section-header { margin-bottom: 5px; }
  .subject-picker-label { font-size: 11px; font-weight: 700; }
  .subject-view-all { font-size: 10px; }
  .subject-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    padding-bottom: 3px;
    justify-content: flex-start;
    margin: 0 -10px;        /* bleed to edges so scroll feels natural */
    padding-left: 10px;
    padding-right: 10px;
  }
  .subject-row::-webkit-scrollbar { display: none; }
  .subject-pill {
    min-width: 60px !important;
    max-width: 72px;
    flex-shrink: 0;
    padding: 7px 5px 6px;
    border-radius: 12px;
  }
  .sp-icon { font-size: 18px; }
  .sp-name { font-size: 9.5px; }
  .sp-desc { display: none !important; }

  /* HW upload CTA — compact single line */
  .hw-upload-cta { padding: 9px 12px; gap: 8px; border-radius: 12px; margin: 3px 0 2px; }
  .hw-cta-icon { font-size: 20px; }
  .hw-cta-title { font-size: 12px; }
  .hw-cta-sub { display: none !important; }   /* hide the subtitle — saves 18px */
  .learn-cta .hw-cta-title { font-size: 12px; }

  /* Suggest chips section */
  .suggest-section-label { font-size: 10px; margin: 3px 0 2px; }
  .suggest { gap: 5px; }
  .suggest button { font-size: 11.5px; padding: 5px 10px; border-radius: 999px; }

  /* Feature cards — completely hidden on mobile (irrelevant in chat UI) */
  .feature-cards { display: none !important; }

  /* Split-left placeholder — hidden on mobile */
  .split-left-placeholder { display: none !important; }

  /* ── 4. Composer — tighter ───────────────────────────────────────────── */
  .composer { padding: 6px 8px calc(6px + var(--safe-bot)); gap: 4px; }
  .composer input[type="text"] { padding: 8px 12px; font-size: 14px; border-radius: 999px; }
  .icon-btn { width: 36px; height: 36px; font-size: 17px; }

  /* ── 5. Bottom nav — ultra thin ──────────────────────────────────────── */
  .mobile-bottom-nav { padding: 2px 0 calc(2px + env(safe-area-inset-bottom, 0px)); }
  .mbn-item { padding: 2px 3px; font-size: 8px; min-width: 40px; gap: 1px; }
  .mbn-item .mbn-icon { font-size: 16px; }

  /* ── 6. Bot bubbles ──────────────────────────────────────────────────── */
  .bubble { max-width: 96%; font-size: 13.5px; padding: 8px 11px; line-height: 1.5; }
  .bubble.user { border-radius: 18px 18px 4px 18px; max-width: 88%; }
  .bubble.rich { padding: 7px 9px 9px; max-width: 98%; }
  .bubble.bot .md-body { font-size: 13.5px; line-height: 1.58; }
  .bot-ribbon { margin-bottom: 3px; gap: 4px; }
  .encour-strip { font-size: 11px; padding: 3px 7px; margin-bottom: 4px; }

  /* ── 7. Quick replies — horizontal scroll (no wrap) ─────────────────── */
  .quick-replies {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 5px;
    margin-top: 6px;
  }
  .quick-replies::-webkit-scrollbar { display: none; }
  .quick-chip { white-space: nowrap; flex-shrink: 0; font-size: 11.5px; padding: 5px 10px; }

  /* ── 8. Status pill position ─────────────────────────────────────────── */
  .status-pill { top: 46px; font-size: 11px; padding: 5px 12px; }

  /* ── 9. Stop-speech button — above composer ──────────────────────────── */
  .stop-speech-btn { padding: 6px 11px; font-size: 11px; margin-left: 0; gap: 5px; }

  /* ── 10. Concept card illustrations — hidden on mobile (save width) ──── */
  .viz-card-illus { display: none !important; }
  .viz.viz-card { padding: 9px 11px; }
  .viz-card-title { font-size: 12px; }
  .viz-card-hint { font-size: 11px; }

  /* ── 11. Notes panel — full screen slide on mobile ───────────────────── */
  .notes-panel {
    width: 100% !important;
    max-width: 100% !important;
    top: 0 !important;
    border-left: none;
    border-top: 2px solid var(--border);
    border-radius: 0;
  }


  /* 11. Doubt cards - 2-column compact */
  .doubt-cards { grid-template-columns: 1fr 1fr; gap: 6px; }
  .doubt-card { padding: 9px 7px; border-radius: 12px; }
  .doubt-icon { font-size: 20px; }
  .doubt-text { font-size: 10.5px; }

  /* 12. Paywall */
  .paywall-card { padding: 22px 18px; }
  .paywall-title { font-size: 18px; }
  .pw-amount { font-size: 28px; }
  .paywall-features { font-size: 12px; }
  .paywall-cta { padding: 12px 20px; font-size: 14px; }
}

/* 400px and below - extreme compaction */
@media (max-width: 400px) {
  .app-bar { padding: 4px 8px; }
  .logo-img { width: 22px; height: 22px; }
  .abhaya-title { font-size: 11px; }
  #welcomeHeading { font-size: 13px; }
  #welcomeSubtext { display: none !important; }
  .welcome { padding: 6px 8px 2px; }
  .lang-btn { padding: 5px 3px 4px; }
  .lang-icon { font-size: 14px; }
  .subject-pill { min-width: 54px !important; }
  .sp-icon { font-size: 16px; }
  .composer input[type="text"] { font-size: 13px; padding: 7px 10px; }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }
  .mbn-item { min-width: 34px; font-size: 7px; }
  .mbn-item .mbn-icon { font-size: 14px; }
  .bubble { font-size: 13px; padding: 7px 10px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   IFRAME MODE — Abhaya embedded inside Vidhyapath React SPA
   The host SPA already has its own NavBar + tab bar. Hiding Abhaya's internal
   app-bar reclaims ~48px — grows chat from ~340px to ~476px on a typical phone.
   ══════════════════════════════════════════════════════════════════════════ */
body.in-iframe .app-bar {
  display: none !important;
}
/* Back/Forward are only reachable via the app-bar pair when NOT in an
   iframe; the floating pill above takes over the exact same job whenever
   the app-bar is hidden, so Back/Forward are never unreachable either way. */
body.in-iframe .nav-float-bar { display: flex; }
/* …except on PHONES (16 Jul 2026, per Sanju — "Option C"): the floating pill
   overlapped the first chat line in focus mode, and the mobile bottom nav
   already switches every mode in one tap, so the history arrows are near-
   duplicate there. Hidden on mobile; desktop keeps the pill (it sits in the
   empty side margin, no overlap). AppNav JS is untouched — the buttons are
   simply not displayed, and their guarded wiring stays harmless. */
@media (max-width: 719px) {
  body.in-iframe .nav-float-bar { display: none !important; }
}
/* split-view fills the full iframe height now that app-bar is gone */
body.in-iframe .split-view {
  height: 100dvh;
}
/* On mobile in iframe, mode tab bar can be a bit more compact since we're tight */
@media (max-width: 719px) {
  body.in-iframe .mode-tab-bar {
    padding: 6px 10px 5px;
    gap: 5px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE WELCOME SCREEN — reduce scroll, prioritise the chat
   Goal: student reaches the input in ≤1 scroll on any Android/iOS phone.
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 719px) {
  /* Feature cards — decorative only, hidden to cut scroll */
  .feature-cards { display: none !important; }

  /* Welcome search bar — duplicates the composer below; hiding removes confusion */
  .welcome-search { display: none !important; }

  /* Mode desc text inside mode-cards — saves ~14px per card, cleaner look */
  .mode-desc { display: none !important; }

  /* Tighter welcome screen padding & spacing */
  .welcome { padding: 10px 12px 6px; gap: 6px; }
  #welcomeHeading { font-size: 19px; margin-bottom: 0; }
  #welcomeSubtext { font-size: 13px; margin-bottom: 4px; }

  /* Language picker — slightly tighter for mobile */
  .lang-picker { margin-bottom: 10px; gap: 6px; }
  .lang-btn { padding: 10px 6px 9px; min-width: 76px; }
  .lang-icon { font-size: 20px; }

  /* Subject picker — horizontal scroll row instead of multi-row grid */
  .subject-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 7px;
    padding-bottom: 4px;
  }
  .subject-row::-webkit-scrollbar { display: none; }
  .subject-pill {
    flex-shrink: 0;
    min-width: 68px;
  }

  /* Suggest chips — horizontal scroll, no wrap */
  .suggest {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }
  .suggest::-webkit-scrollbar { display: none; }

  /* Mode tab bar label — keep visible but compact */
  .mode-tab-label { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV — 5-item bar now includes Home (← back to Vidhyapath)
   Home button navigates window.top so it works both in-iframe and standalone.
   ══════════════════════════════════════════════════════════════════════════ */
#mbn-home .mbn-icon { font-size: 18px; }
@media (max-width: 719px) {
  /* With 5 items, tighten each a little more */
  .mbn-item { min-width: 0; flex: 1; padding: 4px 2px; font-size: 8px; gap: 2px; }
  .mbn-item .mbn-icon { font-size: 18px; }
  #mbn-home { color: var(--primary); }
}

/* ══════════════════════════════════════════════════════════════════════════
   ORAL TEST PRACTICE — "Practice oral questions" (CT/OT/Quick Test prep)
   Replaces the welcome-screen content (#oralTestPanel sits alongside
   #welcome inside #chat) while setup/confirm/play/summary are showing.
   ══════════════════════════════════════════════════════════════════════════ */
.oral-test-panel { width: 100%; }

/* ---- shared bits ---- */
.oral-spinner {
  width: 34px; height: 34px; margin: 0 auto 10px;
  border: 3px solid var(--primary-light); border-top-color: var(--primary);
  border-radius: 50%; animation: oral-spin .8s linear infinite;
}
.oral-spinner.small { width: 22px; height: 22px; margin: 0; border-width: 2.5px; }
@keyframes oral-spin { to { transform: rotate(360deg); } }
.oral-loading { text-align: center; padding: 28px 12px; color: var(--ink-2); font-size: 13.5px; }
.oral-loading p { margin: 0; font-weight: 600; }

/* ---- practice type picker screen ---- */
.oral-type-picker { padding: 20px 16px 16px; }
.oral-tp-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.oral-tp-hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 14px; }
.oral-tp-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.oral-tp-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: 14px; padding: 14px; cursor: pointer;
  text-align: left; font: inherit; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.oral-tp-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.oral-tp-card:active { transform: scale(.98); }
.oral-tp-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.oral-tp-card strong { display: block; font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 3px; }
.oral-tp-desc { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.oral-tp-cancel { width: 100%; }

/* ---- multiplication tables picker screen ---- */
.oral-tables-picker { padding: 20px 16px 16px; text-align: center; }
.oral-tables-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.oral-tables-hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 14px; }
.oral-tables-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.oral-table-pick-btn {
  background: var(--primary-light); border: 1.5px solid var(--border-soft);
  border-radius: 12px; padding: 12px 0; font: inherit; font-size: 15px;
  font-weight: 800; color: var(--primary); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .1s;
}
.oral-table-pick-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.oral-table-pick-btn:active { transform: scale(.94); background: var(--primary); color: #fff; }
.oral-tables-cancel { width: 100%; }
.oral-tables-link { margin-top: 2px; }

/* ---- table practice-style choice + "say the whole table" recitation ---- */
/* Mode-choice cards reuse .oral-tp-card/.oral-tp-cards (already styled above,
   practice-type picker) and .oral-tables-picker (title/hint/padding) — no new
   rules needed for those. Results screen reuses .oral-summary/.oral-breakdown/
   .oral-bd-pill/.oral-summary-list/.oral-summary-row/.oral-retry-btn/
   .oral-done-btn/.oral-correct-answer-box/.oral-ca-text from the existing
   summary screen. */
.oral-full-row-wrong {
  background: rgba(239, 68, 68, .07);
  border-color: rgba(239, 68, 68, .35);
}
.oral-table-tip-box b { display: block; margin-bottom: 2px; }
/* Each full-recitation results row is a real <button> (not a plain div) so
   a mic mishearing can be corrected by the student/parent with one tap —
   reset default button chrome, keep the existing .oral-summary-row look. */
.oral-full-row-toggle {
  width: 100%; text-align: left; font: inherit; color: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.oral-full-row-toggle:hover { border-color: var(--primary); }
.oral-full-row-toggle:active { transform: scale(0.98); }
.oral-full-toggle-hint { font-size: 12.5px; opacity: 0.75; margin-top: -4px; }

/* ---- restored recitation screen ("say the whole table out loud") ----
   Reuses .oral-mic-btn (shared visual style, own ".oral-full-mic-btn" class
   for JS targeting — see app.js's click-delegation comment on why this must
   never be the ONLY class) and .oral-live-transcript (shared with the
   fact-by-fact player + Reading Practice). Only the typed-fallback
   textarea/form need new rules — deliberately their OWN class names
   (".oral-full-type-row"/".oral-full-type-input"), NOT ".oral-type-row"/
   ".oral-type-input", so the generic single-line typed-answer submit
   handler (which assumes an active items[currentIndex]) can never
   intercept this one-shot recitation form. */
.oral-full-type-row {
  display: flex; flex-direction: column; gap: 8px; margin: 14px auto 0;
  max-width: 420px; width: 100%;
}
.oral-full-type-input {
  font: inherit; font-size: 14.5px; padding: 10px 12px; resize: vertical;
  min-height: 64px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink); outline: none;
}
.oral-full-type-input:focus { border-color: var(--primary); }
body.theme-dark .oral-full-type-input { background: #1e213f; color: #e2e8f0; border-color: #2e3155; }

/* ---- worksheet-style grid ("fill in the blanks", one answer per cell) ---- */
.oral-grid-wrap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 14px 0;
}
@media (max-width: 420px) { .oral-grid-wrap { grid-template-columns: 1fr; } }
.oral-grid-cell-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow-card);
}
.oral-grid-cell-form.oral-grid-cell-correct {
  background: rgba(52, 211, 153, .10); border-color: rgba(52, 211, 153, .45);
}
.oral-grid-cell-form.oral-grid-cell-wrong {
  background: rgba(239, 68, 68, .07); border-color: rgba(239, 68, 68, .35);
}
.oral-grid-q {
  font-weight: 700; font-size: 14.5px; color: var(--ink); white-space: nowrap;
}
.oral-grid-input {
  width: 52px; min-width: 0; flex: 1 1 auto; text-align: center;
  font-size: 15px; font-weight: 700; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 4px; background: var(--bg); color: var(--ink);
}
.oral-grid-input:focus { outline: none; border-color: var(--primary); }
.oral-grid-mic-btn {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.oral-grid-mic-btn:active { transform: scale(0.94); }
.oral-grid-mic-btn.recording { background: var(--primary); color: #fff; border-color: var(--primary); }
.oral-grid-verdict { font-size: 15px; width: 18px; flex-shrink: 0; text-align: center; }

/* ---- Reading Practice (new feature) — deliberately its OWN class names
   throughout (never reusing an .oral-* class as the ONLY identifier on a
   button — a couple are combined purely for shared look, e.g.
   "oral-mic-btn read-mic-btn", but ReadingPractice has its own separate
   click-delegation listener on its own #readingPracticePanel container, so
   unlike the Tables ".oral-start-btn" hotfix, there is no possibility of
   this reuse ever being intercepted by an OralTest handler — the two
   listeners are scoped to entirely different DOM subtrees). ---- */
.read-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; text-align: center; }
.read-hint  { font-size: 12.5px; color: var(--ink-2); text-align: center; margin: 0 0 14px; line-height: 1.5; }
.read-passage-box {
  background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
  font-size: 15px; line-height: 1.9; color: var(--ink);
  max-height: 340px; overflow-y: auto; white-space: pre-wrap;
}
.read-passage-box-compact { max-height: 220px; font-size: 14px; }
.read-hear-first-btn {
  display: block; width: 100%; background: var(--primary-light);
  border: 1.5px dashed var(--primary); border-radius: 12px;
  padding: 10px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--primary); cursor: pointer; margin-bottom: 14px;
  transition: background .15s;
}
.read-hear-first-btn:hover { background: rgba(79,70,229,.16); }
.read-start-btn {
  flex: 1; border: none; border-radius: 14px; padding: 13px;
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: var(--shadow); transition: transform .15s;
}
.read-start-btn:active { transform: scale(.97); }
.read-back-btn { margin-top: 10px; }
.read-tier-msg { font-size: 14px; font-weight: 700; color: var(--ink); text-align: center; margin: 4px 0 12px; }
.read-legend { font-size: 12px; color: var(--ink-2); text-align: center; margin: 10px 0 0; }
.read-word-ok  { color: var(--ink); }
.read-word-miss {
  color: #dc2626; font-weight: 800; background: rgba(220,38,38,.10);
  border-radius: 4px; padding: 0 2px;
}
body.theme-dark .read-word-miss { color: #F87171; background: rgba(248,113,113,.14); }
.read-type-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.read-type-input {
  width: 100%; border: 1.5px solid var(--border-soft); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); resize: vertical;
}

/* ---- spelling / meaning mode display ---- */
.oral-question-mode-label { font-size: 12px; color: var(--ink-2); margin: 0 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.oral-question-word { font-size: 28px !important; font-weight: 900 !important; color: var(--primary); letter-spacing: .03em; }

/* ---- confirm / manual-entry screen ---- */
.oral-confirm { width: 100%; }
.oral-confirm-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; text-align: center; }
.oral-confirm-hint { font-size: 12.5px; color: var(--ink-2); text-align: center; margin: 0 0 14px; line-height: 1.5; }
.oral-item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.oral-item-row {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 10px; box-shadow: var(--shadow-card);
}
.oral-item-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 800; display: flex; align-items: center;
  justify-content: center; margin-top: 2px;
}
.oral-item-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.oral-q-input, .oral-a-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--bg); transition: border-color .15s;
}
.oral-q-input { font-weight: 700; }
.oral-a-input { font-weight: 500; color: var(--ink-2); }
.oral-q-input:focus, .oral-a-input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.oral-item-del {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(239,68,68,.1); color: #EF4444;
  font-size: 12px; font-weight: 700; cursor: pointer; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.oral-item-del:hover { background: rgba(239,68,68,.2); }
.oral-add-btn {
  display: block; width: 100%; background: var(--primary-light);
  border: 1.5px dashed var(--primary); border-radius: 12px;
  padding: 10px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--primary); cursor: pointer; margin-bottom: 14px;
  transition: background .15s;
}
.oral-add-btn:hover { background: rgba(79,70,229,.16); }
.oral-confirm-actions { display: flex; gap: 8px; }
.oral-cancel-btn, .oral-start-btn {
  flex: 1; border: none; border-radius: 14px; padding: 13px;
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
  transition: transform .15s;
}
.oral-cancel-btn { background: var(--bg); color: var(--ink-2); border: 1.5px solid var(--border); }
.oral-cancel-btn:hover { background: var(--border); }
.oral-start-btn { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: var(--shadow); }
.oral-start-btn:active, .oral-cancel-btn:active { transform: scale(.97); }

/* Deliberately its OWN class, not a shared .oral-start-btn — that class is also
   matched by an earlier, unrelated click-delegation check (_tryStart()) further
   up the same handler chain, and sharing it here silently swallowed every tap
   on "Check my answers" (routed into the old confirm-screen's start-practice
   logic instead). Same look as .oral-start-btn, kept fully independent. */
.oral-grid-check-btn {
  width: 100%; border: none; border-radius: 14px; padding: 13px;
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
  transition: transform .15s;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: var(--shadow); margin-bottom: 8px;
}
.oral-grid-check-btn:active { transform: scale(.97); }

/* ---- player screen ---- */
.oral-player { width: 100%; }
.oral-progress { font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: center; margin-bottom: 6px; }
.oral-progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.oral-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .3s ease; }
.oral-question-card {
  background: var(--bot-bg); border: 1.5px solid var(--border-soft);
  border-radius: 16px; padding: 18px 16px; text-align: center; margin-bottom: 16px;
}
.oral-question-text { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.5; margin: 0 0 10px; }
.oral-replay-btn {
  background: none; border: none; font: inherit; font-size: 12px;
  font-weight: 700; color: var(--primary); cursor: pointer; padding: 4px 8px;
}
.oral-replay-btn:hover { text-decoration: underline; }
.oral-answer-area { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.oral-mic-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 92px; height: 92px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 28px; cursor: pointer; box-shadow: 0 6px 20px rgba(79,70,229,.35);
  transition: transform .15s;
}
.oral-mic-btn span { font-size: 10.5px; font-weight: 700; line-height: 1; }
.oral-mic-btn:active { transform: scale(.95); }
.oral-mic-btn.recording {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  animation: oral-pulse 1.1s ease-in-out infinite;
}
@keyframes oral-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(239,68,68,.4); }
  50%      { box-shadow: 0 6px 28px rgba(239,68,68,.7); }
}
.oral-skip-btn {
  background: none; border: none; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); cursor: pointer; padding: 4px 8px;
}
.oral-skip-btn:hover { color: var(--primary); }
.oral-grading { text-align: center; padding: 14px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.oral-grading p { margin: 6px 0 0; }
.oral-your-answer { font-size: 13px; color: var(--ink-2); text-align: center; margin: 0 0 10px; }
.oral-your-answer em { color: var(--ink); font-style: normal; font-weight: 700; }
.oral-verdict {
  display: flex; align-items: center; gap: 8px; border-radius: 14px;
  padding: 12px 14px; font-size: 13px; font-weight: 600; line-height: 1.4;
  margin-bottom: 14px;
}
.oral-verdict-correct { background: rgba(16,185,129,.1); color: #047857; }
.oral-verdict-partial { background: rgba(245,158,11,.12); color: #B45309; }
.oral-verdict-incorrect { background: rgba(239,68,68,.1); color: #B91C1C; }
.oral-verdict-feedback {
  font-size: 13px; color: var(--ink-2); text-align: center;
  margin: 4px 0 10px; padding: 0 8px;
}
.oral-score-badge {
  display: inline-block; margin-left: 8px; padding: 2px 7px;
  font-size: 11px; font-weight: 700; border-radius: 10px;
  background: rgba(0,0,0,.08); vertical-align: middle;
}
.oral-reattempt-btn {
  display: block; width: 100%; border: 1.5px solid var(--primary);
  border-radius: 14px; padding: 11px; font: inherit; font-size: 13px;
  font-weight: 700; color: var(--primary); background: var(--bg);
  cursor: pointer; margin-bottom: 8px;
}
.oral-reattempt-btn:hover { background: var(--primary-light); }
.oral-reattempt-btn:active { transform: scale(.97); }
.oral-next-btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  padding: 13px; font: inherit; font-size: 14px; font-weight: 800;
  color: #fff; cursor: pointer; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow);
}
.oral-next-btn:active { transform: scale(.97); }
.oral-exit-btn {
  display: block; width: 100%; text-align: center; background: none;
  border: none; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; padding: 6px;
}
.oral-exit-btn:hover { color: #B91C1C; }

/* ---- summary screen ---- */
.oral-summary { width: 100%; }
.oral-summary-title { font-size: 16px; font-weight: 800; color: var(--ink); text-align: center; margin: 0 0 10px; }
.oral-breakdown { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.oral-bd-pill { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.oral-bd-correct   { background: rgba(16,185,129,.12); color: #047857; }
.oral-bd-partial   { background: rgba(245,158,11,.14); color: #B45309; }
.oral-bd-incorrect { background: rgba(239,68,68,.12); color: #B91C1C; }
.oral-summary-hint { font-size: 12px; color: var(--ink-2); text-align: center; margin: 0 0 12px; }
.oral-summary-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.oral-summary-empty { text-align: center; color: var(--ink-2); font-size: 13px; }
.oral-summary-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-card);
}
.oral-summary-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.oral-summary-body { flex: 1; min-width: 0; }
.oral-summary-q { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.4; }
/* E10 -- what Abhaya actually heard, shown under a crossed line so a child can
   see WHY it was crossed. The line above it is always a true equation. */
.oral-summary-heard { display: block; margin-top: 3px; font-size: 11.5px;
                      font-weight: 500; color: #6B6F80; line-height: 1.35; }
.oral-full-transcript { font-size: 11.5px; color: #6B6F80; font-style: italic;
                        margin-top: 2px; word-break: break-word; }
.oral-summary-a { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.oral-help-btn {
  display: inline-block; margin-top: 6px; background: var(--primary-light);
  border: 1.5px solid var(--primary); border-radius: 99px;
  padding: 5px 12px; font: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--primary); cursor: pointer; transition: background .15s;
}
.oral-help-btn:hover { background: rgba(79,70,229,.16); }
.oral-help-btn:active { transform: scale(.96); }
.oral-summary-actions { display: flex; gap: 8px; }
.oral-retry-btn, .oral-done-btn {
  flex: 1; border: none; border-radius: 14px; padding: 13px;
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.oral-retry-btn { background: var(--bg); color: var(--primary); border: 1.5px solid var(--primary); }
.oral-retry-btn:hover { background: var(--primary-light); }
.oral-done-btn { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: var(--shadow); }
.oral-retry-btn:active, .oral-done-btn:active { transform: scale(.97); }

/* Live transcript shown while student is speaking (Web Speech interim results) */
.oral-live-transcript {
  margin: 6px 0 0;
  padding: 8px 12px;
  background: #f8f5ff;
  border: 1px solid #c4b5fd;
  border-radius: 10px;
  font-style: italic;
  color: #4338ca;
  font-size: 0.88rem;
  min-height: 34px;
  text-align: center;
  line-height: 1.5;
  word-break: break-word;
}
/* Wrong phrase highlighted inline in the student's answer replay (legacy) */
.oral-wrong-phrase {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #ef4444;
}
/* Word-level highlighting: green for correct words, red for wrong words */
.hl-word-ok {
  color: #059669;
  font-weight: 700;
}
.hl-word-bad {
  color: #dc2626;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #ef4444;
}
/* "The correct answer is …" box shown after wrong / partial verdict */
.oral-correct-answer-box {
  margin: 10px 0 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1.5px solid #34d399;
  border-radius: 12px;
  font-size: 0.92rem;
  color: #065f46;
  text-align: left;
}
.oral-ca-label {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #059669;
  margin-bottom: 4px;
}
.oral-ca-text {
  color: #064e3b;
  font-weight: 500;
  line-height: 1.5;
}
.oral-hear-again-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 12px;
  background: #fff;
  border: 1.5px solid #34d399;
  border-radius: 20px;
  color: #059669;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.oral-hear-again-btn:hover { background: #d1fae5; }
.oral-hear-again-btn:active { transform: scale(.96); }

@media (max-width: 480px) {
  .oral-mic-btn { width: 80px; height: 80px; font-size: 24px; }
  .oral-question-text { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v77 ENHANCEMENT PACK — appended overrides only (safe, non-destructive).
   Covers: markdown tables/code · weekly goal · install banner · oral share ·
   accessibility text sizes · touch targets · scrollbars · micro-interactions ·
   wide-screen readability · overscroll · young-learner mic · reduced motion ·
   DARK MODE (body.theme-dark overrides on the major surfaces).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Markdown tables + code blocks (renderMarkdown additions) ── */
.md-table-wrap { overflow-x: auto; margin: 8px 0; border-radius: 10px; border: 1px solid #e2e8f0; }
.md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-table th, .md-table td { padding: 7px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; }
.md-table th { background: #eef2ff; color: #3730a3; font-weight: 700; }
.md-table tr:last-child td { border-bottom: none; }
.md-pre {
  background: #1e1b4b; color: #e0e7ff; padding: 10px 12px; border-radius: 10px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.5; margin: 8px 0;
}
.md-pre code { background: none; color: inherit; padding: 0; }

/* ── Weekly goal line in the streak card ── */
.sb-weekly-goal {
  margin-top: 6px; font-size: 11px; font-weight: 600; color: #4F46E5;
  background: #eef2ff; border-radius: 8px; padding: 4px 8px; text-align: center;
}

/* ── Custom PWA install banner ── */
.install-banner {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 9998;
  background: #ffffff; border: 1px solid #c7d2fe; border-radius: 14px;
  padding: 10px 14px; box-shadow: 0 8px 28px rgba(79, 70, 229, .18);
  max-width: min(92vw, 420px);
}
.install-banner-text { font-size: 13px; color: #1e1b4b; }
.install-banner-btn {
  background: linear-gradient(135deg, #4F46E5, #7C3AED); color: #fff; border: none;
  border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.install-banner-close {
  background: none; border: none; color: #64748b; font-size: 14px; cursor: pointer; padding: 4px;
}

/* ── Oral test "Share result" button ── */
.oral-share-btn {
  background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0;
  border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.oral-share-btn:hover { background: #d1fae5; }
.oral-share-btn:active { transform: scale(.96); }

/* ── Accessibility: chat text size (Settings → Text size) ── */
body.text-large .bubble { font-size: 16.5px; line-height: 1.62; }
body.text-large .md-table { font-size: 14.5px; }
body.text-xl .bubble { font-size: 18.5px; line-height: 1.7; }
body.text-xl .md-table { font-size: 16px; }

/* ── Wide-screen readability: cap the text measure on big monitors ── */
@media (min-width: 1100px) {
  .bubble { max-width: 72ch; }
}

/* ── Thin, soft scrollbars (Windows default bars look heavy on this design) ── */
* { scrollbar-width: thin; scrollbar-color: #c7d2fe transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Micro-interactions: consistent press feedback on all action buttons ── */
.icon-btn:active, .mode-tab:active, .sb-nav-item:active, .feature-card:active,
.hw-intent-btn:active, .doubt-card:active, .lang-btn:active, .mode-card:active,
.suggest button:active, .mcq-option:not(:disabled):active {
  transform: scale(.97);
}

/* ── Mobile: block accidental pull-to-refresh inside the chat scroller ── */
.chat { overscroll-behavior-y: contain; }

/* ── Mobile: minimum 44px touch targets on small controls ── */
@media (max-width: 719px) {
  .bookmark-btn, .speaker-btn, .checklist-toggle, .attach-preview-remove {
    min-width: 44px; min-height: 44px; display: inline-flex;
    align-items: center; justify-content: center;
  }
  .composer .icon-btn { min-width: 44px; min-height: 44px; }
}

/* ── Young-learner mode (Class 1-5): voice-first — bigger, highlighted mic ── */
body.young-learner #micBtn {
  min-width: 52px; min-height: 52px; font-size: 22px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 2px solid #a5b4fc; border-radius: 14px;
}
body.young-learner #micBtn:hover { background: #e0e7ff; }

/* ── Reduced motion: respect the OS setting (accessibility + low-end perf) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .confetti, .celebrate-star { display: none !important; }
}

/* ═══ DARK MODE — body.theme-dark (Settings → Theme, or Auto + OS dark) ═══
   Additive overrides on the major surfaces. Chat visuals (canvas/SVG) keep
   their own light cards by design — diagrams stay readable. */
body.theme-dark { background: #0f1023; color: #e2e8f0; }
body.theme-dark .chat { background: #0f1023; }
body.theme-dark .split-right, body.theme-dark .split-view { background: #0f1023; }
body.theme-dark .welcome h1, body.theme-dark #welcomeHeading { color: #e0e7ff; }
body.theme-dark #welcomeSubtext { color: #94a3b8; }
body.theme-dark .bubble.bot {
  background: #1e213f; color: #e2e8f0; border-color: #2e3155;
}
body.theme-dark .bubble.user { background: #4F46E5; color: #fff; }
body.theme-dark .sidebar-persistent, body.theme-dark .split-left {
  background: #14162e; border-color: #2e3155;
}
body.theme-dark .sb-nav-item { color: #cbd5e1; }
body.theme-dark .sb-nav-item:hover { background: #1e213f; }
body.theme-dark .sb-nav-item.active { background: #2e3155; color: #e0e7ff; }
body.theme-dark .sb-section-label { color: #64748b; }
body.theme-dark .avatar-name { color: #e0e7ff; }
body.theme-dark .avatar-tagline { color: #94a3b8; }
body.theme-dark .sb-streak-card, body.theme-dark .sb-upload-card {
  background: #1e213f; border-color: #2e3155; color: #e2e8f0;
}
body.theme-dark .composer {
  background: #14162e; border-color: #2e3155;
}
body.theme-dark .composer input[type="text"] {
  background: #1e213f; color: #e2e8f0; border-color: #2e3155;
}
body.theme-dark .composer input[type="text"]::placeholder { color: #64748b; }
body.theme-dark .icon-btn { background: #1e213f; color: #cbd5e1; border-color: #2e3155; }
body.theme-dark .icon-btn.primary { background: linear-gradient(135deg, #4F46E5, #7C3AED); color: #fff; }
body.theme-dark .mode-tab-bar { background: #14162e; }
body.theme-dark .mode-tab { color: #cbd5e1; }
body.theme-dark .mode-tab.active { background: #2e3155; color: #e0e7ff; }
body.theme-dark .mode-card, body.theme-dark .feature-card, body.theme-dark .doubt-card,
body.theme-dark .hw-intent-btn, body.theme-dark .lang-btn, body.theme-dark .subject-pill,
body.theme-dark .hw-upload-cta {
  background: #1e213f; color: #e2e8f0; border-color: #2e3155;
}
body.theme-dark .mode-desc, body.theme-dark .fc-sub, body.theme-dark .hw-cta-sub { color: #94a3b8; }
body.theme-dark .fc-title, body.theme-dark .hw-cta-title, body.theme-dark .mode-label { color: #e2e8f0; }
/* Intent step-2 chooser — dark theme (16 Jul 2026) */
body.theme-dark .hw-step2 { background: #171a33; border-color: #2e3155; }
body.theme-dark .hw-step2--guide  { background: linear-gradient(160deg, #1d2145 0%, #171a33 70%); border-color: rgba(129,140,248,.38); }
body.theme-dark .hw-step2--verify { background: linear-gradient(160deg, #12271c 0%, #171a33 70%); border-color: rgba(34,197,94,.35); }
body.theme-dark .hw-step2--oral   { background: linear-gradient(160deg, #2b1626 0%, #171a33 70%); border-color: rgba(236,72,153,.35); }
body.theme-dark .hw-step2-hint { color: #cbd5e1; }
body.theme-dark .hw-step2-card { background: #1e213f; border-color: #2e3155; }
body.theme-dark .hw-step2-body strong { color: #e2e8f0; }
body.theme-dark .hw-step2-desc { color: #94a3b8; }
body.theme-dark .hw-intent-btn[data-intent="verify"].active { background: #12271c; color: #4ade80; }
body.theme-dark .hw-intent-btn[data-intent="oral"].active   { background: #2b1626; color: #f472b6; }
body.theme-dark .hw-step2-sel    { background: #1e213f; }
body.theme-dark .hw-step2--guide  .hw-step2-sel { color: #a5b4fc; }
body.theme-dark .hw-step2--verify .hw-step2-sel { color: #4ade80; }
body.theme-dark .hw-step2--oral   .hw-step2-sel { color: #f472b6; }
body.theme-dark .hw-step2-change { background: #1e213f; border-color: #2e3155; color: #94a3b8; }
body.theme-dark .drawer-card {
  background: #14162e; color: #e2e8f0; border-color: #2e3155;
}
body.theme-dark .drawer-card h2 { color: #e0e7ff; }
body.theme-dark .drawer-card select {
  background: #1e213f; color: #e2e8f0; border-color: #2e3155;
}
body.theme-dark .field span { color: #cbd5e1; }
body.theme-dark .app-bar { background: linear-gradient(135deg, #1e1b4b, #312e81); }
body.theme-dark .welcome-search {
  background: #1e213f; border-color: #2e3155;
}
body.theme-dark .welcome-search-input { background: transparent; color: #e2e8f0; }
body.theme-dark .suggest button {
  background: #1e213f; color: #cbd5e1; border-color: #2e3155;
}
body.theme-dark .checklist, body.theme-dark .oral-tracker {
  background: #14162e; border-color: #2e3155; color: #e2e8f0;
}
body.theme-dark .split-left-placeholder { background: #14162e; color: #cbd5e1; }
body.theme-dark .spl-heading { color: #e0e7ff; }
body.theme-dark .spl-feature-chip { background: #1e213f; color: #cbd5e1; border-color: #2e3155; }
body.theme-dark .md-table th { background: #2e3155; color: #c7d2fe; }
body.theme-dark .md-table-wrap, body.theme-dark .md-table th, body.theme-dark .md-table td { border-color: #2e3155; }
body.theme-dark .md-code { background: #2e3155; color: #e0e7ff; }
body.theme-dark .stuck-row { background: transparent; }
body.theme-dark .new-question-btn, body.theme-dark .stuck-btn { border-color: #2e3155; }
body.theme-dark .attach-preview { background: #1e213f; border-color: #2e3155; color: #cbd5e1; }
body.theme-dark .mobile-bottom-nav { background: #14162e; border-color: #2e3155; }
body.theme-dark .mbn-item { color: #94a3b8; }
body.theme-dark .mbn-item.active { color: #a5b4fc; }
body.theme-dark .install-banner { background: #1e213f; border-color: #2e3155; }
body.theme-dark .install-banner-text { color: #e2e8f0; }
body.theme-dark .notes-panel { background: #14162e; color: #e2e8f0; border-color: #2e3155; }
body.theme-dark .oral-test-panel { background: #14162e; color: #e2e8f0; }
body.theme-dark .oral-question-card { background: #1e213f; border-color: #2e3155; color: #e2e8f0; }
body.theme-dark .sb-weekly-goal { background: #2e3155; color: #c7d2fe; }

/* ═══ DARK MODE v2 — DESIGN-TOKEN PASS (v78) ═══════════════════════════════
   The stylesheet already routes most text/surfaces through :root variables
   (--ink/--ink-2/--surface/--border/…). Redefining the tokens for
   body.theme-dark flips ~250 rules at once — this fixes every "dark text on
   dark background" case the v77 surface-only overrides missed (oral question
   text, homework-check bubble content, progress labels, md headings, strong,
   confirm/edit screens, summary rows, checklists). Hardcoded stragglers are
   overridden individually below. */
body.theme-dark {
  --bg:            #0f1023;
  --surface:       #171a33;
  --primary:       #818CF8;   /* lighter indigo — readable as text on dark   */
  --primary-2:     #A5B4FC;
  --primary-glow:  rgba(129,140,248,.16);
  --primary-light: #2e3155;
  --ink:           #e2e8f0;
  --ink-1:         #e2e8f0;
  --ink-2:         #a5b0c5;
  --ink-3:         #8891a8;
  --muted:         #64748b;
  --border:        #2e3155;
  --border-soft:   rgba(165,180,252,.22);
  --bot-bg:        #1e213f;
  --user-bg:       #4F46E5;
  --user-ink:      #ffffff;
  --shadow:        0 4px 24px rgba(0,0,0,.45);
  --shadow-card:   0 2px 12px rgba(0,0,0,.4), 0 0 0 1px rgba(165,180,252,.08);
}
/* Hardcoded dark-ink stragglers → light */
body.theme-dark .sb-brand-name,
body.theme-dark .sb-streak-days,
body.theme-dark .sb-upload-title,
body.theme-dark .fc-title,
body.theme-dark .avatar-name { color: #e2e8f0; }
body.theme-dark .sp-name { color: #cbd5e1; }
/* Avatar panel — was a light lavender gradient card */
body.theme-dark .avatar-panel {
  background: linear-gradient(180deg, #1e213f 0%, #171a33 100%);
  border-bottom-color: #2e3155;
}
body.theme-dark .avatar-status-pill { background: #2e3155; border-color: #3b3f66; color: #cbd5e1; }
/* Oral verdict tiers + word highlighting — brighter variants for dark bg */
body.theme-dark .oral-verdict-correct   { background: rgba(16,185,129,.18); color: #34D399; }
body.theme-dark .oral-verdict-partial   { background: rgba(245,158,11,.18); color: #FBBF24; }
body.theme-dark .oral-verdict-incorrect { background: rgba(239,68,68,.18);  color: #F87171; }
body.theme-dark .hl-word-ok  { color: #34D399; }
body.theme-dark .hl-word-bad { color: #F87171; text-decoration-color: #F87171; }
/* Light pastel status rows — dark equivalents so token-light text stays readable */
body.theme-dark .oral-tracker-item.chk-current { background: #2e3155; }
body.theme-dark .oral-tracker-item.chk-correct { background: rgba(16,185,129,.15); }
body.theme-dark .oral-tracker-item.chk-partial { background: rgba(245,158,11,.15); }
body.theme-dark .oral-tracker-item.chk-wrong   { background: rgba(239,68,68,.15); }
body.theme-dark .chk-item.chk-active { background: rgba(245,158,11,.16); border-color: #92400e; }
body.theme-dark .chk-item.chk-done   { background: rgba(16,185,129,.16); border-color: #065f46; color: #6EE7B7; }
body.theme-dark .chk-start-btn:hover { background: rgba(16,185,129,.28); }
/* Elements that KEEP a light background in dark mode (correct-answer box,
   celebration cards, amber consent chips) intentionally keep their dark text —
   do not override .oral-correct-answer-box / .oral-ca-text / .quick-chip. */
/* Buttons/inputs on oral confirm + notes panel inherit --surface/--ink now. */
body.theme-dark .oral-q-input, body.theme-dark .oral-a-input {
  background: #1e213f; color: #e2e8f0; border-color: #2e3155;
}
/* User bubble keeps the solid indigo brand fill (NOT the lightened text token) */
body.theme-dark .bubble.user { background: #4F46E5; color: #ffffff; }

/* ── Oral test: typed-answer fallback (works on iPhone, denied-mic, noise) ── */
.oral-type-toggle-btn {
  display: inline-block; margin-top: 10px; background: none; border: none;
  color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer;
  text-decoration: underline; padding: 6px;
}
.oral-type-row {
  display: flex; gap: 8px; margin-top: 12px; width: 100%;
  max-width: 420px; margin-left: auto; margin-right: auto;
}
.oral-type-input {
  flex: 1; min-width: 0; font: inherit; font-size: 15px;
  padding: 12px 14px; border: 2px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--ink);
  outline: none;
}
.oral-type-input:focus { border-color: var(--primary); }
.oral-type-submit-btn {
  flex-shrink: 0; background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff; border: none; border-radius: 12px; padding: 12px 16px;
  font-weight: 700; font-size: 14px; cursor: pointer; min-height: 44px;
}
.oral-type-submit-btn:active { transform: scale(.97); }
body.theme-dark .oral-type-input { background: #1e213f; color: #e2e8f0; border-color: #2e3155; }

/* ══════════════════════════════════════════════════════════════════════════
   New-question boundary + chip + mobile oral-tool switch (16 Jul 2026)
   ══════════════════════════════════════════════════════════════════════════ */

/* Subtle "— new question —" divider dropped into the chat when a new photo /
   confirmed new question resets the thread (context boundary, history kept). */
.newq-divider {
  display: flex; align-items: center; text-align: center;
  gap: 10px; margin: 14px 2px 6px; color: var(--ink-2, #64748b);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.newq-divider::before, .newq-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100,116,139,.35), transparent);
}
.newq-divider span { white-space: nowrap; }
body.theme-dark .newq-divider { color: #94a3b8; }

/* "New question or follow-up?" chip shown before sending a typed message that
   looks like a fresh question while a chat is active. */
.newq-chip {
  align-self: center; max-width: 460px; width: 100%;
  margin: 8px auto; padding: 12px 14px;
  background: linear-gradient(160deg, #EEF2FF 0%, #FDFDFF 70%);
  border: 1.5px solid rgba(79,70,229,.30); border-radius: 14px;
  box-shadow: 0 2px 10px rgba(79,70,229,.10);
  animation: newq-chip-in .22s ease-out both;
}
@keyframes newq-chip-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }
.newq-chip-q { font-size: 13px; font-weight: 700; color: var(--ink, #1e293b); }
.newq-chip-preview { font-size: 12px; color: var(--ink-2, #64748b); margin: 4px 0 10px; font-style: italic; line-height: 1.4; }
.newq-chip-actions { display: flex; gap: 8px; }
.newq-chip-btn {
  flex: 1; padding: 8px 10px; border-radius: 10px; font: inherit;
  font-size: 12.5px; font-weight: 800; cursor: pointer; transition: all .15s;
  min-height: 40px;
}
.newq-chip-new    { background: var(--primary, #4F46E5); color: #fff; border: none; }
.newq-chip-new:active { transform: scale(.97); }
.newq-chip-follow { background: #fff; color: var(--primary, #4F46E5); border: 1.5px solid var(--primary, #4F46E5); }
.newq-chip-follow:active { transform: scale(.97); }
body.theme-dark .newq-chip { background: linear-gradient(160deg, #1d2145 0%, #171a33 70%); border-color: rgba(129,140,248,.38); }
body.theme-dark .newq-chip-q { color: #e2e8f0; }
body.theme-dark .newq-chip-preview { color: #94a3b8; }
body.theme-dark .newq-chip-follow { background: #1e213f; color: #a5b4fc; border-color: #3730a3; }

/* Mobile-only "practise something else" quick switch on oral result screens.
   Desktop (≥720px) keeps the sidebar Quick Access, so this is hidden there. */
.oral-mobile-tools { display: none; margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(100,116,139,.28); }
@media (max-width: 719px) { .oral-mobile-tools { display: block; } }
.oral-mobile-tools-label { margin: 0 0 8px; font-size: 12.5px; font-weight: 800; color: var(--ink, #1e293b); text-align: center; }
.oral-mobile-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.oral-tool-btn {
  padding: 11px 10px; border-radius: 12px; font: inherit;
  font-size: 12.5px; font-weight: 700; cursor: pointer; min-height: 46px;
  background: var(--surface, #fff); color: var(--ink, #1e293b);
  border: 1.5px solid var(--border, #e2e8f0); transition: all .15s;
}
.oral-tool-btn:active { transform: scale(.97); border-color: var(--primary, #4F46E5); }
body.theme-dark .oral-mobile-tools-label { color: #e2e8f0; }
body.theme-dark .oral-tool-btn { background: #1e213f; color: #e2e8f0; border-color: #2e3155; }


/* ==== ABHAYA UI polish (Session 40) ==== */
/* (1) Dark-mode mode-tab contrast — unselected pills were light-on-light */
body.theme-dark .mode-tab-bar { background:#14162e; border-bottom-color:#242a4d; }
body.theme-dark .mode-tab { background:#1e2242; color:#dbe2f4; border-color:#3a4070; }
body.theme-dark .mode-tab:hover { background:#262c58; color:#c7d2fe; border-color:#6366f1; transform:translateY(-1px); }
body.theme-dark .mode-tab.active { background:linear-gradient(135deg,#6366f1 0%,#8b5cf6 100%); color:#fff; border-color:transparent; box-shadow:0 3px 16px rgba(99,102,241,.5); }

/* (2) Sidebar Quick-Access — richer icon chips, hover lift, gradient active */
.sb-nav-item { gap:10px; padding:9px 11px; border:1px solid transparent; border-radius:12px; color:#475569;
  transition:background .15s ease,color .15s ease,box-shadow .15s ease,transform .15s ease,border-color .15s ease; }
.sb-nav-item .sb-nav-icon { width:28px; height:28px; display:flex; align-items:center; justify-content:center;
  border-radius:9px; background:#EEF1FF; box-shadow:inset 0 0 0 1px #E3E6FB; transition:all .15s ease; font-size:15px; text-align:center; }
.sb-nav-item:hover { background:#F4F6FF; color:#4F46E5; border-color:#E3E6FB; box-shadow:0 2px 10px rgba(79,70,229,.09); transform:translateX(2px); }
.sb-nav-item:hover .sb-nav-icon { background:#E0E4FF; box-shadow:inset 0 0 0 1px #C7CCFF; }
.sb-nav-item.active { background:linear-gradient(135deg,#EEF0FF 0%,#F3EEFF 100%); color:#4338CA; font-weight:700; border-color:#DDE1FF;
  box-shadow:inset 3px 0 0 #4F46E5,0 2px 10px rgba(79,70,229,.10); }
.sb-nav-item.active .sb-nav-icon { background:#fff; box-shadow:inset 0 0 0 1px #C7CCFF; }
body.theme-dark .sb-nav-item { color:#cbd5e1; }
body.theme-dark .sb-nav-item .sb-nav-icon { background:#232748; box-shadow:inset 0 0 0 1px #2f3560; }
body.theme-dark .sb-nav-item:hover { background:#1e213f; color:#e0e7ff; border-color:#2f3560; }
body.theme-dark .sb-nav-item:hover .sb-nav-icon { background:#2e3360; box-shadow:inset 0 0 0 1px #3b4270; }
body.theme-dark .sb-nav-item.active { background:#2b2f57; color:#e0e7ff; border-color:#3a3f66; }
body.theme-dark .sb-nav-item.active .sb-nav-icon { background:#4F46E5; box-shadow:none; }

/* (3) Study the Chapter picker — was unstyled (default buttons) */
#studyChapterPanel { padding:4px 2px 12px; }
.sc-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.sc-title { font-size:19px; font-weight:800; color:#1e1b4b; letter-spacing:-.01em; }
.sc-sub { font-size:13px; color:#6B7280; margin-top:3px; max-width:640px; line-height:1.45; }
.sc-close-btn { flex-shrink:0; border:none; background:#F3F4F6; color:#6B7280; font-size:13px; font-weight:600; padding:7px 12px; border-radius:10px; cursor:pointer; transition:all .15s; }
.sc-close-btn:hover { background:#FEE2E2; color:#DC2626; }
.sc-nav-row { margin-bottom:10px; }
.sc-nav-row:empty { display:none; margin:0; }
.sc-back-btn { border:1px solid #E5E7EB; background:#fff; color:#4F46E5; font-size:13px; font-weight:600; padding:7px 14px; border-radius:10px; cursor:pointer; transition:all .15s; }
.sc-back-btn:hover { background:#EEF2FF; border-color:#C7CCFF; transform:translateX(-2px); }
.sc-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(185px,1fr)); gap:12px; }
.sc-grid-btn { display:flex; align-items:center; gap:12px; padding:16px 18px; border-radius:16px; border:1.5px solid #E9E8FB; background:#fff;
  font-family:inherit; font-size:15px; font-weight:600; color:#312e81; cursor:pointer; text-align:left; transition:all .18s ease; box-shadow:0 1px 2px rgba(16,24,40,.04); position:relative; }
.sc-grid-btn:hover { border-color:#7C3AED; background:linear-gradient(135deg,#F5F3FF 0%,#EEF2FF 100%); transform:translateY(-2px); box-shadow:0 8px 20px rgba(124,58,237,.14); }
.sc-btn-emoji { font-size:22px; flex-shrink:0; width:44px; height:44px; display:flex; align-items:center; justify-content:center; border-radius:12px; background:linear-gradient(135deg,#EEF2FF,#F5F3FF); }
.sc-btn-suggested { border-color:#A5B4FC; box-shadow:0 0 0 3px rgba(129,140,248,.16); }
.sc-btn-suggested::after { content:"✓ yours"; position:absolute; top:8px; right:10px; font-size:10px; font-weight:700; color:#4F46E5; background:#EEF2FF; padding:2px 7px; border-radius:20px; letter-spacing:.02em; }
.sc-chapter-list { display:flex; flex-direction:column; gap:8px; }
.sc-chapter-btn { display:flex; align-items:center; gap:14px; padding:13px 16px; border-radius:13px; border:1.5px solid #EDECFB; background:#fff; font-family:inherit; cursor:pointer; text-align:left; transition:all .16s ease; width:100%; }
.sc-chapter-btn:hover { border-color:#7C3AED; background:#FAFAFF; transform:translateX(3px); box-shadow:0 4px 14px rgba(124,58,237,.10); }
.sc-ch-no { flex-shrink:0; width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#4F46E5,#7C3AED); color:#fff; font-size:14px; font-weight:700; }
.sc-ch-title { font-size:14.5px; font-weight:600; color:#1e1b4b; line-height:1.35; }
.sc-loading, .sc-error { padding:26px 20px; text-align:center; color:#6B7280; font-size:14px; background:#F9FAFB; border-radius:14px; border:1px dashed #E5E7EB; }
.sc-error { color:#B45309; background:#FFFBEB; border-color:#FDE68A; }
@media (max-width:560px){ .sc-grid{ grid-template-columns:1fr 1fr; gap:9px; } .sc-grid-btn{ padding:13px; font-size:13.5px; gap:9px; } .sc-btn-emoji{ width:38px; height:38px; font-size:19px; } .sc-title{ font-size:17px; } }
body.theme-dark .sc-title { color:#e9e7ff; }
body.theme-dark .sc-sub { color:#9aa4c4; }
body.theme-dark .sc-close-btn { background:#232748; color:#c0c7e0; }
body.theme-dark .sc-close-btn:hover { background:#4c1d24; color:#fca5a5; }
body.theme-dark .sc-back-btn { background:#1e2242; border-color:#343a63; color:#c7d2fe; }
body.theme-dark .sc-back-btn:hover { background:#262c55; }
body.theme-dark .sc-grid-btn { background:#1a1d3a; border-color:#2e3460; color:#dbe2f7; }
body.theme-dark .sc-grid-btn:hover { border-color:#8b5cf6; background:#232a52; box-shadow:0 8px 22px rgba(0,0,0,.4); }
body.theme-dark .sc-btn-emoji { background:#2a2f57; }
body.theme-dark .sc-btn-suggested { border-color:#6366f1; }
body.theme-dark .sc-btn-suggested::after { background:#2e3360; color:#c7d2fe; }
body.theme-dark .sc-chapter-btn { background:#1a1d3a; border-color:#2a2f52; }
body.theme-dark .sc-chapter-btn:hover { border-color:#8b5cf6; background:#20244a; }
body.theme-dark .sc-ch-title { color:#e2e6f7; }
body.theme-dark .sc-loading { background:#181b34; border-color:#2a2f52; color:#9aa4c4; }
body.theme-dark .sc-error { background:#2a2213; border-color:#5c4a1e; color:#fcd34d; }
/* ==== end ABHAYA UI polish ==== */


/* ==== ABHAYA UI polish (Session 41) ==== */
/* (A) Quick-Access sidebar: card background + border, livelier items.
   The .sb-nav-muted rules outrank the Session-40 .sb-nav-item styles, so target them directly. */
.sb-nav-muted {
  background: linear-gradient(180deg,#FAFAFF 0%,#F3F4FD 100%);
  border: 1px solid #E9EAF7; border-radius: 14px;
  padding: 6px; margin-top: 4px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.sb-nav-muted .sb-nav-item {
  font-size: 12.5px; font-weight: 600; color: #4B5563;
  padding: 8px 9px; border: 1px solid transparent; border-radius: 10px;
}
.sb-nav-muted .sb-nav-item:hover {
  color: #4F46E5; background: #FFFFFF; border-color: #E3E6FB;
  box-shadow: 0 2px 8px rgba(79,70,229,.10); transform: translateX(2px);
}
.sb-nav-muted .sb-nav-item.active {
  color: #4338CA; background: #FFFFFF; border-color: #DDE1FF; font-weight: 700;
  box-shadow: inset 3px 0 0 #4F46E5, 0 2px 8px rgba(79,70,229,.10);
}
body.theme-dark .sb-nav-muted {
  background: linear-gradient(180deg,#181b34 0%,#141730 100%); border-color: #282d52; box-shadow: none;
}
body.theme-dark .sb-nav-muted .sb-nav-item { color: #c3cae0; }
body.theme-dark .sb-nav-muted .sb-nav-item:hover { background: #20243f; color: #e7ecff; border-color: #323868; }
body.theme-dark .sb-nav-muted .sb-nav-item.active { background: #252a4d; color: #e7ecff; border-color: #3a3f66; }

/* (B) "Change" (reset intent) button — was a pale ghost; make it a clear filled pill */
.hw-step2-change {
  border: 1.5px solid transparent;
  background: #4F46E5; color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,.30);
}
.hw-step2-change:hover {
  border-color: transparent; background: #4338CA; color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,.42); transform: translateY(-1px);
}
body.theme-dark .hw-step2-change { background: #6366f1; color: #fff; border-color: transparent; }
body.theme-dark .hw-step2-change:hover { background: #7c74f5; }
/* ==== end Session 41 ==== */
