/* رحلة الحروف — تطبيق أطفال: عمود جوال واحد، خريطة رحلة متعرّجة، شريط تنقّل سفلي، وبطاقات كبيرة سهلة اللمس */
:root {
  --bg: #E7F4FF;
  --bg-deco: #D3EBFF;
  --surface: #FFFFFF;
  --ink: #1C2B4B;
  --muted: #5E6B88;
  --line: #D4E4F3;
  --ocean: #1E8FE8;
  --grape: #7A4CF2;
  --coral: #FF5E5E;
  --sun: #FFC530;
  --mint: #1FBF86;
  --pink: #FF5FA2;
  --ok: #18A874;
  --ok-soft: #DDF7EC;
  --bad: #E5484D;
  --bad-soft: #FFE5E6;
  --card: #FFFFFF;            /* بطاقات الحروف فاتحة دائمًا */
  --card-line: #DCE7F2;
  --shadow: 0 6px 0 rgba(28, 43, 75, .12);
  --world: var(--ocean);
  --font: "Baloo Bhaijaan 2", "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1730; --bg-deco: #16214A; --surface: #1B2650; --ink: #EEF3FF; --muted: #9DABD0; --line: #2C3A6B;
    --ocean: #4DB2FF; --grape: #A589FF; --coral: #FF8080; --sun: #FFD24D; --mint: #3EDBA3; --pink: #FF8DC0;
    --ok: #3EDBA3; --ok-soft: #133A31; --bad: #FF7B80; --bad-soft: #3E1D26; --card: #FBFDFF; --card-line: #3A4A80;
    --shadow: 0 6px 0 rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1730; --bg-deco: #16214A; --surface: #1B2650; --ink: #EEF3FF; --muted: #9DABD0; --line: #2C3A6B;
  --ocean: #4DB2FF; --grape: #A589FF; --coral: #FF8080; --sun: #FFD24D; --mint: #3EDBA3; --pink: #FF8DC0;
  --ok: #3EDBA3; --ok-soft: #133A31; --bad: #FF7B80; --bad-soft: #3E1D26; --card: #FBFDFF; --card-line: #3A4A80;
  --shadow: 0 6px 0 rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 18px; line-height: 1.6;
  background-image: radial-gradient(circle at 12% 18%, var(--bg-deco) 0 46px, transparent 47px),
                    radial-gradient(circle at 88% 42%, var(--bg-deco) 0 70px, transparent 71px),
                    radial-gradient(circle at 20% 80%, var(--bg-deco) 0 58px, transparent 59px);
  background-attachment: fixed;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; border-radius: 14px; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }

