/* =========================================================
   AksharaChitra – Performance-Optimized CSS v12.0
   Single Page Application with Fast Loading
   Mobile-First • Performance-Focused • Production-Ready
   ========================================================= */

/* -------------------- CRITICAL CSS (Above the Fold) -------------------- */
/* Load these styles first for faster initial render */

:root {
  --accent: #00bfa6;
  --accent-hover: #00d4b8;
  --primary: #1e88e5;
  --primary-700: #1565c0;
  --primary-hover: #1976d2;
  --muted: #6b7280;
  --text: #111827;
  --card: #ffffff;
  --bg: #f6f7fb;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-hover: rgba(255, 255, 255, 0.96);
  --danger: #e53935;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1200px;
  --ui-gap: 16px;
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.04);
  --shadow-md: 0 8px 24px rgba(2, 6, 23, 0.08);
  --shadow-lg: 0 16px 40px rgba(2, 6, 23, 0.12);
  --transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: "Poppins", "Montserrat", system-ui, -apple-system, sans-serif;
  --telugu-stack: "Veturi", "Sirivennela", "TenaliRamakrishna", "Timmana", "Ramaraja", "RamaneeyaWin", "RaviPrakash", "TANA", "Noto Sans Telugu", system-ui, sans-serif;
  --btn-padding: 12px 20px;
  --btn-font-size: 0.95rem;
  --focus-ring: rgba(30, 136, 229, 0.15);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
}

/* Dark theme - Using prefers-color-scheme for better performance */
@media (prefers-color-scheme: dark) {
  :root {
    --card: #1a1f2e;
    --bg: #0f141f;
    --glass: rgba(26, 31, 46, 0.85);
    --glass-hover: rgba(26, 31, 46, 0.92);
    --text: #e8eef5;
    --muted: #9fb0c7;
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
    --focus-ring: rgba(30, 136, 229, 0.2);
  }
}

body.dark {
  --card: #1a1f2e;
  --bg: #0f141f;
  --glass: rgba(26, 31, 46, 0.85);
  --glass-hover: rgba(26, 31, 46, 0.92);
  --text: #e8eef5;
  --muted: #9fb0c7;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  --focus-ring: rgba(30, 136, 229, 0.2);
}

/* Reset - Minimal for performance */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
  min-height: 100vh;
  will-change: auto;
}

/* -------------------- TOPBAR (Critical) -------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  backdrop-filter: blur(20px) saturate(180%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  border-bottom: 1px solid rgba(2, 6, 23, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  will-change: transform;
}

body.dark .topbar {
  background: linear-gradient(180deg, rgba(26, 31, 46, 0.92), rgba(26, 31, 46, 0.85));
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.topbar .left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  height: 40px;
  width: auto;
  border-radius: 10px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.app-title {
  font-weight: 800;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* Navigation - Optimized */
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 6px;
  margin-left: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--muted);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  box-shadow: var(--shadow-md);
}

.right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.right-controls button {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: all var(--transition-fast);
  color: var(--text);
}

.hamburger {
  display: block;
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 10px;
  border-radius: 12px;
  color: var(--primary); /* Primary color */
  transition: all var(--transition);
}

.hamburger:hover {
  color: var(--accent); /* Change color to accent on hover */
  background: rgba(0, 0, 0, 0.1); /* Light background on hover */
}


/* Mobile menu */
/* Mobile Menu - Initially Hidden */
.mobile-menu {
  display: none;  /* Initially hide the menu */
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 0;
  z-index: 999;  /* Ensure it's above other content */
  transform: translateY(-12px); /* Hide offscreen initially */
  opacity: 0;  /* Hidden state */
  pointer-events: none;  /* Disable interactions when hidden */
  visibility: hidden;  /* Ensure it doesn't take up space when hidden */
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1), opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
}

/* Mobile Menu - Opened state */
.mobile-menu.open {
  display: block;  /* Show the menu */
  opacity: 1;  /* Make the menu fully visible */
  transform: translateY(0);  /* Slide the menu into place */
  pointer-events: auto;  /* Enable interactions */
  visibility: visible;  /* Ensure visibility */
}

/* Mobile Menu Item Styling */
.mobile-menu .m-item {
  padding: 14px 20px;
  text-align: left;
  font-size: 16px;
  border: none;
  background: none;
  width: calc(100% - 16px);  /* Make items full width with padding */
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  border-radius: 12px;
  transition: all var(--transition);
  margin: 4px 8px;  /* Space between items */
  display: flex;
  align-items: center;
  gap: 10px;  /* Space between icon and text */
}

