/* ══════════════════════════════════════════
   تحدّي المعرفة — وردي ناعم على أبيض دافئ
   ══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #FFF6F9;
  --card: #FFFFFF;
  --pink: #E8628F;
  --pink-soft: #F8C6D8;
  --pink-deep: #C2406A;
  --ink: #4A2B38;
  --ink-soft: #7E5E6A;
  --ok: #4FA98A;
  --ok-ink: #2C7A61;
  --ok-bg: #E8F6F0;
  --no: #D9584F;
  --no-ink: #A83F38;
  --no-bg: #FCEAE8;
  --line: rgba(232, 98, 143, .12);
  --shadow: 0 8px 24px rgba(200, 90, 130, .12);
  --shadow-lift: 0 14px 30px rgba(200, 90, 130, .18);
  --r-lg: 24px;
  --r-md: 18px;
  --pill: 999px;
  --font-display: 'Baloo Bhaijaan 2', 'Tajawal', system-ui, sans-serif;
  --font-body: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  background:
    radial-gradient(130% 45% at 50% 0%, #FFEDF4 0%, rgba(255, 246, 249, 0) 62%),
    var(--bg);
}

h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
svg { display: block; }
button { font-family: inherit; color: inherit; }
::selection { background: var(--pink-soft); color: var(--ink); }

/* ─────────── الهيكل ─────────── */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  min-height: 100dvh;
}

