/* ============================================================
 * game.css — "अक्षर पहचानो" game (game.html)
 * ============================================================ */
.fs-b { font-family: 'JinShashan Brahmi', 'Kids Brahmi', serif; }

.game-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 26px 16px 20px;
}
.screen { animation: kidPop .45s var(--ease-bounce); }
.screen[hidden] { display: none; }

/* ---- Menu ---- */
.game-say .say-mascot { width: 170px; height: 160px; }
.game-say .say-bubble { font-size: 1.25rem; margin-bottom: 36px; }
.gs-title { display: block; margin: 0 0 2px; font-size: 2rem; font-weight: 800; line-height: 1.2; color: var(--grape-d); }

.dir-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  width: fit-content;
  margin: 6px auto 22px;
  padding: 5px;
  background: #fff;
  border-radius: 999px;
  box-shadow: inset 0 0 0 3px #C9B8FF, 0 5px 0 rgba(43, 33, 64, .1);
}
.dir-btn {
  border: 0;
  cursor: pointer;
  padding: 8px 22px;
  border-radius: 999px;
  background: transparent;
  font: 800 1.3rem/1.2 var(--font-fun);
  color: var(--ink-soft);
  transition: background .2s ease, color .2s ease, transform .2s var(--ease-bounce);
}
.dir-btn .fs-b { font-size: 1.5rem; }
.dir-btn.on { background: var(--grape); color: #fff; transform: scale(1.04); }

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  cursor: pointer;
  padding: 18px 8px 16px;
  border-radius: 28px;
  color: #fff;
  background: var(--c);
  box-shadow: 0 8px 0 var(--cd), inset 0 4px 0 rgba(255, 255, 255, .25);
  font-family: var(--font-fun);
  transition: transform .2s var(--ease-bounce), box-shadow .2s ease;
}
.mode-card:hover { transform: translateY(-6px) rotate(-2deg); box-shadow: 0 12px 0 var(--cd), inset 0 4px 0 rgba(255, 255, 255, .25); }
.mode-card:nth-child(even):hover { transform: translateY(-6px) rotate(2deg); }
.mode-card:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--cd); }
.mc-pic {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  font-size: 3rem;
  line-height: 1;
}
.mode-card:hover .mc-pic { animation: kidWiggle .5s ease; }
.mc-title { margin-top: 6px; font-size: 1.45rem; font-weight: 800; }
.mc-sub { font-size: .95rem; font-weight: 600; opacity: .95; }

/* ---- Play ---- */
.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 3px #C9D6E8;
  transition: transform .3s var(--ease-bounce), background .3s ease;
}
.dot.now  { box-shadow: inset 0 0 0 3px var(--grape); transform: scale(1.3); }
.dot.good { background: var(--leaf); box-shadow: none; }
.dot.meh  { background: var(--sun); box-shadow: none; }
.score {
  padding: 4px 14px;
  border-radius: 999px;
  background: #FFF4C7;
  box-shadow: inset 0 0 0 3px var(--sun), 0 3px 0 var(--sun-d);
  font-weight: 800;
  font-size: 1.15rem;
  color: #8A5A00;
  white-space: nowrap;
}

.q-card {
  text-align: center;
  background: #fff;
  border: 5px solid #9EDCF8;
  border-radius: 34px;
  box-shadow: 0 10px 0 rgba(43, 33, 64, .1);
  padding: 14px 16px 18px;
}
.q-text { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--ink-soft); }
.q-glyph {
  font-size: clamp(5.5rem, 22vw, 9rem);
  line-height: 1.2;
  color: #E11D48;
  min-height: 1.2em;
}
.q-glyph.deva { font-family: 'Noto Serif Devanagari', serif; color: var(--grape-d); font-weight: 700; }
.q-glyph.brahmi { font-family: 'JinShashan Brahmi', 'Kids Brahmi', serif; }
html.motion .q-glyph.enter { animation: kidDrop .6s var(--ease-bounce); }