/* Active Menu Item - Highlight */
.mobile-menu .m-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== NEW LANDING SECTION STYLES ==================== */

/* Hero Section - Optimized with will-change */
.about-intro {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius);
  padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 60px);
  color: white;
  text-align: center;
  margin-bottom: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.about-intro::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: pulse 15s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.3; }
}

.about-intro-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.about-intro-header h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.highlight {
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.home-intro-logo {
  width: clamp(60px, 10vw, 90px);
  height: clamp(60px, 10vw, 90px);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  transition: transform var(--transition);
}

.subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  margin-bottom: 20px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  text-align: center;
}

.about-intro p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.8;
  margin: 15px auto;
  max-width: 800px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.about-intro strong {
  color: #ffd700;
  font-weight: 700;
}

/* Why Choose Section - Comparison */
.why-choose-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(30px, 5vw, 50px);
  margin-bottom: 40px;
  box-shadow: var(--shadow-md);
}

.why-choose-section h2 {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--primary);
  margin-bottom: 30px;
  position: relative;
  padding-bottom: 15px;
}

.why-choose-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.comparison-card {
  background: var(--glass);
  border-radius: 12px;
  padding: 25px;
  transition: all var(--transition);
  border: 2px solid transparent;
  will-change: transform;
}

.comparison-card.aksharachitra {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-color: var(--primary);
}

.comparison-card h3 {
  font-size: 1.4rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comparison-features {
  list-style: none;
  padding: 0;
}

.comparison-features li {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  align-items: start;
  gap: 10px;
  font-size: 0.95rem;
}

.comparison-features li:last-child {
  border-bottom: none;
}

.comparison-card.aksharachitra .comparison-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.comparison-card.others .comparison-features li::before {
  content: '✗';
  color: var(--danger);
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* AI Features Showcase */
.ai-features-showcase {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-radius: var(--radius);
  padding: clamp(30px, 5vw, 50px);
  margin-bottom: 40px;
  color: white;
  position: relative;
  overflow: hidden;
}

.ai-features-showcase::before {
  content: '🤖';
  position: absolute;
  font-size: 200px;
  opacity: 0.1;
  right: -50px;
  top: -50px;
  animation: float 6s ease-in-out infinite;
  will-change: transform;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.ai-features-showcase h2 {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 15px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  color: white;
}

.ai-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  position: relative;
  z-index: 1;
}

.ai-feature-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition);
}

.ai-feature-card .icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  display: block;
}

.ai-feature-card h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: white;
}

.ai-feature-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.9;
  color: white;
}

/* TTS & Voice Controls */
.tts-voice-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.tts-voice-section h3 {
  color: var(--primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tts-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.tts-btn, .voice-btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tts-btn.active, .voice-btn.listening {
  background: linear-gradient(135deg, #ff6f61, #ff8a80);
  color: white;
  border-color: transparent;
  animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 111, 97, 0.6); }
  50% { box-shadow: 0 0 0 15px rgba(255, 111, 97, 0); }
}

/* ==================== CORE STYLES (Deferred Load) ==================== */

/* Utilities */
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.92rem; }
.small { font-size: 0.85rem; color: var(--muted); }
.divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 28px auto;
  width: 90%;
  opacity: 0.3;
}

/* Typography */
h1, h2, h3 {
  margin: 0 0 12px 0;
  line-height: 1.25;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 1.85rem);
  color: var(--primary);
}

h3 {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text);
  font-weight: 600;
}

/* Cards & Sections */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.section {
  background: var(--glass);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--ui-gap);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition);
}

/* Form Controls - Optimized */
label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(2, 6, 23, 0.08);
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

select {
  appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 40px;
  cursor: pointer;
}

/* Buttons - Optimized */
.btn {
  padding: var(--btn-padding);
  border-radius: 12px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--btn-font-size);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn.small {
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* Content & Layout */
.content {
  padding: 20px;
  min-height: 60vh;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Font Preview */
.font-preview-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(25px, 4vw, 40px);
  margin-bottom: 30px;
  box-shadow: var(--shadow-md);
}

.tts-control {
  max-width: 300px;
  margin: 20px auto;
}

/* Local Font Access */
.local-font-access, .CustomFont {
  margin-top: 20px;
  padding: 18px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid rgba(0, 0, 0, 0.06);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
}

#loadLocalFontsBtn, #fontSelect_local {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

/* Desktop Fonts Tutorial */
.desktop-fonts-tutorial {
  margin-top: 40px;
}

.tutorial-container {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(25px, 4vw, 40px);
  box-shadow: var(--shadow-md);
}

.tutorial-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--primary);
}

