﻿/* ==========================================================================
   EDUFLOW WORLD-CLASS DUAL DESIGN SYSTEM
   1-Dizayn: Obsidian Elite & Royal Sapphire (Tungi Obsidiani)
   2-Dizayn: Imperial Ivory & Warm Terracotta Gold (Qirollik Marvaridi)
   ========================================================================== */

:root {
  /* Core Luxury Nocturnal Palette - Deep Obsidian & Midnight Sapphire */
  --color-bg: #070A12;
  --color-surface: #0E1422;
  --color-surface-muted: #151D30;
  --color-surface-card: #10182A;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(99, 102, 241, 0.45);
  --color-bg-subtle: #151D30;

  /* Typography Colors - Diamond Crystal White, Platinum & Titanium */
  --color-text-main: #F8FAFC;
  --color-text-muted: #94A3B8;
  --color-text-light: #64748B;

  /* Primary Accent - Royal Electric Indigo & Sapphire */
  --color-primary: #6366F1;
  --color-primary-hover: #4F46E5;
  --color-primary-light: rgba(99, 102, 241, 0.16);
  --color-primary-shadow: rgba(99, 102, 241, 0.38);
  --color-on-primary: #FFFFFF;

  /* Secondary & Tertiary Accents - Celestial Cyan & Royal Champagne Gold */
  --color-accent: #06B6D4;
  --color-accent-light: rgba(6, 182, 212, 0.16);
  --color-accent-hover: #0891B2;

  --color-gold: #F59E0B;
  --color-gold-light: rgba(245, 158, 11, 0.16);

  --color-burgundy: #8B5CF6;
  --color-burgundy-light: rgba(139, 92, 246, 0.16);

  --color-neon: #6366F1;
  --color-neon-light: rgba(99, 102, 241, 0.16);

  --color-indigo: #6366F1;
  --color-purple: #8B5CF6;

  /* Status & Functional Colors */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.16);
  --color-error: #EF4444;
  --color-error-bg: rgba(239, 68, 68, 0.16);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* High-End Multi-layer Diffuse Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.5), 0 2px 5px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 32px -6px rgba(0, 0, 0, 0.65), 0 8px 14px -6px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.48);
  --shadow-card-hover: 0 20px 36px -8px rgba(0, 0, 0, 0.65), 0 0 25px 2px rgba(99, 102, 241, 0.28);

  /* Transitions */
  --transition-base: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);

  /* Atmosphere & Glass */
  --color-header-bg: rgba(7, 10, 18, 0.88);
  --glass-bg: rgba(14, 20, 34, 0.82);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   2-DIZAYN: QIROLLIK MARVARIDI VA TERRAKOTA OLTINI (Royal Ivory & Terracotta)
   ========================================================================== */
html[data-theme="terracotta"] {
  /* Core Luxury Alabaster, Warm Ivory & Fine Porcelain Palette */
  --color-bg: #FBF8F4;
  --color-surface: #FFFFFF;
  --color-surface-muted: #F6EFE6;
  --color-surface-card: #FFFFFF;
  --color-border: #E8DFD3;
  --color-border-hover: #D5C7B5;
  --color-bg-subtle: #F6EFE6;

  /* Typography Colors - Deep Velvet Espresso & Warm Taupe */
  --color-text-main: #1D1612;
  --color-text-muted: #736356;
  --color-text-light: #A39486;

  /* Primary Accent - Imperial Royal Terracotta & Amber Gold */
  --color-primary: #C2542D;
  --color-primary-hover: #D46238;
  --color-primary-light: rgba(194, 84, 45, 0.12);
  --color-primary-shadow: rgba(194, 84, 45, 0.35);
  --color-on-primary: #FFFFFF;

  /* Secondary & Tertiary Accents - Tuscan Amber Gold & Warm Bronze */
  --color-accent: #D9773F;
  --color-accent-light: rgba(217, 119, 63, 0.14);
  --color-accent-hover: #C3652E;

  --color-gold: #D49339;
  --color-gold-light: rgba(212, 147, 57, 0.14);

  --color-burgundy: #A85A32;
  --color-burgundy-light: rgba(168, 90, 50, 0.14);

  --color-neon: #C2542D;
  --color-neon-light: rgba(194, 84, 45, 0.12);

  --color-indigo: #C2542D;
  --color-purple: #934626;

  /* Functional Status Colors */
  --color-success: #15803D;
  --color-success-bg: rgba(21, 128, 61, 0.12);
  --color-error: #DC2626;
  --color-error-bg: rgba(220, 38, 38, 0.12);

  /* High-End Warm Editorial Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(70, 40, 20, 0.05);
  --shadow-md: 0 4px 10px -1px rgba(70, 40, 20, 0.08), 0 2px 5px -2px rgba(70, 40, 20, 0.04);
  --shadow-lg: 0 16px 28px -6px rgba(70, 40, 20, 0.10), 0 8px 12px -4px rgba(70, 40, 20, 0.05);
  --shadow-card: 0 4px 16px 0 rgba(70, 40, 20, 0.06);
  --shadow-card-hover: 0 18px 32px -6px rgba(70, 40, 20, 0.12), 0 0 20px 2px rgba(194, 84, 45, 0.20);

  /* Atmosphere */
  --color-header-bg: rgba(251, 248, 244, 0.92);
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(232, 223, 211, 0.85);
}

/* Header controls wrapper */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sound toggle button */
.sound-toggle-btn {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-base);
  padding: 0;
}
.sound-toggle-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.06);
}


.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.55);
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  flex-shrink: 0;
}
.brand:hover .brand-logo-img {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.85);
}

/* Brand mark polish */
.brand-mark {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent)) !important;
  color: #FFFFFF !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
}

/* Option button polish */
.option-btn {
  border-radius: var(--radius-md) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  overflow: hidden !important;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--color-primary) !important;
  background: var(--color-primary-light) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -3px rgba(16, 185, 129, 0.15);
}
.option-btn .option-letter {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  font-size: 0.9rem !important;
}
.option-btn.selected {
  border-color: var(--color-primary) !important;
  background: var(--color-primary-light) !important;
  box-shadow: 0 0 0 2px var(--color-primary) !important;
}
.option-btn.correct-answer {
  border-color: var(--color-success) !important;
  background: var(--color-success-bg) !important;
  animation: answer-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.option-btn.wrong-answer {
  border-color: var(--color-error) !important;
  background: var(--color-error-bg) !important;
  animation: answer-shake 0.4s ease-in-out;
}

/* Keyboard hint badge inside option */
.key-hint {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: monospace;
}

/* Keyframe animations */
@keyframes answer-pop {
  0% { transform: scale(0.97); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes answer-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Timer warning pulse */
.timer-warning {
  color: var(--color-error) !important;
  border-color: var(--color-error) !important;
  background: var(--color-error-bg) !important;
  animation: timer-pulse 1s infinite alternate;
}
@keyframes timer-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

/* Card hover lifts */
.level-card {
  transition: var(--transition-base) !important;
}
.level-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: var(--shadow-card-hover) !important;
  border-color: var(--color-primary) !important;
}

/* Certificate VIP styling */
.cert-wrapper {
  background: #FCFCFA !important;
  color: #1E293B !important;
  border: 3px double #D97706 !important;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.25) !important;
  border-radius: var(--radius-md) !important;
}
.cert-inner-border {
  border: 2px solid #F59E0B !important;
  padding: var(--space-2xl) !important;
  border-radius: var(--radius-sm) !important;
}
.cert-title {
  color: #B45309 !important;
  letter-spacing: 4px !important;
  font-weight: 900 !important;
}
.cert-recipient {
  color: #0F172A !important;
  font-family: var(--font-display) !important;
}
.cert-stamp {
  border: 2px solid #059669 !important;
  color: #059669 !important;
  background: rgba(5, 150, 105, 0.08) !important;
}



/* ===================== CEFR COLOR SYSTEM & BADGES ===================== */

/* CEFR Color Badges */
.q-badge, .badge-cefr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: transform 0.2s ease;
}
.q-badge:hover, .badge-cefr:hover {
  transform: scale(1.05);
}

.cefr-A1, [data-level="A1"] {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #10B981 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}
.cefr-A2, [data-level="A2"] {
  background: rgba(6, 182, 212, 0.16) !important;
  color: #06B6D4 !important;
  border: 1px solid rgba(6, 182, 212, 0.4) !important;
}
.cefr-B1, [data-level="B1"] {
  background: rgba(2, 132, 199, 0.16) !important;
  color: #38BDF8 !important;
  border: 1px solid rgba(2, 132, 199, 0.4) !important;
}
.cefr-B2, [data-level="B2"] {
  background: rgba(99, 102, 241, 0.16) !important;
  color: #818CF8 !important;
  border: 1px solid rgba(99, 102, 241, 0.4) !important;
}
.cefr-C1, [data-level="C1"] {
  background: rgba(139, 92, 246, 0.16) !important;
  color: #A78BFA !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
}
.cefr-C2, [data-level="C2"] {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #FBBF24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

/* ===================== ULTRA-PREMIUM DESIGN SYSTEM ===================== */
body {
  background: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99, 102, 241, 0.22) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 85% 95%, rgba(6, 182, 212, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 15% 45%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 20%, #131B2E 0%, #070A12 75%) !important;
  background-attachment: fixed !important;
  color: var(--color-text-main) !important;
  position: relative;
}

/* Luxury Cosmic Micro-Grid Texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 25%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 25%, transparent 85%);
}

html[data-theme="terracotta"] body::before {
  background-image: radial-gradient(rgba(194, 84, 45, 0.08) 1px, transparent 1px);
  opacity: 0.4;
}

html[data-theme="terracotta"] body {
  background: radial-gradient(circle at 50% 0%, #FFFDF9 0%, #F5EFE6 65%, #EFE7DA 100%) !important;
  background-attachment: fixed !important;
  color: var(--color-text-main) !important;
}

/* Glassmorphic & Luxury Cards - Specular Rim Lighting & Depth */
.profile-card, .level-card, .results, .dash-kpi-card, .admin-kpi-card, .teacher-kpi-card, .history-header-card, .subject-mgr-card, .billing-kpi-card {
  background: rgba(14, 20, 34, 0.78) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.14),
    inset 0 0 20px 0 rgba(99, 102, 241, 0.02),
    0 14px 36px -8px rgba(0, 0, 0, 0.65),
    0 4px 12px rgba(0, 0, 0, 0.4) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html[data-theme="terracotta"] .profile-card,
html[data-theme="terracotta"] .level-card,
html[data-theme="terracotta"] .results,
html[data-theme="terracotta"] .dash-kpi-card,
html[data-theme="terracotta"] .admin-kpi-card,
html[data-theme="terracotta"] .teacher-kpi-card,
html[data-theme="terracotta"] .history-header-card,
html[data-theme="terracotta"] .subject-mgr-card,
html[data-theme="terracotta"] .billing-kpi-card {
  background: #FFFFFF !important;
  border: 1px solid #E8DFD3 !important;
  box-shadow: 0 8px 24px -4px rgba(70, 40, 20, 0.06), 0 2px 6px rgba(0, 0, 0, 0.02) !important;
}

/* Primary Button Glow & Micro-interactions - Chamfered Glass Sheen */
.btn:not(.ghost) {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.45) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.38),
    0 4px 20px -2px var(--color-primary-shadow, rgba(99, 102, 241, 0.45)),
    0 2px 6px rgba(0, 0, 0, 0.35) !important;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}
.btn:not(.ghost)::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: rotate(25deg);
  transition: all 0.75s ease;
  pointer-events: none;
}
.btn:not(.ghost):hover::before {
  left: 125%;
}
.btn:not(.ghost):hover {
  transform: translateY(-2px) scale(1.015) !important;
  box-shadow: 
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.6),
    0 10px 32px -4px var(--color-primary-shadow, rgba(99, 102, 241, 0.65)),
    0 0 25px var(--color-primary-shadow, rgba(99, 102, 241, 0.4)) !important;
  filter: brightness(1.08) !important;
}
.btn:not(.ghost):active {
  transform: translateY(0) scale(0.99) !important;
}

/* Ghost Button Polish - Frosted Obsidian Glass */
.btn.ghost {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(14, 20, 34, 0.75) !important;
  color: var(--color-text-main) !important;
  border-radius: var(--radius-md) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.22s ease !important;
}
.btn.ghost:hover {
  border-color: var(--color-primary) !important;
  border-top-color: rgba(165, 180, 252, 0.8) !important;
  background: var(--color-primary-light) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 18px var(--color-primary-shadow) !important;
}
html[data-theme="terracotta"] .btn.ghost {
  background: #FFFFFF !important;
  border: 1px solid #E8DFD3 !important;
  color: #1D1612 !important;
  box-shadow: 0 2px 6px rgba(70, 40, 20, 0.04) !important;
}
html[data-theme="terracotta"] .btn.ghost:hover {
  border-color: #C2542D !important;
  background: rgba(194, 84, 45, 0.08) !important;
  color: #C2542D !important;
  box-shadow: 0 4px 14px rgba(194, 84, 45, 0.18) !important;
}

/* Tables in Admin & Teacher */
.admin-table, .teacher-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden !important;
}
.admin-table th, .teacher-table th {
  background: var(--color-surface-muted) !important;
  color: var(--color-text-muted) !important;
  font-size: 0.82rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--color-border) !important;
}
.admin-table td, .teacher-table td {
  padding: 14px 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  font-size: 0.92rem !important;
}
.admin-table tr:hover td, .teacher-table tr:hover td {
  background: var(--color-primary-light) !important;
}

/* Empty states */
.empty-state-card {
  text-align: center;
  padding: 36px 20px;
  color: var(--color-text-muted);
}
.empty-state-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

/* Filter controls bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 8px 14px !important;
  font-size: 0.9rem !important;
  color: var(--color-text-main) !important;
  outline: none;
  transition: border-color 0.2s;
}
.filter-input:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Profile Level Tag */
.profile-stat-badge .level-tag {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent)) !important;
  color: #FFFFFF !important;
  font-size: 1.8rem !important;
  font-weight: 900 !important;
  padding: 6px 18px !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}


/* ===================== ULTRA-RICH ANIMATIONS & EFFECTS ===================== */

/* Ambient Glowing Background Orbs */
.ambient-glow {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
  transform: translateZ(0);
}
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(38px);
  opacity: 0.14;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  animation: orbFloat 36s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.orb-1 {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #4F46E5 0%, rgba(79, 70, 229, 0) 70%);
  top: -120px;
  left: -120px;
  animation-duration: 24s;
}
.orb-2 {
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, #7C3AED 0%, rgba(124, 58, 237, 0) 70%);
  bottom: -160px;
  right: -130px;
  animation-duration: 30s;
  animation-delay: -6s;
}
.orb-3 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #06B6D4 0%, rgba(6, 182, 212, 0) 70%);
  top: 45%;
  left: 60%;
  animation-duration: 26s;
  animation-delay: -12s;
}

