/* ============================================================
   NexA AI — Tech Identity Layer v2
   
   Fluid responsive: 320px → 3840px
   Typography: Space Grotesk (display) · Inter (body) · JetBrains Mono (meta)
   Motion: Spring physics — every element has physical weight
   Surfaces: Multi-layer depth, inset highlights, focus glows
   
   All sizes use clamp() — smooth scaling, no breakpoint jumps
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap');

/* ── TOKENS ── */
:root {
  --display: 'Space Grotesk', system-ui, sans-serif;
  --sans:    'Inter', 'Noto Sans Bengali', system-ui, sans-serif;
  --mono:    'JetBrains Mono', 'Fira Code', monospace;
  --spring:  cubic-bezier(0.16, 1, 0.3, 1);
  --snap:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:    cubic-bezier(0.25, 0.1, 0.25, 1);
}


/* ── TYPOGRAPHY SYSTEM ── */

body {
  font-family: var(--sans);
  font-size: clamp(15px, 1vw, 18px);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Display font — Space Grotesk for headings */
.header-brand,
.welcome-title,
.welcome-kicker,
.splash-brand,
.form-title,
.hero-title,
.quiz-setup-header h2,
.drawer-name,
.leaderboard-header h3 {
  font-family: var(--display);
  letter-spacing: -0.035em;
}

/* Monospace — metadata, labels, technical info */
.stat-pill,
.workspace-plan-card__eyebrow,
.workspace-nav__label,
.drawer-section-title,
.drawer-type-badge,
.quiz-field label,
.chat-timestamp,
.header-sub,
.usage-label,
.countdown-value,
.exam-countdown {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* AI response text */
.ai-text {
  font-family: var(--sans);
  font-size: clamp(14.5px, 1.05vw, 18px);
  line-height: 1.72;
}

/* Chat input */
.question-input {
  font-family: var(--sans);
  font-size: clamp(14.5px, 1.05vw, 17px);
  line-height: 1.6;
}


/* ── TRANSITION & EASING ── */

.icon-btn,
.profile-btn,
.workspace-nav__item,
.workspace-history__item,
.welcome-chip,
.suggestion-chip,
.send-btn,
.workspace-new-chat,
.workspace-user,
.setting-row,
.quiz-option,
.quiz-count-btn,
.quiz-diff-btn,
.quiz-next-btn,
.start-quiz-btn,
.prominent-quiz-btn,
.logout-btn,
.admin-link-btn,
.ref-copy-btn,
.copy-code-btn,
.reaction-bar button,
.scroll-fab,
.stop-inline-btn,
.bookmark-item,
.welcome-exam-link {
  transition: all 0.15s var(--spring);
}


/* ── ACTIVE PRESS STATES ── */

.icon-btn:active                      { transform: scale(0.88); transition-duration: 0.04s; }
.profile-btn:active                   { transform: scale(0.88); transition-duration: 0.04s; }
.workspace-nav__item:active           { transform: scale(0.97); transition-duration: 0.04s; }
.workspace-history__item:active       { transform: scale(0.97); transition-duration: 0.04s; }
.welcome-chip:active,
.suggestion-chip:active               { transform: scale(0.94); transition-duration: 0.04s; }
.send-btn:active:not(:disabled)       { transform: scale(0.86); transition-duration: 0.04s; }
.workspace-new-chat:active            { transform: scale(0.96) translateY(0); transition-duration: 0.04s; }
.workspace-user:active                { transform: scale(0.97); transition-duration: 0.04s; }
.quiz-option:active:not(.answered)    { transform: scale(0.97); transition-duration: 0.04s; }
.quiz-next-btn:active                 { transform: scale(0.94); transition-duration: 0.04s; }
.start-quiz-btn:active                { transform: scale(0.96); transition-duration: 0.04s; }
.prominent-quiz-btn:active            { transform: scale(0.97); transition-duration: 0.04s; }
.setting-row:active                   { transform: scale(0.97); transition-duration: 0.04s; }
.logout-btn:active                    { transform: scale(0.96); transition-duration: 0.04s; }
.reaction-bar button:active           { transform: scale(0.85); transition-duration: 0.04s; }
.scroll-fab:active                    { transform: scale(0.85); transition-duration: 0.04s; }
.stop-inline-btn:active               { transform: scale(0.92); transition-duration: 0.04s; }
.copy-code-btn:active                 { transform: scale(0.90); transition-duration: 0.04s; }
.bookmark-item:active                 { transform: scale(0.97); transition-duration: 0.04s; }
.ref-copy-btn:active                  { transform: scale(0.94); transition-duration: 0.04s; }
.welcome-exam-link:active             { transform: scale(0.96); transition-duration: 0.04s; }


/* ── FOCUS RINGS ── */

.icon-btn:focus-visible,
.profile-btn:focus-visible,
.workspace-nav__item:focus-visible,
.welcome-chip:focus-visible,
.suggestion-chip:focus-visible,
.send-btn:focus-visible,
.workspace-new-chat:focus-visible,
.workspace-user:focus-visible,
.quiz-option:focus-visible,
.quiz-count-btn:focus-visible,
.quiz-diff-btn:focus-visible,
.quiz-next-btn:focus-visible,
.start-quiz-btn:focus-visible,
.setting-row:focus-visible,
.logout-btn:focus-visible,
.prominent-quiz-btn:focus-visible,
.reaction-bar button:focus-visible,
.scroll-fab:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--workspace-soft, var(--bg)),
    0 0 0 4px rgba(98, 91, 238, 0.4);
}

