/* ═══════════════════════════════════════════════════════════════════
   NEXORA PREMIUM UI v3.0 — Bottom Nav · Mode Pills · Glass Back Btn
   Design & Developed by Bikash Talukder
   ═══════════════════════════════════════════════════════════════════ */

/* ── Windows/Android saturation boost removed — was causing GPU compositing ── */
:root { color-scheme: dark; }
@media (color-gamut: p3) { :root { filter: none; } }

/* ── P3 wide-gamut accent ── */
@supports (color: color(display-p3 0 0 1)) {
  :root {
    --primary:    color(display-p3 0.42 0.28 1.0);
    --accent:     color(display-p3 0.0  0.82 1.0);
    --accent-pink:color(display-p3 1.0  0.22 0.78);
  }
}

/* ══════════════════════════════════════════════════════════════════
   SPLASH / INTRO SCREEN
   ══════════════════════════════════════════════════════════════════ */
#splashScreen {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,92,255,0.28) 0%, transparent 60%),
              radial-gradient(ellipse 60% 50% at 80% 90%, rgba(139,92,246,0.15) 0%, transparent 60%),
              #0a0814;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(16px,3vh,28px) clamp(20px,5vw,32px) clamp(16px,3vh,24px);
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  animation: splash-enter 0.6s cubic-bezier(0.34,1.3,0.64,1) both;
}
#splashScreen::-webkit-scrollbar { display: none; }
@keyframes splash-enter {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splash-exit {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.96) translateY(-20px); }
}

/* ── Dynamic intro orb ── */
.splash-orb-wrap {
  position: relative;
  width: clamp(160px,42vw,220px);
  height: clamp(160px,42vw,220px);
  margin: clamp(8px,2vh,20px) auto clamp(12px,2.5vh,24px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ambient glow rings */
.splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(124,92,255,0.18);
  pointer-events: none;
  animation: splash-ring-pulse 3s ease-in-out infinite;
}
.splash-ring-1 {
  inset: -18%;
  animation-delay: 0s;
  border-color: rgba(124,92,255,0.22);
}
.splash-ring-2 {
  inset: -36%;
  animation-delay: 0.6s;
  border-color: rgba(124,92,255,0.12);
}
.splash-ring-3 {
  inset: -54%;
  animation-delay: 1.2s;
  border-color: rgba(124,92,255,0.07);
}
@keyframes splash-ring-pulse {
  0%,100% { opacity: 0.5; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.03); }
}

/* Floating particles */
.splash-particle {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(167,139,250,0.7);
  pointer-events: none;
  animation: splash-float 4s ease-in-out infinite;
}
.sp1 { top: 12%; left: 18%; animation-delay: 0s;    width: 4px; height: 4px; }
.sp2 { top: 20%; right: 14%; animation-delay: 1s;   width: 3px; height: 3px; background: rgba(0,224,255,0.6); }
.sp3 { bottom: 18%; left: 22%; animation-delay: 1.8s; width: 3px; height: 3px; }
.sp4 { bottom: 12%; right: 20%; animation-delay: 0.5s; width: 5px; height: 5px; background: rgba(167,139,250,0.5); }
@keyframes splash-float {
  0%,100% { transform: translateY(0) scale(1);   opacity: 0.7; }
  50%     { transform: translateY(-8px) scale(1.2); opacity: 1; }
}

/* Main orb */
.splash-orb {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    #c4b5fd 0%,
    #8b5cf6 25%,
    #6d28d9 50%,
    #3b0764 78%,
    #1a0533 100%);
  box-shadow:
    0 0 0 1px rgba(139,92,246,0.3),
    0 0 60px rgba(124,92,255,0.65),
    0 0 120px rgba(124,92,255,0.25),
    inset 0 -30px 60px rgba(0,0,0,0.5);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splash-orb-breathe 4s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s;
}
.splash-orb:hover  { transform: scale(1.04); }
.splash-orb:active { transform: scale(0.97); }
@keyframes splash-orb-breathe {
  0%,100% { box-shadow: 0 0 60px rgba(124,92,255,0.65), 0 0 120px rgba(124,92,255,0.25), inset 0 -30px 60px rgba(0,0,0,0.5); }
  50%     { box-shadow: 0 0 90px rgba(124,92,255,0.85), 0 0 160px rgba(124,92,255,0.35), inset 0 -30px 60px rgba(0,0,0,0.5); }
}

/* Glass shine */
.splash-orb-shine {
  position: absolute;
  top: 10%; left: 18%;
  width: 32%; height: 20%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.35) 0%, transparent 70%);
  border-radius: 50%;
  transform: rotate(-25deg);
  pointer-events: none;
}

/* Inner depth layer */
.splash-orb-inner {
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(196,181,253,0.15) 0%, transparent 60%);
  pointer-events: none;
}

/* 4-point star */
.splash-orb-star {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.6));
  animation: splash-star-spin 12s linear infinite;
}
@keyframes splash-star-spin {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  to   { transform: rotate(360deg) scale(1); }
}

/* ── Branding ── */
.splash-brand {
  text-align: center;
  margin-bottom: clamp(12px,2.5vh,20px);
  animation: splash-fade-up 0.7s ease 0.2s both;
}
@keyframes splash-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(32px,8vw,44px);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.splash-tagline {
  font-family: 'Sora', sans-serif;
  font-size: clamp(10px,2.5vw,12px);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(167,139,250,0.8);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.splash-desc {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(12px,3vw,14px);
  color: rgba(160,168,192,0.85);
  line-height: 1.6;
}

/* ── Feature list ── */
.splash-features {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: clamp(14px,2.5vh,22px);
  animation: splash-fade-up 0.7s ease 0.35s both;
}
.splash-feat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: rgba(15,17,35,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.splash-feat:hover {
  border-color: rgba(124,92,255,0.25);
  background: rgba(124,92,255,0.08);
  transform: translateX(2px);
}
.splash-feat-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.splash-feat-text { flex: 1; }
.splash-feat-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.splash-feat-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: rgba(160,168,192,0.7);
}
.splash-feat-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: #a78bfa;
  flex-shrink: 0;
}

/* ── CTA buttons ── */
.splash-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: clamp(10px,2vh,16px);
  animation: splash-fade-up 0.7s ease 0.5s both;
}
.splash-cta-primary {
  width: 100%;
  padding: 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #7c5cff 0%, #a78bfa 100%);
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(124,92,255,0.5), 0 0 0 1px rgba(255,255,255,0.08);
  transition: transform 0.15s cubic-bezier(0.34,1.3,0.64,1), box-shadow 0.2s;
}
.splash-cta-primary:hover {
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 12px 40px rgba(124,92,255,0.65);
}
.splash-cta-primary:active { transform: scale(0.97); }

.splash-cta-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.6);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.splash-cta-secondary:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
}
.splash-cta-secondary:active { transform: scale(0.97); }

/* ── CEO credit ── */
.splash-credit {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  text-align: center;
  letter-spacing: 0.02em;
  animation: splash-fade-up 0.7s ease 0.65s both;
}
.splash-ceo {
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

/* Light mode splash */
.light-mode #splashScreen {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,92,255,0.1) 0%, transparent 60%), #f4f4fb;
}
.light-mode .splash-feat {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.07);
}
.light-mode .splash-feat-title { color: #0f172a; }
.light-mode .splash-feat-sub   { color: #64748b; }
.light-mode .splash-desc       { color: #475569; }
.light-mode .splash-tagline    { color: rgba(124,92,255,0.7); }
.light-mode .splash-title      { color: #0f172a; }
.light-mode .splash-credit     { color: rgba(0,0,0,0.3); }
.light-mode .splash-cta-secondary {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.5);
}

/* ══════════════════════════════════════════════════════════════════
   LANDING PAGE OVERRIDES
   ══════════════════════════════════════════════════════════════════ */

#phone:has(#splashScreen.active) {
  width: min(1180px, 96vw);
  height: min(960px, 96dvh);
}
#phone:has(#splashScreen.active) #statusbar,
#phone:has(#splashScreen.active) #header,
#phone:has(#splashScreen.active) #modeToggle,
#phone:has(#splashScreen.active) #searchOverlay,
#phone:has(#splashScreen.active) #copyToast,
#phone:has(#splashScreen.active) #apiPanel {
  display: none !important;
}

#splashScreen {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at top left, rgba(34,211,238,0.2), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(251,191,36,0.18), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(244,63,94,0.14), transparent 34%),
    linear-gradient(180deg, #07111f 0%, #081726 44%, #07131d 100%);
  padding: 0;
}
#splashScreen.active {
  display: block !important;
}
#splashScreen::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.landing-shell {
  position: relative;
  min-height: 100%;
  padding: 28px clamp(18px, 3vw, 32px) 40px;
  color: #eff6ff;
}
.landing-shell::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 32px;
  border: 1px solid rgba(148,163,184,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  pointer-events: none;
}
.landing-shell > * {
  position: relative;
  z-index: 1;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #f8fafc;
}
.landing-brand-logo,
.landing-brand-fallback {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  flex-shrink: 0;
}
.landing-brand-logo {
  object-fit: cover;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(255,255,255,0.08);
}
.landing-brand-fallback {
  place-items: center;
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #22d3ee, #f59e0b);
  color: #06131f;
}
.landing-brand strong {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.landing-brand small {
  display: block;
  margin-top: 2px;
  color: rgba(226,232,240,0.72);
  font-size: 12px;
}
.landing-nav-links,
.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.landing-nav-links a,
.landing-link-btn,
.landing-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(7,18,33,0.5);
  color: rgba(226,232,240,0.84);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.landing-nav-links a:hover,
.landing-link-btn:hover,
.landing-secondary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34,211,238,0.35);
  background: rgba(14,116,144,0.16);
}
.landing-primary-btn {
  min-height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #07111f;
  background: linear-gradient(135deg, #f8fafc 0%, #67e8f9 48%, #fbbf24 100%);
  box-shadow: 0 18px 40px rgba(34,211,238,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.landing-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 48px rgba(34,211,238,0.26);
}
.landing-primary-btn-large {
  min-height: 52px;
  padding: 0 22px;
  font-size: 14px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: clamp(24px, 4vw, 42px);
  align-items: center;
  padding: 28px 0 24px;
}
.landing-kicker,
.landing-section-kicker,
.landing-story-kicker,
.landing-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(103,232,249,0.16);
  background: rgba(8,26,40,0.76);
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.landing-title {
  margin: 18px 0 14px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  color: #f8fafc;
}
.landing-subtitle {
  max-width: 720px;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.72;
  color: rgba(226,232,240,0.78);
}
.landing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.landing-proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.landing-proof-card,
.landing-story-card,
.landing-feature-card,
.landing-step-card,
.landing-audience-card,
.landing-visual-card {
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(7,18,33,0.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.landing-proof-card {
  padding: 18px;
}
.landing-proof-card strong {
  display: block;
  margin-bottom: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  color: #f8fafc;
}
.landing-proof-card span {
  color: rgba(226,232,240,0.72);
  font-size: 13px;
  line-height: 1.6;
}

.landing-hero-visual {
  position: relative;
  min-height: 560px;
}
.landing-orb-panel {
  position: absolute;
  top: 22px;
  right: 20px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef3c7 0%, #22d3ee 34%, #0f172a 75%);
  box-shadow: 0 0 70px rgba(34,211,238,0.18);
  overflow: hidden;
}
.landing-orb-glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  border: 1px solid rgba(125,211,252,0.22);
  animation: landing-ring-float 7s linear infinite;
}
.landing-orb-core {
  position: absolute;
  inset: 30%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(7,18,33,0.7);
  color: #f8fafc;
  font-family: 'Sora', sans-serif;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.06em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.landing-orb-tag {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(7,18,33,0.78);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
@keyframes landing-ring-float {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  to { transform: rotate(360deg) scale(1); }
}
.landing-visual-card {
  position: absolute;
  padding: 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.landing-visual-card-main {
  left: 0;
  top: 110px;
  width: min(100%, 410px);
}
.landing-visual-card-main h3 {
  margin: 14px 0 10px;
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.landing-visual-card-main p,
.landing-visual-card-side p,
.landing-story-card p,
.landing-feature-card p,
.landing-step-card p,
.landing-audience-card p,
.landing-cta-panel p {
  color: rgba(226,232,240,0.74);
  line-height: 1.68;
  font-size: 14px;
}
.landing-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.landing-mini-list span {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15,23,42,0.76);
  color: #e2e8f0;
  font-size: 12px;
  border: 1px solid rgba(148,163,184,0.16);
}
.landing-visual-card-side {
  right: 0;
  bottom: 22px;
  width: min(100%, 345px);
}
.landing-signal {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(148,163,184,0.12);
  font-size: 13px;
  color: rgba(241,245,249,0.88);
}
.landing-signal:last-child {
  border-bottom: none;
}
.landing-signal b {
  color: #fbbf24;
}

.landing-logo-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0 8px;
}
.landing-logo-rail span {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(15,23,42,0.68);
  border: 1px solid rgba(148,163,184,0.14);
  color: rgba(226,232,240,0.74);
  font-size: 12px;
  font-weight: 600;
}

.landing-founder-section {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 22px;
  align-items: start;
  margin-top: 28px;
}
.landing-founder-media,
.landing-founder-copy {
  border-radius: 28px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(7,18,33,0.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.landing-founder-media {
  padding: 18px;
  position: sticky;
  top: 82px;
}
.landing-founder-photo-frame {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  min-height: 460px;
  background:
    linear-gradient(180deg, rgba(12,27,42,0.25), rgba(12,27,42,0.65)),
    radial-gradient(circle at top, rgba(251,191,36,0.18), transparent 35%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.landing-founder-photo {
  width: 100%;
  height: 100%;
  min-height: 460px;
  object-fit: cover;
  display: block;
}
.landing-founder-photo-fallback {
  position: absolute;
  inset: 0;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: rgba(241,245,249,0.86);
  background:
    linear-gradient(180deg, rgba(8,26,40,0.15), rgba(8,26,40,0.74)),
    radial-gradient(circle at 50% 20%, rgba(34,211,238,0.22), transparent 35%);
}
.landing-founder-photo-fallback span {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #67e8f9, #fbbf24);
  color: #07111f;
}
.landing-founder-photo-fallback small {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.landing-founder-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 6px 4px;
}
.landing-founder-caption strong {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  color: #f8fafc;
}
.landing-founder-caption span {
  color: rgba(226,232,240,0.68);
  font-size: 13px;
}
.landing-founder-copy {
  padding: 28px;
}
.landing-founder-copy h2 {
  margin: 16px 0 14px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(34px, 4.8vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: #f8fafc;
}
.landing-founder-copy p {
  margin: 0 0 16px;
  color: rgba(226,232,240,0.78);
  line-height: 1.82;
  font-size: 15px;
}
.landing-founder-quote {
  margin: 8px 0 0;
  padding: 18px 20px;
  border-left: 3px solid #fbbf24;
  border-radius: 18px;
  background: rgba(15,23,42,0.72);
  color: #f8fafc;
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  line-height: 1.55;
}

.landing-story-grid,
.landing-feature-grid,
.landing-steps,
.landing-audience-grid {
  display: grid;
  gap: 16px;
}
.landing-story-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}
.landing-story-card-wide {
  grid-column: span 1;
}
.landing-story-card,
.landing-step-card,
.landing-audience-card {
  padding: 26px;
}
.landing-story-card h2,
.landing-section-head h2,
.landing-cta-panel h2 {
  margin: 14px 0 12px;
  font-family: 'Sora', sans-serif;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #f8fafc;
}
.landing-section {
  margin-top: 48px;
}
.landing-section-head {
  max-width: 760px;
}
.landing-section-head p {
  color: rgba(226,232,240,0.68);
  line-height: 1.68;
  font-size: 15px;
}
.landing-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}
.landing-feature-card {
  padding: 22px;
}
.landing-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  font-size: 24px;
  background: rgba(255,255,255,0.08);
}
.landing-feature-card h3,
.landing-step-card h3,
.landing-audience-card strong {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: #f8fafc;
}
.landing-feature-card h3,
.landing-step-card h3 {
  margin-bottom: 10px;
}
.landing-feature-card-cyan .landing-feature-icon { background: rgba(34,211,238,0.16); }
.landing-feature-card-amber .landing-feature-icon { background: rgba(245,158,11,0.16); }
.landing-feature-card-lime .landing-feature-icon { background: rgba(132,204,22,0.16); }
.landing-feature-card-coral .landing-feature-icon { background: rgba(251,113,133,0.16); }
.landing-feature-card-indigo .landing-feature-icon { background: rgba(99,102,241,0.16); }
.landing-feature-card-slate .landing-feature-icon { background: rgba(148,163,184,0.16); }
.landing-feature-card-teal .landing-feature-icon { background: rgba(45,212,191,0.16); }
.landing-feature-card-rose .landing-feature-icon { background: rgba(244,63,94,0.16); }
.landing-feature-card-blue .landing-feature-icon { background: rgba(96,165,250,0.16); }
.landing-feature-card-gold .landing-feature-icon { background: rgba(250,204,21,0.16); }
.landing-feature-card-mint .landing-feature-icon { background: rgba(52,211,153,0.16); }
.landing-feature-card-graphite .landing-feature-icon { background: rgba(71,85,105,0.22); }

.landing-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}
.landing-step-number {
  display: inline-block;
  margin-bottom: 16px;
  color: #fbbf24;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
}

.landing-audience-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 24px;
}
.landing-audience-card strong {
  display: block;
  margin-bottom: 10px;
}

.landing-cta-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 52px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(125,211,252,0.18);
  background:
    radial-gradient(circle at 0% 0%, rgba(34,211,238,0.16), transparent 30%),
    radial-gradient(circle at 100% 100%, rgba(251,191,36,0.14), transparent 30%),
    rgba(7,18,33,0.72);
}
.landing-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.landing-credit {
  margin: 24px 0 0;
  text-align: center;
  color: rgba(226,232,240,0.46);
  font-size: 12px;
}
.landing-credit span {
  color: #f8fafc;
}

.light-mode #splashScreen {
  background:
    radial-gradient(circle at top left, rgba(34,211,238,0.08), transparent 32%),
    radial-gradient(circle at 85% 15%, rgba(245,158,11,0.08), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #eff5fb 100%);
}
.light-mode .landing-shell {
  color: #0f172a;
}
.light-mode .landing-shell::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.56));
  border-color: rgba(148,163,184,0.18);
}
.light-mode .landing-brand,
.light-mode .landing-title,
.light-mode .landing-founder-copy h2,
.light-mode .landing-founder-caption strong,
.light-mode .landing-story-card h2,
.light-mode .landing-section-head h2,
.light-mode .landing-feature-card h3,
.light-mode .landing-step-card h3,
.light-mode .landing-audience-card strong,
.light-mode .landing-cta-panel h2 {
  color: #0f172a;
}
.light-mode .landing-brand small,
.light-mode .landing-subtitle,
.light-mode .landing-founder-copy p,
.light-mode .landing-founder-caption span,
.light-mode .landing-proof-card span,
.light-mode .landing-story-card p,
.light-mode .landing-feature-card p,
.light-mode .landing-step-card p,
.light-mode .landing-audience-card p,
.light-mode .landing-cta-panel p,
.light-mode .landing-section-head p,
.light-mode .landing-credit {
  color: rgba(15,23,42,0.68);
}
.light-mode .landing-nav-links a,
.light-mode .landing-link-btn,
.light-mode .landing-secondary-btn,
.light-mode .landing-founder-media,
.light-mode .landing-founder-copy,
.light-mode .landing-proof-card,
.light-mode .landing-story-card,
.light-mode .landing-feature-card,
.light-mode .landing-step-card,
.light-mode .landing-audience-card,
.light-mode .landing-visual-card,
.light-mode .landing-logo-rail span,
.light-mode .landing-kicker,
.light-mode .landing-section-kicker,
.light-mode .landing-story-kicker,
.light-mode .landing-card-eyebrow {
  background: rgba(255,255,255,0.74);
  border-color: rgba(148,163,184,0.18);
  color: #0f172a;
}
.light-mode .landing-logo-rail span,
.light-mode .landing-mini-list span,
.light-mode .landing-signal {
  color: rgba(15,23,42,0.82);
}
.light-mode .landing-founder-quote {
  background: rgba(241,245,249,0.95);
  color: #0f172a;
  border-left-color: #f59e0b;
}
.light-mode .landing-mini-list span {
  background: rgba(241,245,249,0.9);
  border-color: rgba(148,163,184,0.18);
}
.light-mode .landing-primary-btn {
  color: #06131f;
}

@media (max-width: 1100px) {
  .landing-hero,
  .landing-founder-section,
  .landing-story-grid,
  .landing-feature-grid,
  .landing-steps,
  .landing-audience-grid,
  .landing-cta-panel {
    grid-template-columns: 1fr;
  }
  .landing-hero {
    gap: 26px;
  }
  .landing-founder-media {
    position: relative;
    top: auto;
  }
  .landing-proof-grid {
    grid-template-columns: 1fr;
  }
  .landing-hero-visual {
    min-height: 540px;
  }
}

@media (max-width: 820px) {
  #phone:has(#splashScreen.active) {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .landing-shell {
    padding: 18px 16px 28px;
  }
  .landing-shell::before {
    inset: 8px;
    border-radius: 24px;
  }
  .landing-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .landing-nav-links,
  .landing-nav-actions {
    flex-wrap: wrap;
  }
  .landing-hero-visual {
    min-height: 500px;
  }
  .landing-orb-panel {
    position: relative;
    top: 0;
    right: 0;
    margin-left: auto;
    width: 180px;
    height: 180px;
  }
  .landing-visual-card-main,
  .landing-visual-card-side {
    position: relative;
    width: 100%;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    margin-top: 14px;
  }
  .landing-cta-panel {
    display: block;
  }
  .landing-cta-actions {
    margin-top: 18px;
  }
}

@media (max-width: 560px) {
  .landing-nav-links {
    display: none;
  }
  .landing-title {
    font-size: clamp(34px, 12vw, 52px);
  }
  .landing-story-card,
  .landing-feature-card,
  .landing-step-card,
  .landing-audience-card,
  .landing-founder-copy,
  .landing-cta-panel {
    padding: 20px;
  }
  .landing-founder-photo-frame,
  .landing-founder-photo {
    min-height: 360px;
  }
}


/* ══════════════════════════════════════════════════════════════════
   BOTTOM TAB NAV — removed from HTML, CSS kept minimal for safety
   ══════════════════════════════════════════════════════════════════ */
.bottom-nav { display: none !important; }
.home-indicator { display: none !important; }

/* ══════════════════════════════════════════════════════════════════
   GLOBAL FONT SIZE BOOST — everything bigger and more readable
   ══════════════════════════════════════════════════════════════════ */

/* Base body — bump up from browser default */
body { font-size: 15px !important; }

/* ── Status bar ── */
#statusbar { font-size: 13px !important; }

/* ── Header ── */
.header-text h2 { font-size: clamp(17px, 4vw, 20px) !important; }
.header-text p  { font-size: 13px !important; }
.ai-badge       { font-size: 12px !important; }

/* ── Mode pills ── */
.mode-pill { font-size: 13px !important; padding: 7px 16px !important; }

/* ── Chat messages ── */
.bubble     { font-size: 15px !important; line-height: 1.6 !important; }
.bot-bub    { font-size: 15px !important; }
.user-bub   { font-size: 15px !important; }
.bubble-time { font-size: 12px !important; }
.date-divider { font-size: 13px !important; }
.typing-bub   { font-size: 15px !important; }

/* ── Input bar ── */
#userInput    { font-size: 15px !important; }
#cmpInput     { font-size: 15px !important; }

/* ── Mood chips ── */
.chip { font-size: 13px !important; }

/* ── Empty state ── */
.ces-title { font-size: 17px !important; }
.ces-sub   { font-size: 14px !important; }

/* ── Voice screen ── */
.voice-topic        { font-size: 13px !important; letter-spacing: 1px !important; }
.voice-state-label  { font-size: 13px !important; }
.voice-prompt       { font-size: clamp(18px, 4.5vw, 22px) !important; }
.voice-greeting     { font-size: 14px !important; }
.vc-btn             { font-size: 14px !important; }

/* ── Study mode ── */
.study-header-title { font-size: 17px !important; }
.study-ai-pill      { font-size: 13px !important; }
.study-close-btn    { font-size: 13px !important; }
.study-input-label  { font-size: 13px !important; }
.study-textarea     { font-size: 15px !important; }
.study-select       { font-size: 14px !important; }
.study-gen-btn      { font-size: 14px !important; }
.smc-icon           { font-size: 22px !important; }
.smc-label          { font-size: 12px !important; }
.study-stat-val     { font-size: clamp(22px, 5vw, 28px) !important; }
.study-stat-label   { font-size: 12px !important; }
.study-source-title { font-size: 13px !important; }
.study-source-sub   { font-size: 14px !important; }

/* ── Flashcard ── */
.fc-card-text   { font-size: clamp(16px, 4vw, 20px) !important; }
.fc-card-label  { font-size: 12px !important; }
.fc-deck-topic-tag { font-size: 13px !important; }
.fc-progress-text  { font-size: 13px !important; }

/* ── Quiz ── */
.quiz-question      { font-size: clamp(15px, 3.5vw, 18px) !important; }
.quiz-option        { font-size: 15px !important; }
.quiz-result-header { font-size: clamp(18px, 4vw, 22px) !important; }

/* ── Compare panel ── */
.cmp-card-body  { font-size: 15px !important; line-height: 1.65 !important; }
.cmp-card-head  { font-size: 14px !important; }
.cmp-q-header   { font-size: 15px !important; }

/* ── Progress dashboard ── */
.dash-stat-val   { font-size: clamp(28px, 6vw, 36px) !important; }
.dash-stat-label { font-size: 13px !important; }
.dash-section-title { font-size: 15px !important; }
.dash-hero-title    { font-size: clamp(18px, 4vw, 22px) !important; }
.dash-hero-sub      { font-size: 14px !important; }
.dash-bar-label     { font-size: 12px !important; }
.dash-header-title  { font-size: 17px !important; }
.dash-header-subtitle { font-size: 14px !important; }

/* ── IELTS ── */
.ielts-section-card .ielts-sc-label { font-size: 14px !important; }
.ielts-section-card .ielts-sc-desc  { font-size: 12px !important; }
.ielts-subtab { font-size: 13px !important; }
.mcq-question-text { font-size: clamp(15px, 3.5vw, 17px) !important; }
.mcq-option-text   { font-size: 14px !important; }
.mcq-option-letter { font-size: 14px !important; }
.viva-question-text { font-size: clamp(16px, 4vw, 19px) !important; }

/* ── Notebook ── */
.nb-rag-answer-area { font-size: 15px !important; line-height: 1.65 !important; }
.nb-source-name     { font-size: 14px !important; }

/* ── Panels & overlays ── */
.mini-title   { font-size: 16px !important; }
.mini-label   { font-size: 13px !important; }
.mini-input   { font-size: 15px !important; }
.mini-primary { font-size: 15px !important; }
.mini-hint    { font-size: 13px !important; }
.api-panel-title { font-size: 16px !important; }
.api-panel-sub   { font-size: 14px !important; }
.api-save-btn    { font-size: 15px !important; }

/* ── Splash screen ── */
.splash-feat-title { font-size: 15px !important; }
.splash-feat-sub   { font-size: 13px !important; }
.splash-cta-primary   { font-size: 16px !important; }
.splash-cta-secondary { font-size: 15px !important; }
.splash-credit { font-size: 13px !important; }
.splash-tagline { font-size: clamp(12px, 3vw, 14px) !important; }
.splash-desc    { font-size: clamp(14px, 3.5vw, 16px) !important; }

/* ── Welcome / name screen ── */
.welcome-title  { font-size: clamp(24px, 6vw, 30px) !important; }
.welcome-sub    { font-size: clamp(14px, 3.5vw, 16px) !important; }
.welcome-byline { font-size: clamp(12px, 3vw, 13px) !important; }
#nameInput      { font-size: 16px !important; }
.start-btn      { font-size: 16px !important; }

/* ── Menu / mode toggle ── */
.mode-item        { font-size: 15px !important; }
.menu-section-label { font-size: 12px !important; }

/* ── Toasts & badges ── */
#copyToast { font-size: 14px !important; }
.srs-due-badge { font-size: 11px !important; }

/* ── Code blocks ── */
pre, code, .hljs { font-size: 13px !important; }

/* ── Fluid scaling on large screens ── */
@media (min-width: 900px) {
  body { font-size: 16px !important; }
  .bubble, .bot-bub, .user-bub { font-size: 16px !important; }
  .mode-pill { font-size: 14px !important; }
  .study-header-title { font-size: 19px !important; }
  .voice-prompt { font-size: clamp(20px, 3vw, 26px) !important; }
}

/* ── Small phones — don't go below readable ── */
@media (max-width: 360px) {
  body { font-size: 14px !important; }
  .bubble, .bot-bub, .user-bub { font-size: 14px !important; }
  .mode-pill { font-size: 12px !important; padding: 6px 12px !important; }
}

/* ══════════════════════════════════════════════════════════════════
   STUDY MODE — FEATURE CARDS
   ══════════════════════════════════════════════════════════════════ */

/* The dash-panel is a bottom sheet — make it full height */
.dash-panel {
  max-height: 92% !important;
  border-radius: 28px 28px 0 0 !important;
}
.dash-body {
  padding: 0 16px 32px !important;
  gap: 14px !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Header */
.pdash-header {
  padding: 20px 4px 4px;
}
.pdash-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 4px;
}
.pdash-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: rgba(160,168,192,0.7);
}

/* Scholar Rank XP card */
.pdash-xp-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(124,92,255,0.12);
  border: 1px solid rgba(124,92,255,0.25);
  border-radius: 20px;
  padding: 16px 18px;
}
.pdash-xp-level {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(124,92,255,0.25);
  border: 2px solid rgba(124,92,255,0.5);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pdash-xp-lvl-num {
  font-family: 'Sora', sans-serif;
  font-size: 20px; font-weight: 800;
  color: #a78bfa; line-height: 1;
}
.pdash-xp-lvl-label {
  font-size: 9px; font-weight: 700;
  color: rgba(167,139,250,0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pdash-xp-info { flex: 1; }
.pdash-xp-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #fff; margin-bottom: 2px;
}
.pdash-xp-sub {
  font-size: 12px; color: rgba(160,168,192,0.7);
  margin-bottom: 8px;
}
.pdash-xp-bar-wrap {
  height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden; margin-bottom: 4px;
}
.pdash-xp-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #7c5cff, #f59e0b);
  transition: width 0.8s cubic-bezier(0.34,1.3,0.64,1);
}
.pdash-xp-pct {
  font-size: 11px; font-weight: 700;
  color: #f59e0b; text-align: right;
}

/* 2×2 stat grid */
.pdash-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pdash-stat-card {
  background: rgba(15,17,35,0.8);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 18px;
  padding: 16px 16px 14px;
  display: flex; flex-direction: column;
  gap: 4px;
  transition: transform 0.15s;
}
.pdash-stat-card:active { transform: scale(0.97); }
.pdash-stat-val {
  font-family: 'Sora', sans-serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.pdash-stat-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: rgba(160,168,192,0.7);
  margin-top: 2px;
}
.pdash-stat-delta {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.pdash-delta-up { color: #10b981; }

/* Section wrapper */
.pdash-section {
  background: rgba(15,17,35,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 16px 16px 14px;
}
.pdash-section-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

/* Activity bar chart */
.pdash-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
}
.pdash-bar-col {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  height: 100%;
}
.pdash-bar-wrap {
  flex: 1; width: 100%;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: flex-end;
}
.pdash-bar-fill {
  width: 100%;
  background: rgba(124,92,255,0.5);
  border-radius: 8px;
  transition: height 0.6s cubic-bezier(0.34,1.3,0.64,1);
  min-height: 4px;
}
.pdash-bar-fill.today {
  background: #7c5cff;
  box-shadow: 0 0 12px rgba(124,92,255,0.5);
}
.pdash-bar-label {
  font-size: 11px; font-weight: 600;
  color: rgba(160,168,192,0.5);
  text-transform: uppercase;
}
.pdash-bar-label.today { color: #7c5cff; }

/* Top subjects */
.pdash-subjects { display: flex; flex-direction: column; gap: 12px; }
.pdash-subject-row {
  display: flex; align-items: center; gap: 10px;
}
.pdash-subject-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; color: rgba(160,168,192,0.85);
  width: 80px; flex-shrink: 0;
}
.pdash-subject-track {
  flex: 1; height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px; overflow: hidden;
}
.pdash-subject-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.34,1.3,0.64,1);
}
.pdash-subject-pct {
  font-family: 'Sora', sans-serif;
  font-size: 13px; font-weight: 700;
  width: 36px; text-align: right; flex-shrink: 0;
}

/* Light mode */
.light-mode .pdash-xp-card { background: rgba(124,92,255,0.06); border-color: rgba(124,92,255,0.2); }
.light-mode .pdash-stat-card { background: #fff; border-color: #e5e7eb; }
.light-mode .pdash-section { background: #fff; border-color: #e5e7eb; }
.light-mode .pdash-title { color: #0f172a; }
.light-mode .pdash-subtitle { color: #64748b; }
.light-mode .pdash-section-title { color: #0f172a; }
.light-mode .pdash-stat-name { color: #64748b; }
.light-mode .pdash-subject-name { color: #475569; }
.light-mode .pdash-bar-wrap { background: rgba(0,0,0,0.06); }
.light-mode .pdash-subject-track { background: rgba(0,0,0,0.06); } (replaces small icon grid visually)
   JS still uses .study-mode-card / .study-tab — we just restyle them
   ══════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════
   STUDY MODE GRID — Deep Purple/Rose Glassmorphism Redesign
   Fonts: Inter (body) + Playfair Display (headings)
   ══════════════════════════════════════════════════════════════════ */

/* ── Ambient background orbs removed — were causing GPU filter repaints ── */
#studyScreen {
  position: relative;
  overflow: hidden;
}

/* ── Study header ── */
.study-header {
  padding: 14px 20px 8px !important;
  flex-shrink: 0 !important;
  position: relative;
  z-index: 2;
}
.study-header-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 14px !important;
}
.study-header-hero {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
}
.study-header-text {
  flex: 1 !important;
  min-width: 0 !important;
}

/* Playfair Display hero title */
.study-hero-title {
  font-family: 'Playfair Display', 'Georgia', serif !important;
  font-size: 30px !important;
  font-weight: 800 !important;
  color: #fff !important;
  letter-spacing: -0.02em !important;
  line-height: 1.1 !important;
  margin: 0 0 4px !important;
}
/* "Mode" word in rose accent */
.study-hero-title span,
.study-hero-title em {
  color: #c084fc !important;
  font-style: normal !important;
}

/* Inter subtitle */
.study-hero-sub {
  font-family: 'Inter', 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: rgba(196,181,253,0.6) !important;
  margin: 0 !important;
  letter-spacing: 0.01em !important;
}

/* Hide hero title/sub when a panel is active — chip takes over navigation */
#studyScreen:has(.study-panel.active) .study-header-hero { display: none !important; }
#studyScreen:has(.study-panel.active) .study-header-top { margin-bottom: 0 !important; }

/* Breadcrumb styling on the chip when a panel is active */
#studyScreen:has(.study-panel.active) .study-mode-chip {
  background: transparent !important;
  border-color: transparent !important;
  padding-left: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  font-family: 'Inter', 'DM Sans', sans-serif !important;
  font-size: 12px !important;
}
#studyScreen:has(.study-panel.active) .study-mode-chip::before {
  content: 'Study Mode  ›  ';
  color: rgba(196,181,253,0.4);
  font-weight: 500;
}
#studyScreen:has(.study-panel.active) .smc-chip-label {
  color: #e9d5ff !important;
  font-weight: 700 !important;
}
#studyScreen:has(.study-panel.active) .study-mode-chip:hover {
  background: rgba(139,92,246,0.1) !important;
  border-color: rgba(139,92,246,0.2) !important;
}

/* Keep old .study-header-title for JS compat */
.study-header-title {
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

/* Streak badge */
.study-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #db2777, #f59e0b);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(245,158,11,0.35), 0 0 0 1px rgba(255,255,255,0.1) inset;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── Collapsible zone sits above orbs ── */
.study-collapsible {
  position: relative;
  z-index: 2;
}

/* ── Grid layout ── */
.study-mode-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  padding: 0 !important;
}

/* Wide cards span both columns */
.study-mode-card.smc-wide {
  grid-column: 1 / -1 !important;
}
/* Half cards — each takes 1 col */
.study-mode-card.smc-half {
  grid-column: span 1 !important;
}
/* Third cards — keep as half in new 2-col layout */
.study-mode-card.smc-third {
  grid-column: span 1 !important;
}

/* ── Base card — glassmorphism ── */
.study-mode-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  min-height: 80px !important;
  padding: 16px 16px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(139,92,246,0.15) !important;
  background: rgba(28,18,52,0.55) !important;
  backdrop-filter: blur(18px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.4) !important;
  cursor: pointer !important;
  text-align: left !important;
  position: relative !important;
  overflow: hidden !important;
  transition: transform 0.2s cubic-bezier(0.34,1.3,0.64,1),
              border-color 0.2s,
              box-shadow 0.2s !important;
  /* Top-edge highlight shine */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 4px 24px rgba(0,0,0,0.35) !important;
}
.study-mode-card:active { transform: scale(0.96) !important; }
.study-mode-card:hover  {
  transform: translateY(-3px) !important;
  border-color: rgba(139,92,246,0.35) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 8px 32px rgba(124,92,255,0.25) !important;
}

/* ── Icon box ── */
.smc-icon {
  font-size: 24px !important;
  width: 50px !important;
  height: 50px !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  background: rgba(139,92,246,0.18) !important;
  border: 1px solid rgba(139,92,246,0.2) !important;
  transition: transform 0.2s !important;
}
.study-mode-card:hover .smc-icon { transform: scale(1.08) rotate(-3deg) !important; }

/* Smaller icon for half/third cards */
.smc-half .smc-icon,
.smc-third .smc-icon {
  width: 44px !important;
  height: 44px !important;
  font-size: 22px !important;
  border-radius: 12px !important;
}

/* ── Body ── */
.smc-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  flex: 1 !important;
  min-width: 0 !important;
}

/* Label — Inter semibold */
.smc-label {
  font-family: 'Inter', 'Sora', sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #ede9fe !important;
  letter-spacing: -0.01em !important;
  line-height: 1.2 !important;
}
.smc-half .smc-label,
.smc-third .smc-label {
  font-size: 14px !important;
}

/* Subtitle — Inter light */
.smc-sub {
  font-family: 'Inter', 'DM Sans', sans-serif !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  color: rgba(196,181,253,0.55) !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ── Progress bar (Flashcards hero) ── */
.smc-progress-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-top: 8px !important;
}
.smc-progress-track {
  flex: 1 !important;
  height: 5px !important;
  border-radius: 99px !important;
  background: rgba(139,92,246,0.15) !important;
  overflow: hidden !important;
}
.smc-progress-bar {
  height: 5px !important;
  border-radius: 99px !important;
  background: linear-gradient(90deg, #7c5cff, #c084fc) !important;
  box-shadow: 0 0 8px rgba(192,132,252,0.6) !important;
  /* No track hack — use the wrapper above */
  box-shadow: none !important;
  background: linear-gradient(90deg, #7c5cff, #c084fc) !important;
  flex: 1 !important;
  height: 5px !important;
  border-radius: 99px !important;
}
.smc-progress-pct {
  font-family: 'Inter', sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #c084fc !important;
  flex-shrink: 0 !important;
}

/* ── LIVE badge (AI Tutor) ── */
.smc-live-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin-top: 6px !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  background: rgba(16,185,129,0.15) !important;
  border: 1px solid rgba(16,185,129,0.3) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #34d399 !important;
  letter-spacing: 0.08em !important;
  width: fit-content !important;
  animation: live-pulse 2s ease-in-out infinite !important;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* ── Arrow CTA ── */
.study-mode-card::after {
  content: '›' !important;
  font-size: 20px !important;
  color: rgba(196,181,253,0.3) !important;
  font-weight: 300 !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
  transition: color 0.2s, transform 0.2s !important;
}
.smc-half::after,
.smc-third::after { display: none !important; }
.study-mode-card:hover::after {
  color: rgba(196,181,253,0.8) !important;
  transform: translateX(3px) !important;
}

/* Active card */
.study-mode-card.active::after { display: none !important; }
.study-mode-card.active {
  border-color: rgba(124,92,255,0.55) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 0 1px rgba(124,92,255,0.25),
    0 4px 24px rgba(124,92,255,0.25) !important;
  transform: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   PER-CARD ACCENT COLORS
   purple=memory  teal=AI/live  amber=quiz  blue=audio
   ══════════════════════════════════════════════════════════════════ */

/* Flashcards — hero purple, full-width */
#stab-flashcard {
  background: linear-gradient(135deg,
    rgba(76,29,149,0.65) 0%,
    rgba(109,40,217,0.35) 60%,
    rgba(28,18,52,0.55) 100%) !important;
  border-color: rgba(139,92,246,0.35) !important;
  min-height: 110px !important;
}
#stab-flashcard .smc-icon {
  background: rgba(139,92,246,0.28) !important;
  border-color: rgba(139,92,246,0.35) !important;
  width: 54px !important; height: 54px !important;
  font-size: 28px !important;
  border-radius: 16px !important;
}
#stab-flashcard .smc-label {
  font-family: 'Playfair Display', serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #ddd6fe !important;
}
#stab-flashcard .smc-sub { color: rgba(196,181,253,0.65) !important; }
#stab-flashcard::after { color: #a78bfa !important; }

/* AI Tutor — teal accent, full-width */
#stab-viva {
  background: linear-gradient(135deg,
    rgba(6,78,59,0.65) 0%,
    rgba(4,120,87,0.35) 60%,
    rgba(28,18,52,0.55) 100%) !important;
  border-color: rgba(16,185,129,0.3) !important;
  min-height: 100px !important;
}
#stab-viva .smc-icon {
  background: rgba(16,185,129,0.2) !important;
  border-color: rgba(16,185,129,0.25) !important;
  width: 52px !important; height: 52px !important;
  font-size: 26px !important;
  border-radius: 15px !important;
}
#stab-viva .smc-label {
  font-family: 'Playfair Display', serif !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #a7f3d0 !important;
}
#stab-viva .smc-sub { color: rgba(167,243,208,0.55) !important; }
#stab-viva::after { color: #10b981 !important; }

/* MCQ Quiz — amber */
#stab-quiz {
  background: linear-gradient(135deg,
    rgba(92,45,10,0.7) 0%,
    rgba(120,53,15,0.4) 100%) !important;
  border-color: rgba(217,119,6,0.3) !important;
}
#stab-quiz .smc-icon {
  background: rgba(217,119,6,0.2) !important;
  border-color: rgba(217,119,6,0.25) !important;
}
#stab-quiz .smc-label { color: #fde68a !important; }
#stab-quiz .smc-sub   { color: rgba(253,230,138,0.5) !important; }

/* Listen Mode — blue */
#stab-podcast {
  background: linear-gradient(135deg,
    rgba(12,74,110,0.7) 0%,
    rgba(3,105,161,0.4) 100%) !important;
  border-color: rgba(14,165,233,0.3) !important;
}
#stab-podcast .smc-icon {
  background: rgba(14,165,233,0.2) !important;
  border-color: rgba(14,165,233,0.25) !important;
}
#stab-podcast .smc-label { color: #bae6fd !important; }
#stab-podcast .smc-sub   { color: rgba(186,230,253,0.5) !important; }

/* AI Compare — rose/violet */
#stab-compare-tile {
  background: linear-gradient(135deg,
    rgba(112,26,117,0.65) 0%,
    rgba(157,23,77,0.4) 100%) !important;
  border-color: rgba(232,121,249,0.3) !important;
}
#stab-compare-tile .smc-icon {
  background: rgba(232,121,249,0.2) !important;
  border-color: rgba(232,121,249,0.25) !important;
  font-size: 20px !important;
  color: #f0abfc !important;
}
#stab-compare-tile .smc-label { color: #f0abfc !important; }
#stab-compare-tile .smc-sub   { color: rgba(240,171,252,0.5) !important; }

/* IELTS — teal/cyan */
#stab-ielts {
  background: linear-gradient(135deg,
    rgba(6,78,59,0.65) 0%,
    rgba(15,118,110,0.4) 100%) !important;
  border-color: rgba(20,184,166,0.3) !important;
}
#stab-ielts .smc-icon {
  background: rgba(20,184,166,0.2) !important;
  border-color: rgba(20,184,166,0.25) !important;
}
#stab-ielts .smc-label { color: #99f6e4 !important; }
#stab-ielts .smc-sub   { color: rgba(153,246,228,0.5) !important; }

/* BCS Decks — red/rose */
#stab-mcq {
  background: linear-gradient(135deg,
    rgba(127,29,29,0.7) 0%,
    rgba(153,27,27,0.4) 100%) !important;
  border-color: rgba(239,68,68,0.3) !important;
}
#stab-mcq .smc-icon {
  background: rgba(239,68,68,0.2) !important;
  border-color: rgba(239,68,68,0.25) !important;
}
#stab-mcq .smc-label { color: #fecaca !important; }
#stab-mcq .smc-sub   { color: rgba(254,202,202,0.5) !important; }

/* Summarize — slate */
#stab-summarizer {
  background: linear-gradient(135deg,
    rgba(30,41,59,0.8) 0%,
    rgba(51,65,85,0.5) 100%) !important;
  border-color: rgba(100,116,139,0.3) !important;
}
#stab-summarizer .smc-icon {
  background: rgba(100,116,139,0.2) !important;
  border-color: rgba(100,116,139,0.25) !important;
}
#stab-summarizer .smc-label { color: #e2e8f0 !important; }
#stab-summarizer .smc-sub   { color: rgba(226,232,240,0.5) !important; }

/* Review/SRS — emerald */
#stab-srs {
  background: linear-gradient(135deg,
    rgba(6,78,59,0.7) 0%,
    rgba(4,120,87,0.4) 100%) !important;
  border-color: rgba(16,185,129,0.3) !important;
}
#stab-srs .smc-icon {
  background: rgba(16,185,129,0.2) !important;
  border-color: rgba(16,185,129,0.25) !important;
}
#stab-srs .smc-label { color: #a7f3d0 !important; }
#stab-srs .smc-sub   { color: rgba(167,243,208,0.5) !important; }

/* Notebook — indigo */
#stab-notebook {
  background: linear-gradient(135deg,
    rgba(49,46,129,0.7) 0%,
    rgba(67,56,202,0.4) 100%) !important;
  border-color: rgba(99,102,241,0.3) !important;
}
#stab-notebook .smc-icon {
  background: rgba(99,102,241,0.2) !important;
  border-color: rgba(99,102,241,0.25) !important;
}
#stab-notebook .smc-label { color: #c7d2fe !important; }
#stab-notebook .smc-sub   { color: rgba(199,210,254,0.5) !important; }

/* ══════════════════════════════════════════════════════════════════
   STATS ROW + SOURCE SHELL + LIGHT MODE
   ══════════════════════════════════════════════════════════════════ */

/* Stats row */
.study-stats-row {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 10px !important;
  margin-top: 0 !important;
}
.study-stat-card {
  background: rgba(28,18,52,0.55) !important;
  border: 1px solid rgba(139,92,246,0.15) !important;
  border-radius: 18px !important;
  padding: 14px 12px !important;
  text-align: center !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06) !important;
}
.study-stat-val {
  font-family: 'Playfair Display', serif !important;
  font-size: clamp(22px,5vw,28px) !important;
  font-weight: 800 !important;
  color: #c084fc !important;
  line-height: 1 !important;
  margin-bottom: 4px !important;
}
.study-stat-label {
  font-family: 'Inter', sans-serif !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  color: rgba(196,181,253,0.5) !important;
  text-transform: uppercase !important;
}

/* Source shell — hidden by default */
.study-source-shell {
  display: none !important;
}
.study-source-shell.has-file {
  display: block !important;
}

/* ── Light mode overrides ── */
.light-mode .study-mode-card {
  background: rgba(255,255,255,0.82) !important;
  border-color: rgba(139,92,246,0.15) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 16px rgba(0,0,0,0.08) !important;
}
.light-mode #stab-flashcard  { background: rgba(139,92,246,0.09) !important; }
.light-mode #stab-viva       { background: rgba(16,185,129,0.08) !important; }
.light-mode #stab-quiz       { background: rgba(217,119,6,0.08) !important; }
.light-mode #stab-podcast    { background: rgba(14,165,233,0.08) !important; }
.light-mode #stab-compare-tile { background: rgba(192,38,211,0.08) !important; }
.light-mode #stab-ielts      { background: rgba(20,184,166,0.08) !important; }
.light-mode #stab-mcq        { background: rgba(239,68,68,0.08) !important; }
.light-mode #stab-summarizer { background: rgba(100,116,139,0.08) !important; }
.light-mode #stab-srs        { background: rgba(16,185,129,0.08) !important; }
.light-mode #stab-notebook   { background: rgba(99,102,241,0.08) !important; }
.light-mode .study-mode-card .smc-label { color: #1e1b4b !important; }
.light-mode .study-mode-card .smc-sub   { color: #6b5a8a !important; }
.light-mode .study-stat-card {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(139,92,246,0.15) !important;
}
.light-mode .study-stat-val  { color: #7c3aed !important; }
.light-mode .study-stat-label { color: #6b5a8a !important; }
.light-mode .study-hero-sub  { color: #6b5a8a !important; }

.bn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 14px;
  position: relative;
  transition: background 0.2s cubic-bezier(0.34,1.3,0.64,1),
              transform 0.15s cubic-bezier(0.34,1.3,0.64,1);
  -webkit-tap-highlight-color: transparent;
}
.bn-tab:active { transform: scale(0.92); }

/* Active tab — purple pill background */
.bn-tab.active {
  background: rgba(124, 92, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(124,92,255,0.22) inset;
}

.bn-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  display: block;
}
.bn-tab.active .bn-icon { transform: scale(1.12) translateY(-1px); }

.bn-label {
  font-family: 'Sora', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #2d3555;
  transition: color 0.2s;
}
.bn-tab.active .bn-label { color: #7c5cff; }

/* 2px underline indicator */
.bn-indicator {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c5cff, #a78bfa);
  transition: transform 0.3s cubic-bezier(0.34,1.3,0.64,1);
}
.bn-tab.active .bn-indicator { transform: translateX(-50%) scaleX(1); }

/* Home indicator bar */
.home-indicator {
  width: 80px; height: 3px;
  border-radius: 2px;
  background: #1e2240;
  margin: 4px auto 6px;
  flex-shrink: 0;
}

/* Light mode bottom nav */
.light-mode .bottom-nav {
  background: rgba(244,244,251,0.88);
  border-top-color: rgba(0,0,0,0.07);
}
.light-mode .bn-label { color: #94a3b8; }
.light-mode .bn-tab.active { background: rgba(124,92,255,0.1); }
.light-mode .home-indicator { background: #d1d5db; }

/* ══════════════════════════════════════════════════════════════════
   MODE PILLS ROW — horizontal scrollable, pinned below header
   ══════════════════════════════════════════════════════════════════ */
.mode-pills-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
  animation: pills-fade-in 0.4s ease 0.1s both;
}
.mode-pills-row::-webkit-scrollbar { display: none; }
@keyframes pills-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mode-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(28,18,52,0.85);
  color: #a0a8c0;
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s cubic-bezier(0.34,1.3,0.64,1),
              color 0.2s,
              border-color 0.2s,
              transform 0.15s cubic-bezier(0.34,1.3,0.64,1),
              box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mode-pill:active { transform: scale(0.94); }
.mode-pill.active,
.mode-pill:hover {
  background: linear-gradient(135deg, rgba(124,92,255,0.35), rgba(167,139,250,0.2));
  border-color: rgba(124,92,255,0.5);
  color: #fff;
  box-shadow: 0 0 12px rgba(124,92,255,0.25);
}

/* Nav pills — slightly different tint to distinguish from mode pills */
.mode-pill-nav {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
}
.mode-pill-nav:hover {
  background: linear-gradient(135deg, rgba(0,224,255,0.18), rgba(124,92,255,0.15));
  border-color: rgba(0,224,255,0.35);
  color: #fff;
  box-shadow: 0 0 10px rgba(0,224,255,0.15);
}

/* Divider dot between nav and mode pills */
.pills-divider {
  flex-shrink: 0;
  color: rgba(255,255,255,0.2);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  align-self: center;
  user-select: none;
}

@media (min-width: 901px) {
  #header {
    padding: 8px 20px 12px;
  }
  .back-btn,
  .menu-btn,
  .auth-quick-btn,
  .memory-brain-btn,
  #themeToggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 14px;
  }
  .header-center {
    gap: 12px;
  }
  .header-avatar-wrap,
  .header-avatar,
  .header-avatar-img {
    width: 42px;
    height: 42px;
  }
  .header-text h2 {
    font-size: 22px;
  }
  .mode-pills-row {
    gap: 10px;
    padding: 8px 20px 12px;
  }
  .mode-pill {
    padding: 8px 18px;
    font-size: 13px;
  }
  #messages {
    padding: 14px 22px 22px;
    gap: 16px;
  }
  .date-divider {
    font-size: 13px;
    margin: 6px 0 10px;
  }
  .bubble {
    max-width: 70%;
    padding: 14px 18px;
    font-size: 15px;
  }
  .bubble-time {
    font-size: 11px;
    margin-top: 6px;
  }
  .chat-empty-state {
    gap: 14px;
  }
  .ces-orb {
    width: 66px;
    height: 66px;
    font-size: 24px;
  }
  .ces-title {
    font-size: 18px;
  }
  .ces-sub {
    font-size: 13px;
    max-width: 300px;
  }
  #inputBar {
    gap: 14px;
    padding: 14px 20px 24px;
  }
  .input-wrap {
    gap: 10px;
    padding: 12px 16px;
    border-radius: 28px;
  }
  #userInput {
    font-size: 16px;
  }
  .camera-btn,
  .study-chat-btn,
  .voice-toggle,
  .send-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .voice-quick-btn {
    width: auto;
    min-width: 92px;
    height: 48px;
    padding: 0 14px;
    border-radius: 999px;
  }
  .voice-toggle {
    border-radius: 50%;
  }
  .camera-btn svg,
  .study-chat-btn svg,
  .voice-quick-btn svg,
  .voice-toggle svg,
  .send-btn svg {
    width: 18px;
    height: 18px;
  }
}

.light-mode .mode-pill {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.08);
  color: #475569;
}
.light-mode .mode-pill.active,
.light-mode .mode-pill:hover {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.3);
  color: #7c5cff;
}

/* ══════════════════════════════════════════════════════════════════
   GLASSMORPHISM BACK BUTTON — replaces the plain back-btn
   ══════════════════════════════════════════════════════════════════ */
.back-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 14px !important;
  background: rgba(28, 18, 52, 0.55) !important;
  backdrop-filter: blur(20px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.4) !important;
  border: 1px solid rgba(255,255,255,0.13) !important;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 0 0 rgba(124,92,255,0) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition:
    background 0.2s,
    box-shadow 0.25s cubic-bezier(0.34,1.3,0.64,1),
    transform 0.15s cubic-bezier(0.34,1.3,0.64,1),
    border-color 0.2s !important;
  position: relative;
  overflow: hidden;
}
/* Shimmer sweep on hover */
.back-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.12) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
  border-radius: inherit;
  pointer-events: none;
}
.back-btn:hover::before { transform: translateX(100%); }
.back-btn:hover {
  background: rgba(124,92,255,0.18) !important;
  border-color: rgba(124,92,255,0.4) !important;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 0 0 3px rgba(124,92,255,0.15) !important;
}
.back-btn:active {
  transform: scale(0.91) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}
.back-btn svg {
  width: 16px !important;
  height: 16px !important;
  stroke: rgba(255,255,255,0.85) !important;
  fill: none !important;
  transition: stroke 0.2s, transform 0.2s;
}
.back-btn:hover svg { stroke: #fff !important; transform: translateX(-1px); }

/* Light mode back button */
.light-mode .back-btn {
  background: rgba(255,255,255,0.65) !important;
  border-color: rgba(0,0,0,0.1) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8) !important;
}
.light-mode .back-btn:hover {
  background: rgba(124,92,255,0.1) !important;
  border-color: rgba(124,92,255,0.3) !important;
}
.light-mode .back-btn svg { stroke: #475569 !important; }

/* ══════════════════════════════════════════════════════════════════
   HIDE OLD HAMBURGER MENU BUTTON when pills row is visible
   ══════════════════════════════════════════════════════════════════ */
#chatScreen .menu-btn { display: flex; }

/* Keep menu-btn visible on other screens that don't have pills */
#phone.overlay-mode .menu-btn { display: flex; }

/* ══════════════════════════════════════════════════════════════════
   PHONE SHELL — account for bottom nav height
   ══════════════════════════════════════════════════════════════════ */
/* Screens need to not overflow into the nav */
.screen { padding-bottom: 0; }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — tablet gets left sidebar nav instead of bottom
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 481px) and (max-width: 900px) {
  .bottom-nav {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 64px;
    flex-direction: column;
    justify-content: center;
    padding: 16px 6px;
    border-top: none;
    border-right: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
    gap: 8px;
  }
  .bn-label { display: none; }
  .bn-indicator {
    bottom: auto;
    left: 2px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 2px; height: 20px;
  }
  .bn-tab.active .bn-indicator { transform: translateY(-50%) scaleY(1); }
  .home-indicator { display: none; }
  #phone { padding-left: 64px; }
  .mode-pills-row { padding-left: 8px; }
}

/* ── Theme flash prevention ──────────────────────────────────────
   Applied by inline script in <head> before first paint.
   Prevents the dark→light flash for users with light mode saved.
   JS removes this class after taking over theme control on load.
   ─────────────────────────────────────────────────────────────── */
html.preload-light body {
  background: #F4F4FB !important;
}
html.preload-light #phone {
  background: #F4F4FB !important;
}

/* ═══════════════════════════════════════════════════════════════
   REMINDER & GROUP PANELS — Polished bottom-sheet with backdrop
   ═══════════════════════════════════════════════════════════════ */

/* Shared backdrop — fades in behind the panel */
.mini-panel-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2990;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.mini-panel-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* Panels slide up from the bottom */
#reminderPanel, #groupPanel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3000;
  background: rgba(10, 14, 28, 0.97);
  border: 1px solid rgba(124, 92, 255, 0.18);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 0;
  box-shadow:
    0 -12px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.22s ease;
  will-change: transform;
}

#reminderPanel.open, #groupPanel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Drag handle */
#reminderPanel::before, #groupPanel::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  margin: 12px auto 0;
}

.mini-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-title {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}

.mini-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.mini-close:hover { background: rgba(255, 255, 255, 0.13); color: #f1f5f9; }

.mini-panel-body {
  display: grid;
  gap: 12px;
  padding: 18px 20px 28px;
}

.mini-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: -4px;
}

.mini-input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.8);
  color: #f1f5f9;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.mini-input:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

.mini-primary {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  cursor: pointer;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.3);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  font-family: 'Sora', sans-serif;
}
.mini-primary:hover { box-shadow: 0 4px 24px rgba(167, 139, 250, 0.5); }
.mini-primary:active { transform: scale(0.96); opacity: 0.92; }

.mini-hint {
  font-size: 12px;
  color: #93c5fd;
  min-height: 16px;
  padding-left: 2px;
}

.group-feed {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.5);
  line-height: 1.6;
}

.group-send-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

/* Light mode overrides */
.light-mode #reminderPanel,
.light-mode #groupPanel {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(124, 92, 255, 0.15);
  box-shadow: 0 -12px 60px rgba(15, 23, 42, 0.15);
}
.light-mode #reminderPanel::before,
.light-mode #groupPanel::before {
  background: rgba(0, 0, 0, 0.12);
}
.light-mode .mini-title { color: #0f172a; }
.light-mode .mini-label { color: #94a3b8; }
.light-mode .mini-input {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.35);
  color: #0f172a;
}
.light-mode .mini-close {
  background: rgba(0, 0, 0, 0.05);
  color: #475569;
}
.light-mode .mini-panel-head {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}
.light-mode .group-feed {
  background: rgba(248, 250, 252, 0.9);
  color: #334155;
  border-color: rgba(0, 0, 0, 0.08);
}
/* Source style block 1 */
/* =============================================
     NEXORA PREMIUM DESIGN SYSTEM v2.0
     🌌 Dark AI UI — Futuristic Neon Glass
     ============================================= */
  :root {
    --radius: 24px;
    --radius-card: 16px;
    --radius-bubble: 20px;
    --radius-btn: 999px;
    --orb-size: 180px;

    --bg-app:      #0d0b1a;
    --bg-chat:     #100d1f;
    --bg-surface:  rgba(28, 18, 52, 0.75);
    --bg-input:    rgba(13, 11, 26, 0.97);
    --bg:          #0d0b1a;
    --surface:     rgba(28, 18, 52, 0.6);
    --surface2:    rgba(28, 18, 52, 0.8);
    --surface3:    rgba(35, 22, 65, 0.95);

    --primary:      #7c5cff;
    --primary-dark: #4f35cc;
    --accent:       #00e0ff;
    --accent2:      #7c5cff;
    --accent-pink:  #ff4ecd;
    --accent-glow:  rgba(139, 92, 246, 0.5);
    --accent-dim:   rgba(139, 92, 246, 0.15);

    --grad:         linear-gradient(135deg, #9b6dff, #c084fc, #e879f9);
    --grad-btn:     linear-gradient(135deg, #7c5cff, #a855f7);
    --user-bubble:  linear-gradient(135deg, #7c5cff, #c026d3);

    --text:         #f0eaff;
    --text2:        #b8a8d8;
    --text3:        #6b5a8a;
    --border:       rgba(139, 92, 246, 0.1);
    --border2:      rgba(139, 92, 246, 0.18);
    --border-strong:rgba(139, 92, 246, 0.32);

    --success:      #00e5a0;
    --warning:      #ffb830;
    --error:        #ff4e6a;

    --shadow-card:  0 20px 60px rgba(0,0,0,0.75), 0 0 0 1px rgba(139,92,246,0.08);
    --shadow-glow:  0 0 30px rgba(139, 92, 246, 0.6);
    --shadow-input: none;

    --chat-bg-gradient: linear-gradient(180deg, #0d0b1a 0%, #100d1f 100%);
  }

  * { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

  /* Apply theme transitions only during an actual theme switch */
  html.theme-transition *, html.theme-transition *::before, html.theme-transition *::after {
    transition-property: background-color, border-color, color, box-shadow, fill, stroke;
    transition-duration: 220ms;
    transition-timing-function: ease;
  }
  /* But keep motion-heavy elements instant so animations aren't sluggish */
  .orb-slice, .voice-orb, .dot, .v-ring, .orb-shell, .orb-shell-inner, .orb-depth-1, .orb-depth-2, .orb-rim {
    transition: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation: none !important;
      scroll-behavior: auto !important;
    }
  }

  body {
    background: var(--bg-app);
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: background 0.3s ease;
  }

  /* ===== ANIMATED BLOB BACKGROUND ===== */
  body::after {
    content: '';
    position: fixed; inset: 0;
    background:
      radial-gradient(ellipse 65% 55% at 15% 15%, rgba(124,92,255,0.13) 0%, transparent 65%),
      radial-gradient(ellipse 55% 65% at 85% 80%, rgba(0,224,255,0.10) 0%, transparent 65%),
      radial-gradient(ellipse 45% 50% at 50% 50%, rgba(255,78,205,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: blob-drift 40s ease-in-out infinite alternate;
    transition: opacity 0.3s ease;
  }

  body.light-mode::after {
    background:
      radial-gradient(ellipse 60% 50% at 20% 20%, rgba(139,92,246,0.05) 0%, transparent 70%),
      radial-gradient(ellipse 50% 60% at 80% 75%, rgba(6,182,212,0.04) 0%, transparent 70%);
  }

  @keyframes blob-drift {
    0%   { transform: scale(1) translate(0, 0); }
    33%  { transform: scale(1.04) translate(1%, 1.5%); }
    66%  { transform: scale(0.97) translate(-1%, 0.5%); }
    100% { transform: scale(1.02) translate(0.5%, -1%); }
  }

  /* ===== GRAIN OVERLAY ===== */
  body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none; z-index: 999; opacity: 0.4;
  }

  /* ===== APP SHELL — works on phone, tablet, laptop, desktop ===== */
  #phone {
    width: min(520px, 100vw);
    height: min(880px, 100dvh);
    background: var(--bg-app);
    border-radius: 28px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.05),
      var(--shadow-card),
      0 0 80px rgba(124,92,255,0.35),
      0 0 160px rgba(0,224,255,0.08);
    z-index: 1;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  }

  /* Tablet: give a bit more breathing room */
  @media (min-width: 600px) and (max-width: 900px) {
    #phone { width: min(580px, 94vw); border-radius: 32px; }
  }

  @media (min-width: 901px) and (max-width: 1199px) {
    #phone {
      width: min(820px, 94vw);
      height: min(930px, 95dvh);
      border-radius: 34px;
    }
  }

  @media (min-width: 1200px) {
    #phone {
      width: min(1120px, 95vw);
      height: min(950px, 95dvh);
      border-radius: 36px;
    }
  }

  /* Full-screen on small phones */
  @media (max-width: 480px) {
    body { align-items: flex-start; }
    #phone { width: 100vw; height: 100dvh; border-radius: 0; border: none; box-shadow: none; }
  }

  /* ===== TOP BAR — merged with header into one compact row ===== */
  #statusbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 0;
    font-size: 11px; font-weight: 500;
    color: var(--text3);
    flex-shrink: 0;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 11;
  }
  /* Clock — far left */
  #clockDisplay { flex-shrink: 0; }
  /* Date — far right */
  #statusbar .sb-date { color: var(--text3); flex-shrink: 0; }

  /* Full-panel modes: Study / Compare should replace the default shell, not stack with it */
  #phone.overlay-mode > #statusbar,
  #phone.overlay-mode > #header,
  #phone.overlay-mode > #modeToggle,
  #phone.overlay-mode > #searchOverlay,
  #phone.overlay-mode > #copyToast,
  #phone.overlay-mode > #apiPanel,
  #phone.overlay-mode > .screen:not(#studyScreen) {
    display: none !important;
  }
  #phone.study-mode-open > #comparePanel {
    display: none !important;
  }
  #phone.compare-mode-open > #studyScreen {
    display: none !important;
  }

  /* ===== HEADER — merged into statusbar row visually ===== */
  #header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 16px 8px;
    flex-shrink: 0;
    position: relative;
  }

  .back-btn {
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(28, 18, 52, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.07);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
  }
  .back-btn:active { background: var(--surface3); }
  .back-btn svg { width: 15px; height: 15px; stroke: var(--text2); fill: none; }

  /* Center: logo + Nexora name */
  .header-center {
    display: flex; align-items: center; gap: 9px;
    position: absolute; left: 50%; transform: translateX(-50%);
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .header-avatar-wrap {
    position: relative;
    width: 36px; height: 36px;
    flex-shrink: 0;
  }

  /* Image logo */
  .header-avatar {
    width: 36px; height: 36px; border-radius: 12px;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    box-shadow: 0 0 14px rgba(0,224,255,0.5), 0 0 28px rgba(0,224,255,0.2);
    flex-shrink: 0;
    transition: box-shadow 0.3s ease;
    overflow: hidden;
  }
  .header-avatar-img {
    width: 36px; height: 36px; border-radius: 12px;
    object-fit: cover;
    background: #000;
    display: block;
    box-shadow: 0 0 14px rgba(0,224,255,0.5), 0 0 28px rgba(0,224,255,0.2);
    flex-shrink: 0;
    transition: box-shadow 0.3s ease;
  }

  /* Clean Nexora title */
  .header-text h2 {
    font-family: 'Playfair Display', 'Sora', serif;
    font-size: 18px; font-weight: 800;
    color: #f0eaff;
    letter-spacing: -0.02em;
    line-height: 1;
  }
  .header-text p { display: none !important; }
  .header-text p::before { display: none; }

  .header-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
  }
  /* Image logo — crop to circle to remove the baked-in square background */
  .header-avatar-wrap {
    position: relative;
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
  }
  .header-avatar-img {
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    border: none;
    display: block;
    flex-shrink: 0;
  }

  /* Clean Nexora title — no badge, no subtitle */
  .header-text h2 {
    font-family: 'Playfair Display', 'Sora', serif;
    font-size: 18px; font-weight: 800;
    color: #f0eaff;
    letter-spacing: -0.02em;
    line-height: 1;
  }

  /* Hide the old subtitle p — kept in DOM for JS compat */
  .header-text p { display: none !important; }
  .header-text p::before { display: none; }

  @keyframes pulse-dot {
    0%,100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  /* ── Live status dot next to "here for you" ── */
  .status-dot-live {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
    position: relative;
    display: inline-block;
  }
  .status-dot-live::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid var(--success);
    opacity: 0;
    animation: ring-pulse 2.2s ease-out infinite;
  }
  @keyframes ring-pulse {
    0%   { transform: scale(0.7); opacity: 0.7; }
    100% { transform: scale(2.2); opacity: 0; }
  }

  /* ── Status ring around avatar ── */
  .header-avatar-wrap {
    position: relative;
    width: 36px; height: 36px;
    flex-shrink: 0;
  }
  .header-avatar {
    width: 36px; height: 36px; border-radius: 12px;
    background: linear-gradient(135deg, #7c5cff, #00e0ff, #ff4ecd);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 18px rgba(124,92,255,0.6), 0 0 35px rgba(0,224,255,0.2);
    transition: box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
  }
  .status-ring {
    position: absolute;
    inset: -3px;
    border-radius: 15px;
    border: 1.5px solid rgba(167, 139, 250, 0.4);
    pointer-events: none;
    animation: status-ring-breathe 3s ease-in-out infinite;
    z-index: 0;
  }
  @keyframes status-ring-breathe {
    0%,100% { opacity: 0.45; box-shadow: 0 0 0 0 rgba(167,139,250,0); }
    50%     { opacity: 1;    box-shadow: 0 0 10px 2px rgba(167,139,250,0.18); }
  }

  /* ── Empty chat state ── */
  .chat-empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
    pointer-events: none;
    animation: ces-fade-in 0.6s ease 0.3s both;
    z-index: 0;
  }
  @keyframes ces-fade-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
  }
.chat-empty-state.hidden { display: none; }
#messages:has(.msg-row) .chat-empty-state { display: none; }
.ces-orb {
    width: 58px; height: 58px; border-radius: 50%;
    background: radial-gradient(circle at 38% 36%, rgba(180,160,255,0.25) 0%, rgba(124,92,255,0.08) 60%, transparent 100%);
    border: 1px solid rgba(124,92,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: rgba(167,139,250,0.7);
    animation: ces-orb-pulse 3s ease-in-out infinite;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 30px rgba(124,92,255,0.12);
  }
  @keyframes ces-orb-pulse {
    0%,100% { box-shadow: 0 0 20px rgba(124,92,255,0.1); }
    50%     { box-shadow: 0 0 40px rgba(124,92,255,0.22); }
  }
  .ces-title {
    font-family: 'Sora', sans-serif;
    font-size: 15px; font-weight: 600;
    color: rgba(255,255,255,0.45);
    letter-spacing: -0.01em;
  }
  .ces-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.2);
    text-align: center;
    max-width: 220px;
    line-height: 1.5;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
  }
  .light-mode .ces-title { color: rgba(15,23,42,0.35); }
  .light-mode .ces-sub   { color: rgba(15,23,42,0.2); }
  .light-mode .ces-orb   { background: rgba(124,92,255,0.05); border-color: rgba(124,92,255,0.15); }

  .menu-btn {
    width: 36px; height: 36px; border-radius: 12px;
    background: rgba(28, 18, 52, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-direction: column; gap: 3px;
  }
  .menu-btn span {
    width: 14px; height: 1.5px;
    background: var(--text2);
    border-radius: 2px;
    display: block;
  }

  .auth-quick-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(28, 18, 52, 0.7);
    color: var(--text2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .auth-quick-btn.signed-in {
    min-width: 44px;
    color: #0b1120;
    background: linear-gradient(135deg, #67e8f9 0%, #f8fafc 50%, #fbbf24 100%);
    border-color: transparent;
  }

  .auth-menu-card {
    margin: 6px 2px 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(15,17,35,0.72);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .auth-menu-title {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
  }
  .auth-menu-sub {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text3);
  }

  #authPanel {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
  }
  #authPanel.open { display: block; }
  .auth-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2,6,23,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .auth-panel-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 28px));
    max-height: min(720px, calc(100dvh - 28px));
    overflow-y: auto;
    border-radius: 28px;
    border: 1px solid rgba(148,163,184,0.16);
    background:
      radial-gradient(circle at top right, rgba(34,211,238,0.12), transparent 26%),
      radial-gradient(circle at bottom left, rgba(251,191,36,0.08), transparent 26%),
      rgba(7,18,33,0.95);
    box-shadow: 0 32px 80px rgba(2,6,23,0.5);
    padding: 22px;
  }
  .auth-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
  }
  .auth-panel-title {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.02em;
  }
  .auth-panel-subtitle {
    margin-top: 5px;
    color: rgba(226,232,240,0.7);
    font-size: 13px;
    line-height: 1.6;
  }
  .auth-panel-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(15,23,42,0.72);
    color: #e2e8f0;
    cursor: pointer;
  }
  .auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .auth-tab {
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(148,163,184,0.14);
    background: rgba(15,23,42,0.7);
    color: rgba(226,232,240,0.78);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  .auth-tab.active {
    background: linear-gradient(135deg, rgba(103,232,249,0.18), rgba(251,191,36,0.14));
    color: #f8fafc;
    border-color: rgba(103,232,249,0.28);
  }
  .auth-user-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15,23,42,0.74);
    border: 1px solid rgba(148,163,184,0.14);
  }
  .auth-user-chip {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #67e8f9 0%, #f8fafc 48%, #fbbf24 100%);
    color: #08111d;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 700;
  }
  .auth-user-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .auth-user-copy strong {
    color: #f8fafc;
    font-size: 14px;
  }
  .auth-user-copy span {
    color: rgba(226,232,240,0.66);
    font-size: 12px;
  }
  .auth-label {
    display: block;
    margin: 12px 0 8px;
    color: rgba(226,232,240,0.84);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  .auth-input {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(148,163,184,0.16);
    background: rgba(15,23,42,0.78);
    color: #f8fafc;
    font-size: 14px;
    outline: none;
  }
  .auth-input:focus {
    border-color: rgba(103,232,249,0.4);
    box-shadow: 0 0 0 3px rgba(34,211,238,0.08);
  }
  .auth-helper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: rgba(226,232,240,0.58);
    font-size: 11px;
  }
  .auth-link-btn,
  .auth-ghost-btn {
    border: none;
    background: transparent;
    color: #7dd3fc;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
  }
  .auth-status {
    min-height: 20px;
    margin-top: 14px;
    color: rgba(226,232,240,0.8);
    font-size: 12px;
    line-height: 1.5;
  }
  .auth-status.error { color: #fca5a5; }
  .auth-status.success { color: #86efac; }
  .auth-submit-btn,
  .auth-secondary-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 14px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 700;
  }
  .auth-submit-btn {
    color: #08111d;
    background: linear-gradient(135deg, #67e8f9 0%, #f8fafc 48%, #fbbf24 100%);
    box-shadow: 0 18px 42px rgba(34,211,238,0.14);
  }
  .auth-secondary-btn {
    color: #f8fafc;
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.22);
  }
  .auth-ghost-btn {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    margin-top: 14px;
    color: rgba(226,232,240,0.72);
  }

  body.light-mode .auth-quick-btn {
    background: rgba(255,255,255,0.82);
    color: #0f172a;
    border-color: rgba(15,23,42,0.08);
  }
  body.light-mode .auth-menu-card,
  body.light-mode .auth-panel-card,
  body.light-mode .auth-user-box,
  body.light-mode .auth-tab,
  body.light-mode .auth-input {
    background: rgba(255,255,255,0.9);
    color: #0f172a;
    border-color: rgba(148,163,184,0.18);
  }
  body.light-mode .auth-menu-title,
  body.light-mode .auth-panel-title,
  body.light-mode .auth-user-copy strong,
  body.light-mode .auth-label {
    color: #0f172a;
  }
  body.light-mode .auth-menu-sub,
  body.light-mode .auth-panel-subtitle,
  body.light-mode .auth-user-copy span,
  body.light-mode .auth-helper-row,
  body.light-mode .auth-status,
  body.light-mode .auth-ghost-btn {
    color: rgba(15,23,42,0.68);
  }
  body.light-mode .auth-panel-close {
    background: rgba(241,245,249,0.9);
    color: #0f172a;
    border-color: rgba(148,163,184,0.18);
  }

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

  /* ===== NAME SCREEN ===== */
  #nameScreen {
    align-items: center; justify-content: flex-start;
    padding: clamp(20px, 4vh, 40px) clamp(20px, 6vw, 32px) clamp(20px, 3vh, 32px);
    gap: 0;
    overflow-y: auto;
  }
  /* Center vertically only when content fits */
  @media (min-height: 700px) {
    #nameScreen { justify-content: center; }
  }

  /* ===== NEXORA ORB — Hex Mesh Sphere ===== */
  .orb-container {
    position: relative;
    width: clamp(150px, 38vw, 220px);
    height: clamp(150px, 38vw, 220px);
    margin-bottom: clamp(18px, 3vh, 32px);
    flex-shrink: 0;
    border-radius: 50%;
  }

  /* Hover lift */
  .orb-container:hover {
    transform: scale(1.03);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* ── Canvas fills the container ── */
  .orb-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    display: block;
  }

  /* ── Outer ambient halo ── */
  .orb-halo {
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
      rgba(0,200,255,0.18) 0%,
      rgba(0,120,255,0.10) 35%,
      transparent 70%);
    pointer-events: none;
    animation: halo-pulse 4s ease-in-out infinite;
    z-index: 0;
  }
  @keyframes halo-pulse {
    0%,100% { opacity: 0.7; transform: scale(1);    }
    50%     { opacity: 1;   transform: scale(1.06); }
  }

  /* ── Orbital rings — 3 ellipses at different tilt angles ── */
  .orb-orbital {
    position: absolute;
    inset: -18%;
    border-radius: 50%;
    border: 1.5px solid rgba(180,240,255,0.55);
    pointer-events: none;
    z-index: 10;
    /* Glow on the ring line */
    box-shadow: 0 0 6px rgba(0,220,255,0.7), 0 0 14px rgba(0,180,255,0.3);
  }
  /* Ring 1 — tilted ~20° on X, slow */
  .orb-orbital-1 {
    transform: rotateX(70deg) rotateZ(20deg);
    animation: orbit-spin-1 7s linear infinite;
    border-color: rgba(180,240,255,0.6);
  }
  /* Ring 2 — tilted ~45° on X, medium */
  .orb-orbital-2 {
    transform: rotateX(55deg) rotateZ(-40deg);
    animation: orbit-spin-2 10s linear infinite reverse;
    border-color: rgba(140,220,255,0.45);
    box-shadow: 0 0 5px rgba(0,200,255,0.5), 0 0 12px rgba(0,160,255,0.25);
  }
  /* Ring 3 — nearly flat, fastest */
  .orb-orbital-3 {
    transform: rotateX(80deg) rotateZ(70deg);
    animation: orbit-spin-3 5s linear infinite;
    border-color: rgba(200,245,255,0.35);
    box-shadow: 0 0 4px rgba(0,220,255,0.4), 0 0 10px rgba(0,180,255,0.2);
  }
  @keyframes orbit-spin-1 {
    from { transform: rotateX(70deg) rotateZ(20deg); }
    to   { transform: rotateX(70deg) rotateZ(380deg); }
  }
  @keyframes orbit-spin-2 {
    from { transform: rotateX(55deg) rotateZ(-40deg); }
    to   { transform: rotateX(55deg) rotateZ(-400deg); }
  }
  @keyframes orbit-spin-3 {
    from { transform: rotateX(80deg) rotateZ(70deg); }
    to   { transform: rotateX(80deg) rotateZ(430deg); }
  }

  /* Preserve 3D for orbital rings */
  .orb-container { transform-style: preserve-3d; perspective: 600px; }

  /* ── Orb responsive overrides ── */
  @media (max-width: 360px) {
    .orb-container { width: 140px; height: 140px; margin-bottom: 16px; }
  }
  @media (max-width: 480px) and (min-width: 361px) {
    .orb-container { width: 160px; height: 160px; margin-bottom: 20px; }
  }
  @media (max-height: 600px) {
    .orb-container { width: 120px; height: 120px; margin-bottom: 12px; }
    .welcome-sub { display: none; }
  }
  @media (min-width: 600px) and (max-width: 900px) {
    .orb-container { width: 200px; height: 200px; }
  }
  @media (min-width: 1200px) {
    .orb-container { width: 220px; height: 220px; margin-bottom: 32px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .orb-orbital, .orb-halo { animation: none !important; }
    .orb-container:hover { transform: none; }
  }

  .welcome-title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(20px, 5vw, 26px); font-weight: 600;
    background: linear-gradient(135deg, #ffffff 20%, #a78bfa 60%, #00e0ff 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 8px;
  }

  .welcome-sub {
    font-size: clamp(12px, 3vw, 14px); color: var(--text2);
    text-align: center; line-height: 1.6;
    margin-bottom: clamp(12px, 2.5vh, 20px);
    max-width: 260px;
  }

  .welcome-byline {
    font-size: clamp(10px, 2.5vw, 11px);
    color: #7070a0;
    text-align: center;
    margin-bottom: clamp(16px, 3vh, 28px);
    letter-spacing: 0.4px;
    display: flex; align-items: center; gap: 7px;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
  }
  .welcome-byline::before,
  .welcome-byline::after {
    content: '';
    width: 30px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,92,255,0.5), transparent);
    display: inline-block;
  }
  .welcome-byline .byline-name {
    background: linear-gradient(135deg, #7c5cff, #00e0ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-weight: 500;
    letter-spacing: 0.2px;
  }

  .name-input-wrap {
    width: 100%;
    background: rgba(28, 18, 52, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 14px 20px;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 0 0 transparent;
  }
  .name-input-wrap:focus-within {
    border-color: #7c5cff;
    box-shadow: 0 0 0 1px rgba(124,92,255,0.3), 0 0 20px rgba(124,92,255,0.2);
  }
  .name-input-wrap svg { width: 18px; height: 18px; stroke: var(--text3); fill: none; flex-shrink: 0; }

  #nameInput {
    flex: 1;
    background: transparent;
    border: none; outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px; color: var(--text);
  }
  #nameInput::placeholder { color: var(--text3); }

  .start-btn {
    width: 100%;
    padding: 15px;
    border-radius: 20px;
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    border: none; cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 15px; font-weight: 600;
    color: white;
    letter-spacing: 0.3px;
    box-shadow: 0 8px 32px rgba(124,92,255,0.45), 0 0 0 1px rgba(255,255,255,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .start-btn:hover {
    box-shadow: 0 0 30px rgba(124,92,255,0.65), 0 0 60px rgba(0,224,255,0.25), 0 8px 32px rgba(124,92,255,0.35);
    transform: scale(1.03);
  }
  .start-btn:active { transform: scale(0.97); box-shadow: 0 4px 16px rgba(124,92,255,0.3); }

  /* ===== VOICE SCREEN ===== */
  #voiceScreen {
    align-items: center; justify-content: space-between;
    padding: 20px 28px 36px;
  }

  .voice-topic {
    font-size: 11px; color: var(--text3); letter-spacing: 1.2px;
    text-transform: uppercase; align-self: flex-start;
    font-weight: 600;
  }

  /* ── Orb wrap ── */
  .voice-orb-wrap {
    position: relative;
    flex: 1; display: flex; align-items: center; justify-content: center;
  }

  /* ── Main orb ── */
  .voice-orb {
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%,
      #c4b5fd 0%, #8b5cf6 28%, #5b21b6 58%, #1e1b4b 85%, #0d0b1a 100%);
    box-shadow:
      0 0 0 1px rgba(139,92,246,0.25),
      0 0 50px rgba(124,92,255,0.55),
      0 0 100px rgba(0,224,255,0.12),
      inset 0 -20px 40px rgba(0,0,0,0.4);
    animation: orb-breathe 4.5s ease-in-out infinite;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.5s ease, box-shadow 0.5s ease, transform 0.18s ease;
    overflow: hidden;
  }
  .voice-orb:hover  { transform: scale(1.04); }
  .voice-orb:active { transform: scale(0.97); transition-duration: 0.08s; }

  /* Glass shine — top-left highlight, always visible */
  .orb-glass-shine {
    position: absolute; top: 11%; left: 17%;
    width: 30%; height: 18%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.32) 0%, transparent 70%);
    border-radius: 50%; transform: rotate(-30deg);
    pointer-events: none; z-index: 3;
  }

  /* Color overlay — fades between state colors */
  .orb-inner-glow {
    position: absolute; inset: 0; border-radius: 50%;
    background: transparent;
    transition: background 0.5s ease;
    pointer-events: none; z-index: 1;
  }

  /* ── Orb icon (mic) ── */
  .orb-icon {
    position: relative; z-index: 2;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.45));
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  /* ── Waveform bars — hero signal for listening ── */
  .orb-waveform {
    position: absolute; z-index: 2;
    display: flex; align-items: center; gap: 5px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .orb-waveform span {
    display: block; width: 4px; border-radius: 4px;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 0 5px rgba(255,255,255,0.4);
  }
  /* Asymmetric heights + unique durations = organic, not template */
  .orb-waveform span:nth-child(1) { height: 12px; animation: wf1 0.9s cubic-bezier(0.45,0.05,0.55,0.95) infinite alternate; }
  .orb-waveform span:nth-child(2) { height: 28px; animation: wf2 0.7s cubic-bezier(0.45,0.05,0.55,0.95) infinite alternate; }
  .orb-waveform span:nth-child(3) { height: 38px; animation: wf3 0.5s cubic-bezier(0.45,0.05,0.55,0.95) infinite alternate; }
  .orb-waveform span:nth-child(4) { height: 22px; animation: wf4 0.8s cubic-bezier(0.45,0.05,0.55,0.95) infinite alternate; }
  .orb-waveform span:nth-child(5) { height: 14px; animation: wf5 1.1s cubic-bezier(0.45,0.05,0.55,0.95) infinite alternate; }
  @keyframes wf1 { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
  @keyframes wf2 { from { transform: scaleY(0.5);  } to { transform: scaleY(1); } }
  @keyframes wf3 { from { transform: scaleY(0.3);  } to { transform: scaleY(1); } }
  @keyframes wf4 { from { transform: scaleY(0.6);  } to { transform: scaleY(1); } }
  @keyframes wf5 { from { transform: scaleY(0.4);  } to { transform: scaleY(1); } }

  /* ── Processing arc — orbits OUTSIDE the orb, center stays clean ── */
  .orb-process-arc {
    position: absolute;
    width: 228px; height: 228px;
    border-radius: 50%;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
    animation: orb-spin 1.4s linear infinite;
    background: conic-gradient(
      rgba(245,158,11,0.9) 0deg,
      rgba(245,158,11,0.0) 80deg,
      transparent 80deg
    );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  }
  @keyframes orb-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }

  /* ── STATE: idle (default) — breathing animation defined on .voice-orb above ── */
  @keyframes orb-breathe {
    0%,100% { transform: scale(1);    box-shadow: 0 0 50px rgba(124,92,255,0.55), 0 0 100px rgba(0,224,255,0.12), inset 0 -20px 40px rgba(0,0,0,0.4); }
    50%     { transform: scale(1.04); box-shadow: 0 0 70px rgba(124,92,255,0.72), 0 0 130px rgba(0,224,255,0.2),  inset 0 -20px 40px rgba(0,0,0,0.4); }
  }

  /* ── STATE: listening — waveform is the hero, orb pulse is gentle ── */
  .voice-orb.listening {
    animation: orb-listen 0.65s ease-in-out infinite alternate;
    background: radial-gradient(circle at 35% 32%,
      #a5f3fc 0%, #22d3ee 25%, #0891b2 55%, #0c4a6e 82%, #0d0b1a 100%);
    box-shadow:
      0 0 0 1px rgba(34,211,238,0.4),
      0 0 60px rgba(34,211,238,0.55),
      0 0 120px rgba(34,211,238,0.16),
      inset 0 -20px 40px rgba(0,0,0,0.4);
  }
  .voice-orb.listening .orb-icon-mic  { opacity: 0; transform: scale(0.75); }
  .voice-orb.listening .orb-waveform  { opacity: 1; }
  .voice-orb.listening .orb-inner-glow {
    background: radial-gradient(circle at 50% 65%, rgba(34,211,238,0.16) 0%, transparent 60%);
  }
  @keyframes orb-listen {
    from { transform: scale(1);    }
    to   { transform: scale(1.06); }
  }

  /* ── STATE: processing — arc outside is the hero, orb barely moves ── */
  .voice-orb.processing {
    animation: orb-process 2.5s ease-in-out infinite;
    background: radial-gradient(circle at 35% 32%,
      #fde68a 0%, #f59e0b 28%, #b45309 58%, #1c1917 85%, #0d0b1a 100%);
    box-shadow:
      0 0 0 1px rgba(245,158,11,0.3),
      0 0 50px rgba(245,158,11,0.42),
      0 0 100px rgba(245,158,11,0.12),
      inset 0 -20px 40px rgba(0,0,0,0.4);
  }
  /* Mic stays visible at reduced opacity — center stays readable */
  .voice-orb.processing .orb-icon-mic { opacity: 0.4; transform: scale(0.88); }
  .voice-orb.processing .orb-inner-glow {
    background: radial-gradient(circle at 50% 65%, rgba(245,158,11,0.12) 0%, transparent 60%);
  }
  /* Arc activates on the wrap element, not inside the orb */
  .voice-orb-wrap.processing .orb-process-arc { opacity: 1; }
  @keyframes orb-process {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(1.02); }
  }

  /* ── STATE: speaking — pulse is the hero ── */
  .voice-orb.speaking {
    animation: orb-speak 0.5s ease-in-out infinite alternate;
    background: radial-gradient(circle at 35% 32%,
      #d9f99d 0%, #84cc16 28%, #3f6212 58%, #1a2e05 85%, #0d0b1a 100%);
    box-shadow:
      0 0 0 1px rgba(132,204,22,0.32),
      0 0 60px rgba(132,204,22,0.52),
      0 0 120px rgba(132,204,22,0.16),
      inset 0 -20px 40px rgba(0,0,0,0.4);
  }
  .voice-orb.speaking .orb-inner-glow {
    background: radial-gradient(circle at 50% 65%, rgba(132,204,22,0.14) 0%, transparent 60%);
  }
  @keyframes orb-speak {
    from { transform: scale(1);    }
    to   { transform: scale(1.065); }
  }

  /* Excited orb — fires on hype/gossip replies */
  .voice-orb.excited {
    animation: orb-excited 0.4s ease-in-out infinite alternate !important;
    box-shadow: 0 0 85px rgba(139,92,246,0.8), 0 0 155px rgba(236,72,153,0.45) !important;
  }
  @keyframes orb-excited {
    from { transform: scale(1); }
    to   { transform: scale(1.09); }
  }

  /* Calm orb — fires on sad/support replies */
  .voice-orb.calm {
    animation: orb-calm 3.5s ease-in-out infinite !important;
    box-shadow: 0 0 36px rgba(34,211,238,0.42), 0 0 72px rgba(34,211,238,0.18) !important;
    background: radial-gradient(circle at 35% 32%, #93c5fd 0%, #3b82f6 40%, #1e3a8a 75%, #0f172a 100%) !important;
  }
  @keyframes orb-calm {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(1.025); }
  }

  /* ── Outer rings — idle: slow & dim; listening: faster but not frantic ── */
  .voice-rings {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
  }
  .v-ring {
    position: absolute; border-radius: 50%;
    border: 1px solid rgba(139,92,246,0.14);
    opacity: 0;
    animation: v-ring-idle 4s ease-out infinite;
  }
  .v-ring:nth-child(1) { width: 240px; height: 240px; animation-delay: 0s;   border-color: rgba(124,92,255,0.28); }
  .v-ring:nth-child(2) { width: 295px; height: 295px; animation-delay: 1.1s; border-color: rgba(0,224,255,0.16); }
  .v-ring:nth-child(3) { width: 350px; height: 350px; animation-delay: 2.2s; border-color: rgba(255,78,205,0.10); }
  @keyframes v-ring-idle {
    0%   { opacity: 0;    transform: scale(0.9); }
    18%  { opacity: 0.5; }
    100% { opacity: 0;    transform: scale(1.07); }
  }

  /* Listening rings — slightly faster, cyan, ~30% less opacity than before */
  #voiceRings.active .v-ring {
    animation: v-ring-active 1.4s ease-out infinite;
  }
  #voiceRings.active .v-ring:nth-child(1) { animation-delay: 0s;    border-color: rgba(34,211,238,0.36); }
  #voiceRings.active .v-ring:nth-child(2) { animation-delay: 0.45s; border-color: rgba(34,211,238,0.22); }
  #voiceRings.active .v-ring:nth-child(3) { animation-delay: 0.9s;  border-color: rgba(34,211,238,0.12); }
  @keyframes v-ring-active {
    0%   { opacity: 0;   transform: scale(0.92); }
    12%  { opacity: 0.65; }
    100% { opacity: 0;   transform: scale(1.12); }
  }

  /* ── State label — fades out after a moment, reappears on each state change ── */
  .voice-state-label {
    font-family: 'Sora', sans-serif;
    font-size: 10px; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--text3);
    padding: 3px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    transition: color 0.4s ease, border-color 0.4s ease,
                background 0.4s ease, opacity 0.6s ease;
    margin-bottom: 2px;
    opacity: 1;
  }
  .voice-state-label.faded { opacity: 0; }
  .voice-state-label.state-listening {
    color: #22d3ee; border-color: rgba(34,211,238,0.28);
    background: rgba(34,211,238,0.06);
  }
  .voice-state-label.state-processing {
    color: #f59e0b; border-color: rgba(245,158,11,0.28);
    background: rgba(245,158,11,0.06);
  }
  .voice-state-label.state-speaking {
    color: #84cc16; border-color: rgba(132,204,22,0.28);
    background: rgba(132,204,22,0.06);
  }

  /* ── Voice prompt (primary CTA) ── */
  .voice-prompt {
    font-family: 'Sora', sans-serif;
    font-size: 17px; font-weight: 600;
    text-align: center; line-height: 1.5;
    padding: 0 16px; color: var(--text1);
    min-height: 48px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.3s ease;
  }
  .voice-prompt .dim { color: var(--text3); font-weight: 400; font-size: 13px; }

  /* ── Greeting hint — visually quiet, secondary ── */
  .voice-greeting {
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 400;
    color: var(--text3);
    text-align: center;
    padding: 4px 14px;
    background: rgba(124,92,255,0.06);
    border: 1px solid rgba(124,92,255,0.14);
    border-radius: 20px;
    margin-top: 2px;
    opacity: 0.8;
    animation: hint-breathe 4s ease-in-out infinite;
  }
  .voice-greeting strong { color: var(--accent); font-weight: 600; }
  @keyframes hint-breathe {
    0%, 100% { opacity: 0.65; border-color: rgba(124,92,255,0.14); }
    50%       { opacity: 1.0;  border-color: rgba(124,92,255,0.32); }
  }

  /* ── Speaking dots — animated ellipsis in speaking state ── */
  .voice-speak-dots {
    display: inline-flex; gap: 2px; align-items: flex-end;
    color: #84cc16; font-size: 18px; font-weight: 700;
    line-height: 1; margin-left: 2px;
  }
  .voice-speak-dots span {
    display: inline-block;
    animation: speak-dot 1.2s ease-in-out infinite;
    opacity: 0;
  }
  .voice-speak-dots span:nth-child(1) { animation-delay: 0s; }
  .voice-speak-dots span:nth-child(2) { animation-delay: 0.2s; }
  .voice-speak-dots span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes speak-dot {
    0%, 60%, 100% { opacity: 0; transform: translateY(0); }
    30%            { opacity: 1; transform: translateY(-3px); }
  }

  /* ── Controls ── */
  .voice-controls {
    display: flex; align-items: center; gap: 28px;
    margin-top: 16px;
  }

  .vc-btn {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
  }
  .vc-btn:hover  { background: var(--surface3); }
  .vc-btn:active { transform: scale(0.93); }
  .vc-btn svg { width: 18px; height: 18px; stroke: var(--text2); fill: none; }

  .mic-btn {
    width: 68px; height: 68px; border-radius: 50%;
    background: linear-gradient(135deg, #7c5cff 0%, #00e0ff 100%);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 26px rgba(124,92,255,0.5), 0 0 52px rgba(0,224,255,0.15);
    transition: transform 0.15s, box-shadow 0.25s;
    position: relative;
  }
  .mic-btn::after {
    content: '';
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.22) 0%, transparent 60%);
    pointer-events: none;
  }
  .mic-btn:hover  { transform: scale(1.06); box-shadow: 0 0 38px rgba(124,92,255,0.7), 0 0 72px rgba(0,224,255,0.24); }
  .mic-btn:active { transform: scale(0.94); }
  .mic-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 0 28px rgba(239,68,68,0.55), 0 0 56px rgba(239,68,68,0.18);
    animation: mic-active-pulse 1.4s ease-in-out infinite;
  }
  @keyframes mic-active-pulse {
    0%,100% { box-shadow: 0 0 28px rgba(239,68,68,0.55), 0 0 56px rgba(239,68,68,0.18); }
    50%     { box-shadow: 0 0 44px rgba(239,68,68,0.78), 0 0 80px rgba(239,68,68,0.28); }
  }
  .mic-btn svg { width: 26px; height: 26px; position: relative; z-index: 1; }

  .voice-call-btn {
    border: 1px solid rgba(148,163,184,0.28);
    background: rgba(15,23,42,0.68);
    color: #e2e8f0;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
  }
  .voice-call-btn:hover { background: rgba(30,41,59,0.9); }
  .voice-call-btn.active {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: transparent;
    color: #052e16;
    box-shadow: 0 0 18px rgba(34,197,94,0.38);
  }


  /* ===== CHAT SCREEN ===== */
  #chatScreen { min-height: 0; }

  #messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    display: flex; flex-direction: column; gap: 12px;
    scroll-behavior: smooth;
    background: var(--chat-bg-gradient);
    position: relative;
  }
  #messages::-webkit-scrollbar { display: none; }

  /* Date divider */
  .date-divider {
    text-align: center;
    font-size: 11px; color: var(--text3);
    margin: 4px 0;
    letter-spacing: 0.5px;
  }

  /* Message rows */
  .msg-row {
    display: flex; gap: 8px;
    animation: msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .msg-row.user { flex-direction: row-reverse; }

  @keyframes msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .msg-av {
    width: 30px; height: 30px; border-radius: 50%;
    flex-shrink: 0; align-self: flex-end;
    overflow: hidden; background: transparent;
  }
  .msg-av img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
    display: block;
  }
    background: linear-gradient(135deg, #7c5cff, #00e0ff, #ff4ecd);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    box-shadow: 0 0 14px rgba(124,92,255,0.5), 0 0 25px rgba(0,224,255,0.15);
  }
  .user-av {
    background: linear-gradient(135deg, #1e3a5f, #1d4ed8);
    font-size: 11px; font-weight: 600;
    color: white;
  }

  .bubble {
    max-width: 65%;
    padding: 11px 15px;
    border-radius: var(--radius-bubble);
    font-size: 14px; line-height: 1.6;
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease;
    font-weight: 400;
    font-family: 'DM Sans', sans-serif;
    will-change: transform, opacity;
  }

  .bot-bub {
    background: rgba(28, 18, 52, 0.95);
    /* backdrop-filter removed — solid bg is faster and looks identical */
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 2px solid rgba(0,224,255,0.55);
    border-bottom-left-radius: 5px;
    color: var(--text);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,224,255,0.04);
  }
  /* Typography balance inside bubbles */
  .bubble p        { margin: 0 0 6px; }
  .bubble p:last-child { margin-bottom: 0; padding-bottom: 2px; }
  .bubble strong   { font-weight: 600; }
  .bubble em       { opacity: 0.88; }
  .bubble code     { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 5px; }

  .user-bub {
    background: linear-gradient(135deg, #7c5cff, #ff4ecd);
    border-bottom-right-radius: 5px;
    color: white;
    box-shadow: 0 0 20px rgba(124,92,255,0.4), 0 0 40px rgba(255,78,205,0.15);
  }

  .bubble-time {
    font-size: 10px; color: var(--text3);
    margin-top: 4px;
    text-align: right;
  }
  .user-bub + .bubble-time { text-align: right; }

  /* Typing dots */
  .typing-bub {
    background: rgba(28, 18, 52, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-left: none;
    border-radius: var(--radius-bubble); border-bottom-left-radius: 5px;
    padding: 14px 18px;
    display: flex; gap: 5px; align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
  .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text3);
    animation: dot-bounce 1.2s infinite;
  }
  .dot:nth-child(2) { animation-delay: 0.2s; }
  .dot:nth-child(3) { animation-delay: 0.4s; }
  @keyframes dot-bounce {
    0%,60%,100% { transform: translateY(0); }
    30% { transform: translateY(-6px); background: #00e0ff; }
  }

  /* ===== MOOD CHIPS ===== */
  #moodBar {
    display: flex; gap: 6px;
    padding: 6px 16px 2px;
    overflow-x: auto; flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    /* fade edge right */
    mask-image: linear-gradient(to right, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
  }
  #moodBar::-webkit-scrollbar { display: none; }

  .chip {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    background: rgba(28, 18, 52, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.07);
    font-size: 11.5px; color: var(--text3);
    cursor: pointer; white-space: nowrap;
    transition: all 0.18s ease;
    flex-shrink: 0;
    font-weight: 500;
  }
  .chip:hover {
    border-color: rgba(124,92,255,0.4);
    background: rgba(124,92,255,0.1);
    color: #c4b5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,92,255,0.18);
  }
  .chip:active { transform: scale(0.96); }

  /* ===== INPUT BAR ===== */
  #inputBar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px 20px;
    flex-shrink: 0;
    background: rgba(13, 11, 26, 0.96);
    border-top: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    transition: background 0.3s ease;
  }

  .input-wrap {
    flex: 1;
    display: flex; align-items: center; gap: 8px;
    background: rgba(28, 18, 52, 0.85);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 24px;
    padding: 10px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .input-wrap:focus-within {
    border-color: rgba(124,92,255,0.6);
    box-shadow: 0 0 0 1px rgba(124,92,255,0.25), 0 0 20px rgba(124,92,255,0.15);
  }

  #userInput {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px; color: var(--text);
    resize: none; max-height: 80px;
  }
  #userInput::placeholder { color: var(--text3); }

  .voice-toggle {
    width: 28px; height: 28px; border-radius: 50%;
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .voice-toggle svg { width: 16px; height: 16px; stroke: var(--text3); fill: none; }
  .voice-toggle.active svg { stroke: var(--accent); }

  /* ── Camera / OCR button — more prominent ── */
  .camera-btn {
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(0, 224, 255, 0.08);
    border: 1px solid rgba(0, 224, 255, 0.2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
    position: relative;
  }
  .camera-btn svg { width: 16px; height: 16px; stroke: #00e0ff; fill: none; }
  .camera-btn:hover {
    background: rgba(0, 224, 255, 0.18);
    border-color: rgba(0, 224, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 224, 255, 0.3);
  }
  .camera-btn.scanning svg { stroke: #00e0ff; filter: drop-shadow(0 0 6px #00e0ff); animation: pulse-dot 0.8s infinite; }
  /* Tooltip label */
  .camera-btn::after {
    content: 'Snap & Solve 📚';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #00e0ff;
    font-size: 10px;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .camera-btn:hover::after { opacity: 1; }

  /* ── Voice Quick Toggle Button ── */
  .voice-quick-btn {
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(124, 92, 255, 0.08);
    border: 1px solid rgba(124, 92, 255, 0.2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
    position: relative;
  }
  .voice-quick-btn svg { width: 16px; height: 16px; stroke: #7c5cff; fill: none; }
  .voice-quick-btn:hover {
    background: rgba(124, 92, 255, 0.18);
    border-color: rgba(124, 92, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(124, 92, 255, 0.3);
  }
  .voice-quick-btn::after {
    content: 'Voice Mode 🎙️';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #7c5cff;
    font-size: 10px;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .voice-quick-btn:hover::after { opacity: 1; }

  .voice-quick-label {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .input-action-divider {
    width: 1px;
    align-self: stretch;
    margin: 2px 1px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.18), transparent);
    flex-shrink: 0;
  }

  /* ── Image Preview Bar ── */
  #imgPreviewBar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 0;
    background: var(--bg-input);
    flex-shrink: 0;
    animation: fadeInUp 0.2s ease;
  }
  #imgPreviewBar.active { display: flex; }
  #imgPreviewThumb {
    width: 52px; height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--accent);
    flex-shrink: 0;
  }
  .img-preview-info {
    flex: 1;
    font-size: 12px;
    color: var(--text2);
    line-height: 1.5;
  }
  .img-preview-info strong { color: var(--text); font-size: 13px; }
  .img-preview-dismiss {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.35);
    color: #ef4444;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .img-preview-dismiss:hover { background: rgba(239,68,68,0.28); }

  .send-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, #7c5cff, #a78bfa);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(124,92,255,0.45), 0 0 0 1px rgba(255,255,255,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .send-btn:hover {
    box-shadow: 0 0 22px rgba(167,139,250,0.65), 0 0 45px rgba(124,92,255,0.3), 0 4px 16px rgba(124,92,255,0.35);
    transform: scale(1.06);
  }
  .send-btn:active { transform: scale(0.96); box-shadow: 0 2px 8px rgba(124,92,255,0.3); }
  .send-btn svg { width: 18px; height: 18px; fill: white; }

  /* ===== MODE TOGGLE ===== */
  #modeToggle {
    position: absolute; top: 68px; right: 20px;
    background: rgba(12, 17, 32, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 8px 6px;
    display: none;
    flex-direction: column; gap: 1px;
    z-index: 100;
    box-shadow: 0 16px 50px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04), 0 0 30px rgba(124,92,255,0.12);
    animation: drop-in 0.22s cubic-bezier(0.34,1.2,0.64,1);
    min-width: 200px;
  }
  @keyframes drop-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  #modeToggle.open { display: flex; }

  .menu-section-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 6px 14px 3px;
    font-family: 'Sora', sans-serif;
  }

  .menu-section-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 4px 10px;
  }

  .mode-item {
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px; color: var(--text3);
    cursor: pointer;
    display: flex; align-items: center; gap: 9px;
    transition: background 0.13s, color 0.13s, transform 0.12s;
    white-space: nowrap;
    font-weight: 500;
  }
  .mode-item:hover  { background: rgba(255,255,255,0.05); color: var(--text); }
  .mode-item:active { transform: scale(0.96); background: rgba(255,255,255,0.08); }
  .mode-item.selected {
    color: #a78bfa;
    background: rgba(167,139,250,0.1);
    border-left: 1.5px solid rgba(167,139,250,0.7);
    box-shadow: inset 0 0 16px rgba(167,139,250,0.06), 0 0 12px rgba(167,139,250,0.12);
  }
  /* Desaturate emoji icons to muted until hover */
  .mode-item span { font-size: 15px; filter: saturate(0.4) brightness(0.9); transition: filter 0.13s; }
  .mode-item:hover span, .mode-item.selected span { filter: saturate(1) brightness(1); }

  /* ===== MEMORY BADGE ===== */
  .memory-badge {
    background: rgba(124,92,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(124,92,255,0.2);
    border-radius: 12px;
    padding: 7px 12px;
    font-size: 12px; color: #a78bfa;
    box-shadow: 0 0 12px rgba(124,92,255,0.1);
    margin: 0 16px 4px;
    display: none;
    align-items: center; gap: 6px;
    animation: msg-in 0.3s ease;
  }
  .memory-badge.show { display: flex; }
  .memory-badge svg { width: 13px; height: 13px; stroke: #a78bfa; fill: none; flex-shrink: 0; }

  /* ===== SCROLL FADE ===== */
  .scroll-fade {
    position: absolute; bottom: 150px; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--bg-app), transparent);
    pointer-events: none;
  }

  /* ===== MOOD / ORB REACTIONS ===== */
  :root {
    --mood-accent: #8B5CF6; /* updated by JS based on nexoraMood */
  }


  /* Gossip mode — neon flicker on header avatar */
  .gossip-active .header-avatar {
    animation: gossip-flicker 1.8s ease-in-out infinite;
  }
  @keyframes gossip-flicker {
    0%,100% { box-shadow: 0 0 18px rgba(124,92,255,0.6); }
    40%     { box-shadow: 0 0 30px rgba(255,78,205,0.9), 0 0 55px rgba(0,224,255,0.4); }
    60%     { box-shadow: 0 0 14px rgba(124,92,255,0.35); }
  }

  /* Idle ping bubble — soft pulse border */
  .msg-row.idle-ping .bubble {
    border-color: rgba(124,92,255,0.5) !important;
    animation: idle-border 2s ease-in-out 3;
  }
  @keyframes idle-border {
    0%,100% { border-color: rgba(124,92,255,0.4); }
    50%     { border-color: rgba(0,224,255,0.9); }
  }
  .resource-card {
    margin: 4px 0;
    background: rgba(239,68,68,0.08);
    border: 0.5px solid rgba(239,68,68,0.25);
    border-radius: 14px;
    padding: 10px 13px;
    font-size: 13px;
    color: #fca5a5;
    line-height: 1.5;
  }

  /* Answer cards for keyword matches */
  .answer-card {
    margin: 4px 0;
    background: rgba(28, 18, 52, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(124,92,255,0.06);
  }
  .answer-key {
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  /* ===== LIGHT MODE — Soft Day ===== */
  body.light-mode {
    /* Override all app-level tokens */
    --bg-app:      #F4F4FB;
    --bg-chat:     #F9FAFB;
    --bg-surface:  #FFFFFF;
    --bg-input:    #FFFFFF;
    --bg:          #F4F4FB;
    --surface:     #FFFFFF;
    --surface2:    #EDEDF5;
    --surface3:    #E4E4F0;

    --primary:      #7c5cff;
    --primary-dark: #4f35cc;
    --accent:       #00c8e8;
    --accent2:      #7c5cff;
    --accent-pink:  #ff4ecd;
    --accent-glow:  rgba(124,92,255,0.12);
    --accent-dim:   rgba(124,92,255,0.07);

    --text:        #111827;
    --text2:       #6B7280;
    --text3:       #9CA3AF;
    --border:      #E5E7EB;
    --border2:     #D1D5DB;
    --border-strong:#9CA3AF;

    --success:     #16A34A;
    --warning:     #D97706;
    --error:       #DC2626;

    --shadow-card: 0 14px 30px rgba(15,23,42,0.08);
    --shadow-glow: 0 0 0 transparent;
    --shadow-input: 0 10px 25px rgba(15,23,42,0.06);

    /* Chat area warm→cool gradient */
    --chat-bg-gradient: linear-gradient(180deg, #FDFDFE 0%, #F4F4FB 40%, #EEF2FF 100%);

    /* User bubble slightly softer in light mode */
    --user-bubble: linear-gradient(135deg, #A855F7, #F472B6);
  }

  body.light-mode #phone {
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04), var(--shadow-card), 0 0 40px rgba(139,92,246,0.06);
  }

  body.light-mode .bot-bub {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-left: 2px solid var(--primary);
  }

  body.light-mode .typing-bub {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-left: 2px solid var(--primary);
  }

  body.light-mode .user-bub {
    box-shadow: 0 4px 10px rgba(148,163,184,0.35);
  }

  body.light-mode .answer-card {
    background: #FFFFFF;
    border-color: #E5E7EB;
    box-shadow: 0 4px 12px rgba(15,23,42,0.06);
  }

  body.light-mode .resource-card {
    background: rgba(239,68,68,0.05);
    border-color: rgba(239,68,68,0.2);
  }

  body.light-mode #inputBar {
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
    box-shadow: 0 -10px 25px rgba(15,23,42,0.05);
  }

  body.light-mode .input-wrap {
    background: #FFFFFF;
    border-color: #D1D5DB;
  }

  body.light-mode .input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(6,182,212,0.5);
  }

  body.light-mode .search-result-item mark {
    background: rgba(139,92,246,0.15);
    color: var(--primary);
  }

  .light-mode .menu-section-label { color: rgba(0,0,0,0.3); }
  .light-mode .menu-section-divider { background: rgba(0,0,0,0.07); }
  .light-mode .mode-item { color: #6b7280; }
  .light-mode .mode-item:hover { background: rgba(0,0,0,0.04); color: #111827; }
  .light-mode #modeToggle {
    background: rgba(255,255,255,0.97);
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 16px 50px rgba(15,23,42,0.15);
  }
  .light-mode .status-ring { border-color: rgba(124,92,255,0.35); }
  .light-mode .status-dot-live { background: var(--success); }
  .light-mode .header-text p { color: var(--success); }

  /* ===== THEME TOGGLE BTN ===== */
  #themeToggle {
    width: 30px; height: 30px; border-radius: 10px;
    background: rgba(28, 18, 52, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 15px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s;
    flex-shrink: 0;
  }
  #themeToggle:hover { transform: scale(1.1); }
  #themeToggle:active { background: var(--surface3); }

  /* ===== EXPORT BUTTON ===== */
#exportBtn {
  position: absolute; bottom: 80px; right: 16px;
  width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(28, 18, 52, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.15s;
}
#exportBtn { display: none !important; }
#exportBtn.visible { opacity: 1; pointer-events: auto; }
#exportBtn:active { transform: scale(0.92); }

  /* ===== SCROLL TO BOTTOM BTN ===== */
  #scrollBtn {
    position: absolute; bottom: 130px; right: 16px;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(28, 18, 52, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
  }
  #scrollBtn.visible { opacity: 1; pointer-events: auto; }

  /* ===== READ RECEIPT ===== */
  .read-receipt {
    font-size: 10px; color: var(--accent2);
    text-align: right;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.4s ease 0.8s;
    letter-spacing: 0.3px;
  }
  .read-receipt.shown { opacity: 1; }

  /* ===== COPY TOAST ===== */
  #copyToast {
    position: absolute;
    bottom: 160px; left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: linear-gradient(135deg, rgba(124,92,255,0.95), rgba(0,224,255,0.9));
    color: white;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
  }
  #copyToast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  /* ===== CONTEXT CHIPS (after bot reply) ===== */
  .context-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 0 16px 6px;
    animation: msg-in 0.3s ease;
  }
  .ctx-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border2);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    white-space: nowrap;
  }
  .ctx-chip:hover { transform: scale(1.02); }
  .ctx-chip:active { background: var(--surface3); }

  /* ===== SEARCH BAR ===== */
  #searchOverlay {
    position: absolute; inset: 0;
    background: var(--bg);
    z-index: 50;
    display: none; flex-direction: column;
    padding: 14px 16px;
    gap: 12px;
  }
  #searchOverlay.open { display: flex; }
  .search-header {
    display: flex; align-items: center; gap: 10px;
  }
  #searchInput {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 10px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    outline: none;
  }
  #searchInput::placeholder { color: var(--text3); }
  .search-close {
    width: 36px; height: 36px; border-radius: 12px;
    background: var(--surface2); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; color: var(--text2);
  }
  #searchResults {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
  }
  .search-result-item {
    background: var(--surface2);
    border: 0.5px solid var(--border);
    border-radius: 14px;
    padding: 10px 13px;
    font-size: 13px;
    color: var(--text2);
    line-height: 1.5;
  }
  .search-result-item mark {
    background: rgba(139,92,246,0.2);
    color: var(--primary);
    border-radius: 3px;
  }
  .search-no-result {
    text-align: center; color: var(--text3);
    font-size: 13px; margin-top: 30px;
  }

  /* ===== BUBBLE COPY HINT ===== */
  .bot-bub { cursor: pointer; }
  .bot-bub:active { opacity: 0.8; }

  /* ── Streaming cursor — blinks while tokens arrive ── */
  .stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    border-radius: 1px;
    animation: stream-blink 0.7s ease-in-out infinite;
  }
  @keyframes stream-blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0; }
  }

  /* ===== AI STATUS BADGE ===== */
  .ai-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 500; letter-spacing: 0.4px;
    padding: 2px 8px; border-radius: 10px;
    border: 0.5px solid var(--border2);
    margin-left: 4px;
    vertical-align: middle;
  }
  .ai-badge.online  { background: rgba(34,197,94,0.12); color: #22c55e; border-color: rgba(34,197,94,0.3); }
  .ai-badge.no-key {
    background: rgba(255, 184, 48, 0.15);
    border: 1px solid rgba(255, 184, 48, 0.35);
    color: #ffb830;
    animation: none;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex; align-items: center; gap: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
  }
  .ai-badge.no-key:hover {
    background: rgba(255, 184, 48, 0.25);
    box-shadow: 0 0 12px rgba(255, 184, 48, 0.3);
  }
  .ai-badge.offline { background: rgba(148,163,184,0.12); color: var(--text3); }
  .ai-badge .ai-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

  /* ===== API KEY SETUP PANEL ===== */
  #apiPanel {
    position: absolute; inset: 0;
    background: var(--bg);
    z-index: 60;
    display: none; flex-direction: column;
    padding: 20px 20px 16px;
    gap: 14px;
    overflow-y: auto;
  }
  #apiPanel.open { display: flex; }

  /* ── Tab switcher ── */
  .key-tabs {
    display: flex; gap: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 14px; padding: 4px;
    flex-shrink: 0;
  }
  .key-tab {
    flex: 1; padding: 8px 6px;
    border-radius: 10px; border: none;
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 600;
    cursor: pointer; text-align: center;
    background: transparent; color: var(--text3);
    transition: all 0.18s;
    display: flex; align-items: center; justify-content: center; gap: 4px;
  }
  .key-tab.active {
    background: var(--surface3);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  .key-tab .tab-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text3); flex-shrink: 0;
  }
  .key-tab.active .tab-dot { background: var(--success); box-shadow: 0 0 6px rgba(0,229,160,0.6); }
  .key-pane { display: none; flex-direction: column; gap: 12px; }
  .key-pane.active { display: flex; }
  .api-panel-title {
    font-family: 'Sora', sans-serif;
    font-size: 17px; font-weight: 600;
    color: var(--text);
  }
  .api-panel-sub {
    font-size: 13px; color: var(--text2); line-height: 1.6;
    margin-top: -8px;
  }
  .api-panel-sub a { color: var(--accent); }
  .api-input-wrap {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
  }
  #apiKeyInput {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; color: var(--text);
    letter-spacing: 0.5px;
  }
  #apiKeyInput::placeholder { color: var(--text3); }
  .api-save-btn {
    width: 100%; padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    border: none; cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 14px; font-weight: 500; color: white;
    box-shadow: 0 6px 24px rgba(139,92,246,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .api-save-btn:hover { box-shadow: 0 0 24px rgba(139,92,246,0.5), 0 6px 20px rgba(139,92,246,0.3); }
  .api-save-btn:active { transform: scale(0.98); }
  .api-close-btn {
    background: none; border: none; cursor: pointer;
    font-size: 13px; color: var(--text3);
    text-align: center; text-decoration: underline;
  }
  .api-status-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2);
    border: 0.5px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px; color: var(--text2);
  }
  .api-model-tag {
    font-size: 11px; color: var(--accent2);
    background: var(--accent-dim);
    padding: 2px 8px; border-radius: 8px;
    margin-left: auto;
  }
  .api-remove-btn {
    width: 100%; padding: 13px;
    border-radius: 16px;
    background: transparent;
    border: 1px solid rgba(239,68,68,0.4);
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 14px; font-weight: 500;
    color: #f87171;
    transition: background 0.15s, transform 0.15s;
  }
  .api-remove-btn:active { transform: scale(0.98); background: rgba(239,68,68,0.08); }
  .api-remove-btn:hover  { background: rgba(239,68,68,0.08); }
  .api-warn-row {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 12px; color: #fbbf24;
    background: rgba(251,191,36,0.08);
    border: 0.5px solid rgba(251,191,36,0.25);
    border-radius: 12px;
    padding: 10px 13px;
    line-height: 1.5;
  }
  .api-warn-row strong { color: #f59e0b; }

  /* ═══ PREMIUM: Particle shimmer on phone shell ═══ */
  #phone::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg,
      rgba(124,92,255,0.03) 0%,
      transparent 40%,
      rgba(0,224,255,0.03) 70%,
      transparent 100%);
    pointer-events: none;
    z-index: 0;
    animation: phone-shimmer 8s ease-in-out infinite alternate;
  }
  @keyframes phone-shimmer {
    0%   { opacity: 0.5; transform: translateY(0); }
    100% { opacity: 1;   transform: translateY(-4px); }
  }

  /* ═══ PREMIUM: Gradient border glow on phone ═══ */
  #phone {
    position: relative;
  }
  #phone::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 29px;
    background: linear-gradient(135deg, rgba(124,92,255,0.4), rgba(0,224,255,0.2), rgba(255,78,205,0.2), rgba(124,92,255,0.4));
    z-index: -1;
    animation: border-rotate 6s linear infinite;
    background-size: 300% 300%;
  }
  @keyframes border-rotate {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }

  /* ═══ PREMIUM: Glow line under header ═══ */
  #header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,92,255,0.4), rgba(0,224,255,0.3), transparent);
  }

  /* ═══ Nexora title — cyan/white gradient matching the logo ═══ */
  .header-text h2 {
    background: linear-gradient(135deg, #ffffff 20%, #67e8f9 60%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* ═══ PREMIUM: Glow hover on bubble ═══ */
  .bot-bub:hover {
    border-color: rgba(0,224,255,0.25) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 12px rgba(0,224,255,0.1) !important;
    transition: all 0.3s ease;
  }
  .user-bub:hover {
    box-shadow: 0 0 28px rgba(124,92,255,0.55), 0 0 50px rgba(255,78,205,0.2) !important;
    transition: all 0.3s ease;
  }

  /* ═══ PREMIUM: Smooth message pop-in ═══ */
  @keyframes msg-in {
    from { opacity: 0; transform: translateY(16px) scale(0.93); filter: blur(2px); }
    to   { opacity: 1; transform: translateY(0) scale(1);      filter: blur(0); }
  }

  /* ═══ PREMIUM: Floating scroll btn glow ═══ */
  #scrollBtn.visible {
    box-shadow: 0 0 14px rgba(124,92,255,0.4);
    border-color: rgba(124,92,255,0.3) !important;
  }

  /* ═══ PREMIUM: Input bar top gradient line ═══ */
  #imgPreviewBar, #inputBar {
    position: relative;
  }
  #inputBar::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,92,255,0.35), rgba(0,224,255,0.25), transparent);
  }

  /* ═══ PREMIUM: Voice screen gradient bg ═══ */
  #voiceScreen {
    background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(124,92,255,0.08) 0%, transparent 70%);
  }


/* Source style block 2 */
/* ── Compare Panel Overlay ── */
  #comparePanel {
    position: absolute; inset: 0;
    background: var(--bg-app);
    z-index: 500;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: drop-in 0.25s cubic-bezier(.16,1,.3,1);
  }
  #comparePanel.open { display: flex; }

  .cmp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
  }
  .cmp-header h3 {
    font-family: 'Sora', sans-serif;
    font-size: 14px; font-weight: 600;
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .cmp-close {
    background: rgba(255,255,255,0.07); border: 1px solid var(--border);
    color: var(--text2); border-radius: 10px;
    padding: 5px 10px; font-size: 12px; cursor: pointer;
    transition: background 0.15s;
  }
  .cmp-close:hover { background: rgba(255,255,255,0.12); }

  /* ── Model Toggles ── */
  .cmp-models {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(13,11,26,0.6);
  }
  .cmp-model-chip {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border2);
    color: var(--text2);
    background: rgba(28,18,52,0.7);
    transition: all 0.2s;
    user-select: none;
    flex-wrap: nowrap;
  }
  .cmp-model-chip.active {
    border-color: rgba(124,92,255,0.6);
    background: rgba(124,92,255,0.15);
    color: #c4b5fd;
  }
  .cmp-model-chip .chip-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text3); flex-shrink: 0;
  }
  .cmp-model-chip.active .chip-dot { background: #7c5cff; box-shadow: 0 0 6px rgba(124,92,255,0.8); }

  /* ── Results Area ── */
  #cmpResults {
    flex: 1; overflow-y: auto; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 10px;
  }
  #cmpResults::-webkit-scrollbar { width: 3px; }
  #cmpResults::-webkit-scrollbar-thumb { background: rgba(124,92,255,0.3); border-radius: 4px; }

  .cmp-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text3); font-size: 13px; gap: 10px;
    text-align: center; padding: 20px;
  }
  .cmp-empty .cmp-icon { font-size: 38px; }

  /* ── Result Card ── */
  .cmp-card {
    background: rgba(28,18,52,0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    overflow: hidden;
    animation: msg-in 0.3s ease;
  }
  .cmp-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 13px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
  }
  .cmp-card-head .cmp-model-label {
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--text3);
  }
  .cmp-card-head .cmp-status {
    font-size: 11px; color: var(--text3);
    display: flex; align-items: center; gap: 5px;
  }
  .cmp-card-body {
    padding: 11px 13px;
    font-size: 13px; line-height: 1.6; color: var(--text);
  }

  /* ── Markdown rendering inside compare cards ── */
  .cmp-card-body p { margin: 0 0 8px 0; }
  .cmp-card-body p:last-child { margin-bottom: 0; }
  .cmp-card-body h1, .cmp-card-body h2, .cmp-card-body h3,
  .cmp-card-body h4, .cmp-card-body h5 {
    font-family: 'Sora', sans-serif;
    font-weight: 600; margin: 10px 0 5px 0;
    color: var(--text);
  }
  .cmp-card-body h1 { font-size: 16px; }
  .cmp-card-body h2 { font-size: 15px; }
  .cmp-card-body h3 { font-size: 14px; }
  .cmp-card-body ul, .cmp-card-body ol {
    padding-left: 18px; margin: 6px 0;
  }
  .cmp-card-body li { margin: 3px 0; }
  .cmp-card-body strong { color: var(--text); font-weight: 600; }
  .cmp-card-body em { color: var(--text2); font-style: italic; }
  .cmp-card-body code:not(.hljs) {
    background: rgba(124,92,255,0.15);
    border: 1px solid rgba(124,92,255,0.2);
    border-radius: 5px;
    padding: 1px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: #a78bfa;
  }
  .cmp-card-body .code-block-wrapper {
    margin: 8px 0;
  }
  .cmp-card-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 8px 0;
    padding: 4px 12px;
    color: var(--text2);
    font-style: italic;
    background: rgba(0,224,255,0.04);
    border-radius: 0 8px 8px 0;
  }
  .cmp-card-body table {
    border-collapse: collapse;
    font-size: 12px;
    width: 100%;
  }
  .cmp-card-body th, .cmp-card-body td {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 10px;
    text-align: left;
  }
  .cmp-card-body th {
    background: rgba(124,92,255,0.12);
    font-weight: 600;
  }
  .cmp-card-body hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 10px 0;
  }

  .cmp-card.loading .cmp-card-body {
    display: flex; gap: 5px; align-items: center;
  }
  .cmp-card.success { border-left: 2px solid #00e0ff; }
  .cmp-card.error   { border-left: 2px solid var(--error); opacity: 0.75; }
  .cmp-card.nexora  { border-left: 2px solid #7c5cff; }

  /* Copy btn on card */
  .cmp-copy-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--text3); border-radius: 8px;
    padding: 3px 9px; font-size: 11px;
    cursor: pointer; transition: all 0.15s;
  }
  .cmp-copy-btn:hover { background: var(--surface3); color: var(--text); }

  /* ── Specialty Badges ── */
  .chip-name { font-weight: 500; }
  .chip-tag {
    font-size: 9px; font-weight: 600;
    padding: 2px 6px; border-radius: 6px;
    text-transform: uppercase; letter-spacing: 0.4px;
    line-height: 1.3; flex-shrink: 0;
  }
  .tag-bestie  { background: rgba(124,92,255,0.2); color: #c4b5fd; }
  .tag-logic   { background: rgba(0,224,255,0.15); color: #67e8f9; }
  .tag-creative{ background: rgba(16,185,129,0.18); color: #6ee7b7; }
  .tag-fast    { background: rgba(245,158,11,0.18); color: #fcd34d; }
  .tag-summary { background: rgba(167,139,250,0.18); color: #c4b5fd; }
  .tag-soon    { background: rgba(255,255,255,0.07); color: var(--text3); }

  /* ── Coming Soon chips ── */
  .cmp-model-chip.coming-soon {
    opacity: 0.55;
    cursor: default;
    border-style: dashed;
    border-color: rgba(255,255,255,0.1);
  }
  .cmp-model-chip.coming-soon:hover { background: rgba(28,18,52,0.7); }
  .cmp-model-chip.coming-soon .chip-dot { background: var(--text3) !important; box-shadow: none !important; }
  .lock-icon { font-size: 9px; opacity: 0.5; }

  /* ── Coming Soon card ── */
  .cmp-card.coming-soon-card {
    border: 1px dashed rgba(255,255,255,0.1);
    background: rgba(28,18,52,0.4);
    opacity: 0.7;
    position: relative;
    overflow: hidden;
  }
  .cmp-card.coming-soon-card::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.015) 8px,
      rgba(255,255,255,0.015) 16px
    );
    pointer-events: none;
  }
  .coming-soon-body {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 18px 14px; gap: 6px; text-align: center;
  }
  .coming-soon-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(124,92,255,0.15);
    border: 1px solid rgba(124,92,255,0.3);
    border-radius: 20px; padding: 4px 10px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
    color: #a78bfa; text-transform: uppercase;
  }
  .coming-soon-desc {
    font-size: 12px; color: var(--text3); line-height: 1.5;
  }

  /* ── Card head upgrade ── */
  .cmp-head-left {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  }
  .cmp-model-icon { font-size: 14px; flex-shrink: 0; }

  /* ── Question header ── */
  .cmp-q-header {
    background: linear-gradient(135deg,rgba(124,92,255,0.15),rgba(0,224,255,0.1));
    border: 1px solid rgba(124,92,255,0.25);
    border-radius: 14px; padding: 10px 14px;
    font-size: 13px; color: var(--text);
    line-height: 1.5; animation: msg-in 0.3s ease;
  }
  .cmp-q-label {
    font-size: 10px; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.5px;
    display: block; margin-bottom: 5px;
  }

  /* ── Image thumbnail inside question header ── */
  .cmp-q-img-wrap {
    margin: 6px 0 4px;
  }
  .cmp-q-thumb {
    width: 88px; height: 88px; object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(124,92,255,0.4);
    display: block;
    box-shadow: 0 2px 12px rgba(124,92,255,0.25);
  }
  .cmp-q-text {
    margin-top: 6px;
    font-size: 13px; color: var(--text);
    line-height: 1.5; word-break: break-word;
  }

  /* ── Question group — wraps one question + all its answer cards ── */
  .cmp-group {
    display: flex; flex-direction: column; gap: 8px;
  }
  .cmp-group + .cmp-group {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.07);
  }

  /* ── Final Verdict button ── */
  .cmp-verdict-btn {
    width: 100%; padding: 13px 16px;
    background: linear-gradient(135deg, rgba(124,92,255,0.9), rgba(0,224,255,0.8));
    border: none; border-radius: 14px;
    color: white; font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer; letter-spacing: 0.2px;
    box-shadow: 0 4px 20px rgba(124,92,255,0.4), 0 0 40px rgba(0,224,255,0.1);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    animation: msg-in 0.35s ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
  }
  .cmp-verdict-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 6px 28px rgba(124,92,255,0.6), 0 0 50px rgba(0,224,255,0.2);
  }
  .cmp-verdict-btn:active:not(:disabled) { transform: scale(0.97); }
  .cmp-verdict-btn:disabled { cursor: default; }

  /* ── Final Verdict card ── */
  .cmp-verdict-card {
    background: linear-gradient(135deg, rgba(124,92,255,0.12), rgba(0,224,255,0.07));
    border: 1px solid rgba(124,92,255,0.3);
    border-radius: 16px; overflow: hidden;
    animation: msg-in 0.4s ease;
    box-shadow: 0 0 30px rgba(124,92,255,0.15);
  }
  .vd-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(124,92,255,0.2);
    background: rgba(124,92,255,0.1);
  }
  .vd-title {
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    background: linear-gradient(135deg, #a78bfa, #67e8f9);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .vd-body { padding: 12px 14px; }
  .vd-body p { font-size: 13px; line-height: 1.6; color: var(--text); margin-bottom: 8px; }
  .vd-body p:last-child { margin-bottom: 0; }
  .vd-agreement { color: var(--text2) !important; font-size: 12px !important; }
  .vd-clarity   { color: var(--accent) !important; font-size: 12px !important; }
  .vd-best {
    background: rgba(124,92,255,0.08);
    border-left: 2px solid #7c5cff;
    border-radius: 0 10px 10px 0;
    padding: 8px 10px !important;
    font-weight: 500 !important;
  }

  body.light-mode .cmp-verdict-card { background: linear-gradient(135deg,rgba(124,92,255,0.06),rgba(0,224,255,0.04)); }
  body.light-mode .vd-body p { color: #111827; }
  body.light-mode .vd-best { background: rgba(124,92,255,0.05); }

  /* ── Compare Input Bar ── */
  #cmpInputBar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px 14px;
    flex-shrink: 0;
    background: rgba(13,11,26,0.92);
    border-top: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 -6px 24px rgba(0,0,0,0.35);
  }
  #cmpInputBar .input-wrap { flex: 1; }

  /* ── Camera & Mic buttons — iOS-style rounded-square icon buttons ── */
  #cmpCameraBtn, #cmpMicBtn {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: rgba(14, 22, 40, 0.85);
    border: 1.5px solid rgba(0, 224, 255, 0.18);
    cursor: pointer;
    color: var(--text3);
    transition: all 0.2s cubic-bezier(.16,1,.3,1);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    position: relative;
  }
  #cmpCameraBtn:hover {
    color: #00e0ff;
    border-color: rgba(0, 224, 255, 0.55);
    background: rgba(0, 224, 255, 0.08);
    box-shadow: 0 0 18px rgba(0,224,255,0.25), 0 2px 12px rgba(0,0,0,0.3);
    transform: scale(1.06);
  }
  #cmpMicBtn:hover {
    color: #a78bfa;
    border-color: rgba(124,92,255,0.55);
    background: rgba(124,92,255,0.1);
    box-shadow: 0 0 18px rgba(124,92,255,0.25), 0 2px 12px rgba(0,0,0,0.3);
    transform: scale(1.06);
  }
  /* Camera active — image is loaded */
  #cmpCameraBtn.has-image {
    color: #00e0ff;
    border-color: rgba(0,224,255,0.7);
    background: rgba(0,224,255,0.12);
    box-shadow: 0 0 22px rgba(0,224,255,0.35), inset 0 0 10px rgba(0,224,255,0.07);
  }
  /* Mic active — recording */
  #cmpMicBtn.active {
    color: #f87171;
    border-color: rgba(248,113,113,0.6);
    background: rgba(248,113,113,0.1);
    box-shadow: 0 0 22px rgba(248,113,113,0.3), inset 0 0 10px rgba(248,113,113,0.07);
    animation: mic-pulse 1s ease-in-out infinite;
  }
  @keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 22px rgba(248,113,113,0.3), inset 0 0 10px rgba(248,113,113,0.07); }
    50%       { box-shadow: 0 0 34px rgba(248,113,113,0.55), inset 0 0 14px rgba(248,113,113,0.12); }
  }

  /* ── Mic listening overlay — sits over the compare panel content ── */
  #cmpMicOverlay {
    display: none;
    position: absolute; inset: 0;
    z-index: 120;
    background: rgba(7,11,22,0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center; justify-content: center;
    border-radius: inherit;
  }
  #cmpMicOverlay.active { display: flex; }

  #cmpMicOverlayInner {
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
    padding: 32px 24px;
    text-align: center;
  }

  /* Animated wave bars */
  #cmpMicWaveWrap {
    display: flex; align-items: center; gap: 5px;
    height: 48px;
  }
  .cmp-mic-wave-bar {
    width: 5px; border-radius: 4px;
    background: #f87171;
    animation: cmp-wave 1.1s ease-in-out infinite;
    transform-origin: bottom;
  }
  .cmp-mic-wave-bar:nth-child(1) { height: 18px; animation-delay: 0s;    }
  .cmp-mic-wave-bar:nth-child(2) { height: 32px; animation-delay: 0.15s; }
  .cmp-mic-wave-bar:nth-child(3) { height: 44px; animation-delay: 0.3s;  }
  .cmp-mic-wave-bar:nth-child(4) { height: 32px; animation-delay: 0.15s; }
  .cmp-mic-wave-bar:nth-child(5) { height: 18px; animation-delay: 0s;    }
  @keyframes cmp-wave {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50%       { transform: scaleY(1);   opacity: 1;   }
  }

  /* Status text */
  #cmpMicStatus {
    font-size: 14px; font-weight: 600;
    color: #f87171; letter-spacing: 0.3px;
  }

  /* Live interim transcript */
  #cmpMicInterim {
    min-height: 24px;
    font-size: 13px; color: var(--text2);
    font-style: italic; max-width: 320px;
    line-height: 1.5; opacity: 0.85;
  }

  #cmpMicCancelBtn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text3); cursor: pointer;
    font-size: 12px; padding: 7px 18px;
    border-radius: 20px; margin-top: 4px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
  }
  #cmpMicCancelBtn:hover {
    background: rgba(248,113,113,0.12);
    border-color: rgba(248,113,113,0.4);
    color: #f87171;
  }

  /* Make #comparePanel position:relative so overlay can absolute-fill it */
  #comparePanel { position: relative; }

  /* ── Export button — lives in .cmp-header ── */
  #cmpExportBtn {
    background: none;
    border: 1px solid rgba(124,92,255,0.25);
    cursor: pointer; font-size: 11px;
    color: var(--text2); padding: 5px 10px;
    border-radius: 10px; font-family: 'DM Sans', sans-serif;
    transition: all 0.2s; white-space: nowrap; flex-shrink: 0;
  }
  #cmpExportBtn:hover {
    background: rgba(124,92,255,0.12);
    color: var(--accent);
    border-color: rgba(124,92,255,0.5);
  }

  @media (max-width: 720px) {
    .cmp-header {
      flex-wrap: wrap;
      align-items: flex-start;
      gap: 8px;
    }
    .cmp-header h3 {
      flex: 1 1 100%;
    }
    #cmpInputBar {
      flex-wrap: wrap;
      gap: 8px;
    }
    #cmpInputBar .input-wrap {
      order: 1;
      width: 100%;
    }
    #cmpInputBar .cmp-clear-btn {
      order: 2;
    }
    #cmpInputBar .send-btn {
      order: 3;
      margin-left: auto;
    }
  }

  /* ── Image preview bar — full-width strip above #cmpInputBar ── */
  #cmpImgPreviewBar {
    display: none; align-items: center; gap: 10px;
    padding: 8px 14px; flex-shrink: 0;
    background: rgba(124,92,255,0.08);
    border-top: 1px solid rgba(124,92,255,0.18);
    border-bottom: 1px solid rgba(124,92,255,0.12);
  }
  #cmpImgPreviewBar.active { display: flex; }
  #cmpImgPreviewThumb {
    width: 52px; height: 52px; object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(124,92,255,0.35);
    flex-shrink: 0;
  }
  #cmpImgPreviewLabel {
    flex: 1; font-size: 12px; color: var(--text2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #cmpImgDismissBtn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text3); line-height: 1;
    padding: 4px; border-radius: 6px; transition: color 0.2s;
  }
  #cmpImgDismissBtn:hover { color: #f87171; }

  /* ── Vote buttons ── */
  .cmp-vote-wrap { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; }
  .cmp-vote-btn  {
    background: none; border: none; cursor: pointer; font-size: 14px;
    opacity: 0.45; transition: opacity 0.15s, transform 0.15s;
    line-height: 1; padding: 1px 2px;
  }
  .cmp-vote-btn:hover { opacity: 1; transform: scale(1.2); }
  .cmp-vote-btn.active { opacity: 1; }
  .cmp-vote-tally { font-size: 11px; opacity: 0.7; }
  .cmp-vote-lifetime {
    margin-left: 4px; font-size: 10px; opacity: 0.45;
    padding: 1px 5px; border-radius: 5px;
    background: rgba(255,255,255,0.05);
  }

  /* ── Auto-Diff card ── */
  .cmp-diff-card {
    background: rgba(14,20,36,0.7);
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 14px; padding: 14px 16px; margin-top: 10px;
  }
  .cmp-diff-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
  .cmp-diff-title  { font-size: 13px; font-weight: 700; color: #67e8f9; }
  .cmp-diff-sub    { font-size: 11px; color: var(--text3); }
  .cmp-diff-body   { display: flex; flex-direction: column; gap: 8px; }
  .diff-row        { display: flex; gap: 10px; font-size: 12px; line-height: 1.5; }
  .diff-label      {
    font-weight: 700; font-size: 11px; color: var(--text2);
    white-space: nowrap; min-width: 90px; padding-top: 1px;
  }
  .diff-text       { color: var(--text1); flex: 1; }
  .diff-agree    .diff-label { color: #6ee7b7; }
  .diff-disagree .diff-label { color: #fca5a5; }
  .diff-unique   .diff-label { color: #a78bfa; }
  .diff-best     .diff-label { color: #fcd34d; }
  #cmpInput {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px; color: var(--text);
    resize: none; max-height: 80px;
  }
  #cmpInput::placeholder { color: var(--text3); }

  /* ── Tip strip ── */
  .cmp-tip {
    padding: 7px 16px;
    font-size: 11px; color: var(--text3);
    text-align: center;
    background: rgba(124,92,255,0.05);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    line-height: 1.5;
  }

  /* ── Key-locked chip (neutral, not broken) ── */
  .cmp-model-chip.key-locked {
    opacity: 0.65;
    border-style: dashed;
    border-color: rgba(255,255,255,0.15);
    cursor: pointer;
  }
  .cmp-model-chip.key-locked:hover {
    opacity: 0.85;
    background: rgba(124,92,255,0.08);
    border-color: rgba(124,92,255,0.35);
  }
  .cmp-model-chip.key-locked .chip-dot { background: var(--text3) !important; box-shadow: none !important; }

  /* ── Key-unlocked chip (has key, behaves like free chips) ── */
  .cmp-model-chip.key-unlocked {
    opacity: 1;
    border-style: solid;
  }
  .cmp-model-chip.key-unlocked.active {
    border-color: rgba(124,92,255,0.6);
    background: rgba(124,92,255,0.15);
    color: #c4b5fd;
  }
  .cmp-model-chip.key-unlocked.active .chip-dot { background: #7c5cff; box-shadow: 0 0 6px rgba(124,92,255,0.8); }

  /* ── Key button on chip ── */
  .chip-key-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--text3);
    font-size: 10px;
    padding: 2px 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    line-height: 1.4;
  }
  .chip-key-btn:hover { background: rgba(124,92,255,0.2); border-color: rgba(124,92,255,0.4); color: #c4b5fd; }
  .cmp-model-chip.key-unlocked .chip-key-btn { color: var(--success); border-color: rgba(0,229,160,0.3); }

  /* ── New specialty tag colors ── */
  .tag-grok         { background: rgba(34,211,238,0.15); color: #67e8f9; }
  .tag-chatgpt      { background: rgba(16,163,127,0.18); color: #6ee7b7; }
  .tag-claude       { background: rgba(217,119,6,0.18);  color: #fcd34d; }
  .tag-pplx         { background: rgba(34,211,238,0.15); color: #a5f3fc; }
  .tag-groq         { background: rgba(249,115,22,0.15); color: #fdba74; }
  .tag-groq-active  { background: rgba(0,229,160,0.18);  color: #6ee7b7; font-weight:700; }

  /* ── New free model tags ── */
  .tag-reasoning    { background: rgba(168,85,247,0.18); color: #d8b4fe; }
  .tag-speed        { background: rgba(251,146,60,0.18); color: #fdba74; }
  .tag-code         { background: rgba(34,197,94,0.18);  color: #86efac; }
  .tag-search       { background: rgba(14,165,233,0.18); color: #7dd3fc; }
  .tag-cf           { background: rgba(249,115,22,0.22); color: #fb923c; }
  .tag-cf-active    { background: rgba(249,115,22,0.35); color: #fed7aa; font-weight:700; }

  /* ── Cloudflare AI section divider ── */
  .cmp-section-divider {
    width: 100%;
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0 2px;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--text3);
    flex-basis: 100%;
    flex-shrink: 0;
  }
  .cmp-section-divider::before,
  .cmp-section-divider::after {
    content: '';
    flex: 1; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  }
  .cmp-section-divider.cf-divider { color: #fb923c; }
  .cmp-section-divider.cf-divider::before,
  .cmp-section-divider.cf-divider::after {
    background: linear-gradient(90deg, transparent, rgba(249,115,22,0.3), transparent);
  }

  /* ── CF Worker URL input panel ── */
  #cfWorkerPanel {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(249,115,22,0.2);
    animation: drop-in 0.2s ease;
    display: none;
  }
  #cfWorkerPanel.open { display: block; }
  .cf-panel-inner {
    background: rgba(17,12,6,0.97);
    backdrop-filter: blur(16px);
    padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
    border-top: 1px solid rgba(249,115,22,0.15);
  }
  .cf-panel-title {
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    background: linear-gradient(135deg, #fb923c, #fbbf24);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .cf-panel-sub {
    font-size: 11px; color: var(--text3);
    line-height: 1.6;
  }
  .cf-panel-sub a { color: #fb923c; text-decoration: none; }
  .cf-panel-sub a:hover { text-decoration: underline; }
  .cf-panel-steps {
    font-size: 11px; color: var(--text3);
    background: rgba(249,115,22,0.06);
    border: 1px solid rgba(249,115,22,0.15);
    border-radius: 10px; padding: 9px 11px;
    line-height: 1.8;
  }
  .cf-panel-steps b { color: #fb923c; }
  .cf-input-row { display: flex; gap: 6px; align-items: center; }
  .cf-url-input {
    flex: 1;
    background: rgba(28,18,52,0.8);
    border: 1px solid rgba(249,115,22,0.25);
    border-radius: 10px; padding: 8px 12px;
    font-size: 12px; color: var(--text);
    font-family: 'DM Sans', sans-serif; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .cf-url-input:focus {
    border-color: rgba(249,115,22,0.6);
    box-shadow: 0 0 0 1px rgba(249,115,22,0.2);
  }
  .cf-save-btn {
    background: linear-gradient(135deg, #fb923c, #f59e0b);
    border: none; border-radius: 10px;
    color: white; font-size: 12px; font-weight: 600;
    padding: 8px 14px; cursor: pointer;
    font-family: 'Sora', sans-serif;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .cf-save-btn:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(249,115,22,0.4); }
  .cf-remove-btn {
    background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px; color: #f87171; font-size: 12px;
    padding: 8px 10px; cursor: pointer; flex-shrink: 0;
    transition: background 0.15s;
  }
  .cf-remove-btn:hover { background: rgba(239,68,68,0.22); }
  .cf-test-status {
    font-size: 11px; min-height: 16px;
    transition: color 0.3s;
  }
  .cf-test-status.ok  { color: var(--success); }
  .cf-test-status.err { color: var(--error); }
  .cf-close-btn {
    align-self: flex-end;
    background: transparent; border: 1px solid var(--border);
    border-radius: 8px; color: var(--text3); font-size: 11px;
    padding: 4px 10px; cursor: pointer; transition: background 0.15s;
    margin-top: -2px;
  }
  .cf-close-btn:hover { background: var(--surface3); color: var(--text); }

  /* ── Key Input Modal ── */
  .cmp-key-modal {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    animation: drop-in 0.2s ease;
  }
  .cmp-key-modal-inner {
    background: rgba(14,19,34,0.97);
    backdrop-filter: blur(16px);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .cmp-key-modal-title {
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .cmp-key-modal-sub {
    font-size: 11px; color: var(--text3);
    display: flex; flex-direction: column; gap: 3px;
  }
  .cmp-key-cors-note {
    color: var(--warning); font-size: 10px;
    background: rgba(255,184,48,0.08);
    border: 1px solid rgba(255,184,48,0.2);
    border-radius: 6px; padding: 4px 7px;
    line-height: 1.5;
  }
  .cmp-key-input-row {
    display: flex; gap: 6px; align-items: center;
  }
  .cmp-key-input {
    flex: 1;
    background: rgba(28,18,52,0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px; color: var(--text);
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .cmp-key-input:focus {
    border-color: rgba(124,92,255,0.5);
    box-shadow: 0 0 0 1px rgba(124,92,255,0.2);
  }
  .cmp-key-save-btn {
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    border: none; border-radius: 10px;
    color: white; font-size: 12px; font-weight: 600;
    padding: 8px 14px; cursor: pointer;
    font-family: 'Sora', sans-serif;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
  }
  .cmp-key-save-btn:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(124,92,255,0.5); }
  .cmp-key-remove-btn {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    color: #f87171; font-size: 12px; font-weight: 500;
    padding: 8px 12px; cursor: pointer;
    flex-shrink: 0; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .cmp-key-remove-btn:hover { background: rgba(239,68,68,0.22); }
  .cmp-key-modal-links { font-size: 11px; }
  .cmp-key-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 11px;
  }
  .cmp-key-link:hover { text-decoration: underline; }
  .cmp-key-close-btn {
    align-self: flex-end;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text3); font-size: 11px;
    padding: 4px 10px; cursor: pointer;
    transition: background 0.15s;
    margin-top: -2px;
  }
  .cmp-key-close-btn:hover { background: var(--surface3); color: var(--text); }

  /* ── Question number badge ── */
  .cmp-q-num {
    display: inline-block;
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    color: white;
    font-size: 9px; font-weight: 700;
    padding: 2px 6px; border-radius: 6px;
    margin-right: 4px;
    letter-spacing: 0.5px;
    font-family: 'Sora', sans-serif;
  }

  /* ── Clear chat button ── */
  .cmp-clear-btn {
    width: 36px; height: 36px; border-radius: 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    color: #f87171; font-size: 14px;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
  }
  .cmp-clear-btn:hover { background: rgba(239,68,68,0.22); border-color: rgba(239,68,68,0.4); transform: scale(1.05); }

  /* Light mode overrides */
  body.light-mode .cmp-key-modal-inner { background: #fff; }
  body.light-mode .cmp-key-input { background: #f3f4f6; border-color: #E5E7EB; color: #111827; }
  body.light-mode .cmp-key-cors-note { color: #92400e; background: rgba(255,184,48,0.06); }
  body.light-mode .cmp-model-chip.key-locked { border-color: #d1d5db; }

  body.light-mode .cmp-card { background: #fff; border-color: #E5E7EB; }
  body.light-mode .cmp-card-body code:not(.hljs) {
    background: rgba(124,92,255,0.08);
    border-color: rgba(124,92,255,0.2);
    color: #7c3aed;
  }
  body.light-mode .cmp-card-body blockquote {
    background: rgba(0,150,200,0.05);
    border-left-color: var(--accent);
    color: #555;
  }
  body.light-mode .cmp-card-body th {
    background: rgba(124,92,255,0.07);
  }
  body.light-mode .cmp-card-body th, body.light-mode .cmp-card-body td {
    border-color: rgba(0,0,0,0.1);
  }
  body.light-mode .cmp-model-chip { background: #f3f4f6; }
  body.light-mode #cmpInputBar { background: #fff; border-top-color: #E5E7EB; }
  body.light-mode .cmp-header { background: #F9FAFB; }
  body.light-mode #cmpImgPreviewBar {
    background: rgba(124,92,255,0.05);
    border-color: rgba(124,92,255,0.18);
  }
  body.light-mode .cmp-q-thumb {
    border-color: rgba(124,92,255,0.3);
    box-shadow: 0 2px 10px rgba(124,92,255,0.12);
  }

  /* ════════════════════════════════════════
     AI SELECTOR BAR
  ════════════════════════════════════════ */
  .cmp-selector-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(13,11,26,0.6);
  }

  /* Glowing pill button */
  .ai-select-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 14px 7px 11px;
    background: linear-gradient(135deg,rgba(124,92,255,0.18),rgba(0,224,255,0.10));
    border: 1px solid rgba(124,92,255,0.45);
    border-radius: 999px;
    color: #e0d8ff;
    font-family: 'Sora', sans-serif;
    font-size: 12px; font-weight: 600;
    cursor: pointer; flex-shrink: 0;
    box-shadow: 0 0 14px rgba(124,92,255,0.28), inset 0 0 12px rgba(124,92,255,0.06);
    animation: ai-btn-glow 2.8s ease-in-out infinite;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative; overflow: hidden;
  }
  .ai-select-btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg,rgba(124,92,255,0.12),rgba(0,224,255,0.08));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .ai-select-btn:hover::before { opacity: 1; }
  .ai-select-btn:hover { transform: scale(1.03); box-shadow: 0 0 22px rgba(124,92,255,0.5), inset 0 0 16px rgba(124,92,255,0.1); }
  .ai-select-btn:active { transform: scale(0.97); }

  @keyframes ai-btn-glow {
    0%,100% { box-shadow: 0 0 14px rgba(124,92,255,0.28), inset 0 0 12px rgba(124,92,255,0.06); border-color: rgba(124,92,255,0.45); }
    50%      { box-shadow: 0 0 26px rgba(124,92,255,0.55), 0 0 8px rgba(0,224,255,0.2), inset 0 0 16px rgba(124,92,255,0.1); border-color: rgba(0,224,255,0.4); }
  }

  .ai-select-icon { font-size: 13px; line-height: 1; }
  .ai-select-label { letter-spacing: 0.2px; }
  .ai-select-count {
    background: rgba(124,92,255,0.35);
    border: 1px solid rgba(124,92,255,0.5);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px; font-weight: 700;
    color: #c4b5fd;
    min-width: 20px; text-align: center;
  }

  /* Active dots row */
  .ai-active-dots {
    display: flex; gap: 5px; align-items: center;
    flex-wrap: wrap; flex: 1; overflow: hidden;
  }
  .ai-dot {
    width: 9px; height: 9px; border-radius: 50%;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
  }
  .ai-dot-label {
    font-size: 10px; color: var(--text3);
    white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  /* ════════════════════════════════════════
     AI SELECTION SHEET (bottom-sheet overlay)
  ════════════════════════════════════════ */
  .ai-sheet-backdrop {
    position: absolute; inset: 0; z-index: 800;
    background: rgba(0,0,5,0.65);
    backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .ai-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

  .ai-sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    z-index: 810;
    background: linear-gradient(180deg, #130f26 0%, #0d0b1a 100%);
    border-radius: 22px 22px 0 0;
    border-top: 1px solid rgba(124,92,255,0.35);
    box-shadow: 0 -24px 70px rgba(0,0,0,0.7), 0 -1px 0 rgba(124,92,255,0.25);
    max-height: 88%;
    display: flex; flex-direction: column;
    transform: translateY(105%);
    transition: transform 0.38s cubic-bezier(.16,1,.3,1);
    will-change: transform;
    overflow: hidden;
  }
  .ai-sheet.open { transform: translateY(0); }

  /* Drag handle */
  .ai-sheet-handle {
    width: 36px; height: 4px; border-radius: 99px;
    background: rgba(255,255,255,0.15);
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  /* Sheet header row */
  .ai-sheet-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 8px;
    flex-shrink: 0;
    position: sticky; top: 0; z-index: 4;
    background: linear-gradient(180deg, rgba(20,14,40,0.98), rgba(13,11,26,0.96));
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .ai-sheet-back {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border-radius: 999px;
    min-width: 66px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .ai-sheet-back:hover {
    background: rgba(124,92,255,0.14);
    border-color: rgba(124,92,255,0.35);
    color: #e0d8ff;
  }
  .ai-sheet-title {
    font-family: 'Sora', sans-serif;
    font-size: 14px; font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #67e8f9);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    flex: 1;
    text-align: center;
    min-width: 0;
  }
  .ai-sheet-done {
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    border: none; border-radius: 999px;
    color: white; font-family: 'Sora', sans-serif;
    font-size: 12px; font-weight: 600;
    padding: 6px 14px; cursor: pointer;
    min-width: 74px;
    box-shadow: 0 0 14px rgba(124,92,255,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .ai-sheet-done:hover { transform: scale(1.04); box-shadow: 0 0 22px rgba(124,92,255,0.6); }
  .ai-sheet-done:active { transform: scale(0.96); }

  /* Scrollable grid area */
  .ai-sheet-scroll {
    flex: 1; overflow-y: auto; padding: 6px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    min-height: 0; /* critical: allows flex child to shrink and scroll */
  }
  .ai-sheet-scroll::-webkit-scrollbar { width: 3px; }
  .ai-sheet-scroll::-webkit-scrollbar-thumb { background: rgba(124,92,255,0.3); border-radius: 4px; }

  /* Section label inside sheet */
  .ai-sheet-section {
    font-size: 10px; font-weight: 700; letter-spacing: 0.7px;
    text-transform: uppercase; color: var(--text3);
    padding: 10px 4px 5px;
    display: flex; align-items: center; gap: 8px;
  }
  .ai-sheet-section::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
  }
  .ai-sheet-section.cf-sec { color: #fb923c; }
  .ai-sheet-section.cf-sec::after { background: linear-gradient(90deg, rgba(249,115,22,0.3), transparent); }
  .ai-sheet-section.key-sec { color: var(--text3); }

  /* Card grid */
  .ai-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  @media (min-width: 520px) { .ai-sheet-grid { grid-template-columns: repeat(3, 1fr); } }

  /* Individual AI card */
  .ai-sheet-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: 11px 10px 10px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.07);
    background: rgba(28,18,52,0.75);
    cursor: pointer; position: relative;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
    min-height: 68px; user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .ai-sheet-card:active { transform: scale(0.96); }
  .ai-sheet-card.active {
    border-color: rgba(124,92,255,0.55);
    background: rgba(124,92,255,0.13);
    box-shadow: 0 0 14px rgba(124,92,255,0.18);
  }
  .ai-sheet-card.locked {
    opacity: 0.6; border-style: dashed;
    border-color: rgba(255,255,255,0.12);
  }
  .ai-sheet-card.locked:hover { opacity: 0.8; border-color: rgba(249,115,22,0.4); }

  /* Card color bar at top */
  .ai-card-bar {
    position: absolute; top: 0; left: 12px; right: 12px;
    height: 2px; border-radius: 0 0 4px 4px;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .ai-sheet-card.active .ai-card-bar { opacity: 1; }

  /* Card icon + name row */
  .ai-card-top {
    display: flex; align-items: center; gap: 6px;
  }
  .ai-card-icon { font-size: 15px; line-height: 1; flex-shrink: 0; }
  .ai-card-name {
    font-family: 'Sora', sans-serif;
    font-size: 12px; font-weight: 600;
    color: var(--text); line-height: 1.2;
  }
  .ai-sheet-card.active .ai-card-name { color: #e0d8ff; }

  /* Specialty tag */
  .ai-card-tag {
    display: inline-block;
    font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
    text-transform: uppercase; padding: 2px 6px; border-radius: 6px;
    align-self: flex-start; line-height: 1.4;
  }

  /* Active check badge */
  .ai-card-check {
    position: absolute; top: 8px; right: 8px;
    width: 16px; height: 16px; border-radius: 50%;
    background: rgba(124,92,255,0.8);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: white; font-weight: 700;
    opacity: 0; transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 0 8px rgba(124,92,255,0.6);
  }
  .ai-sheet-card.active .ai-card-check { opacity: 1; transform: scale(1); }

  /* Key button on locked card */
  .ai-card-key-btn {
    margin-top: 3px;
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 7px; padding: 3px 7px;
    font-size: 10px; color: var(--text3);
    cursor: pointer; transition: all 0.15s;
    align-self: flex-start;
    font-family: 'DM Sans', sans-serif;
  }
  .ai-card-key-btn:hover { background: rgba(124,92,255,0.18); border-color: rgba(124,92,255,0.4); color: #c4b5fd; }
  .ai-sheet-card.cf-card .ai-card-key-btn:hover { background: rgba(249,115,22,0.18); border-color: rgba(249,115,22,0.4); color: #fb923c; }
  .ai-sheet-card.unlocked { opacity: 1; border-style: solid; }

  /* Light mode */
  body.light-mode .ai-sheet { background: linear-gradient(180deg, #f8faff 0%, #f0f2f8 100%); border-top-color: rgba(124,92,255,0.25); }
  body.light-mode .ai-sheet-top { background: linear-gradient(180deg, rgba(248,250,255,0.98), rgba(240,242,248,0.96)); border-bottom-color: rgba(0,0,0,0.06); }
  body.light-mode .ai-sheet-back { background: #fff; border-color: #dbe3f0; color: #111827; }
  body.light-mode .ai-sheet-back:hover { background: rgba(124,92,255,0.08); color: #4f35cc; border-color: rgba(124,92,255,0.28); }
  body.light-mode .ai-sheet-card { background: #fff; border-color: #e5e7eb; }
  body.light-mode .ai-sheet-card.active { background: rgba(124,92,255,0.06); border-color: rgba(124,92,255,0.35); }
  body.light-mode .ai-card-name { color: #111827; }
  body.light-mode .ai-sheet-card.active .ai-card-name { color: #4f35cc; }
  body.light-mode .ai-sheet-title { -webkit-text-fill-color: transparent; }
  body.light-mode .ai-sheet-handle { background: rgba(0,0,0,0.15); }

  /* ═══════════════════════════════════════════
     MODEL CAPABILITIES SYSTEM — CSS
     ═══════════════════════════════════════════ */

  /* ── Recommended + Category Filter strip ── */
  .ai-sheet-controls {
    padding: 10px 14px 2px;
    display: flex; flex-direction: column; gap: 8px;
    flex-shrink: 0;
  }
  .ai-recommended-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: var(--text2);
    min-height: 22px;
  }
  .ai-rec-label {
    font-weight: 600; color: #fbbf24;
    display: flex; align-items: center; gap: 4px;
    white-space: nowrap; flex-shrink: 0;
  }
  .ai-rec-chips {
    display: flex; gap: 5px; flex-wrap: wrap;
  }
  .ai-rec-chip {
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 20px; padding: 2px 8px;
    font-size: 10px; font-weight: 600;
    color: #fbbf24; white-space: nowrap;
    cursor: pointer; transition: all 0.15s;
  }
  .ai-rec-chip:hover { background: rgba(251,191,36,0.22); }

  /* ── Category filter chips ── */
  .ai-cat-row {
    display: flex; gap: 6px; flex-wrap: wrap;
  }
  .ai-cat-chip {
    display: flex; align-items: center; gap: 3px;
    padding: 5px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(28,18,52,0.6);
    color: var(--text2); cursor: pointer;
    transition: all 0.2s; user-select: none;
    white-space: nowrap;
  }
  .ai-cat-chip:active { transform: scale(0.95); }
  .ai-cat-chip.selected {
    background: rgba(124,92,255,0.2);
    border-color: rgba(124,92,255,0.6);
    color: #c4b5fd;
    box-shadow: 0 0 10px rgba(124,92,255,0.25);
  }

  /* ── Card highlight/dim states ── */
  .ai-sheet-card {
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s,
                transform 0.2s, opacity 0.2s;
  }
  .ai-sheet-card.cap-highlight {
    border-color: rgba(124,92,255,0.7) !important;
    box-shadow: 0 0 18px rgba(124,92,255,0.35), 0 0 6px rgba(124,92,255,0.2) !important;
    opacity: 1 !important;
    transform: scale(1.02);
  }
  .ai-sheet-card.cap-dim {
    opacity: 0.35 !important;
    transform: scale(0.98);
  }

  /* ── ⓘ info button on card ── */
  .ai-card-info-btn {
    position: absolute; bottom: 7px; right: 7px;
    width: 16px; height: 16px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text3); font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
    line-height: 1; font-style: italic;
    font-family: Georgia, serif;
  }
  .ai-card-info-btn:hover {
    background: rgba(124,92,255,0.25);
    border-color: rgba(124,92,255,0.5);
    color: #c4b5fd;
    transform: scale(1.15);
  }
  .ai-sheet-card.cf-card .ai-card-info-btn:hover {
    background: rgba(249,115,22,0.25);
    border-color: rgba(249,115,22,0.5);
    color: #fb923c;
  }

  /* ── Capability tag pills ── */
  .ai-cap-tags {
    display: flex; gap: 3px; flex-wrap: wrap;
    margin-top: 2px;
  }
  .ai-cap-tag {
    font-size: 8px; font-weight: 700; letter-spacing: 0.3px;
    padding: 2px 5px; border-radius: 5px;
    text-transform: uppercase; line-height: 1.4;
    white-space: nowrap;
  }
  .cap-reasoning  { background: rgba(139,92,246,0.2); color: #c4b5fd; }
  .cap-coding     { background: rgba(34,197,94,0.18); color: #86efac; }
  .cap-writing    { background: rgba(236,72,153,0.18); color: #f9a8d4; }
  .cap-research   { background: rgba(14,165,233,0.18); color: #7dd3fc; }
  .cap-fast       { background: rgba(251,146,60,0.2); color: #fdba74; }
  .cap-analysis   { background: rgba(99,102,241,0.2); color: #a5b4fc; }
  .cap-web        { background: rgba(6,182,212,0.18); color: #67e8f9; }
  .cap-creative   { background: rgba(244,114,182,0.18); color: #f9a8d4; }
  .cap-summary    { background: rgba(168,85,247,0.15); color: #d8b4fe; }
  .cap-friendly   { background: rgba(251,191,36,0.15); color: #fde68a; }
  .cap-free       { background: rgba(0,229,160,0.15); color: #6ee7b7; }
  .cap-search     { background: rgba(14,165,233,0.2); color: #93c5fd; }

  /* ── "Best for" micro-line ── */
  .ai-card-bestfor {
    font-size: 9px; color: var(--text3); line-height: 1.3;
    margin-top: 1px; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }

  /* ══ INFO MODAL (model detail sheet) ══ */
  .ai-info-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 600; opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
  }
  .ai-info-backdrop.open { opacity: 1; pointer-events: auto; }

  .ai-info-modal {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(180deg, #130f26 0%, #0d0b1a 100%);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px 24px 0 0;
    padding: 0 0 32px;
    z-index: 601;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(.16,1,.3,1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  }
  .ai-info-modal.open { transform: translateY(0); }

  .ai-info-handle {
    width: 36px; height: 4px; border-radius: 4px;
    background: rgba(255,255,255,0.15);
    margin: 12px auto 0;
  }
  .ai-info-header {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 18px 20px 0;
  }
  .ai-info-icon-wrap {
    width: 48px; height: 48px; border-radius: 14px;
    background: rgba(124,92,255,0.15);
    border: 1.5px solid rgba(124,92,255,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
  }
  .ai-info-title-col { flex: 1; }
  .ai-info-name {
    font-family: 'Sora', sans-serif;
    font-size: 16px; font-weight: 700;
    color: #fff; line-height: 1.2;
    margin-bottom: 6px;
  }
  .ai-info-tags {
    display: flex; gap: 4px; flex-wrap: wrap;
  }
  .ai-info-body {
    padding: 14px 20px 0;
    display: flex; flex-direction: column; gap: 10px;
  }
  .ai-info-section-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.7px;
    text-transform: uppercase; color: var(--text3);
    margin-bottom: 2px;
  }
  .ai-info-bestfor {
    font-size: 13px; color: var(--text); line-height: 1.55;
    font-weight: 500;
  }
  .ai-info-why {
    font-size: 12px; color: var(--text2); line-height: 1.6;
  }
  .ai-info-actions {
    display: flex; flex-direction: column; gap: 8px;
    padding: 16px 20px 0;
  }
  .ai-info-use-btn {
    width: 100%; padding: 13px;
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    border: none; border-radius: 14px;
    color: white; font-family: 'Sora', sans-serif;
    font-size: 14px; font-weight: 600;
    cursor: pointer; letter-spacing: 0.2px;
    box-shadow: 0 4px 20px rgba(124,92,255,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .ai-info-use-btn:active { transform: scale(0.97); }
  .ai-info-use-btn:hover { box-shadow: 0 6px 28px rgba(124,92,255,0.6); transform: scale(1.01); }
  .ai-info-add-btn {
    width: 100%; padding: 11px;
    background: rgba(124,92,255,0.1);
    border: 1.5px solid rgba(124,92,255,0.3);
    border-radius: 14px; color: #c4b5fd;
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
  }
  .ai-info-add-btn:hover { background: rgba(124,92,255,0.2); border-color: rgba(124,92,255,0.5); }
  .ai-info-add-btn:active { transform: scale(0.97); }
  .ai-info-close-row {
    display: flex; justify-content: center;
    padding: 12px 20px 0;
  }
  .ai-info-close-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; padding: 6px 20px;
    color: var(--text3); font-size: 12px; cursor: pointer;
    transition: all 0.15s;
  }
  .ai-info-close-btn:hover { background: rgba(255,255,255,0.06); color: var(--text2); }

  /* Light mode overrides */
  body.light-mode .ai-info-modal { background: linear-gradient(180deg,#f8faff,#f0f2f8); border-top-color: rgba(124,92,255,0.2); }
  body.light-mode .ai-info-name { color: #111827; }
  body.light-mode .ai-info-bestfor { color: #111827; }
  body.light-mode .ai-info-why { color: #6b7280; }
  body.light-mode .ai-cat-chip { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
  body.light-mode .ai-cat-chip.selected { background: rgba(124,92,255,0.1); color: #4f35cc; }
  body.light-mode .ai-info-icon-wrap { background: rgba(124,92,255,0.08); }


/* Source style block 3 */
/* Install banner */
  #pwaInstallBanner {
    display: none;
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, 92vw);
    background: linear-gradient(135deg, rgba(124,92,255,0.97), rgba(0,224,255,0.9));
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 14px 18px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(124,92,255,0.5), 0 0 60px rgba(0,224,255,0.15);
    animation: slideUp 0.35s cubic-bezier(.16,1,.3,1);
    color: white;
    font-family: 'DM Sans', sans-serif;
  }
  #pwaInstallBanner.show { display: flex; align-items: center; gap: 12px; }
  @keyframes slideUp {
    from { opacity:0; transform: translateX(-50%) translateY(20px); }
    to   { opacity:1; transform: translateX(-50%) translateY(0); }
  }
  .pwa-banner-icon { font-size: 28px; flex-shrink: 0; }
  .pwa-banner-text { flex: 1; }
  .pwa-banner-text strong { font-family: 'Sora', sans-serif; font-size: 13px; display: block; margin-bottom: 2px; }
  .pwa-banner-text span { font-size: 11px; opacity: 0.88; }
  .pwa-install-btn {
    background: white; color: #8B5CF6;
    border: none; border-radius: 12px;
    padding: 8px 14px; font-size: 12px; font-weight: 600;
    cursor: pointer; flex-shrink: 0;
    font-family: 'Sora', sans-serif;
    transition: transform 0.15s;
  }
  .pwa-install-btn:active { transform: scale(0.95); }
  .pwa-dismiss-btn {
    background: transparent; border: none;
    color: rgba(255,255,255,0.7); font-size: 18px;
    cursor: pointer; flex-shrink: 0; padding: 0 2px;
    line-height: 1;
  }

  /* ── SW Update Banner ── */
  #swUpdateBanner {
    display: none;
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(380px, 92vw);
    background: linear-gradient(135deg, rgba(30,20,60,0.97), rgba(10,14,28,0.97));
    border: 1px solid rgba(124,92,255,0.45);
    backdrop-filter: blur(14px);
    border-radius: 16px;
    padding: 12px 16px;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,92,255,0.2);
    color: #f1f5f9;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    gap: 10px;
    align-items: center;
  }
  #swUpdateBanner.show { display: flex; }
  #swUpdateBanner span { flex: 1; }
  #swUpdateBanner button:first-of-type {
    background: linear-gradient(135deg, #7c5cff, #00e0ff);
    border: none; border-radius: 10px;
    padding: 7px 14px; font-size: 12px; font-weight: 600;
    color: white; cursor: pointer; flex-shrink: 0;
    font-family: 'Sora', sans-serif;
    transition: opacity 0.15s;
  }
  #swUpdateBanner button:first-of-type:hover { opacity: 0.88; }
  #swUpdateBanner button:last-of-type {
    background: transparent; border: none;
    color: rgba(255,255,255,0.5); font-size: 16px;
    cursor: pointer; flex-shrink: 0; padding: 0 2px;
    line-height: 1;
  }


/* ═══════════════════════════════════════════════════════════
   NEXORA MARKDOWN RENDERING — Premium AI Response Design
   Matches Claude / ChatGPT visual quality
   ═══════════════════════════════════════════════════════════ */

/* ── Base prose spacing inside bot bubbles ── */
.bot-bub p {
  margin: 0 0 8px 0;
  line-height: 1.7;
  color: var(--text2);
}
.bot-bub p:last-child { margin-bottom: 0; }

/* ── Headings ── */
.bot-bub h1, .bot-bub h2 {
  font-family: 'Sora', sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 14px 0 6px;
  line-height: 1.35;
  letter-spacing: -0.2px;
}
.bot-bub h3 {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 12px 0 5px;
  line-height: 1.4;
}
.bot-bub h4, .bot-bub h5, .bot-bub h6 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 10px 0 4px;
}
.bot-bub h1:first-child,
.bot-bub h2:first-child,
.bot-bub h3:first-child { margin-top: 2px; }

/* ── Strong & Emphasis ── */
.bot-bub strong, .bot-bub b {
  color: var(--text);
  font-weight: 600;
}
.bot-bub em, .bot-bub i {
  color: var(--text2);
  font-style: italic;
}

/* ── Horizontal Rule ── */
.bot-bub hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 12px 0;
}

/* ── Inline Code ── */
.bot-bub code:not(pre code) {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  background: rgba(124, 92, 255, 0.13);
  color: #c4b5fd;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(124, 92, 255, 0.22);
  white-space: nowrap;
}

/* ── Code Block Wrapper ── */
.code-block-wrapper {
  margin: 10px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #0d1117;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
}
.code-block-wrapper:first-child { margin-top: 4px; }
.code-block-wrapper:last-child  { margin-bottom: 4px; }

/* ── Code Block Header Bar ── */
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}
.code-lang-label {
  font-family: 'Sora', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.code-lang-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.7;
  box-shadow: 14px 0 0 rgba(0,224,255,0.6), 28px 0 0 rgba(255,78,205,0.6);
}

/* ── Copy Button ── */
.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  white-space: nowrap;
}
.code-copy-btn:hover {
  color: var(--text);
  border-color: rgba(124,92,255,0.45);
  background: rgba(124,92,255,0.12);
  transform: translateY(-1px);
}
.code-copy-btn:active { transform: translateY(0); }
.code-copy-btn.copied {
  color: var(--success);
  border-color: rgba(0,229,160,0.35);
  background: rgba(0,229,160,0.08);
}

/* ── Code Block Pre/Code ── */
.bot-bub pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: #0d1117;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.bot-bub pre::-webkit-scrollbar { height: 5px; }
.bot-bub pre::-webkit-scrollbar-track { background: transparent; }
.bot-bub pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
}
.bot-bub pre code, .bot-bub pre code.hljs {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace !important;
  font-size: 13px !important;
  line-height: 1.75 !important;
  tab-size: 2;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  white-space: pre;
}
/* hljs overrides to match dark theme */
.hljs { background: #0d1117 !important; }

/* ── Tables ── */
.bot-bub table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12.5px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.bot-bub thead { background: rgba(124,92,255,0.16); }
.bot-bub thead tr { border-bottom: 1px solid rgba(124,92,255,0.2); }
.bot-bub th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.bot-bub td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text2);
  line-height: 1.5;
}
.bot-bub tbody tr:last-child td { border-bottom: none; }
.bot-bub tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.025);
}
.bot-bub tbody tr {
  transition: background 0.15s;
}
.bot-bub tbody tr:hover {
  background: rgba(124,92,255,0.07);
}

/* ── Lists ── */
.bot-bub ul, .bot-bub ol {
  padding-left: 18px;
  margin: 6px 0 8px;
}
.bot-bub li {
  margin: 5px 0;
  color: var(--text2);
  line-height: 1.65;
  padding-left: 2px;
}
.bot-bub ul li { list-style: none; position: relative; }
.bot-bub ul li::before {
  content: '▸';
  color: var(--accent2);
  position: absolute;
  left: -16px;
  font-size: 11px;
  top: 2px;
  opacity: 0.85;
}
.bot-bub ol { list-style: none; counter-reset: nexora-counter; }
.bot-bub ol li {
  counter-increment: nexora-counter;
  position: relative;
  padding-left: 8px;
}
.bot-bub ol li::before {
  content: counter(nexora-counter);
  position: absolute;
  left: -20px;
  top: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(124,92,255,0.18);
  color: var(--accent2);
  font-size: 10px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid rgba(124,92,255,0.25);
}
/* Nested lists */
.bot-bub li ul, .bot-bub li ol { margin: 4px 0 2px; }

/* ── Blockquotes ── */
.bot-bub blockquote {
  margin: 10px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent2);
  background: rgba(124,92,255,0.07);
  border-radius: 0 10px 10px 0;
  color: var(--text2);
}
.bot-bub blockquote p { margin: 0; color: var(--text2); }

/* ── Links ── */
.bot-bub a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,224,255,0.25);
  transition: border-color 0.2s, color 0.2s;
}
.bot-bub a:hover {
  color: #5ef0ff;
  border-color: rgba(0,224,255,0.7);
}

/* ── Math/answer highlight ── */
.bot-bub .math-answer {
  display: inline-block;
  font-size: 1.15em;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0,224,255,0.08);
  padding: 1px 8px;
  border-radius: 6px;
}

/* ── Cursor blink during streaming ── */
.md-cursor::after {
  content: '▋';
  display: inline-block;
  color: var(--accent2);
  animation: mdBlink 0.65s step-end infinite;
  margin-left: 1px;
  font-size: 0.8em;
  vertical-align: text-bottom;
}
@keyframes mdBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Step card style for numbered solutions ── */
.bot-bub .step-block {
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 6px 0;
}

/* ═══════════════════════════════════
   LIGHT MODE OVERRIDES
   ═══════════════════════════════════ */
body.light-mode .bot-bub code:not(pre code) {
  background: rgba(109,40,217,0.09);
  color: #5b21b6;
  border-color: rgba(109,40,217,0.18);
}
body.light-mode .code-block-wrapper {
  background: #1e1e2e;
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
body.light-mode .code-block-header {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .code-copy-btn {
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
body.light-mode .code-copy-btn:hover {
  color: #fff;
  background: rgba(124,92,255,0.2);
  border-color: rgba(124,92,255,0.4);
}
body.light-mode .bot-bub table {
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .bot-bub thead {
  background: rgba(124,92,255,0.1);
}
body.light-mode .bot-bub th { color: #5b21b6; }
body.light-mode .bot-bub td { color: #374151; border-color: rgba(0,0,0,0.05); }
body.light-mode .bot-bub tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
body.light-mode .bot-bub tbody tr:hover { background: rgba(124,92,255,0.05); }
body.light-mode .bot-bub blockquote {
  background: rgba(124,92,255,0.05);
  border-color: #7c5cff;
}
body.light-mode .bot-bub a { color: #5b21b6; border-color: rgba(91,33,182,0.3); }
body.light-mode .bot-bub strong { color: #111827; }
body.light-mode .bot-bub p { color: #374151; }
body.light-mode .bot-bub li { color: #374151; }
body.light-mode .bot-bub ul li::before { color: #7c5cff; }
body.light-mode .bot-bub ol li::before {
  background: rgba(124,92,255,0.12);
  color: #5b21b6;
  border-color: rgba(124,92,255,0.2);
}
/* Light mode hljs — switch to github light theme */
body.light-mode #hljs-theme { 
  /* theme already handles via the class swap below, 
     injected by toggleTheme() */ 
}


/* ══════════════════════════════════════════════════════════════
   STUDY MODE — Full screen experience
   ══════════════════════════════════════════════════════════════ */

/* ── Screen base ── */
#studyScreen {
  position: absolute;
  inset: 0;
  z-index: 800;          /* above statusbar, header, everything */
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0814;   /* solid dark — no bleed-through */
  /* Override .screen's flex:1 — this element is position:absolute, not a flex child */
  flex: none;
}
#studyScreen.active {
  display: flex;
  animation: study-slide-in 0.28s cubic-bezier(0.34,1.3,0.64,1) both;
}
@keyframes study-slide-in {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════════════════════════════════
   PREMIUM STUDY HEADER
════════════════════════════════════════════════════════════════════════ */
.study-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 11px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(8,12,24,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  z-index: 10;
}

/* Glass-pill back button */
.study-back-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text2); flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, color 0.18s;
}
.study-back-btn:hover {
  background: rgba(124,92,255,0.18);
  border-color: rgba(124,92,255,0.4);
  color: var(--primary);
  transform: scale(1.08) translateX(-1px);
}
.study-back-btn:active { transform: scale(0.94); }

.study-header-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 15px; font-weight: 700; color: var(--text); flex: 1;
  letter-spacing: -0.2px;
}
.study-header-icon { font-size: 17px; }
.study-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ── AI model pill — glowing teal dot, purple hover ── */
.study-ai-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 11px 6px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap; flex-shrink: 0;
}
.study-ai-pill:hover {
  background: rgba(124,92,255,0.14);
  border-color: rgba(124,92,255,0.45);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(124,92,255,0.2);
}

/* Glowing teal dot */
.study-ai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #00e5c8;
  box-shadow: 0 0 0 2px rgba(0,229,200,0.25), 0 0 8px rgba(0,229,200,0.5);
  flex-shrink: 0;
  animation: ai-dot-glow 2.4s ease-in-out infinite;
}
@keyframes ai-dot-glow {
  0%,100% { box-shadow: 0 0 0 2px rgba(0,229,200,0.25), 0 0 8px rgba(0,229,200,0.5); }
  50%      { box-shadow: 0 0 0 3px rgba(0,229,200,0.15), 0 0 14px rgba(0,229,200,0.7); }
}

/* Close button — red on hover */
.study-close-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.05);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}
.study-close-btn:hover {
  background: rgba(248,113,113,0.14);
  border-color: rgba(248,113,113,0.4);
  color: #fca5a5;
  box-shadow: 0 0 12px rgba(248,113,113,0.18);
}
.study-close-btn:active { transform: scale(0.96); }

/* ── Collapsible hub zone — scrollable ── */
#studyCollapsible {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
#studyCollapsible::-webkit-scrollbar { display: none; }
#studyCollapsible.collapsed {
  display: none;
}

/* ── AI Picker dropdown ── */
.study-ai-picker {
  position: absolute; top: 62px; right: 10px; z-index: 200;
  background: rgba(18,24,40,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 12px;
  width: 220px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
}
.study-ai-picker-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text3); margin-bottom: 10px; padding: 0 2px;
}
.study-ai-picker-grid {
  display: flex; flex-direction: column; gap: 4px;
}
.study-ai-option {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 10px;
  cursor: pointer; transition: background 0.15s;
  border: 1px solid transparent;
}
.study-ai-option:hover { background: rgba(255,255,255,0.06); }
.study-ai-option.selected {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.3);
}
.study-ai-option-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.study-ai-option-label { font-size: 13px; font-weight: 500; color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════
   PREMIUM STUDY TAB BAR — icon+label mode grid
════════════════════════════════════════════════════════════════════════ */
.study-tab-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  padding: 8px 10px;
  background: rgba(8,12,24,0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.study-tab-bar::-webkit-scrollbar { display: none; }

.study-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 7px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
  position: relative;
  min-width: 60px;
}
.stab-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s;
}
.stab-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.18s;
}
.study-tab:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}
.study-tab:hover .stab-icon { transform: scale(1.15); }
.study-tab:hover .stab-label { color: var(--text2); }
.study-tab.active {
  background: rgba(124,92,255,0.14);
  border-color: rgba(124,92,255,0.35);
  box-shadow: 0 4px 16px rgba(124,92,255,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-1px);
}
.study-tab.active .stab-label { color: var(--primary); font-weight: 700; }
.study-tab.active .stab-icon { filter: drop-shadow(0 0 6px rgba(124,92,255,0.6)); }
.study-tab.active::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}
.srs-due-badge {
  background: #f87171; color: #fff;
  font-size: 9px; font-weight: 800;
  min-width: 15px; height: 15px;
  border-radius: 8px; padding: 0 3px;
  display: inline-flex; align-items: center; justify-content: center;
  position: absolute; top: 5px; right: 5px;
  box-shadow: 0 0 6px rgba(248,113,113,0.5);
}
/* Light mode */
body.light-mode .study-tab-bar { background: rgba(249,250,251,0.95); border-bottom-color: #E5E7EB; }
body.light-mode .study-tab:hover { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.light-mode .study-tab.active { background: rgba(124,92,255,0.08); border-color: rgba(124,92,255,0.3); box-shadow: 0 4px 12px rgba(124,92,255,0.1); }
body.light-mode .stab-label { color: #9ca3af; }
body.light-mode .study-tab.active .stab-label { color: #7c5cff; }
/* ── Panels ── */
.study-panel {
  display: none; flex: 1; overflow-y: auto;
  flex-direction: column; padding: 14px;
  gap: 14px;
  min-height: 0; /* CRITICAL: allows flex child to shrink below content size */
}
.study-panel.active { display: flex; }

@media (min-width: 901px) {
  .study-panel {
    padding: 22px 26px;
    gap: 18px;
  }
  #spanel-flashcard.active {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    column-gap: 24px;
  }
  #spanel-flashcard .study-input-section,
  #spanel-flashcard #fcDeckArea,
  #spanel-flashcard #fcExplainPanel {
    width: 100%;
    margin: 0;
  }
  #spanel-flashcard #fcSavedSection {
    width: 100%;
    margin: 0;
    grid-column: 2;
    grid-row: 1 / span 3;
    position: sticky;
    top: 4px;
  }
  .study-input-section,
  #fcDeckArea,
  #quizActive,
  #quizReview,
  #srsSession,
  #srsBrowsePanel,
  #srsEmpty,
  #srsAllDone,
  #fcSavedSection {
    width: min(100%, 860px);
    margin-left: auto;
    margin-right: auto;
  }
  .fc-card {
    height: 280px;
  }
  .fc-card-text,
  .quiz-question {
    font-size: 17px;
  }
}

@media (min-width: 1200px) {
  .study-header {
    padding: 16px 22px 14px;
  }
  .study-panel {
    padding: 26px 34px;
  }
  .study-input-section,
  #fcDeckArea,
  #quizActive,
  #quizReview,
  #srsSession,
  #srsBrowsePanel,
  #srsEmpty,
  #srsAllDone,
  #fcSavedSection {
    width: min(100%, 920px);
  }
  .study-ai-picker {
    width: 280px;
  }
}

@media (max-width: 700px) {
  .study-close-btn {
    padding: 8px 10px;
    font-size: 0;
    min-width: 40px;
  }
  .study-close-btn::before {
    content: '✕';
    font-size: 15px;
  }
}

/* ── Input section ── */
.study-input-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  flex-shrink: 0;
}
.study-input-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text3);
}
.study-textarea {
  width: 100%; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 10px 12px;
  font-size: 14px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  resize: none; outline: none; line-height: 1.5;
  transition: border-color 0.2s; box-sizing: border-box;
}
.study-textarea:focus { border-color: rgba(124,92,255,0.4); }
.study-textarea::placeholder { color: var(--text3); }
.study-input-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.study-select {
  flex: 1 1 120px; min-width: 120px; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 8px 10px;
  font-size: 12px; color: var(--text2);
  font-family: 'DM Sans', sans-serif; outline: none;
  cursor: pointer;
}
.study-gen-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  background: linear-gradient(135deg, #7c5cff, #00e0ff);
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 13px; font-weight: 700;
  color: #fff; font-family: 'DM Sans', sans-serif;
  white-space: nowrap; transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
  flex: 1 1 140px;
}
.study-gen-btn:hover { opacity: 0.9; transform: scale(1.03); }
.study-gen-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════════════════════════════
   PREMIUM STUDY SOURCE CARD — (canonical block below at STUDY SCREEN LAYOUT)
════════════════════════════════════════════════════════════════════════ */
/* Stale duplicate removed — see canonical definitions ~line 5050 */

/* ── Source action pills stub (canonical below) ── */
.study-source-action {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  text-align: center;
  white-space: nowrap;
}
.study-source-action:hover {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.25);
  color: var(--primary);
}
/* Active state — glowing purple pill */
.study-source-action.active,
.study-source-action:focus {
  background: rgba(124,92,255,0.18);
  border-color: rgba(124,92,255,0.45);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(124,92,255,0.2);
  outline: none;
}
.study-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 10px;
}
.study-output-header span:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.study-output-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.study-output-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
}
.study-output-btn:hover {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.28);
  color: var(--accent);
}
.study-output-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  max-height: 260px;
  overflow-y: auto;
}
.study-output-body ul,
.study-output-body ol {
  padding-left: 18px;
  margin: 8px 0;
}
.study-output-body li { margin-bottom: 4px; }
.study-output-body p { margin-bottom: 8px; }
.study-output-body p:last-child { margin-bottom: 0; }

/* ══ FLASHCARD STYLES ══ */
.fc-deck-meta {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.fc-deck-topic-tag {
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.3);
  color: var(--accent); font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  max-width: 120px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fc-progress-text {
  font-size: 12px; color: var(--text3); margin-left: auto;
}
.fc-save-all-btn {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6ee7b7; font-size: 11px; font-weight: 600;
  padding: 5px 10px; border-radius: 10px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; white-space: nowrap;
  transition: all 0.2s;
}
.fc-save-all-btn:hover { background: rgba(16,185,129,0.2); }

/* Flip card */
.fc-card-wrap { perspective: 1000px; -webkit-perspective: 1000px; width: 100%; flex-shrink: 0; }
.fc-card {
  width: 100%; height: 220px;
  cursor: pointer; position: relative;
}
.fc-card-inner {
  position: absolute; inset: 0;
  transition: transform 0.5s cubic-bezier(.4,2,.6,1);
  -webkit-transition: -webkit-transform 0.5s cubic-bezier(.4,2,.6,1);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: 20px;
}
.fc-card.flipped .fc-card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}
.fc-card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 10px;
  -webkit-transform: translateZ(0.01px);
  transform: translateZ(0.01px);
  will-change: transform;
}
.fc-card-face.front {
  background: linear-gradient(145deg, rgba(124,92,255,0.12), rgba(0,224,255,0.06));
  border: 1px solid rgba(124,92,255,0.25);
  box-shadow: 0 8px 32px rgba(124,92,255,0.15);
}
.fc-card-face.back {
  background: linear-gradient(145deg, rgba(16,185,129,0.1), rgba(124,92,255,0.06));
  border: 1px solid rgba(16,185,129,0.25);
  box-shadow: 0 8px 32px rgba(16,185,129,0.12);
  transform: rotateY(180deg) translateZ(0.01px);
  -webkit-transform: rotateY(180deg) translateZ(0.01px);
}
.fc-card-label {
  font-size: 9px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text3); font-weight: 700;
}
.fc-card-text {
  font-size: 15px; font-weight: 500; color: var(--text);
  line-height: 1.55; flex: 1;
}
.fc-tap-hint {
  font-size: 10px; color: var(--text3);
  text-align: right; margin-top: auto;
}
.fc-hint-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.fc-hint-btn {
  background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25);
  color: #fbbf24; font-size: 11px; padding: 3px 9px;
  border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.fc-hint-text { font-size: 12px; color: #fbbf24; font-style: italic; }
.fc-explain-btn {
  background: rgba(124,92,255,0.1); border: 1px solid rgba(124,92,255,0.25);
  color: var(--accent); font-size: 11px; padding: 5px 10px;
  border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  align-self: flex-start; transition: all 0.2s;
}
.fc-explain-btn:hover { background: rgba(124,92,255,0.2); }

/* Navigation */
.fc-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; flex-shrink: 0;
}
.fc-nav-btn {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text2); transition: all 0.2s;
}
.fc-nav-btn:hover { background: rgba(124,92,255,0.15); color: var(--accent); }
.fc-dots { display: flex; gap: 5px; align-items: center; }
.fc-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.15); transition: all 0.2s;
}
.fc-dot.active { background: var(--accent); width: 18px; border-radius: 4px; }

/* Per-card actions */
.fc-card-actions {
  display: flex; gap: 8px; flex-shrink: 0;
}
.fc-action-btn {
  flex: 1; padding: 9px; border-radius: 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.2s;
}
.fc-action-btn.save {
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25);
  color: #6ee7b7;
}
.fc-action-btn.save:hover { background: rgba(16,185,129,0.2); }
.fc-action-btn.flip-all {
  background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.2);
  color: #fbbf24;
}
.fc-action-btn.flip-all:hover { background: rgba(251,191,36,0.16); }

/* Explain panel */
.fc-explain-panel {
  background: rgba(14,20,36,0.95);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 16px; padding: 14px;
  flex-shrink: 0;
}
.fc-explain-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px;
}
.fc-explain-header button {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 16px;
}
.fc-explain-body {
  font-size: 13px; color: var(--text2); line-height: 1.65;
  max-height: 140px; overflow-y: auto;
}

/* Saved decks */
.study-saved-section { flex-shrink: 0; }
.study-saved-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text3); margin-bottom: 8px;
}
.fc-saved-list { display: flex; flex-direction: column; gap: 8px; }
.fc-saved-deck {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 13px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer; transition: all 0.2s;
}
.fc-saved-deck:hover { background: rgba(124,92,255,0.08); border-color: rgba(124,92,255,0.2); }
.fc-saved-deck-icon { font-size: 20px; flex-shrink: 0; }
.fc-saved-deck-info { flex: 1; }
.fc-saved-deck-name { font-size: 13px; font-weight: 600; color: var(--text); }
.fc-saved-deck-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.fc-saved-deck-del {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 16px; padding: 4px;
  transition: color 0.15s;
}
.fc-saved-deck-del:hover { color: #f87171; }

/* ══ QUIZ STYLES ══ */
.quiz-header-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.quiz-q-counter { font-size: 12px; font-weight: 700; color: var(--text3); white-space: nowrap; }
.quiz-progress-bar {
  flex: 1; height: 4px; background: rgba(255,255,255,0.08);
  border-radius: 4px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; background: linear-gradient(90deg, #7c5cff, #00e0ff);
  border-radius: 4px; transition: width 0.4s ease;
}
.quiz-score-live { font-size: 12px; font-weight: 700; color: #fbbf24; white-space: nowrap; }
.quiz-question {
  font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.55; margin-bottom: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px; padding: 16px;
}
.quiz-options { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.quiz-option-btn {
  width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text); font-family: 'DM Sans', sans-serif;
  transition: all 0.2s; line-height: 1.45;
}
.quiz-option-btn:hover:not(:disabled) { background: rgba(124,92,255,0.1); border-color: rgba(124,92,255,0.3); }
.quiz-option-btn.correct {
  background: rgba(16,185,129,0.15); border-color: #10b981; color: #6ee7b7;
}
.quiz-option-btn.wrong {
  background: rgba(248,113,113,0.1); border-color: #f87171; color: #fca5a5;
}
.quiz-option-btn:disabled { cursor: default; }
.quiz-next-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #7c5cff, #00e0ff);
  border: none; border-radius: 13px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff;
  font-family: 'DM Sans', sans-serif; transition: opacity 0.2s;
}
.quiz-next-btn:hover { opacity: 0.88; }

/* Quiz results */
.quiz-result-header {
  text-align: center; padding: 20px 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07); margin-bottom: 14px;
}
.quiz-result-emoji { font-size: 44px; margin-bottom: 8px; }
.quiz-result-score { font-size: 28px; font-weight: 800; color: var(--text); }
.quiz-result-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }
.quiz-review-list { display: flex; flex-direction: column; gap: 10px; }
.quiz-review-item {
  border-radius: 13px; padding: 12px 13px;
  font-size: 13px; line-height: 1.5;
}
.quiz-review-item.correct {
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
}
.quiz-review-item.wrong {
  background: rgba(248,113,113,0.06); border: 1px solid rgba(248,113,113,0.18);
}
.quiz-review-q { font-weight: 600; color: var(--text); margin-bottom: 5px; }
.quiz-review-your { font-size: 12px; color: var(--text3); }
.quiz-review-correct { font-size: 12px; color: #6ee7b7; margin-top: 2px; }
.quiz-re-explain-btn {
  background: rgba(124,92,255,0.1); border: 1px solid rgba(124,92,255,0.25);
  color: var(--accent); font-size: 11px; padding: 4px 9px;
  border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  margin-top: 7px; display: inline-block; transition: all 0.2s;
}
.quiz-result-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.quiz-retake-btn, .quiz-new-btn {
  flex: 1; padding: 11px; border-radius: 13px;
  font-size: 13px; font-weight: 700;
  font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s;
}
.quiz-retake-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text2);
}
.quiz-retake-btn:hover { background: rgba(255,255,255,0.1); }
.quiz-new-btn {
  background: linear-gradient(135deg, #7c5cff, #00e0ff);
  border: none; color: #fff;
}
.quiz-new-btn:hover { opacity: 0.88; }

/* ══ SPACED REP STYLES ══ */
.srs-session-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-shrink: 0;
}
.srs-session-count { font-size: 13px; font-weight: 600; color: var(--text2); }
.srs-streak {
  font-size: 12px; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25);
  padding: 3px 9px; border-radius: 20px;
}
.srs-rating-row {
  display: flex; gap: 10px; margin-top: 12px;
}
.srs-rate-btn {
  flex: 1; padding: 12px 8px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer; font-size: 20px;
  font-family: 'DM Sans', sans-serif;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all 0.2s;
}
.srs-rate-btn span { font-size: 11px; font-weight: 600; }
.srs-rate-btn.hard { background: rgba(248,113,113,0.08); color: #fca5a5; }
.srs-rate-btn.hard:hover { background: rgba(248,113,113,0.18); }
.srs-rate-btn.medium { background: rgba(251,191,36,0.08); color: #fbbf24; }
.srs-rate-btn.medium:hover { background: rgba(251,191,36,0.18); }
.srs-rate-btn.easy { background: rgba(16,185,129,0.08); color: #6ee7b7; }
.srs-rate-btn.easy:hover { background: rgba(16,185,129,0.18); }

/* Browse all panel */
.srs-browse-btn {
  background: rgba(124,92,255,0.1); border: 1px solid rgba(124,92,255,0.3);
  color: var(--accent); font-size: 13px; font-weight: 600;
  padding: 9px 18px; border-radius: 12px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.2s;
}
.srs-browse-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.srs-browse-header button {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 18px;
}
.srs-browse-list { display: flex; flex-direction: column; gap: 8px; }
.srs-browse-card {
  padding: 11px 13px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
}
.srs-browse-card-q { font-size: 13px; font-weight: 600; color: var(--text); }
.srs-browse-card-a { font-size: 12px; color: var(--text3); margin-top: 3px; }
.srs-browse-card-meta { font-size: 10px; color: var(--text3); margin-top: 5px; opacity: 0.6; }

/* ── Empty states ── */
.study-empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 40px 20px; gap: 8px;
}
.study-empty-icon { font-size: 44px; }
.study-empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.study-empty-sub { font-size: 13px; color: var(--text3); line-height: 1.6; max-width: 220px; }

/* ── Loading overlay ── */
.study-loading {
  position: absolute; inset: 0; z-index: 150;
  background: rgba(7,11,22,0.82);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  border-radius: inherit;
}
.study-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(124,92,255,0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.study-loading-text { font-size: 13px; color: var(--text2); font-weight: 500; }

/* ── Light mode overrides ── */
body.light-mode .study-header { background: rgba(249,250,251,0.95); border-bottom-color: #E5E7EB; }
body.light-mode .study-back-btn { background: #F3F4F6; border-color: #E5E7EB; color: #374151; }
body.light-mode .study-back-btn:hover { background: rgba(124,92,255,0.08); border-color: rgba(124,92,255,0.25); color: #7c5cff; }
body.light-mode .study-ai-pill { background: #F9FAFB; border-color: #E5E7EB; color: #374151; }
body.light-mode .study-close-btn { background: #F9FAFB; border-color: #E5E7EB; color: #374151; }
body.light-mode .study-textarea { background: #fff; border-color: #D1D5DB; color: #111; }
body.light-mode .study-select { background: #F9FAFB; border-color: #D1D5DB; color: #374151; }
body.light-mode .study-source-card,
body.light-mode .study-output-panel,
body.light-mode .study-upload-preview {
  background: #fff;
  border-color: #E5E7EB;
}
body.light-mode .study-upload-btn {
  background: rgba(0,180,160,0.06);
  border-color: rgba(0,180,160,0.2);
  color: #009e8c;
}
body.light-mode .study-source-actions {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
body.light-mode .study-source-action { color: #6b7280; }
body.light-mode .study-source-action:hover,
body.light-mode .study-source-action.active {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.25);
  color: #7c5cff;
}
body.light-mode .fc-card-face.front { background: rgba(124,92,255,0.05); border-color: rgba(124,92,255,0.2); }
body.light-mode .fc-card-face.back { background: rgba(16,185,129,0.05); border-color: rgba(16,185,129,0.2); }
body.light-mode .quiz-question { background: #F9FAFB; border-color: #E5E7EB; }
body.light-mode .quiz-option-btn { background: #fff; border-color: #E5E7EB; color: #111; }
/* ══════════════════════════════════════════════════════════════════════
   NEXORA — NEW FEATURES CSS v1.0
   Paste this entire block at the END of styles.css
   Covers:
     1. 📊 Progress Dashboard
     2. 📝 Summarizer
     3. 🎤 Viva Mode
   (PDF export uses its own inline print styles — no CSS needed here)
════════════════════════════════════════════════════════════════════════ */

/* ── Shared study tab scrolling (needed for 5 tabs) ── */
.study-tab-bar .study-tab { white-space: nowrap; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════════
   STUDY SCREEN LAYOUT — source card, mode grid, stats
════════════════════════════════════════════════════════════════════════ */

/* Source card */
.study-source-shell {
  padding: 10px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.study-source-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.study-source-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text3);
  text-transform: uppercase;
}
.study-source-sub {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin-top: -4px;
}

/* Notes / Podcast pill tabs */
.study-source-actions {
  display: flex;
  gap: 8px;
}
/* .study-source-action defined earlier — canonical block */

/* Add File — full-width teal gradient button */
.study-addfile-btn {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,229,200,0.25);
  background: linear-gradient(135deg, rgba(0,229,200,0.12) 0%, rgba(59,130,246,0.12) 100%);
  color: #00e5c8;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
  text-align: center;
}
.study-addfile-btn:hover {
  background: linear-gradient(135deg, rgba(0,229,200,0.22) 0%, rgba(59,130,246,0.22) 100%);
  border-color: rgba(0,229,200,0.5);
  box-shadow: 0 0 16px rgba(0,229,200,0.2);
  transform: scale(1.01);
}
.study-addfile-btn:active { transform: scale(0.98); }

/* Upload preview */
.study-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
}
.study-upload-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.study-upload-info  { flex: 1; min-width: 0; }
.study-upload-name  { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-upload-meta  { margin-top: 2px; font-size: 11px; color: var(--text3); }
.study-upload-remove {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.1);
  color: #fca5a5; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: background 0.18s, transform 0.12s;
}
.study-upload-remove:hover { background: rgba(248,113,113,0.22); transform: scale(1.1); }

/* Output panel */
.study-output-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 14px;
}

/* ── Mode grid — 3×3 square cards ── */
.study-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}
@media (max-width: 360px) {
  .study-mode-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

.study-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  position: relative;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
  /* Override study-tab inherited styles that break the grid */
  min-width: 0;
  flex-shrink: 1;
  width: 100%;
  /* Remove the active dot indicator inherited from study-tab */
}
/* Suppress the dot indicator from .study-tab.active::after on mode cards */
.study-mode-card.active::after {
  display: none;
}
.smc-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s;
}
.smc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  line-height: 1.2;
  transition: color 0.18s;
}

/* Hover — lift */
.study-mode-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.study-mode-card:hover .smc-icon { transform: scale(1.18); }
.study-mode-card:hover .smc-label { color: var(--text); }

/* Active — purple glow */
.study-mode-card.active {
  background: rgba(124,92,255,0.22);
  border-color: rgba(124,92,255,0.5);
  box-shadow: 0 4px 20px rgba(124,92,255,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-1px);
}
.study-mode-card.active .smc-label {
  color: #fff;
  font-weight: 700;
}
.study-mode-card.active .smc-icon {
  filter: drop-shadow(0 0 8px rgba(124,92,255,0.7));
}

/* ── Stats row ── */
.study-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 8px;
  flex-shrink: 0;
}
.study-stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
}
.study-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.study-stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text3);
  text-transform: uppercase;
}

/* Light mode */
body.light-mode .study-source-card,
body.light-mode .study-output-panel,
body.light-mode .study-upload-preview { background: #fff; border-color: #E5E7EB; }
body.light-mode .study-source-action  { background: rgba(124,92,255,0.06); border-color: rgba(124,92,255,0.15); color: #374151; }
body.light-mode .study-source-action:hover,
body.light-mode .study-source-action.active { background: rgba(124,92,255,0.14); border-color: rgba(124,92,255,0.4); color: #7c5cff; }
body.light-mode .study-addfile-btn    { background: rgba(0,180,160,0.06); border-color: rgba(0,180,160,0.2); color: #009e8c; }
body.light-mode .study-mode-card      { background: #f9fafb; border-color: #e5e7eb; }
body.light-mode .study-mode-card:hover { background: #f3f4f6; }
body.light-mode .study-mode-card.active { background: rgba(124,92,255,0.1); border-color: rgba(124,92,255,0.35); }
body.light-mode .smc-label            { color: #6b7280; }
body.light-mode .study-mode-card.active .smc-label { color: #7c5cff; }
body.light-mode .study-stat-card      { background: #fff; border-color: #e5e7eb; }

/* ══════════════════════════════════════════════════════════════════════
   COLLAPSIBLE ZONE — source card + mode grid + stats collapse on select
════════════════════════════════════════════════════════════════════════ */
.study-collapsible {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  /* Animate via max-height for smooth open/close */
  max-height: 1000px;
  opacity: 1;
  transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
}
.study-collapsible.collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
  /* Margin/padding must also collapse to zero — no ghost space */
  margin: 0 !important;
  padding: 0 !important;
}
/* Also collapse inner elements' margins when parent collapses */
.study-collapsible.collapsed .study-source-shell,
.study-collapsible.collapsed .study-mode-grid,
.study-collapsible.collapsed .study-stats-row {
  margin: 0 !important;
  padding: 0 !important;
}

/* ── Mode chip — compact selected-mode indicator in the header ── */
.study-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  border: 1px solid rgba(124,92,255,0.4);
  background: rgba(124,92,255,0.15);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, opacity 0.2s;
  /* Slide-in animation */
  animation: chip-pop 0.28s cubic-bezier(0.34,1.56,0.64,1);
  flex-shrink: 0;
}
@keyframes chip-pop {
  from { opacity: 0; transform: scale(0.7) translateX(-6px); }
  to   { opacity: 1; transform: scale(1) translateX(0); }
}
.study-mode-chip:hover {
  background: rgba(124,92,255,0.25);
  border-color: rgba(124,92,255,0.65);
  transform: scale(1.04);
}
.study-mode-chip:active { transform: scale(0.96); }
.smc-chip-icon { font-size: 14px; line-height: 1; }
.smc-chip-label { font-size: 12px; }

/* Light mode chip */
body.light-mode .study-mode-chip {
  background: rgba(124,92,255,0.1);
  border-color: rgba(124,92,255,0.3);
  color: #7c5cff;
}

/* ══════════════════════════════════════════════════════════════════════
   1. 📊 PROGRESS DASHBOARD
════════════════════════════════════════════════════════════════════════ */

.dash-overlay {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}
.dash-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.dash-overlay.open .dash-panel {
  transform: translateY(0);
}

.dash-panel {
  width: 100%;
  max-height: 88%;
  background: var(--bg-surface, rgba(14, 20, 38, 0.97));
  border: 1px solid var(--border2);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(40px);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -12px 60px rgba(0,0,0,0.6);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dash-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.dash-close-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.dash-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 3-column stat grid */
.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dash-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dash-stat-icon { font-size: 20px; }
.dash-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.dash-stat-label { font-size: 10px; color: var(--text3); text-align: center; line-height: 1.3; }

/* Section containers */
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.dash-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-section-sub { font-weight: 400; color: var(--text3); }

/* Progress bars */
.dash-progress-row { display: flex; flex-direction: column; gap: 5px; }
.dash-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
}
.dash-progress-track {
  height: 7px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.dash-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 3px;
}
.dash-progress-bar.secondary { background: var(--accent); }

/* Quiz accuracy stats row */
.dash-quiz-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.dash-quiz-stat { flex: 1; text-align: center; }
.dash-quiz-val { font-size: 20px; font-weight: 700; color: var(--text); }
.dash-quiz-lab { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* Sparkline */
.dash-spark-wrap {
  height: 60px;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface2);
  padding: 6px 8px;
}
.dash-spark { width: 100%; height: 100%; }
.dash-no-data { font-size: 11px; color: var(--text3); text-align: center; padding-top: 18px; }

/* Topic chips */
.dash-topics-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dash-topic-chip {
  font-size: 10px;
  background: var(--accent-dim);
  color: var(--primary);
  border-radius: 20px;
  padding: 3px 10px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bar chart */
.dash-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  margin-bottom: 8px;
}
.dash-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.dash-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--surface2);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}
.dash-bar-fill {
  width: 100%;
  background: var(--primary);
  opacity: 0.55;
  border-radius: 4px 4px 0 0;
  transition: height 500ms ease;
  min-height: 0;
}
.dash-bar-fill.today { opacity: 1; background: var(--primary); }
.dash-bar-label { font-size: 9px; color: var(--text3); }
.dash-bar-label.today { color: var(--primary); font-weight: 600; }
.dash-study-footer { font-size: 11px; color: var(--text3); text-align: center; }

/* Quiz history table */
.dash-quiz-hist { display: flex; flex-direction: column; gap: 1px; }
.dash-quiz-hist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.dash-quiz-hist-row:last-child { border-bottom: none; }
.dash-quiz-hist-topic { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-quiz-hist-diff  { font-size: 10px; color: var(--text3); }
.dash-quiz-hist-score { font-weight: 700; min-width: 36px; text-align: right; }
.dash-quiz-hist-score.good { color: var(--success); }
.dash-quiz-hist-score.mid  { color: var(--warning); }
.dash-quiz-hist-score.low  { color: var(--error); }
.dash-quiz-hist-time  { font-size: 10px; color: var(--text3); min-width: 44px; text-align: right; }

/* ══════════════════════════════════════════════════════════════════════
   2. 📝 SUMMARIZER
════════════════════════════════════════════════════════════════════════ */

.sum-compare-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.sum-compare-label input[type="checkbox"] { accent-color: var(--primary); }

.sum-loading {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
}
.sum-error {
  padding: 14px 16px;
  background: rgba(255,78,106,0.08);
  border: 1px solid var(--error);
  border-radius: 12px;
  font-size: 13px;
  color: var(--error);
}

.sum-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.sum-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.sum-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding-left: 16px; /* room for the colored left border */
}
.sum-card-model { font-size: 12px; font-weight: 600; color: var(--text2); }
.sum-copy-btn {
  font-size: 11px;
  color: var(--text3);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 150ms;
}
.sum-copy-btn:hover { color: var(--primary); }

.sum-card-body {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  overflow-y: auto;
  max-height: 320px;
}
.sum-card-body ul, .sum-card-body ol {
  padding-left: 18px;
  margin: 6px 0;
}
.sum-card-body li { margin-bottom: 4px; }
.sum-card-body strong { color: var(--text); }
.sum-card-body p { margin-bottom: 8px; }
.sum-card-body p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════════════════════
   3. 🎤 VIVA MODE
════════════════════════════════════════════════════════════════════════ */

/* Progress bar */
.viva-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.viva-progress-label { font-size: 11px; color: var(--text3); white-space: nowrap; }
.viva-progress-track {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.viva-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 400ms ease;
}

/* Question card */
.viva-question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.viva-q-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 8px;
}
.viva-question-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  font-weight: 500;
}

/* Answer area */
.viva-answer-section { margin-bottom: 8px; }
.viva-answer-label { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.viva-answer-input { min-height: 80px; }

/* Mic button */
.viva-mic-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, border-color 150ms;
  flex-shrink: 0;
}
.viva-mic-btn.active {
  background: rgba(124,92,255,0.15);
  border-color: var(--primary);
  animation: mic-pulse 1s ease-in-out infinite;
}

/* Critique card */
.viva-critique-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 12px;
}
.viva-critique-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.viva-critique-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}
.viva-critique-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}

/* Score badges */
.viva-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  padding: 3px 10px;
  border: 1px solid transparent;
}
.viva-score-badge.good { color: var(--success); background: rgba(0,229,160,0.08); border-color: rgba(0,229,160,0.2); }
.viva-score-badge.mid  { color: var(--warning); background: rgba(255,184,48,0.08); border-color: rgba(255,184,48,0.2); }
.viva-score-badge.low  { color: var(--error);   background: rgba(255,78,106,0.08); border-color: rgba(255,78,106,0.2); }

/* Results screen */
.viva-result-header {
  text-align: center;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.viva-result-grade { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.viva-result-score { font-size: 40px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.viva-result-topic { font-size: 12px; color: var(--text3); }

/* Review items */
.viva-review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.viva-review-q {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 8px;
}
.viva-review-num {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 1px;
}
.viva-review-answer {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  border-left: 2px solid var(--border2);
  padding-left: 10px;
  margin-bottom: 8px;
}
.viva-review-critique {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}

/* Light mode tweaks */
body.light-mode .dash-panel {
  background: rgba(255,255,255,0.97);
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .dash-stat-card,
body.light-mode .dash-section,
body.light-mode .sum-card,
body.light-mode .viva-question-card,
body.light-mode .viva-critique-card,
body.light-mode .viva-review-item {
  background: #f8f7ff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .dash-bar-wrap { background: rgba(0,0,0,0.06); }
body.light-mode .dash-spark-wrap { background: rgba(0,0,0,0.04); }
body.light-mode .sum-card-header { background: rgba(0,0,0,0.03); }

/* ── Export PDF buttons (in study panels) ── */
.study-export-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding: 0 4px;
}
.study-export-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 150ms;
}
.study-export-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}
/* ══════════════════════════════════════════════════════════════════════
   NEXORA — 🎧 PODCAST / LISTEN MODE CSS
   Paste at the END of styles.css (after nexora-features.css block)
════════════════════════════════════════════════════════════════════════ */

/* ── Hero section ── */
.podcast-hero {
  text-align: center;
  padding: 20px 16px 12px;
  border-bottom: none;
}
.podcast-hero-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 16px rgba(124,92,255,0.5));
  animation: podcast-pulse 3s ease-in-out infinite;
}
@keyframes podcast-pulse {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(124,92,255,0.4)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 24px rgba(124,92,255,0.7)); transform: scale(1.05); }
}
.podcast-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.podcast-hero-sub {
  font-size: 12px;
  color: var(--text3);
}

/* ── OR divider ── */
.podcast-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--text3);
  font-size: 11px;
}
.podcast-or-divider::before,
.podcast-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── File upload ── */
.podcast-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1.5px dashed var(--border2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.podcast-upload-label:hover {
  border-color: var(--primary);
  background: var(--accent-dim);
  color: var(--primary);
}

/* ── Generate button (wider) ── */
.podcast-gen-btn { flex: 1; justify-content: center; min-width: 100%; }

/* ── Library ── */
.podcast-library {
  margin-top: 20px;
  padding: 0 4px 80px;
}
.podcast-library-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
}
.podcast-lib-empty {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.podcast-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.podcast-lib-item:hover {
  border-color: var(--primary);
  background: var(--accent-dim);
}
.podcast-lib-icon { font-size: 20px; flex-shrink: 0; }
.podcast-lib-meta { flex: 1; overflow: hidden; }
.podcast-lib-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podcast-lib-date { font-size: 10px; color: var(--text3); margin-top: 2px; }
.podcast-lib-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.podcast-lib-del:hover { background: var(--error-dim); color: var(--error); }

/* ══════════════════════════════════════════════════════════════════════
   GENERATING STATE
════════════════════════════════════════════════════════════════════════ */
.podcast-generating-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 20px;
  min-height: 320px;
}

/* Animated orb */
.podcast-gen-orb {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.podcast-gen-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: podcast-ring-expand 2s ease-out infinite;
}
.podcast-gen-ring.r1 { width: 80px; height: 80px; animation-delay: 0s; }
.podcast-gen-ring.r2 { width: 80px; height: 80px; animation-delay: 0.55s; }
.podcast-gen-ring.r3 { width: 80px; height: 80px; animation-delay: 1.1s; }

@keyframes podcast-ring-expand {
  0%   { transform: scale(0.4); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.podcast-gen-icon {
  position: relative;
  font-size: 28px;
  z-index: 2;
  animation: podcast-pulse 2s ease-in-out infinite;
}

.podcast-status-text {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  font-weight: 500;
}

.podcast-gen-progress-track {
  width: 80%;
  max-width: 240px;
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.podcast-gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 600ms ease;
}

.podcast-gen-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text3);
}
.podcast-gen-step-arrow { color: var(--border2); }

/* ══════════════════════════════════════════════════════════════════════
   PLAYER
════════════════════════════════════════════════════════════════════════ */
.podcast-player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 18px 16px;
  margin: 4px 4px 12px;
}

/* Animated waveform visual */
.podcast-player-visual {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.podcast-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
}
.podcast-wave span {
  display: block;
  width: 4px;
  border-radius: 99px;
  background: var(--primary);
  opacity: 0.7;
  animation: podcast-wave-bar 1.2s ease-in-out infinite;
}
.podcast-wave span:nth-child(1)  { height: 12px; animation-delay: 0.0s; }
.podcast-wave span:nth-child(2)  { height: 24px; animation-delay: 0.1s; }
.podcast-wave span:nth-child(3)  { height: 32px; animation-delay: 0.2s; }
.podcast-wave span:nth-child(4)  { height: 20px; animation-delay: 0.3s; }
.podcast-wave span:nth-child(5)  { height: 36px; animation-delay: 0.4s; }
.podcast-wave span:nth-child(6)  { height: 28px; animation-delay: 0.5s; }
.podcast-wave span:nth-child(7)  { height: 36px; animation-delay: 0.4s; }
.podcast-wave span:nth-child(8)  { height: 20px; animation-delay: 0.3s; }
.podcast-wave span:nth-child(9)  { height: 30px; animation-delay: 0.2s; }
.podcast-wave span:nth-child(10) { height: 14px; animation-delay: 0.1s; }

@keyframes podcast-wave-bar {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50%       { transform: scaleY(1.0); opacity: 1.0; }
}

.podcast-player-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  text-align: center;
}
.podcast-player-info-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.podcast-player-info { font-size: 11px; color: var(--text3); }
.podcast-tts-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.podcast-tts-badge.cf  { background: rgba(0,229,160,0.1);   color: var(--success); border: 1px solid rgba(0,229,160,0.25); }
.podcast-tts-badge.web { background: rgba(124,92,255,0.1); color: var(--primary); border: 1px solid rgba(124,92,255,0.25); }

/* Speed */
.podcast-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.podcast-speed-label { font-size: 11px; color: var(--text3); }
.podcast-speed-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

/* Seek bar */
.podcast-seek-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.podcast-time { font-size: 10px; color: var(--text3); min-width: 30px; }
.podcast-seek-track {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.podcast-seek-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 400ms linear;
}

/* Controls */
.podcast-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}
.podcast-ctrl-btn {
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 100ms, background 150ms;
}
.podcast-ctrl-btn:active { transform: scale(0.9); }
.podcast-ctrl-btn.primary {
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,92,255,0.4);
}
.podcast-ctrl-btn.primary:hover { background: var(--primary-hover); }
.podcast-ctrl-btn.secondary {
  width: 38px;
  height: 38px;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.podcast-ctrl-btn.secondary:hover { background: var(--accent-dim); color: var(--primary); }

/* Action buttons */
.podcast-action-row {
  display: flex;
  gap: 8px;
}
.podcast-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 10px;
  padding: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 150ms;
}
.podcast-action-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Transcript ── */
.podcast-transcript-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 0 4px;
  overflow: hidden;
  margin-bottom: 80px;
}
.podcast-transcript-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.podcast-transcript {
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 0;
}
.podcast-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 14px;
  border-radius: 8px;
  margin: 1px 4px;
  transition: background 200ms;
}
.podcast-line.active {
  background: rgba(124,92,255,0.1);
  border-left: 2px solid var(--primary);
}
.podcast-line.student {
  background: rgba(0,229,224,0.04);
}
.podcast-speaker {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.podcast-line-text {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.55;
}
.podcast-line.active .podcast-line-text {
  color: var(--text);
  font-weight: 500;
}

/* ── Light mode ── */
body.light-mode .podcast-player-card,
body.light-mode .podcast-transcript-wrap,
body.light-mode .podcast-lib-item,
body.light-mode .podcast-lib-empty {
  background: #f8f7ff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .podcast-upload-label { background: #f0eeff; border-color: rgba(124,92,255,0.2); }
body.light-mode .podcast-gen-progress-track,
body.light-mode .podcast-seek-track { background: rgba(0,0,0,0.08); }

/* ══════════════════════════════════════════════════════════════
   FLASHCARD REFRESH — visual-only override layer
   Keeps all existing IDs and JS untouched.
════════════════════════════════════════════════════════════════════════ */

#spanel-flashcard.active {
  gap: 16px;
  align-content: start;
}

#spanel-flashcard .study-input-section,
#spanel-flashcard #fcDeckArea,
#spanel-flashcard #fcExplainPanel,
#spanel-flashcard #fcSavedSection {
  background: linear-gradient(180deg, rgba(22,14,42,0.92), rgba(13,11,26,0.96));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  backdrop-filter: blur(18px);
}

#spanel-flashcard .study-input-section {
  border-radius: 22px;
  padding: 16px;
}

#spanel-flashcard .study-input-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: #8b93b2;
}

#spanel-flashcard .study-textarea {
  min-height: 92px;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

#spanel-flashcard .study-input-row {
  gap: 10px;
}

#spanel-flashcard .study-select {
  border-radius: 14px;
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.08);
}

#fcDeckArea {
  padding: 16px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}

#fcDeckArea::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(124,92,255,0.14), transparent 34%),
    radial-gradient(circle at bottom right, rgba(0,224,255,0.10), transparent 30%);
  pointer-events: none;
  opacity: 0.9;
}

#fcDeckArea > * {
  position: relative;
  z-index: 1;
}

.fc-deck-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.fc-deck-topic-tag {
  background: rgba(124,92,255,0.14);
  border: 1px solid rgba(124,92,255,0.28);
  color: #d8cfff;
  padding: 6px 11px;
  border-radius: 999px;
  max-width: 180px;
}

.fc-progress-text {
  margin-left: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text2);
}

.fc-save-all-btn {
  margin-left: auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.24);
  color: #7ee0bd;
}

.fc-card-wrap {
  perspective: 1600px;
  -webkit-perspective: 1600px;
}

.fc-card {
  height: 280px;
  border-radius: 26px;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fc-card-inner {
  border-radius: 26px;
  transition: transform 0.55s cubic-bezier(.2,.85,.2,1);
  -webkit-transition: -webkit-transform 0.55s cubic-bezier(.2,.85,.2,1);
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.fc-card.flipped .fc-card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.fc-card-face {
  border-radius: 26px;
  padding: 24px 22px 18px;
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  /* Force GPU layer in Safari — fixes bleed-through bug */
  -webkit-transform: translateZ(0.01px);
  transform: translateZ(0.01px);
  will-change: transform;
}

.fc-card-face::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,0.10), transparent 24%),
    radial-gradient(circle at 82% 16%, rgba(124,92,255,0.16), transparent 20%),
    linear-gradient(145deg, rgba(255,255,255,0.02), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.fc-card-face > * {
  position: relative;
  z-index: 1;
}

.fc-card-face.front {
  background:
    linear-gradient(145deg, rgba(124,92,255,0.18), rgba(0,224,255,0.07)),
    linear-gradient(180deg, rgba(20,25,44,0.96), rgba(12,16,27,0.98));
  border-color: rgba(124,92,255,0.26);
}

.fc-card-face.back {
  background:
    linear-gradient(145deg, rgba(16,185,129,0.12), rgba(124,92,255,0.06)),
    linear-gradient(180deg, rgba(22,14,42,0.96), rgba(13,11,26,0.98));
  border-color: rgba(16,185,129,0.24);
  transform: rotateY(180deg) translateZ(0.01px);
  -webkit-transform: rotateY(180deg) translateZ(0.01px);
}

.fc-card-label {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #9ca3c7;
  letter-spacing: 1px;
}

.fc-card-text {
  font-size: 18px;
  line-height: 1.55;
  font-weight: 600;
  color: #f4f7ff;
  text-wrap: pretty;
}

.fc-tap-hint {
  color: #8d95b6;
  letter-spacing: 0.2px;
}

.fc-hint-row {
  gap: 8px;
  margin-top: 2px;
}

.fc-hint-btn,
.fc-explain-btn {
  border-radius: 999px;
  padding: 7px 11px;
}

.fc-explain-btn {
  align-self: center;
  margin-top: auto;
}

.fc-nav {
  padding: 2px 2px 0;
  gap: 12px;
}

.fc-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

.fc-dots {
  flex: 1;
  justify-content: center;
  min-height: 16px;
}

.fc-card-actions {
  gap: 10px;
}

.fc-action-btn {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text2);
}

.fc-action-btn:hover {
  border-color: rgba(124,92,255,0.35);
  color: #eff6ff;
  background: rgba(124,92,255,0.14);
}

.fc-action-btn.save {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.24);
  color: #7ee0bd;
}

.fc-action-btn.save:hover {
  background: rgba(16,185,129,0.18);
  color: #c7f3df;
}

.fc-action-btn.flip-all {
  background: rgba(251,191,36,0.10);
  border-color: rgba(251,191,36,0.22);
  color: #f5c453;
}

.fc-action-btn.flip-all:hover {
  background: rgba(251,191,36,0.16);
  color: #ffe19a;
}

#fcExplainPanel {
  padding: 16px;
  border-radius: 22px;
}

.fc-explain-header {
  color: #d9dff7;
  margin-bottom: 12px;
}

.fc-explain-body {
  max-height: 180px;
  color: var(--text2);
}

#fcSavedSection {
  padding: 16px;
  border-radius: 22px;
  position: sticky;
  top: 6px;
}

.study-saved-title {
  color: #9aa4c9;
  letter-spacing: 1px;
}

.fc-saved-list {
  gap: 10px;
}

.fc-saved-deck {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
}

.fc-saved-deck:hover {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.25);
  transform: translateY(-1px);
}

.fc-saved-deck-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(124,92,255,0.12);
}

body.light-mode #spanel-flashcard .study-input-section,
body.light-mode #spanel-flashcard #fcDeckArea,
body.light-mode #spanel-flashcard #fcExplainPanel,
body.light-mode #spanel-flashcard #fcSavedSection {
  background: #fff;
  border-color: #e5e7eb;
  box-shadow: 0 12px 30px rgba(15,23,42,0.08);
}

body.light-mode .fc-deck-topic-tag {
  background: rgba(124,92,255,0.08);
  color: #5b21b6;
}

body.light-mode .fc-progress-text {
  background: #f8fafc;
  color: #6b7280;
  border-color: #e5e7eb;
}

body.light-mode .fc-card-face.front {
  background:
    linear-gradient(145deg, rgba(124,92,255,0.08), rgba(0,224,255,0.04)),
    linear-gradient(180deg, #fff7ff, #eef6ff);
  border-color: rgba(124,92,255,0.18);
}

body.light-mode .fc-card-face.back {
  background:
    linear-gradient(145deg, rgba(16,185,129,0.07), rgba(124,92,255,0.04)),
    linear-gradient(180deg, #f7fff9, #effaf5);
  border-color: rgba(16,185,129,0.18);
}

body.light-mode .fc-card-text {
  color: #111827;
}

body.light-mode .fc-card-label,
body.light-mode .fc-tap-hint,
body.light-mode .fc-explain-body,
body.light-mode .fc-saved-deck-meta {
  color: #6b7280;
}

@media (min-width: 901px) {
  #spanel-flashcard.active {
    grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.68fr);
    column-gap: 20px;
  }
  #spanel-flashcard .study-input-section {
    grid-column: 1;
    grid-row: 1;
  }
  #fcDeckArea {
    grid-column: 1;
    grid-row: 2;
  }
  #fcExplainPanel {
    grid-column: 1;
    grid-row: 3;
  }
  #fcSavedSection {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  .fc-card {
    height: 300px;
  }
  .fc-card-text {
    font-size: 19px;
  }
}

@media (max-width: 900px) {
  #spanel-flashcard.active {
    display: flex;
  }
  .fc-card {
    height: 250px;
  }
  .fc-card-text {
    font-size: 16px;
  }
  .fc-nav {
    gap: 8px;
  }
  .fc-nav-btn {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 700px) {
  #spanel-flashcard .study-input-section,
  #fcDeckArea,
  #fcExplainPanel,
  #fcSavedSection {
    padding: 14px;
    border-radius: 18px;
  }
  .fc-deck-meta {
    align-items: flex-start;
  }
  .fc-save-all-btn {
    margin-left: 0;
  }
  .fc-card {
    height: 220px;
  }
  .fc-card-face {
    padding: 18px 16px 16px;
  }
  .fc-card-text {
    font-size: 15px;
  }
  .fc-card-actions {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  #spanel-flashcard .study-input-section,
  #fcDeckArea,
  #fcExplainPanel,
  #fcSavedSection {
    padding: 12px;
    border-radius: 16px;
  }
  #spanel-flashcard .study-textarea {
    min-height: 78px;
    padding: 12px;
  }
  .fc-deck-meta {
    gap: 8px;
    align-items: stretch;
  }
  .fc-deck-topic-tag,
  .fc-progress-text {
    flex: 1 1 auto;
    min-width: 0;
  }
  .fc-save-all-btn {
    flex: 1 1 calc(50% - 4px);
    margin-left: 0;
    justify-content: center;
  }
  .fc-card {
    height: auto;
    min-height: 232px;
  }
  .fc-card-face {
    padding: 16px 14px 14px;
    overflow: auto;
  }
  .fc-card-text {
    font-size: 14px;
    line-height: 1.45;
  }
  .fc-nav {
    gap: 6px;
  }
  .fc-nav-btn {
    width: 38px;
    height: 38px;
  }
  .fc-action-btn {
    padding: 10px 11px;
    font-size: 12px;
  }
}

/* ══════════════════════════════════════════════════════════════
   PROGRESS DASHBOARD + CHAT BAR POLISH
════════════════════════════════════════════════════════════════════════ */

.dash-panel {
  max-height: calc(100dvh - 12px);
  min-height: 0;
  border-radius: 26px 26px 0 0;
  background:
    radial-gradient(circle at top left, rgba(124,92,255,0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(0,224,255,0.08), transparent 28%),
    linear-gradient(180deg, rgba(14,20,38,0.98), rgba(9,12,23,0.99));
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 12px;
  background:
    linear-gradient(180deg, rgba(14,20,38,0.98), rgba(14,20,38,0.92));
  backdrop-filter: blur(20px) saturate(140%);
}

.dash-header-title {
  font-size: 18px;
  letter-spacing: -0.2px;
}

.dash-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.dash-header-subtitle {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.45;
}

.dash-close-btn {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.09);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.dash-close-btn:hover {
  background: rgba(124,92,255,0.14);
  border-color: rgba(124,92,255,0.3);
  color: #e5ddff;
}

.dash-body {
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom));
  gap: 14px;
  min-height: 0;
  overscroll-behavior: contain;
}

.dash-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(135deg, rgba(124,92,255,0.16), rgba(0,224,255,0.08)),
    rgba(255,255,255,0.03);
  box-shadow: 0 14px 36px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  position: relative;
  min-width: 0;
}

.dash-hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.10), transparent 28%);
  pointer-events: none;
}

.dash-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.dash-hero-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #93c5fd;
  font-weight: 700;
}

.dash-hero-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.dash-hero-sub {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  max-width: 40ch;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-hero-ring {
  position: relative;
  z-index: 1;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 30%),
    linear-gradient(145deg, rgba(124,92,255,0.9), rgba(0,224,255,0.7));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 0 28px rgba(124,92,255,0.35);
  opacity: 0.95;
  flex-shrink: 0;
}

.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.dash-stat-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px 12px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 10px 30px rgba(0,0,0,0.16);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  animation: dash-pop 360ms ease both;
}

.dash-stat-card:nth-child(1) { animation-delay: 40ms; }
.dash-stat-card:nth-child(2) { animation-delay: 90ms; }
.dash-stat-card:nth-child(3) { animation-delay: 140ms; }

.dash-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 18px 42px rgba(0,0,0,0.22), 0 0 24px rgba(124,92,255,0.10);
  border-color: rgba(124,92,255,0.22);
}

.dash-stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.08), transparent 25%);
  opacity: 0.8;
  pointer-events: none;
}

.dash-stat-card.hero {
  grid-column: 1 / -1;
  text-align: left;
  align-items: flex-start;
  min-height: 0;
  padding: 18px 18px 16px;
  gap: 8px;
  border-color: rgba(124,92,255,0.22);
  background:
    linear-gradient(135deg, rgba(124,92,255,0.20), rgba(0,224,255,0.08)),
    rgba(255,255,255,0.03);
}

.dash-stat-note {
  margin-top: 2px;
  max-width: 36ch;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text2);
  text-align: left;
}

.dash-stat-card.secondary {
  background:
    linear-gradient(135deg, rgba(124,92,255,0.08), rgba(0,224,255,0.04)),
    var(--surface);
}
.dash-stat-card.tertiary {
  background:
    linear-gradient(135deg, rgba(16,185,129,0.08), rgba(124,92,255,0.04)),
    var(--surface);
}

.dash-stat-icon {
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.05));
}
.dash-stat-val {
  font-size: 30px;
  font-weight: 800;
  color: #9f7cff;
  line-height: 1;
  text-shadow: 0 0 18px rgba(124,92,255,0.18);
}
.dash-stat-card.hero .dash-stat-val {
  font-size: clamp(36px, 10vw, 48px);
}
.dash-stat-label {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
}
.dash-stat-card.hero .dash-stat-label {
  font-size: 12px;
}

.dash-section {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02)),
    var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 10px 28px rgba(0,0,0,0.14);
  min-width: 0;
}

.dash-section-title {
  font-size: clamp(12px, 2vw, 13px);
  margin-bottom: 14px;
  line-height: 1.35;
}

.dash-progress-track {
  height: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.dash-progress-bar {
  background: linear-gradient(90deg, #8b5cf6, #00e0ff);
  box-shadow: 0 0 12px rgba(124,92,255,0.35);
}

.dash-progress-bar.secondary {
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 12px rgba(16,185,129,0.28);
}

.dash-progress-label {
  font-size: 12px;
  color: var(--text2);
}

.dash-quiz-stats {
  gap: 10px;
}

.dash-quiz-stat {
  padding: 12px 8px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.dash-quiz-val {
  font-size: 24px;
  color: #f4f7ff;
}

.dash-spark-wrap {
  height: 86px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(124,92,255,0.18);
  background:
    linear-gradient(180deg, rgba(124,92,255,0.10), rgba(0,224,255,0.04)),
    rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.dash-spark {
  filter: drop-shadow(0 0 8px rgba(124,92,255,0.36));
}

.dash-spark polyline {
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(124,92,255,0.5));
}

.dash-spark circle {
  r: 4.3;
  filter: drop-shadow(0 0 6px rgba(124,92,255,0.48));
}

.dash-no-data {
  padding-top: 26px;
}

.dash-topics-row {
  gap: 8px;
}

.dash-topic-chip {
  background: rgba(124,92,255,0.16);
  color: #c7b8ff;
  border: 1px solid rgba(124,92,255,0.18);
}

.dash-bar-chart {
  height: 108px;
  gap: 8px;
}

.dash-bar-wrap {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.dash-bar-fill {
  background: linear-gradient(180deg, #a78bfa 0%, #7c5cff 50%, #00e0ff 100%);
  box-shadow: 0 0 16px rgba(124,92,255,0.24);
}

.dash-bar-fill.today {
  background: linear-gradient(180deg, #c084fc 0%, #8b5cf6 45%, #00e0ff 100%);
  box-shadow: 0 0 18px rgba(124,92,255,0.34);
}

.dash-bar-label {
  font-size: 10px;
}

.dash-study-footer {
  font-size: 12px;
  padding: 8px 12px 0;
  color: var(--text2);
}

.dash-quiz-hist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-quiz-hist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.dash-quiz-hist-topic {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-quiz-hist-diff {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124,92,255,0.12);
  color: #c7b8ff;
}

.dash-quiz-hist-score {
  font-weight: 700;
}
.dash-quiz-hist-score.good { color: #6ee7b7; }
.dash-quiz-hist-score.mid  { color: #fbbf24; }
.dash-quiz-hist-score.low  { color: #fca5a5; }

.dash-quiz-hist-time {
  color: var(--text3);
  font-size: 11px;
  white-space: nowrap;
}

@keyframes dash-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

body.light-mode .dash-panel {
  background:
    radial-gradient(circle at top left, rgba(124,92,255,0.08), transparent 34%),
    radial-gradient(circle at top right, rgba(0,224,255,0.05), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,252,0.99));
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .dash-header {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.92));
  border-bottom-color: rgba(0,0,0,0.08);
}
body.light-mode .dash-hero-banner,
body.light-mode .dash-stat-card,
body.light-mode .dash-section,
body.light-mode .dash-quiz-stat,
body.light-mode .dash-quiz-hist-row {
  background: #fff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .dash-stat-val {
  color: #7c5cff;
}
body.light-mode .dash-stat-card.hero {
  background: linear-gradient(135deg, rgba(124,92,255,0.08), rgba(0,224,255,0.05)), #fff;
}
body.light-mode .dash-hero-title,
body.light-mode .dash-quiz-val {
  color: #111827;
}
body.light-mode .dash-hero-sub,
body.light-mode .dash-study-footer,
body.light-mode .dash-quiz-hist-time {
  color: #6b7280;
}
body.light-mode .dash-quiz-hist-diff,
body.light-mode .dash-topic-chip {
  background: rgba(124,92,255,0.08);
  color: #5b21b6;
  border-color: rgba(124,92,255,0.14);
}
body.light-mode .dash-spark-wrap,
body.light-mode .dash-bar-wrap {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}

@media (min-width: 700px) {
  .dash-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dash-stat-card.hero {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .dash-panel {
    max-height: calc(100dvh - 8px);
    border-radius: 20px 20px 0 0;
  }
  .dash-header {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 14px 14px 12px;
  }
  .dash-header-copy {
    flex: 1 1 100%;
  }
  .dash-close-btn {
    margin-left: auto;
  }
  .dash-hero-banner {
    padding: 14px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .dash-hero-title {
    font-size: 14px;
  }
  .dash-hero-ring {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }
  .dash-grid-3 {
    grid-template-columns: 1fr;
  }
  .dash-stat-card.hero {
    padding: 16px 14px 14px;
  }
  .dash-stat-note {
    max-width: none;
  }
  .dash-quiz-hist-row {
    grid-template-columns: 1fr auto auto;
  }
  .dash-quiz-hist-time {
    grid-column: 1 / -1;
  }
  .dash-section {
    padding: 14px;
  }
}

#inputBar {
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  gap: 12px;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(16,10,32,0.92), rgba(16,10,32,0.98)),
    rgba(13,11,26,0.98);
  box-shadow: 0 -16px 46px rgba(0,0,0,0.52);
}

#inputBar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,92,255,0.45), rgba(0,224,255,0.32), transparent);
  pointer-events: none;
}

.input-wrap {
  flex: 0 1 min(840px, calc(100vw - 120px));
  max-width: min(840px, calc(100vw - 120px));
  min-height: 58px;
  padding: 10px 14px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(30,18,55,0.98), rgba(28,18,52,0.95));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 10px 28px rgba(0,0,0,0.16);
  transition:
    max-width 0.28s ease,
    flex-basis 0.28s ease,
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.28s ease;
}

#inputBar.is-expanded .input-wrap {
  flex: 1 1 auto;
  max-width: none;
  transform: translateY(0);
}

#inputBar.is-collapsed .input-wrap {
  transform: translateY(-1px);
}

.input-wrap:focus-within {
  border-color: rgba(124,92,255,0.7);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(124,92,255,0.24),
    0 0 22px rgba(124,92,255,0.16);
}

#userInput {
  font-size: 15px;
  line-height: 1.5;
}

#userInput::placeholder {
  color: #8d93b0;
}

.voice-toggle {
  width: 30px;
  height: 30px;
}

.camera-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  box-shadow:
    0 8px 22px rgba(124,92,255,0.38),
    0 0 0 1px rgba(255,255,255,0.05);
}

.send-btn:hover {
  box-shadow:
    0 10px 26px rgba(124,92,255,0.5),
    0 0 38px rgba(0,224,255,0.28),
    0 0 0 1px rgba(255,255,255,0.06);
}

body.light-mode #inputBar {
  background:
    linear-gradient(180deg, rgba(248,250,255,0.92), rgba(241,244,250,0.98));
  box-shadow: 0 -12px 34px rgba(15,23,42,0.12);
}

body.light-mode .input-wrap {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,249,252,0.96));
  border-color: rgba(124,92,255,0.12);
}

body.light-mode #userInput::placeholder {
  color: #9ca3af;
}

@media (max-width: 480px) {
  #inputBar {
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .input-wrap {
    flex: 1 1 auto;
    max-width: none;
    min-height: 54px;
    padding: 8px 12px;
  }
  #userInput {
    font-size: 14px;
  }
  .camera-btn,
  .voice-toggle {
    width: 28px;
    height: 28px;
  }
  .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
  }
  .dash-hero-banner {
    padding: 12px;
    gap: 10px;
  }
  .dash-hero-title {
    font-size: 13px;
  }
  .dash-hero-ring {
    width: 44px;
    height: 44px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   ✨ NEXORA — 15 FEATURE UPGRADE STYLES
   ══════════════════════════════════════════════════════════════════ */

/* ── FIX 3: Thinking bubble ──────────────────────────────────────── */
.thinking-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px !important;
  min-width: 60px;
}
.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, #7c5cff);
  opacity: 0.7;
  animation: thinkPulse 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* ── FEATURE 4: Smart Suggestions Bar ───────────────────────────── */
.smart-suggest-bar {
  display: flex;
  gap: 7px;
  padding: 6px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.smart-suggest-bar::-webkit-scrollbar { display: none; }
.smart-chip {
  flex-shrink: 0;
  padding: 6px 13px;
  background: rgba(124, 92, 255, 0.09);
  border: 1px solid rgba(124, 92, 255, 0.22);
  border-radius: 20px;
  font-size: 11.5px;
  color: #a78bfa;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, transform 0.12s, opacity 0.25s, scale 0.25s;
  font-weight: 500;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.smart-chip:hover, .smart-chip:active {
  background: rgba(124, 92, 255, 0.2);
  border-color: rgba(124,92,255,0.45);
  transform: scale(0.97);
}
/* Tap-to-dismiss fade */
.smart-chip.chip-dismissed {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}
.light-mode .smart-chip {
  background: rgba(124, 92, 255, 0.08);
  border-color: rgba(124, 92, 255, 0.2);
  color: #7c5cff;
}

/* ── FEATURE 5: Memory Panel ─────────────────────────────────────── */
.memory-brain-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 0.15s, transform 0.12s;
  line-height: 1;
}
.memory-brain-btn:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }
.light-mode .memory-brain-btn:hover { background: rgba(0,0,0,0.06); }

.memory-panel-popup {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 280px;
  background: var(--card, #0f172a);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.45);
  z-index: 9999;
  overflow: hidden;
  animation: memPanelIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes memPanelIn {
  from { opacity: 0; transform: scale(0.92) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}
.light-mode .memory-panel-popup {
  background: #fff;
  border-color: rgba(124,92,255,0.2);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.memory-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #7c5cff);
}
.light-mode .memory-panel-header { border-bottom-color: rgba(0,0,0,0.06); }
.memory-panel-header button {
  background: none; border: none; color: var(--text3, #64748b);
  font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
  transition: background 0.15s;
}
.memory-panel-header button:hover { background: rgba(255,255,255,0.08); }
.memory-panel-body { padding: 8px 16px 4px; }
.mem-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.light-mode .mem-row { border-bottom-color: rgba(0,0,0,0.05); }
.mem-row:last-child { border-bottom: none; }
.mem-label {
  color: var(--text3, #64748b);
  min-width: 90px;
  flex-shrink: 0;
  font-size: 11px;
  padding-top: 1px;
}
.mem-val {
  color: var(--text1, #f1f5f9);
  font-weight: 500;
  flex: 1;
  word-break: break-word;
  line-height: 1.4;
}
.light-mode .mem-val { color: #1e293b; }
.mem-topics { display: flex; flex-wrap: wrap; gap: 4px; }
.mem-topics span {
  background: rgba(124,92,255,0.12);
  color: var(--accent, #7c5cff);
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10.5px;
}
.mem-profile-bar {
  display: flex;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}
.mem-profile-fill.emotional { background: linear-gradient(90deg,#f472b6,#ec4899); }
.mem-profile-fill.logical   { background: linear-gradient(90deg,#60a5fa,#3b82f6); }
.mem-profile-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text3, #64748b);
}
.memory-panel-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.light-mode .memory-panel-footer { border-top-color: rgba(0,0,0,0.06); }
.memory-panel-footer button {
  width: 100%;
  padding: 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  color: #f87171;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}
.memory-panel-footer button:hover { background: rgba(239,68,68,0.2); }

/* ── FEATURE 6: Message Reactions ────────────────────────────────── */
.msg-reaction-bar {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  display: flex;
  gap: 4px;
  background: var(--card, #0f172a);
  border: 1px solid rgba(124,92,255,0.25);
  border-radius: 24px;
  padding: 5px 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  z-index: 200;
  animation: reactionBarIn 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
.light-mode .msg-reaction-bar {
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
@keyframes reactionBarIn {
  from { opacity: 0; transform: scale(0.85) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.reaction-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 8px;
  transition: transform 0.12s, background 0.12s;
  line-height: 1;
}
.reaction-btn:hover { transform: scale(1.3); background: rgba(124,92,255,0.1); }
.reaction-badge {
  position: absolute;
  bottom: -10px;
  right: -6px;
  font-size: 14px;
  pointer-events: none;
  line-height: 1;
}

/* ── FEATURE 7: Study-from-Chat button ───────────────────────────── */
.study-chat-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--accent, #7c5cff);
  opacity: 0.75;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, background 0.15s;
}
.study-chat-btn:hover { opacity: 1; background: rgba(124,92,255,0.1); }
.study-chat-btn svg { width: 18px; height: 18px; }

.voice-quick-btn {
  width: auto;
  min-width: 72px;
  padding: 0 12px;
  gap: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,92,255,0.16), rgba(56,189,248,0.10));
  border: 1px solid rgba(124,92,255,0.28);
}
.voice-quick-btn svg {
  flex-shrink: 0;
}
.voice-quick-btn:hover {
  background: linear-gradient(135deg, rgba(124,92,255,0.24), rgba(56,189,248,0.14));
  border-color: rgba(124,92,255,0.42);
  box-shadow: 0 0 12px rgba(124,92,255,0.18);
  transform: none;
}
.voice-toggle {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
}
.voice-toggle:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
}
.voice-toggle.active {
  background: rgba(0,224,255,0.10);
  border-color: rgba(0,224,255,0.25);
}

body.light-mode .voice-quick-btn {
  background: linear-gradient(135deg, rgba(124,92,255,0.10), rgba(56,189,248,0.08));
  border-color: rgba(124,92,255,0.18);
}
body.light-mode .voice-toggle {
  background: rgba(255,255,255,0.7);
  border-color: rgba(124,92,255,0.12);
}

/* ── FEATURE 8: Offline Banner ───────────────────────────────────── */
.offline-banner {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 14px;
  letter-spacing: 0.01em;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── FEATURE 10: Study Progress Banner ───────────────────────────── */
.study-progress-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 5px 16px;
  background: rgba(124,92,255,0.07);
  border-bottom: 1px solid rgba(124,92,255,0.12);
  flex-shrink: 0; /* CRITICAL: never grow, never shrink, stays fixed height */
  min-height: 0;
  overflow: hidden;
}
.spb-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  padding: 0 12px;
  cursor: default;
}
.spb-stat.due { cursor: pointer; }
.spb-stat.due .spb-val { color: #f59e0b; }
.spb-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #7c5cff);
  line-height: 1.2;
}
.spb-lab {
  font-size: 9px;
  color: var(--text3, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.spb-divider {
  width: 1px;
  height: 20px;
  background: rgba(124,92,255,0.15);
  flex-shrink: 0;
}

/* ── FEATURE 11: Podcast transcript clickable lines ──────────────── */
.podcast-line {
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.podcast-line:hover { background: rgba(124,92,255,0.1); }
.podcast-line.active { background: rgba(124,92,255,0.18); }

/* ── FEATURE 12: SVG theme toggle ────────────────────────────────── */
.theme-svg {
  transition: transform 0.3s ease, opacity 0.2s;
  display: block;
}
.sun-svg { color: #f59e0b; animation: sunSpin 0.4s ease; }
.moon-svg { color: #818cf8; animation: moonFade 0.3s ease; }
@keyframes sunSpin {
  from { transform: rotate(-45deg) scale(0.7); opacity: 0; }
  to   { transform: rotate(0)      scale(1);   opacity: 1; }
}
@keyframes moonFade {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
#themeToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}
#themeToggle:hover { background: rgba(255,255,255,0.1); }
.light-mode #themeToggle:hover { background: rgba(0,0,0,0.06); }

/* ── FEATURE 13: Daily Challenge Panel ───────────────────────────── */
.daily-challenge-panel {
  position: absolute;
  bottom: 90px;
  left: 12px;
  right: 12px;
  background: var(--card, #0f172a);
  border: 1px solid rgba(124,92,255,0.35);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  z-index: 9990;
  animation: challengeSlideUp 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.light-mode .daily-challenge-panel {
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
@keyframes challengeSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.dc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.dc-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #7c5cff);
  background: rgba(124,92,255,0.12);
  padding: 3px 10px;
  border-radius: 20px;
}
.dc-close {
  background: none; border: none; color: var(--text3, #64748b);
  font-size: 16px; cursor: pointer; padding: 2px 6px;
  border-radius: 6px; transition: background 0.15s;
}
.dc-close:hover { background: rgba(255,255,255,0.07); }
.dc-question {
  font-size: 14px;
  font-weight: 600;
  color: var(--text1, #f1f5f9);
  line-height: 1.5;
  margin-bottom: 14px;
}
.light-mode .dc-question { color: #1e293b; }
.dc-reveal-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.dc-reveal-btn:hover { opacity: 0.9; }
.dc-answer {
  font-size: 13px;
  color: var(--text2, #94a3b8);
  line-height: 1.6;
  background: rgba(124,92,255,0.07);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.dc-actions {
  display: flex;
  gap: 8px;
}
.dc-rate {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.dc-rate:hover { opacity: 0.85; transform: scale(0.97); }
.dc-rate.hard { background: rgba(239,68,68,0.15);  color: #f87171; }
.dc-rate.ok   { background: rgba(251,191,36,0.15); color: #fbbf24; }
.dc-rate.easy { background: rgba(34,197,94,0.15);  color: #4ade80; }

/* ── FEATURE 14 & 15: Deck action buttons ────────────────────────── */
.fc-deck-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.fc-deck-action-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 7px;
  transition: background 0.15s, transform 0.12s;
  line-height: 1;
}
.fc-deck-action-btn:hover { background: rgba(124,92,255,0.12); transform: scale(1.1); }
.srs-anki-btn {
  background: rgba(124,92,255,0.12);
  border: 1px solid rgba(124,92,255,0.2);
  border-radius: 8px;
  color: var(--accent, #7c5cff);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.srs-anki-btn:hover { background: rgba(124,92,255,0.22); }

/* ── FEATURE 15: Import toast ────────────────────────────────────── */
.import-toast {
  position: absolute;
  bottom: 90px;
  left: 12px;
  right: 12px;
  background: var(--card, #0f172a);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text1, #f1f5f9);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9995;
  line-height: 1.6;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.light-mode .import-toast { background: #fff; color: #1e293b; }
.import-toast-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 7px 14px;
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.import-toast-btn:hover { opacity: 0.9; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}


/* ══════════════════════════════════════════════════════════════════════
   NEXORA — 📓 NOTEBOOK MODE CSS
   NotebookLM-style multi-source study companion
════════════════════════════════════════════════════════════════════════ */

/* ── Sources section (inside podcast setup + standalone tab) ── */
.nb-sources-section {
  border-radius: 16px;
  padding: 14px 14px 10px;
}

.nb-sources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.nb-sources-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Add files label (acts as button) */
.nb-add-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.3);
  color: var(--primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.nb-add-file-btn:hover {
  background: rgba(124,92,255,0.25);
  border-color: var(--primary);
}

/* Clear button */
.nb-clear-btn {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  color: #f87171;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: background 150ms;
}
.nb-clear-btn:hover { background: rgba(248,113,113,0.2); }

/* Source chip list */
.nb-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.nb-sources-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text3);
  padding: 4px 0;
}

.nb-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.2);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: 11px;
  color: var(--text2);
  max-width: 200px;
  transition: border-color 150ms;
}
.nb-source-chip:hover { border-color: var(--primary); }

.nb-source-chip-icon { font-size: 13px; flex-shrink: 0; }

.nb-source-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.nb-source-chip-size {
  font-size: 9px;
  color: var(--text3);
  flex-shrink: 0;
}

.nb-source-remove {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 11px;
  padding: 0 0 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 150ms;
}
.nb-source-remove:hover { color: #f87171; }

/* ── Notebook save/load row ── */
.nb-notebook-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.nb-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.nb-action-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}
.nb-action-btn-primary {
  background: rgba(124,92,255,0.15);
  border-color: rgba(124,92,255,0.35);
  color: var(--primary);
}
.nb-action-btn-primary:hover {
  background: rgba(124,92,255,0.28);
}

/* ── Library panel ── */
.nb-library-panel {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.nb-library-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
}

.nb-library-list {
  max-height: 220px;
  overflow-y: auto;
}

.nb-lib-empty {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  padding: 14px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nb-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 6px;
  transition: border-color 150ms, background 150ms;
}
.nb-lib-item:hover {
  border-color: var(--primary);
  background: var(--accent-dim);
}

.nb-lib-item-icon { font-size: 18px; flex-shrink: 0; }

.nb-lib-item-meta { flex: 1; overflow: hidden; }

.nb-lib-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-lib-item-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}

.nb-lib-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.nb-lib-load-btn {
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.3);
  color: var(--primary);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms;
}
.nb-lib-load-btn:hover { background: rgba(124,92,255,0.28); }

.nb-lib-del-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 150ms, background 150ms;
}
.nb-lib-del-btn:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* ── RAG Chat section ── */
.nb-rag-section {
  margin: 16px 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.nb-rag-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
}

.nb-rag-input-row {
  display: flex;
  gap: 8px;
}

.nb-rag-input {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 150ms;
}
.nb-rag-input:focus { border-color: var(--primary); }
.nb-rag-input::placeholder { color: var(--text3); }

.nb-rag-ask-btn {
  background: var(--primary);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
  flex-shrink: 0;
}
.nb-rag-ask-btn:hover { background: var(--primary-hover, #6b4de6); }
.nb-rag-ask-btn:active { transform: scale(0.96); }
.nb-rag-ask-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nb-rag-answer-area {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
}

.nb-rag-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text3);
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}

.nb-rag-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(124,92,255,0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: nb-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes nb-spin {
  to { transform: rotate(360deg); }
}

.nb-rag-answer {
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 12px;
  padding: 12px;
}

.nb-rag-answer-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}

.nb-rag-answer-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.nb-rag-copy-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all 150ms;
}
.nb-rag-copy-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}

.nb-rag-error {
  font-size: 12px;
  color: #f87171;
  padding: 10px 12px;
  background: rgba(248,113,113,0.08);
  border-radius: 10px;
}

/* ── Standalone Notebook tab ── */
.nb-standalone-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 80px;
}

/* ── Light mode overrides ── */
body.light-mode .nb-source-chip {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.15);
}
body.light-mode .nb-lib-item,
body.light-mode .nb-rag-section {
  background: #f8f7ff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .nb-rag-input {
  background: #fff;
  border-color: rgba(124,92,255,0.2);
  color: #1a1a2e;
}
body.light-mode .nb-rag-answer {
  background: rgba(124,92,255,0.04);
}

/* ══════════════════════════════════════════════════════════════════════
   NEXORA — 📓 NOTEBOOK v2 ADDITIONS
   Smart chunking · source highlighting · progress queue · export
════════════════════════════════════════════════════════════════════════ */

/* ── Generation progress bar ── */
.nb-gen-progress-wrap {
  margin: 10px 0 6px;
  padding: 10px 12px;
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.18);
  border-radius: 12px;
}

.nb-gen-progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.nb-gen-progress-track {
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 5px;
}

.nb-gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent, #00e5e0));
  border-radius: 99px;
  transition: width 500ms ease;
}

.nb-gen-progress-sub {
  font-size: 10px;
  color: var(--text3);
}

/* ── Source chip highlight states ── */

/* Queried: pulsing blue-purple — shown while AI is searching */
@keyframes nb-chip-query-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,92,255,0.5); border-color: var(--primary); }
  50%       { box-shadow: 0 0 0 5px rgba(124,92,255,0); border-color: var(--primary); }
}
.nb-source-chip.nb-source-queried {
  border-color: var(--primary);
  background: rgba(124,92,255,0.2);
  animation: nb-chip-query-pulse 1s ease-in-out 3;
}

/* Cited: green flash — shown when AI answer references this source */
@keyframes nb-chip-cited-flash {
  0%   { background: rgba(0,229,160,0.35); border-color: #00e5a0; }
  60%  { background: rgba(0,229,160,0.2);  border-color: #00e5a0; }
  100% { background: rgba(124,92,255,0.1); border-color: rgba(124,92,255,0.2); }
}
.nb-source-chip.nb-source-cited {
  animation: nb-chip-cited-flash 3s ease forwards;
}

/* ── Citation spans inside RAG answers ── */
.nb-citation {
  display: inline-block;
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 6px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--primary);
  cursor: default;
  vertical-align: baseline;
  line-height: 1.4;
}

/* ── Chunks hint in RAG answer footer ── */
.nb-rag-chunks-hint {
  font-size: 10px;
  color: var(--text3);
  margin-left: 6px;
  align-self: center;
}

/* ── Light mode ── */
body.light-mode .nb-gen-progress-wrap {
  background: rgba(124,92,255,0.05);
  border-color: rgba(124,92,255,0.15);
}
body.light-mode .nb-citation {
  background: rgba(124,92,255,0.08);
}


/* ══════════════════════════════════════════════════════════════════════
   NEXORA — Notebook Features v2 CSS
   Quick actions · Voice btn · Drag-drop · Resume banner ·
   Web-search prompt · Shortcut hints · Language selector
════════════════════════════════════════════════════════════════════════ */

/* ── Quick actions row (below generate button) ── */
.nb-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nb-quick-btn {
  flex: 1;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.nb-quick-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}
.nb-quick-btn.nb-voice-active {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.4);
  color: #ef4444;
  animation: nb-voice-pulse 1.5s ease-in-out infinite;
}
@keyframes nb-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── Drag-and-drop states ── */
.nb-source-chip[draggable="true"] { cursor: grab; }
.nb-source-chip[draggable="true"]:active { cursor: grabbing; }
.nb-source-chip.nb-dragging {
  opacity: 0.4;
  transform: scale(0.96);
}
.nb-source-chip.nb-drag-over {
  border-color: var(--primary);
  background: rgba(124,92,255,0.25);
  transform: scale(1.04);
  transition: transform 120ms;
}

/* ── Resume banner ── */
.nb-resume-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.25);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text2);
  flex-wrap: wrap;
}
.nb-resume-btn {
  background: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 150ms;
}
.nb-resume-btn:hover { background: var(--primary-hover, #6b4de6); }
.nb-resume-dismiss {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  margin-left: auto;
  padding: 2px 4px;
}
.nb-resume-dismiss:hover { color: var(--text); }

/* ── Web search prompt ── */
.nb-web-search-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(0,229,160,0.06);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 10px;
  font-size: 11px;
  color: var(--text2);
  flex-wrap: wrap;
}
.nb-web-search-btn {
  background: rgba(0,229,160,0.12);
  border: 1px solid rgba(0,229,160,0.3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #00e5a0;
  cursor: pointer;
  transition: background 150ms;
}
.nb-web-search-btn:hover { background: rgba(0,229,160,0.22); }

/* ── Shortcut hints row ── */
.nb-shortcut-hints-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nb-shortcut-hint {
  font-size: 10px;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-family: monospace;
  white-space: nowrap;
}

/* ── Web source chip variant ── */
.nb-source-chip[data-kind="web"],
.nb-source-chip .nb-source-chip-icon[data-kind="web"] {
  border-color: rgba(0,229,160,0.3);
  background: rgba(0,229,160,0.08);
}

/* ── Light mode ── */
body.light-mode .nb-resume-banner { background: rgba(124,92,255,0.05); }
body.light-mode .nb-web-search-prompt { background: rgba(0,229,160,0.04); }
body.light-mode .nb-shortcut-hint { background: #f0eeff; border-color: rgba(124,92,255,0.15); }


/* ══════════════════════════════════════════════════════════════════════
   NEXORA — 📘 BCS PREP / MCQ BANK CSS
════════════════════════════════════════════════════════════════════════ */

/* ── Deck selector row ── */
.mcq-selector-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Import row ── */
.mcq-import-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mcq-import-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.mcq-import-btn:hover {
  background: var(--accent-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Deck header ── */
.mcq-deck-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mcq-deck-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mcq-deck-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.mcq-reset-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all 150ms;
  flex-shrink: 0;
}
.mcq-reset-btn:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248,113,113,0.08);
}

/* ── Deck progress bar ── */
.mcq-progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.mcq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 99px;
  transition: width 600ms ease;
}
.mcq-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text3);
}

/* ── Session progress bar ── */
.mcq-session-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 4px;
}
.mcq-session-progress-track {
  flex: 1;
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.mcq-session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent, #00e5e0));
  border-radius: 99px;
  transition: width 400ms ease;
}
.mcq-session-counter {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  font-weight: 600;
}

/* ── Quiz area ── */
.mcq-quiz-area {
  padding: 4px 4px 0;
}
.mcq-question-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* ── Options ── */
.mcq-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
/* mcq-option-btn styles moved to PREMIUM MCQ OPTION BUTTONS section below */

/* ── Feedback ── */
.mcq-feedback {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}
.mcq-feedback-correct {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  color: #10b981;
}
.mcq-feedback-wrong {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--text);
}
.mcq-explanation {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text2);
  font-style: italic;
}
.mcq-feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.mcq-explain-btn,
.mcq-audio-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.mcq-explain-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--accent-dim); }
.mcq-audio-btn:hover   { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.08); }
.mcq-ai-explanation {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
}

/* ── Next button ── */
.mcq-next-btn {
  width: 100%;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 150ms, transform 80ms;
  margin-top: 4px;
}
.mcq-next-btn:hover  { background: var(--primary-hover, #6b4de6); }
.mcq-next-btn:active { transform: scale(0.98); }

/* ── Session done card ── */
.mcq-done-card {
  text-align: center;
  padding: 28px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin: 8px 4px;
}
.mcq-done-emoji { font-size: 40px; margin-bottom: 8px; }
.mcq-done-score { font-size: 28px; font-weight: 800; color: var(--text); }
.mcq-done-pct   { font-size: 13px; color: var(--text3); margin: 4px 0 16px; }
.mcq-done-actions { display: flex; gap: 10px; justify-content: center; }
.mcq-btn-primary {
  background: var(--primary);
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 150ms;
}
.mcq-btn-primary:hover { background: var(--primary-hover, #6b4de6); }
.mcq-btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 150ms;
}
.mcq-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ── Stats panel ── */
.mcq-stats-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
}
.mcq-stats-body {
  margin-top: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.mcq-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.mcq-stat-q {
  font-size: 11px;
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcq-badge {
  font-size: 10px;
  border-radius: 6px;
  padding: 2px 7px;
  font-weight: 600;
  flex-shrink: 0;
}
.mcq-badge-mastered  { background: rgba(16,185,129,0.12); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
.mcq-badge-due       { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.mcq-badge-upcoming  { background: rgba(124,92,255,0.1);   color: var(--primary); border: 1px solid rgba(124,92,255,0.2); }

/* ── Light mode ── */
body.light-mode .mcq-question-text,
body.light-mode .mcq-option-btn,
body.light-mode .mcq-done-card {
  background: #f8f7ff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .mcq-option-text { color: #1a1a2e; }

/* ══════════════════════════════════════════════════════════════════════
   NEXORA — MCQ v2: Exam Mode · Streak · Offline
════════════════════════════════════════════════════════════════════════ */

/* ── Exam preset buttons ── */
.mcq-exam-presets-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mcq-exam-presets-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  flex-shrink: 0;
}
.mcq-exam-preset-btn {
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  color: #fbbf24;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms;
}
.mcq-exam-preset-btn:hover {
  background: rgba(251,191,36,0.2);
  border-color: #fbbf24;
}

/* ── Exam mode banner (timer bar) ── */
.mcq-exam-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 12px;
  padding: 8px 14px;
  margin: 8px 0 4px;
}
.mcq-exam-label {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
}
.mcq-exam-time {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 52px;
  text-align: center;
}
.mcq-timer-warning { color: #f97316 !important; }
.mcq-timer-critical {
  color: #ef4444 !important;
  animation: mcq-timer-blink 0.5s ease-in-out infinite;
}
@keyframes mcq-timer-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.mcq-exam-abort {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.3);
  color: #f87171;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms;
}
.mcq-exam-abort:hover { background: rgba(248,113,113,0.22); }

/* ── Daily streak display ── */
.mcq-streak-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 8px 0 4px;
}
.mcq-streak-flame {
  font-size: 20px;
  flex-shrink: 0;
}
.mcq-streak-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.mcq-streak-today {
  font-size: 11px;
  color: var(--text3);
}
.mcq-streak-ring {
  flex-shrink: 0;
  transition: stroke-dashoffset 600ms ease;
}
#mcqStreakRingFill {
  transition: stroke-dashoffset 600ms ease;
}

/* ── Offline status ── */
.mcq-offline-status {
  font-size: 10px;
  color: var(--text3);
  margin-top: 6px;
  padding-left: 2px;
}

/* ── Light mode ── */
body.light-mode .mcq-streak-display { background: #f8f7ff; border-color: rgba(124,92,255,0.12); }
body.light-mode .mcq-exam-banner    { background: rgba(251,191,36,0.06); }

/* ── Live BCS button ── */
.mcq-live-btn {
  background: linear-gradient(135deg, rgba(124,92,255,0.2), rgba(0,229,160,0.15));
  border: 1px solid rgba(124,92,255,0.4);
  color: var(--primary);
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms;
  position: relative;
  overflow: hidden;
}
.mcq-live-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transform: translateX(-100%);
  transition: transform 400ms;
}
.mcq-live-btn:hover::before { transform: translateX(100%); }
.mcq-live-btn:hover {
  background: linear-gradient(135deg, rgba(124,92,255,0.3), rgba(0,229,160,0.22));
  border-color: var(--primary);
}
.mcq-live-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Live status line ── */
.mcq-live-status {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  padding-left: 2px;
  min-height: 16px;
  transition: color 300ms;
}

/* ══════════════════════════════════════════════════════════════════════
   NEXORA — MCQ Final Polish: Category filters · Pagination · Page size
════════════════════════════════════════════════════════════════════════ */

/* ── Category filter chips ── */
.mcq-cat-filter-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 8px;
}
.mcq-cat-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
}
.mcq-cat-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--accent-dim);
}
.mcq-cat-btn.active {
  background: rgba(124,92,255,0.18);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Page size selector ── */
.mcq-page-size-sel {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

/* ── Pagination row ── */
.mcq-pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px 2px;
}
.mcq-page-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.mcq-page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--accent-dim);
}
.mcq-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.mcq-page-info {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
}

/* ── Light mode ── */
body.light-mode .mcq-cat-btn        { background: #f0eeff; border-color: rgba(124,92,255,0.15); }
body.light-mode .mcq-cat-btn.active { background: rgba(124,92,255,0.12); }
body.light-mode .mcq-page-btn       { background: #f0eeff; border-color: rgba(124,92,255,0.15); }

/* ── Category filter rebuild spinner ── */
.mcq-cat-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(124,92,255,0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: mcq-cat-spin 0.55s linear infinite;
  vertical-align: middle;
  margin-left: 4px;
  flex-shrink: 0;
}
@keyframes mcq-cat-spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════════════════
   NEXORA — 🎓 IELTS PREP HUB CSS
════════════════════════════════════════════════════════════════════════ */

/* ── IELTS Hero ── */
/* -- IELTS Hero v2 -- */

/* Breadcrumb */
.ielts-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 0 6px;
  font-family: "Inter","DM Sans",sans-serif;
  font-size: 12px; font-weight: 500;
}
.ielts-bc-item {
  color: rgba(196,181,253,0.5); cursor: pointer;
  transition: color 0.15s;
}
.ielts-bc-item:hover { color: rgba(196,181,253,0.9); }
.ielts-bc-active { color: #e9d5ff !important; font-weight: 700; cursor: default; }
.ielts-bc-sep { color: rgba(196,181,253,0.35); font-size: 14px; }
.ielts-bc-grid-btn {
  margin-left: 4px; background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.2); border-radius: 6px;
  color: rgba(196,181,253,0.6); padding: 4px 6px; cursor: pointer;
  display: flex; align-items: center; transition: all 0.15s;
}
.ielts-bc-grid-btn:hover { background: rgba(139,92,246,0.22); color: #e9d5ff; }

/* Hero banner */
.ielts-hero2 {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(76,29,149,0.55) 0%, rgba(109,40,217,0.3) 50%, rgba(28,18,52,0.6) 100%);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
  min-height: 160px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 32px rgba(0,0,0,0.4);
}
.ielts-hero2::before {
  content: ""; position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(192,38,211,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.ielts-hero2-top {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px;
}
.ielts-hero2-icon-wrap { flex-shrink: 0; }
.ielts-hero2-text { flex: 1; min-width: 0; }
.ielts-hero2-title {
  font-family: "Playfair Display","Georgia",serif;
  font-size: 18px; font-weight: 800;
  color: #f0eaff; letter-spacing: -0.01em; line-height: 1.2;
  margin-bottom: 3px;
}
.ielts-hero2-sub {
  font-family: "Inter","DM Sans",sans-serif;
  font-size: 11px; color: rgba(196,181,253,0.6); margin-bottom: 8px;
}
.ielts-hero2-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ielts-hero2-tag {
  font-family: "Inter",sans-serif; font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(139,92,246,0.18); border: 1px solid rgba(139,92,246,0.28);
  color: #ddd6fe;
}
.ielts-hero2-arrow {
  font-size: 22px; color: rgba(196,181,253,0.35);
  flex-shrink: 0; align-self: flex-start; margin-top: 2px;
}

/* Hero stats row */
.ielts-hero2-stats {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px;
}
.ielts-hero2-stat {
  background: rgba(13,11,26,0.5); border: 1px solid rgba(139,92,246,0.15);
  border-radius: 12px; padding: 10px 8px; text-align: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ielts-hero2-stat-val {
  font-family: "Playfair Display",serif;
  font-size: 22px; font-weight: 800; color: #e9d5ff; line-height: 1;
  margin-bottom: 3px;
}
.ielts-hero2-stat-label {
  font-family: "Inter",sans-serif; font-size: 10px; font-weight: 500;
  color: rgba(196,181,253,0.5); text-transform: uppercase; letter-spacing: 0.06em;
}

/* Section labels */
.ielts-section-label {
  font-family: "Inter",sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(196,181,253,0.45); margin: 14px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.ielts-section-label::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(139,92,246,0.2), transparent);
}

/* Card grid — 3 equal columns */
.ielts-card-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
  margin-bottom: 4px;
}
@media (max-width: 400px) { .ielts-card-grid { grid-template-columns: repeat(2,1fr); } }

/* Base card */
.ielts-card {
  position: relative; display: flex; flex-direction: column;
  align-items: flex-start; gap: 0; padding: 14px 12px 12px;
  border-radius: 18px; border: 1px solid rgba(139,92,246,0.15);
  background: rgba(28,18,52,0.55);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 4px 20px rgba(0,0,0,0.3);
  cursor: pointer; text-align: left;
  transition: transform 0.18s cubic-bezier(0.34,1.3,0.64,1), border-color 0.2s, box-shadow 0.2s;
}
.ielts-card:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 8px 28px rgba(0,0,0,0.4);
}
.ielts-card:active { transform: scale(0.96); }

/* Icon bubble */
.ielts-card-icon-wrap {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; flex-shrink: 0;
  transition: transform 0.2s;
}
.ielts-card:hover .ielts-card-icon-wrap { transform: scale(1.08) rotate(-3deg); }
.ielts-card-icon-wrap svg { stroke-width: 1.8; }

/* Card body */
.ielts-card-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ielts-card-title {
  font-family: "Inter","Sora",sans-serif; font-size: 14px; font-weight: 700;
  color: #f0eaff; letter-spacing: -0.01em; line-height: 1.2;
}
.ielts-card-sub {
  font-family: "Inter","DM Sans",sans-serif; font-size: 10.5px;
  color: rgba(196,181,253,0.5); line-height: 1.3; margin-bottom: 6px;
}
.ielts-card-arrow {
  position: absolute; top: 12px; right: 12px;
  font-size: 16px; color: rgba(196,181,253,0.25);
  transition: color 0.2s, transform 0.2s;
}
.ielts-card:hover .ielts-card-arrow { color: rgba(196,181,253,0.7); transform: translateX(2px); }

/* Micro-badges */
.ielts-card-badge {
  display: inline-flex; align-items: center;
  font-family: "Inter",sans-serif; font-size: 9.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em;
}
.ielts-badge-teal   { background: rgba(20,184,166,0.15); border: 1px solid rgba(20,184,166,0.3); color: #5eead4; }
.ielts-badge-amber  { background: rgba(217,119,6,0.15);  border: 1px solid rgba(217,119,6,0.3);  color: #fcd34d; }
.ielts-badge-purple { background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.3); color: #c4b5fd; }
.ielts-badge-red    { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.ielts-badge-blue   { background: rgba(14,165,233,0.15); border: 1px solid rgba(14,165,233,0.3); color: #7dd3fc; }

/* Color-coded icon bubbles */
.ielts-icon-teal   { background: rgba(20,184,166,0.18);  border: 1px solid rgba(20,184,166,0.25);  color: #5eead4; }
.ielts-icon-amber  { background: rgba(217,119,6,0.18);   border: 1px solid rgba(217,119,6,0.25);   color: #fcd34d; }
.ielts-icon-purple { background: rgba(139,92,246,0.18);  border: 1px solid rgba(139,92,246,0.25);  color: #c4b5fd; }
.ielts-icon-red    { background: rgba(239,68,68,0.18);   border: 1px solid rgba(239,68,68,0.25);   color: #fca5a5; }
.ielts-icon-blue   { background: rgba(14,165,233,0.18);  border: 1px solid rgba(14,165,233,0.25);  color: #7dd3fc; }

/* Card accent borders */
.ielts-card-teal   { border-color: rgba(20,184,166,0.2);  }
.ielts-card-amber  { border-color: rgba(217,119,6,0.2);   }
.ielts-card-purple { border-color: rgba(139,92,246,0.2);  }
.ielts-card-red    { border-color: rgba(239,68,68,0.2);   }
.ielts-card-blue   { border-color: rgba(14,165,233,0.2);  }
.ielts-card-teal:hover   { border-color: rgba(20,184,166,0.5);  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 28px rgba(20,184,166,0.15); }
.ielts-card-amber:hover  { border-color: rgba(217,119,6,0.5);   box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 28px rgba(217,119,6,0.12); }
.ielts-card-purple:hover { border-color: rgba(139,92,246,0.5);  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 28px rgba(139,92,246,0.18); }
.ielts-card-red:hover    { border-color: rgba(239,68,68,0.5);   box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 28px rgba(239,68,68,0.12); }
.ielts-card-blue:hover   { border-color: rgba(14,165,233,0.5);  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 28px rgba(14,165,233,0.12); }

/* Idiom of the Day — glass serif card */
.idiom-card {
  background: rgba(28,18,52,0.6); border: 1px solid rgba(139,92,246,0.2);
  border-radius: 18px; padding: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 4px 20px rgba(0,0,0,0.3);
  margin-top: 14px;
}
.idiom-label {
  font-family: "Inter",sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(196,181,253,0.5); margin-bottom: 8px;
}
.idiom-phrase {
  font-family: "Playfair Display","Georgia",serif;
  font-size: 17px; font-weight: 700; color: #e9d5ff;
  letter-spacing: -0.01em; margin-bottom: 4px;
}
.idiom-meaning {
  font-family: "Inter","DM Sans",sans-serif; font-size: 12px;
  color: rgba(196,181,253,0.65); margin-bottom: 8px;
}
.idiom-example {
  font-family: "Playfair Display","Georgia",serif;
  font-size: 12px; font-style: italic; color: rgba(196,181,253,0.5);
  border-left: 2px solid rgba(20,184,166,0.4); padding-left: 10px;
  margin-bottom: 10px; line-height: 1.5;
}
.ielts-orb-speak-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(20,184,166,0.15); border: 1px solid rgba(20,184,166,0.3);
  border-radius: 999px; padding: 5px 12px;
  font-family: "Inter",sans-serif; font-size: 11px; font-weight: 600;
  color: #5eead4; cursor: pointer; transition: all 0.15s;
}
.ielts-orb-speak-btn:hover { background: rgba(20,184,166,0.25); border-color: rgba(20,184,166,0.5); }

/* Daily Tip — amber accent card */
.daily-tip-card {
  background: linear-gradient(135deg, rgba(92,45,10,0.5), rgba(120,53,15,0.3));
  border: 1px solid rgba(217,119,6,0.25); border-radius: 18px; padding: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 20px rgba(0,0,0,0.3);
  margin-top: 10px;
}
.daily-tip-label {
  font-family: "Inter",sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(253,230,138,0.6); margin-bottom: 6px;
}
.daily-tip-title {
  font-family: "Inter","Sora",sans-serif; font-size: 14px; font-weight: 700;
  color: #fde68a; margin-bottom: 4px;
}
.daily-tip-detail {
  font-family: "Inter","DM Sans",sans-serif; font-size: 12px;
  color: rgba(253,230,138,0.6); line-height: 1.5;
}

/* Subtab bar */
.ielts-subtab-bar {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(28,18,52,0.5); border: 1px solid rgba(139,92,246,0.12);
  border-radius: 12px; margin: 0 0 12px;
  overflow-x: auto; scrollbar-width: none;
}
.ielts-subtab-bar::-webkit-scrollbar { display: none; }
.ielts-subtab {
  background: transparent; border: none; border-radius: 8px;
  padding: 7px 13px; font-size: 12px; font-weight: 600;
  color: rgba(196,181,253,0.55); cursor: pointer; white-space: nowrap;
  transition: color 150ms, background 150ms; flex-shrink: 0;
}
.ielts-subtab:hover { color: #e9d5ff; background: rgba(139,92,246,0.1); }
.ielts-subtab.active { color: #c4b5fd; background: rgba(139,92,246,0.18); }

/* Light mode */
body.light-mode .ielts-hero2 { background: rgba(139,92,246,0.07); border-color: rgba(139,92,246,0.2); }
body.light-mode .ielts-card { background: rgba(255,255,255,0.88); border-color: rgba(139,92,246,0.12); }
body.light-mode .ielts-card-title { color: #1e1b4b; }
body.light-mode .ielts-card-sub { color: #6b5a8a; }
body.light-mode .ielts-subtab-bar { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.06); }
body.light-mode .ielts-subtab.active { background: rgba(124,92,255,0.1); color: #4f35cc; }


/* ── IELTS back-to-overview button ── */
#ieltsBackBtn {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px 0;
  padding: 7px 14px;
  border: 1px solid rgba(124, 92, 255, 0.3);
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.08);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
#ieltsBackBtn:hover {
  background: rgba(124, 92, 255, 0.16);
  border-color: rgba(124, 92, 255, 0.55);
  color: var(--text);
}
#ieltsBackBtn:active { transform: scale(0.96); }
body.light-mode #ieltsBackBtn {
  background: rgba(124, 92, 255, 0.06);
  border-color: rgba(124, 92, 255, 0.2);
  color: #475569;
}

/* ── Part transition banner ── */
.ielts-part-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.25);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  animation: ielts-banner-in 0.3s ease;
}
@keyframes ielts-banner-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ielts-part-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(124,92,255,0.15);
  border-radius: 6px;
  padding: 2px 8px;
}
.ielts-part-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

/* ── Part 2 cue card ── */
.ielts-cue-card {
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.2);
  border-radius: 12px;
  padding: 12px;
}
.ielts-cue-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ── Sample answer box ── */
.ielts-sample-toggle {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  padding: 4px 0;
}
.ielts-sample-toggle::-webkit-details-marker { display: none; }
.ielts-sample-box {
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 12px;
  padding: 14px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text2);
}

/* ── Feedback grid ── */
.ielts-feedback-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.ielts-fb-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
}
.ielts-fb-label {
  font-weight: 700;
  color: var(--text2);
  min-width: 110px;
  flex-shrink: 0;
  font-size: 11px;
}
.ielts-fb-val {
  color: var(--text);
  line-height: 1.5;
}
.ielts-fb-improved {
  background: rgba(0,229,160,0.06);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ielts-fb-tip {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  margin-top: 4px;
}

/* ── Writing section ── */
.ielts-writing-prompt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin-top: 8px;
}
.ielts-word-target {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
}
.ielts-word-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  transition: color 300ms;
}

/* ── Progress grid ── */
.ielts-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.ielts-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}
.ielts-progress-skill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}
.ielts-progress-band {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1;
}
.ielts-progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.ielts-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #00e5a0);
  border-radius: 99px;
  transition: width 600ms ease;
}

/* ── Light mode ── */
body.light-mode .ielts-sample-box,
body.light-mode .ielts-writing-prompt,
body.light-mode .ielts-progress-card {
  background: #f8f7ff;
  border-color: rgba(124,92,255,0.12);
}
body.light-mode .ielts-cue-card { background: rgba(124,92,255,0.04); }

/* ══════════════════════════════════════════════════════════════════════
   NEXORA — IELTS v2: Timers · AI Explainer · SRS · Grammar Panel
════════════════════════════════════════════════════════════════════════ */

/* ── Exam timer bar ── */
.ielts-timer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 10px;
  padding: 6px 12px;
}
.ielts-timer-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  flex-shrink: 0;
}
.ielts-timer-display {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 48px;
}
.ielts-session-exit-btn {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.ielts-session-exit-btn:hover {
  background: rgba(239,68,68,0.25);
}
.ielts-timer-warning { color: #f97316 !important; }
.ielts-timer-critical {
  color: #ef4444 !important;
  animation: mcq-timer-blink 0.5s ease-in-out infinite;
}
.ielts-timer-input {
  width: 52px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text);
  text-align: center;
}
.ielts-timer-btn {
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.3);
  color: #fbbf24;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms;
  margin-left: auto;
}
.ielts-timer-btn:hover { background: rgba(251,191,36,0.22); }

/* ── AI Explain panel ── */
.ielts-explain-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ielts-explain-panel {
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.18);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  font-size: 12px;
}
.ielts-explain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 12px;
}
.ielts-explain-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}
.ielts-explain-close:hover { color: var(--text); }
.ielts-explain-body {
  color: var(--text);
  line-height: 1.65;
  font-size: 12px;
}
.ielts-explain-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 12px;
}
.ielts-explain-error {
  color: #f87171;
  font-size: 12px;
}
.ielts-srs-btn {
  background: rgba(0,229,160,0.1) !important;
  border-color: rgba(0,229,160,0.3) !important;
  color: #00e5a0 !important;
}

/* ── Grammar reference panel ── */
.ielts-grammar-answer {
  margin-top: 10px;
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
}

/* ── SRS missed notice ── */
.ielts-srs-notice {
  font-size: 11px;
  color: #00e5a0;
  background: rgba(0,229,160,0.08);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 8px 0;
}

/* ── SRS flashcard ── */
.ielts-srs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 16px;
  padding: 20px 16px;
  margin: 10px 0;
  min-height: 100px;
}
.ielts-srs-front {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
}
.ielts-srs-back {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  white-space: pre-wrap;
}
.ielts-srs-rating {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.ielts-srs-rate-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms;
}
.ielts-rate-hard {
  background: rgba(248,113,113,0.12);
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.3);
}
.ielts-rate-hard:hover { background: rgba(248,113,113,0.22); }
.ielts-rate-good {
  background: rgba(16,185,129,0.12);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
}
.ielts-rate-good:hover { background: rgba(16,185,129,0.22); }

/* ── Light mode ── */
body.light-mode .ielts-srs-card    { background: #f8f7ff; border-color: rgba(124,92,255,0.12); }
body.light-mode .ielts-explain-panel,
body.light-mode .ielts-grammar-answer { background: rgba(124,92,255,0.04); }
body.light-mode .ielts-timer-bar   { background: rgba(251,191,36,0.04); }

/* ══════════════════════════════════════════════════════════════════
   Smart Practice Generator — Advanced Controls
   ══════════════════════════════════════════════════════════════════ */

.ielts-advanced-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ielts-ctrl-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ielts-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 130px;
}

.ielts-ctrl-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Daily Challenge Banner ── */
.ielts-daily-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(124,92,255,0.10));
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.ielts-daily-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ielts-daily-left span:first-child {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24;
}

.ielts-daily-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.ielts-daily-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.ielts-daily-btn:not(:disabled):hover { opacity: 0.85; }

.ielts-daily-badge {
  background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(124,92,255,0.15));
  border: 1px solid rgba(251,191,36,0.35);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
  text-align: center;
  margin: 6px 0;
}

/* ── Weakness Heatmap ── */
.ielts-weak-report {
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.18);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
}

.ielts-weak-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ielts-weak-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ielts-weak-label {
  font-size: 12px;
  color: var(--text2);
  min-width: 110px;
  text-transform: capitalize;
}

.ielts-weak-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ielts-weak-bar {
  height: 100%;
  background: linear-gradient(90deg, #f87171, #ef4444);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.ielts-weak-count {
  font-size: 11px;
  color: var(--text3);
  min-width: 40px;
  text-align: right;
}

.ielts-weak-tip {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Light mode overrides */
body.light-mode .ielts-daily-banner { background: linear-gradient(135deg, rgba(251,191,36,0.08), rgba(124,92,255,0.06)); }
body.light-mode .ielts-weak-report  { background: rgba(124,92,255,0.04); }
body.light-mode .ielts-weak-bar-wrap { background: rgba(0,0,0,0.06); }

/* ══════════════════════════════════════════════════════════════════
   Exam Simulation Presets Strip
   ══════════════════════════════════════════════════════════════════ */

.ielts-presets-strip {
  margin-bottom: 12px;
}

.ielts-presets-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.ielts-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ielts-preset-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.ielts-preset-btn:hover {
  background: rgba(124,92,255,0.15);
  border-color: rgba(124,92,255,0.4);
  color: var(--accent);
}
.ielts-preset-hot {
  border-color: rgba(239,68,68,0.35);
  color: #f87171;
}
.ielts-preset-hot:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.6);
  color: #ef4444;
}
.ielts-preset-marathon {
  border-color: rgba(251,191,36,0.35);
  color: #fbbf24;
}
.ielts-preset-marathon:hover {
  background: rgba(251,191,36,0.12);
  border-color: rgba(251,191,36,0.6);
}

/* ══════════════════════════════════════════════════════════════════
   Skill-Based Recommendation Panel
   ══════════════════════════════════════════════════════════════════ */

.ielts-rec-panel {
  background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
}

.ielts-rec-title {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ielts-rec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ielts-rec-topic {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  text-transform: capitalize;
  flex: 1;
  min-width: 100px;
}

.ielts-rec-diff {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.ielts-rec-btn {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.ielts-rec-btn:hover {
  background: rgba(16,185,129,0.25);
  border-color: rgba(16,185,129,0.5);
}

/* Difficulty colour tags (shared across rec + wrong book) */
.ielts-diff-easy   { background: rgba(16,185,129,0.15); color: #10b981; }
.ielts-diff-medium { background: rgba(251,191,36,0.15);  color: #fbbf24; }
.ielts-diff-hard   { background: rgba(239,68,68,0.15);   color: #f87171; }

/* ══════════════════════════════════════════════════════════════════
   Wrong-Question Notebook
   ══════════════════════════════════════════════════════════════════ */

.ielts-wrongbook-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text3);
  font-size: 14px;
}

.ielts-wrongbook-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.ielts-wrongbook-clear {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: #f87171;
  cursor: pointer;
  transition: all 0.18s;
}
.ielts-wrongbook-clear:hover {
  background: rgba(239,68,68,0.2);
}

.ielts-wrongbook-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color 0.18s;
}
.ielts-wrongbook-card:hover {
  border-color: rgba(124,92,255,0.25);
}

.ielts-wrongbook-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ielts-wrongbook-topic {
  font-size: 11px;
  font-weight: 700;
  background: rgba(124,92,255,0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.ielts-wrongbook-diff {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.ielts-wrongbook-date {
  font-size: 11px;
  color: var(--text3);
  margin-left: auto;
}

.ielts-wrongbook-q {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  margin-bottom: 6px;
  line-height: 1.4;
}

.ielts-wrongbook-answers {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.ielts-wrongbook-wrong {
  font-size: 12px;
  color: #f87171;
}

.ielts-wrongbook-correct {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
}

.ielts-wrongbook-exp {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.ielts-wrongbook-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   IELTS AMBIENT VOICE — Live Band Panel + VAD Indicator
════════════════════════════════════════════════════════════════════════ */

/* ── Speaking session layout with side panel ── */
.ielts-speaking-ambient-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  align-items: start;
}
@media (max-width: 700px) {
  .ielts-speaking-ambient-layout {
    grid-template-columns: 1fr;
  }
}

/* ── VAD status indicator ── */
.ielts-vad-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
}
.ielts-vad-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.ielts-vad-indicator.vad-listening {
  background: #00e5c8;
  box-shadow: 0 0 0 0 rgba(0,229,200,0.6);
}
.ielts-vad-indicator.vad-listening.vad-pulse {
  animation: vad-pulse-ring 1.1s ease-out infinite;
}
.ielts-vad-indicator.vad-silence {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245,158,11,0.5);
}
.ielts-vad-indicator.vad-processing {
  background: #a855f7;
  box-shadow: 0 0 0 0 rgba(168,85,247,0.6);
}
.ielts-vad-indicator.vad-processing.vad-pulse {
  animation: vad-pulse-ring-purple 1.1s ease-out infinite;
}
.ielts-vad-indicator.vad-off {
  background: var(--text3);
  box-shadow: none;
}
/* Done state — mic stopped, waiting for user to tap Submit */
.ielts-vad-indicator.vad-done {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.6);
}
@keyframes vad-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0,229,200,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(0,229,200,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,229,200,0); }
}
@keyframes vad-pulse-ring-purple {
  0%   { box-shadow: 0 0 0 0 rgba(168,85,247,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(168,85,247,0); }
  100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); }
}
#ieltsVADLabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.01em;
}

/* Submit button ready-to-tap pulse */
.ielts-submit-ready {
  animation: ielts-submit-pulse 1.4s ease-in-out infinite !important;
  border-color: rgba(34,197,94,0.6) !important;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.5) !important;
}
@keyframes ielts-submit-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ── Live Band Panel ── */
#ieltsLiveBandPanel {
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.2);
  border-radius: 14px;
  padding: 14px 12px;
  position: sticky;
  top: 12px;
  transition: border-color 0.4s, background 0.4s;
}
#ieltsLiveBandPanel.panel-active {
  border-color: rgba(0,229,200,0.4);
  background: rgba(0,229,200,0.05);
}
.ilbp-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.ilbp-waiting {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}
.ilbp-main-band {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  transition: color 0.4s;
}
.ilbp-label {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}
.ilbp-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 8px;
}
.ilbp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.ilbp-row-label {
  min-width: 72px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 600;
}
.ilbp-bar-wrap {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.ilbp-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.34,1.56,0.64,1), background 0.4s;
}
.ilbp-row-score {
  font-size: 11px;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
  transition: color 0.4s;
}
.ilbp-words {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
}

/* ── Transcript area — minimal, ambient ── */
.ielts-transcript-area {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text2);
  min-height: 80px;
  line-height: 1.6;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.3s;
}
.ielts-transcript-area:focus {
  outline: none;
  border-color: rgba(0,229,200,0.35);
}

/* Light mode */
body.light-mode #ieltsLiveBandPanel {
  background: rgba(124,92,255,0.04);
  border-color: rgba(124,92,255,0.15);
}
body.light-mode .ielts-transcript-area {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.1);
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════════════
   IELTS ORB TEACHER — Voice teach buttons
════════════════════════════════════════════════════════════════════════ */

/* Orb speak button — appears on MCQ feedback, wrong book, SRS */
.ielts-orb-speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid rgba(0,229,200,0.35);
  background: rgba(0,229,200,0.08);
  color: #00e5c8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.ielts-orb-speak-btn:hover {
  background: rgba(0,229,200,0.16);
  border-color: rgba(0,229,200,0.6);
  transform: scale(1.04);
}
.ielts-orb-speak-btn:active {
  transform: scale(0.97);
}

/* Row above MCQ options — read question button */
.ielts-orb-question-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 8px;
}

/* Explain panel header with speak button */
.ielts-explain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Light mode */
body.light-mode .ielts-orb-speak-btn {
  border-color: rgba(0,180,160,0.3);
  background: rgba(0,180,160,0.06);
  color: #009e8c;
}

/* ══════════════════════════════════════════════════════════════════════
   IELTS MCQ — Type tabs, grammar chips, difficulty tabs, practice button
════════════════════════════════════════════════════════════════════════ */

/* Section header */
.ielts-mcq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ielts-mcq-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Type tabs (Mixed / Vocabulary / Grammar) */
.ielts-mcq-type-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.ielts-type-tab {
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.ielts-type-tab:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.ielts-type-tab.active {
  background: rgba(124,92,255,0.18);
  color: var(--primary);
}

/* Grammar sub-topic chips */
.ielts-grammar-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(124,92,255,0.05);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 12px;
}
.ielts-grammar-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(124,92,255,0.2);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ielts-grammar-chip:hover { border-color: var(--primary); color: var(--primary); }
.ielts-grammar-chip.active {
  background: rgba(124,92,255,0.18);
  border-color: var(--primary);
  color: var(--primary);
}

/* Difficulty + count row */
.ielts-practice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ielts-diff-tabs {
  display: flex;
  gap: 4px;
}
.ielts-diff-tab {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.ielts-diff-tab:hover { border-color: var(--primary); color: var(--primary); }
.ielts-diff-tab.active {
  background: rgba(124,92,255,0.15);
  border-color: var(--primary);
  color: var(--primary);
}
.ielts-count-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
}

/* Big practice button */
.ielts-practice-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #00c8b0 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(124,92,255,0.35);
  margin-bottom: 12px;
}
.ielts-practice-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(124,92,255,0.45);
}
.ielts-practice-btn:active { transform: scale(0.98); }
.ielts-practice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Light mode */
body.light-mode .ielts-mcq-type-tabs { background: rgba(0,0,0,0.03); }
body.light-mode .ielts-grammar-topics { background: rgba(124,92,255,0.03); }
body.light-mode .ielts-type-tab.active,
body.light-mode .ielts-diff-tab.active,
body.light-mode .ielts-grammar-chip.active { background: rgba(124,92,255,0.1); }

/* ══════════════════════════════════════════════════════════════════════
   VOCAB & GRAMMAR PREMIUM CARD (vg-*)
════════════════════════════════════════════════════════════════════════ */

.vg-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

/* Header */
.vg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.vg-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Mode tabs with sliding pill */
.vg-mode-tabs {
  position: relative;
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 30px;
  padding: 3px;
  gap: 0;
}
.vg-mode-pill {
  position: absolute;
  top: 3px; bottom: 3px;
  border-radius: 24px;
  background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 100%);
  transition: left 0.25s cubic-bezier(0.34,1.56,0.64,1), width 0.25s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  z-index: 0;
}
.vg-mode-tab {
  position: relative;
  z-index: 1;
  padding: 5px 14px;
  border: none;
  background: transparent;
  border-radius: 24px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}
.vg-mode-tab.active { color: #fff; }
.vg-mode-tab:not(.active):hover { color: var(--text2); }

/* Difficulty pills */
.vg-diff-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vg-diff-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}
.vg-diff-btn:hover { border-color: rgba(255,255,255,0.25); color: var(--text); }
.vg-diff-btn.active {
  background: linear-gradient(135deg, rgba(124,92,255,0.3) 0%, rgba(0,229,200,0.2) 100%);
  border-color: rgba(124,92,255,0.5);
  color: #fff;
  transform: scale(1.04);
}
.vg-diff-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vg-count-wrap { margin-left: auto; }
.vg-count-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
}

/* Big animated start button */
.vg-start-btn {
  width: 100%;
  height: 56px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, #7c5cff 0%, #22d3ee 50%, #10b981 100%);
  background-size: 200% 200%;
  animation: vg-gradient-shift 5s ease infinite;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 24px rgba(124,92,255,0.4);
}
.vg-start-btn:hover {
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 8px 32px rgba(124,92,255,0.5);
}
.vg-start-btn:active { transform: scale(0.98); }
.vg-start-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; animation: none; }
@keyframes vg-gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Streak row */
.vg-streak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
}
.vg-streak-label {
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
}
.vg-streak-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.vg-daily-btn {
  padding: 7px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251,191,36,0.3);
  background: rgba(251,191,36,0.08);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.vg-daily-btn:hover { background: rgba(251,191,36,0.15); border-color: rgba(251,191,36,0.5); }
.vg-daily-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Presets grid */
.vg-presets-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: -6px;
}
.vg-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 480px) {
  .vg-presets-grid { grid-template-columns: repeat(2, 1fr); }
}
.vg-preset {
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, color 0.18s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vg-preset:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
  color: var(--text);
  transform: translateY(-2px);
}
.vg-preset:active { transform: scale(0.96); }
.vg-preset-hot {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.06);
  color: #fca5a5;
}
.vg-preset-hot:hover {
  background: linear-gradient(135deg, rgba(251,146,60,0.25) 0%, rgba(239,68,68,0.25) 100%);
  border-color: rgba(239,68,68,0.5);
  color: #fff;
}

/* Timer row */
.vg-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
}
.vg-timer-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 600;
}
.vg-timer-val {
  color: #f87171;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.vg-timer-btn {
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.07);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
}
.vg-timer-btn:hover { background: rgba(255,255,255,0.12); }

/* AI source indicator */
.vg-ai-source {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--text3);
  font-weight: 600;
  padding: 0 2px;
}
.vg-ai-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: vg-dot-pulse 2s ease-in-out infinite;
}
.vg-ai-dot.cf      { background: #22d3ee; box-shadow: 0 0 5px #22d3ee; }
.vg-ai-dot.or      { background: #a855f7; box-shadow: 0 0 5px #a855f7; }
.vg-ai-dot.gemini  { background: #4ade80; box-shadow: 0 0 5px #4ade80; }
.vg-ai-dot.free    { background: #fbbf24; box-shadow: 0 0 5px #fbbf24; }
@keyframes vg-dot-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Light mode */
body.light-mode .vg-card {
  background: #fff;
  border-color: rgba(0,0,0,0.07);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
body.light-mode .vg-mode-tabs { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.light-mode .vg-diff-btn  { border-color: rgba(0,0,0,0.1); color: #6b7280; }
body.light-mode .vg-streak-row,
body.light-mode .vg-timer-row { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.06); }
body.light-mode .vg-preset    { background: #f9fafb; border-color: #e5e7eb; color: #374151; }
body.light-mode .vg-count-select { background: #f9fafb; border-color: #d1d5db; color: #111; }

/* ══════════════════════════════════════════════════════════════════════
   IELTS MINI ORB — hero orb that mirrors main orb state
════════════════════════════════════════════════════════════════════════ */

/* Hero layout */
.ielts-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg,
    rgba(124,92,255,0.10) 0%,
    rgba(0,229,200,0.06) 50%,
    rgba(8,12,24,0.4) 100%);
  border: 1px solid rgba(124,92,255,0.18);
  border-radius: 20px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.ielts-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(0,229,200,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.ielts-hero-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ielts-hero-welcome {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 3px;
  letter-spacing: 0.01em;
}
.ielts-hero-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.ielts-hero-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.ielts-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #00e5c8;
  box-shadow: 0 0 6px #00e5c8;
  animation: ielts-dot-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes ielts-dot-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.85); }
}
#ieltsHeroStatusText {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
}

/* Mini orb container */
.ielts-mini-orb {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 50%;
}

/* The orb sphere itself */
.ielts-mini-orb-inner {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%,
    #c4b5fd 0%, #8b5cf6 28%, #5b21b6 58%, #1e1b4b 85%, #0d0b1a 100%);
  box-shadow:
    0 0 0 1px rgba(139,92,246,0.3),
    0 0 20px rgba(124,92,255,0.6),
    0 0 40px rgba(0,224,255,0.1),
    inset 0 -8px 16px rgba(0,0,0,0.4);
  animation: mini-orb-breathe 4s ease-in-out infinite;
  transition: background 0.5s, box-shadow 0.5s;
}
/* Glass shine */
.ielts-mini-orb-inner::after {
  content: '';
  position: absolute;
  top: 12%; left: 18%;
  width: 28%; height: 16%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.35) 0%, transparent 70%);
  border-radius: 50%;
  transform: rotate(-30deg);
}
@keyframes mini-orb-breathe {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* Orbital rings */
.ielts-mini-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(180,240,255,0.4);
  box-shadow: 0 0 4px rgba(0,220,255,0.5);
  pointer-events: none;
}
.ielts-mini-orb-ring.r1 {
  transform: rotateX(70deg) rotateZ(20deg);
  animation: mini-orbit-1 14s linear infinite;
}
.ielts-mini-orb-ring.r2 {
  transform: rotateX(55deg) rotateZ(-40deg);
  animation: mini-orbit-2 20s linear infinite reverse;
  border-color: rgba(140,220,255,0.3);
}
@keyframes mini-orbit-1 {
  from { transform: rotateX(70deg) rotateZ(20deg); }
  to   { transform: rotateX(70deg) rotateZ(380deg); }
}
@keyframes mini-orbit-2 {
  from { transform: rotateX(55deg) rotateZ(-40deg); }
  to   { transform: rotateX(55deg) rotateZ(-400deg); }
}
.ielts-mini-orb { transform-style: preserve-3d; perspective: 300px; }

/* Halo glow */
.ielts-mini-orb-halo {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(0,200,255,0.15) 0%, transparent 70%);
  pointer-events: none;
  animation: mini-halo-pulse 4s ease-in-out infinite;
}
@keyframes mini-halo-pulse {
  0%,100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ── State colours for mini orb ── */
.ielts-mini-orb-inner.orb-idle {
  background: radial-gradient(circle at 35% 32%,
    #c4b5fd 0%, #8b5cf6 28%, #5b21b6 58%, #1e1b4b 85%, #0d0b1a 100%);
  box-shadow: 0 0 20px rgba(124,92,255,0.6), 0 0 40px rgba(0,224,255,0.1),
    inset 0 -8px 16px rgba(0,0,0,0.4);
}
.ielts-mini-orb-inner.orb-listening {
  background: radial-gradient(circle at 35% 32%,
    #a5f3fc 0%, #22d3ee 25%, #0891b2 55%, #0c4a6e 82%, #0d0b1a 100%);
  box-shadow: 0 0 24px rgba(34,211,238,0.7), 0 0 48px rgba(34,211,238,0.2),
    inset 0 -8px 16px rgba(0,0,0,0.4);
  animation: mini-orb-listen 0.65s ease-in-out infinite alternate;
}
@keyframes mini-orb-listen {
  from { transform: scale(1); }
  to   { transform: scale(1.1); }
}
.ielts-mini-orb-inner.orb-processing {
  background: radial-gradient(circle at 35% 32%,
    #fde68a 0%, #f59e0b 28%, #b45309 58%, #1c1917 85%, #0d0b1a 100%);
  box-shadow: 0 0 20px rgba(245,158,11,0.6), 0 0 40px rgba(245,158,11,0.15),
    inset 0 -8px 16px rgba(0,0,0,0.4);
}
.ielts-mini-orb-inner.orb-speaking {
  background: radial-gradient(circle at 35% 32%,
    #d9f99d 0%, #84cc16 28%, #3f6212 58%, #1a2e05 85%, #0d0b1a 100%);
  box-shadow: 0 0 24px rgba(132,204,22,0.65), 0 0 48px rgba(132,204,22,0.18),
    inset 0 -8px 16px rgba(0,0,0,0.4);
  animation: mini-orb-speak 0.5s ease-in-out infinite alternate;
}
@keyframes mini-orb-speak {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}
.ielts-mini-orb-inner.orb-examiner {
  background: radial-gradient(circle at 35% 32%,
    #e9d5ff 0%, #a855f7 28%, #6b21a8 58%, #1e1b4b 85%, #0d0b1a 100%);
  box-shadow: 0 0 24px rgba(168,85,247,0.7), 0 0 48px rgba(0,229,200,0.15),
    inset 0 -8px 16px rgba(0,0,0,0.4);
}
.ielts-mini-orb-inner.orb-error {
  background: radial-gradient(circle at 35% 32%,
    #fca5a5 0%, #ef4444 28%, #991b1b 58%, #1c0a0a 85%, #0d0b1a 100%);
  box-shadow: 0 0 20px rgba(239,68,68,0.6), inset 0 -8px 16px rgba(0,0,0,0.4);
}

/* ══════════════════════════════════════════════════════════════════════
   PREMIUM MCQ OPTION BUTTONS
════════════════════════════════════════════════════════════════════════ */
.mcq-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s, box-shadow 0.18s;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.mcq-option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,92,255,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.18s;
}
.mcq-option-btn:hover:not(:disabled) {
  border-color: rgba(124,92,255,0.45);
  background: rgba(124,92,255,0.07);
  transform: translateX(3px);
  box-shadow: 0 4px 16px rgba(124,92,255,0.12);
}
.mcq-option-btn:hover:not(:disabled)::before { opacity: 1; }
.mcq-option-btn:disabled { cursor: default; }
.mcq-option-btn.mcq-correct {
  border-color: #10b981;
  background: rgba(16,185,129,0.08);
  box-shadow: 0 0 0 1px rgba(16,185,129,0.2), 0 4px 16px rgba(16,185,129,0.1);
}
.mcq-option-btn.mcq-wrong {
  border-color: #f87171;
  background: rgba(248,113,113,0.08);
  box-shadow: 0 0 0 1px rgba(248,113,113,0.2);
}
.mcq-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.2);
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.mcq-option-btn:hover:not(:disabled) .mcq-option-letter {
  background: rgba(124,92,255,0.2);
  border-color: rgba(124,92,255,0.5);
}
.mcq-option-btn.mcq-correct .mcq-option-letter {
  background: rgba(16,185,129,0.2);
  border-color: #10b981;
  color: #10b981;
}
.mcq-option-btn.mcq-wrong .mcq-option-letter {
  background: rgba(248,113,113,0.2);
  border-color: #f87171;
  color: #f87171;
}
.mcq-option-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  font-weight: 500;
}

/* Premium question text */
.mcq-question-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.12);
  border-radius: 14px;
  border-left: 3px solid var(--primary);
}

/* Premium progress bar */
.quiz-progress-bar {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 5px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c5cff, #00e5c8);
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 0 8px rgba(0,229,200,0.4);
}

/* Light mode */
body.light-mode .ielts-hero {
  background: linear-gradient(135deg, rgba(124,92,255,0.06) 0%, rgba(0,180,160,0.04) 100%);
}
body.light-mode .mcq-option-btn {
  background: #fff;
  border-color: #e5e7eb;
}
body.light-mode .mcq-option-btn:hover:not(:disabled) {
  background: rgba(124,92,255,0.04);
  border-color: rgba(124,92,255,0.3);
}
body.light-mode .mcq-question-text {
  background: rgba(124,92,255,0.04);
  border-color: rgba(124,92,255,0.1);
}

/* Light mode */
body.light-mode .ielts-preset-btn    { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: var(--text2); }
body.light-mode .ielts-rec-panel     { background: rgba(16,185,129,0.04); }
body.light-mode .ielts-wrongbook-card { background: #fafafa; border-color: rgba(0,0,0,0.07); }
body.light-mode .ielts-wrongbook-exp  { background: rgba(0,0,0,0.03); }


/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — BCS Prep & IELTS Hub
   Breakpoints:
     xs  : ≤ 480px  (small phones, portrait)
     sm  : ≤ 600px  (phones, landscape / small tablets)
     md  : ≤ 900px  (tablets)
     lg  : ≥ 901px  (desktop / large tablet)
     xl  : ≥ 1200px (wide desktop)
════════════════════════════════════════════════════════════════════════ */

/* ── Shared: MCQ option buttons — always thumb-friendly ── */
.mcq-option-btn {
  min-height: 48px;
  font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────────────
   SMALL PHONES  ≤ 480px
───────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {

  /* BCS — deck selector stacks vertically */
  .mcq-selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  .mcq-selector-row .study-gen-btn {
    width: 100%;
    justify-content: center;
  }

  /* BCS — import row: 2-column grid */
  .mcq-import-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .mcq-import-btn,
  .mcq-live-btn {
    width: 100%;
    text-align: center;
    font-size: 11px;
    padding: 7px 8px;
  }

  /* BCS — exam preset pills wrap tightly */
  .mcq-exam-presets-row {
    gap: 5px;
  }
  .mcq-exam-preset-btn {
    padding: 5px 9px;
    font-size: 11px;
  }

  /* BCS — deck header stacks */
  .mcq-deck-header {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .mcq-deck-header > div:last-child {
    justify-content: flex-start;
  }

  /* BCS — done card actions stack */
  .mcq-done-actions {
    flex-direction: column;
    gap: 8px;
  }
  .mcq-btn-primary,
  .mcq-btn-secondary {
    width: 100%;
    padding: 12px;
    font-size: 13px;
  }

  /* BCS — question text slightly smaller */
  .mcq-question-text {
    font-size: 13px;
    padding: 12px;
  }

  /* BCS — option buttons: bigger tap target */
  .mcq-option-btn {
    min-height: 56px;
    font-size: 14px;
    padding: 12px 12px;
  }
  .mcq-option-letter {
    width: 28px;
    height: 28px;
    font-size: 12px;
    flex-shrink: 0;
  }

  /* BCS — streak display compact */
  .mcq-streak-display {
    padding: 8px 12px;
    gap: 6px;
  }
  .mcq-streak-count { font-size: 12px; }
  .mcq-streak-today { font-size: 10px; }

  /* BCS — exam banner compact */
  .mcq-exam-banner {
    padding: 7px 10px;
    gap: 6px;
  }
  .mcq-exam-time { font-size: 16px; }

  /* IELTS — subtab bar: smaller text */
  .ielts-subtab {
    padding: 8px 10px;
    font-size: 11px;
  }

  /* IELTS — advanced controls: single column */
  .ielts-ctrl-row {
    flex-direction: column;
    gap: 6px;
  }
  .ielts-ctrl-group {
    min-width: unset;
    width: 100%;
  }

  /* IELTS — daily banner stacks */
  .ielts-daily-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ielts-daily-btn {
    width: 100%;
    text-align: center;
    padding: 10px;
  }

  /* IELTS — presets: 2-column grid */
  .ielts-presets-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .ielts-preset-btn {
    text-align: center;
    padding: 7px 6px;
    font-size: 11px;
  }

  /* IELTS — timer bar stacks */
  .ielts-timer-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .ielts-timer-input {
    width: 56px;
  }
  .ielts-timer-btn {
    flex: 1;
  }

  /* IELTS — recommendation rows stack */
  .ielts-rec-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .ielts-rec-btn {
    width: 100%;
    text-align: center;
    padding: 8px;
  }

  /* IELTS — wrong book meta wraps */
  .ielts-wrongbook-meta {
    flex-wrap: wrap;
  }
  .ielts-wrongbook-date {
    margin-left: 0;
    width: 100%;
  }

  /* IELTS — done card actions stack */
  .mcq-done-card .mcq-done-actions {
    flex-direction: column;
    gap: 8px;
  }

  /* IELTS — speaking feedback grid */
  .ielts-feedback-grid {
    gap: 8px;
  }
  .ielts-fb-row {
    flex-direction: column;
    gap: 2px;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   PHONES  ≤ 600px  (catches landscape phones too)
───────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* BCS — page size selector + reset button row */
  .mcq-deck-header > div:last-child {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* BCS — session counter smaller */
  .mcq-session-counter { font-size: 10px; }

  /* IELTS — writing area: smaller padding */
  .ielts-writing-area,
  #ieltsWritingInput {
    font-size: 13px;
  }

  /* IELTS — SRS card text */
  .ielts-srs-front,
  .ielts-srs-back {
    font-size: 14px;
  }

  /* IELTS — weak area bars: label truncates */
  .ielts-weak-label {
    min-width: 80px;
    font-size: 11px;
  }

  /* IELTS — wrong book answers column */
  .ielts-wrongbook-answers {
    gap: 4px;
  }
  .ielts-wrongbook-wrong,
  .ielts-wrongbook-correct {
    font-size: 11px;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   TABLETS  ≤ 900px
───────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {

  /* BCS — import row wraps naturally (already flex-wrap) */
  .mcq-import-row { gap: 6px; }

  /* IELTS — ctrl rows: 2 per row max */
  .ielts-ctrl-group { min-width: 140px; }

  /* IELTS — presets row: natural wrap already set */
  .ielts-preset-btn { font-size: 12px; }
}

/* ─────────────────────────────────────────────────────────────────────
   LARGE SCREENS  ≥ 901px
───────────────────────────────────────────────────────────────────── */
@media (min-width: 901px) {

  /* BCS — deck selector: keep inline */
  .mcq-selector-row { flex-direction: row; }

  /* BCS — import row: single line */
  .mcq-import-row { flex-wrap: nowrap; }
  .mcq-import-btn,
  .mcq-live-btn { white-space: nowrap; }

  /* IELTS — advanced controls: 2 per row */
  .ielts-ctrl-row { flex-wrap: nowrap; }
  .ielts-ctrl-group { flex: 1; }

  /* IELTS — daily banner: always inline */
  .ielts-daily-banner { flex-direction: row; align-items: center; }

  /* IELTS — presets: single row */
  .ielts-presets-row { flex-wrap: wrap; }

  /* IELTS — recommendation rows: inline */
  .ielts-rec-row { flex-direction: row; align-items: center; }
  .ielts-rec-btn { width: auto; }

  /* IELTS — done card actions: inline */
  .mcq-done-card .mcq-done-actions { flex-direction: row; }
}

/* ─────────────────────────────────────────────────────────────────────
   WIDE DESKTOP  ≥ 1200px
───────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {

  /* BCS — question text: slightly larger for readability */
  .mcq-question-text { font-size: 15px; padding: 16px 18px; }
  .mcq-option-btn    { font-size: 14px; padding: 12px 16px; min-height: 52px; }

  /* BCS — done card: more breathing room */
  .mcq-done-card { padding: 36px 32px; }
  .mcq-done-score { font-size: 34px; }

  /* IELTS — subtab: slightly larger */
  .ielts-subtab { padding: 10px 18px; font-size: 13px; }

  /* IELTS — ctrl labels: visible */
  .ielts-ctrl-label { font-size: 12px; }

  /* IELTS — presets: comfortable spacing */
  .ielts-preset-btn { padding: 6px 16px; font-size: 13px; }

  /* IELTS — wrong book card: more padding */
  .ielts-wrongbook-card { padding: 14px 18px; }
  .ielts-wrongbook-q    { font-size: 14px; }
}

/* ══════════════════════════════════════════════════════════════════════
   IELTS READING SECTION
   ══════════════════════════════════════════════════════════════════════ */

/* Passage selector grid */
.ielts-reading-meta {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 12px;
  line-height: 1.5;
}
.ielts-reading-selector-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.ielts-reading-passage-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ielts-reading-passage-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.ielts-reading-passage-btn:hover {
  border-color: rgba(124,92,255,0.5);
  background: rgba(124,92,255,0.06);
  transform: translateY(-1px);
}
.ielts-reading-passage-btn:active { transform: scale(0.98); }
.irpb-random {
  border-style: dashed;
  border-color: rgba(124,92,255,0.3);
  background: rgba(124,92,255,0.04);
}
.irpb-topic {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.irpb-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.irpb-meta {
  font-size: 11px;
  color: var(--text3);
}
.irpb-diff { font-weight: 700; }

/* Reading session layout */
#ieltsReadingSession {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ielts-reading-passage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  max-height: 260px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.ielts-reading-passage-card::-webkit-scrollbar { width: 4px; }
.ielts-reading-passage-card::-webkit-scrollbar-thumb {
  background: rgba(124,92,255,0.3);
  border-radius: 4px;
}
.ielts-reading-passage-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}
.ielts-reading-passage-body p {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 10px;
}
.ielts-reading-passage-body p strong {
  color: var(--accent);
  font-size: 11px;
  margin-right: 4px;
}

/* Question card */
.ielts-reading-q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 10px;
}
.ielts-reading-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ielts-reading-q-type {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ielts-reading-q-counter {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
}
.ielts-reading-para-excerpt {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  background: rgba(124,92,255,0.05);
  border-left: 2px solid var(--primary);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* T/F/NG buttons */
.ielts-tfng-btn {
  justify-content: center !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
}

/* Sentence completion input */
.ielts-reading-sentence-wrap { margin-top: 8px; }
.ielts-reading-sentence-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ielts-reading-sentence-input:focus {
  border-color: rgba(124,92,255,0.6);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.12);
}
.ielts-reading-sentence-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Results breakdown */
.ielts-reading-breakdown {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ielts-reading-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.ielts-reading-breakdown-row span:last-child {
  font-weight: 700;
  color: var(--text);
}

/* Light mode overrides */
body.light-mode .ielts-reading-passage-btn {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}
body.light-mode .ielts-reading-passage-card,
body.light-mode .ielts-reading-q-card {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .ielts-reading-passage-body p { color: #334155; }
body.light-mode .ielts-reading-sentence-input {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.15);
  color: #0f172a;
}
body.light-mode .ielts-reading-breakdown-row {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.07);
}

/* ── IELTS Reading: Filter bar ───────────────────────────────────────── */
.ielts-reading-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ielts-rf-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ielts-rf-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.ielts-rf-select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ielts-rf-select:focus { border-color: rgba(124,92,255,0.5); }
.ielts-rf-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  white-space: nowrap;
}
.ielts-reading-passage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Weak area nudge ─────────────────────────────────────────────────── */
.ielts-reading-weak-nudge {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}
.ielts-reading-weak-nudge strong { color: #f59e0b; }

/* ── Vocab sidebar ───────────────────────────────────────────────────── */
.ielts-reading-vocab-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  background: rgba(124,92,255,0.05);
  border: 1px solid rgba(124,92,255,0.15);
  border-radius: 10px;
  margin-bottom: 4px;
}
.irvs-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 100%;
  margin-bottom: 2px;
}
.irvs-word {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.2);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.irvs-word:hover {
  background: rgba(124,92,255,0.2);
  border-color: rgba(124,92,255,0.4);
}

/* ── Results: weak area + vocab export ──────────────────────────────── */
.ielts-reading-weak-result {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.2);
  font-size: 12px;
  color: var(--text2);
}
.ielts-reading-weak-result strong { color: #f59e0b; }
.ielts-reading-vocab-export {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
}
.ielts-reading-vocab-export .irvs-title { color: #10b981; }
.ielts-reading-vocab-export .irvs-word {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.25);
  color: #10b981;
}

/* Light mode overrides */
body.light-mode .ielts-reading-filters { background: #fff; border-color: rgba(0,0,0,0.08); }
body.light-mode .ielts-rf-select { background: #f8fafc; color: #0f172a; border-color: rgba(0,0,0,0.12); }
body.light-mode .ielts-reading-vocab-sidebar { background: rgba(124,92,255,0.04); }
body.light-mode .irvs-word { background: rgba(124,92,255,0.07); }

/* ── Contextual vocab highlight in passage ───────────────────────────── */
mark.irvs-highlight {
  background: rgba(124,92,255,0.22);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
  animation: irvs-flash 0.6s ease;
}
@keyframes irvs-flash {
  0%   { background: rgba(124,92,255,0.55); }
  100% { background: rgba(124,92,255,0.22); }
}
body.light-mode mark.irvs-highlight {
  background: rgba(124,92,255,0.18);
}

/* ── Strategy tip in results card ────────────────────────────────────── */
.ielts-reading-strategy-tip {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(245,158,11,0.06);
  border-left: 3px solid #f59e0b;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
  font-style: italic;
}
body.light-mode .ielts-reading-strategy-tip {
  background: rgba(245,158,11,0.05);
  color: #475569;
}

/* ══════════════════════════════════════════════════════════════
   IELTS LISTENING MODULE
   ══════════════════════════════════════════════════════════════ */

/* Section picker grid */
.ilp-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.ilp-section-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 16px;
  border: 1px solid rgba(14,165,233,0.25);
  background: rgba(14,165,233,0.06);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}
.ilp-section-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(14,165,233,0.6);
  box-shadow: 0 6px 18px rgba(14,165,233,0.15);
}
.ilp-section-btn:active { transform: scale(0.96); }
.ilp-sec-num {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}
.ilp-sec-label {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.ilp-sec-desc {
  font-size: 11px;
  color: rgba(160,168,192,0.6);
}

/* Session header */
.ilp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ilp-section-label {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 2px;
}
.ilp-topic {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.ilp-status {
  font-size: 12px;
  font-weight: 600;
  color: rgba(160,168,192,0.7);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Player */
.ilp-player {
  background: rgba(14,165,233,0.06);
  border: 1px solid rgba(14,165,233,0.2);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

/* Waveform bars */
.ilp-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
}
.ilp-waveform span {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: rgba(56,189,248,0.3);
  height: 8px;
  transition: height 0.15s ease;
}
.ilp-waveform.ilp-wf-active span:nth-child(1)  { animation: ilp-bar 0.9s ease-in-out infinite 0.0s; }
.ilp-waveform.ilp-wf-active span:nth-child(2)  { animation: ilp-bar 0.9s ease-in-out infinite 0.1s; }
.ilp-waveform.ilp-wf-active span:nth-child(3)  { animation: ilp-bar 0.9s ease-in-out infinite 0.2s; }
.ilp-waveform.ilp-wf-active span:nth-child(4)  { animation: ilp-bar 0.9s ease-in-out infinite 0.3s; }
.ilp-waveform.ilp-wf-active span:nth-child(5)  { animation: ilp-bar 0.9s ease-in-out infinite 0.4s; }
.ilp-waveform.ilp-wf-active span:nth-child(6)  { animation: ilp-bar 0.9s ease-in-out infinite 0.3s; }
.ilp-waveform.ilp-wf-active span:nth-child(7)  { animation: ilp-bar 0.9s ease-in-out infinite 0.2s; }
.ilp-waveform.ilp-wf-active span:nth-child(8)  { animation: ilp-bar 0.9s ease-in-out infinite 0.1s; }
.ilp-waveform.ilp-wf-active span:nth-child(9)  { animation: ilp-bar 0.9s ease-in-out infinite 0.05s; }
.ilp-waveform.ilp-wf-active span:nth-child(10) { animation: ilp-bar 0.9s ease-in-out infinite 0.0s; }
.ilp-waveform.ilp-wf-active span { background: #38bdf8; }
@keyframes ilp-bar {
  0%, 100% { height: 6px; }
  50%       { height: 28px; }
}

/* Controls */
.ilp-controls {
  display: flex;
  gap: 8px;
}
.ilp-play-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.ilp-play-btn:hover   { opacity: 0.9; transform: translateY(-1px); }
.ilp-play-btn:active  { transform: scale(0.97); }
.ilp-replay-btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(14,165,233,0.3);
  background: rgba(14,165,233,0.08);
  color: #38bdf8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.ilp-replay-btn:hover { background: rgba(14,165,233,0.15); }

/* Transcript */
.ilp-transcript-btn {
  font-size: 12px;
  font-weight: 600;
  color: rgba(160,168,192,0.7);
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.ilp-transcript-btn:hover { color: #fff; border-color: rgba(255,255,255,0.2); }
.ilp-transcript {
  margin-top: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 12px 14px;
  max-height: 200px;
  overflow-y: auto;
}
.ilp-tr-line {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.ilp-tr-speaker {
  font-weight: 700;
  color: #38bdf8;
  flex-shrink: 0;
  min-width: 80px;
}
.ilp-tr-text { color: rgba(200,210,230,0.85); }

/* Questions */
.ilp-questions-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160,168,192,0.5);
  margin: 14px 0 8px;
}
.ilq-list { display: flex; flex-direction: column; gap: 12px; }
.ilq-item {
  display: flex;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px 14px;
}
.ilq-num {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  min-width: 24px;
  padding-top: 2px;
}
.ilq-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ilq-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.ilq-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.ilq-input:focus { border-color: rgba(14,165,233,0.5); }
.ilq-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text2);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}
.ilq-option:hover { color: #fff; }
.ilq-option input[type="radio"] { accent-color: #38bdf8; }

/* Results */
.ielts-results-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 12px;
}
.ielts-results-score {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}
.ielts-results-band { font-size: 14px; font-weight: 700; }
.ielts-results-pct  { font-size: 13px; color: rgba(160,168,192,0.7); margin-left: auto; }
.ielts-results-list { display: flex; flex-direction: column; gap: 8px; }
.ielts-result-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.ielts-result-item.ilr-correct { border-color: rgba(34,197,94,0.2); background: rgba(34,197,94,0.04); }
.ielts-result-item.ilr-wrong   { border-color: rgba(239,68,68,0.2);  background: rgba(239,68,68,0.04); }
.ilr-icon { font-size: 16px; flex-shrink: 0; padding-top: 1px; }
.ilr-content { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ilr-q       { font-size: 13px; color: var(--text); font-weight: 500; }
.ilr-your    { font-size: 12px; color: rgba(239,68,68,0.8); }
.ilr-correct { font-size: 12px; color: rgba(34,197,94,0.9); }

/* Light mode */
.light-mode .ilp-section-btn { background: rgba(14,165,233,0.05); border-color: rgba(14,165,233,0.2); }
.light-mode .ilp-player       { background: rgba(14,165,233,0.04); border-color: rgba(14,165,233,0.15); }
.light-mode .ilq-item         { background: #fff; border-color: #e5e7eb; }
.light-mode .ilq-input        { background: #f9fafb; border-color: #d1d5db; color: #111; }
.light-mode .ilq-text         { color: #111827; }
.light-mode .ilq-option       { color: #374151; }
.light-mode .ielts-result-item { background: #fff; border-color: #e5e7eb; }

/* ── Listening: pre-read bar ── */
.ilp-preread-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  margin-bottom: 10px;
}
.ilp-prt-label { font-size: 13px; font-weight: 600; color: #fbbf24; flex: 1; }
.ilp-prt-count {
  font-family: 'Sora', sans-serif;
  font-size: 16px; font-weight: 800;
  color: #f59e0b; min-width: 36px; text-align: center;
}
.ilp-prt-skip {
  font-size: 12px; font-weight: 600; color: rgba(160,168,192,0.6);
  background: none; border: none; cursor: pointer; padding: 2px 6px;
  transition: color 0.2s;
}
.ilp-prt-skip:hover { color: #fff; }

/* ── Listening: mode toggle ── */
.ilp-mode-toggle {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(160,168,192,0.8);
  cursor: pointer; transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.ilp-mode-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Listening: notepad ── */
.ilp-notepad-wrap {
  margin: 8px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  overflow: hidden;
}
.ilp-notepad-toggle {
  padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  color: rgba(160,168,192,0.7);
  cursor: pointer;
  background: rgba(255,255,255,0.03);
  list-style: none;
  transition: color 0.2s;
}
.ilp-notepad-toggle:hover { color: #fff; }
.ilp-notepad {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: none; border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  resize: vertical; outline: none;
}

/* ── Speaking: Part 2 timer ── */
.ielts-cue-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px; font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
}
.ielts-part2-timer {
  font-family: 'Sora', sans-serif;
  font-size: 18px; font-weight: 800;
  color: #f59e0b;
  min-width: 44px; text-align: right;
  transition: color 0.3s;
}

/* ── Speaking: continue speaking button ── */
.ielts-continue-speaking-btn {
  font-size: 12px; font-weight: 600;
  color: #38bdf8;
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.25);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.ielts-continue-speaking-btn:hover {
  background: rgba(14,165,233,0.15);
  border-color: rgba(14,165,233,0.5);
}

/* Light mode */
.light-mode .ilp-preread-bar { background: rgba(251,191,36,0.06); }
.light-mode .ilp-mode-toggle { background: #f9fafb; border-color: #e5e7eb; color: #374151; }
.light-mode .ilp-notepad     { background: #f9fafb; color: #111; }
.light-mode .ilp-notepad-toggle { background: #f9fafb; color: #374151; }


/* ══════════════════════════════════════════════════════════════════
   DAILY NEWS CARDS
   ══════════════════════════════════════════════════════════════════ */
.news-digest {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(139,92,246,0.2);
  background: rgba(28,18,52,0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 4px 24px rgba(0,0,0,0.3);
  margin: 2px 0;
}
.news-digest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(139,92,246,0.12);
  background: rgba(139,92,246,0.08);
}
.news-digest-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: #e9d5ff;
  letter-spacing: -0.01em;
}
.news-digest-time {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: rgba(196,181,253,0.45);
  letter-spacing: 0.03em;
}
.news-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid rgba(139,92,246,0.08);
  transition: background 0.15s;
}
.news-item:last-of-type { border-bottom: none; }
.news-item:hover { background: rgba(139,92,246,0.06); }
.news-item-img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}
.news-item-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.news-item-title {
  font-family: 'Inter', 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #ede9fe;
  text-decoration: none;
  line-height: 1.4;
  display: block;
  transition: color 0.15s;
}
.news-item-title:hover { color: #c084fc; }
.news-item-desc {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 11.5px;
  color: rgba(196,181,253,0.55);
  line-height: 1.4;
  margin: 0;
}
.news-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.news-item-source {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #c084fc;
  letter-spacing: 0.02em;
}
.news-item-dot { color: rgba(196,181,253,0.3); font-size: 10px; }
.news-item-time {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(196,181,253,0.4);
}
.news-digest-footer {
  padding: 8px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(196,181,253,0.35);
  text-align: center;
  border-top: 1px solid rgba(139,92,246,0.08);
  background: rgba(139,92,246,0.04);
}

/* News pill active state */
#mpill-news.active {
  background: rgba(139,92,246,0.22) !important;
  color: #e9d5ff !important;
  border-color: rgba(139,92,246,0.45) !important;
  box-shadow: 0 0 12px rgba(139,92,246,0.25) !important;
}

/* Light mode */
body.light-mode .news-digest {
  background: rgba(255,255,255,0.92);
  border-color: rgba(139,92,246,0.15);
}
body.light-mode .news-digest-header { background: rgba(139,92,246,0.06); }
body.light-mode .news-digest-title  { color: #1e1b4b; }
body.light-mode .news-item-title    { color: #1e1b4b; }
body.light-mode .news-item-title:hover { color: #7c3aed; }
body.light-mode .news-item-desc     { color: #6b5a8a; }
body.light-mode .news-item-source   { color: #7c3aed; }
body.light-mode .news-digest-footer { color: #9ca3af; }
body.light-mode .news-item { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .news-item:hover { background: rgba(139,92,246,0.04); }


/* ── Hide noisy header elements — JS compat preserved ── */
.nexora-usage-badge { display: none !important; }
.ai-badge           { display: none !important; }
#headerStatus       { display: none !important; }
#statusDotLive      { display: none !important; }


/* ══════════════════════════════════════════════════════════════════
   VOICE TRANSCRIPT — live user + Nexora text below the orb
   ══════════════════════════════════════════════════════════════════ */
.voice-transcript {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 24px;
  margin: 8px 0 4px;
  width: 100%;
  max-width: 420px;
  align-self: center;
}
.vt-user {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: rgba(196,181,253,0.75);
  text-align: center;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.vt-user.visible { opacity: 1; transform: translateY(0); }
.vt-user.interim { color: rgba(196,181,253,0.4); font-style: italic; }
.vt-nexora {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: rgba(224,242,254,0.6);
  text-align: center;
  line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease 0.1s, transform 0.35s ease 0.1s;
}
.vt-nexora.visible { opacity: 1; transform: translateY(0); }
#voicePrompt { transition: opacity 0.3s ease, transform 0.3s ease; }
#voicePrompt.hint-hidden { opacity: 0; pointer-events: none; transform: translateY(-4px); }
#voiceGreeting { transition: opacity 0.3s ease; }
#voiceGreeting.hint-hidden { opacity: 0; pointer-events: none; }
body.light-mode .vt-user   { color: rgba(109,40,217,0.7); }
body.light-mode .vt-nexora { color: rgba(14,116,144,0.7); }


/* ══════════════════════════════════════════════════════════════════
   EXPLORE SCREEN
   ══════════════════════════════════════════════════════════════════ */
#exploreScreen {
  background: var(--bg-app);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}
#exploreScreen::-webkit-scrollbar { display: none; }

.explore-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 40px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

/* Header */
.explore-header { margin-bottom: 4px; }
.explore-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px; font-weight: 800;
  color: #f0eaff; letter-spacing: -0.02em;
  line-height: 1.1; margin-bottom: 4px;
}
.explore-title em { color: #c084fc; font-style: normal; }
.explore-sub {
  font-family: 'Inter', sans-serif;
  font-size: 13px; color: rgba(196,181,253,0.55);
  margin-bottom: 12px;
}
.explore-model-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.explore-chip {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(28,18,52,0.6);
  color: rgba(196,181,253,0.7);
}
.explore-chip-purple { border-color: rgba(139,92,246,0.4); color: #c4b5fd; }
.explore-chip-teal   { border-color: rgba(20,184,166,0.4); color: #5eead4; }
.explore-chip-green  { border-color: rgba(34,197,94,0.4);  color: #86efac; }
.explore-chip-amber  { border-color: rgba(217,119,6,0.4);  color: #fcd34d; }
.explore-chip-blue   { border-color: rgba(14,165,233,0.4); color: #7dd3fc; }

/* Base card */
.explore-card {
  background: rgba(28,18,52,0.55);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 4px 20px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.3,0.64,1), border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.explore-card:hover  { transform: translateY(-3px); border-color: rgba(139,92,246,0.35); box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 8px 28px rgba(124,92,255,0.2); }
.explore-card:active { transform: scale(0.97); }

/* Card accent variants */
.explore-card-purple { background: linear-gradient(135deg, rgba(76,29,149,0.6), rgba(28,18,52,0.55)); border-color: rgba(139,92,246,0.25); }
.explore-card-amber  { background: linear-gradient(135deg, rgba(92,45,10,0.65), rgba(28,18,52,0.55)); border-color: rgba(217,119,6,0.25); }
.explore-card-teal   { background: linear-gradient(135deg, rgba(6,78,59,0.65), rgba(28,18,52,0.55)); border-color: rgba(20,184,166,0.25); }
.explore-card-red    { background: linear-gradient(135deg, rgba(127,29,29,0.65), rgba(28,18,52,0.55)); border-color: rgba(239,68,68,0.25); }
.explore-card-green  { background: linear-gradient(135deg, rgba(6,78,59,0.65), rgba(15,118,110,0.4)); border-color: rgba(20,184,166,0.25); }
.explore-card-blue   { background: linear-gradient(135deg, rgba(12,74,110,0.65), rgba(28,18,52,0.55)); border-color: rgba(14,165,233,0.25); }
.explore-card-compare { background: linear-gradient(135deg, rgba(49,46,129,0.65), rgba(28,18,52,0.55)); border-color: rgba(99,102,241,0.25); }
.explore-card-voice  { background: linear-gradient(135deg, rgba(76,29,149,0.5), rgba(28,18,52,0.55)); border-color: rgba(139,92,246,0.2); }
.explore-card-news   { background: linear-gradient(135deg, rgba(6,78,59,0.5), rgba(28,18,52,0.55)); border-color: rgba(16,185,129,0.2); }

/* Hero card */
.explore-hero {
  background: linear-gradient(135deg, rgba(76,29,149,0.7) 0%, rgba(109,40,217,0.45) 50%, rgba(28,18,52,0.6) 100%);
  border-color: rgba(139,92,246,0.35);
  padding: 22px 20px;
}
.explore-live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; color: #34d399;
  background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3);
  border-radius: 999px; padding: 3px 10px;
  margin-bottom: 10px; width: fit-content;
  animation: live-pulse 2s ease-in-out infinite;
}
.explore-live-teal { color: #5eead4; background: rgba(20,184,166,0.15); border-color: rgba(20,184,166,0.3); }
.explore-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 800;
  color: #f0eaff; line-height: 1.15;
  margin-bottom: 8px; letter-spacing: -0.02em;
}
.explore-hero-title em { color: #c084fc; font-style: normal; }
.explore-hero-sub {
  font-family: 'Inter', sans-serif; font-size: 13px;
  color: rgba(196,181,253,0.65); line-height: 1.5;
  margin-bottom: 14px;
}
.explore-hero-quote {
  display: flex; align-items: center; gap: 10px;
  background: rgba(13,11,26,0.5); border: 1px solid rgba(139,92,246,0.2);
  border-radius: 12px; padding: 10px 14px;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif; font-size: 12px;
  color: rgba(196,181,253,0.7); font-style: italic;
}
.explore-hero-orb {
  width: 28px; height: 28px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}
.explore-hero-btns { display: flex; gap: 10px; }
.explore-cta-primary {
  flex: 1; padding: 12px 16px; border-radius: 999px; border: none;
  background: linear-gradient(135deg, #7c5cff, #a855f7);
  color: #fff; font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 20px rgba(124,92,255,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.explore-cta-primary:hover { transform: scale(1.02); box-shadow: 0 6px 28px rgba(124,92,255,0.55); }
.explore-cta-primary:active { transform: scale(0.97); }
.explore-cta-secondary {
  padding: 12px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: rgba(196,181,253,0.8); font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.explore-cta-secondary:hover { background: rgba(255,255,255,0.12); }

/* 2-col grid */
.explore-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* Card internals */
.explore-card-icon { font-size: 26px; margin-bottom: 8px; }
.explore-card-title {
  font-family: 'Inter', 'Sora', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #f0eaff; letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.explore-card-sub {
  font-family: 'Inter', sans-serif; font-size: 11px;
  color: rgba(196,181,253,0.5); line-height: 1.4;
}
.explore-card-eyebrow {
  font-family: 'Inter', sans-serif; font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(196,181,253,0.4); margin-bottom: 6px;
}

/* Progress bar */
.explore-progress-wrap { margin-top: 10px; }
.explore-progress-label {
  font-family: 'Inter', sans-serif; font-size: 10px;
  color: rgba(196,181,253,0.4); margin-bottom: 4px;
}
.explore-progress-track {
  height: 5px; border-radius: 99px;
  background: rgba(139,92,246,0.15); overflow: hidden;
}
.explore-progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #7c5cff, #c084fc);
  transition: width 0.6s cubic-bezier(0.34,1.3,0.64,1);
}
.explore-bar-blue { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.explore-progress-pct {
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
  color: #c084fc; text-align: right; margin-top: 3px;
}

/* Chip row */
.explore-chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.explore-mini-chip {
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.25);
  color: rgba(196,181,253,0.8);
}

/* Compare card */
.explore-compare-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.explore-compare-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 800;
  color: #f0eaff; letter-spacing: -0.02em;
}
.explore-compare-icon { font-size: 36px; flex-shrink: 0; opacity: 0.7; }

/* AI Tutor card */
.explore-tutor-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.explore-tutor-icon { font-size: 40px; flex-shrink: 0; }

/* XP row */
.explore-xp-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.explore-xp-level {
  font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700;
  color: rgba(196,181,253,0.6);
}
.explore-xp-val {
  font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 700;
  color: #93c5fd;
}
.explore-streak-badge {
  display: inline-block; margin-top: 8px;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,45,18,0.5), rgba(180,83,9,0.3));
  border: 1px solid rgba(245,158,11,0.3); color: #fbbf24;
}

/* Waveform animation */
.explore-waveform {
  display: flex; align-items: center; gap: 3px; margin-top: 12px; height: 28px;
}
.explore-waveform span {
  display: block; width: 3px; border-radius: 99px;
  background: rgba(139,92,246,0.6);
  animation: explore-wave 1.2s ease-in-out infinite;
}
.explore-waveform span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.explore-waveform span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.explore-waveform span:nth-child(3) { height: 22px; animation-delay: 0.2s; }
.explore-waveform span:nth-child(4) { height: 28px; animation-delay: 0.3s; }
.explore-waveform span:nth-child(5) { height: 22px; animation-delay: 0.4s; }
.explore-waveform span:nth-child(6) { height: 16px; animation-delay: 0.5s; }
.explore-waveform span:nth-child(7) { height: 10px; animation-delay: 0.6s; }
.explore-waveform span:nth-child(8) { height: 16px; animation-delay: 0.7s; }
.explore-waveform span:nth-child(9) { height: 8px;  animation-delay: 0.8s; }
@keyframes explore-wave {
  0%,100% { transform: scaleY(0.5); opacity: 0.5; }
  50%     { transform: scaleY(1);   opacity: 1; }
}
/* Slow down live-pulse to reduce repaints */
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* Explore pill button */
.mode-pill-explore {
  font-size: 14px !important;
  padding: 5px 10px !important;
  border-color: rgba(139,92,246,0.3) !important;
}

/* Footer */
.explore-footer {
  font-family: 'Inter', sans-serif; font-size: 11px;
  color: rgba(196,181,253,0.25); text-align: center;
  padding-top: 8px;
}

/* Light mode */
body.light-mode #exploreScreen { background: var(--bg-app); }
body.light-mode .explore-card { background: rgba(255,255,255,0.88); border-color: rgba(139,92,246,0.12); }
body.light-mode .explore-card-title { color: #1e1b4b; }
body.light-mode .explore-card-sub   { color: #6b5a8a; }
body.light-mode .explore-title      { color: #1e1b4b; }
body.light-mode .explore-hero { background: rgba(139,92,246,0.08); }
body.light-mode .explore-hero-title { color: #1e1b4b; }


/* ── Explore screen: full-screen overlay covering header/statusbar ── */
#exploreScreen {
  position: absolute !important;
  inset: 0 !important;
  z-index: 100 !important;
  display: none;
  flex-direction: column;
  background: var(--bg-app);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
#exploreScreen.active {
  display: flex !important;
}
#exploreScreen::-webkit-scrollbar { display: none; }

/* ── Explore screen: hide chat chrome ── */
#phone:has(#exploreScreen.active) #header,
#phone:has(#exploreScreen.active) #modePillsRow,
#phone:has(#exploreScreen.active) #inputBar,
#phone:has(#exploreScreen.active) #smartSuggestBar,
#phone:has(#exploreScreen.active) #scrollBtn,
#phone:has(#exploreScreen.active) #exportBtn,
#phone:has(#exploreScreen.active) #memoryBadge {
  display: none !important;
}


/* ── Explore top bar ── */
.explore-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 0;
  flex-shrink: 0;
}
.explore-back-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(28,18,52,0.6); border: 1px solid rgba(139,92,246,0.2);
  border-radius: 999px; padding: 7px 14px;
  font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
  color: rgba(196,181,253,0.7); cursor: pointer;
  transition: all 0.15s;
}
.explore-back-btn:hover { background: rgba(139,92,246,0.15); color: #e9d5ff; border-color: rgba(139,92,246,0.4); }
.explore-topbar-logo { display: flex; align-items: center; justify-content: center; }
.explore-topbar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.explore-hero-orb { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ── Explore topbar brand ── */
.explore-topbar-logo { display: flex; align-items: center; gap: 8px; }
.explore-topbar-brand { display: flex; flex-direction: column; align-items: center; }
.explore-topbar-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, #ffffff 20%, #c084fc 60%, #22d3ee 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.1;
}
.explore-topbar-founder {
  font-family: 'Inter', sans-serif; font-size: 9px; font-weight: 600;
  letter-spacing: 0.04em; color: rgba(196,181,253,0.45);
  white-space: nowrap;
}


/* ── YouTube → Study card ── */
.explore-card-yt {
  background: linear-gradient(135deg, rgba(180,0,0,0.5) 0%, rgba(28,18,52,0.6) 100%);
  border-color: rgba(239,68,68,0.25);
}
.explore-card-yt:hover {
  border-color: rgba(248,113,113,0.45);
  box-shadow: 0 16px 42px rgba(127,29,29,0.28);
}
.explore-yt-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 800;
  color: #fecaca; line-height: 1.2;
  margin-bottom: 6px;
}
.explore-yt-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.explore-yt-btn {
  font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5; transition: all 0.15s;
}
.explore-yt-btn:hover { background: rgba(239,68,68,0.35); color: #fff; }

/* ── YouTube Study screen ── */
#youtubeStudyScreen {
  background:
    radial-gradient(circle at top left, rgba(239,68,68,0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(168,85,247,0.18), transparent 28%),
    linear-gradient(180deg, #090816 0%, #0d0a1c 100%);
  overflow-y: auto;
}
.yt-page-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
  background: rgba(8,8,18,0.76);
}
.youtube-study-wrap {
  padding: 14px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.youtube-study-hero,
.youtube-study-card,
.youtube-study-preview,
.youtube-study-action {
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 46px rgba(0,0,0,0.22);
}
.youtube-study-hero {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(127,29,29,0.64), rgba(44,17,64,0.72));
}
.youtube-study-eyebrow {
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.18em;
  color: rgba(254,202,202,0.82);
  margin-bottom: 10px;
}
.youtube-study-title {
  margin: 0 0 8px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.06;
  color: #fff1f2;
}
.youtube-study-sub {
  margin: 0;
  font: 400 13px/1.55 'Inter', sans-serif;
  color: rgba(255,228,230,0.8);
}
.youtube-study-card,
.youtube-study-preview {
  border-radius: 22px;
  padding: 16px;
  background: rgba(15,13,31,0.9);
}
.youtube-study-label {
  display: block;
  margin-bottom: 8px;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(224,231,255,0.8);
}
.youtube-study-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}
.youtube-study-input,
.youtube-study-focus {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(248,113,113,0.18);
  background: rgba(10,10,24,0.82);
  color: #f8fafc;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.youtube-study-input {
  padding: 14px 16px;
  font-size: 14px;
}
.youtube-study-focus {
  min-height: 76px;
  resize: vertical;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}
.youtube-study-input:focus,
.youtube-study-focus:focus {
  border-color: rgba(251,113,133,0.48);
  box-shadow: 0 0 0 3px rgba(244,63,94,0.12);
}
.youtube-study-fetch-btn {
  min-width: 120px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(251,113,133,0.32);
  background: linear-gradient(135deg, #ef4444, #be123c);
  color: #fff;
  font: 700 13px/1 'Inter', sans-serif;
  cursor: pointer;
}
.youtube-study-fetch-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.youtube-study-status {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(127,29,29,0.18);
  color: #fecaca;
  font: 500 12px/1.5 'Inter', sans-serif;
}
.youtube-study-preview-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.youtube-study-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.youtube-study-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.youtube-study-video-title {
  font: 700 16px/1.3 'Sora', sans-serif;
  color: #fff;
}
.youtube-study-video-sub {
  font: 500 12px/1.5 'Inter', sans-serif;
  color: rgba(226,232,240,0.72);
}
.youtube-study-video-badge {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(74,222,128,0.2);
  color: #86efac;
  font: 700 11px/1 'Inter', sans-serif;
}
.youtube-study-warning {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.18);
  color: #fde68a;
  font: 500 12px/1.5 'Inter', sans-serif;
}
.youtube-study-transcript-label {
  margin-top: 14px;
  margin-bottom: 8px;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226,232,240,0.68);
}
.youtube-study-transcript {
  max-height: 176px;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(8,8,18,0.78);
  border: 1px solid rgba(255,255,255,0.06);
  color: #dbe4f0;
  font: 400 13px/1.65 'DM Sans', sans-serif;
  white-space: pre-wrap;
}
.youtube-study-actions {
  display: grid;
  gap: 10px;
}
.youtube-study-action {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(24,22,46,0.96), rgba(56,22,55,0.94));
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.youtube-study-action:hover:not(:disabled),
.youtube-study-action.is-preferred {
  transform: translateY(-1px);
  border-color: rgba(251,113,133,0.35);
  box-shadow: 0 14px 32px rgba(127,29,29,0.22);
}
.youtube-study-action:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.youtube-study-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  font-size: 22px;
  flex-shrink: 0;
}
.youtube-study-action-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.youtube-study-action-title {
  font: 700 15px/1.2 'Sora', sans-serif;
  color: #fff;
}
.youtube-study-action-sub {
  font: 400 12px/1.45 'Inter', sans-serif;
  color: rgba(226,232,240,0.7);
}

/* ── Photo → Study card ── */
.explore-card-photo {
  background: linear-gradient(135deg, rgba(124,92,255,0.5) 0%, rgba(28,18,52,0.6) 100%);
  border-color: rgba(139,92,246,0.25);
}
.explore-card-photo:hover {
  border-color: rgba(167,139,250,0.42);
  box-shadow: 0 16px 42px rgba(76,29,149,0.24);
}

/* ── Photo Study screen ── */
#photoStudyScreen {
  background:
    radial-gradient(circle at top left, rgba(124,92,255,0.2), transparent 34%),
    radial-gradient(circle at top right, rgba(59,130,246,0.16), transparent 26%),
    linear-gradient(180deg, #090816 0%, #0c0b1d 100%);
  overflow-y: auto;
}
.photo-page-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
  background: rgba(8,8,18,0.76);
}
.photo-study-wrap {
  padding: 14px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.photo-study-hero,
.photo-study-card,
.photo-study-preview,
.photo-study-action {
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 46px rgba(0,0,0,0.22);
}
.photo-study-hero {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(76,29,149,0.72), rgba(30,64,175,0.58));
}
.photo-study-eyebrow {
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.18em;
  color: rgba(224,231,255,0.84);
  margin-bottom: 10px;
}
.photo-study-title {
  margin: 0 0 8px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.06;
  color: #f5f3ff;
}
.photo-study-sub {
  margin: 0;
  font: 400 13px/1.55 'Inter', sans-serif;
  color: rgba(224,231,255,0.78);
}
.photo-study-card,
.photo-study-preview {
  border-radius: 22px;
  padding: 16px;
  background: rgba(15,13,31,0.92);
}
.photo-study-upload-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.photo-study-upload-btn {
  flex: 1;
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(139,92,246,0.28);
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font: 700 13px/1 'Inter', sans-serif;
  cursor: pointer;
}
.photo-study-upload-btn.secondary {
  background: rgba(91,33,182,0.16);
  color: #ddd6fe;
}
.photo-study-label {
  display: block;
  margin-bottom: 8px;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(224,231,255,0.8);
}
.photo-study-focus {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(139,92,246,0.2);
  background: rgba(10,10,24,0.82);
  color: #f8fafc;
  font: 400 13px/1.45 'DM Sans', sans-serif;
  outline: none;
  box-sizing: border-box;
}
.photo-study-focus:focus {
  border-color: rgba(167,139,250,0.44);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.12);
}
.photo-study-status {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(76,29,149,0.18);
  color: #ddd6fe;
  font: 500 12px/1.5 'Inter', sans-serif;
}
.photo-study-preview-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.photo-study-image {
  width: 120px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.photo-study-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.photo-study-file-title {
  font: 700 16px/1.3 'Sora', sans-serif;
  color: #fff;
}
.photo-study-file-sub {
  font: 500 12px/1.5 'Inter', sans-serif;
  color: rgba(226,232,240,0.72);
}
.photo-study-file-badge {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(74,222,128,0.2);
  color: #86efac;
  font: 700 11px/1 'Inter', sans-serif;
}
.photo-study-warning {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.18);
  color: #fde68a;
  font: 500 12px/1.5 'Inter', sans-serif;
}
.photo-study-text-label {
  margin-top: 14px;
  margin-bottom: 8px;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226,232,240,0.68);
}
.photo-study-text {
  max-height: 176px;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(8,8,18,0.78);
  border: 1px solid rgba(255,255,255,0.06);
  color: #dbe4f0;
  font: 400 13px/1.65 'DM Sans', sans-serif;
  white-space: pre-wrap;
}
.photo-study-actions {
  display: grid;
  gap: 10px;
}
.photo-study-action {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(24,22,46,0.96), rgba(36,29,84,0.96));
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.photo-study-action:hover:not(:disabled),
.photo-study-action.is-preferred {
  transform: translateY(-1px);
  border-color: rgba(167,139,250,0.36);
  box-shadow: 0 14px 32px rgba(76,29,149,0.22);
}
.photo-study-action:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.photo-study-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  font-size: 22px;
  flex-shrink: 0;
}
.photo-study-action-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.photo-study-action-title {
  font: 700 15px/1.2 'Sora', sans-serif;
  color: #fff;
}
.photo-study-action-sub {
  font: 400 12px/1.45 'Inter', sans-serif;
  color: rgba(226,232,240,0.7);
}

@media (max-width: 640px) {
  .youtube-study-input-row {
    flex-direction: column;
  }
  .youtube-study-fetch-btn {
    min-height: 48px;
  }
  .youtube-study-preview-head {
    flex-direction: column;
  }
  .youtube-study-thumb {
    width: 100%;
  }
  .photo-study-upload-row {
    flex-direction: column;
  }
  .photo-study-preview-head {
    flex-direction: column;
  }
  .photo-study-image {
    width: 100%;
    aspect-ratio: 4 / 3;
  }
}


/* ── Pause all animations when tab is hidden — saves CPU/GPU/battery ── */
.page-hidden * {
  animation-play-state: paused !important;
}

/* ── Performance: limit GPU layer promotion ── */
/* Only promote elements that actually need it */
.voice-orb, #orbCanvas, .splash-orb {
  will-change: transform;
}
/* Remove will-change from elements that don't need GPU layers */
.splash-ring, .splash-particle, .ielts-mini-orb-ring,
.explore-waveform span, .smc-live-badge, .ai-dot {
  will-change: auto;
}
/* Use transform instead of opacity for animations where possible */
.study-mode-card, .explore-card, .ielts-card {
  will-change: auto;
  transform: translateZ(0); /* single composite layer */
}

/* ── Final responsive polish overrides ── */
@media (min-width: 901px) {
  #header {
    padding: 8px 20px 12px;
  }
  .menu-btn,
  .auth-quick-btn,
  .memory-brain-btn,
  #themeToggle {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    border-radius: 14px;
  }
  .header-center {
    gap: 12px;
  }
  .header-avatar-wrap,
  .header-avatar,
  .header-avatar-img {
    width: 42px;
    height: 42px;
  }
  .header-text h2 {
    font-size: 22px;
  }
  .mode-pills-row {
    gap: 10px;
    padding: 8px 20px 12px;
  }
  .mode-pill {
    padding: 8px 18px;
    font-size: 13px;
  }
  #messages {
    padding: 14px 22px 22px;
    gap: 16px;
  }
  .date-divider {
    font-size: 13px;
    margin: 6px 0 10px;
  }
  .bubble {
    max-width: 70%;
    padding: 14px 18px;
    font-size: 15px;
  }
  .bubble-time {
    font-size: 11px;
    margin-top: 6px;
  }
  .chat-empty-state {
    gap: 14px;
  }
  .ces-orb {
    width: 66px;
    height: 66px;
    font-size: 24px;
  }
  .ces-title {
    font-size: 18px;
  }
  .ces-sub {
    font-size: 13px;
    max-width: 300px;
  }
  #inputBar {
    gap: 14px;
    padding: 14px 20px 24px;
  }
  .input-wrap {
    gap: 10px;
    padding: 12px 16px;
    border-radius: 28px;
  }
  #userInput {
    font-size: 16px;
  }
  .camera-btn,
  .study-chat-btn,
  .voice-toggle,
  .send-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .voice-quick-btn {
    width: auto;
    min-width: 92px;
    height: 48px;
    padding: 0 14px;
    border-radius: 999px;
  }
  .voice-toggle {
    border-radius: 50%;
  }
  .camera-btn svg,
  .study-chat-btn svg,
  .voice-quick-btn svg,
  .voice-toggle svg,
  .send-btn svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 430px) {
  .input-action-divider {
    margin: 4px 0;
  }
  .voice-quick-btn {
    min-width: 36px;
    width: 36px;
    padding: 0;
    border-radius: 12px;
  }
  .voice-quick-label {
    display: none;
  }
  #spanel-flashcard .study-input-row {
    gap: 8px;
  }
  #spanel-flashcard .study-select,
  #spanel-flashcard .study-gen-btn {
    min-height: 42px;
  }
  .fc-save-all-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }
}