html[data-theme="terracotta"] .orb-1 {
  background: radial-gradient(circle, #C2542D 0%, rgba(194, 84, 45, 0) 70%) !important;
  opacity: 0.15 !important;
}
html[data-theme="terracotta"] .orb-2 {
  background: radial-gradient(circle, #D49339 0%, rgba(212, 147, 57, 0) 70%) !important;
  opacity: 0.14 !important;
}
html[data-theme="terracotta"] .orb-3 {
  background: radial-gradient(circle, #E08758 0%, rgba(224, 135, 88, 0) 70%) !important;
  opacity: 0.12 !important;
}

@keyframes orbFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(50px, 70px, 0) scale(1.1); }
  100% { transform: translate3d(-40px, 35px, 0) scale(0.92); }
}

/* Smooth Page & View Transitions */
.view.active {
  display: block;
  animation: viewEntrance 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes viewEntrance {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.995);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Level Cards 3D Interactive Hover & CEFR Colored Glows */
.level-card {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.28s ease !important;
  cursor: pointer;
}
.level-card:hover {
  transform: translateY(-8px) scale(1.018) !important;
}
.level-card:hover .seal {
  transform: scale(1.15) rotate(6deg) !important;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
.level-card[data-level="A1"]:hover {
  border-color: #10B981 !important;
  box-shadow: 0 16px 36px -8px rgba(16, 185, 129, 0.35), 0 0 18px 2px rgba(16, 185, 129, 0.2) !important;
}
.level-card[data-level="A2"]:hover {
  border-color: #06B6D4 !important;
  box-shadow: 0 16px 36px -8px rgba(6, 182, 212, 0.35), 0 0 18px 2px rgba(6, 182, 212, 0.2) !important;
}
.level-card[data-level="B1"]:hover {
  border-color: #0EA5E9 !important;
  box-shadow: 0 16px 36px -8px rgba(14, 165, 233, 0.35), 0 0 18px 2px rgba(14, 165, 233, 0.2) !important;
}
.level-card[data-level="B2"]:hover {
  border-color: #6366F1 !important;
  box-shadow: 0 16px 36px -8px rgba(99, 102, 241, 0.35), 0 0 18px 2px rgba(99, 102, 241, 0.2) !important;
}
.level-card[data-level="C1"]:hover {
  border-color: #8B5CF6 !important;
  box-shadow: 0 16px 36px -8px rgba(139, 92, 246, 0.35), 0 0 18px 2px rgba(139, 92, 246, 0.2) !important;
}
.level-card[data-level="C2"]:hover {
  border-color: #F59E0B !important;
  box-shadow: 0 16px 36px -8px rgba(245, 158, 11, 0.35), 0 0 18px 2px rgba(245, 158, 11, 0.2) !important;
}

/* Question Card & Text Transition */
.q-text-enter {
  animation: qTextEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes qTextEntrance {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Option Buttons Staggered Entrance */
.option-btn {
  animation: optSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@keyframes optSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Correct and Wrong Answer Feedback Animations */
.option-btn.correct-answer {
  border-color: var(--color-success) !important;
  background: var(--color-success-bg) !important;
  animation: answerPopCorrect 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.38) !important;
}
@keyframes answerPopCorrect {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

.option-btn.wrong-answer {
  border-color: var(--color-error) !important;
  background: var(--color-error-bg) !important;
  animation: answerShakeWrong 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35) !important;
}
@keyframes answerShakeWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Animated Radiant Progress Bar - Smooth GPU-friendly */
#quizProgress, .card-progress-bar-fill, .level-progress-fill {
  background: linear-gradient(90deg, #10B981, #06B6D4, #6366F1) !important;
  background-size: 100% 100% !important;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3) !important;
}
@keyframes progressShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Celebratory Score Seal Pulse */
.score-seal-celebrate {
  animation: scoreSealPop 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes scoreSealPop {
  0% { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  70% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Certificate VIP Golden Light Sweep */
.cert-wrapper {
  position: relative;
  overflow: hidden;
}
.cert-wrapper::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(60deg, transparent 40%, rgba(245, 158, 11, 0.1) 50%, transparent 60%);
  animation: certLightSweep 5.5s infinite;
  pointer-events: none;
}
@keyframes certLightSweep {
  0% { transform: translateX(-100%) translateY(-100%) rotate(25deg); }
  22%, 100% { transform: translateX(100%) translateY(100%) rotate(25deg); }
}

/* Certificate Stamp Entrance Animation */
.cert-stamp-enter {
  animation: certStampIn 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes certStampIn {
  0% { transform: scale(2.2) rotate(20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Animated Sound Wave Equalizer */
.sound-wave-anim {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  margin-left: 8px;
  vertical-align: middle;
}
.sound-wave-bar {
  width: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  animation: soundWavePulse 0.8s ease-in-out infinite alternate;
}
.sound-wave-bar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.sound-wave-bar:nth-child(2) { height: 16px; animation-delay: 0.3s; }
.sound-wave-bar:nth-child(3) { height: 10px; animation-delay: 0.15s; }
.sound-wave-bar:nth-child(4) { height: 18px; animation-delay: 0.4s; }

@keyframes soundWavePulse {
  0% { height: 4px; }
  100% { height: 18px; }
}




/* ===================== EDUFLOW BILLING & SUBJECT MANAGER CSS ===================== */
.billing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.billing-kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.billing-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.billing-kpi-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.billing-kpi-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-top: 6px;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-status.status-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-status.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-status.status-unpaid {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Modal Windows */
.eduflow-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.eduflow-modal.open {
  display: flex;
  animation: viewEntrance 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.eduflow-modal-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: min(580px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.7);
  padding: 28px 32px;
  position: relative;
}
.eduflow-modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eduflow-modal-close:hover {
  color: var(--color-text-main);
  border-color: var(--color-primary);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}
.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--color-text-main);
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Receipt Voucher Styling */
.receipt-box {
  background: #FCFCFA;
  color: #1E293B;
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 16px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.receipt-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.receipt-stamp {
  display: inline-block;
  border: 2px solid #10B981;
  color: #10B981;
  padding: 4px 12px;
  font-weight: 800;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transform: rotate(-4deg);
}

/* ===================== BANK CARD & REKVIZIT WIDGET ===================== */
.bank-card-widget {
  position: relative;
  border-radius: 18px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #064E3B 0%, #065F46 45%, #047857 100%);
  color: #FFFFFF !important;
  box-shadow: 0 12px 28px -6px rgba(6, 78, 59, 0.45), 0 6px 12px -4px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-sans);
}

html[data-theme="terracotta"] .bank-card-widget {
  background: linear-gradient(135deg, #853316 0%, #A8431E 48%, #C2542D 100%);
  box-shadow: 0 12px 28px -6px rgba(133, 51, 22, 0.4), 0 6px 12px -4px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bank-card-widget::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.bank-card-widget * {
  color: #FFFFFF;
}

.bank-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.bank-card-chip {
  width: 40px;
  height: 30px;
  background: linear-gradient(135deg, #FFE082 0%, #FFB300 50%, #FFA000 100%);
  border: 1px solid #FF8F00;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(0, 0, 0, 0.25);
  font-size: 0.65rem;
  font-weight: 900;
  color: #6D4C41 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.8px;
  user-select: none;
}

.bank-card-number-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 11px 15px;
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.bank-card-number-box:hover {
  background: rgba(0, 0, 0, 0.46);
  border-color: rgba(255, 255, 255, 0.35);
}

.bank-card-number {
  font-family: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', 'Fira Code', 'Consolas', monospace;
  font-size: clamp(0.95rem, 2.1vw, 1.22rem);
  font-weight: 800;
  letter-spacing: clamp(0.8px, 0.2vw, 1.8px);
  color: #FFFFFF !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;
  user-select: all;
  flex-shrink: 0;
  line-height: 1.25;
}

@media (max-width: 480px) {
  .bank-card-widget {
    padding: 16px 14px !important;
  }
  .bank-card-number-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
    padding: 12px 10px;
  }
  .bank-card-number {
    font-size: 1.12rem !important;
    letter-spacing: 1.5px !important;
    text-align: center;
    width: 100%;
    display: block;
    white-space: nowrap !important;
  }
  .btn-copy-card {
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;
    padding: 8px 14px !important;
  }
}

/* HIGH CONTRAST COPY BUTTON */
.btn-copy-card {
  background: #FFFFFF !important;
  color: #064E3B !important;
  border: 1px solid #FFFFFF !important;
  border-radius: 8px !important;
  padding: 6px 14px !important;
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  flex-shrink: 0 !important;
  margin-left: auto;
}

.btn-copy-card * {
  color: #064E3B !important;
  font-weight: 800 !important;
}

html[data-theme="terracotta"] .btn-copy-card {
  color: #853316 !important;
}

html[data-theme="terracotta"] .btn-copy-card * {
  color: #853316 !important;
}

.btn-copy-card:hover {
  background: #ECFDF5 !important;
  color: #047857 !important;
  transform: translateY(-1px) scale(1.03) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35) !important;
}

.btn-copy-card:active {
  transform: translateY(0) scale(0.97) !important;
}

/* RECEIPT IMAGE UPLOAD BOX */
.receipt-upload-box {
  border: 2px dashed rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.04);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
  user-select: none;
}

.receipt-upload-box:hover {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.09);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.receipt-upload-box.dragover {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.18);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.3);
}

html[data-theme="terracotta"] .receipt-upload-box {
  border-color: rgba(194, 84, 45, 0.45);
  background: rgba(194, 84, 45, 0.04);
}

html[data-theme="terracotta"] .receipt-upload-box:hover {
  border-color: #C2542D;
  background: rgba(194, 84, 45, 0.09);
}

/* PENDING PAYMENTS QUEUE */
.pending-queue-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}

.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: var(--transition-base);
}

.pending-item:hover {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.pending-item strong {
  color: var(--color-text-main) !important;
}

/* ONLINE USER ITEMS */
.online-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--color-surface-muted) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 8px;
  transition: var(--transition-base);
  color: var(--color-text-main) !important;
}

.online-user-item:hover {
  background: var(--color-surface) !important;
  border-color: var(--color-border-hover) !important;
}

.online-user-item strong {
  color: var(--color-text-main) !important;
  font-weight: 700;
}

.online-user-empty {
  color: var(--color-text-muted) !important;
  font-size: 0.9rem;
  padding: 14px;
  text-align: center;
  background: var(--color-surface-muted) !important;
  border: 1px dashed var(--color-border) !important;
  border-radius: var(--radius-sm);
}

select.form-control option,
select.filter-input option {
  background: var(--color-surface);
  color: var(--color-text-main);
}


/* Subject Manager Grid */
.subject-mgr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.subject-mgr-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}
.subject-mgr-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

/* ===================== MULTI-SUBJECT SYSTEM CSS ===================== */
.subject-nav-wrapper {
  margin: 16px 0 32px;
  text-align: center;
}
.subject-nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}
.subject-pill-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.subject-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 30px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.subject-pill-btn:hover {
  transform: translateY(-3px);
  border-color: var(--subject-accent, var(--color-primary));
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.35);
}
.subject-pill-btn.active {
  background: var(--subject-gradient, linear-gradient(135deg, var(--color-primary), var(--color-accent))) !important;
  color: #FFFFFF !important;
  border-color: transparent !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
  box-shadow: 0 8px 25px -4px var(--subject-glow, rgba(16, 185, 129, 0.45)) !important;
  transform: translateY(-2px) scale(1.03);
}
.subject-pill-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* Dynamic Level Card Header Line */
.level-top-bar {
  height: 4px;
  border-radius: 4px;
  margin-bottom: 14px;
  background: var(--level-color, var(--color-primary));
}

/* ===================== WORLD-CLASS DESIGN SYSTEM ELEVATION ===================== */

/* Header Inner & Quick Nav Links */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
}
.brand-accent {
  color: var(--color-primary);
}
.header-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-link-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-link-btn:hover {
  color: var(--color-text-main);
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  transform: translateY(-1px);
}
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 var(--color-primary-light);
  animation: pulseDot 2s infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 var(--color-primary-shadow); }
  70% { box-shadow: 0 0 0 8px rgba(0, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* Premium Hero Section */
.hero-premium {
  padding: 44px 0 36px;
  text-align: center;
  position: relative;
}
.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.38);
  border-top: 1px solid rgba(165, 180, 252, 0.6);
  color: #A5B4FC;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 22px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.hero-main-title {
  font-size: clamp(2.2rem, 4.8vw, 3.5rem);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.03em;
  margin: 0 auto 10px;
  max-width: 24ch;
  color: var(--color-text-main);
}
.gradient-text {
  background: linear-gradient(135deg, #FFFFFF 0%, #E2E8F0 25%, #818CF8 60%, #38BDF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 24px rgba(99, 102, 241, 0.4));
}
html[data-theme="terracotta"] .gradient-text {
  background: linear-gradient(135deg, #C2542D 0%, #D9773F 45%, #D49B4B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 20px rgba(194, 84, 45, 0.2));
}
.hero-subtitle-en {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.hero-description {
  max-width: 64ch;
  margin: 0 auto 30px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--color-text-muted);
}
.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 42px;
}
.btn-hero-primary {
  padding: 13px 28px !important;
  font-size: 1.02rem !important;
  border-radius: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.45) !important;
}
.btn-hero-secondary {
  padding: 13px 22px !important;
  font-size: 0.95rem !important;
  border-radius: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.hero-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 500px) {
  .hero-stats-row {
    grid-template-columns: 1fr;
  }
  .header-nav-links {
    display: none;
  }
}
.hero-stat-card {
  background: rgba(17, 24, 39, 0.65);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
html[data-theme="terracotta"] .hero-stat-card {
  background: #FFFFFF;
  border-color: #E8DFD3;
  box-shadow: 0 4px 16px rgba(70, 40, 20, 0.05);
}
.hero-stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary);
}
.stat-icon-wrap {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-num {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--color-text-main);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Placement Test Callout Card */
.placement-callout-card {
  margin: 10px 0 36px;
}
.placement-callout-inner {
  background: 
    radial-gradient(ellipse 60% 80% at 90% 50%, rgba(6, 182, 212, 0.16) 0%, transparent 60%),
    linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, rgba(14, 20, 34, 0.90) 100%) !important;
  border: 1.5px solid rgba(99, 102, 241, 0.38) !important;
  border-top: 1.5px solid rgba(165, 180, 252, 0.7) !important;
  border-radius: var(--radius-lg);
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  backdrop-filter: blur(20px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 16px 40px -8px rgba(0, 0, 0, 0.65),
    0 0 35px rgba(99, 102, 241, 0.22) !important;
  transition: transform 0.25s ease;
}
html[data-theme="terracotta"] .placement-callout-inner {
  background: linear-gradient(135deg, rgba(194, 84, 45, 0.08), rgba(212, 147, 57, 0.10));
  border-color: rgba(194, 84, 45, 0.3);
  box-shadow: 0 10px 30px -5px rgba(194, 84, 45, 0.15);
}
.placement-callout-inner:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.callout-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.callout-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 6px;
}
.callout-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 55ch;
  line-height: 1.5;
}
.btn-callout-cta {
  padding: 12px 26px !important;
  font-size: 1rem !important;
  border-radius: 30px !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4) !important;
  white-space: nowrap;
}

