:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --panel: rgba(255, 255, 255, 0.92);
  --user: #2563eb;
  --bot: #fff7ed;
  --accent: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --bg1: #a7f3d0;
  --bg2: #93c5fd;
  --hair: #7c2d12;
  --skin: #fde68a;
  --dress: #fb7185;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Noto Sans Bengali", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100%;
}
body.theme-meadow { --bg1: #bbf7d0; --bg2: #86efac; --dress: #fb7185; }
body.theme-classroom-yellow { --bg1: #fde68a; --bg2: #fdba74; --dress: #f97316; }
body.theme-space { --bg1: #1e3a8a; --bg2: #312e81; color: #f8fafc; --panel: rgba(15,23,42,0.88); --bot: #1e293b; --ink: #f8fafc; --muted: #cbd5e1; --dress: #60a5fa; --skin: #fcd34d; }
body.theme-ocean { --bg1: #67e8f9; --bg2: #38bdf8; --dress: #14b8a6; }
body.theme-city-lab { --bg1: #ddd6fe; --bg2: #c4b5fd; --dress: #a855f7; }

.app {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px;
  gap: 12px;
}
header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.brand { font-weight: 800; font-size: 1.1rem; }
.brand-home {
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: inherit;
}
.brand-home:hover,
.brand-home:focus-visible {
  text-decoration: underline;
  outline: none;
}
.meter {
  display: flex; gap: 10px; align-items: center; font-size: 0.9rem; color: var(--muted);
}
.meter .pill {
  background: #ecfccb; color: #166534; padding: 4px 10px; border-radius: 999px; font-weight: 700;
}
body.theme-space .meter .pill { background: #14532d; color: #bbf7d0; }
.student-pill, .score-pill, .streak-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}
.student-pill { background: #ede9fe; color: #6d28d9; }
.score-pill { background: #fef3c7; color: #92400e; }
.streak-pill { background: #ffedd5; color: #c2410c; }

.stage {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
  min-height: 0;
}
@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }
}

/* ---------- Mobile-first adjustments ---------- */
@media (max-width: 640px) {
  .app { padding: 8px; gap: 8px; }
  header.top {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 14px;
    position: sticky;
    top: 8px;
    z-index: 20;
  }
  .brand { font-size: 0.95rem; }
  .meter { font-size: 0.8rem; gap: 6px; flex-wrap: wrap; }
  .stage {
    gap: 8px;
    grid-template-columns: 1fr;
  }
  .panel { min-height: 0; border-radius: 16px; }
  .character-wrap { min-height: 34vh; max-height: 38vh; }
  .character { width: min(180px, 55%); }
  /* Character-only focus on mobile — no chat */
  .page-talk .desktop-chat,
  .page-talk .desktop-only,
  .page-talk .talk-nav .site-links { display: none !important; }
  /* Hide top site header (মিরা / গেমস) on mobile talk */
  .page-talk .talk-nav { display: none !important; }
  .page-talk .app {
    grid-template-rows: auto 1fr auto;
    min-height: 100dvh;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .page-talk .stage { height: 100%; }
  .page-talk .character-wrap {
    min-height: calc(100dvh - 168px);
    max-height: none;
    height: 100%;
  }
  .page-talk .character { width: min(280px, 78%); }
  .page-talk header.top {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }
  .page-talk header.top .brand {
    font-size: 0.82rem;
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page-talk header.top .brand-home {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page-talk header.top .meter {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    font-size: 0.78rem;
  }
  .page-talk header.top .meter .pill {
    padding: 3px 8px;
    font-size: 0.78rem;
    flex: 0 0 auto;
  }
  .page-talk header.top .meter span:not(.pill):not(#statusText) { display: none; }
  .page-talk header.top .meter .net-pill,
  .page-talk header.top #btnNetStatus { display: none !important; }
  .page-talk header.top #statusText {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
  }
  .page-talk .controls {
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
  }
  .page-talk .power-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0;
    max-width: 132px;
    min-height: 36px;
    height: 36px;
    padding: 6px 14px;
    font-size: 0.88rem;
    font-weight: 800;
    border-radius: 999px;
    background: #0f5132;
    color: #fff;
    align-self: center;
    margin-inline: auto;
  }
  /* Credit btn hidden → keep পাঠ চালু compact (never full-bar) */
  .page-talk .power-btn.is-solo {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 112px;
    max-width: 132px;
    min-height: 36px;
    height: 36px;
    font-size: 0.88rem;
    letter-spacing: 0.01em;
    margin-inline: auto;
  }
  .page-talk .controls.needs-credit .power-btn {
    flex: 0 0 auto !important;
    min-width: 100px;
    max-width: 120px;
  }
  .page-talk .power-btn.is-on {
    background: #b91c1c;
  }
  .chat { min-height: 38vh; }
  #messages { padding: 10px; }
  .bubble { max-width: 88%; font-size: 0.94rem; }
  .controls {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    padding: 10px;
    border-radius: 14px;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.1);
  }
  button:not(.power-btn), .btn { padding: 13px 16px; font-size: 0.98rem; flex: 1 1 auto; min-height: 48px; }
  .modal { padding: 16px; border-radius: 16px; }
  .listen-rings span { width: 150px; height: 150px; }
  .intent-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intent-bar button { min-height: 42px; font-size: .9rem; padding: 8px; }
}

.power-btn { display: none; }

@media (min-width: 641px) {
  .page-talk .desktop-chat { display: flex; }
  .page-talk .power-btn { display: none !important; }
}

/* Desktop talk: fill viewport — conversation column stretches full height */
@media (min-width: 641px) {
  body.page-talk {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  body.page-talk .talk-nav {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
  }
  body.page-talk .app {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 1180px;
    height: 100%;
    overflow: hidden;
    padding: 10px 14px 12px;
    gap: 10px;
  }
  body.page-talk .stage {
    grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.2fr);
    align-items: stretch;
    min-height: 0;
    height: 100%;
  }
  body.page-talk .panel {
    min-height: 0;
    height: 100%;
  }
  body.page-talk .character-wrap {
    min-height: 0;
  }
  body.page-talk .desktop-chat.chat {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  body.page-talk .desktop-chat .chat-head {
    flex: 0 0 auto;
  }
  body.page-talk .desktop-chat #messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 18px 20px;
    gap: 12px;
    scrollbar-gutter: stable;
  }
  body.page-talk .desktop-chat .bubble {
    max-width: 92%;
    font-size: 1.02rem;
    line-height: 1.5;
  }
  body.page-talk .desktop-chat .meta {
    max-width: 92%;
  }
  body.page-talk .controls {
    flex-shrink: 0;
  }
}

.panel {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
  overflow: hidden;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.character-wrap {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding-bottom: 4.5rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.35), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.2), transparent 35%);
}

/* ---- Mood animated background (kids joy) ---- */
.mira-mood-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.mood-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: orbDrift 9s ease-in-out infinite;
}
.mood-orb.orb-a {
  width: 42%;
  height: 36%;
  left: -8%;
  top: 8%;
  background: radial-gradient(circle, #fce7f3 0%, transparent 70%);
}
.mood-orb.orb-b {
  width: 48%;
  height: 40%;
  right: -10%;
  top: 18%;
  background: radial-gradient(circle, #dbeafe 0%, transparent 70%);
  animation-delay: -3s;
  animation-duration: 11s;
}
.mood-orb.orb-c {
  width: 36%;
  height: 32%;
  left: 30%;
  bottom: 6%;
  background: radial-gradient(circle, #fef9c3 0%, transparent 70%);
  animation-delay: -5s;
  animation-duration: 10s;
}
.mood-sun {
  position: absolute;
  top: 8%;
  right: 10%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a, #fbbf24 60%, transparent 72%);
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.55);
  animation: sunPulse 4s ease-in-out infinite;
}
.mood-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 40px;
  filter: blur(0.2px);
  animation: cloudDrift 18s linear infinite;
}
.mood-cloud::before,
.mood-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.mood-cloud.cloud-a {
  width: 70px;
  height: 22px;
  top: 18%;
  left: -20%;
}
.mood-cloud.cloud-a::before {
  width: 28px;
  height: 28px;
  top: -14px;
  left: 12px;
}
.mood-cloud.cloud-a::after {
  width: 36px;
  height: 36px;
  top: -18px;
  left: 32px;
}
.mood-cloud.cloud-b {
  width: 56px;
  height: 18px;
  top: 28%;
  left: -30%;
  animation-duration: 24s;
  animation-delay: -8s;
  opacity: 0.65;
}
.mood-cloud.cloud-b::before {
  width: 22px;
  height: 22px;
  top: -10px;
  left: 10px;
}
.mood-cloud.cloud-b::after {
  width: 28px;
  height: 28px;
  top: -14px;
  left: 26px;
}
.mood-bit {
  position: absolute;
  font-size: clamp(1.1rem, 3.5vw, 1.7rem);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  animation: bitFloat 5.5s ease-in-out infinite;
  opacity: 0.9;
}
.mood-bit.bit-1 { left: 8%; top: 42%; animation-delay: 0s; }
.mood-bit.bit-2 { left: 18%; top: 62%; animation-delay: 0.8s; }
.mood-bit.bit-3 { right: 12%; top: 48%; animation-delay: 1.4s; }
.mood-bit.bit-4 { right: 22%; top: 68%; animation-delay: 2s; }
.mood-bit.bit-5 { left: 42%; top: 14%; animation-delay: 0.4s; font-size: 1.35rem; }
.mood-bit.bit-6 { right: 38%; bottom: 22%; animation-delay: 1.1s; }

@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -16px) scale(1.08); }
}
@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.12); opacity: 1; }
}
@keyframes cloudDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(140vw); }
}
@keyframes bitFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* Mood states on the stage */
.character-wrap.mood-listening .mood-orb { opacity: 0.7; animation-duration: 6s; }
.character-wrap.mood-listening .listen-rings { opacity: 1; }
.character-wrap.mood-speaking .mood-bit {
  animation-duration: 2.8s;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.45));
}
.character-wrap.mood-speaking .mood-sun {
  animation-duration: 2.2s;
  box-shadow: 0 0 36px rgba(251, 191, 36, 0.75);
}
.character-wrap.mood-celebrating .mood-bit {
  animation: bitCelebrate 0.9s ease-out infinite;
}
.character-wrap.mood-celebrating .mood-orb {
  opacity: 0.85;
  filter: blur(1px) saturate(1.3);
}
.character-wrap.mood-waiting .mood-orb {
  animation-duration: 3.5s;
  opacity: 0.65;
}
.character-wrap.mood-retry .mira-mood-bg {
  filter: saturate(0.85);
}
@keyframes bitCelebrate {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-22px) scale(1.25) rotate(18deg); }
}

