/* تعلم مع يوسف وزين — ستايل التطبيق */
:root {
  --bg: #FFF6EA;
  --bg2: #FDEBD8;
  --ink: #2B2A33;
  --muted: #7A7488;
  --line: #F0E4D4;
  --card: #FFFFFF;
  --teal: #2FA98C;
  --teal-d: #1F8A71;
  --orange: #F2A03D;
  --pink: #EF7A9B;
  --purple: #7B6CD9;
  --sky: #58B7E8;
  --gold: #F6B93B;
  --shadow: 0 3px 0 rgba(43, 42, 51, .10), 0 10px 22px rgba(43, 42, 51, .07);
  --shadow-sm: 0 2px 0 rgba(43, 42, 51, .10), 0 6px 14px rgba(43, 42, 51, .06);
  --font: "Noto Sans Arabic", "Noto Sans Arabic UI", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --naskh: "Noto Naskh Arabic", "Noto Sans Arabic", "Traditional Arabic", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background-image: radial-gradient(circle at 12% 8%, #FFE9C9 0, transparent 42%),
    radial-gradient(circle at 88% 4%, #E4F5EF 0, transparent 38%),
    radial-gradient(circle at 50% 100%, #FDE7F0 0, transparent 55%);
  background-attachment: fixed;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 14px calc(28px + env(safe-area-inset-bottom));
}

button { font-family: inherit; }

/* ===== الشريط العلوي ===== */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 2px 10px;
  background: linear-gradient(180deg, var(--bg) 62%, rgba(255, 246, 234, 0));
}

.top-back {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.top-back:active { transform: translateY(2px); }

.top-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.star-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #FFF1D2;
  color: #8A5A00;
  font-weight: 800;
  font-size: 15px;
  box-shadow: inset 0 -2px 0 rgba(138, 90, 0, .12);
}

.star-pill .s { font-size: 16px; }

/* ===== عناصر عامة ===== */
.screen { animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border-radius: 26px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.h1 { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.sub { font-size: 14px; color: var(--muted); line-height: 1.7; }
.mt8 { margin-top: 8px; }
.mt14 { margin-top: 14px; }
.mt18 { margin-top: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 20px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 4px 0 rgba(31, 138, 113, .55);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(31, 138, 113, .55); }
.btn.block { display: flex; width: 100%; }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:active { transform: translateY(2px); }
.btn.orange { background: var(--orange); box-shadow: 0 4px 0 #C97F22; }
.btn.pink { background: var(--pink); box-shadow: 0 4px 0 #C25677; }
.btn.purple { background: var(--purple); box-shadow: 0 4px 0 #5A4CB3; }
.btn.sm { padding: 10px 14px; font-size: 15px; border-radius: 16px; }

.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 16px;
  padding: 10px 15px;
  background: #EAF7F3;
  color: var(--teal-d);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.speak-btn:active { transform: translateY(2px); }
.speak-btn.big { font-size: 17px; padding: 13px 20px; border-radius: 18px; }

/* ===== الترحيب والرئيسية ===== */
.hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 26px;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF3E2 100%);
  box-shadow: var(--shadow);
}

.avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 22px;
  background: #FFF6E6;
  display: grid;
  place-items: center;
  box-shadow: inset 0 -3px 0 rgba(43, 42, 51, .07);
}
.avatar img { width: 44px; height: 44px; display: block; }

.hero-text { flex: 1; min-width: 0; }
.hero-hi { font-size: 13px; color: var(--muted); font-weight: 700; }
.hero-name { font-size: 21px; font-weight: 800; margin-top: 2px; }

/* حلقة الهدف اليومي */
.goal {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
  margin-top: 12px;
}
.ring { position: relative; width: 62px; height: 62px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring-txt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--teal-d);
}
.goal-body { flex: 1; min-width: 0; }
.goal-title { font-weight: 800; font-size: 15px; }
.goal-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.goal-done .goal-title { color: var(--teal-d); }

/* بطاقات المسارات */
.paths { display: grid; gap: 12px; margin-top: 14px; }

.path-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: right;
  border: 0;
  border-radius: 24px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
}
.path-card:active { transform: translateY(2px); }
.path-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 19px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
}
.path-body { flex: 1; min-width: 0; }
.path-title { font-size: 17px; font-weight: 800; }
.path-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.path-go { color: var(--muted); font-size: 20px; }
.path-card.locked { opacity: .62; }
.path-card.locked .path-go { font-size: 13px; font-weight: 800; background: #F2EFEA; border-radius: 999px; padding: 5px 10px; }

.path-card.accent-ar { background: linear-gradient(135deg, #FFFFFF 30%, #EAF7F3 100%); }
.path-card.accent-num { background: linear-gradient(135deg, #FFFFFF 30%, #FFF0DA 100%); }
.path-card.accent-en { background: linear-gradient(135deg, #FFFFFF 30%, #EDF0FF 100%); }

.section-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 4px 10px;
}
.section-h h2 { font-size: 16px; font-weight: 800; margin: 0; }
.section-h .link { font-size: 13px; font-weight: 800; color: var(--teal-d); background: none; border: 0; cursor: pointer; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.tile .em { font-size: 24px; }
.tile:active { transform: translateY(2px); }
.tile.soon { opacity: .55; }

/* ===== مسار الدروس ===== */
.lesson {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: right;
  border: 0;
  border-radius: 24px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  cursor: pointer;
}
.lesson:active { transform: translateY(2px); }
.lesson-num {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: var(--teal);
}
.lesson-body { flex: 1; min-width: 0; }
.lesson-title { font-weight: 800; font-size: 16px; }
.lesson-chars {
  font-family: var(--naskh);
  font-size: 22px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 2px;
}
.lesson-stars { font-size: 13px; font-weight: 800; color: var(--gold); }
.lesson.locked { opacity: .55; }
.lesson.locked .lesson-num { background: #D8D2C8; }
.lesson.done .lesson-num { background: var(--teal); }
.lesson.current { box-shadow: 0 0 0 3px #CFEDE3, var(--shadow-sm); }

/* ===== اللعبة ===== */
.game-wrap { display: flex; flex-direction: column; gap: 12px; }

.progress-dots { display: flex; gap: 6px; justify-content: center; padding: 4px 0 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #E6DCCD; }
.dot.on { background: var(--teal); }
.dot.miss { background: #E3B7B7; }

.qcard {
  border-radius: 26px;
  padding: 18px 16px;
  background: linear-gradient(135deg, #FFFFFF 0%, #EAF7F3 100%);
  box-shadow: var(--shadow);
  text-align: center;
}
.qtext { font-size: 22px; font-weight: 800; line-height: 1.5; }
.qcard .speak-btn { margin-top: 12px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  font-family: var(--naskh);
  font-size: clamp(48px, 17vw, 76px);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .08s ease;
}
.opt:active { transform: scale(.97); }
.opt.right { background: #DFF5EA; box-shadow: 0 0 0 4px var(--teal), var(--shadow); color: var(--teal-d); }
.opt.wrong { background: #FDECEC; box-shadow: 0 0 0 4px #F0B4B4, var(--shadow); color: #C25B5B; animation: shake .34s ease; }
.opt.off { opacity: .45; pointer-events: none; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===== نهاية الدرس ===== */
.end-card {
  border-radius: 30px;
  padding: 24px 18px;
  background: linear-gradient(160deg, #FFFFFF 0%, #FFF3E2 100%);
  box-shadow: var(--shadow);
  text-align: center;
}
.end-emoji { font-size: 54px; line-height: 1; }
.end-title { font-size: 24px; font-weight: 800; margin-top: 8px; }
.end-score { font-size: 16px; color: var(--muted); margin-top: 8px; font-weight: 700; }
.end-stars { font-size: 26px; letter-spacing: 4px; margin-top: 12px; }
.end-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ===== المراجعة ===== */
.letters-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.ltile {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 20px;
  color: #fff;
  font-family: var(--naskh);
  font-size: clamp(30px, 10vw, 40px);
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(43, 42, 51, .12);
}
.ltile:active { transform: translateY(2px); }

/* ===== كارت الحرف ===== */
.letter-card {
  border-radius: 30px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.letter-big {
  font-family: var(--naskh);
  font-size: clamp(96px, 34vw, 150px);
  line-height: 1;
  font-weight: 700;
}
.letter-word-img { width: 108px; height: 108px; display: block; margin: 6px auto 0; }
.letter-word {
  font-family: var(--naskh);
  font-size: 34px;
  font-weight: 700;
  margin-top: 4px;
}
.letter-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.letter-nav { display: flex; gap: 10px; margin-top: 12px; }
.letter-nav .btn { flex: 1; }

/* ===== أولياء الأمور ===== */
.gate { max-width: 340px; margin: 30px auto 0; text-align: center; }
.gate-q { font-size: 26px; font-weight: 800; margin: 14px 0 4px; direction: ltr; }
.gate-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.gate-choices button {
  border: 0;
  border-radius: 18px;
  padding: 16px 0;
  font-size: 19px;
  font-weight: 800;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-label { font-weight: 700; font-size: 15px; }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 0;
  border-radius: 14px;
  padding: 9px 14px;
  background: #F6F1E9;
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.chip.on { background: var(--teal); color: #fff; }

.field {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  background: #fff;
  color: var(--ink);
  text-align: center;
}
.field:focus { outline: 0; border-color: var(--teal); }

.bar { height: 9px; border-radius: 999px; background: #F1E9DC; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--teal); }

.av-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.av {
  border: 0;
  border-radius: 20px;
  background: #fff;
  padding: 10px 6px 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
}
.av img { width: 42px; height: 42px; }
.av.on { box-shadow: 0 0 0 3px var(--teal), var(--shadow-sm); color: var(--ink); }

/* ===== توست ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: #2B2A33;
  color: #fff;
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* نجوم متطايرة */
.pop-star {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(.4);
  font-size: 62px;
  pointer-events: none;
  opacity: 0;
  z-index: 80;
  animation: pop .9s ease forwards;
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  35% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(1); }
}

.hidden { display: none !important; }

/* أيقونات */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; }
.tile .em { display: inline-flex; }
.tile .em svg { width: 26px; height: 26px; }
.star-pill .s svg { width: 17px; height: 17px; }
.lesson-stars svg { width: 15px; height: 15px; }
.lesson-num svg { width: 20px; height: 20px; }
.btn svg { width: 19px; height: 19px; }
.speak-btn svg { width: 18px; height: 18px; }
.speak-btn.big svg { width: 21px; height: 21px; }
.end-emoji svg { width: 64px; height: 64px; color: var(--gold); }
.options.cols3 { grid-template-columns: repeat(3, 1fr); }
.options.cols3 .opt { font-size: clamp(38px, 12vw, 56px); border-radius: 24px; }
.end-stars { display: flex; justify-content: center; gap: 4px; }
.end-stars svg { width: 30px; height: 30px; }
.chip svg { width: 14px; height: 14px; }
.options.cols3 .opt { aspect-ratio: 1 / 1.22; font-size: clamp(46px, 15vw, 66px); }

/* صفوف تعليم الحروف */
.teach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 24px;
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: right;
}
.teach-row:active { transform: translateY(2px); }
.tr-letter {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 19px;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--naskh);
  font-size: 34px;
  font-weight: 700;
}
.tr-img { width: 46px; height: 46px; flex: 0 0 auto; }
.tr-body { flex: 1; min-width: 0; }
.tr-word { font-family: var(--naskh); font-size: 25px; font-weight: 700; }
.tr-name { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.tr-spk { color: var(--teal); font-size: 22px; }

/* الأرقام */
.tr-num { font-family: var(--font); font-size: 28px; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dots .d { width: 9px; height: 9px; border-radius: 50%; background: #F2A03D; opacity: .85; }
.letter-card .dots { justify-content: center; margin-top: 10px; }
.letter-card .dots .d { width: 13px; height: 13px; }
.options.isnum .opt { font-family: var(--font); font-size: clamp(38px, 13vw, 58px); font-weight: 800; }
.options.isnum.cols3 .opt { font-size: clamp(34px, 11vw, 50px); }

/* English */
.tr-en { font-family: var(--font); font-size: 30px; font-weight: 800; }
.options.isen .opt { font-family: var(--font); font-size: clamp(44px, 15vw, 64px); font-weight: 800; }
.options.isen.cols3 .opt { font-size: clamp(38px, 12vw, 54px); }

/* الألعاب */
.q-img { width: 118px; height: 118px; display: block; margin: 0 auto 8px; }
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mem-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(160deg, #FFFFFF 0%, #FFF3E2 100%);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  padding: 10px;
  cursor: pointer;
}
.mem-card img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .18s ease; }
.mem-card::after {
  content: '؟';
  position: absolute;
  font-size: 34px;
  font-weight: 800;
  color: #D6C9B4;
}
.mem-card.open { background: #fff; }
.mem-card.open img { opacity: 1; }
.mem-card.open::after { display: none; }
.mem-card.matched { background: #EAF7F3; box-shadow: 0 0 0 3px #2FA98C, var(--shadow-sm); }

.trace-wrap { background: #fff; border-radius: 26px; box-shadow: var(--shadow); padding: 8px; }
#trace { width: 100%; display: block; border-radius: 20px; touch-action: none; background: #FFFDF8; }
.trace-pick { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 6px; -webkit-overflow-scrolling: touch; }
.tp {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--naskh);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.tp.on { background: var(--teal); color: #fff; }

/* عدّات سؤال العد */
.qcard .dots { justify-content: center; margin: 0 auto 12px; max-width: 300px; }
.qcard .dots .d { width: 20px; height: 20px; }

/* دروس الكلمات والقراءة */
.qword { font-family: var(--naskh); font-size: clamp(38px, 12vw, 60px); font-weight: 700; margin-top: 4px; }
.opt.opt-pic { padding: 10px; }
.opt .opt-img { width: 76%; height: auto; display: block; margin: 0 auto; }
.qword.en { font-family: var(--font); font-size: clamp(32px, 10vw, 52px); letter-spacing: .01em; }