/* Level Card Module Pills */
.level-modules-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.module-pill {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ===================== Global Styles ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  background: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===================== LUXURY DESIGN SWITCHER PILL ===================== */
.design-switcher-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-main);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  outline: none;
  user-select: none;
}
.design-switcher-pill:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--color-primary-shadow);
}
.design-pill-icon {
  font-size: 1.05rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface-muted);
  transition: transform 0.3s ease;
}
.design-switcher-pill:hover .design-pill-icon {
  transform: rotate(20deg) scale(1.1);
}
.design-pill-text {
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.design-pill-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #FFFFFF;
  text-transform: uppercase;
  transition: all 0.25s ease;
}
html[data-theme="terracotta"] .design-switcher-pill {
  background: #FFFFFF;
  border-color: #E8DFD3;
  color: #1D1612;
  box-shadow: 0 2px 8px rgba(70, 40, 20, 0.05);
}
html[data-theme="terracotta"] .design-switcher-pill:hover {
  border-color: #C2542D;
  background: rgba(194, 84, 45, 0.08);
  box-shadow: 0 4px 16px rgba(194, 84, 45, 0.22);
}
html[data-theme="terracotta"] .design-pill-icon {
  background: #F6EFE6;
}
html[data-theme="terracotta"] .design-pill-badge {
  background: #C2542D;
}

/* Luxury Theme Change Toast */
.theme-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999999;
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  color: var(--color-text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.5), 0 0 20px var(--color-primary-shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  animation: themeToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}
@keyframes themeToastIn {
  0% { transform: translateY(20px) scale(0.95); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Backward compatibility for .theme-toggle */
.theme-toggle {
  position: relative;
  width: 32px;
  height: 20px;
  min-height: 20px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: var(--transition-base);
}
.theme-toggle:hover {
  border-color: var(--color-primary);
}
.theme-toggle .theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
html[data-theme="terracotta"] .theme-toggle .theme-toggle-knob {
  transform: translateX(12px);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: inherit;
}

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  width: 100%;
}

button, input, select, textarea, .option-btn, .admin-nav-item, .teacher-nav-item, .auth-tab, .role-opt {
  min-height: 44px;
  touch-action: manipulation;
}

/* ===================== Header ===================== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  background-color: var(--color-header-bg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--color-primary);
  transition: var(--transition-base);
}

.brand:hover {
  opacity: 0.9;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #FFFFFF !important;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 4px 18px rgba(99, 102, 241, 0.45) !important;
}

.header-tag {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.pro-tools {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.pro-tools .btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.88rem;
}

.pro-tools .btn.ghost {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.pro-tools .btn.ghost:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-hover);
  color: var(--color-primary);
}

/* ===================== Hero Section ===================== */
.hero {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
}

.placement-btn {
  margin-top: var(--space-lg);
}

.hero-rule {
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-full);
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--color-burgundy);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin: 0 auto;
  color: var(--color-text-main);
}

.hero h1 .accent {
  color: var(--color-burgundy);
  font-style: italic;
}

.hero p.lede {
  margin: var(--space-md) auto 0;
  max-width: 48ch;
  font-size: 1.05rem;
  color: var(--color-text-muted);
}

/* ===================== Levels Grid ===================== */
.levels {
  padding: var(--space-lg) 0 var(--space-2xl);
}

.levels-heading {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.levels-heading h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--color-text-main);
}

.levels-heading .sub {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: var(--space-xs);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.level-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.level-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.level-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-code {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
}

.seal {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--color-on-primary);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.seal.tone-burgundy { background: var(--color-burgundy); }
.seal.tone-navy { background: var(--color-primary); }
.seal.tone-gold { background: var(--color-accent); }

.level-label {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text-main);
}

.level-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  flex-grow: 1;
  line-height: 1.5;
}

.card-progress-wrapper {
  margin-top: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.card-progress-bar-track {
  height: 6px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.card-progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.4s ease;
  border-radius: var(--radius-full);
}

.level-cta {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  border-top: 1px solid var(--color-surface-muted);
  padding-top: var(--space-md);
  margin-top: var(--space-xs);
  transition: var(--transition-base);
}

.level-cta::after {
  content: "→";
  transition: transform 0.2s ease;
}

.level-card:hover .level-cta::after {
  transform: translateX(4px);
}

/* ===================== Level Detail Hub ===================== */
.level-hub-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  margin-top: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.level-hub-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.level-hub-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--color-text-main);
}

.level-hub-desc {
  margin-top: var(--space-xs);
  color: var(--color-text-muted);
  max-width: 70ch;
  font-size: 0.95rem;
}

.hub-progress-box {
  min-width: 220px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0 var(--space-2xl);
}

.module-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: var(--transition-base);
}

.module-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.module-icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-xs);
}

.module-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.module-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  flex-grow: 1;
}

/* ===================== Quiz UI ===================== */
.quiz-header {
  background: var(--color-surface);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 73px;
  z-index: 99;
  box-shadow: var(--shadow-sm);
}

.quiz-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.quiz-seal {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-on-primary);
  background: var(--color-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.quiz-title-block {
  flex-grow: 1;
  min-width: 180px;
}

.quiz-title-block h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-primary);
  text-shadow: 0 0 14px var(--color-primary-shadow);
}

.quiz-title-block .sub {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.back-link {
  font-weight: 600;
  font-size: 0.9rem;
  background: none;
  cursor: pointer;
  color: var(--color-primary);
  border: none;
  padding: 0;
  transition: var(--transition-base);
}

.back-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.progress-track {
  height: 4px;
  background: var(--color-surface-muted);
  margin-top: var(--space-md);
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-body {
  padding: var(--space-2xl) 0;
  max-width: 750px;
  margin: 0 auto;
  width: 100%;
}

.q-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.q-count {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.q-timer {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.q-meta {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.q-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.q-media, .q-audio {
  margin: var(--space-md) 0;
  width: 100%;
}

.q-media img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Custom HTML5 Audio Player for Listening Module */
.custom-audio-player {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.audio-controls-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.audio-play-btn {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.audio-play-btn:hover {
  background: var(--color-primary-hover);
}

.audio-progress-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.audio-seekbar {
  flex-grow: 1;
  height: 6px;
  appearance: none;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.audio-seekbar::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  cursor: pointer;
  transition: var(--transition-base);
}

.audio-seekbar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.audio-time-display {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  min-width: 80px;
  text-align: right;
}

.audio-volume-container {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.audio-volume-slider {
  width: 70px;
  height: 6px;
  appearance: none;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.audio-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-text-muted);
  cursor: pointer;
}

.audio-unavailable-msg {
  padding: var(--space-md);
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

.q-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  line-height: 1.4;
  margin: var(--space-md) 0 var(--space-xl);
  color: var(--color-text-main);
}

.options {
  display: grid;
  gap: var(--space-sm);
  width: 100%;
}

.option-btn {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-top: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(14, 20, 34, 0.75);
  backdrop-filter: blur(12px);
  font-family: var(--font-sans);
  font-size: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-surface-muted);
}

.option-letter {
  font-weight: 700;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  flex-shrink: 0;
  color: #CBD5E1;
  background: rgba(21, 29, 48, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.option-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

.option-btn.selected .option-letter {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.option-btn.selected:disabled {
  opacity: 1;
}

.option-btn.correct-answer {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-weight: 600;
  opacity: 1;
}

.option-btn.correct-answer .option-letter {
  background: var(--color-success);
  color: var(--color-on-primary);
  border-color: var(--color-success);
}

.option-btn.wrong-answer {
  border-color: var(--color-error);
  background: var(--color-error-bg);
  color: var(--color-error);
  font-weight: 600;
  opacity: 1;
}

.option-btn.wrong-answer .option-letter {
  background: var(--color-error);
  color: #FFF;
  border-color: var(--color-error);
}

.q-explanation {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-accent-light);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
  color: var(--color-text-main);
}

.quiz-controls-row {
  margin-top: var(--space-2xl);
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

@keyframes pulseNext {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
  50% { transform: scale(1.02); box-shadow: 0 0 10px 2px rgba(16, 185, 129, 0.22); }
}

.pulse-next-btn {
  animation: pulseNext 2.4s ease-in-out 3 !important;
  border-color: #34d399 !important;
}

.btn {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
  color: var(--color-on-primary);
  border: 1px solid var(--color-primary);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
  border-color: var(--color-primary-hover);
  box-shadow: 0 0 0 3px var(--color-primary-light), var(--shadow-md);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.ghost {
  background: var(--color-surface);
  color: var(--color-text-main);
  border-color: var(--color-border);
}

.btn.ghost:hover {
  background: var(--color-surface-muted);
  color: var(--color-primary);
  border-color: var(--color-border-hover);
}

/* ===================== Results View & Motivation Card ===================== */
.results {
  width: 100%;
  max-width: 680px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 24px;
  padding: 36px 32px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(10, 14, 26, 0.98) 100%);
  margin: var(--space-xl) auto;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 0 35px rgba(99, 102, 241, 0.15);
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

html[data-theme="terracotta"] .results {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF5EE 100%);
  border: 1.5px solid rgba(194, 84, 45, 0.22);
  box-shadow: 0 20px 48px -10px rgba(70, 40, 20, 0.08), 0 0 25px rgba(194, 84, 45, 0.08);
}

.results-kicker {
  font-weight: 800;
  color: var(--color-primary);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

html[data-theme="terracotta"] .results-kicker {
  color: #C2542D;
}

.results-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.score-seal {
  width: 108px;
  height: 108px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2.2rem;
  color: #A5B4FC;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.20), rgba(6, 182, 212, 0.20));
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.35);
  border: 3px solid #6366F1;
  transition: transform 0.3s ease;
}

html[data-theme="terracotta"] .score-seal {
  color: #C2542D;
  background: linear-gradient(135deg, rgba(194, 84, 45, 0.14), rgba(212, 147, 57, 0.16));
  border-color: #C2542D;
  box-shadow: 0 0 25px rgba(194, 84, 45, 0.28);
}

.results-verdict h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--color-text-main);
}

.results-verdict p {
  color: var(--color-text-muted);
  font-size: 1.02rem;
  max-width: 48ch;
  margin: 0 auto;
}

/* Motivation Card */
.result-motivation-card {
  background: linear-gradient(145deg, rgba(26, 36, 60, 0.75), rgba(13, 19, 34, 0.92)) !important;
  border: 1.5px solid rgba(99, 102, 241, 0.32) !important;
  border-radius: 20px !important;
  padding: 24px 22px !important;
  margin: 24px 0 !important;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5), 0 0 24px rgba(99, 102, 241, 0.16) !important;
  text-align: left !important;
  position: relative !important;
  overflow: hidden !important;
  backdrop-filter: blur(16px) !important;
}

html[data-theme="terracotta"] .result-motivation-card {
  background: linear-gradient(145deg, #FFFFFF, #FAF5ED) !important;
  border: 1.5px solid rgba(194, 84, 45, 0.24) !important;
  box-shadow: 0 12px 28px -6px rgba(70, 40, 20, 0.08), 0 0 20px rgba(194, 84, 45, 0.08) !important;
}

.result-motivation-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #6366F1, #06B6D4, #10B981, #EC4899);
}

.result-motivation-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.motivation-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.motivation-kicker {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #818CF8;
}

html[data-theme="terracotta"] .motivation-kicker {
  color: #C2542D;
}

.motivation-subkicker {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.result-motivation-quote-wrap {
  position: relative;
  padding: 10px 14px 10px 30px;
  border-left: 3px solid #6366F1;
  margin: 12px 0 14px 0;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 0 12px 12px 0;
}

.motivation-quote-mark {
  position: absolute;
  top: -6px;
  left: 8px;
  font-size: 2.2rem;
  color: rgba(99, 102, 241, 0.4);
  font-family: Georgia, serif;
  line-height: 1;
}

.result-motivation-quote {
  font-size: 1.05rem;
  line-height: 1.65;
  font-style: italic;
  color: var(--color-text-main);
  margin: 0;
  font-weight: 500;
}

.result-motivation-author {
  font-size: 0.92rem;
  font-weight: 700;
  color: #38BDF8;
  margin-top: 6px;
  text-align: right;
  display: block;
}

html[data-theme="terracotta"] .result-motivation-author {
  color: #D49339;
}

.result-motivation-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

html[data-theme="terracotta"] .result-motivation-pills {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.motivation-tag-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.14);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.motivation-boost-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.14);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

html[data-theme="terracotta"] .motivation-boost-pill {
  background: rgba(194, 84, 45, 0.12);
  color: #C2542D;
  border-color: rgba(194, 84, 45, 0.3);
}

.results-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.results-actions .btn {
  padding: 10px 20px;
  font-size: 0.92rem;
  border-radius: 12px;
  font-weight: 600;
}

/* ===================== History & Analytics UI ===================== */
.history-container {
  max-width: 1200px;
  margin: var(--space-xl) auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

.history-header-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.history-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 800;
  color: var(--color-text-main);
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  width: 100%;
}

.stat-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  text-align: left;
}

.stat-summary-card .val {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-top: var(--space-xs);
}

.stat-summary-card .lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  width: 100%;
}

.profile-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.attempts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.attempt-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.attempt-id-badge {
  font-family: monospace;
  font-size: 0.78rem;
  background: var(--color-surface-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  display: inline-block;
}

/* ===================== Auth & Gate Styles ===================== */
#loginGate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

#loginGate.hidden {
  display: none !important;
}

.login-card {
  width: min(440px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
  margin: auto;
}

.login-card h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: var(--space-xs);
  color: var(--color-text-main);
}

.login-card .login-sub {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin-bottom: var(--space-lg);
}

.auth-tabs {
  display: flex;
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--color-border);
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-sm);
  cursor: pointer;
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  transition: var(--transition-base);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.auth-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.login-form {
  display: grid;
  gap: var(--space-md);
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-base);
}

.login-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.login-role {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.role-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: center;
  background: var(--color-surface);
  position: relative;
  transition: var(--transition-base);
}

.role-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.role-opt:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.login-user {
  font-size: 0.85rem;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  font-weight: 500;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #FFF;
}

.role-badge.student { background: var(--color-primary); color: var(--color-on-primary); }
.role-badge.teacher { background: #7C3AED; }
.role-badge.admin { background: var(--color-burgundy); color: var(--color-on-primary); }

.role-select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  background: var(--color-surface);
  color: var(--color-text-main);
}
.role-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-btn {
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* ===================== Profile Dashboard ===================== */
.profile-dashboard {
  max-width: 1000px;
  margin: var(--space-xl) auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

.profile-hero {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: var(--space-lg);
  align-items: center;
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.profile-avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 2rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.profile-stat-badge {
  text-align: center;
}

.profile-stat-badge .level-tag {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
}

.profile-stat-badge .level-lbl {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-surface-muted);
  font-size: 0.92rem;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.profile-info-row:last-child {
  border-bottom: none;
}

.profile-quicklinks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.profile-quicklink {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 16px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.profile-quicklink:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.profile-quicklink-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.profile-info-label {
  color: var(--color-text-muted);
}

.profile-info-val {
  font-weight: 600;
  color: var(--color-text-main);
}

.level-progress-item {
  margin-bottom: var(--space-md);
}

.level-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.level-progress-bar {
  height: 8px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.4s ease;
  border-radius: var(--radius-full);
}

/* ===================== Contact Section ===================== */
.contact-section {
  max-width: 800px;
  margin: var(--space-xl) auto var(--space-2xl);
  width: 100%;
}

.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-card);
}

.contact-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: var(--space-xs);
  text-align: center;
}

.contact-sub {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.contact-form {
  display: grid;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.95rem;
  outline: none;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.error-msg {
  color: var(--color-error);
  font-size: 0.8rem;
  display: none;
  font-weight: 600;
}

/* ===================== Form Select (Guruhga biriktirish uchun) ===================== */
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-surface-muted);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ===================== Searchable Student Combobox (Guruhga biriktirish) ===================== */
.student-combobox {
  position: relative;
}

.student-combobox-input {
  font-family: var(--font-sans);
}

.student-combobox-input::placeholder {
  color: var(--color-text-muted);
}

.student-combobox-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  -webkit-overflow-scrolling: touch;
}

.student-combobox-results.open {
  display: block;
}

.student-combobox-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: var(--transition-base);
}

.student-combobox-item:last-child {
  border-bottom: none;
}

.student-combobox-item:hover,
.student-combobox-item.active {
  background: var(--color-primary-light);
}

.student-combobox-item-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.student-combobox-item-email {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.student-combobox-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.student-combobox-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
}

.student-combobox-selected-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.student-combobox-selected-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-combobox-selected-email {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-combobox-change {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-base);
}

.student-combobox-change:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

@media (max-width: 640px) {
  .student-combobox-results {
    max-height: 220px;
  }

  .student-combobox-selected {
    flex-wrap: wrap;
  }

  .student-combobox-change {
    width: 100%;
    text-align: center;
  }
}

.error-msg.visible {
  display: block;
}

.status-banner {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  display: none;
  margin-bottom: var(--space-md);
}

.status-banner.info {
  display: block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid #BFDBFE;
}

.status-banner.success {
  display: block;
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #BBF7D0;
}

.contact-history {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-lg);
}

.contact-history h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: var(--space-md);
  color: var(--color-text-main);
}