.screen { display: none; }
.screen.is-active { display: block; animation: screenIn .32s cubic-bezier(.22,.8,.35,1) both; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ─────────── الرئيسية ─────────── */
.screen-home { position: relative; }
.home-inner { position: relative; z-index: 1; }

.deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.deco .dot { position: absolute; border-radius: 50%; background: var(--pink-soft); opacity: .55; }
.deco .d1 { width: 10px; height: 10px; top: 26px; inset-inline-start: 20px; }
.deco .d2 { width: 6px;  height: 6px;  top: 100px; inset-inline-start: 54px; opacity: .4; }
.deco .d3 { width: 14px; height: 14px; top: 62px; inset-inline-end: 30px; background: #F3B9CE; opacity: .45; }
.deco .d4 { width: 7px;  height: 7px;  top: 210px; inset-inline-end: 12px; opacity: .38; }
.deco .d5 { width: 9px;  height: 9px;  top: 300px; inset-inline-start: 8px; background: #F6C1D9; opacity: .35; }

.deco .leaf { position: absolute; width: 46px; height: 46px; }
.deco .leaf path { fill: var(--pink-soft); opacity: .38; }
.deco .leaf-1 { top: 8px; inset-inline-end: -14px; transform: rotate(-18deg); }
.deco .leaf-2 { top: 232px; inset-inline-start: -20px; transform: rotate(196deg); width: 38px; height: 38px; }
.deco .leaf-2 path { opacity: .3; }

.lulu-halo {
  width: 176px;
  height: 176px;
  margin: 6px auto 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 46%, #FFDFEC 0%, #FFF0F6 52%, rgba(255, 246, 249, 0) 74%);
}

.app-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 33px;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: center;
  color: var(--pink-deep);
  margin-top: 2px;
}

.app-sub {
  max-width: 300px;
  margin: 6px auto 20px;
  text-align: center;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* ─────────── الأزرار ─────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--pill);
  background: var(--pink);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(226, 82, 132, .32);
  transition: transform .14s ease, box-shadow .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn-primary:active { transform: scale(.97); box-shadow: 0 5px 14px rgba(226, 82, 132, .3); background: #DD5A86; }
.btn-primary:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 3px; }
@media (hover: hover) {
  .btn-primary:hover { background: #E2608C; box-shadow: 0 14px 28px rgba(226, 82, 132, .34); }
}

.btn-spark { width: 22px; height: 22px; flex: none; opacity: .95; }

.btn-start { margin-top: 4px; }

.start-hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 10px;
  opacity: .9;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border: 2px solid #F3B9CE;
  border-radius: var(--pill);
  background: var(--card);
  color: var(--pink-deep);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s ease, background .18s ease, border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn-secondary svg { width: 18px; height: 18px; }
.btn-secondary:active { transform: scale(.97); background: #FFF3F8; border-color: var(--pink); }
.btn-secondary:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 3px; }

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .14s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn-ghost:active { background: #FFEFF6; color: var(--pink-deep); transform: scale(.98); }
.btn-ghost:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 2px; }

/* ─────────── قائمة الأقسام ─────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 30px 4px 12px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.section-head span {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--card);
  border-radius: var(--pill);
  padding: 3px 11px;
  box-shadow: 0 2px 8px rgba(200, 90, 130, .08);
}

.cat-list { display: flex; flex-direction: column; gap: 12px; }

.cat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  text-align: start;
  color: var(--ink);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.cat-card:active { transform: scale(.98); box-shadow: 0 4px 14px rgba(200, 90, 130, .15); }
.cat-card:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 2px; }
@media (hover: hover) {
  .cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
}

.cat-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--pink-deep);
}
.cat-icon svg { width: 25px; height: 25px; }

.cat-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; }

.cat-tail { flex: none; display: flex; align-items: center; gap: 6px; }
.cat-best {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #FFF0F6;
  color: var(--pink-deep);
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--pill);
  padding: 3px 8px;
  white-space: nowrap;
}
.cat-best svg { width: 11px; height: 11px; }
.cat-chev { color: #E7A6C0; display: grid; place-items: center; }
.cat-chev svg { width: 18px; height: 18px; }

.home-foot {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  opacity: .85;
  margin-top: 26px;
}

/* ─────────── التميمة لولو ─────────── */
.lulu { display: block; line-height: 0; }
.lulu svg { display: block; width: 100%; height: auto; overflow: visible; }
.lulu-home { width: 132px; }
.lulu-quiz { width: 62px; flex: none; margin-inline-start: auto; }
.lulu-result { width: 152px; margin-inline: auto; }

@keyframes luluBlink {
  0%, 91%, 100% { transform: scaleY(1); }
  94%           { transform: scaleY(.1); }
}
.lulu-blink ellipse {
  transform-box: fill-box;
  transform-origin: center;
  animation: luluBlink 4.6s ease-in-out infinite;
}

@keyframes luluJump {
  0%   { transform: translateY(0) scale(1, 1); }
  22%  { transform: translateY(-9px) scale(.96, 1.06); }
  52%  { transform: translateY(2px) scale(1.06, .94); }
  76%  { transform: translateY(-2px) scale(.99, 1.01); }
  100% { transform: translateY(0) scale(1, 1); }
}
.lulu.is-pop svg { animation: luluJump .55s cubic-bezier(.3, .9, .4, 1); }

@keyframes luluShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25%      { transform: translateX(-4px) rotate(-3deg); }
  65%      { transform: translateX(4px) rotate(3deg); }
}
.lulu.is-oops svg { animation: luluShake .42s ease-in-out; }

/* ─────────── شاشة السؤال ─────────── */
.quiz-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 62px;
}

.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: var(--pink-deep);
  cursor: pointer;
  transition: transform .14s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.94); background: #FFF3F8; }
.icon-btn:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 2px; }

.quiz-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  background: var(--card);
  border-radius: var(--pill);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--pink-deep);
  min-width: 0;
}
.quiz-cat > span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quiz-cat-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--pink-deep);
}
.quiz-cat-icon svg { width: 16px; height: 16px; }

