/* Practice quiz site - mobile-first dark theme with permanent desktop sidebar */

:root {
  --bg-primary: #050810;
  --bg-secondary: rgba(20, 28, 42, 0.6);
  --bg-tertiary: rgba(30, 40, 58, 0.5);
  --bg-elevated: rgba(40, 52, 74, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text-primary: #F0F4FA;
  --text-secondary: #A8B3C5;
  --text-muted: #6B7589;
  --accent: #F7931A;
  --accent-light: #FFB347;
  --accent-soft: rgba(247, 147, 26, 0.14);
  --accent-glow: rgba(247, 147, 26, 0.45);
  --neon-blue: #58A6FF;
  --neon-blue-glow: rgba(88, 166, 255, 0.5);
  --neon-purple: #B084F0;
  --neon-purple-glow: rgba(176, 132, 240, 0.4);
  --success: #34D399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --error: #F87171;
  --error-soft: rgba(248, 113, 113, 0.15);
  --info: #58A6FF;
  --info-soft: rgba(88, 166, 255, 0.12);
  --gold: #FFD68A;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.55);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-top: env(safe-area-inset-top, 0);
  --sidebar-width: 300px;
}

[data-theme="light"] {
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --border: #E2E8F0;
  --border-subtle: #EDF1F5;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --accent: #E97D1B;
  --accent-light: #D86F12;
  --accent-soft: rgba(233, 125, 27, 0.1);
  --accent-glow: rgba(233, 125, 27, 0.18);
  --success: #16A34A;
  --success-soft: rgba(22, 163, 74, 0.1);
  --error: #DC2626;
  --error-soft: rgba(220, 38, 38, 0.08);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Assistant', 'Heebo', 'Rubik', -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 800px 600px at 15% -10%, rgba(247,147,26,0.18), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 90% 110%, rgba(88,166,255,0.18), transparent 60%),
    radial-gradient(ellipse 600px 800px at 50% 50%, rgba(176,132,240,0.08), transparent 70%),
    linear-gradient(180deg, #050810 0%, #0A0F1B 50%, #050810 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
}

/* Grid pattern overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(88,166,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88,166,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 90%);
}

/* Animated sparkles */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 22% 18%, rgba(247,147,26,0.8), transparent),
    radial-gradient(2px 2px at 78% 25%, rgba(88,166,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 15% 62%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 88% 73%, rgba(247,147,26,0.6), transparent),
    radial-gradient(1.5px 1.5px at 35% 85%, rgba(88,166,255,0.7), transparent),
    radial-gradient(2px 2px at 60% 12%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 45%, rgba(247,147,26,0.6), transparent),
    radial-gradient(1.5px 1.5px at 8% 35%, rgba(88,166,255,0.6), transparent),
    radial-gradient(1px 1px at 45% 35%, rgba(176,132,240,0.6), transparent),
    radial-gradient(2px 2px at 70% 90%, rgba(176,132,240,0.5), transparent);
  animation: sparkleDrift 20s ease-in-out infinite;
  opacity: 0.9;
}
@keyframes sparkleDrift {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.8; }
  25% { transform: translateY(-15px) translateX(10px); opacity: 1; }
  50% { transform: translateY(-30px) translateX(-5px); opacity: 0.6; }
  75% { transform: translateY(-15px) translateX(-10px); opacity: 1; }
}

.app-header, main, .app-footer, .sidebar { position: relative; z-index: 1; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea {
  font-family: inherit;
  color: inherit;
  unicode-bidi: plaintext;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive helpers */
.mobile-only { display: flex; }
.desktop-only { display: none; }
@media (min-width: 960px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: flex; }
}

/* ============== HEADER ============== */
.app-header {
  position: relative;
  width: 100%;
  background:
    linear-gradient(135deg, rgba(14,17,22,0.92) 0%, rgba(31,36,46,0.7) 50%, rgba(14,17,22,0.92) 100%),
    radial-gradient(circle at 25% 60%, rgba(247,147,26,0.18), transparent 50%),
    radial-gradient(circle at 75% 40%, rgba(88,166,255,0.18), transparent 50%);
  border-bottom: 1px solid rgba(247,147,26,0.3);
  z-index: 100;
  padding-top: var(--safe-top);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
@media (min-width: 960px) {
  .app-header {
    margin-right: var(--sidebar-width);
  }
}
[data-theme="light"] .app-header {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(240,245,255,0.85) 100%),
    radial-gradient(circle at 25% 60%, rgba(247,147,26,0.12), transparent 50%);
}

/* Animated sparkles inside header */
.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 30%, rgba(247,147,26,0.7), transparent),
    radial-gradient(2px 2px at 38% 15%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 65% 65%, rgba(88,166,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 85% 25%, rgba(247,147,26,0.5), transparent),
    radial-gradient(1px 1px at 50% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 20% 70%, rgba(88,166,255,0.6), transparent);
  pointer-events: none;
  animation: heroSparkle 5s ease-in-out infinite;
}

