/* Sacred Ayat Kids — bright, tactile, big buttons */
:root {
  --bg:        #06121d;
  --bg-soft:   #0f223a;
  --bg-card:   #16304a;
  --gold:      #f5d061;
  --green:     #9bd17a;
  --pink:      #f59c8b;
  --teal:      #7ec5c5;
  --purple:    #c599f7;
  --ivory:     #fff7e2;
  --muted:     #a3b6c8;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; height:100%; }
body {
  font-family: 'Quicksand', 'Comic Sans MS', 'Trebuchet MS', sans-serif;
  background: radial-gradient(900px 600px at 50% -100px, #1f3d68 0%, var(--bg) 70%);
  color: var(--ivory);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
.kids-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  background: linear-gradient(180deg, rgba(6,18,29,.94), rgba(6,18,29,.6));
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.kids-back, .kids-home {
  background: rgba(245,208,97,.15);
  border: 0; border-radius: 999px;
  color: var(--gold);
  font-size: 18px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  cursor: pointer;
  text-decoration: none;
}
.kids-title {
  font-size: 18px; font-weight: 700;
  letter-spacing: .04em;
}

/* Mascot */
.nur {
  position: fixed; right: 18px; bottom: 26px; z-index: 30;
  width: 70px; height: 70px;
  pointer-events: none;
  transition: transform .4s ease;
}
.nur svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 16px rgba(245,208,97,.5)); }
.nur.bounce { animation: bounce .6s ease; }
.nur.cheer { animation: cheer .8s ease; }
@keyframes bounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-12px);} }
@keyframes cheer { 0% { transform: scale(1) rotate(0); } 30% { transform: scale(1.3) rotate(-12deg);} 60% { transform: scale(1.2) rotate(12deg);} 100% { transform: scale(1) rotate(0);} }

/* Pages */
.page { padding: 18px 16px 110px; max-width: 720px; margin: 0 auto; }

/* Landing tiles */
.greet { margin: 6px 4px 22px; }
.greet h1 { font-size: 28px; margin: 0 0 4px; color: var(--gold); }
.greet p  { color: var(--muted); margin: 0; font-size: 14px; }

.coins-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(245,208,97,.18);
  color: var(--gold);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700; font-size: 14px;
}

.tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.tile {
  position: relative;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 22px;
  padding: 18px 14px 16px;
  text-decoration: none;
  color: var(--ivory);
  display: flex; flex-direction: column; gap: 6px;
  min-height: 130px;
  cursor: pointer;
  transition: transform .12s ease, border-color .2s;
}
.tile:active { transform: scale(.97); }
.tile.locked { opacity: .55; }
.tile-emoji { font-size: 32px; }
.tile-name { font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.tile-desc { font-size: 12px; color: var(--muted); }
.tile.live { border-color: var(--gold); }
.tile.locked .lock-pill {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,.4); color: var(--gold);
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
}

/* Surah picker */
.section-h { font-size: 16px; color: var(--gold); margin: 24px 4px 10px; letter-spacing: .03em; }
.surah-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.surah-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 14px;
  border-top: 4px solid var(--surahColor, var(--gold));
  text-decoration: none;
  color: var(--ivory);
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
}
.surah-card:active { transform: scale(.97); }
.surah-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(245,208,97,.15);
  color: var(--gold);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.surah-name-ar { font-size: 22px; color: var(--gold); direction: rtl; font-family: 'Amiri', serif; }
.surah-name-en { font-size: 14px; font-weight: 700; }
.surah-meta { font-size: 11px; color: var(--muted); }
.surah-progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.surah-progress > div { height: 100%; background: var(--gold); width: 0; transition: width .4s ease; }

/* Ayah builder game screen */
.game-head {
  text-align: center;
  background: var(--bg-card);
  padding: 16px;
  border-radius: 22px;
  margin-bottom: 14px;
}
.game-head .surah-tag {
  font-size: 12px; color: var(--gold); letter-spacing: .12em;
  text-transform: uppercase;
}
.game-head .ayah-of {
  font-size: 14px; color: var(--muted); margin-top: 4px;
}
.game-head .progress-dots {
  display: flex; justify-content: center; gap: 6px; margin-top: 10px;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.15);
}
.dot.done   { background: var(--green); }
.dot.active { background: var(--gold); transform: scale(1.3); }

