/* ============================================================
   AlphabetPlay — games.css (فاز ۳)
   بازی‌های جدید: شکار صدا، متفاوت، خط خطی، بچین و بخوان، سبد میوه
   ============================================================ */

/* ---------------- کارت‌های حرف (شکار صدا / متفاوت) ---------------- */
.letter-grid {
  display: flex; flex-wrap: wrap; gap: 14px;
  justify-content: center; align-content: center;
  padding: 12px; min-height: 42vh;
}
.letter-tile {
  border-radius: 1.2rem;
  border: 4px solid #fff;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  color: var(--c-teal-d);
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s;
}
.letter-tile:active { transform: scale(0.93); }
.letter-tile.xl { width: 120px; height: 120px; font-size: 3.4rem; }
.letter-tile.lg { width: 104px; height: 104px; font-size: 2.9rem; }
.letter-tile.md { width: 88px;  height: 88px;  font-size: 2.4rem; }
.letter-tile:nth-child(4n+1) { color: var(--c-primary); }
.letter-tile:nth-child(4n+2) { color: var(--c-teal-d); }
.letter-tile:nth-child(4n+3) { color: var(--c-purple); }
.letter-tile:nth-child(4n+4) { color: var(--c-blue); }

/* ---------------- انتخاب بازی در ایستگاه ---------------- */
.station-games {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.game-chip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-bg);
  border: 3px solid #fff;
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  color: var(--c-ink);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(58, 46, 57, 0.08);
}
.game-chip:active { transform: translateY(2px); box-shadow: none; }
.game-chip.locked { opacity: 0.5; }
.game-chip .g-ico { font-size: 1.35rem; }

/* انتخابگر زبان (صفحه‌ی اول) */
.lang-grid { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 340px; }
.lang-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-card);
  border: 4px solid #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-family: inherit; cursor: pointer;
  box-shadow: var(--shadow-pop);
  text-align: start;
}
.lang-card:active { transform: translateY(3px); box-shadow: none; }
.lang-card .lang-flag { font-size: 2.2rem; }
.lang-card .lang-info { display: flex; flex-direction: column; }
.lang-card .lang-info b { font-size: 1.15rem; }
.lang-card .lang-info span { color: var(--c-ink-soft); font-size: 1.3rem; letter-spacing: 3px; }
.lang-current-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--c-card); border-radius: 999px;
  padding: 6px 14px; font-weight: 700;
  box-shadow: 0 3px 0 rgba(58,46,57,.1);
}