.header-banner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 2;
  min-height: 130px;
}
@media (min-width: 768px) {
  .header-banner { padding: 22px 32px; min-height: 160px; }
}

.header-banner-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  flex-shrink: 0;
  filter:
    drop-shadow(0 0 22px rgba(88,166,255,0.6))
    drop-shadow(0 0 14px rgba(247,147,26,0.5));
  animation: logoPulse 4s ease-in-out infinite;
}
@media (min-width: 768px) {
  .header-banner-logo {
    width: 140px;
    height: 140px;
  }
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 22px rgba(88,166,255,0.6)) drop-shadow(0 0 14px rgba(247,147,26,0.5)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 30px rgba(88,166,255,0.85)) drop-shadow(0 0 20px rgba(247,147,26,0.7)); }
}

.header-banner-content {
  flex: 1;
  min-width: 0;
  text-align: right;
}
.header-banner-title {
  font-size: clamp(22px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #cce4ff 60%, #FFB347 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.header-banner-subtitle {
  font-size: clamp(13px, 1.8vw, 17px);
  color: var(--accent-light);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.header-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.back-btn:hover, .back-btn:active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.back-btn.visible { display: flex; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}
.brand-logo {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 14px rgba(88, 166, 255, 0.55)) drop-shadow(0 0 8px rgba(247, 147, 26, 0.45));
  transition: transform 300ms ease, filter 300ms ease;
}
.brand-logo:hover {
  transform: scale(1.05) rotate(-3deg);
  filter: drop-shadow(0 0 20px rgba(88, 166, 255, 0.8)) drop-shadow(0 0 12px rgba(247, 147, 26, 0.6));
}
@media (max-width: 600px) {
  .brand-logo { width: 56px; height: 56px; }
}
.brand-text { min-width: 0; flex: 1; overflow: hidden; }
.brand-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(135deg, #fff 0%, #B3D5FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub {
  font-size: 13px;
  color: var(--accent-light);
  line-height: 1.2;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
@media (min-width: 480px) {
  .brand-title { font-size: 22px; }
  .brand-sub { font-size: 14px; }
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover, .icon-btn:active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============== SIDEBAR ============== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background:
    linear-gradient(180deg, rgba(10,15,27,0.96) 0%, rgba(20,28,42,0.92) 100%);
  border-left: 1px solid rgba(247,147,26,0.18);
  z-index: 90;
  overflow-y: auto;
  transition: transform var(--transition);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: -10px 0 40px rgba(0,0,0,0.4);
}
.sidebar-content {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}
.sidebar-close {
  position: absolute;
  top: 8px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-section {
  margin-bottom: 14px;
}
.sidebar-section-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  padding: 8px 16px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  width: 100%;
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 2px 8px rgba(0,0,0,0.15);
  transition: all 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .sidebar-link {
  background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.3) 100%);
  border: 1px solid rgba(15,23,42,0.06);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    0 2px 8px rgba(15,23,42,0.04);
}
.sidebar-link:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 4px 16px rgba(0,0,0,0.25);
}
.sidebar-link:active {
  transform: translateY(0);
}
.sidebar-link.active {
  background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(255,255,255,0.02) 100%);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 24px var(--accent-glow),
    0 4px 16px rgba(0,0,0,0.2);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.06) 100%);
  pointer-events: none;
}
.sidebar-link.active .sb-sub { color: var(--accent); opacity: 0.85; }
.sidebar-link.small {
  font-size: 13px;
  color: var(--text-secondary);
}
.sidebar-link.danger:hover { color: var(--error); border-color: rgba(218,54,51,0.3); }
.sb-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(247,147,26,0.18) 0%, rgba(88,166,255,0.12) 100%);
  border: 1px solid rgba(247,147,26,0.25);
  color: var(--accent-light);
  transition: all var(--transition);
}
.sb-icon svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 4px rgba(247,147,26,0.4));
}
.sidebar-link:hover .sb-icon {
  background: linear-gradient(135deg, rgba(247,147,26,0.3) 0%, rgba(88,166,255,0.2) 100%);
  border-color: rgba(247,147,26,0.5);
  box-shadow: 0 0 12px rgba(247,147,26,0.25);
}
.sidebar-link.active .sb-icon {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 16px var(--accent-glow);
}
.sidebar-link.active .sb-icon svg { filter: drop-shadow(0 0 6px rgba(255,255,255,0.6)); }
.sidebar-link.danger .sb-icon {
  background: linear-gradient(135deg, rgba(218,54,51,0.12) 0%, rgba(218,54,51,0.06) 100%);
  border-color: rgba(218,54,51,0.25);
  color: var(--error);
}
.sidebar-link.danger:hover .sb-icon {
  background: linear-gradient(135deg, rgba(218,54,51,0.25) 0%, rgba(218,54,51,0.12) 100%);
  border-color: var(--error);
}
.sb-label { display: flex; flex-direction: column; line-height: 1.25; gap: 2px; }
.sb-name { font-weight: 600; }
.sb-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Mobile behavior: slide-out */
@media (max-width: 959px) {
  .sidebar {
    transform: translateX(100%);
    box-shadow: -10px 0 40px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
}

/* Sidebar overlay (mobile only) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 960px) {
  .sidebar-overlay { display: none; }
}

/* ============== APP LAYOUT ============== */
.app-layout {
  max-width: 1400px;
  margin: 0 auto;
}
main {
  padding: 16px;
  min-height: calc(100vh - 64px - 200px);
}
/* On desktop, push main content away from sidebar (RTL: right) */
@media (min-width: 960px) {
  main {
    margin-right: var(--sidebar-width);
    padding: 24px 32px 32px;
  }
}

/* ============== LOADER ============== */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loader-text {
  color: var(--text-secondary);
  font-size: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== HOME / HERO ============== */
.hero {
  background: linear-gradient(135deg, #0E1116 0%, #1A2030 60%, #0E1116 100%);
  border: 1px solid rgba(247,147,26,0.25);
  border-radius: 28px;
  padding: 40px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
@media (min-width: 768px) {
  .hero {
    padding: 56px 48px;
    min-height: 320px;
  }
}
/* Logo image as decorative element on the left side (RTL: actually visual right) */
.hero .hero-deco {
  position: absolute;
  top: 50%;
  left: 6%;
  transform: translateY(-50%);
  width: 280px;
  height: 280px;
  background: url('assets/logo.png') no-repeat center / contain;
  opacity: 0.45;
  filter: drop-shadow(0 0 30px rgba(88,166,255,0.5)) drop-shadow(0 0 20px rgba(247,147,26,0.3));
  animation: heroFloat 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(-50%) scale(1) rotate(0deg); }
  50% { transform: translateY(-52%) scale(1.04) rotate(2deg); }
}
@media (max-width: 768px) {
  .hero .hero-deco {
    width: 180px;
    height: 180px;
    opacity: 0.18;
    left: -20px;
  }
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 75% 40%, rgba(88,166,255,0.18), transparent 50%),
    radial-gradient(circle at 25% 75%, rgba(247,147,26,0.15), transparent 50%);
  pointer-events: none;
  animation: heroGlow 8s ease-in-out infinite alternate;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 30% 30%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 65% 18%, rgba(247,147,26,0.7), transparent),
    radial-gradient(2px 2px at 45% 70%, rgba(88,166,255,0.6), transparent),
    radial-gradient(1px 1px at 80% 55%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 20% 85%, rgba(247,147,26,0.5), transparent);
  pointer-events: none;
  animation: heroSparkle 6s ease-in-out infinite;
  opacity: 0.9;
}
@keyframes heroGlow {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}
@keyframes heroSparkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.hero > * { position: relative; z-index: 2; }
.hero-greeting {
  font-size: 13px;
  color: var(--accent-light);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}
.hero h1 {
  font-size: clamp(28px, 5.5vw, 44px);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
  letter-spacing: -0.8px;
  position: relative;
  background: linear-gradient(135deg, #fff 0%, #cce4ff 60%, #FFB347 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  max-width: 65%;
}
.hero p {
  color: rgba(230,237,243,0.85);
  font-size: 16px;
  line-height: 1.55;
  margin-bottom: 22px;
  position: relative;
  max-width: 65%;
}
@media (max-width: 600px) {
  .hero h1 { max-width: 100%; }
  .hero p { max-width: 100%; }
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  position: relative;
}
@media (min-width: 480px) {
  .hero-stats { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
.hero-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.hero-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 600;
}
@media (min-width: 600px) {
  .hero-stat-value { font-size: 34px; }
  .hero-stat-label { font-size: 13px; }
}

/* ============== SECTION TITLE ============== */
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 28px 0 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title-link {
  font-size: 13px;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  cursor: pointer;
}

/* ============== QUICK ACTIONS ============== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.quick-action {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: right;
  transition: all var(--transition);
}
.quick-action:hover, .quick-action:active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white;
  border: none;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.quick-action.primary .qa-subtitle { color: rgba(255,255,255,0.85); }
.quick-action-icon { font-size: 22px; margin-bottom: 4px; }
.qa-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.qa-subtitle { font-size: 12px; color: var(--text-secondary); }

/* ============== CARDS LIST ============== */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 600px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background:
    linear-gradient(135deg, rgba(30,40,58,0.55) 0%, rgba(20,28,42,0.4) 100%);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 4px 16px rgba(0,0,0,0.25);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent 0%, rgba(247,147,26,0.0) 50%, rgba(88,166,255,0.0) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: all var(--transition);
}
.card:hover, .card:active {
  transform: translateY(-3px);
  border-color: rgba(247,147,26,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 12px 40px rgba(0,0,0,0.4),
    0 0 30px rgba(247,147,26,0.18);
}
.card:hover::before {
  background: linear-gradient(135deg, rgba(247,147,26,0.4) 0%, rgba(88,166,255,0.3) 50%, rgba(176,132,240,0.3) 100%);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.card-badge { display: inline-flex; align-items: center; gap: 4px; }
.card-progress-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.card-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.card-best {
  color: var(--success);
  font-weight: 700;
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: all var(--transition);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  min-height: 48px;
}
.btn:hover, .btn:active { background: var(--bg-elevated); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border: none;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover, .btn-primary:active {
  box-shadow: 0 6px 22px var(--accent-glow);
}
.btn-secondary { background: var(--bg-secondary); }
.btn-ghost { background: transparent; border: 1px solid var(--border-subtle); }
.btn-success { background: var(--success); color: white; border: none; }
.btn-full { width: 100%; }

/* ============== QUIZ / SIMULATION RUNNER ============== */
.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.sim-title-bar { flex: 1; min-width: 0; }
.sim-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.sim-progress-text { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.sim-mode-badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.progress-track {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.question-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  animation: slideIn 250ms ease;
}
@media (min-width: 600px) {
  .question-card { padding: 28px; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: 600;
}
.question-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 18px;
}
.question-callout {
  background: var(--info-soft);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-right: 3px solid var(--info);
  line-height: 1.5;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.help-btn:hover, .help-btn:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.explanation-panel {
  background: var(--info-soft);
  border: 1px solid var(--info);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.6;
  animation: slideIn 200ms ease;
}
.explanation-panel .ep-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.explanation-panel .deep-btn {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--info);
  border: 1px solid var(--info);
  border-radius: 100px;
  padding: 6px 12px;
  background: transparent;
  transition: all var(--transition);
}
.explanation-panel .deep-btn:hover { background: var(--info); color: white; }
.explanation-panel .deep-text {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  animation: slideIn 200ms ease;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
  text-align: right;
  min-height: 56px;
}
.option:hover:not(.locked) {
  border-color: var(--accent);
  background: var(--bg-elevated);
}
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.correct { border-color: var(--success); background: var(--success-soft); }
.option.incorrect { border-color: var(--error); background: var(--error-soft); }
.option.locked { cursor: default; }
.option-marker {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-secondary);
}
.option.selected .option-marker { background: var(--accent); border-color: var(--accent); color: white; }
.option.correct .option-marker { background: var(--success); border-color: var(--success); color: white; }
.option.incorrect .option-marker { background: var(--error); border-color: var(--error); color: white; }
.option-text { flex: 1; }
.option-icon { font-size: 20px; line-height: 1; }

.open-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.5;
  min-height: 120px;
  resize: vertical;
}
.open-input:focus { outline: none; border-color: var(--accent); }
.open-note {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 8px;
  font-style: italic;
}

.action-bar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 8px;
}
.action-bar .left { display: flex; gap: 8px; }
.action-bar .right { display: flex; gap: 8px; flex: 1; justify-content: flex-end; }
@media (max-width: 600px) {
  .action-bar { flex-direction: column-reverse; gap: 8px; }
  .action-bar .left, .action-bar .right { width: 100%; }
  .action-bar .btn { flex: 1; }
}

/* ============== RESULTS ============== */
.results-hero {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}
.score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg-tertiary);
  border: 6px solid var(--accent);
}
.score-circle.passing { border-color: var(--success); }
.score-circle.failing { border-color: var(--error); }
.score-percent { font-size: 34px; font-weight: 800; line-height: 1; }
.score-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.results-message { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.results-detail { color: var(--text-secondary); margin-bottom: 20px; font-size: 14px; }

.review-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.review-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.review-status {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.review-status.correct { background: var(--success); }
.review-status.incorrect { background: var(--error); }
.review-status.skipped { background: var(--text-muted); }
.review-num { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.review-question { font-weight: 600; margin-bottom: 10px; line-height: 1.5; font-size: 15px; }
.review-answers { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.review-line {
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.5;
}
.review-line.correct { background: var(--success-soft); color: var(--success); }
.review-line.user.wrong { background: var(--error-soft); color: var(--error); }
.review-line.user.right { background: var(--success-soft); color: var(--success); }
.review-line.user.neutral { background: var(--accent-soft); }

.topic-icon { font-size: 22px; margin-bottom: 4px; }

.info-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.info-block h2 {
  font-size: 18px;
  margin-bottom: 10px;
  font-weight: 700;
}
.info-block p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.info-block ul { margin-right: 20px; color: var(--text-secondary); }
.info-block li { margin-bottom: 4px; }

.app-footer {
  margin-top: 60px;
  padding: 24px 16px calc(20px + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}
.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}
@media (min-width: 960px) {
  .app-footer { padding-right: calc(var(--sidebar-width) + 16px); }
}
.footer-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
@media (min-width: 600px) {
  .footer-credits {
    flex-direction: row;
    justify-content: center;
    gap: 18px;
  }
}
.footer-logo {
  width: 110px;
  height: auto;
  opacity: 0.9;
  border-radius: 8px;
  background: white;
  padding: 6px 10px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
.footer-copyright {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.footer-builder {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.footer-builder strong {
  color: var(--accent);
  font-weight: 700;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

.search-box {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.search-box:focus { outline: none; border-color: var(--accent); }

.toast {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* ============== LOGIN SCREEN ============== */
body.login-mode .app-header,
body.login-mode .sidebar,
body.login-mode .sidebar-overlay,
body.login-mode .app-footer { display: none !important; }

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, rgba(22,26,34,0.85) 0%, rgba(31,36,46,0.7) 100%);
  border: 1px solid rgba(247,147,26,0.25);
  border-radius: 28px;
  padding: 36px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    0 30px 80px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 80px rgba(88,166,255,0.1);
}
[data-theme="light"] .login-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.88) 100%);
  border-color: rgba(247,147,26,0.3);
}
.login-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(circle at 30% 30%, rgba(88,166,255,0.12), transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(247,147,26,0.12), transparent 40%);
  animation: heroGlow 7s ease-in-out infinite alternate;
  pointer-events: none;
}
.login-card > * { position: relative; z-index: 2; }

.login-logo {
  width: 130px;
  height: 130px;
  object-fit: contain;
  margin: 0 auto 18px;
  display: block;
  filter:
    drop-shadow(0 0 24px rgba(88,166,255,0.65))
    drop-shadow(0 0 14px rgba(247,147,26,0.5));
  animation: logoPulse 4s ease-in-out infinite;
}

.login-title {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff 0%, #cce4ff 60%, #FFB347 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-subtitle {
  font-size: 13px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 28px;
  letter-spacing: 0.3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: right;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.login-field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
  text-align: right;
  unicode-bidi: plaintext;
}
[data-theme="light"] .login-field input {
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.1);
}
.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(247,147,26,0.06);
  box-shadow: 0 0 0 3px rgba(247,147,26,0.15);
}

.login-password-wrap {
  position: relative;
}
.login-eye {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  color: var(--text-secondary);
  transition: opacity var(--transition);
  opacity: 0.7;
}
.login-eye:hover, .login-eye.on { opacity: 1; }

.login-error {
  min-height: 20px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}
.login-error.error { color: var(--error); }
.login-error.info { color: var(--accent-light); }

.login-submit {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  transition: all var(--transition);
  box-shadow: 0 8px 24px rgba(247,147,26,0.35);
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(247,147,26,0.45); }
.login-submit:active { transform: translateY(0); }

.login-signup {
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-secondary);
}
.login-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.login-link:hover { text-decoration: underline; }

.login-footer {
  margin-top: 36px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.login-footer-line { margin-bottom: 4px; }
.login-footer-line:last-child { color: var(--accent-light); font-weight: 600; }

/* ============== HELP ROW + BOT BUTTON ============== */
.help-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.help-btn.bot,
.deep-btn.bot {
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.12), rgba(196, 165, 90, 0.12));
  color: var(--accent);
  border-color: var(--accent);
}
.help-btn.bot:hover,
.deep-btn.bot:hover {
  background: var(--accent);
  color: white;
}

/* ============== BOT OVERLAY + PANEL ============== */
.bot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 200ms ease;
}
@media (min-width: 600px) {
  .bot-overlay { align-items: center; padding: 24px; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.bot-panel {
  background: var(--bg-secondary);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 280ms cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
}
@media (min-width: 600px) {
  .bot-panel { border-radius: var(--radius-lg); min-height: 480px; }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.bot-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.bot-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.bot-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.bot-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.bot-context {
  padding: 12px 20px;
  background: var(--info-soft);
  border-bottom: 1px solid var(--border-subtle);
}
.bot-context-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.bot-context-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  max-height: 70px;
  overflow-y: auto;
}

.bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.bot-msg {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 88%;
  word-wrap: break-word;
  animation: slideIn 200ms ease;
}
.bot-msg.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bot-msg.ai {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bot-msg.ai.thinking {
  color: var(--text-muted);
  font-style: italic;
}
.bot-msg.ai.error {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error);
}
.bot-msg-bank-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.bot-suggestions {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px dashed var(--border);
}
.bot-suggestions-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.bot-suggestion-btn {
  display: block;
  width: 100%;
  text-align: right;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: all var(--transition);
  cursor: pointer;
}
.bot-suggestion-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(-2px);
}
.bot-suggestion-btn:last-child { margin-bottom: 0; }

.bot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}
.bot-input-row input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-primary);
}
.bot-input-row input:focus { outline: none; border-color: var(--accent); }
.bot-send {
  background: var(--accent);
  color: white;
  border-radius: 100px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}
.bot-send:hover { background: var(--accent-light); transform: translateY(-1px); }

/* Markdown rendering inside bot messages */
.bot-msg.ai .md-p { margin-bottom: 8px; line-height: 1.55; }
.bot-msg.ai .md-p:last-child { margin-bottom: 0; }
.bot-msg.ai .md-h { font-weight: 700; line-height: 1.3; margin: 10px 0 6px; }
.bot-msg.ai .md-h3 { font-size: 16px; color: var(--accent); }
.bot-msg.ai .md-h4 { font-size: 15px; color: var(--accent); }
.bot-msg.ai .md-h5, .bot-msg.ai .md-h6 { font-size: 14px; }
.bot-msg.ai .md-list { margin: 6px 0 10px; padding-right: 20px; }
.bot-msg.ai .md-list li { margin-bottom: 4px; line-height: 1.5; }
.bot-msg.ai .md-hr { border: none; border-top: 1px dashed var(--border); margin: 10px 0; }
.bot-msg.ai .md-spacer { height: 4px; }
.bot-msg.ai strong { color: var(--accent); font-weight: 700; }
.bot-msg.ai code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}
