/* ============================================================
   أبطال الضرب — أنماط الواجهة
   ألوان الحلويات: وردي / سماوي / بنفسجي / أبيض + ذهبي للنجوم
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root{
  --pink:#FF7EB6;
  --pink-soft:#FFD3E6;
  --pink-deep:#EF5C97;
  --sky:#63C7F0;
  --sky-soft:#D6F2FF;
  --sky-deep:#2BA7D8;
  --violet:#8E6BE8;
  --violet-soft:#E4D9FF;
  --violet-deep:#6B4BC9;
  --ink:#3B2A5E;
  --gold:#FFC94D;
  --gold-soft:#FFF1C9;
  --mint:#CFF3E4;
  --mint-ink:#1B7A57;
  --white:#FFFFFF;
  --bg:#FBF6FF;

  --r-xl:34px;
  --r-lg:28px;
  --r-md:20px;
  --r-sm:14px;

  --shadow-btn:0 8px 0 rgba(59,42,94,.20);
  --shadow-card:0 10px 0 rgba(142,107,232,.16), 0 18px 34px rgba(142,107,232,.14);
  --shadow-soft:0 8px 0 rgba(142,107,232,.25);

  --font-d:'Baloo Bhaijaan 2','Tajawal',system-ui,sans-serif;
  --font-b:'Tajawal',system-ui,-apple-system,'Segoe UI',sans-serif;
}

html, body { height:100%; }

body{
  margin:0;
  font-family:var(--font-b);
  font-size:16px;
  line-height:1.55;
  color:var(--ink);
  background:var(--bg);
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  -webkit-user-select:none;
  user-select:none;
}

h1,h2,h3,p{ margin:0; }
button{ font:inherit; color:inherit; background:none; border:0; cursor:pointer; }
img{ max-width:100%; }

.hidden{ display:none !important; }

/* ---------------- الخلفية (ملعب النجوم) ---------------- */
.scene{
  position:fixed;
  inset:0;
  z-index:0;
  pointer-events:none;
  overflow:hidden;
  background:linear-gradient(180deg,#EFE4FF 0%, #FBF6FF 45%, #FFFFFF 100%);
}
.scene-img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  opacity:.42;
}
.scene-veil{
  position:absolute;
  inset:0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(251,246,255,.05) 0%, rgba(251,246,255,.72) 55%, #FBF6FF 92%),
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(251,246,255,.9));
}
.deco-star{
  position:absolute;
  display:block;
  background:var(--gold);
  opacity:.35;
  clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
  animation:floaty 11s ease-in-out infinite;
}
.d1{ width:34px; height:34px; top:14%; right:6%; animation-delay:0s; }
.d2{ width:20px; height:20px; top:30%; left:8%; animation-delay:1.6s; opacity:.28; }
.d3{ width:26px; height:26px; top:62%; right:11%; animation-delay:3.2s; opacity:.22; }
.d4{ width:16px; height:16px; top:78%; left:14%; animation-delay:4.6s; opacity:.3; }
.d5{ width:22px; height:22px; top:8%; left:30%; animation-delay:2.4s; opacity:.24; }

@keyframes floaty{
  0%,100%{ transform:translateY(0) rotate(-6deg); }
  50%{ transform:translateY(-14px) rotate(8deg); }
}

/* ---------------- هيكل التطبيق ---------------- */
.app{
  position:relative;
  z-index:1;
  width:100%;
  max-width:880px;
  margin:0 auto;
  padding:10px 16px 32px;
  min-height:100vh;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 2px 14px;
  flex:0 0 auto;
}
.brand{ display:flex; align-items:center; gap:9px; min-width:0; }
.hero-badge{
  width:44px; height:44px;
  flex:0 0 auto;
  border-radius:50%;
  background:var(--violet-soft);
  border:3px solid var(--ink);
  overflow:hidden;
  display:grid;
  place-items:center;
}
.hero-badge svg{ width:100%; height:100%; display:block; }
.brand-text{
  display:flex;
  flex-direction:column;
  min-width:0;
  line-height:1.18;
}
.brand-name{
  font-family:var(--font-b);
  font-weight:700;
  font-size:11.5px;
  color:#7A6A9C;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.player-name{
  font-family:var(--font-d);
  font-weight:800;
  font-size:16px;
  color:var(--ink);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:min(46vw,220px);
}
.topbar-actions{ display:flex; align-items:center; gap:8px; flex:0 0 auto; }