.history-item {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.88rem;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* ===================== Home Contact Info ===================== */
.contact-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.contact-info-item {
  display: block;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  transition: var(--transition-base);
}

.contact-info-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

.contact-info-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.contact-info-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  font-family: monospace;
}

/* ===================== Dashboard Grid & Stats ===================== */
.dash-header {
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.dash-header-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
}

.dash-header-sub {
  font-size: 0.92rem;
  margin-top: var(--space-xs);
  opacity: 0.9;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}

.dash-kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  border-top: 4px solid var(--color-primary);
}

.dash-kpi-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-top: var(--space-xs);
}

.dash-kpi-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.skill-card {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
}

.skill-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===================== Certificates ===================== */
.cert-wrapper {
  max-width: 850px;
  width: 100%;
  margin: var(--space-lg) auto;
  background: var(--color-surface);
  border: 8px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  color: var(--color-text-main);
  text-align: center;
}

.cert-inner-border {
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-xl);
  background: #FFFCF7;
}

.cert-header {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-burgundy);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.cert-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: var(--space-md);
}

.cert-recipient {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--color-burgundy);
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
  padding: 0 var(--space-md) 6px;
  margin-bottom: var(--space-lg);
}

.cert-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.cert-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
  font-size: 0.88rem;
}

.cert-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.verify-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  max-width: 600px;
  margin: var(--space-xl) auto;
  box-shadow: var(--shadow-card);
}

/* ===================== Admin & Teacher Layouts ===================== */
.admin-layout, .teacher-layout {
  display: flex;
  min-height: calc(100vh - 73px);
  background: var(--color-bg);
  margin: 0 calc(var(--space-lg) * -1);
  width: calc(100% + (var(--space-lg) * 2));
}

.admin-sidebar, .teacher-sidebar {
  width: 260px;
  background: #0F172A;
  color: #94A3B8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.teacher-sidebar {
  background: #1E1B4B;
}

.admin-sidebar-brand, .teacher-sidebar-brand {
  padding: var(--space-xl) var(--space-lg);
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFF;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-nav, .teacher-nav {
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.admin-nav-item, .teacher-nav-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: var(--transition-base);
}

.admin-nav-item:hover, .teacher-nav-item:hover {
  background: #1E293B;
  color: #FFF;
}

.admin-nav-item.active {
  background: var(--color-primary);
  color: #FFF;
}

.teacher-nav-item.active {
  background: #4C1D95;
  color: var(--color-on-primary);
}

.btn-att-status {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border, #E2E8F0);
  background: var(--color-surface, #F8FAFC);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-text-muted, #64748B);
}

.btn-att-status:hover {
  filter: brightness(0.96);
}

.btn-att-present.active {
  background: #ECFDF5 !important;
  color: #065F46 !important;
  border-color: #10B981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.btn-att-absent.active {
  background: #FEF2F2 !important;
  color: #991B1B !important;
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.admin-content, .teacher-content {
  flex-grow: 1;
  padding: var(--space-2xl);
  overflow-x: hidden;
  width: 100%;
}

.admin-page-header, .teacher-page-header {
  margin-bottom: var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.admin-page-title, .teacher-page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-text-main);
}

.admin-kpi-grid, .teacher-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.admin-kpi-card, .teacher-kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.admin-kpi-title, .teacher-kpi-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.admin-kpi-val, .teacher-kpi-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-top: 4px;
}

.admin-table-container, .teacher-table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  width: 100%;
}

.admin-table, .teacher-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  min-width: 600px;
}

.admin-table th, .teacher-table th {
  background: var(--color-surface-muted);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table td, .teacher-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.admin-tab-content, .teacher-tab-content {
  display: none;
}

.admin-tab-content.active, .teacher-tab-content.active {
  display: block;
}

.read-only-banner {
  background: var(--color-accent-light);
  border: 1px solid #FDE68A;
  color: #92400E;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ===================== Responsive Media Queries ===================== */
@media (max-width: 1100px) {
  .level-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .admin-layout, .teacher-layout {
    flex-direction: column;
    margin: 0 calc(var(--space-md) * -1);
    width: calc(100% + (var(--space-md) * 2));
  }
  .admin-sidebar, .teacher-sidebar {
    width: 100%;
  }
  .admin-nav, .teacher-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: var(--space-sm);
    white-space: nowrap;
  }
  .admin-nav-item, .teacher-nav-item {
    padding: 8px 12px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }
  .admin-content, .teacher-content {
    padding: var(--space-lg);
  }
}

@media (max-width: 820px) {
  .wrap {
    padding: 0 var(--space-md);
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-hero {
    grid-template-columns: 70px 1fr;
    padding: var(--space-lg);
  }
  .profile-stat-badge {
    grid-column: span 2;
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-md);
  }
  .cert-details-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .cert-wrapper {
    padding: var(--space-lg) var(--space-sm);
    border-width: 4px;
  }
  .cert-inner-border {
    padding: var(--space-md);
  }
}

@media (max-width: 768px) {
  .level-grid {
    grid-template-columns: 1fr;
  }
  .stats-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pro-tools {
    justify-content: center;
    width: 100%;
  }
  .site-header .wrap {
    justify-content: center;
    text-align: center;
  }
  .brand {
    justify-content: center;
  }
  .quiz-controls-row {
    flex-direction: column-reverse;
  }
  .quiz-controls-row .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: var(--space-xl) 0 var(--space-lg);
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .btn {
    width: 100%;
    padding: 12px;
  }
  .stats-summary-grid {
    grid-template-columns: 1fr;
  }
  .results-actions {
    flex-direction: column;
    width: 100%;
  }
  .results-actions .btn {
    width: 100%;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }
  #printableCertArea, #printableCertArea *,
  #printableReceiptArea, #printableReceiptArea * {
    visibility: visible !important;
  }
  #printableCertArea, #printableReceiptArea {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 24px !important;
    box-shadow: none !important;
    border: 2px solid #222 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .cert-actions, .eduflow-modal-close, header, .nav-wrap, #loginGate, button, .btn {
    display: none !important;
  }
}

/* ==========================================================================
   BOOK UI (KITOBLAR JAVONI) 3D STYLES & SUBJECT THEMES
   ========================================================================== */
.bookshelf-hero {
  text-align: center;
  padding: 40px 20px 24px;
  max-width: 960px;
  margin: 0 auto;
}
.bookshelf-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full, 9999px);
  color: var(--color-primary);
  box-shadow: 0 2px 10px var(--color-primary-shadow);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}
.bookshelf-title {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.22;
  margin-bottom: 16px;
}
.bookshelf-desc {
  font-size: 1.12rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: 28px;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}
.bookshelf-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
}
.bookshelf-stat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(14, 20, 34, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding: 10px 22px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.bookshelf-stat-pill:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  border-top-color: rgba(165, 180, 252, 0.8);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.books-showcase {
  margin: 10px 0 60px;
}
.books-shelf-header {
  text-align: center;
  margin-bottom: 40px;
}
.books-shelf-header h2 {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 2.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.books-shelf-header p {
  color: var(--color-text-muted, #7A8A80);
  font-size: 1.05rem;
}
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 36px;
  perspective: 1200px;
  padding: 16px 8px;
  max-width: 1240px;
  margin: 0 auto;
}
.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  perspective: 1000px;
  padding: 16px 12px 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 23, 40, 0.78) 0%, rgba(10, 15, 26, 0.94) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-top: 1.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 36px -6px rgba(0, 0, 0, 0.65);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}