.options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 8px;
}
.opt-btn {
  border: 0;
  cursor: pointer;
  min-height: 104px;
  border-radius: 26px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 4px var(--c), 0 7px 0 var(--cd);
  font-size: 3rem;
  line-height: 1.1;
  transition: transform .18s var(--ease-bounce), box-shadow .18s ease, background .2s ease;
}
.opt-btn.deva { font-family: 'Noto Serif Devanagari', serif; font-weight: 700; }
.opt-btn.brahmi { font-family: 'JinShashan Brahmi', 'Kids Brahmi', serif; color: #E11D48; }
.opt-btn:hover:not(:disabled) { transform: translateY(-4px); background: #FFFBEA; }
.opt-btn:active:not(:disabled) { transform: translateY(6px); box-shadow: inset 0 0 0 4px var(--c), 0 1px 0 var(--cd); }
.opt-btn.right { background: #DCFCE7; box-shadow: inset 0 0 0 5px var(--leaf), 0 7px 0 var(--leaf-d); animation: kidBoing .55s ease; }
.opt-btn.wrong { background: #FEE2E2; box-shadow: inset 0 0 0 4px var(--red), 0 3px 0 var(--red-d); opacity: .6; cursor: default; }
.opt-btn.reveal-ans { box-shadow: inset 0 0 0 5px var(--leaf), 0 7px 0 var(--leaf-d); }

.play-say { margin-top: 12px; }
.play-say .say-mascot { width: 100px; height: 94px; }
.play-say .say-bubble { font-size: 1.2rem; margin-bottom: 20px; }

/* ---- Result ---- */
.result-card {
  text-align: center;
  background: #fff;
  border: 5px solid #FFD27A;
  border-radius: 36px;
  box-shadow: 0 12px 0 rgba(43, 33, 64, .1);
  padding: 22px 18px 26px;
}
.result-gaju { width: 190px; height: 178px; margin: 0 auto; }
.res-title { margin: 4px 0; font-size: 2.6rem; font-weight: 800; color: var(--orange-d); }
.res-stars { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; font-size: 2.2rem; }
.res-stars span { display: inline-block; }
.res-stars .off { filter: grayscale(1); opacity: .3; }
html.motion .res-stars span { animation: kidPop .5s var(--ease-bounce) both; animation-delay: calc(var(--i) * 90ms + .2s); }
.res-text { font-size: 1.25rem; font-weight: 700; color: var(--ink-soft); margin: 10px 0 18px; }
.res-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.res-actions .btn3d { font-size: 1.2rem; padding: 13px 24px; }

/* ---- 3D (2026-11-12) ---- */
/* a new screen swings up into place */
html.motion .screen { animation: screen3d .6s cubic-bezier(.2, .8, .25, 1.1); transform-origin: 50% 0; }
@keyframes screen3d { from { opacity: 0; transform: perspective(1200px) rotateX(-22deg) translateY(30px); } }
/* the question letter turns in like a card */
html.motion .q-glyph.enter { animation: glyph3d .75s cubic-bezier(.2, .8, .25, 1.25); }
@keyframes glyph3d { from { opacity: 0; transform: perspective(700px) rotateY(-110deg) scale(.6); } 55% { opacity: 1; } }
/* the right answer flips like a coin */
html.motion .opt-btn.right { animation: coin3d .9s cubic-bezier(.2, .8, .25, 1); }
@keyframes coin3d {
  0% { transform: perspective(600px) rotateY(0deg) scale(1); }
  50% { transform: perspective(600px) rotateY(200deg) scale(1.18); }
  100% { transform: perspective(600px) rotateY(360deg) scale(1); }
}
/* result stars spin in */
html.motion .res-stars span { animation: star3d .85s cubic-bezier(.2, .8, .25, 1.2) both; animation-delay: calc(var(--i) * 110ms + .2s); }
@keyframes star3d { from { opacity: 0; transform: perspective(300px) rotateY(-540deg) scale(.2); } }
/* mode cards: the big letter and the title lift off the card while it leans */
@media screen {
  .mode-card.j3-tilting { transform-style: preserve-3d; }
  .mode-card .mc-pic, .mode-card .mc-title { transition: translate .4s var(--ease-bounce); }
  .mode-card.j3-tilting .mc-pic { translate: 0 0 52px; }
  .mode-card.j3-tilting .mc-title { translate: 0 0 26px; }
}
.game-say .hero-cube { --s: 112px; align-self: center; margin-left: 22px; }
/* the big letters on the mode cards bob and turn a little, all the time */
html.motion .mc-pic { animation: mcBob 3.6s ease-in-out infinite; }
html.motion .mode-card:nth-child(2) .mc-pic { animation-delay: -.9s; }
html.motion .mode-card:nth-child(3) .mc-pic { animation-delay: -1.8s; }
html.motion .mode-card:nth-child(4) .mc-pic { animation-delay: -2.7s; }
@keyframes mcBob {
  0%, 100% { transform: perspective(300px) translateY(0) rotateY(-14deg); }
  50% { transform: perspective(300px) translateY(-6px) rotateY(14deg); }
}

/* ---- Phones ---- */
@media (max-width: 720px) {
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .opt-btn { min-height: 92px; font-size: 2.6rem; }
  .game-say { flex-direction: column; align-items: center; }
  .game-say .say-mascot { width: 130px; height: 122px; }
  .game-say .say-bubble { margin-bottom: 0; text-align: center; }
  .game-say .hero-cube { --s: 84px; margin: 16px auto 4px; }
  .game-say .say-bubble::before { left: 50%; bottom: auto; top: -20px; transform: translateX(-50%); border: 12px solid transparent; border-bottom: 18px solid var(--ink); border-top: 0; }
  .game-say .say-bubble::after  { left: 50%; bottom: auto; top: -12px; transform: translateX(-50%); border: 9px solid transparent; border-bottom: 13px solid #fff; border-top: 0; }
  .play-top .btn-sm { padding: 6px 10px; }
  .dot { width: 12px; height: 12px; }
  .play-say .say-mascot { width: 80px; height: 76px; }
  .play-say .say-bubble { font-size: 1.05rem; }
}