.star-counter{
  display:flex;
  align-items:center;
  gap:6px;
  background:var(--white);
  border:3px solid var(--ink);
  border-radius:999px;
  padding:5px 14px 5px 12px;
  font-family:var(--font-d);
  font-weight:800;
  font-size:20px;
  color:var(--ink);
  box-shadow:0 5px 0 rgba(255,201,77,.65);
  transition:transform .18s ease;
}
.star-counter.pulse{ animation:popStar .45s ease; }
.sc-star{
  width:20px; height:20px;
  background:var(--gold);
  clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
  display:block;
  flex:0 0 auto;
}
@keyframes popStar{
  0%{ transform:scale(1); }
  45%{ transform:scale(1.16); }
  100%{ transform:scale(1); }
}

.icon-btn{
  width:46px; height:46px;
  flex:0 0 auto;
  border-radius:50%;
  border:3px solid var(--ink);
  background:var(--white);
  color:var(--ink);
  display:grid;
  place-items:center;
  box-shadow:0 5px 0 rgba(59,42,94,.18);
  transition:transform .12s ease, box-shadow .12s ease;
}
.icon-btn:active{ transform:translateY(4px); box-shadow:0 1px 0 rgba(59,42,94,.18); }
.icon-btn .ico-off{ display:none; }
.icon-btn[aria-pressed="true"] .ico-on{ display:none; }
.icon-btn[aria-pressed="true"] .ico-off{ display:block; }
.icon-btn[aria-pressed="true"]{ background:var(--pink-soft); }

/* ---------------- الشاشات ---------------- */
main{ flex:1 1 auto; display:flex; flex-direction:column; }
.screen{
  display:flex;
  flex-direction:column;
  gap:16px;
  animation:screenIn .32s ease-out both;
  flex:1 1 auto;
}
@keyframes screenIn{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:translateY(0); }
}

.screen-head{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:space-between;
}
.screen-title{
  font-family:var(--font-d);
  font-size:clamp(21px,6vw,28px);
  font-weight:800;
  color:var(--violet);
  text-align:center;
  flex:1 1 auto;
  min-width:0;
}
.head-spacer{ width:46px; height:46px; flex:0 0 auto; }
.back-btn{
  width:46px; height:46px;
  flex:0 0 auto;
  border-radius:16px;
  border:3px solid var(--ink);
  background:var(--white);
  color:var(--ink);
  display:grid;
  place-items:center;
  box-shadow:0 5px 0 rgba(59,42,94,.18);
  transition:transform .12s ease, box-shadow .12s ease;
}
.back-btn:active{ transform:translateY(4px); box-shadow:0 1px 0 rgba(59,42,94,.18); }
.screen-lead{
  font-size:15px;
  color:#5B4880;
  text-align:center;
  padding:0 6px;
}

