:root {
  --night: #0e3b43;
  --night-2: #13505a;
  --night-3: #0a2b31;
  --saffron: #f4b740;
  --coral: #f07a63;
  --mint: #9adbc8;
  --paper: #fff6e8;
  --paper-2: #f6e9d2;
  --ink: #1d2a2c;
  --ink-soft: #4d5f62;
  --line: #e7d6b8;
  --ok: #2f9e7a;
  --warn: #c9811a;
  --bad: #c4513d;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(14, 59, 67, 0.08), 0 10px 24px -12px rgba(14, 59, 67, 0.35);
  --head: "Baloo Bhaijaan 2", "Tajawal", system-ui, sans-serif;
  --body: "Tajawal", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(rgba(14, 59, 67, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}
img { max-width: 100%; display: block; }
a { color: var(--night); }
h1, h2, h3 { font-family: var(--head); line-height: 1.3; margin: 0 0 0.4em; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
#app { min-height: 70vh; outline: none; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ---------- الشريط العلوي ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100% - 1120px) / 2));
  background: rgba(14, 59, 67, 0.92);
  backdrop-filter: blur(8px);
  color: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 12px; background: var(--night-2); }
.brand__name { font-family: var(--head); font-weight: 800; font-size: 1.15rem; }
.brand__name em { font-style: normal; color: var(--saffron); }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .topnav button {
  color: var(--paper); text-decoration: none; background: none; border: 0; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; font-weight: 500;
}
.topnav a:hover, .topnav button:hover { background: rgba(255, 246, 232, 0.12); }
.topnav a.is-cta {
  background: var(--saffron); color: var(--night); font-weight: 700;
  box-shadow: 0 3px 0 #c88f22;
}
.topnav a.is-cta:hover { transform: translateY(-1px); background: #ffc85a; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none;
  padding: 12px 22px; border-radius: 14px; font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(2px); }
.btn--sun { background: var(--saffron); color: var(--night); box-shadow: 0 4px 0 #c88f22; }
.btn--sun:hover { background: #ffc85a; }
.btn--coral { background: var(--coral); color: #fff; box-shadow: 0 4px 0 #c45844; }
.btn--night { background: var(--night); color: var(--paper); box-shadow: 0 4px 0 var(--night-3); }
.btn--ghost { background: transparent; color: var(--night); border: 2px dashed var(--night); }
.btn--small { padding: 7px 14px; font-size: 0.92rem; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- البطل المتحرك ---------- */
.hero { position: relative; height: 300vh; background: var(--night); color: var(--paper); }
.hero__stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.hero__media, .hero__poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero__shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10, 43, 49, 0.1) 0%, rgba(10, 43, 49, 0.55) 55%, rgba(10, 43, 49, 0.88) 100%);
}
.hero__chapters { position: absolute; inset: 0; display: grid; align-items: center; }
.chapter {
  grid-area: 1 / 1; padding-inline: max(20px, calc((100% - 1120px) / 2));
  max-width: 620px; justify-self: start;
  opacity: 0; transform: translateY(24px); transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.chapter.is-on { opacity: 1; transform: none; pointer-events: auto; }
.chapter__kicker {
  display: inline-block; font-weight: 700; color: var(--night); background: var(--mint);
  padding: 2px 12px; border-radius: 999px; margin-bottom: 10px; font-size: 0.95rem;
}
.chapter h1, .chapter h2 { font-size: clamp(2.1rem, 5vw, 3.6rem); color: var(--paper); margin-bottom: 0.25em; }
.chapter h1 span, .chapter h2 span { color: var(--saffron); }
.chapter p { font-size: clamp(1.05rem, 2vw, 1.3rem); color: #e9f3ef; max-width: 34ch; }
.chapter .btn { margin-top: 10px; }
.hero__dots { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); display: grid; gap: 10px; }
.hero__dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 246, 232, 0.35); transition: 0.3s; }
.hero__dots span.is-on { background: var(--saffron); transform: scale(1.4); }
.hero__hint {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  font-size: 0.9rem; color: rgba(255, 246, 232, 0.8); animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- أقسام الصفحة الرئيسية ---------- */
.section { padding: 80px 0; }
.section--night { background: var(--night); color: var(--paper); }
.section__head { max-width: 640px; margin-bottom: 36px; }
.section__head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.section__head p { color: var(--ink-soft); }
.section--night .section__head p { color: #cfe3de; }
.tag-sun { color: var(--coral); font-weight: 700; }

.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.subject {
  background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 2px solid var(--line); text-decoration: none; color: inherit;
  transform: rotate(var(--tilt, 0deg)); transition: transform 0.2s ease;
}
.subject:hover { transform: rotate(0) translateY(-4px); }
.subject__img { aspect-ratio: 1; background: var(--night-2); }
.subject__img img { width: 100%; height: 100%; object-fit: cover; }
.subject__name { font-family: var(--head); font-weight: 700; padding: 10px 14px; font-size: 1.1rem; }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.pillar { background: var(--night-2); border-radius: var(--radius); padding: 24px; border: 2px solid rgba(154, 219, 200, 0.25); }
.pillar__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; }
.pillar__icon svg { width: 28px; height: 28px; }
.pillar h3 { font-size: 1.3rem; color: var(--saffron); }
.pillar p { margin: 0; color: #d8e9e4; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; counter-reset: s; }
.step {
  background: #fff; border-radius: var(--radius); padding: 26px 22px 22px; position: relative;
  box-shadow: var(--shadow); border: 2px solid var(--line);
}
.step::before {
  counter-increment: s; content: counter(s);
  position: absolute; top: -18px; right: 20px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 1.2rem;
  background: var(--saffron); color: var(--night); box-shadow: 0 3px 0 #c88f22;
}
.step h3 { font-size: 1.25rem; }
.step p { margin: 0; color: var(--ink-soft); }

.price {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; align-items: center;
  background: #fff; border-radius: 26px; padding: 34px; box-shadow: var(--shadow); border: 2px solid var(--line);
}
.price__amount { font-family: var(--head); font-size: 3.4rem; color: var(--night); font-weight: 800; line-height: 1; }
.price__amount small { font-size: 1.1rem; color: var(--ink-soft); font-weight: 500; }
.price ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.price li::before { content: "✓"; color: var(--ok); font-weight: 800; margin-left: 8px; }

/* ---------- البطاقات والنماذج ---------- */
.page { padding: 40px 0 70px; }
.card {
  background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 2px solid var(--line);
}
.auth { max-width: 460px; margin: 40px auto; }
.auth h1 { font-size: 2rem; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 0.95rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--night); outline: none; background: #fff; }
.field textarea { min-height: 110px; resize: vertical; }
.field input[type="radio"], .field input[type="checkbox"] { width: auto; flex: 0 0 auto; padding: 0; accent-color: var(--night); }
.qb-item .opt input[type="text"] { width: auto; min-width: 0; background: #fff; }
.field .hint { font-size: 0.85rem; color: var(--ink-soft); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 180px; }
.muted { color: var(--ink-soft); }
.form-error { color: var(--bad); font-weight: 700; min-height: 1.5em; }

/* ---------- لوحة الطالب ---------- */
.banner {
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--radius); margin-bottom: 22px; font-weight: 500;
}
.banner--trial { background: #e3f5ef; border: 2px solid var(--mint); }
.banner--sub { background: #fff1d2; border: 2px solid var(--saffron); }
.banner--expired { background: #fde4de; border: 2px solid var(--coral); }
.banner--pending { background: #eef3f4; border: 2px dashed var(--night-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 22px; }
.chip {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 500;
}
.chip.is-on { background: var(--night); color: var(--paper); border-color: var(--night); }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lesson-card {
  background: #fff; border-radius: var(--radius); border: 2px solid var(--line); padding: 18px; display: grid; gap: 8px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform 0.15s ease;
}
.lesson-card:hover { transform: translateY(-3px); }
.lesson-card__meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; }
.badge { background: var(--paper-2); border-radius: 999px; padding: 1px 10px; font-weight: 700; color: var(--night); }
.badge--mint { background: #dff4ee; }
.badge--sun { background: #ffeec7; }
.badge--coral { background: #fde0d9; }
.lesson-card h3 { font-size: 1.2rem; margin: 0; }
.lesson-card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.stars { color: var(--saffron); letter-spacing: 2px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }

/* ---------- صفحة الدرس ---------- */
.lesson-head { margin-bottom: 18px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  border: 0; cursor: pointer; padding: 9px 18px; border-radius: 12px; font-weight: 700;
  background: var(--paper-2); color: var(--night);
}
.tab.is-on { background: var(--night); color: var(--paper); }
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { white-space: pre-line; font-size: 1.1rem; }
.activity { background: #fff8e6; border: 2px dashed var(--saffron); border-radius: var(--radius); padding: 22px; white-space: pre-line; font-size: 1.08rem; }
.quiz-q { margin-bottom: 18px; }
.quiz-q h3 { font-size: 1.2rem; }
.options { display: grid; gap: 8px; }
.option {
  text-align: right; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 500;
}
.option:hover { border-color: var(--night); }
.option.is-right { background: #dff4ee; border-color: var(--ok); }
.option.is-wrong { background: #fde4de; border-color: var(--bad); }
.result { text-align: center; padding: 26px; }
.result .big-stars { font-size: 2.6rem; color: var(--saffron); letter-spacing: 6px; }
.lock { text-align: center; padding: 40px 24px; }
.lock svg { width: 56px; height: 56px; margin: 0 auto 10px; color: var(--coral); }

/* ---------- زوم ---------- */
.live-list { display: grid; gap: 14px; }
.live {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  background: #fff; border-radius: var(--radius); padding: 16px 18px; border: 2px solid var(--line); box-shadow: var(--shadow);
}
.live__date { background: var(--night); color: var(--paper); border-radius: 14px; padding: 8px 12px; text-align: center; min-width: 74px; }
.live__date strong { display: block; font-family: var(--head); font-size: 1.5rem; line-height: 1.1; }
.live h3 { margin: 0; font-size: 1.15rem; }

/* ---------- الاشتراك ---------- */
.bank { background: var(--paper); border: 2px dashed var(--night-2); border-radius: 14px; padding: 16px; white-space: pre-line; font-weight: 500; }

/* ---------- لوحة المعلمة ---------- */
.admin-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.side { display: grid; gap: 6px; position: sticky; top: 80px; }
.side button {
  text-align: right; border: 0; background: transparent; padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 700; color: var(--night);
}
.side button.is-on { background: var(--night); color: var(--paper); }
.side .count { background: var(--coral); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 0.8rem; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: var(--radius); padding: 18px; border: 2px solid var(--line); }
.stat strong { display: block; font-family: var(--head); font-size: 2.2rem; color: var(--night); line-height: 1.1; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; font-size: 0.95rem; vertical-align: top; }
th { background: var(--paper-2); font-weight: 700; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 2px solid var(--line); }
.quiz-builder { display: grid; gap: 12px; }
.qb-item { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 14px; }
.qb-item .opts { display: grid; gap: 6px; margin-top: 8px; }
.qb-item .opt { display: flex; gap: 8px; align-items: center; }
.qb-item .opt input[type="text"] { flex: 1; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); }

/* ---------- عام ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 140%); z-index: 50;
  background: var(--night); color: var(--paper); padding: 12px 22px; border-radius: 14px; font-weight: 700;
  transition: transform 0.3s ease; max-width: calc(100% - 32px);
}
.toast.is-on { transform: translate(-50%, 0); }
.footer { background: var(--night-3); color: #cfe3de; padding: 34px 0; }
.footer__inner { width: min(1120px, 100% - 32px); margin-inline: auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer p { margin: 4px 0 0; }
.footer__small { font-size: 0.9rem; opacity: 0.8; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--paper-2); border-top-color: var(--saffron); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.gift {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 43, 49, 0.85);
}
.gift__card { background: var(--paper); border-radius: 28px; padding: 36px 30px; max-width: 460px; text-align: center; box-shadow: var(--shadow); }
.gift__card h2 { font-size: 2rem; color: var(--night); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 820px) {
  body { font-size: 16px; }
  .price { grid-template-columns: 1fr; padding: 24px; }
  .admin-grid { grid-template-columns: 1fr; }
  .side { position: static; display: flex; overflow-x: auto; }
  .side button { white-space: nowrap; }
  .hero__shade { background: linear-gradient(180deg, rgba(10, 43, 49, 0.2) 0%, rgba(10, 43, 49, 0.85) 70%); }
  .hero__chapters { align-items: end; padding-bottom: 80px; }
  .live { grid-template-columns: auto 1fr; }
  .live > :last-child { grid-column: 1 / -1; }
  .topbar { padding: 8px 16px; }
  .brand__name { font-size: 1rem; }
  .topnav a, .topnav button { padding: 5px 9px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .hero { height: auto; }
  .hero__stage { position: relative; }
  .chapter { position: relative; opacity: 1; transform: none; }
}

/* ---------- الساحة ---------- */
.c-page { max-width: 760px; }
.c-safe { background: var(--mint); color: var(--night); border-radius: 14px; padding: 10px 14px; font-weight: 700; margin-bottom: 14px; }
.c-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.c-tabs a { flex: 1 1 160px; text-align: center; padding: 10px 14px; border-radius: 12px; text-decoration: none; font-weight: 700; background: var(--paper-2); color: var(--night); }
.c-tabs a.is-on { background: var(--night); color: var(--paper); }
.c-compose h2 { font-size: 1.15rem; }
.c-compose textarea { width: 100%; resize: vertical; }
.c-kinds { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.c-kinds label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.c-kinds input { accent-color: var(--night); }
.c-draw { margin: 10px 0; }
.c-draw canvas { width: 100%; height: auto; aspect-ratio: 10 / 7; background: #fff; border: 2px dashed var(--night); border-radius: 14px; touch-action: none; cursor: crosshair; display: block; }
.c-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.c-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(14, 59, 67, .25); cursor: pointer; padding: 0; }
.c-color.is-on { outline: 3px solid var(--saffron); outline-offset: 2px; }
.c-tools select { width: auto; }
.c-img { display: block; max-width: 100%; max-height: 520px; margin: 10px auto 0; border-radius: 14px; background: #fff; }
.c-post { margin-bottom: 14px; }
.c-post.is-pinned { border: 3px solid var(--saffron); }
.c-head { display: flex; gap: 10px; align-items: center; }
.c-head > div { flex: 1; min-width: 0; }
.c-meta { font-size: .85rem; }
.c-av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; font-size: 1.1rem; }
.c-av--sun { background: var(--saffron); color: var(--night); }
.c-av--coral { background: var(--coral); color: #fff; }
.c-av--mint { background: var(--mint); color: var(--night); }
.c-av--night { background: var(--night); color: var(--paper); }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; }
.c-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; border-top: 1px dashed rgba(14, 59, 67, .2); padding-top: 10px; }
.c-actions button:not(.c-link) { background: var(--paper-2); border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; color: var(--night); }
.c-actions button.is-on { background: var(--saffron); }
.c-link { background: none; border: 0; color: var(--night); opacity: .65; cursor: pointer; font: inherit; font-size: .88rem; padding: 4px 6px; }
.c-link:hover { opacity: 1; text-decoration: underline; }
.c-comments { margin-top: 10px; background: var(--paper); border-radius: 12px; padding: 10px 12px; }
.c-comment { padding: 6px 0; border-bottom: 1px dashed rgba(14, 59, 67, .12); overflow-wrap: anywhere; }
.c-comment .is-teacher { color: var(--coral); }
.c-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.c-presets button { background: #fff; border: 1.5px solid var(--mint); border-radius: 999px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: .9rem; color: var(--night); }
.c-cform { display: flex; gap: 8px; }
.c-cform input { flex: 1; min-width: 0; }
.c-rules { padding-inline-start: 1.2em; margin: 10px 0 16px; line-height: 1.9; }
.c-review { border-bottom: 1px dashed rgba(14, 59, 67, .2); padding: 12px 0; }
.c-review:last-child { border-bottom: 0; }
[hidden] { display: none !important; }
.toast { visibility: hidden; transition: transform 0.3s ease, visibility 0.3s; }
.toast.is-on { visibility: visible; }