.book-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  border-top-color: rgba(165, 180, 252, 0.8);
  transform: translateY(-6px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 22px 50px -10px rgba(0, 0, 0, 0.8),
    0 0 35px rgba(99, 102, 241, 0.28);
}
.book-3d-wrap {
  position: relative;
  width: 215px;
  height: 310px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.5s ease;
  border-radius: 4px 14px 14px 4px;
  margin: 10px 0 16px;
}
.book-card:hover .book-3d-wrap {
  transform: rotateY(-24deg) rotateX(6deg) translateY(-10px) scale(1.04);
}
.book-cover {
  position: absolute;
  inset: 0;
  border-radius: 4px 14px 14px 4px;
  box-shadow: 4px 12px 30px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px;
  color: #ffffff;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 100%;
  border-radius: 4px 0 0 4px;
  transform: rotateY(-90deg) translateZ(12px);
  background: inherit;
  filter: brightness(0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.book-spine-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.68rem;
  letter-spacing: 2.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}
.book-pages {
  position: absolute;
  right: 0;
  top: 3px;
  width: 18px;
  height: calc(100% - 6px);
  background: repeating-linear-gradient(to right, #fdfbf7 0px, #fdfbf7 2px, #e8dfcb 3px);
  transform: rotateY(90deg) translateZ(9px);
  border-radius: 0 4px 4px 0;
  box-shadow: inset -2px 0 4px rgba(0,0,0,0.25);
}
.book-ribbon {
  position: absolute;
  top: -4px;
  right: 26px;
  width: 16px;
  height: 42px;
  background: #f59e0b;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.35);
  z-index: 5;
}
.book-top-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.book-center-content {
  text-align: center;
  padding: 10px 0;
}
.book-icon-seal {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.book-title-text {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 6px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.book-sub-text {
  font-size: 0.8rem;
  opacity: 0.92;
  font-weight: 500;
  line-height: 1.35;
}
.book-bottom-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 10px;
  opacity: 0.95;
  font-weight: 600;
}
.book-meta-details {
  text-align: center;
  width: 100%;
}
.book-name-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 6px;
}
.book-desc-label {
  font-size: 0.88rem;
  color: var(--color-text-muted, #7A8A80);
  margin-bottom: 14px;
  line-height: 1.45;
  min-height: 38px;
}
.btn-open-book {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 18px;
  border-radius: var(--radius-md, 12px);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.btn-open-book:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* Fanlar bo'yicha maxsus muqovalar va soyalar */
.book-card-math .book-cover {
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
}
.book-card-math:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(37, 99, 235, 0.55);
}
.book-card-math .btn-open-book {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
}

.book-card-english .book-cover {
  background: linear-gradient(145deg, #450a0a 0%, #881337 50%, #dc2626 100%);
}
.book-card-english:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(220, 38, 38, 0.55);
}
.book-card-english .btn-open-book {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #ffffff;
}

.book-card-uzbek .book-cover {
  background: linear-gradient(145deg, #022c22 0%, #064e3b 50%, #059669 100%);
}
.book-card-uzbek:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(5, 150, 105, 0.55);
}
.book-card-uzbek .btn-open-book {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
}

.book-card-german .book-cover {
  background: linear-gradient(145deg, #18181b 0%, #78350f 50%, #d97706 100%);
}
.book-card-german:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(217, 119, 6, 0.55);
}
.book-card-german .btn-open-book {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
}

.book-card-physics .book-cover {
  background: linear-gradient(145deg, #1e1b4b 0%, #4c1d95 50%, #7c3aed 100%);
}
.book-card-physics:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(124, 58, 237, 0.55);
}
.book-card-physics .btn-open-book {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #ffffff;
}


.book-card-history .book-cover {
  background: linear-gradient(145deg, #2d1810 0%, #78350f 50%, #d97706 100%);
}
.book-card-history:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(217, 119, 6, 0.55);
}
.book-card-history .btn-open-book {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
}

.book-card-chemistry .book-cover {
  background: linear-gradient(145deg, #042f2e 0%, #0e7490 50%, #06b6d4 100%);
}
.book-card-chemistry:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(6, 182, 212, 0.55);
}
.book-card-chemistry .btn-open-book {
  background: linear-gradient(135deg, #0e7490, #06b6d4);
  color: #ffffff;
}
.book-card-russian .book-cover {
  background: linear-gradient(145deg, #4c0519 0%, #9f1239 50%, #e11d48 100%);
}
.book-card-russian:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(225, 29, 72, 0.55);
}
.book-card-russian .btn-open-book {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #ffffff;
}

/* 9. Geografiya Card */
.book-card-geography .book-cover {
  background: linear-gradient(145deg, #042f2e 0%, #115e59 50%, #0d9488 100%);
}
.book-card-geography:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(13, 148, 136, 0.55);
}
.book-card-geography .btn-open-book {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #ffffff;
}

/* 10. Biologiya Card */
.book-card-biology .book-cover {
  background: linear-gradient(145deg, #052e16 0%, #166534 50%, #16a34a 100%);
}
.book-card-biology:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(22, 163, 74, 0.55);
}
.book-card-biology .btn-open-book {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #ffffff;
}

/* 11. Turk Tili Card */
.book-card-turkish .book-cover {
  background: linear-gradient(145deg, #450a0a 0%, #991b1b 50%, #dc2626 100%);
}
.book-card-turkish:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(220, 38, 38, 0.55);
}
.book-card-turkish .btn-open-book {
  background: linear-gradient(135deg, #991b1b, #ef4444);
  color: #ffffff;
}

/* 12. Dasturlash Card */
.book-card-programming .book-cover {
  background: linear-gradient(145deg, #1e1b4b 0%, #3730a3 50%, #6366f1 100%);
}
.book-card-programming:hover .book-3d-wrap {
  box-shadow: 0 16px 40px -6px rgba(99, 102, 241, 0.55);
}
.book-card-programming .btn-open-book {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: #ffffff;
}

.btn-subject-book-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-md, 12px);
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid var(--color-border);
  background: var(--color-surface, rgba(255,255,255,0.05));
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-subject-book-link:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}
.btn-subject-book-link:active {
  transform: translateY(1px) scale(0.98);
}

/* ==========================================================================
   MOTION.DEV / FRAMER MOTION SPRING ANIMATSIYALARI VA INTERAKTIV EFFEKTLAR
   - Spring physics curves: cubic-bezier(0.16, 1, 0.3, 1) & cubic-bezier(0.34, 1.56, 0.64, 1)
   - Dynamic 3D book sheen & hover elevation
   - Staggered entrance for 12 subject book cards
   - Micro-interaction press feedback
   ========================================================================== */

/* 3D Book Cover Specular Sheen (Shimmer Sweeping Effect) */
.book-cover {
  position: absolute;
  inset: 0;
  border-radius: 4px 14px 14px 4px;
  box-shadow: 4px 12px 30px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px;
  color: #ffffff;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.book-cover::after {
  content: '';
  position: absolute;
  top: 0;
  left: -130%;
  width: 90%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.24) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 10;
}

.book-card:hover .book-cover::after {
  left: 140%;
}

/* 3D Book Wrap Smooth Spring Physics */
.book-3d-wrap {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.book-card:hover .book-3d-wrap {
  transform: rotateY(-22deg) rotateX(5deg) translateY(-12px) scale(1.035) !important;
}

/* 12 ta Kitob Kartasi uchun Silliq Bosqichma-bosqich (Staggered) Kirish Animatsiyasi */
.books-grid > .book-card {
  animation: motionCardEntrance 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes motionCardEntrance {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.books-grid > .book-card:nth-child(1) { animation-delay: 0.03s; }
.books-grid > .book-card:nth-child(2) { animation-delay: 0.06s; }
.books-grid > .book-card:nth-child(3) { animation-delay: 0.09s; }
.books-grid > .book-card:nth-child(4) { animation-delay: 0.12s; }
.books-grid > .book-card:nth-child(5) { animation-delay: 0.15s; }
.books-grid > .book-card:nth-child(6) { animation-delay: 0.18s; }
.books-grid > .book-card:nth-child(7) { animation-delay: 0.21s; }
.books-grid > .book-card:nth-child(8) { animation-delay: 0.24s; }
.books-grid > .book-card:nth-child(9) { animation-delay: 0.27s; }
.books-grid > .book-card:nth-child(10) { animation-delay: 0.30s; }
.books-grid > .book-card:nth-child(11) { animation-delay: 0.33s; }
.books-grid > .book-card:nth-child(12) { animation-delay: 0.36s; }

/* Motion Micro-interactions: Tugmalar bosilganda silliq qaytish (Spring Tap Feedback) */
.btn-open-book, 
.btn-subject-book-link,
.btn-hero-primary,
.subject-tab-btn {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease !important;
}

.btn-open-book:active, 
.btn-subject-book-link:active,
.btn-hero-primary:active,
.subject-tab-btn:active {
  transform: scale(0.95) translateY(1px) !important;
}

/* Framer Stats Ribbon Interactive Hover Float */
.framer-stat-item {
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}
.framer-stat-item:hover {
  transform: translateY(-3px) scale(1.02);
}

/* Bento Cards Hover Elevation */
.framer-bento-card {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease !important;
}
.framer-bento-card:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.5), 0 0 25px rgba(99, 102, 241, 0.18) !important;
}

/* Fan Sahifasi (Subject Hub) Tablari Silliq O'tishi */
.subject-tab-content.active {
  display: block;
  animation: motionTabFadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes motionTabFadeSlide {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Prefers-Reduced-Motion himoyasi */
@media (prefers-reduced-motion: reduce) {
  .books-grid > .book-card,
  .subject-tab-content.active,
  .book-cover::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Terracotta Mode Moslashuvi */
html[data-theme="terracotta"] .book-card {
  background: #FFFFFF;
  border-color: #E8DFD3;
  box-shadow: 0 6px 20px rgba(70, 40, 20, 0.06);
}
html[data-theme="terracotta"] .book-card:hover {
  border-color: #C2542D;
  box-shadow: 0 16px 36px -6px rgba(194, 84, 45, 0.18);
}
html[data-theme="terracotta"] .book-name-label {
  color: #1D1612;
}
html[data-theme="terracotta"] .book-desc-label {
  color: #736356;
}
html[data-theme="terracotta"] .bookshelf-stat-pill {
  background: #FFFFFF;
  border-color: #E8DFD3;
  color: #1D1612;
  box-shadow: 0 2px 8px rgba(70, 40, 20, 0.05);
}
html[data-theme="terracotta"] .bookshelf-stat-pill:hover {
  border-color: #C2542D;
  box-shadow: 0 6px 16px -2px rgba(194, 84, 45, 0.22);
}

/* ==========================================================================
   SUBJECT HUB, 5 MODULES & FORMULAS / LUG'AT STYLES
   ========================================================================== */
.subject-hub-banner {
  border-radius: 20px;
  padding: 32px 28px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.subject-hub-banner-content {
  max-width: 720px;
  z-index: 2;
}
.subject-hub-badge-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.subject-hub-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.subject-hub-badge-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}
.subject-hub-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 8px;
}
.subject-hub-desc {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.5;
}
.subject-hub-icon-wrap {
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Tabs inside Subject */
.subject-tabs-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.subject-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subject-tab-btn:hover {
  color: var(--color-text-main);
  background: var(--color-surface);
}
.subject-tab-btn.active {
  color: var(--color-primary);
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.subject-tab-content {
  display: none;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.subject-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* 5 Modules Grid */
.subject-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}
.module-card-item {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}
.module-card-item:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}
.module-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 12px;
  align-self: flex-start;
}
.module-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--color-text-main);
}
.module-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  flex-grow: 1;
}
.module-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}
.btn-start-module {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: var(--color-primary);
  color: var(--color-on-primary);
  transition: all 0.2s ease;
}
.btn-start-module:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Formulas & Resource Showcase */
.resource-search-bar {
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.resource-search-input {
  flex: 1;
  min-width: 260px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-main);
  font-size: 0.95rem;
}
.resource-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}
.formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.formula-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}
.formula-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.formula-cat-pill {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.formula-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--color-text-main);
}
.formula-math-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-surface-muted);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  overflow-x: auto;
}
.formula-explanation {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.formula-example {
  font-size: 0.85rem;
  color: var(--color-text-light);
  background: var(--color-surface-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-top: auto;
}

/* Vocabulary / So'zlar kartochkalari */
.vocab-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.vocab-card-item {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.vocab-card-item:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}
.vocab-word-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.vocab-main-word {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-main);
}
.vocab-pos-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}
.vocab-uz-meaning {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.vocab-example-box {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
  border-left: 2px solid var(--color-border);
  padding-left: 8px;
  margin-top: 6px;
}
.btn-speak-vocab {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-speak-vocab:hover {
  background: var(--color-surface-muted);
}


/* ==========================================================================
   AI USTOZ (AI MENTOR & TUTOR) STYLES
   ========================================================================== */
.ai-ustoz-wrapper {
  background: var(--color-surface, #ffffff);
  border: 1.5px solid #8B5CF6;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.12);
  margin: var(--space-lg) 0;
  position: relative;
  overflow: hidden;
}

.ai-ustoz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.ai-ustoz-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-ustoz-avatar {
  font-size: 2.2rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #C4B5FD;
}

.ai-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.1);
  color: #7C3AED;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.ai-status-pill.active-openai {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

.ai-growth-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid #C4B5FD;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.ai-growth-badge {
  font-size: 1.6rem;
  font-weight: 900;
  color: #7C3AED;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-growth-desc {
  font-size: 0.92rem;
  color: var(--color-text-main);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

.ai-ustoz-nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 2px;
  overflow-x: auto;
}

.ai-tab-btn {
  padding: 9px 18px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-tab-btn.active {
  color: #7C3AED;
  border-bottom-color: #7C3AED;
  background: rgba(139, 92, 246, 0.06);
}

.ai-tab-pane {
  display: none;
}
.ai-tab-pane.active {
  display: block;
}

/* Mistake Card */
.ai-mistake-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid #EF4444;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.ai-mistake-q {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--color-text-main);
}

.ai-answers-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.ai-ans-box {
  padding: 8px 12px;
  border-radius: 8px;
}
.ai-ans-box.wrong {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #DC2626;
}
.ai-ans-box.correct {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}

.ai-why-box {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 10px;
  line-height: 1.5;
}

.ai-helper-pill {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.15));
  border: 1px solid #F59E0B;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
}

/* Tomorrow Plan Card */
.ai-tomorrow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.ai-plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.ai-plan-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 10px;
  color: #7C3AED;
}

/* AI Chat Feed - Dual Theme High Contrast Luxury */
.ai-chat-feed {
  max-height: 380px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(10, 15, 29, 0.92);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ai-chat-bubble {
  max-width: 84%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.94rem;
  line-height: 1.6;
  word-break: break-word;
  position: relative;
  transition: transform 0.15s ease;
}

.ai-chat-bubble.ai {
  align-self: flex-start;
  background: linear-gradient(145deg, #131B2E 0%, #0F172A 100%);
  color: #F1F5F9 !important;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-top: 1.5px solid rgba(165, 180, 252, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 16px rgba(99, 102, 241, 0.08);
  border-radius: 16px 16px 16px 4px;
}

.ai-chat-bubble.ai * {
  color: inherit;
}

.ai-chat-bubble.ai strong {
  color: #FFFFFF !important;
  font-weight: 700;
}

.ai-chat-bubble.ai code {
  background: rgba(99, 102, 241, 0.22);
  color: #A5B4FC;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.88em;
}

.ai-chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4338CA 0%, #6366F1 50%, #4F46E5 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.4);
  border-radius: 16px 16px 4px 16px;
}

.ai-chat-bubble.user .chat-author {
  color: rgba(255, 255, 255, 0.88) !important;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 6px;
  display: block;
}

.ai-chat-bubble.ai .chat-author {
  color: #A5B4FC !important;
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ai-prompt-chip {
  padding: 7px 14px;
  background: rgba(19, 27, 46, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #C7D2FE;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.ai-prompt-chip:hover {
  background: #4F46E5;
  color: #ffffff;
  border-color: #6366F1;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
  transform: translateY(-1px);
}

.ai-chat-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  font-size: 0.94rem;
  outline: none;
  background: #0B1120;
  color: #F8FAFC;
  transition: all 0.2s ease;
}
.ai-chat-input:focus {
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: #0F172A;
}

.btn-ai-send {
  padding: 11px 22px;
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
  transition: all 0.2s ease;
}
.btn-ai-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.55);
}

/* Design 2 (Terracotta & Ivory) Overrides for AI Ustoz Chat */
html[data-theme="terracotta"] .ai-chat-feed {
  background: #F8F3ED !important;
  border: 1px solid #E6DCD1 !important;
  box-shadow: inset 0 2px 8px rgba(70, 40, 20, 0.05) !important;
}

html[data-theme="terracotta"] .ai-chat-bubble.ai {
  background: #FFFFFF !important;
  color: #1D1612 !important;
  border: 1px solid #E8DFD3 !important;
  border-top: 1.5px solid #C2542D !important;
  box-shadow: 0 3px 12px rgba(70, 40, 20, 0.06) !important;
}

html[data-theme="terracotta"] .ai-chat-bubble.ai * {
  color: #1D1612 !important;
}

html[data-theme="terracotta"] .ai-chat-bubble.ai strong {
  color: #1D1612 !important;
  font-weight: 700;
}

html[data-theme="terracotta"] .ai-chat-bubble.ai code {
  background: rgba(194, 84, 45, 0.1) !important;
  color: #8C3717 !important;
}

html[data-theme="terracotta"] .ai-chat-bubble.ai .chat-author {
  color: #C2542D !important;
}

html[data-theme="terracotta"] .ai-chat-bubble.user {
  background: linear-gradient(135deg, #C2542D 0%, #D86B43 100%) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 14px rgba(194, 84, 45, 0.28) !important;
}

html[data-theme="terracotta"] .ai-prompt-chip {
  background: #FFFFFF !important;
  border: 1px solid #E8DFD3 !important;
  color: #8C3717 !important;
}

html[data-theme="terracotta"] .ai-prompt-chip:hover {
  background: #C2542D !important;
  color: #FFFFFF !important;
  border-color: #C2542D !important;
  box-shadow: 0 4px 12px rgba(194, 84, 45, 0.3) !important;
}

html[data-theme="terracotta"] .ai-chat-input {
  background: #FFFFFF !important;
  border: 1.5px solid #E8DFD3 !important;
  color: #1D1612 !important;
}

html[data-theme="terracotta"] .ai-chat-input:focus {
  border-color: #C2542D !important;
  box-shadow: 0 0 0 3px rgba(194, 84, 45, 0.18) !important;
  background: #FFFFFF !important;
}

html[data-theme="terracotta"] .btn-ai-send {
  background: linear-gradient(135deg, #C2542D, #D86B43) !important;
  box-shadow: 0 4px 14px rgba(194, 84, 45, 0.3) !important;
}

/* Floating AI Ustoz Widget */
.floating-ai-tutor-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 30px;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.4);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.floating-ai-tutor-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.55);
}


/* ==========================================================================
   LUCIDE ICONS (lucide.dev) - DUAL THEME VECTOR ICONOGRAPHY
   ========================================================================== */
.lucide, i[data-lucide], span[data-lucide] {
  width: 1.25em;
  height: 1.25em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.2em;
  stroke-width: 2;
  stroke: currentColor;
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.2s ease, color 0.2s ease;
}
.book-icon-seal .lucide, .book-icon-seal i[data-lucide] {
  width: 42px;
  height: 42px;
  stroke-width: 2.2;
}
.btn .lucide, .btn i[data-lucide] {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.15em;
}
.design-pill-icon .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

#vocabularyModal { background: rgba(7, 10, 18, 0.85) !important; backdrop-filter: blur(10px); }
#vocabularyModal .vocab-box { background: var(--color-surface) !important; border: 1px solid var(--color-border) !important; box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important; }
#vocabularyModal .vocab-close { background: var(--color-surface-muted) !important; color: var(--color-text-main) !important; border: 1px solid var(--color-border) !important; }
#vocabularyModal .vocab-close:hover { background: var(--color-primary) !important; color: #FFFFFF !important; border-color: var(--color-primary) !important; }
html[data-theme="terracotta"] #vocabularyModal { background: rgba(29, 22, 18, 0.6) !important; }
html[data-theme="terracotta"] #vocabularyModal .vocab-box { background: #FFFFFF !important; border: 1px solid #E8DFD3 !important; box-shadow: 0 20px 50px rgba(70,40,20,0.15) !important; color: #1D1612 !important; }
html[data-theme="terracotta"] #vocabularyModal .vocab-close { background: #F6EFE6 !important; color: #1D1612 !important; border-color: #E8DFD3 !important; }
html[data-theme="terracotta"] #vocabularyModal .vocab-close:hover { background: #C2542D !important; color: #FFFFFF !important; border-color: #C2542D !important; }
/* ==========================================================================
   EDUFLOW ULTIMATE RESPONSIVE & MOBILE ENGINE
   Moslashtirilgan: Smartfonlar (320px - 480px), Planshetlar (481px - 768px),
   Noutbuklar (769px - 1024px) va Katta Ekranlar (>1024px)
   ========================================================================== */

/* Global Mobile Fixes & Touch Ergonomics */
* {
  -webkit-tap-highlight-color: transparent;
}

button, .btn, .option-btn, .book-card, .subject-tab-btn, .ai-tab-btn, [role="button"] {
  touch-action: manipulation;
}