/* Audio play button */
.play-card {
  background: linear-gradient(135deg, rgba(245,208,97,.2), rgba(126,197,197,.15));
  padding: 22px;
  border-radius: 22px;
  text-align: center;
  margin-bottom: 18px;
}
.play-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  font-size: 36px;
  border: 0;
  cursor: pointer;
  display: grid; place-items: center;
  margin: 0 auto;
  box-shadow: 0 8px 28px rgba(245,208,97,.4);
  transition: transform .15s;
}
.play-btn:active { transform: scale(.92); }
.play-btn.playing { animation: pulse 1s infinite ease-in-out; }
@keyframes pulse {
  0%,100% { box-shadow: 0 8px 28px rgba(245,208,97,.4); }
  50%     { box-shadow: 0 8px 40px rgba(245,208,97,.85); }
}
.play-hint { color: var(--muted); margin-top: 14px; font-size: 13px; }

/* Slot row (where you build the ayah) */
.slot-row {
  background: rgba(255,255,255,.04);
  border: 2px dashed rgba(245,208,97,.25);
  border-radius: 18px;
  padding: 14px;
  min-height: 80px;
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
  direction: rtl;
}
.slot-row.shake { animation: shake .4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* Tile bank (drag from here) */
.bank {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 0;
  direction: rtl;
}
.word-tile {
  background: var(--bg-card);
  color: var(--ivory);
  padding: 12px 16px;
  border-radius: 14px;
  font-family: 'Amiri', 'Scheherazade New', serif;
  font-size: 22px;
  cursor: pointer;
  border: 2px solid transparent;
  min-width: 50px; text-align: center;
  user-select: none;
  transition: transform .1s, border-color .15s;
}
.word-tile:active { transform: scale(.94); }
.word-tile.placed {
  border-color: var(--gold);
  background: rgba(245,208,97,.1);
}
.word-tile.correct {
  border-color: var(--green);
  background: rgba(155,209,122,.18);
  animation: pop .3s ease;
}
.word-tile.wrong {
  border-color: var(--pink);
  background: rgba(245,156,139,.18);
}
@keyframes pop {
  0% { transform: scale(1); } 60% { transform: scale(1.1); } 100% { transform: scale(1); }
}

/* Translation reveal */
.translation {
  text-align: center;
  color: var(--ivory);
  font-style: italic;
  margin: 12px 8px;
  opacity: 0;
  transition: opacity .4s;
  font-size: 14px;
}
.translation.show { opacity: 1; }

/* Action buttons */
.actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 6px;
}
.btn {
  background: var(--gold); color: var(--bg);
  border: 0; border-radius: 999px;
  padding: 14px 22px; font-weight: 700; font-size: 15px;
  cursor: pointer; flex: 1; max-width: 220px;
}
.btn:disabled { opacity: .4; }
.btn.ghost { background: rgba(245,208,97,.12); color: var(--gold); }
.btn:active { transform: scale(.96); }

/* Win modal */
.modal-wrap {
  position: fixed; inset: 0;
  background: rgba(6,18,29,.85);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-wrap.show { display: flex; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 28px;
  padding: 30px 24px;
  text-align: center;
  max-width: 360px; width: 100%;
}
.modal h2 { color: var(--gold); margin: 0 0 6px; font-size: 28px; }
.modal .stars {
  font-size: 40px; margin: 12px 0;
}
.modal .reward {
  color: var(--ivory); margin: 8px 0 18px; line-height: 1.5;
}
.modal .modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;}

/* Confetti dots */
.confetti {
  position: fixed; pointer-events: none; inset: 0; z-index: 90;
  overflow: hidden;
}
.confetti span {
  position: absolute; top: -20px;
  width: 10px; height: 10px; border-radius: 2px;
  animation: fall 1.6s linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