/* ---------------- ✏️ خط خطی کردن ---------------- */
.game-trace { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.trace-canvas-wrap {
  position: relative;
  width: 300px; height: 300px;
  border-radius: 1.4rem;
  background: #fff;
  box-shadow: var(--shadow-pop);
  touch-action: none;
  overflow: hidden;
}
.trace-canvas-wrap canvas { position: absolute; inset: 0; }
.trace-progress {
  width: 100%; max-width: 300px; height: 16px;
  background: #fff; border-radius: 999px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.trace-progress .fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-teal), var(--c-green));
  border-radius: 999px;
  transition: width 0.2s;
}

/* ---------------- 🧱 بچین و بخوان ---------------- */
.game-word { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.wb-hint {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-card);
  border-radius: var(--radius);
  padding: 10px 20px;
  box-shadow: var(--shadow-pop);
}
.wb-emoji { font-size: 2.8rem; }
.wb-slots { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 68px; }
.wb-slot {
  width: 58px; height: 68px;
  border-radius: 0.9rem;
  border: 3px dashed #d9c8ba;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 700;
  color: var(--c-primary);
}
.wb-slot.filled { border-style: solid; border-color: var(--c-green); background: #E9FBF4; color: var(--c-green-d); }
.wb-tiles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wb-tile {
  width: 58px; height: 68px;
  border-radius: 0.9rem;
  border: 4px solid #fff;
  background: var(--c-yellow);
  font-family: inherit;
  font-size: 2.1rem; font-weight: 700;
  color: var(--c-ink);
  cursor: pointer;
  box-shadow: var(--shadow-pop);
}
.wb-tile:active { transform: scale(0.93); }
.wb-tile.used { opacity: 0; pointer-events: none; transform: scale(0.6); }

/* ---------------- 🧺 سبد میوه ---------------- */
.game-catch {
  position: relative;
  height: 58vh; min-height: 340px;
  border-radius: 1.4rem;
  background: linear-gradient(180deg, #EAF7FF 0%, #FFF7EC 75%);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  touch-action: none;
}
.cb-prompt { position: absolute; top: 10px; inset-inline: 12px; z-index: 3; }
.catch-score { position: absolute; bottom: 84px; inset-inline-end: 12px; z-index: 3; }
.catch-basket {
  position: absolute; bottom: 8px;
  width: 84px; height: 66px;
  font-size: 3rem;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 4px 3px rgba(58, 46, 57, 0.25));
  z-index: 2;
}
.fall-letter {
  position: absolute; top: 0;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: var(--b, var(--c-teal));
  color: var(--c-ink); /* موج ۲ a11y */
  font-weight: 700; font-size: 1.9rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(58, 46, 57, 0.2);
  z-index: 1;
}

/* ---------------- select تنظیمات ---------------- */
.kid-select {
  font-family: inherit;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 10px;
  border: 3px solid #ffe1c4;
  background: #fff;
  color: var(--c-ink);
}

@media (max-width: 380px) {
  .letter-tile.xl { width: 100px; height: 100px; font-size: 2.8rem; }
  .letter-tile.lg { width: 90px; height: 90px; font-size: 2.5rem; }
  .letter-tile.md { width: 78px; height: 78px; font-size: 2.1rem; }
  .wb-slot, .wb-tile { width: 50px; height: 60px; font-size: 1.8rem; }
  .trace-canvas-wrap { width: 250px; height: 250px; }
}

/* ---------------- بازی ۹: واژه‌سنجی هوشمند (فاز ۱۰) ---------------- */
.game-wordquiz { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.wq-target {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap;
}
.wq-char {
  font-size: 3.4rem; font-weight: 800; line-height: 1.1;
  color: var(--c-primary);
  background: var(--c-bg);
  border: 3px dashed var(--c-primary);
  border-radius: 1.2rem;
  padding: 6px 26px;
  cursor: pointer; font-family: inherit;
  animation: wqBounce 2.2s ease-in-out infinite;
}
.wq-char:active { transform: scale(0.93); }
@keyframes wqBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
body.reduced-motion .wq-char { animation: none; }
.wq-ask { font-size: 1.02rem; font-weight: 800; color: var(--c-ink); max-width: 220px; }
.wq-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; align-content: start; flex: 1;
}
.wq-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 8px 14px;
  background: var(--c-card);
  border: 2px solid var(--c-bg-2); border-radius: 1.2rem;
  cursor: pointer; font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, opacity 0.2s ease;
}
.wq-card:hover { border-color: var(--c-teal); }
.wq-card:active { transform: scale(0.94); }
.wq-card.dim { opacity: 0.45; pointer-events: none; }
.wq-card.done { border-color: var(--c-green); background: #E9FBF4; }
.wq-emoji { font-size: 2.6rem; line-height: 1.1; }
.wq-text { font-size: 1.15rem; font-weight: 800; color: var(--c-ink); }
.wq-text .hl { color: var(--c-primary); }
.wq-hear {
  position: absolute; top: 8px; inset-inline-end: 10px;
  font-size: 1rem; opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.wq-hear:hover { opacity: 1; transform: scale(1.15); }
@media (max-width: 380px) {
  .wq-grid { grid-template-columns: 1fr; }
  .wq-emoji { font-size: 2.1rem; }
}
.wq-img, .wc-img { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; }

/* ---------------- فاز ۱۱: داستان‌های کوتاه حرف‌محور ---------------- */
.stories-screen .story-list { display: flex; flex-direction: column; gap: 12px; }
.story-card {
  display: flex; align-items: center; gap: 14px; text-align: start;
  width: 100%; padding: 14px 16px;
  background: var(--c-card); border: 2px solid var(--c-bg-2); border-radius: 1.2rem;
  cursor: pointer; font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.story-card:hover:not(.locked) { border-color: var(--c-purple); transform: translateY(-2px); }
.story-card:active:not(.locked) { transform: scale(0.97); }
.story-card.locked { opacity: 0.62; cursor: default; }
.story-card.done { border-color: var(--c-green); background: #E9FBF4; }
.story-card .st-emoji { font-size: 2.3rem; }
.story-card .st-info { display: flex; flex-direction: column; gap: 4px; }
.story-card .st-info i { font-style: normal; font-size: 0.78rem; color: var(--c-ink-soft); }
.st-focus { display: flex; gap: 4px; }
.st-focus-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px;
  background: var(--c-bg); color: var(--c-primary);
  border-radius: 8px; font-weight: 800; font-size: 0.95rem;
}

/* خواننده */
.story-reader { display: flex; flex-direction: column; gap: 12px; }
.reader-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; min-height: 280px;
  background: var(--c-card); border: 2px solid var(--c-bg-2); border-radius: 1.4rem;
  padding: 18px;
}
.rd-sentence { font-size: 1.75rem; font-weight: 800; line-height: 2.2; text-align: center; }
.rd-word {
  font: inherit; color: var(--c-ink);
  background: var(--c-bg); border: 2px solid transparent; border-radius: 0.7rem;
  padding: 2px 10px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.rd-word:hover { border-color: var(--c-teal); }
.rd-word:active { transform: scale(0.92); }
.rd-emoji { font-size: 3.2rem; }
.st-hint { font-size: 0.75rem; color: var(--c-ink-soft); }
.reader-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.rq-title { font-size: 1.3rem; font-weight: 800; text-align: center; }
.rq-options { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.rq-opt {
  font-size: 3rem; background: var(--c-bg);
  border: 3px solid var(--c-bg-2); border-radius: 1.2rem;
  width: 92px; height: 92px; cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.rq-opt:hover { border-color: var(--c-teal); }
.rq-opt:active { transform: scale(0.92); }
.rq-opt.dim { opacity: 0.4; pointer-events: none; }
.rd-done { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.rd-done h2 { font-size: 1.4rem; }
.rd-done-stars { font-size: 1.6rem; font-weight: 800; color: var(--c-primary); }
@media (max-width: 380px) {
  .rd-sentence { font-size: 1.4rem; }
  .rq-opt { width: 76px; height: 76px; font-size: 2.4rem; }
}

/* ═══════════ فاز ۱۴ — بازی «بلند بگو!» (تشخیص گفتار) ═══════════ */
.sl-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; }
.sl-char {
  font-size: 4.6rem; font-weight: 800; line-height: 1;
  width: 128px; height: 128px; border-radius: 1.6rem;
  background: #fff; border: 5px solid var(--c-teal);
  color: var(--c-ink); cursor: pointer;
  box-shadow: var(--shadow-pop);
}
.sl-char.reveal { border-color: var(--c-yellow); animation: sl-reveal 0.7s ease-in-out infinite alternate; }
@keyframes sl-reveal { to { transform: scale(1.07); } }
.sl-status { font-size: 1.05rem; font-weight: 800; color: var(--c-ink); min-height: 1.6em; text-align: center; }
.sl-heard {
  min-height: 1.7em; font-size: 1.15rem; font-weight: 700;
  color: var(--c-ink-soft); text-align: center; max-width: 320px;
}
.sl-mic {
  position: relative; width: 108px; height: 108px; border-radius: 50%;
  font-size: 3rem; border: 5px solid var(--c-primary);
  background: #fff; cursor: pointer; margin-top: 6px;
  box-shadow: var(--shadow-pop);
  display: grid; place-items: center;
}
.sl-mic:active { transform: scale(0.94); }
.sl-mic:disabled { opacity: 0.75; cursor: default; }
.sl-mic-ring { display: none; }
.sl-mic.listening { border-color: var(--c-teal); }
.sl-mic.listening .sl-mic-ring {
  display: block; position: absolute; inset: -7px; border-radius: 50%;
  border: 4px solid var(--c-teal); animation: sl-pulse 1s ease-out infinite;
}
.sl-mic.listening .sl-mic-ico { animation: sl-bounce 0.8s ease-in-out infinite alternate; }
@keyframes sl-pulse {
  0% { transform: scale(0.92); opacity: 0.9; }
  100% { transform: scale(1.28); opacity: 0; }
}
@keyframes sl-bounce { to { transform: scale(1.16); } }
.sl-mic.correct { border-color: var(--c-yellow); }
/* نمای «میکروفون نیست/اجازه نیست» */
.sl-unavailable {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 18px 8px;
}
.sl-unavail-ico { font-size: 3.4rem; }
.sl-unavail-body h3 { font-size: 1.2rem; }
.sl-unavail-body p { font-size: 0.9rem; line-height: 1.9; max-width: 340px; }
@media (prefers-reduced-motion: reduce) {
  .sl-mic.listening .sl-mic-ring, .sl-mic.listening .sl-mic-ico, .sl-char.reveal { animation: none; }
}