.progress-wrap { margin-bottom: 16px; }
.progress-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 7px;
  padding: 0 2px;
}
.live-score {
  color: var(--pink-deep);
  font-weight: 700;
  background: #FFF0F6;
  border-radius: var(--pill);
  padding: 2px 10px;
  white-space: nowrap;
}
.progress-track {
  height: 10px;
  border-radius: var(--pill);
  background: #FBE3EC;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--pill);
  background: linear-gradient(90deg, #F49BB8 0%, #E8628F 100%);
  transition: width .38s cubic-bezier(.25, .8, .3, 1);
}

.q-card {
  background: var(--card);
  border: 1px solid rgba(232, 98, 143, .08);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 14px;
}

.q-text {
  font-family: var(--font-display);
  font-size: 19.5px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 16px;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  background: #FFF8FA;
  border: 2px solid #F9DDE8;
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  text-align: start;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease,
              color .18s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.option:focus-visible { outline: 3px solid #F6AFC9; outline-offset: 2px; }
.option:active { transform: scale(.985); }
@media (hover: hover) {
  .options:not(.is-locked) .option:hover { background: #FFF1F6; border-color: #F3B9CE; }
}

.option-letter {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #FCE4EE;
  color: var(--pink-deep);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease;
}
.option-letter svg { width: 17px; height: 17px; }
.option-text { flex: 1; min-width: 0; }

.option.is-correct {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok-ink);
}
.option.is-correct .option-letter { background: var(--ok); color: #fff; }

.option.is-wrong {
  background: var(--no-bg);
  border-color: var(--no);
  color: var(--no-ink);
}
.option.is-wrong .option-letter { background: var(--no); color: #fff; }

.option.is-dim { opacity: .48; }
.options.is-locked { pointer-events: none; }

/* ─────────── تعليق الإجابة ─────────── */
@keyframes fbIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.feedback {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: 20px;
  margin-bottom: 14px;
  animation: fbIn .28s cubic-bezier(.25, .8, .3, 1) both;
}
.feedback.is-ok { background: var(--ok-bg); color: var(--ok-ink); }
.feedback.is-no { background: var(--no-bg); color: var(--no-ink); }

.feedback-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.feedback.is-ok .feedback-icon { background: var(--ok); color: #fff; }
.feedback.is-no .feedback-icon { background: var(--no); color: #fff; }
.feedback-icon svg { width: 16px; height: 16px; }

.feedback-title { font-weight: 700; font-size: 15px; line-height: 1.4; }
.feedback-text p { font-size: 14px; line-height: 1.6; opacity: .95; margin-top: 2px; }

.quiz-actions { margin-top: 2px; }

/* ─────────── شاشة النتيجة ─────────── */
.result-hero { text-align: center; }
.result-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--pink-deep);
  margin-top: 2px;
}
.result-sub {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 300px;
  margin: 4px auto 0;
}

.score-card {
  background: var(--card);
  border: 1px solid rgba(232, 98, 143, .08);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
  text-align: center;
  margin: 18px 0 16px;
  animation: screenIn .36s cubic-bezier(.22, .8, .35, 1) both;
}

.score-main { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.score-num {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: var(--pink);
}
.score-unit { font-size: 15px; font-weight: 700; color: var(--ink-soft); }

.score-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.stat { background: #FFF6F9; border-radius: 16px; padding: 10px 8px; }
.stat-lbl { font-size: 12.5px; color: var(--ink-soft); }
.stat-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-top: 2px;
}

.new-best {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: var(--pill);
  background: #FFF0F6;
  color: var(--pink-deep);
  font-size: 13px;
  font-weight: 700;
}
.new-best svg { width: 14px; height: 14px; }

.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ─────────── تأكيد الخروج ─────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 43, 56, .34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(120, 40, 70, .28);
  padding: 22px 20px 18px;
  text-align: center;
  animation: modalIn .28s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.modal-badge {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #FFF0F6;
  color: var(--pink-deep);
  display: grid;
  place-items: center;
}
.modal-badge svg { width: 24px; height: 24px; }

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.modal-card p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 6px 0 16px;
}
.modal-actions { display: flex; flex-direction: column; gap: 6px; }
.modal-actions .btn-primary { min-height: 54px; font-size: 18px; }

/* ─────────── الشاشات القصيرة والواسعة ─────────── */
@media (max-height: 700px) {
  .lulu-halo { width: 140px; height: 140px; margin-top: 0; }
  .lulu-home { width: 108px; }
  .app-title { font-size: 29px; }
  .app-sub { margin-bottom: 16px; font-size: 14px; }
  .section-head { margin-top: 22px; }
}

@media (min-width: 700px) {
  .app { padding-top: 34px; }
}

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