.scene-decor {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.scene-decor span {
  position: absolute;
  font-size: clamp(2.5rem, 7vw, 5rem);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.12));
  animation: decorFloat 3.5s ease-in-out infinite;
}
.scene-decor span:nth-child(1) { left: 6%; top: 12%; }
.scene-decor span:nth-child(2) { right: 7%; top: 17%; animation-delay: .7s; }
.scene-decor span:nth-child(3) { right: 14%; bottom: 15%; animation-delay: 1.4s; }
.scene-decor span.scene-extra {
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  opacity: 0.85;
}
.scene-decor span:nth-child(4) { left: 12%; bottom: 28%; animation-delay: 0.3s; animation-duration: 4.2s; }
.scene-decor span:nth-child(5) { right: 28%; top: 10%; animation-delay: 1.8s; animation-duration: 4.8s; }
.topic-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: 88%;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  color: #334155;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  animation: badgePop 0.55s ease;
}
@keyframes badgePop {
  0% { transform: translateX(-50%) scale(0.86); opacity: 0.4; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes decorFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg) scale(1); }
  50% { transform: translateY(-12px) rotate(5deg) scale(1.06); }
}

/* Activity-driven full character-panel scenes. */
.character-wrap.scene-rainbow { background: linear-gradient(145deg,#bae6fd,#fbcfe8,#fef3c7); }
.character-wrap.scene-moon,
.character-wrap.scene-space,
.character-wrap.scene-stars { background: radial-gradient(circle at 70% 20%,#fef9c3 0 7%,transparent 8%),linear-gradient(#172554,#312e81); }
.character-wrap.scene-garden,
.character-wrap.scene-forest,
.character-wrap.scene-jungle,
.character-wrap.scene-orchard,
.character-wrap.scene-treehouse { background: linear-gradient(#a5f3fc 0 48%,#86efac 49% 100%); }
.character-wrap.scene-ocean,
.character-wrap.scene-river,
.character-wrap.scene-pond { background: linear-gradient(#bae6fd 0 42%,#38bdf8 43%,#0369a1); }
.character-wrap.scene-train,
.character-wrap.scene-market,
.character-wrap.scene-classroom,
.character-wrap.scene-letters,
.character-wrap.scene-clockroom { background: linear-gradient(145deg,#fef3c7,#fed7aa); }
.character-wrap.scene-sunny,
.character-wrap.scene-sky,
.character-wrap.scene-playground,
.character-wrap.scene-picnic { background: linear-gradient(#7dd3fc 0 60%,#bef264 61%); }
.character-wrap.scene-home,
.character-wrap.scene-bakery,
.character-wrap.scene-candy { background: linear-gradient(145deg,#fce7f3,#fef3c7); }
.character-wrap.scene-farm { background: linear-gradient(#bae6fd 0 55%,#fde68a 56%); }
.character-wrap.scene-blocks,
.character-wrap.scene-mystery { background: linear-gradient(145deg,#ddd6fe,#bfdbfe); }

.character-wrap.scene-rhyme .character { transform: scale(.94); }
.character-wrap.scene-math .character { transform: scale(1.02); }
body.intent-rhyme .character.speaking { animation: rhymeDance .8s ease-in-out infinite; }
@keyframes rhymeDance {
  25% { transform: rotate(-3deg) translateY(-4px); }
  75% { transform: rotate(3deg) translateY(-4px); }
}
.ground {
  position: absolute; bottom: 0; left: 0; right: 0; height: 28%;
  background: linear-gradient(transparent, rgba(0,0,0,0.08));
  z-index: 1;
}
.character {
  width: min(280px, 70%);
  transition: transform 0.25s ease, filter 0.3s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
  z-index: 3;
  filter: drop-shadow(0 10px 16px rgba(15, 23, 42, 0.14));
}
.character.idle { animation: breathe 2.2s ease-in-out infinite; }
.character .eye-l, .character .eye-r {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4s ease-in-out infinite;
}
.character .eye-spark-l,
.character .eye-spark-r {
  transform-box: fill-box;
  transform-origin: center;
  animation: eyeTwinkle 2.8s ease-in-out infinite;
}
.character .arm-l, .character .arm-r {
  transform-box: fill-box;
  transform-origin: top center;
}
.character .mira-bow {
  transform-box: fill-box;
  transform-origin: center;
  animation: bowBob 2.6s ease-in-out infinite;
}
.character .blush-l,
.character .blush-r {
  animation: blushPulse 3.2s ease-in-out infinite;
}
.character .ear-l,
.character .ear-r {
  animation: earringSwing 2.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: top center;
}
.character .mira-glasses {
  animation: glassesShine 5s ease-in-out infinite;
}
.character.listening { animation: bounce 1.2s ease-in-out infinite; }
.character.listening .arm-r { animation: waveHand 0.7s ease-in-out infinite; }
.character.listening .brow-l,
.character.listening .brow-r {
  animation: browUp 1.2s ease-in-out infinite;
}
.character.waiting { animation: waitPulse 1.6s ease-in-out infinite; }
.character.thinking { animation: sway 1.4s ease-in-out infinite; }
.character.thinking .mira-glasses { animation: glassesThink 1.4s ease-in-out infinite; }
.character.speaking {
  animation: speakBob 0.9s ease-in-out infinite;
}
.character.speaking .mouth { animation: talk 0.28s ease-in-out infinite; }
.character.speaking .arm-l,
.character.speaking .arm-r { animation: talkArms 0.55s ease-in-out infinite; }
.character.speaking .mira-bow { animation: bowBob 0.7s ease-in-out infinite; }
.character.celebrating { animation: celebrate 0.7s ease; }
.character.celebrating .mira-bow { animation: bowSpin 0.7s ease; }
.character.retry { animation: shake 0.45s ease; }
.character.wave-hi {
  animation: miraJump 0.65s ease !important;
}
.character.wave-hi .arm-r {
  animation: waveHand 0.35s ease-in-out 3 !important;
}
.character.clap-fun {
  animation: miraJump 0.55s ease !important;
}
.character.clap-fun .arm-l,
.character.clap-fun .arm-r {
  animation: clapArms 0.28s ease-in-out 4 !important;
}
.character.wiggle-fun {
  animation: wiggleBody 0.7s ease !important;
}
.character.heart-fun {
  animation: miraJump 0.6s ease !important;
}
.character.heart-fun .mouth {
  animation: smileBig 0.6s ease !important;
}
@keyframes bounce { 50% { transform: translateY(-8px); } }
@keyframes waitPulse {
  0%, 100% { transform: scale(1) translateY(0); filter: brightness(1) drop-shadow(0 10px 16px rgba(15, 23, 42, 0.14)); }
  50% { transform: scale(1.03) translateY(-4px); filter: brightness(1.08) drop-shadow(0 14px 20px rgba(15, 23, 42, 0.18)); }
}
@keyframes breathe { 50% { transform: translateY(-4px) scale(1.01); } }
@keyframes speakBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.02); }
}
@keyframes blink { 0%,45%,49%,100% { transform: scaleY(1); } 47% { transform: scaleY(.08); } }
@keyframes eyeTwinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.25); }
}
@keyframes bowBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(4deg); }
}
@keyframes bowSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(18deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes blushPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}
@keyframes earringSwing {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg); }
}
@keyframes glassesShine {
  0%, 80%, 100% { opacity: 0.88; }
  90% { opacity: 1; filter: brightness(1.25); }
}
@keyframes glassesThink {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes browUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes sway { 50% { transform: rotate(-3deg); } }
@keyframes talk { 50% { transform: scaleY(0.55); } }
@keyframes celebrate { 30% { transform: translateY(-18px) scale(1.05); } 100% { transform: none; } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes waveHand {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-42deg); }
}
@keyframes talkArms {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(8deg); }
}
@keyframes clapArms {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(28deg); }
}
@keyframes miraJump {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-18px) scale(1.06); }
  70% { transform: translateY(-4px) scale(1.02); }
}
@keyframes wiggleBody {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-8deg) translateY(-4px); }
  40% { transform: rotate(8deg) translateY(-8px); }
  60% { transform: rotate(-6deg) translateY(-2px); }
  80% { transform: rotate(5deg); }
}
@keyframes smileBig {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50% { transform: scaleY(1.35) scaleX(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .mira-mood-bg *,
  .scene-decor span,
  .character,
  .character * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.mira-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}
.mira-sparks i {
  position: absolute;
  left: 50%;
  top: 42%;
  font-style: normal;
  font-size: 1.4rem;
  animation: sparkFly 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), var(--dy, -80px)) scale(1.2); }
}

/* Network quality pill (room noise vs human voice is separate — this is link health) */
.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: #e2e8f0;
  color: #334155;
  line-height: 1.2;
}
.net-pill .net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.5);
}
.net-pill.net-offline { background: #fee2e2; color: #991b1b; }
.net-pill.net-offline .net-dot { background: #ef4444; }
.net-pill.net-connecting { background: #fef3c7; color: #92400e; }
.net-pill.net-connecting .net-dot {
  background: #f59e0b;
  animation: netPulse 1s ease-in-out infinite;
}
.net-pill.net-good { background: #dcfce7; color: #166534; }
.net-pill.net-good .net-dot { background: #22c55e; }
.net-pill.net-slow { background: #ffedd5; color: #9a3412; }
.net-pill.net-slow .net-dot { background: #f97316; }
.net-pill.net-reconnecting { background: #fef3c7; color: #92400e; }
.net-pill.net-reconnecting .net-dot {
  background: #f59e0b;
  animation: netPulse 0.7s ease-in-out infinite;
}
@keyframes netPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* Auto-send status (পাঠাও button removed) */
.voice-send-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(5, 150, 105, 0.28);
  pointer-events: none;
  animation: voiceSendPop 0.28s ease-out;
}
.voice-send-status.hidden { display: none !important; }
.voice-send-status.is-waiting {
  background: linear-gradient(135deg, #ca8a04, #eab308);
}
.voice-send-status.is-sending {
  background: linear-gradient(135deg, #0369a1, #0ea5e9);
}
.voice-send-status.is-sent {
  background: linear-gradient(135deg, #15803d, #22c55e);
}
.voice-send-status .voice-send-icon { font-size: 0.95rem; }
@keyframes voiceSendPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Legacy পাঠাও — kept hidden if old cache still injects it */
.send-voice-btn { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .character.listening, .character.waiting, .character.thinking, .character.speaking .mouth,
  .character.celebrating, .character.retry, .character.idle,
  .character .eye-l, .character .eye-r,
  .character.listening .arm-r, .character.speaking .arm-l, .character.speaking .arm-r,
  .character.wave-hi, .character.clap-fun, .character.wiggle-fun, .character.heart-fun {
    animation: none !important;
  }
}

/* Pulsing rings while Mira is listening to the child */
.listen-rings {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
  z-index: 2;
}
body.is-listening .listen-rings { display: grid; }
.listen-rings span {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 3px solid rgba(22, 163, 74, 0.45);
  animation: ringPulse 1.6s ease-out infinite;
}
.listen-rings span:nth-child(2) { animation-delay: 0.5s; }
.listen-rings span:nth-child(3) { animation-delay: 1s; }
@keyframes ringPulse {
  from { transform: scale(0.75); opacity: 0.9; }
  to { transform: scale(1.35); opacity: 0; }
}

/* Waiting dots while AI processes */
.wait-dots {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 8px;
  z-index: 6;
}
body.is-waiting .wait-dots { display: flex; }
.wait-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0f5132;
  opacity: 0.35;
  animation: waitDot 1.1s ease-in-out infinite;
}
.wait-dots i:nth-child(2) { animation-delay: 0.18s; }
.wait-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes waitDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
  40% { transform: translateY(-7px); opacity: 1; }
}

.emotion-caption {
  position: absolute;
  bottom: 12px;
  font-weight: 700;
  color: var(--muted);
  z-index: 5;
}
body.is-listening .emotion-caption,
body.is-hearing-voice .emotion-caption {
  bottom: 72px;
}

/* Live Bangla captions — what the child is saying right now */
.live-caption-wrap {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  width: min(92%, 340px);
  z-index: 7;
  pointer-events: none;
  text-align: center;
}
body.is-listening .live-caption-wrap,
body.is-hearing-voice .live-caption-wrap {
  bottom: 108px;
}
.live-caption-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.live-caption-label.hidden { display: none; }
.live-caption {
  min-height: 1.35em;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 14px;
  font-weight: 800;
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  line-height: 1.35;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid transparent;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  word-break: break-word;
}
.live-caption.has-text,
.live-caption.hearing {
  opacity: 1;
}
.live-caption.hearing:not(.has-text) {
  color: #64748b;
  font-weight: 700;
  font-size: 0.92rem;
}
body.is-hearing-voice .live-caption {
  border-color: rgba(22, 163, 74, 0.55);
  transform: translateY(-2px);
}
.voice-meter {
  display: none;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  height: 14px;
  align-items: flex-end;
}
body.is-listening .voice-meter,
body.is-hearing-voice .voice-meter,
body.is-waiting .voice-meter,
body.is-noise-gated .voice-meter {
  display: flex;
}
.voice-meter.is-hot {
  transform: scale(1.08);
}
.voice-meter i {
  display: block;
  width: 5px;
  height: 4px;
  border-radius: 2px;
  background: #94a3b8;
  transform-origin: bottom;
  transition: height 0.06s linear, background 0.12s ease, opacity 0.12s ease;
}
body.is-noise-gated:not(.is-hearing-voice) .voice-meter i {
  background: #94a3b8;
}
body.is-mic-open .voice-meter i,
body.is-hearing-voice .voice-meter i {
  background: #16a34a;
}

@media (prefers-reduced-motion: reduce) {
  .live-caption { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .listen-rings span { animation: none; opacity: 0.5; }
  .wait-dots i { animation: none; }
  .scene-decor span,
  body.intent-rhyme .character.speaking { animation: none; }
}

.chat {
  display: flex; flex-direction: column; min-height: 0;
}
.chat-head {
  padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.06); font-weight: 700;
}
#messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.row { display: flex; width: 100%; }
.row.user { justify-content: flex-end; }
.row.assistant { justify-content: flex-start; }
.bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: 0.98rem;
  white-space: pre-wrap;
}
.row.user .bubble { background: var(--user); color: #fff; border-bottom-right-radius: 4px; }
.row.assistant .bubble { background: var(--bot); color: var(--ink); border-bottom-left-radius: 4px; }
.label { font-size: 0.75rem; color: var(--muted); margin-bottom: 3px; }
.word-in {
  display: inline-block;
  animation: wordIn 0.32s ease both;
}
@keyframes wordIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.row.assistant .bubble.speaking-glow {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.35);
}
@media (prefers-reduced-motion: reduce) {
  .word-in { animation: none; }
}
.meta { display: flex; flex-direction: column; max-width: 78%; }
.row.user .meta { align-items: flex-end; }
.row.assistant .meta { align-items: flex-start; }

.controls {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  background: var(--panel); border-radius: 18px; padding: 12px;
}
.intent-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}
.intent-bar button {
  background: #fff;
  color: #334155;
  border: 2px solid rgba(37,99,235,.15);
  padding: 9px 8px;
}
.intent-bar button:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
.intent-bar button.active {
  border-color: #0f766e;
  background: #ccfbf1;
  color: #115e59;
}
button, .btn {
  border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 800;
  font-size: 1rem; cursor: pointer; font-family: inherit;
}
button.primary { background: var(--accent); color: white; }
button.secondary { background: #e5e7eb; color: #111827; }
button.danger { background: var(--danger); color: white; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.hidden { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: grid; place-items: center; z-index: 50; padding: 16px;
}
.modal {
  width: min(520px, 100%);
  background: white; color: #111827;
  border-radius: 22px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal h2 { margin-bottom: 8px; }
.modal p, .modal label { color: #4b5563; font-size: 0.95rem; margin-bottom: 10px; display: block; }
.pay-success-box {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 8px;
}
.pay-success-box p { color: #065f46; margin-bottom: 6px; }
.pay-success-box .muted { color: #047857; font-size: 0.9rem; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid #d1d5db; margin-bottom: 12px; font-size: 1rem; font-family: inherit;
}
.checks label { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.checks input { width: auto; margin-top: 4px; }
.err { color: #b91c1c; font-size: 0.9rem; min-height: 1.2em; }

/* --- Onboarding gates: privacy → school → class --- */
.gate-backdrop {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(56, 189, 248, 0.35), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(251, 191, 36, 0.28), transparent 40%),
    rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  z-index: 60;
  align-items: start;
  overflow-y: auto;
  padding: 24px 16px;
}
.gate-card {
  width: min(560px, 100%);
  border-radius: 28px;
  padding: 26px 22px 22px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.35);
  animation: gateIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.gate-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f766e;
  background: #ccfbf1;
  border-radius: 999px;
  padding: 5px 10px;
  margin-bottom: 10px;
}
.gate-lead {
  color: #64748b !important;
  line-height: 1.45;
  margin-bottom: 16px !important;
}
.gate-cta {
  margin-top: 4px;
  border-radius: 14px !important;
  padding: 13px 16px !important;
  font-weight: 700;
}
.gate-back {
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 600;
  padding: 0;
  margin-bottom: 8px;
  cursor: pointer;
}

.privacy-points {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 520px) {
  .privacy-points { grid-template-columns: repeat(3, 1fr); }
}
.privacy-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: start;
  margin-bottom: 16px;
}
.privacy-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: linear-gradient(145deg, #fef3c7, #fda4af);
  box-shadow: 0 8px 20px rgba(251, 113, 133, 0.25);
}
.privacy-hero-text { min-width: 0; }
.privacy-hero-text h2 { margin: 0 0 4px; font-size: 1.35rem; color: #0f172a; }
.voice-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.voice-play-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #0f766e;
  background: linear-gradient(90deg, #ccfbf1, #e0f2fe);
  border-radius: 999px;
  padding: 10px 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.voice-play-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2); }
.voice-play-btn.is-playing {
  background: linear-gradient(90deg, #99f6e4, #bae6fd);
  animation: voicePulse 1.2s ease-in-out infinite;
}
.voice-play-btn.needs-tap {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #92400e;
  animation: voicePulse 1.2s ease-in-out infinite;
}
.voice-stop-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
  background: #dc2626;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.35);
  transition: transform 0.12s, filter 0.12s;
}
.voice-stop-btn:hover { filter: brightness(1.08); transform: scale(1.04); }
.voice-stop-btn:active { transform: scale(0.96); }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
}
.privacy-point {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
}
.privacy-point span { font-size: 1.25rem; line-height: 1; }
.privacy-point strong { display: block; color: #0f172a; font-size: 0.88rem; }
.privacy-point small { color: #64748b; font-size: 0.78rem; line-height: 1.3; }
.privacy-policy {
  background: #f1f5f9;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #334155;
}
.privacy-policy summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
}
.privacy-policy #consentBody {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 140px;
  overflow-y: auto;
}
.privacy-check-hint {
  font-size: 0.82rem !important;
  color: #64748b !important;
  margin-bottom: 8px !important;
}
.privacy-checks {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.privacy-check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 16px;
  padding: 14px 14px;
  cursor: pointer;
  font: inherit;
  color: #0f172a;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.privacy-check-row:hover {
  border-color: #67e8f9;
  background: #f0fdfa;
}
.privacy-check-row.is-on {
  border-color: #14b8a6;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.privacy-check-row.optional.is-on {
  border-color: #38bdf8;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}
.check-box {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid #94a3b8;
  flex-shrink: 0;
  margin-top: 1px;
  background: #fff;
  position: relative;
}
.privacy-check-row.is-on .check-box {
  border-color: #0d9488;
  background: #14b8a6;
}
.privacy-check-row.is-on .check-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-text { flex: 1; font-size: 0.92rem; line-height: 1.4; }
.check-text em { font-style: normal; color: #64748b; font-size: 0.85em; }
.privacy-rel-label {
  display: block;
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 6px;
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.school-pick {
  display: grid;
  gap: 12px;
}
.school-card {
  text-align: left;
  border: 2px solid #e2e8f0;
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  padding: 18px 16px;
  cursor: pointer;
  font: inherit;
  color: #0f172a;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.school-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.18);
}
.school-emoji { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.school-card strong { display: block; font-size: 1.15rem; margin-bottom: 4px; }
.school-card small { display: block; color: #64748b; font-size: 0.86rem; line-height: 1.35; }
.school-ages {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 999px;
  padding: 4px 10px;
}
#pickPreschool:hover { border-color: #f59e0b; box-shadow: 0 12px 28px rgba(245, 158, 11, 0.18); }
#pickPrimary:hover { border-color: #2563eb; box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18); }

@media (min-width: 560px) {
  .school-pick { grid-template-columns: 1fr 1fr; }
}

.religion-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
  width: 100%;
}
.rel-hint {
  margin: -4px 0 8px !important;
  font-size: 0.82rem !important;
  color: #64748b !important;
}
.req-star { color: #dc2626; font-weight: 800; }
.religion-card {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  text-align: left;
  border: 2px solid #e2e8f0 !important;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%) !important;
  border-radius: 18px !important;
  padding: 14px 14px !important;
  cursor: pointer;
  font: inherit;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.religion-card .rel-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: #f1f5f9;
  flex-shrink: 0;
}
.religion-card .rel-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.religion-card strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.religion-card small {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 500;
}
.religion-card .rel-check {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: transparent;
  background: #e2e8f0;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.religion-card:hover {
  border-color: #34d399 !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.12);
}
.religion-card:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.45);
  outline-offset: 2px;
}
.religion-card.active,
.religion-card[aria-checked="true"] {
  border-color: #059669 !important;
  background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%) !important;
  box-shadow:
    0 0 0 3px rgba(5, 150, 105, 0.22),
    0 12px 28px rgba(5, 150, 105, 0.14);
}
.religion-card.active .rel-icon,
.religion-card[aria-checked="true"] .rel-icon {
  background: #a7f3d0;
}
.religion-card.active .rel-check,
.religion-card[aria-checked="true"] .rel-check {
  color: #fff;
  background: #059669;
  transform: scale(1.05);
}
.profile-gate {
  background:
    linear-gradient(180deg, #ffffff 0%, #f0fdf4 120%);
}
.profile-gate .gate-cta {
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.28);
}
.privacy-rel-label {
  font-weight: 700;
  color: #0f172a !important;
  margin-bottom: 4px !important;
}

.grade-grid {
  display: grid; gap: 8px; margin: 12px 0;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}
.grade-btn {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px;
  background: #eff6ff; border-radius: 14px; padding: 12px 14px; cursor: pointer;
  border: 2px solid transparent;
}
.grade-btn:hover, .grade-btn.active { border-color: #2563eb; background: #dbeafe; }
.grade-btn-body { flex: 1; min-width: 0; }
.grade-btn-body strong { display: block; margin-bottom: 2px; }
.grade-age {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 6px;
}
.grade-btn-arrow { color: #64748b; margin-top: 2px; flex-shrink: 0; }
.subject-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.subject-chip {
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #1e3a8a;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 8px;
}
.grade-btn.active .subject-chip {
  border-color: #93c5fd;
  background: #fff;
}

/* --- Dynamic ask card (Mira speaks, then the input appears) --- */
.ask-card {
  position: absolute;
  left: 50%; bottom: 44px;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 24px));
  background: rgba(255,255,255,0.97);
  color: #111827;
  border-radius: 20px;
  border: 3px solid #fbbf24;
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
  z-index: 20;
  animation: askPop .45s cubic-bezier(.34,1.56,.64,1);
}
@keyframes askPop {
  from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.ask-bubble { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.ask-bubble > span { font-size: 1.8rem; animation: bounce 1.4s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.ask-title { font-weight: 800; font-size: 1.02rem; }
.ask-text { color: #4b5563; font-size: 0.88rem; margin-top: 2px; }
.ask-card input {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 2px solid #d1d5db; font-size: 1.05rem; font-family: inherit;
  margin-bottom: 6px;
}
.ask-card input:focus { border-color: var(--accent); outline: none; }
.ask-card.step-code input {
  text-align: center; letter-spacing: 0.5em; font-weight: 800; font-size: 1.3rem;
}
.ask-actions { display: flex; gap: 8px; }
.ask-actions .primary { flex: 1; }
@media (max-width: 720px) {
  .ask-card { bottom: 12px; }
}

.pay-mode-tabs {
  display: inline-flex;
  gap: 0;
  margin: 0 0 0.75rem;
  border: 1.5px solid var(--line, #d5e3d8);
  border-radius: 999px;
  overflow: hidden;
}
.pay-mode-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  color: var(--muted, #5b6b60);
}
.pay-mode-btn.is-active {
  background: var(--leaf, #1f7a4d);
  color: #fff;
}