/* iOS Safari Input Auto-Zoom Prevention (16px base font size on touch inputs) */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   1. TABLET & COMPACT DESKTOP (max-width: 1024px)
   ========================================================================== */
@media screen and (max-width: 1024px) {
  .teacher-sidebar, .admin-sidebar {
    width: 220px;
  }
  .teacher-content, .admin-content {
    padding: var(--space-xl) var(--space-lg);
  }
  .books-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
  }
  .book-3d-wrap {
    width: 180px;
    height: 260px;
  }
}

/* ==========================================================================
   2. TABLET & PHABLET PORTRAIT (max-width: 899px)
   ========================================================================== */
@media screen and (max-width: 899px) {
  /* Admin & Teacher Portals Collapse to Top Tab Bar */
  .teacher-layout, .admin-layout {
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
  }
  
  .teacher-sidebar, .admin-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--color-border, #1E293B) !important;
    flex-direction: column !important;
  }
  
  .teacher-sidebar-brand, .admin-sidebar-brand {
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  
  .teacher-nav, .admin-nav {
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  .teacher-nav::-webkit-scrollbar, .admin-nav::-webkit-scrollbar {
    display: none !important;
  }
  
  .teacher-nav-item, .admin-nav-item {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 8px 14px !important;
    font-size: 0.84rem !important;
    border-radius: 8px !important;
  }
  
  .teacher-content, .admin-content {
    padding: 18px 14px !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .teacher-page-header, .admin-page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 18px !important;
  }
  
  /* Tables Swiping */
  .teacher-table-container, .admin-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 16px !important;
    border: 1px solid var(--color-border, #1E293B) !important;
  }
  .teacher-table, .admin-table {
    min-width: 600px !important;
  }

  /* Bookshelf 2 or 3 columns on tablet */
  .books-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  .book-3d-wrap {
    width: 175px;
    height: 250px;
    margin: 8px auto 14px;
  }
}

/* ==========================================================================
   3. SMARTPHONE OPTIMIZATION (max-width: 640px)
   ========================================================================== */
@media screen and (max-width: 640px) {
  /* Global Root & Containers */
  body {
    font-size: 14.5px;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }
  .wrap {
    padding: 0 12px !important;
    max-width: 100% !important;
  }
  
  /* --- Site Header & Brand --- */
  .site-header {
    padding: 8px 0 !important;
  }
  .site-header .wrap {
    gap: 8px !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .brand-logo-img {
    width: 38px !important;
    height: 38px !important;
    border-radius: 9px !important;
    background: #ffffff !important;
    padding: 2px !important;
    object-fit: contain !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5) !important;
  }
  .brand-name {
    font-size: 1.15rem !important;
    line-height: 1.1 !important;
  }
  .header-tag {
    display: none !important; /* Screen space saver on small phones */
  }
  .header-right-actions {
    gap: 6px !important;
  }
  .header-controls {
    gap: 6px !important;
  }
  .sound-toggle-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }
  /* Hide theme toggle text on phones, show icon + badge */
  .design-switcher-pill {
    padding: 6px 10px !important;
    gap: 6px !important;
    height: 36px !important;
  }
  .design-switcher-pill .design-pill-text {
    display: none !important;
  }
  .design-switcher-pill .design-pill-badge {
    font-size: 0.65rem !important;
    padding: 2px 5px !important;
  }

  /* Logged In Pro Tools on Mobile */
  .pro-tools {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .login-user {
    font-size: 0.78rem !important;
    padding: 4px 8px !important;
  }
  .pro-tools .btn {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
    min-height: 34px !important;
  }
  
  /* --- Hero Section & Bookshelf --- */
  .hero {
    padding: 20px 0 14px !important;
    text-align: center;
  }
  .hero h1 {
    font-size: 1.55rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
  }
  .hero-sub {
    font-size: 0.88rem !important;
    margin-bottom: 14px !important;
    line-height: 1.45 !important;
  }
  .hero-actions-row {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .hero-actions-row .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 44px !important;
    font-size: 0.92rem !important;
  }

  /* Bookshelf Grid & Responsive 3D Cards */
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px 10px !important;
    padding: 4px 0 20px !important;
  }
  .book-card {
    padding: 10px 6px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    border-radius: 14px !important;
  }
  .book-3d-wrap {
    width: 100% !important;
    max-width: 146px !important;
    height: 212px !important;
    margin: 4px auto 10px !important;
    transform: none !important; /* Flatten slightly on mobile for clarity */
  }
  .book-card:active .book-3d-wrap {
    transform: scale(0.97) !important;
  }
  .book-cover {
    padding: 12px 10px !important;
    border-radius: 3px 10px 10px 3px !important;
  }
  .book-spine {
    width: 18px !important;
    transform: rotateY(-90deg) translateZ(9px) !important;
  }
  .book-spine-text {
    font-size: 0.52rem !important;
    letter-spacing: 1.5px !important;
  }
  .book-cover-top {
    font-size: 0.65rem !important;
    margin-bottom: 4px !important;
  }
  .book-cover-title {
    font-size: 0.92rem !important;
    line-height: 1.15 !important;
  }
  .book-cover-meta {
    font-size: 0.68rem !important;
  }
  .book-pages {
    width: 16px !important;
    right: -12px !important;
  }
  .book-ribbon {
    width: 10px !important;
    height: 26px !important;
    right: 12px !important;
  }
  .book-card-footer {
    font-size: 0.72rem !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
  
  /* --- Subject Hub View (Fan Sahifasi & 5 Modul) --- */
  #viewSubjectHub {
    padding: 8px 0 24px !important;
  }
  #viewSubjectHub > div:first-child {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  #viewSubjectHub .back-link {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }
  #btnStartFullSubjectQuiz {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px 16px !important;
    font-size: 0.9rem !important;
  }
  .subject-hub-banner {
    padding: 16px 14px !important;
    border-radius: 16px !important;
    margin-bottom: 16px !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  .subject-hub-title {
    font-size: 1.35rem !important;
  }
  .subject-hub-desc {
    font-size: 0.86rem !important;
    line-height: 1.4 !important;
  }
  .subject-hub-icon-wrap {
    display: none !important; /* Clean layout on phones */
  }

  /* Horizontally Swipeable Subject Tabs */
  .subject-tabs-nav {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 6px !important;
    width: 100% !important;
  }
  .subject-tabs-nav::-webkit-scrollbar {
    display: none !important;
  }
  .subject-tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 10px 14px !important;
    font-size: 0.86rem !important;
    border-radius: 10px !important;
  }

  .subject-modules-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .module-card-item {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }
  .module-card-title {
    font-size: 1.05rem !important;
  }
  .module-card-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-top: 14px !important;
  }
  .btn-start-module {
    width: 100% !important;
    justify-content: center !important;
    min-height: 46px !important;
    font-size: 0.95rem !important;
  }
  
  /* --- Quiz View (Test Yechish Oynasi) --- */
  .quiz-header {
    padding: 12px 0 10px !important;
  }
  .quiz-header .wrap {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .quiz-title-block h1 {
    font-size: 1.2rem !important;
  }
  .quiz-title-block .sub {
    font-size: 0.82rem !important;
  }
  .quiz-body {
    padding: 12px 0 28px !important;
  }
  .quiz-q-card {
    padding: 16px 12px !important;
    border-radius: 14px !important;
  }
  .q-count-row {
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }
  .q-timer {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
  }
  #qText {
    font-size: 1.1rem !important;
    line-height: 1.48 !important;
    margin: 10px 0 16px !important;
  }
  .btn-speak-question {
    width: 100% !important;
    justify-content: center !important;
    margin-top: 8px !important;
    padding: 8px 12px !important;
  }
  .options-container, #qOptions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  .option-btn {
    min-height: 52px !important;
    padding: 12px 14px !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }
  .option-letter {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 0.88rem !important;
    flex-shrink: 0 !important;
  }
  .key-hint {
    display: none !important; /* Touch qurilmalarda klaviatura tugmasi shart emas */
  }
  .quiz-controls-row {
    flex-direction: column-reverse !important;
    gap: 10px !important;
    margin-top: 18px !important;
  }
  .quiz-controls-row .btn, .quiz-controls-row button {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 0.95rem !important;
    justify-content: center !important;
  }
  #qExplanationBox {
    padding: 14px !important;
    font-size: 0.88rem !important;
    border-radius: 12px !important;
  }
  
  /* --- Results View & AI Ustoz Tahlili --- */
  .results {
    padding: 18px 14px !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .score-seal {
    width: 76px !important;
    height: 76px !important;
    min-width: 76px !important;
    font-size: 1.8rem !important;
  }
  .results-score {
    flex-direction: column !important;
    text-align: center !important;
    gap: 12px !important;
    align-items: center !important;
  }
  .results-actions {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .results-actions .btn {
    width: 100% !important;
    min-height: 46px !important;
    justify-content: center !important;
  }
  .ai-tabs-nav {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding-bottom: 6px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .ai-tabs-nav::-webkit-scrollbar {
    display: none !important;
  }
  .ai-tab-btn {
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
  }
  .ai-answers-comparison {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .ai-mistake-item {
    padding: 14px !important;
    border-radius: 12px !important;
  }
  .ai-tomorrow-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .ai-growth-banner {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 14px !important;
    text-align: center !important;
  }
  
  /* --- Profile View --- */
  .profile-hero {
    flex-direction: column !important;
    text-align: center !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px !important;
  }
  .profile-action-bar {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .profile-action-bar .btn {
    width: 100% !important;
    justify-content: center !important;
    margin-left: 0 !important;
  }
  .profile-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* --- Face ID & Telegram Modals as Native Bottom Sheets --- */
  #faceIdModal, #telegramBotModal {
    padding: 0 !important;
    align-items: flex-end !important;
    overscroll-behavior: contain !important;
  }
  #faceIdModal > div, #telegramBotModal > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    border-radius: 22px 22px 0 0 !important;
    padding: 18px 14px max(24px, env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7) !important;
  }
  #faceIdModal #faceIdVideo {
    aspect-ratio: 16/9 !important;
    max-height: 220px !important;
  }
  #faceIdModal .face-id-actions,
  #faceIdModal button[id^="btnFaceId"] {
    min-width: 100% !important;
    flex: 1 1 100% !important;
    min-height: 46px !important;
  }

  /* --- Floating AI Ustoz Widget & App Drawer on Mobile --- */
  .floating-ai-tutor-btn {
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    right: 14px !important;
    padding: 10px 16px !important;
    font-size: 0.86rem !important;
    border-radius: 24px !important;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45) !important;
    z-index: 99990 !important;
  }
  #aiUstozFloatingModal .eduflow-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 93vh !important;
    max-height: 93vh !important;
    border-radius: 22px 22px 0 0 !important;
    margin: 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 14px 12px max(14px, env(safe-area-inset-bottom)) !important;
  }
  .ai-chat-input-bar {
    gap: 8px !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
  }
  .ai-chat-input {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    padding: 10px 14px !important;
    border-radius: 12px !important;
  }
  .btn-ai-send {
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
    border-radius: 12px !important;
  }
  
  /* --- General Modals & Auth Card --- */
  .eduflow-modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .eduflow-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 22px 22px 0 0 !important;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
  }
  .vocab-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    border-radius: 22px 22px 0 0 !important;
    padding: 16px 14px max(20px, env(safe-area-inset-bottom)) !important;
    margin-top: auto !important;
  }
  #loginGate {
    padding: 16px 12px !important;
  }
  .login-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px 16px !important;
    border-radius: 20px !important;
  }
}

/* ==========================================================================
   4. SUPER COMPACT SMARTPHONES (iPhone SE, Galaxy Fold 320px - 365px)
   ========================================================================== */
@media screen and (max-width: 365px) {
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .book-3d-wrap {
    max-width: 135px !important;
    height: 196px !important;
  }
  .book-cover-title {
    font-size: 0.82rem !important;
  }
  .book-cover {
    padding: 10px 8px !important;
  }
  .brand-name {
    font-size: 1.05rem !important;
  }
  #qText {
    font-size: 1.02rem !important;
  }
  .design-switcher-pill .design-pill-badge {
    display: none !important; /* Hide badge on super small phone to keep 100% one line */
  }
}


/* ==========================================================================
   AI USTOZ SUPER UPGRADE STYLES
   ========================================================================== */
.ai-chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.ai-persona-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-persona-select {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  background: #0B1120;
  color: #F8FAFC;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.ai-persona-select:focus {
  border-color: #6366F1;
}
.ai-tts-speed-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-speed-toggle {
  background: rgba(99, 102, 241, 0.18);
  color: #C7D2FE;
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-speed-toggle:hover {
  background: #4F46E5;
  color: #fff;
  border-color: #6366F1;
}
.btn-ai-mic {
  background: rgba(99, 102, 241, 0.16);
  color: #A5B4FC;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-ai-mic:hover {
  background: rgba(99, 102, 241, 0.28);
  transform: scale(1.05);
}

/* Design 2 Overrides for Toolbar & Controls */
html[data-theme="terracotta"] .ai-chat-toolbar {
  background: #F6EFE6 !important;
  border: 1px solid #E8DFD3 !important;
}
html[data-theme="terracotta"] .ai-persona-select {
  background: #FFFFFF !important;
  color: #1D1612 !important;
  border: 1.5px solid #E8DFD3 !important;
}
html[data-theme="terracotta"] .btn-speed-toggle {
  background: rgba(194, 84, 45, 0.1) !important;
  color: #C2542D !important;
  border: 1px solid rgba(194, 84, 45, 0.3) !important;
}
html[data-theme="terracotta"] .btn-speed-toggle:hover {
  background: #C2542D !important;
  color: #FFFFFF !important;
}
html[data-theme="terracotta"] .btn-ai-mic {
  background: rgba(194, 84, 45, 0.1) !important;
  color: #C2542D !important;
  border: 1.5px solid rgba(194, 84, 45, 0.3) !important;
}
.btn-ai-mic.mic-listening {
  background: #EF4444 !important;
  color: #ffffff !important;
  border-color: #DC2626 !important;
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.ai-prompt-chips-row.floating {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ai-prompt-chips-row.floating::-webkit-scrollbar {
  display: none;
}
.ai-interactive-drill-card {
  background: var(--color-surface);
  border: 2px solid #7C3AED;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.15);
}
.drill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}
.drill-badge {
  background: #7C3AED;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.drill-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-weight: 600;
}
.drill-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 12px;
  line-height: 1.45;
}
.drill-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 500px) {
  .drill-options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.drill-opt-btn {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}
.drill-opt-btn:hover:not(:disabled) {
  border-color: #7C3AED;
  background: rgba(124, 58, 237, 0.08);
  transform: translateY(-1px);
}
.drill-opt-btn.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10B981 !important;
  color: #059669 !important;
  font-weight: 700;
}
.drill-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #EF4444 !important;
  color: #DC2626 !important;
}
.drill-feedback {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}
.drill-feedback.correct {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid #10B981;
}
.drill-feedback.wrong {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
  border: 1px solid #EF4444;
}
.drill-explanation {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(124, 58, 237, 0.07);
  border-left: 3px solid #7C3AED;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--color-text-main);
  line-height: 1.5;
}
.btn-mark-mastered {
  background: transparent;
  border: 1.5px solid #10B981;
  color: #10B981;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-mark-mastered:hover {
  background: rgba(16, 185, 129, 0.1);
  transform: translateY(-1px);
}
.btn-export-notes {
  border-color: #7C3AED !important;
  color: #7C3AED !important;
}
.btn-export-notes:hover {
  background: #7C3AED !important;
  color: #ffffff !important;
}

