/* Shared premium shell for Mira kids games — mobile + desktop */
@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --g-font: "Fredoka", "Noto Sans Bengali", "Hind Siliguri", system-ui, sans-serif;
  --g-text: #f8fafc;
  --g-muted: rgba(248, 250, 252, 0.78);
  --g-panel: rgba(15, 23, 42, 0.5);
  --g-radius: 22px;
  --g-tap: 48px;
  --g-accent: #38bdf8;
  --g-accent-2: #7dd3fc;
  --g-success: #34d399;
  --g-danger: #f87171;
  --g-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --g-glow: 0 0 40px color-mix(in srgb, var(--g-accent) 28%, transparent);
  --g-safe-top: env(safe-area-inset-top, 0px);
  --g-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { -webkit-text-size-adjust: 100%; }
body.game-body {
  font-family: var(--g-font);
  color: var(--g-text);
  min-height: 100dvh;
  min-height: 100vh;
  overflow-x: hidden;
  touch-action: manipulation;
  background: #0f172a;
  padding-bottom: var(--g-safe-bottom);
  position: relative;
}
body.game-body::before,
body.game-body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(40px);
  opacity: 0.55;
  animation: gFloatOrb 12s ease-in-out infinite alternate;
}
body.game-body::before {
  width: min(55vw, 320px);
  height: min(55vw, 320px);
  top: -8%;
  left: -10%;
  background: color-mix(in srgb, var(--g-accent) 55%, transparent);
}
body.game-body::after {
  width: min(45vw, 260px);
  height: min(45vw, 260px);
  bottom: 5%;
  right: -8%;
  background: color-mix(in srgb, var(--g-accent-2) 40%, transparent);
  animation-delay: -4s;
}
@keyframes gFloatOrb {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(18px, 24px) scale(1.08); }
}

