/* =========================================================
   سُلَّم ٢٠٢٧ · نظام التصميم
   ثيم لكل عمر عبر body[data-age]:
   small (٤–٦) و mid (٧–١٠): مرح ملوّن وأزرار ثلاثية الأبعاد
   pre (١١–١٤): مغامرة بألوان أعمق
   teen (١٥+ والجامعة): تركيز، وضع ليلي افتراضي
   adult: صفحات ولي الأمر
   ========================================================= */
:root, [data-age="small"], [data-age="mid"] {
  --bg: #F4F1FF; --surface: #FFFFFF; --surface-2: #F7F5FF; --surface-3: #EFEBFF;
  --ink: #1F1846; --muted: #6B6790; --line: #E7E2FB;
  --primary: #6C4BFF; --primary-deep: #4A2FD4; --on-primary: #FFFFFF; --primary-soft: #ECE7FF;
  --accent: #FFC22E; --accent-deep: #E39500; --on-accent: #3A2600; --accent-soft: #FFF4D6;
  --mint: #22C7B0; --mint-deep: #109C8A; --mint-soft: #DDF8F3;
  --pink: #FF6FA3; --pink-soft: #FFE6F0;
  --good: #22B573; --good-deep: #168A55; --good-soft: #E2F8EC;
  --bad: #FF5A5F; --bad-deep: #D63C42; --bad-soft: #FFE8E8;
  --hero: linear-gradient(135deg, #7B5CFF 0%, #5B8CFF 55%, #22C7B0 120%);
  --glass: rgba(255, 255, 255, .78);
  --radius: 26px; --radius-sm: 18px; --fs: 18px;
  --shadow: 0 1px 2px rgba(31, 24, 70, .05), 0 10px 30px -12px rgba(76, 52, 200, .22);
  --shadow-lg: 0 24px 60px -20px rgba(76, 52, 200, .45);
  --display: 'Baloo Bhaijaan 2', 'Noto Sans Arabic', system-ui, sans-serif;
  --body: 'Noto Sans Arabic', system-ui, sans-serif;
  --page-art: radial-gradient(900px 500px at 100% -10%, #E3DBFF 0%, transparent 60%),
              radial-gradient(700px 500px at -10% 30%, #D9F7F1 0%, transparent 60%),
              radial-gradient(600px 400px at 60% 110%, #FFEBD6 0%, transparent 60%);
}
[data-age="small"] { --fs: 20px; --radius: 30px; }
[data-age="pre"] {
  --bg: #EEF0FF; --surface: #FFFFFF; --surface-2: #F4F5FF; --surface-3: #E8EAFF;
  --ink: #141738; --muted: #5F6488; --line: #E0E3FA;
  --primary: #4F46E5; --primary-deep: #3730B8; --primary-soft: #E6E5FF;
  --accent: #FF4D8D; --accent-deep: #D02A69; --on-accent: #FFFFFF; --accent-soft: #FFE4EE;
  --hero: linear-gradient(135deg, #312E81 0%, #6D28D9 55%, #DB2777 125%);
  --radius: 22px; --radius-sm: 16px; --fs: 17px;
  --page-art: radial-gradient(800px 500px at 100% -10%, #DCD9FF 0%, transparent 60%),
              radial-gradient(700px 500px at -10% 40%, #FFE1EE 0%, transparent 60%);
}
[data-age="teen"], [data-age="teen"][data-theme="dark"] {
  --bg: #0A0D14; --surface: #121722; --surface-2: #171E2C; --surface-3: #1E2738;
  --ink: #EEF1FA; --muted: #8C95AD; --line: rgba(255, 255, 255, .08);
  --primary: var(--pc-night, #7C6CFF); --primary-deep: color-mix(in srgb, var(--primary) 75%, #000); --on-primary: #FFFFFF; --primary-soft: color-mix(in srgb, var(--primary) 18%, transparent);
  --accent: #C8F560; --accent-deep: #9BC93A; --on-accent: #10140A; --accent-soft: rgba(200, 245, 96, .14);
  --mint: #2EE6C8; --mint-deep: #19B39A; --mint-soft: rgba(46, 230, 200, .14);
  --pink: #FF7AB6; --pink-soft: rgba(255, 122, 182, .14);
  --good: #34D399; --good-deep: #1FA477; --good-soft: rgba(52, 211, 153, .14);
  --bad: #F87171; --bad-deep: #D14848; --bad-soft: rgba(248, 113, 113, .14);
  --hero: linear-gradient(135deg, #1B1F3B 0%, #2B2160 55%, #3B1C5A 100%);
  --glass: rgba(18, 23, 34, .82);
  --radius: 20px; --radius-sm: 14px; --fs: 17px;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 12px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
  --display: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', system-ui, sans-serif;
  --page-art: radial-gradient(800px 500px at 100% -10%, rgba(124, 108, 255, .22) 0%, transparent 60%),
              radial-gradient(600px 400px at -10% 40%, rgba(46, 230, 200, .10) 0%, transparent 60%);
  color-scheme: dark;
}
[data-age="teen"][data-theme="light"], [data-age="adult"] {
  --bg: #F5F6FA; --surface: #FFFFFF; --surface-2: #F3F4F8; --surface-3: #EAECF3;
  --ink: #12151F; --muted: #5E6578; --line: #E4E7EF;
  --primary: var(--pc-day, #5B4BF0); --primary-deep: var(--pc-day-deep, #4134C4); --primary-soft: color-mix(in srgb, var(--primary) 12%, #fff);
  --accent: #B7E93F; --accent-deep: #8DBA22; --on-accent: #12170A; --accent-soft: #F1FADB;
  --good: #16A36A; --good-deep: #0F7E52; --good-soft: #E2F6EC;
  --bad: #E5484D; --bad-deep: #C0353A; --bad-soft: #FDE8E8;
  --hero: linear-gradient(135deg, #1E1B4B 0%, #3B2F8F 60%, #5B4BF0 120%);
  --glass: rgba(255, 255, 255, .85);
  --shadow: 0 1px 2px rgba(18, 21, 31, .05), 0 10px 28px -14px rgba(18, 21, 31, .18);
  --page-art: radial-gradient(800px 500px at 100% -10%, #E7E4FF 0%, transparent 60%);
  color-scheme: light;
}
[data-age="adult"] {
  --primary: #0B6E69; --primary-deep: #07504C; --primary-soft: #E1F0EE;
  --accent: #FFB020; --accent-deep: #D98E00; --on-accent: #2A1C00; --accent-soft: #FFF3D6;
  --hero: linear-gradient(135deg, #0A4F4B 0%, #0B6E69 60%, #22A699 120%);
  --display: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', system-ui, sans-serif;
  --radius: 20px; --radius-sm: 14px; --fs: 16px;
  --page-art: radial-gradient(800px 500px at 100% -10%, #DDF1EE 0%, transparent 60%);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body); font-size: var(--fs); color: var(--ink);
  background: var(--page-art), var(--bg); background-attachment: fixed;
  line-height: 1.75; -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
/* التشكيل يحتاج مسافة أسطر أكبر */
body[data-tashkeel="on"] { line-height: 1.95; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, .display { font-family: var(--display); letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .7rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }

/* ---------- الهيكل ---------- */
.app { min-height: 100dvh; display: flex; }
.app-main { flex: 1; min-width: 0; padding-bottom: 120px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 720px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }

/* الشريط السفلي العائم (جوال) والشريط الجانبي (شاشات كبيرة) */
.nav {
  position: fixed; z-index: 30; inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
  display: flex; justify-content: space-around; align-items: center; gap: 2px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 26px; padding: 8px; box-shadow: var(--shadow-lg);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0;
  font-size: 11px; font-weight: 700; color: var(--muted); padding: 7px 2px; border-radius: 18px; transition: background .2s, color .2s;
}
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--primary); background: var(--primary-soft); }
.nav a.cta { color: var(--on-primary); background: var(--primary); box-shadow: 0 4px 0 var(--primary-deep); transform: translateY(-10px); border-radius: 20px; padding: 10px 2px; flex: 1.1; }
.nav .brand { display: none; }
@media (min-width: 960px) {
  .app-main { padding-bottom: 40px; }
  .nav {
    position: sticky; top: 0; inset: auto; height: 100dvh; width: 104px; flex: none;
    flex-direction: column; justify-content: flex-start; gap: 6px; border-radius: 0;
    border: 0; border-left: 1px solid var(--line); padding: 22px 12px; box-shadow: none;
  }
  .nav .brand { display: flex; justify-content: center; margin-bottom: 16px; }
  .nav a { flex: none; width: 100%; padding: 12px 4px; font-size: 12px; }
  .nav a.cta { transform: none; }
  .wrap { padding: 0 32px; }
}

/* ---------- الرأس ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 0 12px; }
.topbar h1 { margin: 0; font-size: 1.45rem; line-height: 1.25; font-weight: 800; }
.topbar .sub { color: var(--muted); font-size: .8rem; font-weight: 600; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 800; font-size: .9rem; border: 0; white-space: nowrap;
}
.chip svg { width: 20px; height: 20px; }
.chip.flame { color: #FF7A1A; } .chip.star { color: #E39500; }
[data-age="teen"] .chip.star { color: var(--accent); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center; border: 0; color: var(--ink); flex: none;
}
.avatar-ring { position: relative; display: inline-flex; border-radius: 50%; padding: 3px; background: conic-gradient(var(--primary), var(--mint), var(--accent), var(--primary)); }
.avatar-ring > svg { border-radius: 50%; background: var(--surface); }
.edit-avatar::after { content: '✎'; position: absolute; bottom: -2px; left: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--accent-deep); }

/* صفحة داخلية برأس متدرّج */
.hero-band { background: var(--hero); color: #fff; border-radius: 0 0 34px 34px; padding: 18px 0 26px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero-band::before, .hero-band::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .10); }
.hero-band::before { width: 260px; height: 260px; top: -120px; left: -60px; }
.hero-band::after { width: 180px; height: 180px; bottom: -110px; right: 12%; }
.hero-band > * { position: relative; z-index: 1; }
.hero-band h1 { margin: 0; font-size: 1.45rem; line-height: 1.3; }
.hero-band .sub { color: rgba(255, 255, 255, .8); font-size: .8rem; font-weight: 600; }
.hero-band .icon-btn { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: none; }
.hero-band .chip { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: none; }

/* ---------- البطاقات والأزرار ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 800; margin: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 10px 2px 2px; }
.btn {
  --b: var(--accent); --bd: var(--accent-deep); --bi: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 22px; border-radius: 18px; border: 0; font-family: var(--display);
  font-weight: 800; font-size: 1.05rem; background: var(--b); color: var(--bi);
  box-shadow: 0 5px 0 var(--bd); transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--bd); }
.btn.primary { --b: var(--primary); --bd: var(--primary-deep); --bi: var(--on-primary); }
.btn.good { --b: var(--good); --bd: var(--good-deep); --bi: #fff; }
.btn.bad { --b: var(--bad); --bd: var(--bad-deep); --bi: #fff; }
.btn.ghost { --b: var(--surface); --bd: var(--line); --bi: var(--ink); border: 2px solid var(--line); }
.btn.sm { min-height: 42px; padding: 0 14px; font-size: .9rem; border-radius: 14px; box-shadow: 0 3px 0 var(--bd); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
[data-age="teen"] .btn { box-shadow: none; } [data-age="teen"] .btn:active { transform: scale(.98); }
[data-age="adult"] .btn { box-shadow: none; font-family: var(--body); } [data-age="adult"] .btn:active { transform: scale(.98); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; border-radius: 10px; padding: 2px 10px; background: var(--primary-soft); color: var(--primary); }
.tag.soon { background: var(--accent-soft); color: var(--accent-deep); }
[data-age="teen"] .tag.soon { color: var(--accent); }
.tag.good { background: var(--good-soft); color: var(--good-deep); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bubble { display: flex; align-items: center; gap: 12px; background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; }
[data-age="teen"] .bubble { background: var(--surface-2); }

/* حلقة تقدّم دائرية */
.ring { --p: 0; --c: var(--primary); --t: var(--surface-3); --s: 64px; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--t) 0); display: grid; place-items: center; position: relative; }
.ring::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring > * { position: relative; z-index: 1; font-weight: 800; font-size: .85rem; }
.hero-card .ring { --t: rgba(255, 255, 255, .25); --c: #fff; }
.hero-card .ring::before { background: rgba(0, 0, 0, .12); }

/* ---------- الرئيسية (بنتو) ---------- */
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bento > .span-2 { grid-column: span 2; }
@media (min-width: 760px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bento > .span-2 { grid-column: span 2; }
  .bento > .span-4 { grid-column: span 4; }
  .bento > .row-2 { grid-row: span 2; }
}
.hero-card {
  background: var(--hero); color: #fff; border-radius: calc(var(--radius) + 4px); padding: 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; min-height: 230px;
}
.hero-card::after { content: ''; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .10); top: -90px; left: -70px; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .k { font-size: .75rem; font-weight: 800; letter-spacing: .02em; opacity: .85; text-transform: uppercase; }
.hero-card h2 { margin: 0; font-size: 1.5rem; line-height: 1.35; }
.hero-card .mascot { position: absolute; left: 14px; bottom: 10px; z-index: 0; opacity: .98; }
.hero-card .btn { align-self: flex-start; }
.tile {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); min-height: 130px; position: relative; overflow: hidden; transition: transform .15s;
}
.tile:hover { transform: translateY(-2px); }
.tile .ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: #fff; }
.tile .ic svg { width: 26px; height: 26px; }
.tile b { font-family: var(--display); font-size: 1.05rem; line-height: 1.3; }
.tile .count { position: absolute; top: 12px; left: 12px; min-width: 28px; height: 28px; border-radius: 10px; padding: 0 8px; background: var(--bad); color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
.ic.violet { background: linear-gradient(135deg, #8E7BFF, #5B6CFF); }
.ic.mint { background: linear-gradient(135deg, #3FE0B5, #11A3C2); }
.ic.sun { background: linear-gradient(135deg, #FFD45C, #FF8A3D); }
.ic.pink { background: linear-gradient(135deg, #FF8FB1, #FF5C6C); }
.week-strip { display: flex; justify-content: space-between; gap: 4px; }
.week-strip span { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.week-strip i { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-style: normal; }
.week-strip i.on { background: linear-gradient(135deg, #FFB347, #FF6A3D); box-shadow: 0 3px 0 #D8501F; }
.week-strip i.today { outline: 3px solid var(--primary); outline-offset: 2px; }
.subjects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 760px) { .subjects { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.subj {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.subj::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 70px; background: linear-gradient(135deg, var(--g1), var(--g2)); opacity: .14; }
.subj:hover { transform: translateY(-3px); }
.subj > * { position: relative; }
.subj b { font-family: var(--display); font-size: 1.1rem; }
.subj .bar > i { background: linear-gradient(90deg, var(--g1), var(--g2)); }
.subj.dim { opacity: .6; }

/* ---------- رحلة المادة (مسار الدروس) ---------- */
.unit-banner { border-radius: var(--radius); padding: 16px 18px; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 6px 0 rgba(0, 0, 0, .12); display: flex; align-items: center; gap: 12px; }
.unit-banner h3 { margin: 0; font-size: 1.15rem; line-height: 1.4; }
.unit-banner .sub { opacity: .85; font-size: .78rem; font-weight: 700; }
.units-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.units-scroller a { flex: none; padding: 8px 14px; border-radius: 14px; background: rgba(255, 255, 255, .18); color: #fff; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.units-scroller a.on { background: #fff; color: var(--ink); }
.journey { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0 30px; }
.node { --x: 0px; display: flex; flex-direction: column; align-items: center; gap: 6px; transform: translateX(var(--x)); text-align: center; width: 180px; }
.node .disc {
  width: 76px; height: 72px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--surface-3); color: var(--muted); box-shadow: 0 7px 0 rgba(0, 0, 0, .12);
}
.node .disc svg { width: 32px; height: 32px; }
.node.done .disc { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; box-shadow: 0 7px 0 rgba(0, 0, 0, .18); }
.node.now .disc { background: var(--accent); color: var(--on-accent); box-shadow: 0 7px 0 var(--accent-deep); animation: bob 2.4s ease-in-out infinite; }
.node.now .disc::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 4px solid var(--accent); opacity: .35; animation: pulse 2s ease-out infinite; }
.node.open .disc { background: var(--surface); color: var(--primary); box-shadow: 0 7px 0 var(--line), inset 0 0 0 3px var(--primary-soft); }
.node.soon .disc { background: var(--accent-soft); color: var(--accent-deep); box-shadow: 0 7px 0 rgba(0, 0, 0, .06); border: 2px dashed var(--accent); }
.node .title { font-weight: 800; font-size: .9rem; line-height: 1.4; }
.node .start { position: absolute; top: -40px; background: var(--surface); color: var(--primary); font-weight: 800; font-size: .78rem; padding: 4px 12px; border-radius: 12px; box-shadow: var(--shadow); white-space: nowrap; }
.node .start::after { content: ''; position: absolute; bottom: -6px; right: calc(50% - 6px); border: 6px solid transparent; border-top-color: var(--surface); border-bottom: 0; }
.stars { display: flex; gap: 2px; justify-content: center; }
.stars svg { width: 16px; height: 16px; }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes pulse { from { transform: scale(.9); opacity: .5; } to { transform: scale(1.25); opacity: 0; } }
/* الثانوي والجامعة: قائمة زمنية نظيفة بدل المسار المتعرّج */
[data-age="teen"] .journey { align-items: stretch; gap: 10px; }
[data-age="teen"] .node { transform: none; width: auto; flex-direction: row; text-align: right; gap: 14px; background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
[data-age="teen"] .node .disc { width: 48px; height: 48px; box-shadow: none; animation: none; }
[data-age="teen"] .node .disc::after, [data-age="teen"] .node .start { display: none; }
[data-age="teen"] .node .disc svg { width: 22px; height: 22px; }
[data-age="teen"] .node .stars { justify-content: flex-start; }

/* ---------- الدرس ---------- */
.lesson-top { position: sticky; top: 0; z-index: 20; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.lesson-top .inner { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.lesson-top .t { flex: 1; min-width: 0; }
.lesson-top .t b { display: block; font-family: var(--display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-top .t span { font-size: .72rem; color: var(--muted); font-weight: 700; }
.seg-progress { display: flex; gap: 4px; padding-bottom: 10px; }
.seg-progress i { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); transition: background .3s; }
.seg-progress i.done { background: var(--good); }
.seg-progress i.on { background: var(--primary); }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.tabs button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 700; white-space: nowrap;
}
.tabs button svg { width: 18px; height: 18px; }
.tabs button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.tabs button .tick { width: 18px; height: 18px; border-radius: 50%; background: var(--good); color: #fff; display: inline-grid; place-items: center; font-size: 11px; }
.panel { display: none; padding-top: 10px; }
.panel.on { display: block; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.prose { font-size: 1.08em; line-height: 2; }
.prose p { margin: 0 0 .8em; }
.prose b, .prose strong { color: var(--primary); }
.idea-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
@media (max-width: 520px) { .idea-card { grid-template-columns: 1fr; } .idea-card .mascot { margin: 0 auto; } }
.video { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.method-note { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.method-note b { color: var(--ink); }

/* ---------- محرك الأسئلة ---------- */
.quiz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.quiz-head .bar { flex: 1; height: 14px; }
.quiz-head .bar > i { background: linear-gradient(90deg, var(--good), var(--mint)); }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--primary); background: var(--primary-soft); padding: 4px 10px; border-radius: 12px; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.lvl i.on { background: var(--primary); }
.qcard { text-align: center; }
.qcard .prompt { font-family: var(--display); font-size: 1.45em; font-weight: 800; margin: 8px 0 16px; line-height: 1.6; }
.qcard .q-meta { display: flex; align-items: center; justify-content: center; gap: 8px; }
.listen { border: 0; background: var(--primary-soft); color: var(--primary); border-radius: 14px; width: 46px; height: 42px; display: inline-grid; place-items: center; }
.listen svg { width: 22px; height: 22px; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.options.one { grid-template-columns: 1fr; }
.opt {
  min-height: 70px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); font-size: 1.35em; font-weight: 800;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s, box-shadow .08s, border-color .15s, background .15s; padding: 8px 12px; line-height: 1.5;
}
.opt:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 4px 0 var(--primary); color: var(--primary); }
.opt.right { border-color: var(--good); background: var(--good-soft); color: var(--good-deep); box-shadow: 0 4px 0 var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-deep); box-shadow: 0 4px 0 var(--bad); animation: shake .35s; }
.opt.faded { opacity: .45; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.answer-in { width: 100%; min-height: 70px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-align: center; font: inherit; font-size: 1.6em; font-weight: 800; }
.answer-in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.answer-in.right { border-color: var(--good); background: var(--good-soft); } .answer-in.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.check-row { margin-top: 16px; }
/* القطع (ترتيب، فراغات، تصنيف) */
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 60px; }
.tile-chip {
  min-width: 56px; min-height: 54px; padding: 6px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  font-weight: 800; font-size: 1.2em; box-shadow: 0 4px 0 var(--line); transition: transform .12s, opacity .2s;
}
.tile-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.tile-chip.used { opacity: .25; pointer-events: none; }
.tile-chip.picked { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 4px 0 var(--primary); }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 66px; padding: 8px; border-radius: 20px; border: 2px dashed var(--line); margin-bottom: 16px; background: var(--surface-2); }
.slots .tile-chip { box-shadow: 0 3px 0 var(--primary); border-color: var(--primary); }
.slots .ph { color: var(--muted); font-size: .85rem; align-self: center; }
.slots.right { border-color: var(--good); background: var(--good-soft); } .slots.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.sentence { font-size: 1.35em; font-weight: 700; line-height: 2.4; margin-bottom: 16px; }
.blank { display: inline-flex; min-width: 84px; min-height: 48px; vertical-align: middle; align-items: center; justify-content: center; padding: 0 10px; margin: 0 4px; border-radius: 14px; border: 2px dashed var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.blank.filled { border-style: solid; }
.blank.cur { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent-deep); }
.blank.right { border-color: var(--good); background: var(--good-soft); color: var(--good-deep); } .blank.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-deep); }
/* التوصيل */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 26px; position: relative; }
.match .col { display: flex; flex-direction: column; gap: 10px; }
.match .tile-chip { width: 100%; }
.match .tile-chip[data-pair] { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, var(--surface)); box-shadow: 0 4px 0 var(--pc); }
.match .tile-chip.right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.match .tile-chip.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 4px 0 var(--bad); animation: shake .35s; }
/* التصنيف */
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 14px; }
.bucket { border-radius: 20px; border: 2px dashed var(--line); background: var(--surface-2); min-height: 120px; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; transition: border-color .2s, background .2s; }
.bucket > b { font-family: var(--display); font-size: .95rem; }
.bucket.target { border-color: var(--primary); background: var(--primary-soft); cursor: pointer; }
.bucket .tile-chip { font-size: 1em; min-height: 42px; box-shadow: 0 2px 0 var(--line); }
.bucket .tile-chip.right { border-color: var(--good); background: var(--good-soft); } .bucket .tile-chip.wrong { border-color: var(--bad); background: var(--bad-soft); }
/* خط الأعداد */
.nline { padding: 26px 8px 4px; }
.nline input[type=range] { width: 100%; accent-color: var(--primary); height: 36px; direction: ltr; }
.nline .ticks { display: flex; justify-content: space-between; direction: ltr; font-weight: 800; color: var(--muted); font-size: .85rem; padding: 0 6px; }
.nline .val { display: inline-block; font-family: var(--display); font-size: 2.2rem; font-weight: 800; color: var(--primary); background: var(--primary-soft); border-radius: 18px; padding: 0 22px; }
.nline .val.right { color: var(--good-deep); background: var(--good-soft); } .nline .val.wrong { color: var(--bad-deep); background: var(--bad-soft); }
/* بناء العدد (عشرات وآحاد) */
.build { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.build .col { background: var(--surface-2); border-radius: 20px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.build .pile { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 92px; align-items: flex-end; }
.build .rod { width: 12px; height: 86px; border-radius: 5px; background: repeating-linear-gradient(180deg, #7B5CFF 0 7.6px, #5A3BE0 7.6px 8.6px); }
.build .cube { width: 16px; height: 16px; border-radius: 4px; background: var(--accent); box-shadow: inset 0 -2px 0 var(--accent-deep); }
.build .pm { display: flex; gap: 8px; }
.build .pm button { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--primary); color: #fff; font-size: 1.4rem; font-weight: 800; box-shadow: 0 3px 0 var(--primary-deep); }
.build-total { font-family: var(--display); font-size: 2rem; font-weight: 800; margin-top: 10px; }
/* الصور المساعدة */
.emoji-row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 2.1rem; line-height: 1.2; margin-bottom: 8px; }
.emoji-group { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: 240px; gap: 3px; padding: 8px 10px; border-radius: 18px; background: var(--surface-2); }
.emoji-row .op { font-size: 1.6rem; color: var(--primary); }
.swatch { width: 110px; height: 110px; border-radius: 30px; margin: 0 auto 10px; box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .06), 0 8px 0 rgba(0, 0, 0, .08); }
.big-glyph { font-family: var(--display); font-size: 5rem; font-weight: 800; line-height: 1.2; color: var(--primary); margin-bottom: 4px; }
.mini-dates { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.mini-dates i { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #A0552A, #5E2A10); }

/* ورقة التغذية الراجعة (تظهر من الأسفل) */
.sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60; transform: translateY(110%); transition: transform .28s cubic-bezier(.2, .9, .3, 1.1);
  background: var(--surface); border-radius: 28px 28px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .35);
}
.sheet.on { transform: none; }
.sheet .inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.sheet .head { display: flex; align-items: center; gap: 12px; }
.sheet .head b { font-family: var(--display); font-size: 1.35rem; }
.sheet.good { background: var(--good-soft); } .sheet.good .head b { color: var(--good-deep); }
.sheet.bad { background: var(--bad-soft); } .sheet.bad .head b { color: var(--bad-deep); }
.sheet .explain { background: var(--surface); border-radius: 16px; padding: 10px 14px; font-size: .95rem; line-height: 1.9; }
.sheet .actions { display: flex; gap: 10px; }
.sheet .actions .btn { flex: 1; }
.hint-box { background: var(--accent-soft); border-radius: 16px; padding: 10px 14px; margin-top: 12px; font-weight: 700; display: none; }
.hint-box.on { display: block; animation: rise .25s ease; }

/* الاحتفال */
.celebrate { position: fixed; inset: 0; z-index: 70; background: rgba(15, 12, 40, .6); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 16px; }
.celebrate.on { display: flex; }
.celebrate .card { max-width: 400px; width: 100%; text-align: center; padding: 26px 20px; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.big-stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.big-stars svg { width: 52px; height: 52px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.big-stars svg:nth-child(2) { animation-delay: .15s; } .big-stars svg:nth-child(3) { animation-delay: .3s; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

/* ألعاب الدرس */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cards button { aspect-ratio: 1; border-radius: 18px; border: 0; background: linear-gradient(135deg, var(--primary), var(--mint)); color: transparent; font-size: 1.8rem; font-weight: 800; font-family: inherit; box-shadow: 0 4px 0 var(--primary-deep); transition: transform .25s; }
.cards button.open { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 3px var(--accent), 0 4px 0 var(--accent-deep); transform: rotateY(180deg) scaleX(-1); }
.cards button.gone { background: var(--good-soft); color: var(--good-deep); box-shadow: none; }
/* أنشطة جرّب بنفسك */
.tray { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; background: #F4E6CF; border-radius: 24px; padding: 14px; border: 3px solid #D9B98A; max-width: 380px; margin: 0 auto; }
.tray span { aspect-ratio: 1; border-radius: 50%; background: #EAD5B3; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .08); position: relative; }
.tray span.on::after { content: ''; position: absolute; inset: 14% 22%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #A0552A, #5E2A10); animation: pop .3s; }
.tray span.new::after { background: radial-gradient(circle at 35% 30%, #D98A2B, #8A4A12); }
.eq { display: flex; justify-content: center; align-items: center; gap: 10px; font-family: var(--display); font-size: 2.1rem; font-weight: 800; margin: 14px 0; }
.eq .q { min-width: 56px; padding: 0 12px; border-radius: 16px; background: var(--accent-soft); text-align: center; }
.stepper { display: flex; justify-content: center; gap: 14px; }
.stepper button { width: 64px; height: 64px; border-radius: 20px; border: 0; background: var(--primary); color: #fff; font-size: 1.9rem; font-weight: 800; box-shadow: 0 5px 0 var(--primary-deep); }
.stepper button:active { transform: translateY(5px); box-shadow: none; }
.tap-area { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; }
.tap { width: 66px; height: 66px; border-radius: 20px; border: 2px dashed var(--line); background: var(--surface); font-size: 2rem; transition: transform .15s; }
.tap.done { border-style: solid; border-color: var(--good); background: var(--good-soft); transform: scale(.92); }
.math-stage { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; font-size: 2rem; min-height: 60px; margin: 10px 0; }
.math-stage .grp { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-radius: 18px; background: var(--surface-2); transition: all .4s; }
.math-stage .grp.merge { background: var(--accent-soft); }
.math-stage .item.gone { opacity: .2; filter: grayscale(1); transition: all .4s; }
.say-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.say-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 4px 0 var(--line); }
.say-card .e { font-size: 2.3rem; line-height: 1.2; }
.say-card .t { font-weight: 800; font-size: 1.15rem; }
.say-card.heard { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.feedback { min-height: 30px; font-weight: 800; margin-top: 12px; }
.feedback.good { color: var(--good-deep); } .feedback.bad { color: var(--bad-deep); }

/* التدريب (مراجعة ذكية وتحدي سريع) */
.timer { --p: 100; width: 64px; height: 64px; }
.sprint-score { font-family: var(--display); font-size: 3.4rem; font-weight: 800; line-height: 1; color: var(--primary); }

/* ---------- اختيار الطالب ---------- */
.choose { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 22px; text-align: center; }
.kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; width: min(760px, 100%); }
.kid { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 12px; border: 3px solid transparent; transition: transform .15s, border-color .15s; }
.kid:hover, .kid:focus-within { border-color: var(--primary); transform: translateY(-3px); }
.kid button { all: unset; display: contents; cursor: pointer; }
.speech { position: relative; background: var(--surface); border-radius: 22px; padding: 12px 18px; box-shadow: var(--shadow); text-align: right; }

/* ---------- الصور والأوسمة والمتجر ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .avatar-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.avatar-grid form { display: contents; }
.avatar-pick { width: 100%; aspect-ratio: 1; border-radius: 26px; border: 3px solid transparent; background: var(--surface); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); padding: 5px; transition: transform .15s; }
.avatar-pick:hover { transform: translateY(-3px) rotate(-2deg); }
.avatar-pick svg { width: 100%; height: auto; }
.avatar-pick.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.medal { width: 96px; height: 96px; margin: 6px auto; }
.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 760px) { .badge-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.product-art { height: 120px; border-radius: 18px; display: grid; place-items: center; font-size: 3.4rem; background: linear-gradient(135deg, var(--primary-soft), var(--mint-soft)); }
.gift { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #FFF3D6, #FFE6F0); color: #3A2600; border-radius: var(--radius); padding: 14px; border: 2px solid #FFD27A; animation: rise .4s ease; }
.gift .e { font-size: 2.6rem; }

/* ---------- ولي الأمر ---------- */
.week { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.week div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week i { width: 100%; border-radius: 8px; background: var(--primary); min-height: 6px; }
.week .today i { background: var(--accent); }
.week .future i { background: var(--line); }
.week span { font-size: .72rem; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; }
.kpis b { display: block; font-size: 1.35rem; color: var(--primary); }
.kids-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.kids-tabs a { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 16px; background: var(--surface); color: var(--ink); border: 2px solid transparent; }
.kids-tabs a.on { border-color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); text-align: center; cursor: pointer; height: 100%; }
.seg-item b { font-size: .85rem; } .seg-item small { font-size: .7rem; color: var(--muted); }
.seg-item input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.seg-item input:focus-visible + span { outline: 3px solid var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 700; }
.field input, .mini-select { font: inherit; min-height: 46px; border-radius: 14px; border: 2px solid var(--line); padding: 0 12px; background: var(--surface); color: var(--ink); }
.field input:focus, .mini-select:focus { outline: none; border-color: var(--primary); }
.field .inline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.field .inline input { width: 90px; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.flash { margin: 0 0 14px; }

@media print {
  .nav, .lesson-top, .tabs, .no-print, .sheet { display: none !important; }
  .panel { display: none !important; } .panel.print { display: block !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- العب وتعلّم ---------- */
.game-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: calc(var(--radius) + 4px); color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 7px 0 rgba(0, 0, 0, .15), var(--shadow-lg); position: relative; overflow: hidden; transition: transform .15s; }
.game-card:hover { transform: translateY(-3px) rotate(-.5deg); }
.game-card::after { content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); left: -60px; bottom: -110px; }
.game-card b { font-family: var(--display); font-size: 1.35rem; }
.game-card p { margin: 2px 0 0; opacity: .92; }
.game-card .art { flex: none; width: 110px; display: grid; place-items: center; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .15)); }
.options.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.game-q { text-align: center; }
.game-q .prompt { font-family: var(--display); font-size: 1.4em; font-weight: 800; margin: 4px 0 14px; }
.race { position: relative; border-radius: calc(var(--radius) + 4px); overflow: hidden; padding: 18px 12px 10px; margin-bottom: 14px; box-shadow: var(--shadow-lg);
  background: var(--race-bg, linear-gradient(180deg, #8FD8FF 0%, #BDEBFF 26%, #2FA6D9 27%, #1E86C2 100%)) center / cover; }
.race::before { content: ''; position: absolute; inset: 27% 0 0 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .18) 0 18px, transparent 18px 46px); mask: linear-gradient(180deg, #000, transparent 60%); animation: waves 3s linear infinite; }
@keyframes waves { to { background-position: 46px 0; } }
.race .lane { position: relative; height: 92px; }
.race .who { position: absolute; top: 4px; right: 6px; font-size: .72rem; font-weight: 800; color: #fff; background: rgba(0, 0, 0, .25); padding: 1px 8px; border-radius: 8px; z-index: 2; }
.race .boat { --pos: 0; position: absolute; bottom: 0; inset-inline-start: calc(var(--pos) * (100% - 96px)); transition: inset-inline-start .6s cubic-bezier(.2, .9, .3, 1.2); animation: sway 2.6s ease-in-out infinite; }
.race .boat.boost svg { filter: drop-shadow(0 0 10px #FFF6A0); }
.race .boat.wobble { animation: shake .4s; }
@keyframes sway { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
.race .finish { position: absolute; left: 10px; top: 30%; bottom: 8px; width: 6px; background: repeating-linear-gradient(180deg, #fff 0 10px, #1F1846 10px 20px); border-radius: 3px; font-size: 0; }
.race .port { position: absolute; left: 4px; top: 2px; font-size: 2rem; }
.sky { position: relative; height: 380px; border-radius: calc(var(--radius) + 4px); overflow: hidden; background: linear-gradient(180deg, #CDEBFF, #F4F1FF); box-shadow: var(--shadow); }
[data-age="teen"] .sky { background: linear-gradient(180deg, #1B2340, #121722); }
.balloon { --x: 10%; --c: #FF6FA3; position: absolute; bottom: -140px; left: var(--x); width: 30%; max-width: 130px; aspect-ratio: .82; border: 0; border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7) 0 8%, transparent 9%), var(--c); color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.4rem;
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .12); animation: floatUp var(--d) linear var(--delay) forwards; }
.balloon::after { content: ''; position: absolute; left: 50%; bottom: -46px; width: 2px; height: 46px; background: rgba(0, 0, 0, .25); }
.balloon span { display: block; padding: 0 6px; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.balloon.wrong { animation: floatUp var(--d) linear var(--delay) forwards, shake .35s; }
.balloon.popped { animation: popOut .35s forwards; }
@keyframes floatUp { from { bottom: -140px; } to { bottom: 110%; } }
@keyframes popOut { to { transform: scale(1.6); opacity: 0; } }

/* ---------- عالم الصغار ---------- */
.world { position: relative; aspect-ratio: 4 / 3.4; min-height: 360px; max-height: 560px; width: 100%; border-radius: 34px; overflow: hidden; box-shadow: var(--shadow-lg); border: 4px solid #fff; }
.world .scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.world .clouds { animation: drift 30s linear infinite alternate; }
.world .ship { animation: sail 9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes drift { to { transform: translateX(40px); } }
@keyframes sail { 50% { transform: translate(-60px, -8px) rotate(-3deg); } }
.place { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; transition: transform .15s; }
.place:hover { transform: translate(-50%, -54%) scale(1.05); }
.place .pin { padding: 6px; border-radius: 26px; background: rgba(255, 255, 255, .9); box-shadow: 0 6px 0 rgba(0, 0, 0, .12), 0 10px 24px -8px rgba(0, 0, 0, .35); }
.place .label { background: #fff; color: #1F1846; font-family: var(--display); font-weight: 800; font-size: .9rem; padding: 2px 12px; border-radius: 12px; box-shadow: 0 3px 0 rgba(0, 0, 0, .1); white-space: nowrap; }
.place .mini-bar { width: 64px; height: 7px; border-radius: 6px; background: rgba(255, 255, 255, .7); overflow: hidden; }
.place .mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--g1), var(--g2)); }
.place.locked { filter: grayscale(.6); opacity: .85; }
.place.next .pin { animation: bob 2s ease-in-out infinite; box-shadow: 0 0 0 5px var(--accent), 0 6px 0 rgba(0, 0, 0, .12); }
.guide { position: absolute; right: 10px; bottom: 6px; display: flex; align-items: flex-end; gap: 6px; z-index: 3; max-width: 78%; }
.guide .mascot { animation: bob 3s ease-in-out infinite; flex: none; }
.guide .speech { background: #fff; color: #1F1846; border-radius: 18px 18px 18px 4px; padding: 6px 12px; font-size: .8rem; font-weight: 700; box-shadow: 0 4px 0 rgba(0, 0, 0, .08); margin-bottom: 30px; line-height: 1.8; }
.big-go { min-height: 66px; font-size: 1.2rem; margin-top: 16px; }
.big-go span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
@media (min-width: 760px) { .quest-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.quest { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; min-height: 140px; border-radius: 28px; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 6px 0 rgba(0, 0, 0, .14); overflow: hidden; transition: transform .15s; }
.quest:hover { transform: translateY(-3px) rotate(-1deg); }
.quest::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .14); left: -40px; bottom: -50px; }
.quest .q-art { font-size: 2.6rem; line-height: 1.2; margin-bottom: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
.quest b { font-family: var(--display); font-size: 1.15rem; }
.quest .small { opacity: .9; }
.quest .count { position: absolute; top: 12px; left: 12px; min-width: 30px; height: 30px; border-radius: 12px; padding: 0 8px; background: #FF5A5F; color: #fff; font-weight: 800; display: grid; place-items: center; box-shadow: 0 3px 0 #C23D42; z-index: 1; }
@media (max-width: 420px) { .place .pin svg { width: 46px; height: 46px; } .place .label { font-size: .78rem; } .guide .mascot { width: 64px; height: 64px; } }

/* ---------- سُلّومي والألبوم ---------- */
.buddy-stage { position: relative; height: 280px; border-radius: 34px; background: var(--hero); display: grid; place-items: center; overflow: hidden; box-shadow: var(--shadow-lg); }
.buddy-stage::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .35), transparent 60%); }
.buddy-floor { position: absolute; bottom: -60px; width: 120%; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.buddy-stage [data-buddy] { position: relative; animation: bob 3s ease-in-out infinite; }
.wear-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .wear-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.wear { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 22px; border: 3px solid transparent; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.wear b { font-size: .8rem; line-height: 1.5; }
.wear .small { color: var(--muted); font-size: .7rem; }
.wear.on { border-color: var(--good); background: var(--good-soft); }
.wear:disabled { opacity: .55; filter: grayscale(.7); cursor: default; }
.album { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .album { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.sticker { aspect-ratio: .85; border-radius: 20px; border: 2px dashed var(--line); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 6px; color: var(--muted); }
.sticker .e { font-size: 2rem; line-height: 1.2; }
.sticker .tiny { line-height: 1.4; }
.sticker.has { border: 0; background: var(--surface); box-shadow: 0 4px 0 var(--line), var(--shadow); color: var(--ink); transform: rotate(-2deg); }
.sticker.has:nth-child(even) { transform: rotate(2deg); }
.color-dots { display: flex; flex-wrap: wrap; gap: 12px; }
.color-dots button { width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--line); background: var(--c); }
.color-dots button.on { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.08); }

.answer-in.thinking { background: linear-gradient(90deg, var(--surface) 0%, var(--primary-soft) 50%, var(--surface) 100%); background-size: 200% 100%; animation: think 1s linear infinite; }
@keyframes think { to { background-position: -200% 0; } }

/* إصلاحات العرض على الجوال */
[hidden] { display: none !important; }
.topbar { gap: 8px; }
.topbar h1 { font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .topbar .chip { height: 38px; padding: 0 9px; gap: 4px; font-size: .85rem; }
  .topbar .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .topbar [data-mute] { display: none; }
  .topbar .avatar-ring > svg { width: 44px; height: 44px; }
}
@media (min-width: 960px) { .nav a.cta { flex: none; } }
@media (min-width: 760px) { .world { aspect-ratio: 16 / 8; } .guide .speech { font-size: .95rem; } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 62px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); font-family: var(--display); font-size: 1.6rem; font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.keypad button:active { transform: translateY(4px); box-shadow: none; }
.keypad button.go { background: var(--good); color: #fff; border-color: var(--good); box-shadow: 0 4px 0 var(--good-deep); }
.pin-display { min-height: 56px; font-size: 1.8rem; text-align: center; letter-spacing: .4em; }

.season-banner { text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: #fff; padding: 10px 16px; border-radius: 18px;
  background: var(--hero); box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.season-banner.national { background: linear-gradient(90deg, #DB161B, #B3121A 30%, #0E7A3A 70%, #008000); }
.season-banner.ramadan { background: linear-gradient(90deg, #1E1B4B, #3B2F8F 60%, #C99A2E); }
.season-banner.eid { background: linear-gradient(90deg, #FF6FA3, #8E7BFF, #22C7B0); }