/* Disabled */
.send-btn:disabled,
.start-quiz-btn:disabled,
.quiz-next-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}


/* ── HEADER ── */

.header-brand {
  font-size: clamp(17px, 1.3vw, 22px);
  font-weight: 700;
}

.header-brand span {
  background: linear-gradient(135deg, var(--workspace-primary, #625BEE), #8B5CF6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  margin-top: 2px;
  font-size: clamp(9px, 0.6vw, 11px);
  letter-spacing: 0.12em;
}

.header-logo { border-radius: 10px; }

.icon-btn {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.icon-btn:hover { transform: translateY(-1px); }

.profile-btn {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 4px 12px rgba(98,91,238,0.2);
}
.profile-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 6px 16px rgba(98,91,238,0.28);
}


/* ── SIDEBAR ── */

.workspace-sidebar__brand strong {
  font-family: var(--display);
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.workspace-sidebar__brand small {
  font-family: var(--mono);
  font-size: clamp(8px, 0.6vw, 11px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-sidebar__mark { border-radius: 9px; }

/* New chat */
.workspace-new-chat {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(12px, 0.85vw, 15px);
  letter-spacing: -0.01em;
  border-radius: 11px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 6px 16px rgba(98,91,238,0.15);
}
.workspace-new-chat::after { display: none !important; }
.workspace-new-chat:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 10px 24px rgba(98,91,238,0.22);
}

/* Nav items */
.workspace-nav__item {
  font-family: var(--sans);
  font-size: clamp(12px, 0.85vw, 15px);
  font-weight: 500;
  border-radius: 8px;
  position: relative;
}
.workspace-nav__item::before { display: none !important; }
.workspace-nav__item.is-active { font-weight: 600; }

/* Left accent pill — signature */
.workspace-nav__item.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  border-radius: 0 3px 3px 0;
  background: var(--workspace-primary, #625BEE);
}

.workspace-nav__label {
  font-family: var(--mono);
  font-size: clamp(9px, 0.6vw, 11px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.workspace-history__item {
  font-size: clamp(12px, 0.8vw, 14px);
  font-weight: 500;
  border-radius: 7px;
}

/* Plan card */
.workspace-plan-card { border-radius: 12px; }
.workspace-plan-card__eyebrow {
  font-family: var(--mono);
  font-size: clamp(9px, 0.6vw, 11px);
  font-weight: 700;
  letter-spacing: 0.1em;
}
.workspace-plan-card strong {
  font-family: var(--display);
  font-size: clamp(13px, 0.95vw, 16px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.workspace-plan-card > span:last-child {
  font-family: var(--sans);
  font-size: clamp(11px, 0.75vw, 14px);
  line-height: 1.5;
}

/* User card */
.workspace-user { border-radius: 10px; }
.workspace-user__avatar {
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.workspace-user__copy strong {
  font-family: var(--sans);
  font-size: clamp(12px, 0.8vw, 14px);
  font-weight: 600;
}
.workspace-user__copy small {
  font-family: var(--mono);
  font-size: clamp(10px, 0.65vw, 12px);
  letter-spacing: 0.03em;
}


/* ── WELCOME STATE ── */

.welcome-logo { border-radius: 14px; }

.welcome-kicker {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.welcome-title {
  font-size: clamp(24px, 3vw, 52px);
  font-weight: 700;
  line-height: 1.1;
}

/* Gradient title accent */
.welcome-title em {
  font-style: normal;
  background: linear-gradient(135deg, #625BEE 0%, #8B5CF6 45%, #3B82F6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-sub {
  font-family: var(--sans);
  font-size: clamp(14px, 1vw, 18px);
  line-height: 1.7;
  max-width: 520px;
}
.welcome-sub strong { font-weight: 600; }

/* Chips */
.welcome-chip,
.suggestion-chip {
  font-family: var(--sans);
  font-size: clamp(12px, 0.85vw, 15px);
  font-weight: 500;
  border-radius: 9px;
  padding: clamp(7px, 0.6vw, 10px) clamp(12px, 1vw, 18px);
}
.welcome-chip:hover,
.suggestion-chip:hover { transform: translateY(-2px); }


/* ── INPUT ISLAND ── */

.input-island {
  border-radius: clamp(14px, 1.1vw, 20px);
  transition: border-color 0.15s var(--spring), box-shadow 0.15s var(--spring);
}

.input-island:focus-within {
  border-color: rgba(98, 91, 238, 0.4) !important;
  box-shadow:
    0 0 0 4px rgba(98, 91, 238, 0.06),
    0 18px 44px rgba(38, 43, 93, 0.12) !important;
}

[data-theme="dark"] .input-island:focus-within {
  box-shadow:
    0 0 0 4px rgba(98, 91, 238, 0.1),
    0 18px 44px rgba(0, 0, 0, 0.3) !important;
}

.question-input::placeholder {
  font-style: normal;
  opacity: 0.55;
}

/* Send button */
.send-btn {
  border-radius: 11px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 4px 14px rgba(98, 91, 238, 0.2);
}
.send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 8px 20px rgba(98, 91, 238, 0.3);
}

.stop-inline-btn {
  border-radius: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(11px, 0.8vw, 14px);
}


/* ── MESSAGES ── */

.msg.user {
  display: flex;
  justify-content: flex-end;
}

.msg.user .bubble {
  max-width: 75%;
  border-radius: clamp(16px, 1.2vw, 20px) clamp(16px, 1.2vw, 20px) 4px clamp(16px, 1.2vw, 20px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 2px 8px rgba(98, 91, 238, 0.12);
}

.msg.ai .bubble {
  border-radius: 4px clamp(16px, 1.2vw, 20px) clamp(16px, 1.2vw, 20px) clamp(16px, 1.2vw, 20px);
}

.msg.ai .bubble::before,
.msg.ai .bubble::after { display: none !important; }

/* AI text heading hierarchy — fluid */
.ai-text h1 { font-family: var(--display); font-size: clamp(18px, 1.4vw, 24px); font-weight: 700; letter-spacing: -0.03em; margin: clamp(16px, 1.5vw, 24px) 0 8px; }
.ai-text h2 { font-family: var(--display); font-size: clamp(16px, 1.2vw, 20px); font-weight: 700; letter-spacing: -0.02em; margin: clamp(14px, 1.2vw, 20px) 0 6px; }
.ai-text h3 { font-family: var(--display); font-size: clamp(14px, 1vw, 18px); font-weight: 600; letter-spacing: -0.015em; margin: clamp(12px, 1vw, 16px) 0 4px; }

/* Inline code */
.ai-text code:not(pre code) {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(98, 91, 238, 0.06);
  border: 1px solid rgba(98, 91, 238, 0.1);
  color: var(--workspace-primary, var(--primary));
  font-weight: 500;
}
[data-theme="dark"] .ai-text code:not(pre code) {
  background: rgba(98, 91, 238, 0.1);
  border-color: rgba(98, 91, 238, 0.18);
}

/* Lists */
.ai-text ul, .ai-text ol { padding-left: 20px; }
.ai-text li { margin-bottom: 4px; line-height: 1.65; }

/* Timestamp */
.chat-timestamp {
  font-family: var(--mono);
  font-size: clamp(9px, 0.6vw, 11px);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.msg:hover .chat-timestamp { opacity: 1; }

/* Reaction bar */
.reaction-bar button {
  border-radius: 7px;
  font-size: clamp(11px, 0.8vw, 14px);
}

/* Typing */
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; }


/* ── CODE BLOCKS ── */

.ai-text pre {
  border-radius: clamp(8px, 0.7vw, 12px);
  overflow: hidden;
}

.ai-text pre code {
  font-family: var(--mono);
  font-size: clamp(12px, 0.85vw, 15px);
  line-height: 1.65;
}

.code-header {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.copy-code-btn {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 500;
  border-radius: 6px;
}
.copy-code-btn:hover { transform: translateY(-1px); }


/* ── SURFACE QUALITY ── */

.welcome-state {
  box-shadow:
    0 0 0 1px rgba(38, 43, 93, 0.04),
    0 2px 4px rgba(38, 43, 93, 0.03),
    0 8px 24px rgba(38, 43, 93, 0.06),
    0 32px 64px rgba(38, 43, 93, 0.04);
}

.msg.ai .bubble {
  box-shadow:
    0 1px 3px rgba(38, 43, 93, 0.04),
    0 6px 20px rgba(38, 43, 93, 0.05);
}

.input-island {
  box-shadow:
    0 1px 3px rgba(38, 43, 93, 0.05),
    0 12px 36px rgba(38, 43, 93, 0.1);
}

/* Dark mode */
[data-theme="dark"] .welcome-state {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .msg.ai .bubble {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
[data-theme="dark"] .input-island {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 12px 36px rgba(0,0,0,0.3);
}
[data-theme="dark"] .workspace-plan-card {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.bg-orb { opacity: 0.3 !important; }


/* ── SCROLLBAR ── */

.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(98, 91, 238, 0.12); border-radius: 4px; }
.chat-area::-webkit-scrollbar-thumb:hover { background: rgba(98, 91, 238, 0.25); }
[data-theme="dark"] .chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .chat-area::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

.workspace-sidebar::-webkit-scrollbar { width: 3px; }
.workspace-sidebar::-webkit-scrollbar-track { background: transparent; }
.workspace-sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.06); border-radius: 3px; }
[data-theme="dark"] .workspace-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); }


/* ── QUIZ & MODAL ── */

.quiz-setup-card, .report-card { border-radius: clamp(14px, 1.1vw, 20px); }

.quiz-setup-header h2 {
  font-size: clamp(16px, 1.2vw, 22px);
  font-weight: 700;
}

.quiz-field label {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.quiz-field input,
.quiz-field textarea {
  font-family: var(--sans);
  font-size: clamp(14px, 1vw, 16px);
  border-radius: 10px;
  transition: border-color 0.12s var(--spring), box-shadow 0.12s var(--spring);
}

.quiz-field input:focus,
.quiz-field textarea:focus {
  border-color: rgba(98, 91, 238, 0.35);
  box-shadow: 0 0 0 3px rgba(98, 91, 238, 0.08);
}

.quiz-option {
  border-radius: 11px;
  font-family: var(--sans);
  font-size: clamp(13px, 0.95vw, 16px);
  transition: all 0.12s var(--spring);
}
.quiz-option:hover:not(.answered) { transform: translateY(-1px); }
.quiz-option.is-correct { background: rgba(16, 185, 129, 0.07); border-color: rgba(16, 185, 129, 0.28); }
.quiz-option.is-wrong { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.22); }

.quiz-count-btn, .quiz-diff-btn {
  border-radius: 9px;
  font-family: var(--sans);
  font-size: clamp(12px, 0.85vw, 15px);
  font-weight: 500;
}

.quiz-next-btn, .start-quiz-btn, #submitReportBtn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(13px, 0.95vw, 16px);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.modal-overlay, .profile-drawer-overlay {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
[data-theme="dark"] .modal-overlay,
[data-theme="dark"] .profile-drawer-overlay { background: rgba(0, 0, 0, 0.5); }


/* ── PROFILE DRAWER (COMPLETE MAKEOVER - DARK BY DEFAULT) ── */

.profile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 200;
  transition: opacity 0.25s ease;
}

[data-theme="light"] .profile-drawer-overlay {
  background: rgba(0, 0, 0, 0.4) !important;
}

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: #0A0A0C !important;
  color: #FFFFFF !important;
  border-left: 1px solid #1C1C20 !important;
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.6) !important;
  z-index: 201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0 !important;
}

/* Header */
.drawer-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 20px 18px;
  background: linear-gradient(180deg, rgba(98, 91, 238, 0.08) 0%, transparent 100%) !important;
  border-bottom: 1px solid #1C1C20 !important;
}

[data-theme="light"] .drawer-header {
  background: linear-gradient(180deg, rgba(98, 91, 238, 0.04) 0%, transparent 100%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.drawer-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #625BEE), var(--accent, #6B6EF3)) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF !important;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(98, 91, 238, 0.35) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.drawer-info {
  flex: 1;
  min-width: 0;
}

.drawer-name {
  font-family: var(--display) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #FFFFFF !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em !important;
}

[data-theme="light"] .drawer-name {
  color: #1B2430 !important;
}

.drawer-email {
  font-family: var(--sans) !important;
  font-size: 12.5px !important;
  color: #A0AEC0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

[data-theme="light"] .drawer-email {
  color: #64748B !important;
}

.drawer-type-badge {
  display: inline-block;
  margin-top: 5px;
  font-family: var(--mono) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 2px 9px;
  border-radius: 8px;
  background: rgba(98, 91, 238, 0.14) !important;
  color: #8E8BFF !important;
  border: 1px solid rgba(98, 91, 238, 0.28) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em !important;
}

[data-theme="light"] .drawer-type-badge {
  color: #4F46E5 !important;
}

.drawer-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid #1C1C20 !important;
  color: #A0AEC0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: auto;
}

[data-theme="light"] .drawer-close-btn {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #64748B !important;
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #FFFFFF !important;
}

[data-theme="light"] .drawer-close-btn:hover {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #0F172A !important;
}

/* Streak Banner */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
  margin: 14px 20px 4px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.09) !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
  color: #FCD34D !important;
}

[data-theme="light"] .streak-banner {
  color: #D97706 !important;
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.22) !important;
}

.streak-fire {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.2) !important;
  color: #FCD34D !important;
  flex-shrink: 0;
}

[data-theme="light"] .streak-fire {
  color: #D97706 !important;
  background: rgba(245, 158, 11, 0.18) !important;
}

.streak-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.streak-copy strong {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #FFE7A3 !important;
}

[data-theme="light"] .streak-copy strong {
  color: #92400E !important;
}

.streak-copy > span {
  font-size: 11px !important;
  color: #D8B96A !important;
}

[data-theme="light"] .streak-copy > span {
  color: #B45309 !important;
}

.streak-best {
  margin-left: auto;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #D8B96A !important;
}

[data-theme="light"] .streak-best {
  color: #B45309 !important;
}

/* Sections */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.drawer-section {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #1C1C20 !important;
}

[data-theme="light"] .drawer-section {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.drawer-section:last-child {
  border-bottom: none !important;
}

.drawer-section-title {
  font-family: var(--mono) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #A0AEC0 !important;
  text-transform: uppercase;
  letter-spacing: 0.14em !important;
  margin-bottom: 12px;
}

[data-theme="light"] .drawer-section-title {
  color: #64748B !important;
}

.drawer-section-title--actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Usage */
.usage-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-bar {
  height: 7px !important;
  border-radius: 7px !important;
  background: #2A2A30 !important;
  overflow: hidden;
}

[data-theme="light"] .usage-bar {
  background: rgba(0, 0, 0, 0.08) !important;
}

.usage-bar-fill {
  height: 100% !important;
  border-radius: 7px !important;
  background: linear-gradient(90deg, var(--primary, #625BEE), #8E8BFF) !important;
  transition: width 0.6s ease;
}

.usage-label {
  font-family: var(--mono) !important;
  font-size: 12px !important;
  color: #E2E8F0 !important;
}

[data-theme="light"] .usage-label {
  color: #475569 !important;
}

/* Referral */
.ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.ref-code {
  flex: 1;
  background: #121216 !important;
  border: 1px solid #2A2A30 !important;
  border-radius: 10px !important;
  padding: 9px 14px;
  font-family: var(--mono) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #8E8BFF !important;
  letter-spacing: 3px !important;
  text-align: center;
}

[data-theme="light"] .ref-code {
  background: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #4F46E5 !important;
}

.ref-copy-btn {
  padding: 9px 16px;
  border-radius: 10px !important;
  background: rgba(98, 91, 238, 0.14) !important;
  border: 1px solid rgba(98, 91, 238, 0.28) !important;
  color: #8E8BFF !important;
  font-family: var(--sans) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

[data-theme="light"] .ref-copy-btn {
  background: rgba(98, 91, 238, 0.1) !important;
  border-color: rgba(98, 91, 238, 0.22) !important;
  color: #4F46E5 !important;
}

.ref-copy-btn:hover {
  background: var(--primary, #625BEE) !important;
  color: #FFFFFF !important;
  border-color: var(--primary, #625BEE) !important;
}

.ref-copy-btn--compact {
  padding: 3px 10px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
}

.ref-hint {
  font-size: 11.5px !important;
  color: #A0AEC0 !important;
}

[data-theme="light"] .ref-hint {
  color: #64748B !important;
}

/* Bookmarks */
.bookmark-empty {
  font-size: 12.5px !important;
  color: #A0AEC0 !important;
  line-height: 1.5;
  padding: 4px 0;
}

[data-theme="light"] .bookmark-empty {
  color: #64748B !important;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px !important;
  background: #121216 !important;
  border: 1px solid #1C1C20 !important;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

[data-theme="light"] .bookmark-item {
  background: #F8FAFC !important;
  border-color: #E2E8F0 !important;
}

.bookmark-item:hover {
  background: rgba(98, 91, 238, 0.08) !important;
  border-color: rgba(98, 91, 238, 0.24) !important;
}

.bookmark-text {
  font-size: 13px !important;
  color: #E2E8F0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .bookmark-text {
  color: #334155 !important;
}

.bookmark-time {
  font-size: 11px !important;
  font-family: var(--mono) !important;
  color: #A0AEC0 !important;
  flex-shrink: 0;
}

/* Settings List */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px !important;
  font-family: var(--sans) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #E2E8F0 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent !important;
  border: 1px solid transparent !important;
  width: 100%;
  text-align: left;
}

[data-theme="light"] .setting-row {
  color: #334155 !important;
}

.setting-row:hover {
  color: #FFFFFF !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: transparent !important;
}

[data-theme="light"] .setting-row:hover {
  color: #0F172A !important;
  background: #F1F5F9 !important;
}

.setting-icon {
  color: #A0AEC0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 24px !important;
  background: #2A2A30 !important;
  cursor: pointer;
  transition: background 0.25s ease;
}

[data-theme="light"] .toggle-slider {
  background: #CBD5E1 !important;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  left: 3px;
  bottom: 3px;
  background: #FFFFFF !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary, #625BEE) !important;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px) !important;
}

/* Footer & Logout */
.drawer-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid #1C1C20 !important;
  background: #0A0A0C !important;
}

[data-theme="light"] .drawer-footer {
  background: #FFFFFF !important;
  border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.logout-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px !important;
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  color: #F87171 !important;
  font-family: var(--sans) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

[data-theme="light"] .logout-btn {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
  color: #EF4444 !important;
}

.logout-btn:hover {
  background: #EF4444 !important;
  color: #FFFFFF !important;
  border-color: #EF4444 !important;
}


/* ── TOAST ── */

#toast {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(13px, 0.9vw, 16px);
  border-radius: 12px;
  letter-spacing: -0.01em;
}


/* ── PROMINENT QUIZ BANNER ── */

.prominent-quiz-btn {
  border-radius: 14px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(13px, 0.9vw, 16px);
}
.prominent-quiz-btn:hover { transform: translateY(-1px); }
.prominent-quiz-btn::after { display: none !important; }


/* ── STAT PILL ── */

.stat-pill {
  font-family: var(--mono);
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stat-pill.warning { color: #D97706; border-color: rgba(217, 119, 6, 0.2); background: rgba(217, 119, 6, 0.05); }
.stat-pill.danger { color: #DC2626; border-color: rgba(220, 38, 38, 0.2); background: rgba(220, 38, 38, 0.05); }
[data-theme="dark"] .stat-pill.warning { color: #FCD34D; background: rgba(252, 211, 77, 0.06); }
[data-theme="dark"] .stat-pill.danger { color: #FCA5A5; background: rgba(252, 165, 165, 0.06); }


/* ── MISC ── */

.splash-brand { font-family: var(--display); letter-spacing: -0.04em; }
.splash-glow { opacity: 0.35; }
.streak-fire { animation: none; }
.announcement-banner { animation: none; font-family: var(--sans); font-weight: 500; font-size: clamp(12px, 0.85vw, 15px); }
.lb-row { border-radius: 10px; }
.scroll-fab { border-radius: 10px; }
.scroll-fab:hover { transform: translateY(-2px); }
.countdown-value { font-family: var(--display); font-weight: 700; }

/* Kill decorative pseudo-elements */
.app::before { display: none !important; }
.workspace-sidebar::before { display: none !important; }

/* Selection */
::selection { background: rgba(98, 91, 238, 0.2); }


/* ── RESPONSIVE ── */

@media (max-width: 820px) {
  .welcome-title { font-size: clamp(22px, 6vw, 34px); }
  .welcome-sub { font-size: clamp(13px, 3.8vw, 15px); }
  .welcome-chip, .suggestion-chip {
    padding: clamp(6px, 1.5vw, 9px) clamp(10px, 3vw, 14px);
    font-size: clamp(12px, 3.5vw, 14px);
  }
  .ai-text { font-size: clamp(14px, 3.8vw, 16px); }
  .question-input { font-size: 16px; } /* prevent iOS zoom */
}

@media (max-width: 480px) {
  .header-brand { font-size: clamp(15px, 4.5vw, 18px); }
  .msg.user .bubble { max-width: 88%; border-radius: 16px 16px 4px 16px; }
  .msg.ai .bubble { border-radius: 4px 16px 16px 16px; }
}

/* Large screens */
@media (min-width: 1920px) {
  .ai-text { line-height: 1.8; }
  .ai-text li { margin-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── SKELETON SHIMMER SYSTEM ── */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(98, 91, 238, 0.05) 25%,
    rgba(98, 91, 238, 0.14) 37%,
    rgba(98, 91, 238, 0.05) 63%
  );
  background-size: 400% 100%;
  animation: nexaSkeletonShimmer 1.4s ease infinite;
  border-radius: 8px;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.12) 37%,
    rgba(255, 255, 255, 0.04) 63%
  );
  background-size: 400% 100%;
}

@keyframes nexaSkeletonShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Leaderboard modal refinement */
.leaderboard-modal {
  width: min(520px, calc(100vw - 32px));
  background: #0d0f16;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(129, 124, 255, 0.05);
}

[data-theme="light"] .leaderboard-modal {
  background: #fbfcff;
  border-color: rgba(15, 23, 42, 0.11);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(98, 91, 238, 0.04);
}

.leaderboard-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 23px 24px 20px;
  background:
    radial-gradient(circle at 12% 0%, rgba(129, 124, 255, 0.18), transparent 38%),
    linear-gradient(145deg, rgba(129, 124, 255, 0.09), rgba(13, 15, 22, 0) 70%);
  border-bottom-color: rgba(148, 163, 184, 0.13);
}

[data-theme="light"] .leaderboard-header {
  background:
    radial-gradient(circle at 12% 0%, rgba(129, 124, 255, 0.14), transparent 38%),
    linear-gradient(145deg, rgba(129, 124, 255, 0.07), rgba(251, 252, 255, 0) 70%);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.leaderboard-heading {
  min-width: 0;
  flex: 1;
}

.leaderboard-kicker {
  display: block;
  margin-bottom: 7px;
  color: #8d96aa;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.leaderboard-header h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #f4f5fb;
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

[data-theme="light"] .leaderboard-header h2 {
  color: #202538;
}

.leaderboard-title-icon {
  display: inline-flex;
  color: #a09cff;
}

.leaderboard-title-icon .nexa-icon,
.leaderboard-title-icon svg {
  width: 18px;
  height: 18px;
}

.leaderboard-meta {
  align-self: center;
  color: #8994aa;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.leaderboard-header .icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #9ba5b9;
}

[data-theme="light"] .leaderboard-header .icon-btn {
  background: rgba(15, 23, 42, 0.045);
  border-color: rgba(15, 23, 42, 0.10);
  color: #657189;
}

.leaderboard-header .icon-btn:hover,
.leaderboard-header .icon-btn:focus-visible {
  background: rgba(129, 124, 255, 0.16);
  border-color: rgba(129, 124, 255, 0.4);
  color: #c3c1ff;
}

.leaderboard-list {
  gap: 9px;
  padding: 18px 20px 20px;
  max-height: 380px;
}

.lb-row {
  min-height: 58px;
  gap: 13px;
  padding: 10px 14px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.13);
}

[data-theme="light"] .lb-row {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.09);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.035);
}

.lb-row:hover {
  background: rgba(129, 124, 255, 0.09);
  border-color: rgba(129, 124, 255, 0.27);
}

[data-theme="light"] .lb-row:hover {
  background: #f7f7ff;
}

.lb-row.lb-top {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(129, 124, 255, 0.045));
  border-color: rgba(245, 158, 11, 0.22);
}

[data-theme="light"] .lb-row.lb-top {
  background: linear-gradient(90deg, #fff9ec, #fbfaff);
  border-color: rgba(217, 119, 6, 0.21);
}

.lb-rank {
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(129, 124, 255, 0.12);
  color: #a09cff;
}

.lb-rank .nexa-icon,
.lb-rank svg {
  width: 16px;
  height: 16px;
}

.lb-rank.rank-0 {
  background: rgba(245, 158, 11, 0.18);
  color: #f6c85f;
}

.lb-rank.rank-1 { color: #b9c5d7; }
.lb-rank.rank-2 { color: #d99773; }

[data-theme="light"] .lb-rank {
  background: #eeedff;
  color: #625bee;
}

[data-theme="light"] .lb-rank.rank-0 {
  background: #fff0c9;
  color: #b7791f;
}

.lb-name {
  color: #e5e8f1;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

[data-theme="light"] .lb-name { color: #293149; }

.lb-score {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: #a09cff;
  font-family: var(--sans);
}

.lb-score strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lb-score small {
  color: #8994aa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lb-empty {
  padding: 36px 22px 38px;
  color: #8994aa;
  font-size: 13px;
  line-height: 1.55;
}

[data-theme="light"] .lb-empty { color: #718096; }

@media (max-width: 520px) {
  .leaderboard-header { padding: 20px 18px 18px; gap: 10px; }
  .leaderboard-meta { display: none; }
  .leaderboard-list { padding: 15px 14px 16px; }
}

/* Keep the profile drawer and its controls on the same theme surface. */
[data-theme="light"] .profile-drawer {
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fd 100%) !important;
  color: #202538 !important;
  border-left-color: rgba(15, 23, 42, 0.10) !important;
  box-shadow: -24px 0 70px rgba(15, 23, 42, 0.15) !important;
}

[data-theme="light"] .profile-drawer .drawer-body {
  background: transparent;
}

[data-theme="light"] .profile-drawer .drawer-header {
  background:
    radial-gradient(circle at 88% 15%, rgba(129, 124, 255, 0.13), transparent 32%),
    linear-gradient(145deg, rgba(129, 124, 255, 0.08), rgba(255, 255, 255, 0) 62%) !important;
}

/* Native scrollbar surfaces should never introduce a white strip into dark UI. */
html[data-theme="dark"] {
  color-scheme: dark;
  scrollbar-color: #4a4e60 #0a0a0c;
}

html[data-theme="light"] {
  color-scheme: light;
  scrollbar-color: #b8bfd0 #f4f6fb;
}

[data-theme="dark"] * {
  scrollbar-color: #4a4e60 transparent;
}

[data-theme="light"] * {
  scrollbar-color: #b8bfd0 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(98, 91, 238, 0.24);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(98, 91, 238, 0.42);
  border-width: 1px;
}

[data-theme="dark"] *::-webkit-scrollbar-track {
  background: #0a0a0c;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.34);
  border-color: #0a0a0c;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.56);
  border-color: #0a0a0c;
}

/* Workspace tokens must remain readable after the workspace layer loads. */
[data-theme="dark"] {
  --text: #F8FAFC;
  --text2: #D7DEEA;
  --text3: #94A3B8;
  --surface: #0D0D0F;
  --surface2: #141418;
  --border: #1C1C20;
  --border2: #2A2A30;
}

.quiz-message-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--workspace-ink);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.quiz-message-title .nexa-icon {
  width: 17px;
  height: 17px;
  color: var(--workspace-primary);
}

.quiz-message-meta {
  color: var(--text2);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.45;
}

[data-theme="dark"] .quiz-message-title { color: #F8FAFC; }
[data-theme="dark"] .quiz-message-meta { color: #B9C4D5; }

.system-error-bubble {
  max-width: min(560px, 82vw);
  padding: 16px 18px 15px;
  background: rgba(239, 68, 68, 0.055) !important;
  border: 1px solid rgba(239, 68, 68, 0.18) !important;
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.06) !important;
}

[data-theme="dark"] .system-error-bubble {
  background: rgba(127, 29, 29, 0.18) !important;
  border-color: rgba(248, 113, 113, 0.24) !important;
}

.system-error-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #B42318;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 750;
}

.system-error-title .nexa-icon {
  width: 17px;
  height: 17px;
  color: #D92D20;
}

[data-theme="dark"] .system-error-title { color: #FDA4AF; }
[data-theme="dark"] .system-error-title .nexa-icon { color: #FB7185; }

.system-error-bubble p {
  margin: 7px 0 12px;
  color: #667085;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
}

[data-theme="dark"] .system-error-bubble p { color: #CBD5E1; }

.system-error-dismiss {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 8px;
  background: transparent;
  color: #B42318;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.system-error-dismiss:hover,
.system-error-dismiss:focus-visible {
  background: rgba(239, 68, 68, 0.10);
}

[data-theme="dark"] .system-error-dismiss { color: #FDA4AF; border-color: rgba(248, 113, 113, 0.28); }

/* Keep the empty-state panel anchored to the chat rail instead of drifting
   as the scroll container and sticky composer recalculate their heights. */
#chatArea:has(> .welcome-state:only-child) {
  justify-content: flex-start;
  padding-top: 12px !important;
  padding-bottom: 24px !important;
}

#chatArea:has(> .welcome-state:only-child) > .welcome-state {
  min-height: 0;
  margin: 0 auto;
  padding: 30px 42px 28px;
  animation: none;
}

#chatArea:has(> .welcome-state:only-child) > .welcome-state .welcome-logo {
  margin-bottom: 4px;
}

#chatArea:has(> .welcome-state:only-child) > .welcome-state .welcome-chip {
  padding-top: 7px;
  padding-bottom: 7px;
}

/* Quiz setup selections must remain visible after the dark-theme button reset. */
.quiz-count-btn[aria-pressed="true"],
.quiz-diff-btn[aria-pressed="true"] {
  background: rgba(98, 91, 238, .18) !important;
  border-color: rgba(142, 139, 255, .72) !important;
  color: #5a52d8 !important;
  box-shadow: 0 0 0 1px rgba(98, 91, 238, .12), 0 6px 18px rgba(98, 91, 238, .12);
}

[data-theme="dark"] .quiz-count-btn[aria-pressed="true"],
[data-theme="dark"] .quiz-diff-btn[aria-pressed="true"] {
  background: rgba(98, 91, 238, .28) !important;
  border-color: rgba(142, 139, 255, .9) !important;
  color: #ffffff !important;
}

@media (max-height: 760px) and (min-width: 821px) {
  #chatArea:has(> .welcome-state:only-child) > .welcome-state {
    padding-top: 22px;
    padding-bottom: 20px;
    gap: 16px;
  }

  #chatArea:has(> .welcome-state:only-child) > .welcome-state .welcome-logo {
    width: 60px;
    height: 60px;
  }
}