body.theme-memory {
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(139, 92, 246, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 10%, rgba(244, 114, 182, 0.25), transparent 50%),
    linear-gradient(160deg, #1e1035 0%, #2a1548 45%, #15102a 100%);
  --g-accent: #a78bfa;
  --g-accent-2: #c4b5fd;
}
body.theme-math {
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(16, 185, 129, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 95% 5%, rgba(59, 130, 246, 0.3), transparent 50%),
    linear-gradient(160deg, #0c1e3a 0%, #12305a 50%, #0f2744 100%);
  --g-accent: #34d399;
  --g-accent-2: #6ee7b7;
}
body.theme-letters {
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(251, 146, 60, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 8%, rgba(250, 204, 21, 0.22), transparent 50%),
    linear-gradient(160deg, #3b1d0f 0%, #5c2e14 50%, #2a150c 100%);
  --g-accent: #fb923c;
  --g-accent-2: #fdba74;
}
body.theme-word {
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(45, 212, 191, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 10%, rgba(56, 189, 248, 0.25), transparent 50%),
    linear-gradient(160deg, #042f2e 0%, #0f4c5c 50%, #083344 100%);
  --g-accent: #2dd4bf;
  --g-accent-2: #5eead4;
}
body.theme-fruit {
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(244, 63, 94, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 8%, rgba(251, 191, 36, 0.28), transparent 50%),
    linear-gradient(160deg, #3f0d1c 0%, #7f1d1d 45%, #2a0a12 100%);
  --g-accent: #fb7185;
  --g-accent-2: #fda4af;
}
body.theme-rhyme-bn {
  background:
    radial-gradient(ellipse 70% 50% at 18% 0%, rgba(251, 146, 60, 0.4), transparent 55%),
    radial-gradient(ellipse 55% 40% at 92% 8%, rgba(244, 114, 182, 0.28), transparent 50%),
    linear-gradient(160deg, #2a1530 0%, #4c1d3d 45%, #1a1024 100%);
  --g-accent: #fb923c;
  --g-accent-2: #fdba74;
}
body.theme-rhyme-en {
  background:
    radial-gradient(ellipse 70% 50% at 18% 0%, rgba(56, 189, 248, 0.38), transparent 55%),
    radial-gradient(ellipse 55% 40% at 92% 8%, rgba(52, 211, 153, 0.28), transparent 50%),
    linear-gradient(160deg, #0b1f33 0%, #123a4a 45%, #0a1624 100%);
  --g-accent: #38bdf8;
  --g-accent-2: #7dd3fc;
}

/* Name-learn grids (color / animal) */
.learn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 440px;
  margin: 0 auto;
}
@media (min-width: 520px) {
  .learn-grid { grid-template-columns: repeat(4, 1fr); }
}
.learn-btn {
  aspect-ratio: 1;
  border-radius: 22px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-family: inherit;
  padding: 0;
}
.learn-btn:active {
  transform: translateY(5px) scale(0.96);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.learn-btn.selected {
  border-color: #fff;
  outline: 3px solid #fde68a;
  outline-offset: 2px;
}
.learn-btn .mini {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.learn-btn.light .mini {
  color: #1e1b4b;
  text-shadow: none;
}
.animal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.45rem 0.3rem 0.55rem;
  aspect-ratio: 1;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.22));
}
.animal-btn .emoji {
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  line-height: 1;
  display: block;
  margin: 0;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}
.animal-btn .mini {
  position: static;
  font-size: clamp(0.72rem, 2.8vw, 0.88rem);
  line-height: 1.15;
  padding: 0 0.2rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
.animal-btn .mini-en {
  display: block;
  font-size: clamp(0.58rem, 2.2vw, 0.7rem);
  font-weight: 600;
  opacity: 0.85;
  margin-top: 1px;
}
.learn-grid.animal-grid {
  max-width: 520px;
  gap: 14px;
}
@media (min-width: 520px) {
  .learn-grid.animal-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}
.learn-grid-huge {
  max-width: 560px;
  gap: 14px;
}
.learn-grid-huge .huge-btn .emoji,
.huge-btn .emoji {
  font-size: clamp(2.8rem, 13vw, 3.8rem);
}
.speak-emoji {
  font-size: clamp(3.4rem, 14vw, 4.6rem);
  line-height: 1;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}
.number-btn .num {
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 800;
  line-height: 1;
  display: block;
  margin-top: 22%;
}
.number-grid {
  max-width: 520px;
}
.count-stage {
  min-height: 72px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  line-height: 1;
}
.range-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.range-chips .g-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
.range-chips .g-btn.active {
  outline: 2px solid #fde68a;
}

.game-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(0.75rem + var(--g-safe-top)) 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 100dvh;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.game-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.55rem 0.45rem;
  backdrop-filter: blur(16px) saturate(1.2);
  background: rgba(15, 23, 42, 0.42);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.game-top .lang-toggle {
  display: inline-flex;
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.game-top .lang-toggle.lang-toggle--select {
  overflow: visible;
}
.game-top .lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent
    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='%23ffffff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 0.45rem center / 0.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.3rem 1.35rem 0.3rem 0.5rem;
  cursor: pointer;
  font-family: inherit;
  max-width: min(10.5rem, 40vw);
  border-radius: 999px;
}
.game-top .lang-select option {
  color: #111;
}
.game-top .lang-btn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-family: inherit;
}
.game-top .lang-btn.is-active {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.game-top h1 {
  flex: 1;
  text-align: center;
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  font-weight: 800;
  color: var(--g-accent-2);
  line-height: 1.2;
}

.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--g-tap);
  min-width: var(--g-tap);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  color: var(--g-text);
  font-family: var(--g-font);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}
.g-btn:hover { border-color: var(--g-accent); background: rgba(255, 255, 255, 0.14); }
.g-btn:active { transform: translateY(2px) scale(0.96); box-shadow: 0 1px 0 rgba(0,0,0,0.18); }
.g-btn-accent {
  background: linear-gradient(180deg, color-mix(in srgb, var(--g-accent) 92%, #fff), var(--g-accent));
  border-color: transparent;
  color: #0f172a;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--g-accent) 45%, #000), var(--g-glow);
}
.g-btn-accent:hover { filter: brightness(1.06); }
.g-btn-ghost { background: transparent; box-shadow: none; }

.g-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.g-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(0,0,0,0.22));
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.g-chip strong { color: var(--g-accent-2); font-variant-numeric: tabular-nums; }

.g-level-bar {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
}
.g-level-bar button {
  min-height: 42px;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: var(--g-muted);
  font-family: var(--g-font);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.g-level-bar button.active {
  color: #0f172a;
  background: var(--g-accent);
  border-color: transparent;
}

.g-stage {
  flex: 1;
  width: 100%;
  background: linear-gradient(165deg, rgba(255,255,255,0.08), rgba(15, 23, 42, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--g-radius);
  box-shadow: var(--g-shadow), inset 0 1px 0 rgba(255,255,255,0.08);
  padding: 1.1rem;
  position: relative;
  backdrop-filter: blur(10px);
}

.g-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 0.25rem auto 0;
  max-width: 280px;
}
.g-progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--g-accent), var(--g-accent-2));
  border-radius: inherit;
  transition: width 0.35s ease;
}

.g-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.g-modal.show { opacity: 1; pointer-events: auto; }
.g-modal-card {
  width: min(100%, 400px);
  text-align: center;
  padding: 1.85rem 1.4rem;
  border-radius: 28px;
  background: linear-gradient(165deg, rgba(40, 55, 80, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--g-shadow), 0 0 0 1px color-mix(in srgb, var(--g-accent) 25%, transparent), var(--g-glow);
  animation: gPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.g-modal-card h2 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--g-success);
  margin-bottom: 0.5rem;
}
.g-modal-card p {
  color: var(--g-muted);
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

@keyframes gPop {
  from { transform: scale(0.88); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes gShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
@keyframes gBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}
.g-shake { animation: gShake 0.35s ease; }
.g-bounce { animation: gBounce 0.7s ease alternate infinite; }

.g-confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -12px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 300;
  animation: gFall linear forwards;
}
@keyframes gFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.hearts { letter-spacing: 0.08em; font-size: 1.15rem; }

/* —— Rhymes player —— */
.rhyme-shell { max-width: 760px; gap: 1rem; }
.rhyme-hint {
  text-align: center;
  color: var(--g-muted);
  font-weight: 600;
  font-size: 0.98rem;
  margin-top: -0.25rem;
}
.rhyme-player {
  position: relative;
  text-align: center;
  padding: 1.35rem 1.15rem 1.2rem;
  border-radius: 28px;
  background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(0,0,0,0.28));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: var(--g-shadow), inset 0 1px 0 rgba(255,255,255,0.1);
  overflow: hidden;
}
.rhyme-player.playing {
  border-color: color-mix(in srgb, var(--g-accent) 70%, #fff);
  box-shadow: var(--g-shadow), var(--g-glow);
}
.rhyme-emoji-big {
  font-size: clamp(3rem, 12vw, 4.2rem);
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.28));
  animation: gBounce 1.1s ease alternate infinite;
}
.rhyme-player.playing .rhyme-emoji-big {
  animation-duration: 0.55s;
}
.rhyme-now-title {
  margin: 0.55rem 0 0.45rem;
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
  font-weight: 700;
  color: var(--g-accent-2);
}
.rhyme-lines {
  max-width: 34rem;
  margin: 0 auto 0.65rem;
  display: grid;
  gap: 0.2rem;
}
.rhyme-lines p {
  color: rgba(255,255,255,0.92);
  font-size: clamp(0.95rem, 3.2vw, 1.12rem);
  font-weight: 600;
  line-height: 1.45;
}
.rhyme-status {
  min-height: 1.3em;
  color: var(--g-muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.rhyme-controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.rhyme-wave {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  height: 18px;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.2s;
}
.rhyme-wave.on { opacity: 1; }
.rhyme-wave span {
  width: 4px;
  height: 6px;
  border-radius: 99px;
  background: var(--g-accent-2);
  animation: rhymeBar 0.7s ease-in-out infinite alternate;
}
.rhyme-wave span:nth-child(2) { animation-delay: 0.1s; }
.rhyme-wave span:nth-child(3) { animation-delay: 0.2s; }
.rhyme-wave span:nth-child(4) { animation-delay: 0.15s; }
.rhyme-wave span:nth-child(5) { animation-delay: 0.05s; }
@keyframes rhymeBar {
  from { height: 5px; opacity: 0.55; }
  to { height: 18px; opacity: 1; }
}

.rhyme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding-bottom: 1.5rem;
}
@media (min-width: 560px) {
  .rhyme-grid { grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
}
@media (min-width: 760px) {
  .rhyme-grid { grid-template-columns: repeat(4, 1fr); }
}
.rhyme-card {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 1rem 0.7rem 0.85rem;
  background: linear-gradient(165deg, rgba(255,255,255,0.14), rgba(0,0,0,0.22));
  color: #fff;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  animation: rhymeIn 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 0.03s);
  position: relative;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  -webkit-tap-highlight-color: transparent;
}
@keyframes rhymeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.rhyme-card:hover {
  transform: translateY(-3px);
  border-color: var(--g-accent);
}
.rhyme-card:active { transform: scale(0.97); }
.rhyme-card.active {
  border-color: var(--g-accent-2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--g-accent) 45%, transparent), var(--g-glow);
  background: linear-gradient(165deg, color-mix(in srgb, var(--g-accent) 28%, transparent), rgba(0,0,0,0.28));
}
.rhyme-emoji { font-size: 2rem; line-height: 1; display: block; }
.rhyme-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  display: block;
}
.rhyme-play-ico {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

@media (max-width: 420px) {
  .game-shell { padding-left: 0.7rem; padding-right: 0.7rem; }
  .game-top .g-btn span.hide-xs { display: none; }
  .g-stage { padding: 0.75rem; }
}