/* ---------------- الأزرار العامة ---------------- */
.btn{
  font-family:var(--font-b);
  font-weight:800;
  font-size:18px;
  border:4px solid var(--ink);
  border-radius:999px;
  background:var(--white);
  color:var(--ink);
  padding:12px 22px;
  min-height:56px;
  box-shadow:0 6px 0 rgba(59,42,94,.20);
  transition:transform .12s ease, box-shadow .12s ease, background-color .15s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-align:center;
}
.btn:active{ transform:translateY(5px); box-shadow:0 1px 0 rgba(59,42,94,.20); }
.btn:focus-visible{ outline:4px solid var(--sky); outline-offset:3px; }
.btn:disabled{ opacity:.55; transform:none; box-shadow:0 6px 0 rgba(59,42,94,.12); }
.btn-lg{ min-height:64px; font-size:20px; padding:14px 26px; width:100%; }
.btn-primary{ background:var(--pink); }
.btn-primary:hover{ background:#FF8FC0; }
.btn-sky{ background:var(--sky); }
.btn-ghost{ background:var(--white); }
.btn-danger{ background:var(--pink-deep); color:#fff; }

/* ---------------- الرئيسية ---------------- */
.home-hero{
  text-align:center;
  padding:2px 0 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
}
.home-mascot{
  width:88px; height:88px;
  animation:bob 3.4s ease-in-out infinite;
}
.home-mascot svg{ width:100%; height:100%; display:block; }
@keyframes bob{
  0%,100%{ transform:translateY(0) rotate(-4deg); }
  50%{ transform:translateY(-9px) rotate(4deg); }
}
.app-title{
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(40px,12.5vw,60px);
  line-height:1.05;
  color:var(--violet);
  text-shadow:0 3px 0 #fff, 0 8px 0 rgba(142,107,232,.22);
  padding:0 4px;
}
.app-sub{
  font-size:15.5px;
  font-weight:500;
  color:#4E3C77;
  max-width:34ch;
  margin:2px auto 0;
}

.picker{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  padding:2px 0;
}
.picker-label{
  font-family:var(--font-d);
  font-weight:700;
  font-size:15px;
  color:#6B5A8F;
}
.picker-row{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.hero-chip{
  width:84px;
  padding:6px 4px 8px;
  border-radius:22px;
  border:3px solid rgba(59,42,94,.25);
  background:var(--white);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  box-shadow:0 5px 0 rgba(59,42,94,.12);
  transition:transform .14s ease, box-shadow .14s ease, border-color .18s ease, background-color .18s ease;
}
.hero-chip:active{ transform:translateY(3px); box-shadow:0 2px 0 rgba(59,42,94,.12); }
.hero-chip.active{
  border-color:var(--ink);
  background:var(--pink-soft);
  box-shadow:0 5px 0 var(--violet);
}
.chip-avatar{
  width:52px; height:52px;
  border-radius:50%;
  overflow:hidden;
  background:var(--sky-soft);
  display:block;
}
.chip-avatar svg{ width:100%; height:100%; display:block; }
.chip-name{
  font-family:var(--font-d);
  font-weight:700;
  font-size:14px;
  color:var(--ink);
}

.menu-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:13px;
  margin-top:2px;
}
.menu-card{
  min-height:132px;
  border-radius:var(--r-lg);
  border:4px solid var(--ink);
  box-shadow:var(--shadow-btn);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:14px 8px;
  transition:transform .12s ease, box-shadow .12s ease, filter .15s ease;
}
.menu-card:active{ transform:translateY(6px); box-shadow:0 2px 0 rgba(59,42,94,.2); }
.menu-card:focus-visible{ outline:4px solid var(--sky); outline-offset:3px; }
.menu-card:hover{ filter:brightness(1.03); }
.mc-learn{ background:var(--pink-soft); }
.mc-quiz{ background:var(--sky-soft); }
.mc-time{ background:var(--violet-soft); }
.mc-results{ background:var(--gold-soft); }
.mc-ico{
  width:54px; height:54px;
  border-radius:18px;
  background:var(--white);
  border:3px solid var(--ink);
  display:grid;
  place-items:center;
  color:var(--ink);
  margin-bottom:2px;
}
.mc-title{
  font-family:var(--font-d);
  font-weight:800;
  font-size:20px;
  color:var(--ink);
  line-height:1.2;
  text-align:center;
}
.mc-sub{
  font-size:12.5px;
  font-weight:700;
  color:#5C4883;
  text-align:center;
}
.home-foot{
  text-align:center;
  font-size:12.5px;
  color:#7A6A9C;
  padding:10px 12px 0;
  margin-top:auto;
}

/* ---------------- صفحة التعلّم ---------------- */
.tables-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:11px;
}
.table-card{
  position:relative;
  aspect-ratio:1 / 1;
  border-radius:var(--r-md);
  border:4px solid var(--ink);
  background:var(--pink-soft);
  box-shadow:0 6px 0 rgba(59,42,94,.18);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:0;
  transition:transform .12s ease, box-shadow .12s ease;
  padding:4px;
}
.table-card:active{ transform:translateY(5px); box-shadow:0 1px 0 rgba(59,42,94,.18); }
.table-card:focus-visible{ outline:4px solid var(--sky); outline-offset:3px; }
.table-card.tone-1{ background:var(--sky-soft); }
.table-card.tone-2{ background:var(--violet-soft); }
.table-card.tone-3{ background:var(--gold-soft); }
.t-num{
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(28px,9vw,38px);
  line-height:1;
  color:var(--ink);
}
.t-label{ font-size:12.5px; font-weight:700; color:#4E3C77; }
.t-badge{
  position:absolute;
  top:6px;
  inset-inline-start:8px;
  font-size:15px;
  color:#C68A00;
  line-height:1;
}

/* ---------------- جدول واحد ---------------- */
.eq-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:9px;
}
.eq{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:.22em;
  padding:10px 8px;
  border-radius:18px;
  border:3px solid var(--ink);
  background:var(--pink-soft);
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(23px,7vw,31px);
  color:var(--ink);
  line-height:1.1;
}
.eq:nth-child(even){ background:var(--sky-soft); }
.eq .eq-op{ color:var(--violet); }
.eq .eq-ans{ color:var(--violet-deep); }
.table-actions{ display:flex; margin-top:6px; }

/* ---------------- بطاقة السؤال ---------------- */
.q-card{
  position:relative;
  background:var(--white);
  border:4px solid var(--ink);
  border-radius:var(--r-xl);
  box-shadow:var(--shadow-card);
  padding:clamp(16px,4vw,26px) 14px;
  min-height:150px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.q-eq{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:.14em;
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(40px,12.5vw,70px);
  line-height:1;
  color:var(--ink);
}
.q-eq .op{ color:var(--violet); font-size:.74em; }
.q-eq .qmark{
  color:var(--pink-deep);
  background:var(--pink-soft);
  border:4px dashed var(--pink);
  border-radius:16px;
  padding:0 .16em;
  min-width:1.05em;
  text-align:center;
  font-size:.86em;
  line-height:1.2;
}

/* ---------------- شريط التقدّم والعدادات ---------------- */
.quiz-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-weight:800;
  font-size:14.5px;
  color:#4E3C77;
  padding:0 2px;
}
.quiz-score{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-family:var(--font-d);
  font-size:18px;
  color:var(--ink);
}
.mini-star{
  width:16px; height:16px;
  background:var(--gold);
  clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
  display:block;
}
.progress{
  height:16px;
  border-radius:999px;
  border:3px solid var(--ink);
  background:var(--white);
  overflow:hidden;
}
.progress > i{
  display:block;
  height:100%;
  width:0%;
  background:linear-gradient(90deg,var(--violet),var(--pink));
  border-radius:999px;
  transition:width .32s ease-out;
}

/* ---------------- الاختيارات ---------------- */
.choices{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:11px;
}
.choice{
  min-height:84px;
  border-radius:24px;
  border:4px solid var(--ink);
  background:var(--white);
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(26px,8vw,38px);
  color:var(--ink);
  box-shadow:0 7px 0 rgba(59,42,94,.20);
  transition:transform .1s ease, box-shadow .1s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
  display:grid;
  place-items:center;
}
.choice:active{ transform:translateY(5px); box-shadow:0 2px 0 rgba(59,42,94,.2); }
.choice:focus-visible{ outline:4px solid var(--sky); outline-offset:3px; }
.choice.correct{
  background:var(--mint);
  border-color:var(--mint-ink);
  color:#12543C;
  animation:pop .38s ease;
}
.choice.wrong{
  background:var(--pink-deep);
  border-color:#9C2450;
  color:#fff;
  animation:shake .38s ease;
}
@keyframes pop{
  0%{ transform:scale(1); }
  45%{ transform:scale(1.06); }
  100%{ transform:scale(1); }
}
@keyframes shake{
  0%,100%{ transform:translateX(0); }
  20%{ transform:translateX(-6px); }
  45%{ transform:translateX(6px); }
  70%{ transform:translateX(-4px); }
}

/* ---------------- رسالة التشجيع ---------------- */
.feedback{
  min-height:62px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:8px;
  font-weight:800;
  font-size:16px;
  line-height:1.4;
  border-radius:22px;
  padding:8px 14px;
  border:4px solid transparent;
  background:transparent;
  color:var(--ink);
  transition:background-color .2s ease, border-color .2s ease, color .2s ease;
}
.feedback.ok{
  background:var(--mint);
  border-color:var(--mint-ink);
  color:#12543C;
}
.feedback.no{
  background:var(--pink-soft);
  border-color:var(--pink-deep);
  color:#8C2350;
}

/* ---------------- الماسكوت في الرأس ---------------- */
.head-mascot{
  width:54px; height:54px;
  flex:0 0 auto;
  display:block;
}
.head-mascot svg{ width:100%; height:100%; display:block; }
.head-mascot.spin{ animation:spinMascot .75s cubic-bezier(.3,.8,.3,1); }
.head-mascot.wobble{ animation:wobble .5s ease; }
@keyframes spinMascot{
  0%{ transform:rotate(0) scale(1); }
  55%{ transform:rotate(200deg) scale(1.15); }
  100%{ transform:rotate(360deg) scale(1); }
}
@keyframes wobble{
  0%,100%{ transform:rotate(0); }
  25%{ transform:rotate(-12deg); }
  60%{ transform:rotate(10deg); }
}

/* ---------------- شاشة التحدي ---------------- */
.time-hud{
  display:flex;
  align-items:center;
  gap:14px;
  background:var(--white);
  border:4px solid var(--ink);
  border-radius:var(--r-lg);
  padding:12px 14px;
  box-shadow:var(--shadow-card);
}
.timer-wrap{
  position:relative;
  width:92px; height:92px;
  flex:0 0 auto;
}
.timer-svg{ width:100%; height:100%; display:block; }
#timerRing{ transition:stroke-dashoffset .12s linear, stroke .3s ease; }
.timer-num{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  font-family:var(--font-d);
  font-weight:800;
  font-size:28px;
  color:var(--ink);
}
.time-stats{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
}
.stat-pill{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  background:var(--violet-soft);
  border-radius:14px;
  padding:4px 12px;
  font-weight:800;
  font-size:14px;
  color:#4E3C77;
}
.stat-pill b{
  font-family:var(--font-d);
  font-size:20px;
  color:var(--ink);
}
.hearts{ display:flex; gap:6px; align-items:center; }
.heart{
  width:22px; height:20px;
  display:block;
  background:var(--pink-deep);
  clip-path:path("M11 20 L2.4 11.6 A5.2 5.2 0 0 1 11 4.4 A5.2 5.2 0 0 1 19.6 11.6 Z");
  transition:background-color .2s ease, transform .2s ease;
}
.heart.off{ background:#E0D7F2; transform:scale(.88); }

/* ---------------- بطاقات النتائج ---------------- */
.card{
  background:var(--white);
  border:4px solid var(--ink);
  border-radius:var(--r-xl);
  box-shadow:var(--shadow-card);
  padding:18px 16px;
}
.card-title{
  font-family:var(--font-d);
  font-weight:800;
  font-size:19px;
  color:var(--violet);
  text-align:center;
  margin-bottom:4px;
}
.card-note{
  text-align:center;
  font-size:13.5px;
  color:#6B5A8F;
  font-weight:600;
}
.stars-card{ display:flex; flex-direction:column; gap:4px; align-items:center; }
.big-stars{ display:flex; align-items:baseline; gap:8px; justify-content:center; }
.big-number{
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(52px,15vw,72px);
  line-height:1;
  color:var(--violet);
}
.big-unit{
  font-family:var(--font-d);
  font-weight:800;
  font-size:22px;
  color:var(--ink);
}
.star-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:9px;
  max-width:250px;
  width:100%;
  margin:12px auto 8px;
}
.star-slot{ aspect-ratio:1 / 1; display:grid; place-items:center; }
.star-slot i{
  display:block;
  width:100%;
  height:100%;
  background:var(--violet-soft);
  clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
  transition:background-color .35s ease, transform .35s ease;
}
.star-slot.on i{ background:var(--gold); transform:scale(1.04); }

.best-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:11px;
}
.best-card{
  border:4px solid var(--ink);
  border-radius:var(--r-md);
  padding:12px 10px;
  box-shadow:var(--shadow-btn);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  text-align:center;
}
.bc-pink{ background:var(--pink-soft); }
.bc-violet{ background:var(--violet-soft); }
.best-label{ font-size:12.5px; font-weight:800; color:#4E3C77; }
.best-value{
  font-family:var(--font-d);
  font-weight:800;
  font-size:21px;
  color:var(--ink);
}

.badges-card{ display:flex; flex-direction:column; gap:6px; }
.badge-grid{
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:8px;
  margin-top:8px;
}
.badge{
  aspect-ratio:1 / 1;
  border-radius:16px;
  border:3px solid rgba(59,42,94,.22);
  background:#F3EEFB;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:0;
  color:#9F91BC;
}
.badge .b-num{
  font-family:var(--font-d);
  font-weight:800;
  font-size:16px;
  line-height:1;
}
.badge .b-star{ font-size:10px; line-height:1; }
.badge.on{
  background:var(--gold-soft);
  border-color:var(--ink);
  color:#8A5B00;
  box-shadow:0 4px 0 rgba(255,201,77,.6);
}

.board-card{ display:flex; flex-direction:column; gap:6px; }
.board-note{ text-align:center; font-size:12.5px; color:#6B5A8F; font-weight:600; }
.board-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 12px;
  border-radius:14px;
  background:#F6F1FE;
  font-weight:700;
  font-size:15px;
}
.board-row.me{ background:var(--gold-soft); border:2px solid var(--gold); }
.br-rank{
  width:26px; height:26px;
  flex:0 0 auto;
  border-radius:50%;
  background:var(--violet);
  color:#fff;
  display:grid;
  place-items:center;
  font-family:var(--font-d);
  font-size:14px;
}
.br-handle{ flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.br-score{ font-family:var(--font-d); font-weight:800; color:var(--ink); }

.results-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:auto;
  padding-top:8px;
}
.confirm-box{
  border:4px solid var(--ink);
  border-radius:var(--r-lg);
  background:var(--pink-soft);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  text-align:center;
  font-weight:800;
  font-size:15px;
  color:var(--ink);
  margin-top:auto;
}
.confirm-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* ---------------- نافذة نهاية الجولة ---------------- */
.overlay{
  position:fixed;
  inset:0;
  z-index:80;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:14px 14px 20px;
  background:rgba(59,42,94,.38);
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px);
  animation:fadeIn .22s ease-out;
}
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
.sheet{
  width:100%;
  max-width:520px;
  max-height:86vh;
  overflow-y:auto;
  background:var(--white);
  border:4px solid var(--ink);
  border-radius:var(--r-xl);
  padding:18px 18px 20px;
  box-shadow:0 12px 0 rgba(59,42,94,.28);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  animation:sheetUp .34s cubic-bezier(.2,.9,.3,1.08) both;
}
@keyframes sheetUp{
  from{ transform:translateY(34px); opacity:.4; }
  to{ transform:translateY(0); opacity:1; }
}
.sheet-mascot{ width:66px; height:66px; margin-top:-4px; }
.sheet-mascot svg{ width:100%; height:100%; display:block; }
.sheet-title{
  font-family:var(--font-d);
  font-weight:800;
  font-size:26px;
  color:var(--violet);
  text-align:center;
}
.sheet-sub{
  text-align:center;
  font-size:15px;
  font-weight:600;
  color:#4E3C77;
}
.rs-stats{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:center;
  margin:8px 0 4px;
}
.rs-pill{
  background:var(--gold-soft);
  border:3px solid var(--ink);
  border-radius:999px;
  padding:5px 14px;
  font-family:var(--font-d);
  font-weight:800;
  font-size:15px;
  color:var(--ink);
}
.sheet-actions{
  display:flex;
  flex-direction:column;
  gap:9px;
  width:100%;
  margin-top:6px;
}

