* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 17px; }
body {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #fff7cc 0%, #e0f2fe 45%, #f0f9ff 100%);
  background-attachment: fixed;
  color: #1f2937; line-height: 1.9;
  -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 1.6rem; margin: 0.5rem 0; color: #0e7490; }
h2 { font-size: 1.3rem; margin: 1rem 0 0.4rem; }
p { margin: 0.4rem 0; }
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: 0.55; cursor: default; }

/* سربرگ: نام اپ + چیپ‌های ستاره/سکه/استریک */
.topbar {
  display: flex; align-items: center; gap: 0.6rem;
  background: linear-gradient(135deg, #0e7490, #0891b2); color: #fff; padding: 0.6rem 0.9rem;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 10px rgba(14, 116, 144, 0.25);
}
.mascot-svg { width: 60px; height: 60px; }
.appname { font-size: 1.35rem; font-weight: bold; line-height: 1.3; }
.appsub { font-size: 0.8rem; opacity: 0.9; }
.wallet { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.chip-w {
  background: rgba(255, 255, 255, 0.22); border-radius: 999px;
  padding: 0.15rem 0.6rem; font-size: 0.95rem; font-weight: bold; white-space: nowrap;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0.9rem 0.9rem 6.5rem; }
.card {
  background: #fff; border: 2px solid #bae6fd; border-radius: 20px;
  padding: 1rem 1.1rem; margin: 0.8rem 0;
}
.card.muted { background: #f8fafc; border-color: #e2e8f0; color: #475569; font-size: 0.95rem; }
.card.center { text-align: center; }
.card.why { border-color: #fbbf24; background: #fffbeb; }
.card.strategy { border-color: #c4b5fd; background: #f5f3ff; }
.muted { color: #64748b; font-size: 0.95rem; }
.ok { color: #047857; font-weight: bold; }

/* کارت خوش‌آمد: یک کار مشخص — ادامه بده */
.greet { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; background: linear-gradient(135deg, #fef3c7, #ffffff 70%); border-color: #fbbf24; }
.greet-mascot { flex-shrink: 0; }
.greet-mascot .mascot-svg { width: 78px; height: 78px; animation: wiggle 2.4s ease-in-out infinite; }
.greet-text { font-size: 1.25rem; line-height: 1.7; flex: 1; min-width: 140px; }
.continue-btn {
  width: 100%; min-height: 62px; font-size: 1.3rem; border-radius: 18px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  box-shadow: 0 4px 0 #b45309;
}
.continue-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b45309; }
@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg) translateY(-2px); }
}

.mission { background: #fef3c7; border-color: #f59e0b; font-size: 1.05rem; }

/* بنر دنیای تازه‌بازشده */
.new-banner {
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
  border-radius: 18px; padding: 0.9rem; margin: 0.8rem 0; text-align: center;
  font-size: 1.25rem; font-weight: bold;
  animation: banner-pop 0.6s ease-out, glow-pulse 1.4s ease-in-out 0.6s infinite;
}
@keyframes banner-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}

/* نوار پیشرفت متحرک */
.progbar {
  display: block; height: 12px; background: #e2e8f0; border-radius: 999px;
  overflow: hidden; margin: 0.35rem 0;
}
.progbar.big { height: 16px; margin: 0.6rem 0 0.2rem; }
.progfill { display: block; height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.prog-label { text-align: center; font-size: 0.95rem; color: #0e7490; font-weight: bold; margin: 0.2rem 0 0.6rem; }

/* نقشه‌ی ماجراجویی: دنیاهای رنگی */
.map { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.6rem; }
.world {
  display: flex; align-items: center; gap: 0.8rem; text-align: right;
  background: #fff; border: 3px solid var(--wc, #0e7490); border-radius: 22px;
  padding: 0.9rem; font-size: 1.1rem; color: #1f2937; width: 100%; min-height: 88px;
  box-shadow: 0 3px 0 rgba(31, 41, 55, 0.08);
}
.world-icon { font-size: 2.3rem; flex-shrink: 0; line-height: 1; }
.world-num {
  background: var(--wc, #0e7490); color: #fff; border-radius: 50%;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: bold; flex-shrink: 0;
}
.world-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.world-body small { color: #64748b; font-size: 0.9rem; }
.world-prog { font-size: 0.9rem; color: #0e7490; font-weight: bold; }
.world-stars { font-size: 1.2rem; color: #f59e0b; letter-spacing: 2px; }
.world.new { animation: glow-pulse 1.2s ease-in-out infinite; border-width: 4px; }

/* نشان‌ها: کارت‌های تصویری قابل‌جمع‌آوری */
.badgecard { border-color: #fbbf24; background: #fffbeb; }
.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.badge {
  flex: 1 1 28%; min-width: 90px; background: #f1f5f9; border: 2px solid #e2e8f0;
  border-radius: 14px; padding: 0.6rem 0.3rem; text-align: center; color: #94a3b8;
}
.badge.got { background: #fef3c7; border-color: #f59e0b; color: #92400e; font-weight: bold; }
.badge-icon { display: block; font-size: 1.9rem; line-height: 1.3; }
.badge-name { font-size: 0.85rem; line-height: 1.4; }

.lesson {
  display: flex; align-items: center; gap: 0.7rem; text-align: right;
  background: #fff; border: 2px solid #bae6fd; border-radius: 16px;
  padding: 0.9rem 1rem; margin: 0.6rem 0; width: 100%; font-size: 1.1rem; color: #1f2937; min-height: 68px;
}
.lesson-num {
  background: #e0f2fe; color: #0e7490; border-radius: 50%;
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  font-weight: bold; flex-shrink: 0; font-size: 1.1rem;
}
.lesson-body { display: flex; flex-direction: column; flex: 1; }
.lesson-body small { color: #64748b; font-size: 0.9rem; }

/* دکمه‌های بزرگ برای انگشت کودک */
.primary {
  background: #0e7490; color: #fff; border: none; border-radius: 18px;
  padding: 0.9rem 1.4rem; font-size: 1.2rem; font-weight: bold; min-height: 58px;
}
.primary.wide, .ghost.wide { width: 100%; margin: 0.5rem 0; }
.ghost {
  background: #fff; color: #0e7490; border: 2px solid #0e7490; border-radius: 18px;
  padding: 0.9rem 1.1rem; font-size: 1.15rem; min-height: 58px;
}
.back { background: none; border: none; color: #0e7490; font-size: 1.1rem; padding: 0.4rem 0; font-weight: bold; }
.row { display: flex; gap: 0.6rem; margin: 0.7rem 0; }
.row .primary, .row .ghost { flex: 1; }

/* چیپ سطح + نقطه‌های پیشرفت */
.level-chip {
  display: inline-block; background: #fef3c7; border: 2px solid #f59e0b; color: #92400e;
  border-radius: 999px; padding: 0.2rem 0.9rem; font-weight: bold; font-size: 1rem;
}
.dots { display: flex; gap: 7px; justify-content: center; margin: 0.7rem 0; }
.dot { width: 13px; height: 13px; border-radius: 50%; background: #cbd5e1; }
.dot.done { background: #22c55e; }
.dot.now { background: #f59e0b; animation: dot-pulse 1.2s infinite; }
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
.practice-info { font-size: 1.05rem; text-align: center; margin: 0.3rem 0 0.6rem; }

/* سؤال و گزینه‌ها */
.qcard { background: #fff; border: 2px solid #bae6fd; border-radius: 20px; padding: 1.1rem; margin: 0.7rem 0; }
.qtext { font-size: 1.3rem; font-weight: bold; margin-bottom: 0.8rem; line-height: 1.8; }
.qtext .big { font-size: 1.5rem; letter-spacing: 2px; }
.opt {
  display: block; width: 100%; text-align: right; background: #f8fafc;
  border: 2px solid #cbd5e1; border-radius: 16px; padding: 1rem 1.1rem;
  margin: 0.6rem 0; font-size: 1.2rem; color: #1f2937; min-height: 60px;
}
.opt.correct { background: #dcfce7; border-color: #16a34a; }
.opt.wrong { background: #fee2e2; border-color: #dc2626; }
.feedback { background: #f0fdf4; border: 2px solid #86efac; border-radius: 14px; padding: 0.8rem; margin: 0.7rem 0; font-size: 1.05rem; }
.step-num { font-weight: bold; color: #0e7490; font-size: 1.15rem; }
.big-stars { font-size: 2.8rem; color: #f59e0b; letter-spacing: 6px; margin: 0.5rem 0; }
.pop-star { display: inline-block; animation: star-pop 0.5s backwards; }
@keyframes star-pop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.35) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.result-card { border-color: #fbbf24; background: linear-gradient(180deg, #fffbeb, #ffffff 60%); }
.result-mascot .mascot-svg { width: 100px; height: 100px; }
.coins-earned { font-size: 1.3rem; font-weight: bold; color: #b45309; }

.clock { width: 150px; height: 150px; display: block; margin: 0.5rem auto; }
table.mini { width: 100%; border-collapse: collapse; background: #fff; margin: 0.6rem 0; font-size: 0.95rem; }
table.mini th, table.mini td { border: 1px solid #cbd5e1; padding: 0.4rem 0.6rem; text-align: right; }
table.mini th { background: #e0f2fe; }
table.mini.wide { font-size: 0.85rem; }

.chat {
  background: #fff; border: 2px solid #bae6fd; border-radius: 16px;
  padding: 0.8rem; margin: 0.7rem 0; max-height: 55vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.msg { border-radius: 14px; padding: 0.6rem 0.9rem; max-width: 90%; line-height: 1.8; }
.msg.me { background: #e0f2fe; align-self: flex-start; }
.msg.ai { background: #fef3c7; align-self: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.chip { background: #fff; border: 2px solid #f59e0b; color: #92400e; border-radius: 20px; padding: 0.5rem 1rem; font-size: 1rem; min-height: 44px; }
.askrow { display: flex; gap: 0.5rem; }
.askrow input {
  flex: 1; font-family: inherit; font-size: 1.05rem; border: 2px solid #0e7490;
  border-radius: 16px; padding: 0.8rem; min-width: 0;
}

.bottomnav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 10;
  display: flex; background: #fff; border-top: 2px solid #bae6fd;
  padding: 0.3rem env(safe-area-inset-bottom);
}
.bottomnav button {
  flex: 1; background: none; border: none; color: #0e7490;
  font-size: 1.05rem; font-weight: bold; padding: 0.7rem 0; line-height: 1.4;
}

#toast {
  position: fixed; bottom: 5.5rem; right: 50%; transform: translateX(50%) translateY(20px);
  background: #1f2937; color: #fff; border-radius: 12px; padding: 0.8rem 1.3rem;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  max-width: 92vw; text-align: center; z-index: 50; font-size: 1.05rem;
}
#toast.show { opacity: 1; transform: translateX(50%) translateY(0); }

/* صدا */
.speak-btn {
  background: #fff; color: #0e7490; border: 2px solid #0e7490; border-radius: 14px;
  padding: 0.5rem 1rem; font-size: 1rem; margin-top: 0.6rem; min-height: 48px;
}
.speak-btn.big { width: 100%; min-height: 54px; font-size: 1.15rem; font-weight: bold; }
.ghost.small { padding: 0.5rem 0.9rem; font-size: 0.95rem; min-height: 46px; }
.big-toggle { flex: 1; min-height: 54px; font-size: 1.05rem; }
.voicerow { display: flex; gap: 0.5rem; margin: 0.7rem 0; flex-wrap: wrap; }
.speak-msg { background: none; border: none; font-size: 1.2rem; padding: 0; margin-inline-start: 0.3rem; vertical-align: middle; }
.mic { border-color: #b45309; color: #92400e; }
.mic.listening { background: #fef3c7; border-color: #f59e0b; animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}
.voice-note { font-size: 0.9rem; color: #64748b; margin: 0.4rem 0; }
.voice-live {
  background: #fef3c7; border: 2px dashed #f59e0b; border-radius: 12px;
  padding: 0.6rem 0.9rem; margin: 0.5rem 0; font-size: 1rem;
}
.voicesettings { border-color: #fbbf24; background: #fffbeb; }
.voice-opt {
  flex: 1; background: #fff; border: 2px solid #cbd5e1; border-radius: 14px;
  padding: 0.8rem; font-size: 1.05rem; color: #1f2937; min-height: 58px;
}
.voice-opt.active { border-color: #0e7490; background: #e0f2fe; font-weight: bold; }
.voice-opt small { color: #64748b; font-size: 0.9rem; }
.voice-toggle-line { width: 100%; margin: 0.8rem 0 0.2rem; }

/* کانفتی جشن */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti-layer i {
  position: absolute; top: -14px; width: 10px; height: 15px;
  animation-name: confetti-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.85; }
}
