:root {
  --ink: #0E1B1F;
  --ink-soft: #33474D;
  --ink-mute: #6A7D83;
  --line: #E2E0D7;
  --line-soft: #EFEDE3;
  --paper: #F7F4EB;
  --paper-2: #FBF9F2;
  --card: #FFFFFF;
  --accent: #0F4C5C;
  --accent-2: #135A6D;
  --accent-soft: #E4EEF0;
  --accent-ink: #073642;
  --bn: #9A3412;
  --bn-soft: #FBE9DF;
  --ok: #1F7A3A;
  --warn: #B45309;
  --danger: #B91C1C;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(14,27,31,.04), 0 2px 8px rgba(14,27,31,.04);
  --shadow-2: 0 8px 24px rgba(14,27,31,.08), 0 2px 6px rgba(14,27,31,.05);
  --shadow-3: 0 24px 60px rgba(14,27,31,.14);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-bn: 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
}

[data-theme="dark"] {
  --ink: #F0EEE5;
  --ink-soft: #C8CBC9;
  --ink-mute: #8A9490;
  --line: #253134;
  --line-soft: #1A2426;
  --paper: #0B1416;
  --paper-2: #0F1A1D;
  --card: #152124;
  --accent: #5EC2D9;
  --accent-2: #7BD1E5;
  --accent-soft: #183239;
  --accent-ink: #CDEAF1;
  --bn: #F59E6B;
  --bn-soft: #2A1B10;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.3);
  --shadow-2: 0 8px 24px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
  --shadow-3: 0 24px 60px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
}
img, video, svg { max-width: 100%; height: auto; }
input, select, textarea { font-size: 16px; } /* prevent iOS zoom on focus */

/* === MOBILE OPTIMIZATION === */
@media (max-width: 640px) {
  .screen {
    padding: 24px 16px 80px !important;
  }
  header {
    padding: 12px 14px !important;
  }
  header > button > div > div:first-child {
    font-size: 15px !important;
  }
  header > button > div > div:last-child {
    font-size: 9.5px !important;
    letter-spacing: 0.04em !important;
  }
  h1, .screen h1 {
    font-size: clamp(24px, 8vw, 36px) !important;
    line-height: 1.1 !important;
  }
}

@media (max-width: 400px) {
  .screen {
    padding: 20px 12px 72px !important;
  }
  header {
    padding: 10px 12px !important;
  }
  header > button > div > div:first-child {
    font-size: 14px !important;
  }
  h1, .screen h1 {
    font-size: clamp(22px, 7vw, 30px) !important;
  }
}

/* Language chip / direction bar compacting */
@media (max-width: 520px) {
  /* Hide the English subtitle on chips */
  .lang-chip-sub { display: none !important; }
  /* Tighten direction bar gap and padding */
  .direction-bar { gap: 6px !important; padding: 6px 8px !important; max-width: 100% !important; }
  .lang-chip { padding: 6px 10px !important; gap: 6px !important; font-size: 13px !important; }
}

:lang(bn), .bn { font-family: var(--font-bn); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font-family: inherit; color: inherit; }

#root { min-height: 100vh; min-height: 100dvh; }
#tts-audio { display: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.screen { animation: fadeUp .36s ease both; }

@keyframes subtlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes micRing {
  0% { transform: scale(1); opacity: .5; }
  100% { transform: scale(1.35); opacity: 0; }
}

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 6px;
}

@media (max-width: 560px) {
  .nav-label { display: none; }
}