.feature-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 10px;
}

.intro-box {
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 30px;
  border-left: 5px solid #00acc1;
}

.steps-container {
  display: grid;
  gap: 20px;
  margin-top: 30px;
}

.step-card {
  background: var(--glass);
  border-radius: 12px;
  padding: 20px;
  border-left: 5px solid var(--primary);
  transition: all var(--transition);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.step-number {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  flex-shrink: 0;
}

.step-title {
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  color: var(--text);
  font-weight: 600;
}

.success-box {
  background: #d4edda;
  border-left: 4px solid #28a745;
  padding: 15px 20px;
  margin: 15px 0;
  border-radius: 5px;
  color: #155724;
}

.benefits-section {
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: white;
  padding: 30px;
  border-radius: var(--radius);
  margin-top: 30px;
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.benefit-item {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.benefit-item .emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 10px;
}

.cta-section {
  text-align: center;
  margin-top: 30px;
  padding: 30px;
  background: linear-gradient(135deg, #fa709a, #fee140);
  border-radius: var(--radius);
}

.cta-button {
  background: var(--primary);
  color: white;
  padding: 14px 40px;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

/* Features Grid */
.home_feature_container {
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(25px, 4vw, 32px);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.home_feature_title {
  color: var(--primary);
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  margin-bottom: 20px;
  text-align: center;
}

.home_feature_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.home_feature_item {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  padding: 18px;
  border-radius: 10px;
  border-left: 4px solid var(--primary);
  transition: all var(--transition);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.home_feature_cta {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

#home_feature_create_btn, #home_feature_share_btn {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
}

#home_feature_create_btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: var(--shadow-md);
}

#home_feature_share_btn {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.home_feature_share_icon {
  width: 24px;
  height: 24px;
}

/* Help Section */
.home_help_container {
  background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
  border-radius: var(--radius);
  padding: clamp(25px, 4vw, 32px);
  box-shadow: var(--shadow-md);
}

.home_help_title {
  color: #00838f;
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  margin-bottom: 20px;
  text-align: center;
}

.home_help_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.home_help_item {
  background: rgba(255, 255, 255, 0.7);
  padding: 18px;
  border-radius: 10px;
  border-left: 4px solid #00acc1;
  transition: all var(--transition);
  backdrop-filter: blur(5px);
}

.home_help_tip {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 20px;
  border-radius: 10px;
  margin-top: 25px;
  font-weight: 600;
}

/* Editor & Preview */
.editor {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 16px;
}

.panel {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.left-panel {
  flex: 1 1 350px;
  min-width: 280px;
}

.right-panel, .poster-info-container {
  flex: 1 1 600px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#previewCard {
  width: 320px;
  aspect-ratio: 4/5;
  padding: 24px;
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 12px auto;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
}

/* Gallery - Optimized */
#galleryGrid {
  padding: clamp(14px, 4vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  background: linear-gradient(180deg, #f9fbff 0%, #eef7ff 100%);
  border-radius: var(--radius);
}

.gallery-grid {
  display: grid;
  gap: clamp(12px, 2.5vw, 20px);
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 30vw, 200px), 1fr));
}

.gallery-card {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  border: 2px solid transparent;
}

.gallery-thumb {
  width: 100%;
  height: clamp(120px, 30vw, 180px);
  object-fit: cover;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
}

/* Footer & FABs */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--card);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 40px;
}

.install-fab, .go-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.5rem;
}

.go-top {
  bottom: 90px;
}