/* الشريط العلوي */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 8px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--surface); border: 3px solid var(--sun); display: grid; place-items: center; flex: none; text-decoration: none; }
.avatar svg { width: 36px; height: 36px; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 10px; font-weight: 700; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.pill svg { width: 24px; height: 24px; }
.topbar .grow { flex: 1; }
.gear { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.gear svg { width: 24px; height: 24px; transition: transform .5s; }
.gear:hover svg { transform: rotate(90deg); }

/* الشريط السفلي */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 40; display: flex; justify-content: center;
  padding: 0 max(10px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); pointer-events: none; }
.tabbar nav { pointer-events: auto; width: 100%; max-width: 500px; background: var(--surface); border-radius: 26px; box-shadow: 0 8px 24px rgba(20, 40, 90, .18); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; }
.tabbar a { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 2px; border-radius: 20px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.tabbar a svg { width: 30px; height: 30px; }
.tabbar a[aria-current="page"] { background: color-mix(in srgb, var(--ocean) 14%, transparent); color: var(--ocean); }
.tabbar a[aria-current="page"] svg { animation: hop .6s ease; }

/* حركات الأيقونات */
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-7px) scale(1.08); } 70% { transform: translateY(1px) scale(.97); } }
@keyframes spin-star { 0%, 80% { transform: rotate(0); } 90% { transform: rotate(18deg) scale(1.15); } 100% { transform: rotate(0); } }
@keyframes flicker { 0%,100% { transform: scaleY(1) rotate(-2deg); } 50% { transform: scaleY(1.08) rotate(3deg); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--world) 50%, transparent); } 50% { transform: scale(1.06); box-shadow: 0 0 0 12px transparent; } }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.3); opacity: .6; } 100% { transform: scale(0); opacity: 0; } }
@keyframes float-up { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }
@keyframes drift { 0%,100% { transform: translate(0, 0); } 33% { transform: translate(6px, -10px); } 66% { transform: translate(-6px, -4px); } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-star { animation: spin-star 3.5s ease-in-out infinite; transform-origin: center; }
.anim-flame { animation: flicker 1.2s ease-in-out infinite; transform-origin: 50% 90%; }
.anim-bob { animation: bob 2.6s ease-in-out infinite; }
.anim-wiggle { animation: wiggle 2.2s ease-in-out infinite; }
.xp-float { position: fixed; z-index: 90; font-weight: 800; color: var(--sun); text-shadow: 0 2px 0 rgba(0,0,0,.25); font-size: 1.6rem; pointer-events: none; animation: float-up 1.1s ease-out forwards; }

/* عناوين وأزرار */
h1, h2, h3 { margin: 0; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 14px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; border: 0; border-radius: 20px; background: var(--world); color: #fff; font-weight: 800; font-size: 1.15rem; cursor: pointer; text-decoration: none; box-shadow: 0 5px 0 color-mix(in srgb, var(--world) 65%, #000); transition: transform .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--world) 65%, #000); }
.btn.soft { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn.sun { background: var(--sun); color: #3A2A00; box-shadow: 0 5px 0 #C99400; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 26px; height: 26px; }
.row-btns { display: flex; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 700; color: var(--muted); padding: 4px 0; }
.back svg { width: 22px; height: 22px; }
.panel { background: var(--surface); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }

/* خريطة الرحلة */
.world { margin: 18px 0 8px; }
.world-head { display: flex; align-items: center; gap: 12px; background: var(--world); color: #fff; border-radius: 24px; padding: 12px 16px; box-shadow: 0 6px 0 color-mix(in srgb, var(--world) 60%, #000); }
.world-head svg { width: 46px; height: 46px; flex: none; }
.world-head h2 { font-size: 1.25rem; }
.world-head p { margin: 0; font-size: .9rem; opacity: .9; }
.world-head .wp { margin-inline-start: auto; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.path { position: relative; display: grid; gap: 6px; padding: 44px 0 6px; }
.node-wrap { display: flex; flex-direction: column; align-items: center; width: 50%; }
.node-wrap.s0 { margin-inline-start: 25%; }
.node-wrap.s1 { margin-inline-start: 45%; }
.node-wrap.s2 { margin-inline-start: 25%; }
.node-wrap.s3 { margin-inline-start: 5%; }
.node { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 0; display: grid; place-items: center; text-decoration: none; cursor: pointer;
  background: var(--world); color: #fff; font-size: 2rem; font-weight: 800; box-shadow: 0 7px 0 color-mix(in srgb, var(--world) 60%, #000); font-variant-numeric: tabular-nums; }
.node.current { animation: pulse 1.8s ease-in-out infinite; }
.node.locked { background: var(--line); color: var(--muted); box-shadow: 0 7px 0 color-mix(in srgb, var(--line) 70%, #000); cursor: not-allowed; }
.node.locked svg { width: 34px; height: 34px; }
.node .ring { position: absolute; inset: -7px; }
.node-label { margin-top: 10px; font-weight: 700; font-size: .95rem; text-align: center; max-width: 160px; line-height: 1.35; }
.node-stars { display: flex; gap: 1px; justify-content: center; }
.node-stars svg { width: 20px; height: 20px; }
.here-tag { position: absolute; top: -34px; background: var(--sun); color: #3A2A00; font-size: .78rem; font-weight: 800; padding: 1px 10px; border-radius: 999px; white-space: nowrap; animation: bob 1.8s ease-in-out infinite; }
.here-tag::after { content: ""; position: absolute; bottom: -6px; inset-inline-start: calc(50% - 6px); border: 6px solid transparent; border-top-color: var(--sun); border-bottom: 0; }
.chest { display: flex; align-items: center; gap: 12px; text-decoration: none; margin: 12px 0 0; }

/* بطاقة الهدف اليومي */
.daily { display: flex; align-items: center; gap: 14px; }
.daily .ring-svg { width: 74px; height: 74px; flex: none; }
.daily b { font-size: 1.1rem; }

/* صفحة الدرس */
.lesson-hero { background: var(--world); color: #fff; border-radius: 28px; padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: 0 7px 0 color-mix(in srgb, var(--world) 60%, #000); }
.lesson-hero .big-n { width: 70px; height: 70px; border-radius: 22px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; flex: none; }
.lesson-hero h1 { font-size: 1.5rem; }
.lesson-hero .stars svg { width: 24px; height: 24px; }
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.step { position: relative; background: var(--surface); border-radius: 24px; padding: 16px 12px 14px; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: var(--shadow); font-weight: 800; }
.step svg.ico { width: 64px; height: 64px; }
.step small { font-weight: 500; color: var(--muted); font-size: .82rem; }
.step .tick { position: absolute; top: 10px; inset-inline-end: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.step:hover svg.ico { animation: hop .6s ease; }

/* بطاقات الحروف */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card { position: relative; background: var(--card); border: 3px solid var(--card-line); border-radius: 20px; height: 108px; padding: 10px; display: grid; place-items: center; cursor: pointer; transition: transform .12s; }
.card:active { transform: scale(.96); }
/* الصورة تملأ داخل الإطار دائمًا ولا تتجاوزه مهما كان حجمها الأصلي */
.card img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; pointer-events: none; }
.card .heard { position: absolute; top: 6px; inset-inline-end: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--mint); }
.card.playing { border-color: var(--sun); background: #FFF6D6; animation: wiggle .6s ease; }
.card.selected { border-color: var(--grape); }
.card.selected::after { content: "✓"; position: absolute; bottom: 4px; inset-inline-start: 10px; color: var(--grape); font-weight: 900; }
.card.mute { opacity: .6; cursor: default; }
.card .fallback { color: #6E7A96; font-size: .9rem; }
.card.right { border-color: var(--ok); background: #E4FAF0; }
.card.wrong { border-color: var(--bad); background: #FFE9EA; animation: shake .4s; }
.card.dim { opacity: .45; }

/* أدوات الاستكشاف */
.tools { display: grid; gap: 10px; }
.tools summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; align-items: center; gap: 8px; }
.tools summary::-webkit-details-marker { display: none; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 10px; }
.tool-row label { font-size: .9rem; color: var(--muted); font-weight: 700; }
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 4px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--world); color: #fff; }
.seg button:disabled { opacity: .4; }
select { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 3px 8px; font-weight: 700; }
.player { display: flex; gap: 10px; align-items: center; justify-content: center; }
.round-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.round-btn.main { width: 70px; height: 70px; background: var(--world); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--world) 60%, #000); }
.round-btn svg { width: 26px; height: 26px; }
.round-btn:disabled { opacity: .4; cursor: not-allowed; }
.chip { border: 0; background: var(--bg); border-radius: 999px; padding: 4px 14px; font-weight: 700; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--grape); color: #fff; }
.meter { height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--sun)); border-radius: 99px; transition: width .4s; }
.meter-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meter-row .meter { flex: 1; }

/* الأسئلة */
.q-head { display: flex; align-items: center; gap: 10px; }
.q-head .meter { flex: 1; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.close svg { width: 20px; height: 20px; }
.listen-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px; }
.speaker { width: 110px; height: 110px; border-radius: 50%; border: 0; background: var(--world); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 7px 0 color-mix(in srgb, var(--world) 60%, #000); }
.speaker svg { width: 56px; height: 56px; }
.speaker.on svg { animation: wiggle .5s ease infinite; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choices .card { height: 124px; }
.fb { min-height: 64px; border-radius: 20px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-weight: 800; animation: rise .25s ease; }
.fb.ok { background: var(--ok-soft); color: var(--ok); }
.fb.no { background: var(--bad-soft); color: var(--bad); }
.fb svg { width: 48px; height: 48px; flex: none; }
.combo { font-weight: 800; color: var(--coral); }

/* الألعاب */
.game-list { display: grid; gap: 14px; }
.game-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border-radius: 26px; padding: 14px; box-shadow: var(--shadow); text-decoration: none; }
.game-card svg.ico { width: 76px; height: 76px; flex: none; }
.game-card p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.game-card .best { margin-inline-start: auto; text-align: center; font-weight: 800; color: var(--grape); font-size: .85rem; }
.lesson-pick { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.lesson-pick button { flex: none; width: 52px; height: 52px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-weight: 800; font-size: 1.15rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.lesson-pick button[aria-pressed="true"] { background: var(--grape); color: #fff; }
.lesson-pick button:disabled { opacity: .35; cursor: not-allowed; }
.pond { position: relative; height: 380px; border-radius: 28px; overflow: hidden; background: linear-gradient(180deg, color-mix(in srgb, var(--ocean) 18%, var(--surface)), color-mix(in srgb, var(--ocean) 34%, var(--surface))); }
.bubble { position: absolute; width: 132px; height: 132px; border-radius: 50%; border: 4px solid rgba(255,255,255,.9); background: radial-gradient(circle at 32% 28%, #fff 0 10%, rgba(255,255,255,.92) 11%); box-shadow: inset -8px -10px 20px rgba(30,143,232,.25), 0 6px 16px rgba(20,40,90,.18); display: grid; place-items: center; cursor: pointer; padding: 22px; animation: drift 4s ease-in-out infinite; }
.bubble img { position: absolute; inset: 26px; width: calc(100% - 52px); height: calc(100% - 52px); object-fit: contain; pointer-events: none; }
.bubble.popped { animation: pop .4s ease forwards; }
.bubble.wrong { animation: shake .4s; border-color: var(--bad); }
.memory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; perspective: 800px; }
.tile { height: 100px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.tile .in { position: relative; display: block; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.tile.open .in, .tile.done .in { transform: rotateY(180deg); }
.tile .face { position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden; display: grid; place-items: center; }
.tile .front { background: var(--grape); box-shadow: 0 5px 0 color-mix(in srgb, var(--grape) 60%, #000); }
.tile .front svg { width: 40px; height: 40px; }
.tile .back { background: var(--card); border: 3px solid var(--card-line); transform: rotateY(180deg); padding: 8px; }
.tile .back img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.tile.done .back { border-color: var(--ok); background: #E4FAF0; }
.timer { font-size: 1.8rem; font-weight: 800; color: var(--coral); font-variant-numeric: tabular-nums; }

/* التقويم */
.assess-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border-radius: 24px; padding: 14px; box-shadow: var(--shadow); text-decoration: none; }
.assess-card svg.ico { width: 60px; height: 60px; flex: none; }
.assess-card .sc { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; color: var(--world); font-variant-numeric: tabular-nums; }
.assess-card.locked { opacity: .55; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.cal .dow { font-size: .75rem; color: var(--muted); font-weight: 700; }
.cal .d { aspect-ratio: 1; max-width: 100%; border-radius: 12px; display: grid; place-items: center; font-size: .9rem; font-weight: 700; background: var(--bg); }
.cal .d.l1 { background: color-mix(in srgb, var(--mint) 35%, var(--surface)); }
.cal .d.l2 { background: color-mix(in srgb, var(--mint) 65%, var(--surface)); }
.cal .d.l3 { background: var(--mint); color: #fff; }
.cal .d.today { outline: 3px solid var(--sun); }
.cal .d.empty { background: transparent; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--bg); cursor: pointer; display: grid; place-items: center; }
.cal-head button svg { width: 18px; height: 18px; }
.legend { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.scores { display: grid; gap: 8px; }
.score-row { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 6px 4px; border-bottom: 2px dashed var(--line); }
.score-row:last-child { border-bottom: 0; }
.score-row .n { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; }
.score-row .stars { margin-inline-start: auto; display: flex; }
.score-row .stars svg { width: 20px; height: 20px; }

/* إنجازاتي */
.me-hero { text-align: center; display: grid; gap: 6px; justify-items: center; }
.me-hero .mascot-lg { width: 130px; height: 130px; }
.rank { display: inline-block; background: var(--grape); color: #fff; border-radius: 999px; padding: 2px 16px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: 22px; padding: 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.stat svg { width: 40px; height: 40px; flex: none; }
.stat b { display: block; font-size: 1.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.badge { text-align: center; display: grid; justify-items: center; gap: 4px; font-size: .8rem; font-weight: 700; line-height: 1.3; }
.badge svg { width: 74px; height: 74px; }
.badge.locked svg { filter: grayscale(1); opacity: .35; }
.badge.locked { color: var(--muted); }
.badge:not(.locked) svg { animation: bob 3s ease-in-out infinite; }

/* لوحة الإعدادات */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 45, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: var(--surface); border-radius: 28px 28px 0 0; padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; animation: rise .25s ease; max-height: 88vh; overflow-y: auto; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.switch { width: 58px; height: 34px; border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; }
.switch[aria-checked="true"] { background: var(--mint); }
.switch[aria-checked="true"]::after { inset-inline-start: 28px; }

/* النافذة الاحتفالية */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(10, 20, 45, .55); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 380px; background: var(--surface); border-radius: 30px; padding: 22px 18px; text-align: center; display: grid; gap: 10px; justify-items: center; animation: rise .3s ease; }
.modal svg.big { width: 120px; height: 120px; }
.modal .stars-row svg { width: 52px; height: 52px; }
.modal .stars-row svg:nth-child(2) { transform: translateY(-10px); }
#confetti { position: fixed; inset: 0; z-index: 85; pointer-events: none; }

/* دليل المعلم */
.guide { display: grid; gap: 12px; }
.guide section { background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.guide h3 { color: var(--world); margin-bottom: 6px; }
.guide ol, .guide ul { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 4px; }
.guide p { margin: 0; }
.guide .rule { border-inline-start: 6px solid var(--sun); }
.media-warning { background: var(--bad-soft); color: var(--bad); border-radius: 18px; padding: 10px 14px; font-weight: 700; font-size: .92rem; }
.note { font-size: .9rem; color: var(--muted); background: var(--surface); border-radius: 16px; padding: 8px 12px; }
.credit { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 24px; }
.toast { position: fixed; z-index: 95; top: calc(70px + env(safe-area-inset-top, 0px)); inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90vw; background: var(--ink); color: var(--bg); padding: 8px 18px; border-radius: 999px; font-weight: 700; animation: rise .2s ease; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* أقسام الدرس ومجموعات الحروف */
.secs { display: grid; gap: 18px; }
.sec { display: grid; gap: 10px; }
.sec h3 { display: flex; gap: 10px; align-items: flex-start; font-size: 1rem; line-height: 1.6; background: var(--surface); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); border-inline-start: 6px solid var(--world); }
.sec-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--world); color: #fff; display: grid; place-items: center; font-size: .9rem; }
.groups { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grp { position: relative; display: grid; grid-template-columns: repeat(var(--g), minmax(0, 1fr)); gap: 8px; background: color-mix(in srgb, var(--world) 10%, var(--surface)); border-radius: 22px; padding: 14px 8px 8px; }
.grp-n { position: absolute; top: -10px; inset-inline-start: 12px; background: var(--world); color: #fff; border-radius: 999px; padding: 0 10px; font-size: .78rem; font-weight: 800; z-index: 1; font-variant-numeric: tabular-nums; }
.grp .card { height: 96px; }
.goals h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.goals h3 svg { width: 24px; height: 24px; }
.goals ol { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 4px; }
.goals p { margin: 6px 0 0; }

/* الحساب */
.field { display: grid; gap: 4px; font-weight: 700; }
.field input { font: inherit; font-weight: 500; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); }
.field input:focus { border-color: var(--ocean); outline: none; }
.field small { font-weight: 500; color: var(--muted); }
.form-err { color: var(--bad); font-weight: 700; min-height: 1.5em; margin: 0; }
.acct { display: flex; gap: 12px; align-items: center; }
.acct .ava { width: 52px; height: 52px; border-radius: 50%; background: var(--ocean); color: #fff; display: grid; place-items: center; flex: none; }
.acct .ava svg { width: 30px; height: 30px; }
.sync-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--ok); font-weight: 700; }
.sync-tag svg { width: 16px; height: 16px; }
.sync-tag.off { color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--ocean); font-weight: 700; cursor: pointer; padding: 4px; }
.welcome { text-align: center; display: grid; gap: 12px; justify-items: center; padding-top: 20px; }
.welcome svg.hero-star { width: 150px; height: 150px; }

/* المشاركة */
.share-prev { width: 100%; max-width: 300px; border-radius: 20px; box-shadow: var(--shadow); justify-self: center; }
.btn.wa { background: #25D366; box-shadow: 0 5px 0 #1A9E4B; }

/* طرق القراءة الرسمية (تهجي اللسان، تهجي النظر، القراءة المباشرة...) */
.ways-box { display: grid; gap: 8px; margin-bottom: 12px; }
.ways-t { font-size: .95rem; }
.ways { display: flex; flex-wrap: wrap; gap: 8px; }
.way { border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; min-height: 44px; }
.way[aria-checked="true"] { background: var(--world); border-color: var(--world); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--world) 60%, #000); }
.way-hint { margin: 0; font-size: .85rem; color: var(--muted); }