/* ==========================================================================
   AI USTOZ MODERN APP-GRADE CHAT MODAL LAYOUT
   ========================================================================== */
#aiUstozFloatingModal.eduflow-modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 6, 14, 0.78);
  backdrop-filter: blur(8px);
}

.ai-chat-modal-window {
  width: min(720px, 96vw) !important;
  height: min(720px, 88vh) !important;
  max-height: 88vh !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  background: #0B101E !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  box-shadow: 0 25px 65px -10px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.15) !important;
  position: relative;
}

html[data-theme="terracotta"] .ai-chat-modal-window {
  background: #FAF6F0 !important;
  border: 1px solid #E8DFD3 !important;
  box-shadow: 0 25px 65px -10px rgba(70, 40, 20, 0.15) !important;
}

/* 1. Header */
.ai-chat-modal-header {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(14, 20, 36, 0.95);
}
html[data-theme="terracotta"] .ai-chat-modal-header {
  border-bottom: 1px solid #E8DFD3;
  background: #F4ECE1;
}

.ai-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ai-chat-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.15));
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818CF8;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
}
html[data-theme="terracotta"] .ai-chat-avatar-badge {
  background: linear-gradient(135deg, rgba(194, 84, 45, 0.15), rgba(216, 107, 67, 0.1));
  border-color: rgba(194, 84, 45, 0.35);
  color: #C2542D;
  box-shadow: 0 4px 12px rgba(194, 84, 45, 0.12);
}
.ai-chat-avatar-badge .lucide {
  width: 24px;
  height: 24px;
}

.ai-chat-header-text {
  min-width: 0;
}

.ai-chat-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #F8FAFC;
}
html[data-theme="terracotta"] .ai-chat-title {
  color: #1D1612;
}

.ai-status-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.14);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
}

.ai-chat-subtitle {
  margin: 3px 0 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(19, 27, 46, 0.7);
  color: #C7D2FE;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.ai-chat-close-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #DC2626;
  transform: rotate(90deg);
}
html[data-theme="terracotta"] .ai-chat-close-btn {
  border-color: #E8DFD3;
  background: #FFFFFF;
  color: #8C3717;
}
html[data-theme="terracotta"] .ai-chat-close-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #DC2626;
}

/* 2. Toolbar */
.ai-chat-toolbar {
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: rgba(12, 17, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  margin: 0;
}
html[data-theme="terracotta"] .ai-chat-toolbar {
  background: #F8F3ED;
  border-bottom: 1px solid #E8DFD3;
}

.ai-toolbar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-right: 4px;
}

.ai-persona-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-persona-select {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  background: #0B1120;
  color: #F8FAFC;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
html[data-theme="terracotta"] .ai-persona-select {
  background: #FFFFFF;
  color: #1D1612;
  border-color: #E8DFD3;
}

.ai-toolbar-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-tts-speed-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-speed-toggle {
  background: rgba(99, 102, 241, 0.15);
  color: #C7D2FE;
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-speed-toggle:hover {
  background: #4F46E5;
  color: #FFFFFF;
}
html[data-theme="terracotta"] .btn-speed-toggle {
  background: rgba(194, 84, 45, 0.1);
  color: #C2542D;
  border-color: rgba(194, 84, 45, 0.3);
}
html[data-theme="terracotta"] .btn-speed-toggle:hover {
  background: #C2542D;
  color: #FFFFFF;
}

.btn-clear-chat-history {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-clear-chat-history:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* 3. Prompt Chips Row */
.ai-prompt-chips-row.floating {
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  background: rgba(9, 13, 24, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin: 0;
}
.ai-prompt-chips-row.floating::-webkit-scrollbar {
  display: none;
}
html[data-theme="terracotta"] .ai-prompt-chips-row.floating {
  background: #FAF6F0;
  border-bottom: 1px solid #E8DFD3;
}

.ai-prompt-chip {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 4. Chat Feed */
#aiUstozModalWindow .ai-chat-feed {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 20px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(7, 10, 18, 0.95);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
}
html[data-theme="terracotta"] #aiUstozModalWindow .ai-chat-feed {
  background: #F8F3ED !important;
  box-shadow: inset 0 2px 8px rgba(70, 40, 20, 0.04) !important;
}

/* 5. Input Bar Wrapper (Always pinned at bottom, never cut off) */
.ai-chat-bottom-wrapper {
  flex-shrink: 0 !important;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(14, 20, 36, 0.98);
  padding: 14px 20px 14px;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
html[data-theme="terracotta"] .ai-chat-bottom-wrapper {
  background: #F4ECE1;
  border-top: 1px solid #E8DFD3;
  box-shadow: 0 -4px 16px rgba(70, 40, 20, 0.06);
}

.ai-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ai-mic {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.ai-chat-input {
  flex: 1;
  min-width: 120px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 0.94rem;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  background: #0B1120;
  color: #F8FAFC;
  outline: none;
  transition: all 0.2s ease;
}
.ai-chat-input:focus {
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: #0F172A;
}
html[data-theme="terracotta"] .ai-chat-input {
  background: #FFFFFF;
  border-color: #E8DFD3;
  color: #1D1612;
}
html[data-theme="terracotta"] .ai-chat-input:focus {
  border-color: #C2542D;
  box-shadow: 0 0 0 3px rgba(194, 84, 45, 0.18);
  background: #FFFFFF;
}

.btn-ai-send {
  height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ai-chat-quick-hints {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--color-text-muted);
  text-align: right;
  opacity: 0.8;
}

/* Mobile full-screen drawer optimization */
@media screen and (max-width: 640px) {
  #aiUstozFloatingModal.eduflow-modal {
    padding: 0 !important;
  }
  .ai-chat-modal-window {
    width: 100% !important;
    max-width: 100% !important;
    height: 96vh !important;
    max-height: 96vh !important;
    border-radius: 20px 20px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
  .ai-chat-modal-header {
    padding: 12px 14px;
  }
  .ai-chat-toolbar {
    padding: 8px 12px;
  }
  .ai-prompt-chips-row.floating {
    padding: 8px 12px;
  }
  #aiUstozModalWindow .ai-chat-feed {
    padding: 14px 12px !important;
  }
  .ai-chat-bottom-wrapper {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .btn-ai-send span {
    display: none; /* Icon-only on tiny screens so send button NEVER overflows */
  }
  .btn-ai-send {
    padding: 0 16px;
    width: 44px;
  }
}

/* ==========================================================================
   AI USTOZ FREE LIMIT (10) & PRO SUBSCRIPTION (29 000 SO'M / 1000 REQUESTS)
   ========================================================================== */
.ai-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.ai-plan-badge.free {
  background: rgba(245, 158, 11, 0.14);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.ai-plan-badge.free:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px) scale(1.03);
}
.ai-plan-badge.pro {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.btn-upgrade-pro-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  color: #FFFFFF !important;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}
.btn-upgrade-pro-header:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.55);
}

.badge-pro-active-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  cursor: pointer;
}

.ai-msg-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(16, 185, 129, 0.16));
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* In-Chat Upgrade Card */
.ai-limit-upgrade-card {
  margin: 12px 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(99, 102, 241, 0.1));
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: viewEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-theme="terracotta"] .ai-limit-upgrade-card {
  background: #FFFDF9;
  border-color: rgba(212, 147, 57, 0.5);
}
.ai-limit-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-limit-card-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: #F59E0B;
}
.ai-limit-card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}
.btn-activate-pro-chat {
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  color: #ffffff !important;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-activate-pro-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.5);
}

/* PRO Subscription Modal */
#aiProUpgradeModal.eduflow-modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 6, 14, 0.82);
  backdrop-filter: blur(10px);
  z-index: 100000;
}
.ai-pro-modal-box {
  width: min(560px, 96vw) !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  background: var(--color-surface) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.35) !important;
  border-radius: 22px !important;
  padding: 28px !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.7), 0 0 35px rgba(245, 158, 11, 0.18) !important;
  position: relative;
}
.ai-pro-crown-badge {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(234, 88, 12, 0.15));
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #F59E0B;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
}
.ai-pro-crown-badge .lucide {
  width: 32px;
  height: 32px;
}
.ai-pro-price-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(99, 102, 241, 0.12));
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
html[data-theme="terracotta"] .ai-pro-price-card {
  background: #FFFDF9;
  border-color: rgba(212, 147, 57, 0.4);
}
.ai-pro-price-val {
  font-size: 1.85rem;
  font-weight: 900;
  color: #F59E0B;
  letter-spacing: -0.5px;
}
.ai-pro-price-period {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}
.ai-pro-comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.86rem;
}
.ai-pro-comparison-table th, .ai-pro-comparison-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.ai-pro-comparison-table th {
  font-weight: 800;
  color: var(--color-text-muted);
}
/* ==========================================================================
   ANIMISTA (animista.net) SHADOW-INSET LUXURY SUITE
   Basic / Shadow-Inset: Center, Top, Right, Bottom, Left & Directional
   Enhanced with cubic-bezier(0.250, 0.460, 0.450, 0.940) smooth easing
   ========================================================================== */

/* 1. Keyframes: shadow-inset-center */
@-webkit-keyframes shadow-inset-center {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 0 16px 0px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 0 16px 0px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}
@keyframes shadow-inset-center {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 0 16px 0px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 0 16px 0px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}

/* 2. Keyframes: shadow-inset-top */
@-webkit-keyframes shadow-inset-top {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}
@keyframes shadow-inset-top {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}

/* 3. Keyframes: shadow-inset-bottom */
@-webkit-keyframes shadow-inset-bottom {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 -14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 -14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}
@keyframes shadow-inset-bottom {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 0 -14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 0 -14px 14px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}

/* 4. Keyframes: shadow-inset-lr */
@-webkit-keyframes shadow-inset-lr {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5)), inset -12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5)), inset -12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}
@keyframes shadow-inset-lr {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  100% {
    -webkit-box-shadow: inset 12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5)), inset -12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
            box-shadow: inset 12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5)), inset -12px 0 12px -8px var(--animista-inset-color, rgba(0, 0, 0, 0.5));
  }
}

/* 5. Keyframes: shadow-inset-glow (Dual Theme Glow) */
@-webkit-keyframes shadow-inset-glow {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  50% {
    -webkit-box-shadow: inset 0 0 20px 2px var(--color-primary-glow, rgba(99, 102, 241, 0.35));
            box-shadow: inset 0 0 20px 2px var(--color-primary-glow, rgba(99, 102, 241, 0.35));
  }
  100% {
    -webkit-box-shadow: inset 0 0 14px 1px var(--color-primary-glow, rgba(99, 102, 241, 0.25));
            box-shadow: inset 0 0 14px 1px var(--color-primary-glow, rgba(99, 102, 241, 0.25));
  }
}
@keyframes shadow-inset-glow {
  0% {
    -webkit-box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
            box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
  }
  50% {
    -webkit-box-shadow: inset 0 0 20px 2px var(--color-primary-glow, rgba(99, 102, 241, 0.35));
            box-shadow: inset 0 0 20px 2px var(--color-primary-glow, rgba(99, 102, 241, 0.35));
  }
  100% {
    -webkit-box-shadow: inset 0 0 14px 1px var(--color-primary-glow, rgba(99, 102, 241, 0.25));
            box-shadow: inset 0 0 14px 1px var(--color-primary-glow, rgba(99, 102, 241, 0.25));
  }
}