/* Animations - Optimized with will-change */
.fade-in {
  animation: fadeUpEnhanced 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes fadeUpEnhanced {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.home_feature_fade {
  animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal - Crop & Preview */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 9999;
  padding: 16px;
}

.crop-modal-content {
  width: 100%;
  max-width: 900px;
  max-height: 95vh;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

/* ==================== RESPONSIVE - MOBILE FIRST ==================== */

/* Mobile Small - Critical optimizations */
@media (max-width: 480px) {
  :root {
    --btn-padding: 10px 14px;
    --btn-font-size: 0.88rem;
  }
  
  .topbar {
    padding: 10px 12px;
  }
  
  .logo {
    height: 36px;
  }
  
  .app-title {
    display: none;
  }
  
  .hamburger {
    display: block;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .about-intro {
    padding: 30px 16px;
  }
  
  .home-intro-logo {
    width: 60px;
    height: 60px;
  }
  
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  
  .ai-features-grid {
    grid-template-columns: 1fr;
  }
  
  .tts-controls {
    flex-direction: column;
  }
  
  .tts-btn, .voice-btn {
    width: 100%;
    justify-content: center;
  }
  
  .home_feature_grid,
  .home_help_grid {
    grid-template-columns: 1fr;
  }
  
  .home_feature_cta {
    flex-direction: column;
  }
  
  #home_feature_create_btn,
  #home_feature_share_btn {
    width: 100%;
    justify-content: center;
  }
  
  .benefits-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .hamburger {
    display: block;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop */
@media (min-width: 769px) {
  .hamburger {
    display: none;
  }
  
  .mobile-menu {
    display: none !important;
  }
}

/* Large Desktop - Performance optimization */
@media (min-width: 1201px) {
  .editor {
    flex-wrap: nowrap;
  }
  
  .left-panel {
    flex: 0 0 380px;
  }
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */

/* Reduce animations on low-end devices */
@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;
  }
}

/* GPU Acceleration for critical elements */
.topbar,
.tab-btn,
.btn,
.card,
.gallery-card,
.about-intro {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lazy loading hint */
img[loading="lazy"] {
  content-visibility: auto;
}

/* Optimize scrolling */
.nav,
.mobile-menu {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Contain layout shifts */
.gallery-thumb {
  contain: layout style paint;
}

/* Print styles */
@media print {
  .topbar,
  .nav,
  .hamburger,
  .right-controls,
  .install-fab,
  .go-top,
  .footer,
  .btn,
  .gallery-overlay {
    display: none !important;
  }
}

/* ==================== FONT FACES (Deferred) ==================== */
/* Load these fonts after critical content */
@font-face {
  font-family: 'Veturi';
  src: url('fonts/Veturi.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sirivennela';
  src: url('fonts/Sirivennela.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* =========================
   CHATHURA FAMILY
========================= */
@font-face {
  font-family: 'Chathura-Light';
  src: url('fonts/Chathura-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Chathura-Regular';
  src: url('fonts/Chathura-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Chathura-Thin';
  src: url('fonts/Chathura-Thin.ttf') format('truetype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Chathura-Bold';
  src: url('fonts/Chathura-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Chathura-ExtraBold';
  src: url('fonts/Chathura-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}


/* =========================
   OTHER TELUGU FONTS
========================= */

@font-face {
  font-family: 'Ramaneeya';
  src: url('fonts/RamaneeyaWin.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ramaraja';
  src: url('fonts/Ramaraja-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RaviPrakash';
  src: url('fonts/RaviPrakash.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sirivennela';
  src: url('fonts/Sirivennela.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'TANA';
  src: url('fonts/TANA.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'TenaliRamakrishna';
  src: url('fonts/TenaliRamakrishna-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Timmana';
  src: url('fonts/TimmanaRegular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Veturi';
  src: url('fonts/Veturi.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* ---------------------------- FULLSCREEN PREVIEW MODAL ---------------------------- */
#akPreviewModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  padding: 16px;
  overflow: hidden;
}

.ak-preview-box {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  background-color: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ak-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.ak-preview-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.ak-preview-date {
  font-size: 0.9rem;
  color: #666;
}

#closePreview {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #ff4d4f;
  cursor: pointer;
}

.ak-preview-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: 20px 0;
}

.ak-preview-actions {
  display: flex;
  justify-content: center;
}

#previewDownload {
  background-color: #00bfa6;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

#previewDownload:hover {
  background-color: #00d4b8;
}
/* ---------------------------- FULLSCREEN PREVIEW MODAL ---------------------------- */
#akPreviewModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  padding: 16px;
  overflow: hidden;
}

.ak-preview-box {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  background-color: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ak-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.ak-preview-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.ak-preview-date {
  font-size: 0.9rem;
  color: #666;
}

#closePreview {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #ff4d4f;
  cursor: pointer;
}

.ak-preview-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: 20px 0;
}

.ak-preview-actions {
  display: flex;
  justify-content: center;
}

#previewDownload {
  background-color: #00bfa6;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

#previewDownload:hover {
  background-color: #00d4b8;
}

/* ========================== RESPONSIVE STYLES ========================== */

/* For small mobile screens (max-width: 480px) */
@media (max-width: 480px) {
  .ak-preview-title {
    font-size: 1.2rem;
  }

  .ak-preview-date {
    font-size: 0.8rem;
  }

  #closePreview {
    font-size: 1.25rem;
  }

  .ak-preview-img {
    max-height: 50vh;
  }

  #previewDownload {
    font-size: 0.9rem;
    padding: 8px 16px;
  }
}

/* For tablets (min-width: 481px and max-width: 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .ak-preview-title {
    font-size: 1.3rem;
  }

  .ak-preview-date {
    font-size: 0.9rem;
  }

  #closePreview {
    font-size: 1.4rem;
  }

  .ak-preview-img {
    max-height: 60vh;
  }

  #previewDownload {
    font-size: 1rem;
    padding: 10px 18px;
  }
}

/* For larger screens (min-width: 769px) */
@media (min-width: 769px) {
  .ak-preview-title {
    font-size: 1.5rem;
  }

  .ak-preview-date {
    font-size: 0.9rem;
  }

  #closePreview {
    font-size: 1.5rem;
  }

  .ak-preview-img {
    max-height: 70vh;
  }

  #previewDownload {
    font-size: 1.1rem;
    padding: 12px 24px;
  }
}

#chatBubble {
  position: fixed;
  bottom: 20px;
  left: 20px;      /* moved from right → left */
  background: #4A90E2;
  color: white;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  z-index: 9999;
}

#chatWindow {
  position: fixed;
  bottom: 80px;
  left: 20px;      /* moved from right → left */
  width: 320px;
  height: 420px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 22px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

/* MOBILE RESPONSIVE */
@media (max-width: 600px) {
  #chatWindow {
    width: 92%;
    left: 4%;       /* centered on mobile */
    height: 70%;
    bottom: 90px;
  }

  #chatBubble {
    bottom: 25px;
    left: 25px;     /* left for mobile */
  }
}

/* Floating bubble */
#chatBubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #4A90E2;
  color: white;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  z-index: 9999;
}

/* Chat window */
#chatWindow {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  height: 420px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 22px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

#chatHeader {
  background: #4A90E2;
  color: white;
  padding: 12px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chatClose {
  cursor: pointer;
  font-size: 18px;
}

/* Chat area */
#chatLog {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-family: Arial;
  font-size: 14px;
}

/* Input & send */
#chatInputArea {
  display: flex;
  padding: 10px;
  background: #f3f3f3;
}

#chatInput {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

#sendBtn {
  margin-left: 6px;
  padding: 8px 12px;
  background: #4A90E2;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* MOBILE responsive */
@media (max-width: 600px) {
  #chatWindow {
    width: 92%;
    right: 4%;
    height: 70%;
    bottom: 90px;
  }

  #chatBubble {
    bottom: 25px;
    right: 25px;
  }
}
#aiModeBox {
  padding: 10px 12px;
  background: #fff7ef;
  border-bottom: 1px solid #f0d2b0;
}

#aiModeBox label {
  font-size: 13px;
  font-weight: 600;
  color: #ff7a00;
}

#aiMode {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #ffcc99;
  outline: none;
}

/* Engine indicator */
#engineIndicator {
  margin-top: 6px;
  font-size: 12px;
  color: #444;
  padding: 5px;
  background: #fff3e6;
  border-radius: 6px;
  border: 1px solid #ffdfb8;
}

/* Clear button area */
#utilityButtons {
  padding: 10px;
  background: white;
  border-top: 1px solid #eee;
}

#clearChat {
  width: 100%;
  padding: 8px;
  background: #ffe0c0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #7a4a00;
}

#clearChat:hover {
  background: #ffcf99;
}
/* Notebook LM Video List */
.video-list {
  display: grid;
  gap: 20px;
  padding: 10px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.video-card {
  background: var(--glass);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.video-card:hover {
  transform: translateY(-3px);
}

.video-card h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: var(--text);
}

/* Responsive Video */
.video-card video {
  width: 100%;
  height: auto;
  border-radius: 10px;
  outline: none;
  background: #000;
}

/* Mobile tightening */
@media (max-width: 480px) {
  .video-list {
    grid-template-columns: 1fr;
  }
}

.visitor-count {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  color: var(--primary);
  margin: clamp(12px, 3vw, 24px) 0;
  text-align: center;
  padding: 8px 14px;
  background: var(--card);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  display: inline-block;
}
.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  padding: 10px 16px;
  background: #1565c0;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  z-index: 99999;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 10px;
  outline: 3px solid #fff;
}
:focus {
  outline: 3px solid #4a90e2 !important;
  outline-offset: 3px;
  border-radius: 6px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #1e88e5 !important;
  outline-offset: 3px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(30,136,229,0.25);
}


/* Additional font faces truncated for brevity - include all from original */

/* ==================== END OF CSS ==================== */