/* ---------------- قصاصات النجوم ---------------- */
.confetti{ position:fixed; inset:0; pointer-events:none; z-index:95; overflow:hidden; }
.confetti-star{
  position:fixed;
  width:16px; height:16px;
  display:block;
  pointer-events:none;
  transform:translate(-50%,-50%);
  animation:confettiFly 1.1s cubic-bezier(.2,.7,.4,1) forwards;
}
@keyframes confettiFly{
  0%{ opacity:1; transform:translate(-50%,-50%) scale(.4) rotate(0deg); }
  100%{ opacity:0; transform:translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); }
}
.flying-star{
  position:fixed;
  width:28px; height:28px;
  z-index:96;
  pointer-events:none;
}

/* ---------------- توست الشارة ---------------- */
.toast{
  position:fixed;
  z-index:97;
  inset-inline:16px;
  bottom:22px;
  margin:0 auto;
  max-width:420px;
  background:var(--gold-soft);
  border:4px solid var(--ink);
  border-radius:22px;
  padding:12px 16px;
  text-align:center;
  font-family:var(--font-d);
  font-weight:800;
  font-size:17px;
  color:var(--ink);
  box-shadow:0 8px 0 rgba(59,42,94,.25);
  animation:toastIn .3s cubic-bezier(.2,.9,.3,1.1) both;
  pointer-events:none;
}
@keyframes toastIn{
  from{ transform:translateY(24px); opacity:0; }
  to{ transform:translateY(0); opacity:1; }
}