/* Animista Utility Classes */
.shadow-inset-center {
  -webkit-animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.shadow-inset-top {
  -webkit-animation: shadow-inset-top 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-top 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.shadow-inset-bottom {
  -webkit-animation: shadow-inset-bottom 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-bottom 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.shadow-inset-lr {
  -webkit-animation: shadow-inset-lr 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-lr 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* ==========================================================================
   COMPONENT INTEGRATIONS WITH ANIMISTA SMOOTH INSET ANIMATIONS
   ========================================================================== */

/* 1. Theme-aware variables */
:root {
  --animista-inset-color: rgba(0, 0, 0, 0.55);
  --color-primary-glow: rgba(99, 102, 241, 0.35);
}
html[data-theme="terracotta"] {
  --animista-inset-color: rgba(70, 40, 20, 0.14);
  --color-primary-glow: rgba(194, 84, 45, 0.25);
}

/* 2. AI Ustoz Chat Feed: Silky smooth inset depth entrance */
#aiUstozModalWindow .ai-chat-feed, .ai-chat-feed {
  -webkit-animation: shadow-inset-center 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 3. Button Active / Press Tactile Animation */
.btn:active, 
.btn-ai-send:active, 
.floating-ai-tutor-btn:active,
.btn-open-book:active {
  -webkit-animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
  transform: translateY(1px) scale(0.985);
}

/* 4. Form inputs on focus: Ultra-smooth inset focus ring */
.ai-chat-input:focus,
.form-control:focus,
.filter-input:focus {
  -webkit-animation: shadow-inset-center 0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 5. Quiz test option buttons: Smooth tactile inset response */
.option-btn:active {
  -webkit-animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.option-btn.selected {
  -webkit-animation: shadow-inset-center 0.35s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.35s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 6. AI Interactive Drill Option Buttons */
.drill-opt-btn:active {
  -webkit-animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.drill-opt-btn.correct {
  -webkit-animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 7. Prompt Chips on hover/active */
.ai-prompt-chip:active {
  -webkit-animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
  transform: scale(0.96);
}

/* 8. Active Teacher & Admin Navigation Items */
.teacher-nav-item.active,
.admin-nav-item.active {
  -webkit-animation: shadow-inset-left 0.35s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-left 0.35s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 9. Design switcher pill on hover */
.design-switcher-pill:hover {
  -webkit-animation: shadow-inset-center 0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* 10. AI Chat Bubble subtle smooth entrance */
.ai-chat-bubble {
  transition: all 0.25s cubic-bezier(0.250, 0.460, 0.450, 0.940);
}
.ai-chat-bubble.ai {
  -webkit-animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
          animation: shadow-inset-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

/* Accessibility: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ambient-orb {
    animation: none !important;
    display: none !important;
  }
}

/* ==========================================================================
   FRAMER MARKETPLACE MODERN SAAS & EDTECH DESIGN SUITE
   - Bento Grids, Ambient Glassmorphism, Micro-interactions, FAQ Accordion
   ========================================================================== */

/* ==========================================================================
   GRADE FILTER STRIP & SEPARATE GRADE BLOCKS (9-SINF & 10-SINF)
   ========================================================================== */
.grade-filter-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 28px 0;
}

.grade-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.grade-filter-tab:hover {
  color: var(--color-text-main);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.grade-filter-tab.active {
  background: var(--color-primary);
  color: #FFFFFF !important;
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.grade-books-block {
  margin-bottom: 44px;
  transition: all 0.3s ease;
}

.grade-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.grade-pill-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.grade-pill-9 {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.grade-pill-10 {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* 1. Announcement Pill Badge */
.framer-announcement-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #C7D2FE;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 16px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.framer-announcement-pill:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px) scale(1.02);
  color: #FFFFFF;
}
html[data-theme="terracotta"] .framer-announcement-pill {
  background: rgba(194, 84, 45, 0.1);
  border-color: rgba(194, 84, 45, 0.3);
  color: #9C3818;
}
html[data-theme="terracotta"] .framer-announcement-pill:hover {
  background: rgba(194, 84, 45, 0.18);
  color: #C2542D;
}
.framer-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
  flex-shrink: 0;
}

/* 2. Stats Strip */
.framer-stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 32px auto 0;
  padding: 16px 28px;
  max-width: 860px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
}
html[data-theme="terracotta"] .framer-stats-strip {
  background: rgba(255, 253, 249, 0.8);
  border: 1px solid rgba(70, 40, 20, 0.12);
  box-shadow: 0 10px 30px rgba(70, 40, 20, 0.08);
}
.framer-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.framer-stat-num {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #818CF8, #06B6D4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme="terracotta"] .framer-stat-num {
  background: linear-gradient(135deg, #C2542D, #D49339);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.framer-stat-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.framer-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
}
html[data-theme="terracotta"] .framer-stat-divider {
  background: rgba(70, 40, 20, 0.12);
}

/* 3. Section Titles */
.framer-section {
  padding: 60px 0 20px;
}
.framer-section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 36px;
}
.framer-section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.framer-section-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin: 0 0 12px;
  line-height: 1.25;
}
.framer-section-desc {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0;
}

/* 4. Bento Grid Layout */
.framer-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-top: 10px;
}
.framer-bento-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
}
.framer-bento-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  border-color: rgba(99, 102, 241, 0.45);
}
html[data-theme="terracotta"] .framer-bento-card:hover {
  box-shadow: 0 18px 40px rgba(70, 40, 20, 0.12);
  border-color: rgba(194, 84, 45, 0.45);
}
.framer-bento-card.span-7 {
  grid-column: span 7;
}
.framer-bento-card.span-5 {
  grid-column: span 5;
}
.framer-bento-card.span-6 {
  grid-column: span 6;
}
.framer-bento-card.span-12 {
  grid-column: span 12;
}
.framer-bento-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(99, 102, 241, 0.12);
  color: #818CF8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 14px;
  align-self: flex-start;
}
html[data-theme="terracotta"] .framer-bento-tag {
  background: rgba(194, 84, 45, 0.1);
  color: #C2542D;
  border-color: rgba(194, 84, 45, 0.25);
}
.framer-bento-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.3;
}
.framer-bento-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 18px;
}
.framer-bento-preview {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 10px;
}
html[data-theme="terracotta"] .framer-bento-preview {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(70, 40, 20, 0.08);
}

/* 5. Steps (Qanday ishlaydi?) */
.framer-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 16px;
}
.framer-step-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 30px 24px;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}
.framer-step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  border-color: var(--color-primary);
}
.framer-step-num {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #818CF8;
  font-size: 1.25rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
html[data-theme="terracotta"] .framer-step-num {
  background: linear-gradient(135deg, rgba(194, 84, 45, 0.15), rgba(212, 147, 57, 0.15));
  border-color: rgba(194, 84, 45, 0.35);
  color: #C2542D;
}
.framer-step-title {
  font-size: 1.18rem;
  font-weight: 800;
  margin: 0 0 10px;
}
.framer-step-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* 6. Testimonials / Reviews */
.framer-reviews-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 16px;
}
.framer-review-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s, box-shadow 0.25s;
}
.framer-review-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
}
.framer-review-stars {
  color: #F59E0B;
  font-size: 0.95rem;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.framer-review-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-text-main);
  margin: 0 0 18px;
  font-style: italic;
}
.framer-review-author {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.framer-review-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.framer-review-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-text-main);
}
.framer-review-role {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* 7. FAQ Accordion */
.framer-faq-container {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.framer-faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.framer-faq-item.open {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
html[data-theme="terracotta"] .framer-faq-item.open {
  box-shadow: 0 8px 24px rgba(70, 40, 20, 0.1);
}
.framer-faq-question {
  width: 100%;
  padding: 18px 22px;
  background: none;
  border: none;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--color-text-main);
}
.framer-faq-icon {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.framer-faq-item.open .framer-faq-icon {
  transform: rotate(180deg);
}
.framer-faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 22px;
  opacity: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s, padding 0.3s;
}
.framer-faq-item.open .framer-faq-answer {
  max-height: 350px;
  padding: 0 22px 20px;
  opacity: 1;
}

/* 8. Framer CTA Banner */
.framer-cta-card {
  max-width: 960px;
  margin: 40px auto 10px;
  padding: 44px 36px;
  border-radius: 26px;
  background: radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.25) 0%, rgba(15, 23, 42, 0.9) 70%);
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.15);
  text-align: center;
  position: relative;
  overflow: hidden;
}
html[data-theme="terracotta"] .framer-cta-card {
  background: radial-gradient(circle at 100% 0%, rgba(194, 84, 45, 0.18) 0%, rgba(255, 253, 249, 0.95) 70%);
  border-color: rgba(194, 84, 45, 0.35);
  box-shadow: 0 20px 50px rgba(70, 40, 20, 0.12);
}
.framer-cta-title {
  font-size: 2.1rem;
  font-weight: 900;
  margin: 0 0 12px;
  line-height: 1.25;
}
.framer-cta-desc {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 580px;
  margin: 0 auto 26px;
  line-height: 1.55;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .framer-bento-card.span-7,
  .framer-bento-card.span-5,
  .framer-bento-card.span-6 {
    grid-column: span 12;
  }
  .framer-steps-grid,
  .framer-reviews-grid {
    grid-template-columns: 1fr;
  }
  .framer-section-title {
    font-size: 1.8rem;
  }
  .framer-stats-strip {
    gap: 16px;
    padding: 14px 18px;
  }
  .framer-stat-divider {
    display: none;
  }
}

/* ==========================================================================
   EDUFLOW - DAFTARGA YOZMA TOPSHIRIQ & AI USTOZ TEKSHIRUVI STYLES
   ========================================================================== */
.homework-hero-card {
  position: relative;
  border-radius: var(--radius-xl, 20px);
  padding: 28px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.homework-hero-content {
  max-width: 780px;
  position: relative;
  z-index: 2;
}
.homework-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #FFFFFF;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}
.homework-hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: #FFFFFF;
  margin: 0 0 10px;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.homework-hero-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.6;
  margin: 0 0 16px;
}
.homework-hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.homework-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.78rem;
  font-weight: 700;
  color: #FFFFFF;
  backdrop-filter: blur(6px);
}
.homework-hero-seal {
  font-size: 5rem;
  opacity: 0.22;
  user-select: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Task Selector */
.homework-task-selector {
  background: var(--color-surface, #0E1422);
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.homework-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.btn-random-task {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--color-primary, #6366F1);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-random-task:hover {
  background: var(--color-primary, #6366F1);
  color: #FFFFFF;
  transform: translateY(-1px);
}
.homework-task-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.homework-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-md, 12px);
  background: var(--color-surface-muted, #151D30);
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.08));
  color: var(--color-text-main, #F8FAFC);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.homework-chip-btn:hover {
  border-color: var(--color-primary, #6366F1);
  transform: translateY(-2px);
}
.homework-chip-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--color-primary, #6366F1);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}
.chip-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface, #0E1422);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}
.chip-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid;
}

/* 2-Column Workspace */
.homework-workspace-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  margin-bottom: 28px;
}
@media (max-width: 960px) {
  .homework-workspace-grid {
    grid-template-columns: 1fr;
  }
}
.homework-card {
  background: var(--color-surface, #0E1422);
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.homework-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.homework-diff-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full, 9999px);
}
.homework-pts-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.homework-time-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted, #94A3B8);
}
.btn-copy-question {
  background: var(--color-surface-muted, #151D30);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  color: var(--color-text-muted, #94A3B8);
  border-radius: var(--radius-md, 10px);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-copy-question:hover {
  color: var(--color-text-main, #F8FAFC);
  border-color: var(--color-primary, #6366F1);
}

/* Question Content Styling */
.homework-question-content {
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--color-text-main, #F8FAFC);
  margin-bottom: 18px;
}
.math-formula-box {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--color-primary, #6366F1);
  padding: 10px 14px;
  margin: 10px 0;
  border-radius: 4px 8px 8px 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-weight: 700;
  color: #A5B4FC;
  overflow-x: auto;
}
.math-inline-box {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-weight: 600;
  color: #67E8F9;
}
.homework-guide-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md, 12px);
  padding: 14px;
  margin-top: 10px;
}
.guide-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #F59E0B;
  margin-bottom: 6px;
}
.guide-box-body {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--color-text-main, #F8FAFC);
}

/* Upload Drop Zone */
.homework-drop-zone {
  border: 2px dashed rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.03);
  border-radius: var(--radius-lg, 16px);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.24s ease;
}
.homework-drop-zone:hover, .homework-drop-zone.drag-over {
  border-color: var(--color-primary, #6366F1);
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.01);
}
.drop-zone-icon {
  margin-bottom: 12px;
}
.btn-zone-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-primary, #6366F1);
  color: #FFFFFF;
  border: none;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-zone-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}
.btn-zone-action.secondary {
  background: var(--color-surface-muted, #151D30);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  color: var(--color-text-main, #F8FAFC);
  box-shadow: none;
}
.btn-zone-action.secondary:hover {
  background: var(--color-surface, #0E1422);
  border-color: var(--color-primary, #6366F1);
}

/* Image Preview */
.homework-preview-box {
  background: var(--color-surface-muted, #151D30);
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 14px);
  padding: 12px;
}
.preview-img-container {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  max-height: 320px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.homework-preview-img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}
.homework-preview-img:hover {
  transform: scale(1.02);
}
.preview-controls-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.65);
  padding: 4px;
  border-radius: var(--radius-md, 10px);
  backdrop-filter: blur(6px);
}
.btn-preview-ctl {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-preview-ctl:hover {
  background: rgba(255,255,255,0.25);
}
.btn-preview-ctl.danger:hover {
  background: #EF4444;
}

/* Student Note Input */
.homework-note-input {
  width: 100%;
  background: var(--color-surface-muted, #151D30);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 10px);
  padding: 10px 14px;
  color: var(--color-text-main, #F8FAFC);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}
.homework-note-input:focus {
  border-color: var(--color-primary, #6366F1);
}

/* Submit CTA */
.btn-homework-submit {
  width: 100%;
  margin-top: 16px;
  padding: 14px 24px;
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(135deg, #10B981, #06B6D4);
  color: #FFFFFF;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}
.btn-homework-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.5);
}
.btn-homework-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Scanning Overlay */
.homework-scanning-box {
  position: relative;
  border-radius: var(--radius-md, 14px);
  overflow: hidden;
  min-height: 280px;
  background: #070A12;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanning-preview-img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  filter: brightness(0.35) contrast(1.2);
}
.scanning-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #10B981, #67E8F9, #10B981, transparent);
  box-shadow: 0 0 18px 4px rgba(16, 185, 129, 0.85);
  animation: scanLaser 2s ease-in-out infinite;
  z-index: 5;
}
@keyframes scanLaser {
  0% { top: 5%; }
  50% { top: 92%; }
  100% { top: 5%; }
}
.scanning-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  z-index: 6;
}
.scanning-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(16, 185, 129, 0.2);
  border-top-color: #10B981;
  border-radius: 50%;
  animation: spinLoader 0.85s linear infinite;
  margin-bottom: 14px;
}
@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

/* Evaluation Card */
.homework-eval-card {
  margin-top: 24px;
  background: var(--color-surface, #0E1422);
  border: 2px solid var(--color-primary, #6366F1);
  border-radius: var(--radius-lg, 16px);
  padding: 22px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}
.eval-hero-banner {
  border-radius: var(--radius-md, 14px);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.eval-score-gauge {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 4px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.gauge-num {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}
.gauge-max {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.8;
}
.eval-hero-text {
  flex-grow: 1;
  min-width: 200px;
}
.btn-eval-speak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-eval-speak:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

/* Evaluation Details */
.eval-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .eval-details-grid {
    grid-template-columns: 1fr;
  }
}
.eval-detail-box {
  background: var(--color-surface-muted, #151D30);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 12px);
  padding: 14px;
}
.detail-box-title {
  font-size: 0.84rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.detail-box-desc {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--color-text-main, #F8FAFC);
}
.detail-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-text-main, #F8FAFC);
}

/* Model Solution Accordion */
.eval-model-solution-wrap {
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  background: var(--color-surface-muted, #151D30);
  overflow: hidden;
}
.btn-toggle-solution {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--color-text-main, #F8FAFC);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.homework-model-sol-content {
  display: none;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border, rgba(255,255,255,0.08));
  background: #070A12;
}
.homework-model-sol-content.open {
  display: block;
}
.model-sol-pre {
  margin: 0;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #A7F3D0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* History Section */
.homework-history-section {
  background: var(--color-surface, #0E1422);
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  padding: 20px;
}
.homework-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.homework-history-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--color-text-muted, #94A3B8);
  font-size: 0.92rem;
}
.homework-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.history-item-card {
  background: var(--color-surface-muted, #151D30);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 12px);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}
.history-item-card:hover {
  border-color: var(--color-primary, #6366F1);
  transform: translateY(-2px);
}
.history-thumb-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--color-border, rgba(255,255,255,0.15));
  cursor: pointer;
}
.history-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.history-score-badge {
  text-align: right;
  flex-shrink: 0;
}
.history-score-badge .score-num {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}
.history-score-badge .score-grade {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
}
.history-score-badge.high { color: #10B981; }
.history-score-badge.medium { color: #06B6D4; }
.history-score-badge.low { color: #F59E0B; }

/* Modals */
.homework-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}
.camera-modal-content {
  background: #0E1422;
  border: 1.5px solid var(--color-border, rgba(255,255,255,0.12));
  border-radius: var(--radius-xl, 20px);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.camera-modal-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.btn-modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted, #94A3B8);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-modal-close:hover {
  color: #FFFFFF;
}
.camera-video-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  background: #000;
  overflow: hidden;
}
#homeworkCameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-notebook-guide-box {
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 8%;
  right: 8%;
  border: 2px dashed rgba(255,255,255,0.45);
  border-radius: 12px;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
}
.guide-label {
  background: rgba(0,0,0,0.65);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full, 9999px);
}
.guide-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid #10B981;
}
.guide-corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.guide-corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.guide-corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.guide-corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.camera-modal-footer {
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #070A12;
}
.btn-shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 3px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-shutter:hover {
  transform: scale(1.06);
}
.btn-shutter:active {
  transform: scale(0.94);
}
.shutter-inner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #FFFFFF;
}

/* Lightbox Modal */
.lightbox-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
#homeworkLightboxImg {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
.lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  color: #FFFFFF;
  font-size: 1.5rem;
}
/* Face ID animations */
@keyframes faceSpin { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }
@keyframes scanBeamAnim { 0%{top:0%; opacity:0.8;} 50%{top:100%; opacity:1;} 100%{top:0%; opacity:0.8;} }
@keyframes facePulseGlow { 0%,100%{box-shadow:0 0 0 4px rgba(16,185,129,0.3);} 50%{box-shadow:0 0 0 10px rgba(16,185,129,0.6);} }
.face-detected-glow { border-color:#10B981 !important; animation:facePulseGlow 1.2s ease-in-out infinite; }