/* ---------------- حالات البطل ---------------- */
.hero-badge.m-celebrate{ animation:hop .65s ease; }
.hero-badge.m-encourage{ animation:tilt .7s ease; }
@keyframes hop{
  0%,100%{ transform:translateY(0) scale(1); }
  35%{ transform:translateY(-8px) scale(1.06); }
  65%{ transform:translateY(0) scale(.98); }
}
@keyframes tilt{
  0%,100%{ transform:rotate(0); }
  40%{ transform:rotate(-9deg) scale(1.04); }
  75%{ transform:rotate(6deg); }
}

/* ---------------- اسم البطلة ---------------- */
.greet-row{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}
.greet-name{
  display:inline-block;
  background:var(--pink-soft);
  border:3px solid var(--ink);
  border-radius:999px;
  padding:5px 14px;
  font-family:var(--font-d);
  font-weight:800;
  font-size:15px;
  color:var(--ink);
  box-shadow:0 4px 0 rgba(59,42,94,.14);
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.name-edit{
  min-height:44px;
  padding:0 16px;
  border-radius:999px;
  border:3px solid rgba(59,42,94,.28);
  background:var(--white);
  color:#4E3C77;
  font-family:var(--font-b);
  font-weight:800;
  font-size:13.5px;
  box-shadow:0 4px 0 rgba(59,42,94,.12);
  transition:transform .12s ease, box-shadow .12s ease, border-color .15s ease;
}
.name-edit:active{ transform:translateY(3px); box-shadow:0 1px 0 rgba(59,42,94,.12); }
.name-edit:focus-visible{ outline:4px solid var(--sky); outline-offset:3px; }

.name-screen{
  position:fixed;
  inset:0;
  z-index:90;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px 16px;
  overflow-y:auto;
  background:
    radial-gradient(105% 60% at 50% 0%, rgba(255,211,230,.85) 0%, rgba(251,246,255,0) 70%),
    linear-gradient(180deg,#EFE4FF 0%, #FBF6FF 55%, #FFFFFF 100%);
  animation:fadeIn .25s ease-out;
}
.name-card{
  width:100%;
  max-width:430px;
  background:var(--white);
  border:4px solid var(--ink);
  border-radius:var(--r-xl);
  box-shadow:0 12px 0 rgba(142,107,232,.16), 0 20px 40px rgba(142,107,232,.18);
  padding:22px 18px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  text-align:center;
  animation:sheetUp .4s cubic-bezier(.2,.9,.3,1.08) both;
}
.name-mascot{ width:82px; height:82px; }
.name-mascot svg{ width:100%; height:100%; display:block; }
.name-title{
  font-family:var(--font-d);
  font-weight:800;
  font-size:clamp(24px,7.5vw,32px);
  line-height:1.25;
  color:var(--violet);
}
.name-sub{
  font-size:14.5px;
  font-weight:600;
  color:#4E3C77;
  max-width:30ch;
}
.name-label{
  align-self:flex-start;
  font-weight:800;
  font-size:13.5px;
  color:#6B5A8F;
  margin-bottom:-4px;
}
.name-input{
  width:100%;
  min-height:60px;
  border:4px solid var(--ink);
  border-radius:20px;
  background:var(--pink-soft);
  font-family:var(--font-d);
  font-weight:800;
  font-size:22px;
  color:var(--ink);
  padding:0 16px;
  text-align:center;
  outline:none;
  -webkit-user-select:text;
  user-select:text;
}
.name-input::placeholder{ color:#9A87BC; font-weight:600; font-size:19px; }
.name-input:focus{ border-color:var(--violet); background:#FFF3F9; }
.name-err{ color:#9C2450; font-weight:800; font-size:14px; }
.name-card .btn{ width:100%; }

/* ---------------- تجاوب ---------------- */
@media (max-width:359px){
  .brand-name{ display:none; }
  .app{ padding-inline:12px; }
  .menu-card{ min-height:118px; }
  .mc-title{ font-size:18px; }
}
@media (min-width:560px){
  .tables-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); }
  .eq-grid{ grid-template-columns:1fr 1fr; }
  .badge-grid{ grid-template-columns:repeat(6,1fr); }
}
@media (min-width:820px){
  .app{ padding-top:18px; }
  .menu-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); }
  .menu-card{ min-height:156px; }
  .mc-title{ font-size:21px; }
  .tables-grid{ grid-template-columns:repeat(6,minmax(0,1fr)); }
  .eq-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); }
  .home-mascot{ width:104px; height:104px; }
  .results-actions{ flex-direction:row; }
  .results-actions .btn{ flex:1 1 0; }
  .badge-grid{ grid-template-columns:repeat(12,1fr); }
}

/* ---------------- تقليل الحركة ---------------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
  .home-mascot, .deco-star{ animation:none !important; }
}