/* كويز «اختر كتابك» — الهاتف أولاً (360px)، RTL، بلا أي لون وردي */
@font-face { font-family: 'Changa'; font-weight: 800; font-display: swap; src: url('../fonts/changa-arabic-800-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Changa'; font-weight: 800; font-display: swap; src: url('../fonts/changa-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2013-2026; }
@font-face { font-family: 'Changa'; font-weight: 700; font-display: swap; src: url('../fonts/changa-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Changa'; font-weight: 700; font-display: swap; src: url('../fonts/changa-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2013-2026; }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../fonts/tajawal-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../fonts/tajawal-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2013-2026; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../fonts/tajawal-arabic-500-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../fonts/tajawal-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2013-2026; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2013-2026; }

:root {
  --navy: #1B2A4A; --navy-2: #2B3A5C; --ink: #1B2A4A; --muted: #55627C;
  --cream: #F7F2E8; --paper: #FFFDF8; --line: #DDD5C4;
  --teal: #0F7676; --teal-2: #0B5F5F; --gold: #E8A33D; --ok: #1E7A5A; --err: #B3261E;
  --r: 16px; --shadow: 0 6px 22px rgba(27, 42, 74, .10);
  --font-h: 'Changa', 'Tajawal', system-ui, sans-serif; --font-b: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 17px/1.7 var(--font-b); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-h); margin: 0; line-height: 1.3; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-2); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.skip { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 50; }
.skip:focus { inset-inline-start: 8px; top: 8px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 18px; }

/* ---------- أزرار ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 22px; border: 2px solid transparent; border-radius: 14px; font: 700 18px/1.2 var(--font-b); cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 6px 16px rgba(15, 118, 118, .28); }
.btn-primary:hover { background: var(--teal-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--navy); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-lg { width: 100%; min-height: 60px; font-size: 20px; }
.btn-block { width: 100%; }

/* ---------- صفحة الهبوط ---------- */
.landing { padding: 26px 0 40px; }
.eyebrow { display: inline-block; margin: 0 0 12px; padding: 5px 14px; border-radius: 999px; background: var(--navy); color: var(--cream); font: 500 14px/1.6 var(--font-b); }
.hero-title { font-size: clamp(26px, 7.4vw, 40px); font-weight: 800; color: var(--navy); text-wrap: balance; }
.hero-desc { margin: 14px 0 20px; color: var(--navy-2); font-size: 17px; }
.counter { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: #FFF4DC; border: 1px solid #F0D49A; font-weight: 500; text-align: center; }
.counter b { font-family: var(--font-h); font-size: 20px; }
.notice { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: #EAF1F7; border: 1px solid #C9D7E6; }
.notice-closed { text-align: center; font-weight: 700; font-size: 18px; }
.trust { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 14.5px; }
.hero-art { display: block; margin: 26px -6px 0; }
.hero-art img { width: 100%; aspect-ratio: 1200 / 700; object-fit: contain; }
.faq { margin-top: 30px; }
.faq h2 { font-size: 22px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 3px solid var(--navy); display: inline-block; }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font: 700 22px/1 var(--font-h); color: var(--teal); }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0; padding: 0 16px 16px; color: var(--navy-2); }
.foot { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }

/* ---------- غلاف الكويز ---------- */
.quiz { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.qbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--cream); border-bottom: 1px solid var(--line); }
.qback { width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); display: grid; place-items: center; cursor: pointer; color: var(--navy); }
.qback[disabled] { opacity: .3; }
.qprogress { flex: 1; height: 8px; border-radius: 99px; background: #E4DCCB; overflow: hidden; }
.qprogress i { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 99px; transition: width .35s ease; }
.qcount { flex: none; min-width: 44px; text-align: center; font: 700 14px/1 var(--font-b); color: var(--muted); direction: ltr; }
.qstage { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 22px 18px 120px; }
.screen { animation: in .28s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } .qprogress i, .btn { transition: none; } }
.q-title { font-size: clamp(22px, 6.2vw, 30px); font-weight: 800; color: var(--navy); text-wrap: balance; }
.q-help { margin: 6px 0 0; color: var(--muted); font-size: 15.5px; }
.q-body { margin-top: 18px; }
.q-error { margin: 12px 0 0; color: var(--err); font-weight: 700; }

/* خيارات كبيرة سهلة اللمس */
.opts { display: grid; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 12px 16px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; text-align: start; font: 500 17.5px/1.45 var(--font-b); cursor: pointer; transition: border-color .12s, background .12s; }
.opt:hover { border-color: #B9AE96; }
.opt[aria-checked="true"], .opt[aria-pressed="true"] { border-color: var(--teal); background: #E8F4F3; font-weight: 700; }
.opt .mark { flex: none; width: 24px; height: 24px; border: 2px solid #A99F88; border-radius: 50%; display: grid; place-items: center; background: #fff; }
.opt.multi .mark { border-radius: 7px; }
.opt[aria-checked="true"] .mark { border-color: var(--teal); background: var(--teal); }
.opt[aria-checked="true"] .mark::after { content: ''; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.6px 2.6px; transform: rotate(-45deg) translate(1px, -1px); }
.opt[aria-disabled="true"] { opacity: .45; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; direction: ltr; }
.scale .opt { justify-content: center; min-height: 64px; font: 800 22px/1 var(--font-h); padding: 0; }
.scale-ends { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 14px; direction: ltr; }
textarea, input[type="text"], input[type="tel"], input[type="email"], select { width: 100%; min-height: 54px; padding: 12px 14px; background: #fff; border: 2px solid var(--line); border-radius: 12px; font-size: 17px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
textarea:focus, input:focus, select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(15, 118, 118, .18); }

/* شريط الإجراء السفلي */
.actionbar { position: fixed; inset: auto 0 0 0; z-index: 12; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--cream) 72%, rgba(247, 242, 232, 0)); }
.actionbar-in { max-width: 684px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.actionbar .btn { flex: 1; }
.actionbar .hint { flex: none; font: 700 15px/1.2 var(--font-b); color: var(--navy-2); }

/* ---------- شبكة الكتب (Q14) ---------- */
.sec-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font: 800 19px/1.3 var(--font-h); }
.sec-title::after { content: ''; flex: 1; height: 3px; background: var(--navy); border-radius: 2px; }
.books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .books { grid-template-columns: repeat(4, minmax(0, 1fr)); } .qstage.wide { max-width: 1040px; } }
.book { position: relative; display: flex; flex-direction: column; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .12s, box-shadow .12s, transform .12s; }
.book.sel { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 118, .2); }
.book.dim { opacity: .55; }
.book-pick { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: start; cursor: pointer; }
.book-img { aspect-ratio: 1 / 1; background: #EFE8D8; display: grid; place-items: center; overflow: hidden; }
.book-img img { width: 100%; height: 100%; object-fit: contain; }
.book-txt { padding: 10px 10px 4px; }
.book-title { font: 800 16px/1.35 var(--font-h); color: var(--navy); }
.book-age { display: inline-block; margin-top: 5px; padding: 1px 9px; border-radius: 99px; background: #E9EEF5; color: var(--navy-2); font: 500 12.5px/1.7 var(--font-b); }
.book-pitch { margin: 6px 0 0; color: var(--navy-2); font-size: 14px; line-height: 1.55; }
.book-more { margin: auto 8px 8px; min-height: 44px; border: 0; background: none; color: var(--teal-2); font: 700 14.5px/1 var(--font-b); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.badge { position: absolute; top: 8px; inset-inline-start: 8px; width: 38px; height: 38px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font: 800 20px/1 var(--font-h); box-shadow: 0 3px 10px rgba(0, 0, 0, .25); z-index: 2; }

/* ---------- ترتيب الاختيارات ---------- */
.rank { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; touch-action: none; }
.rank li.drag { border-color: var(--teal); box-shadow: var(--shadow); }
.rank .n { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 800 19px/1 var(--font-h); }
.rank img { flex: none; width: 54px; height: 54px; object-fit: contain; }
.rank .t { flex: 1; font: 700 16px/1.4 var(--font-h); }
.rank .mv { display: grid; gap: 6px; }
.rank .mv button { width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 15px; color: var(--navy); }
.rank .mv button[disabled] { opacity: .3; }

/* ---------- نية الشراء ---------- */
.intent { background: var(--paper); border: 2px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.intent-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.intent-head img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.intent-head .t { font: 800 17px/1.4 var(--font-h); }
.intent .opts { gap: 8px; }
.intent .opt { min-height: 50px; font-size: 16.5px; }

/* ---------- استمارة الهدية ---------- */
.form { display: grid; gap: 16px; }
.field label, .field .lbl { display: block; margin-bottom: 6px; font-weight: 700; }
.field .req { color: var(--err); }
.field .opt-tag { color: var(--muted); font-weight: 400; font-size: 14px; }
.field .msg { margin: 6px 0 0; color: var(--err); font-weight: 700; font-size: 15px; }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--err); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg .opt { min-height: 52px; justify-content: center; text-align: center; }
.gift-note { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: #FFF4DC; border: 1px solid #F0D49A; font-size: 15px; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--paper); border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.consent input { flex: none; width: 24px; height: 24px; margin-top: 3px; accent-color: var(--teal); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- صفحة الشكر ---------- */
.thanks { text-align: center; }
.thanks .big { font-size: clamp(26px, 7vw, 36px); font-weight: 800; }
.thanks .code { display: inline-block; margin-top: 10px; padding: 6px 16px; border-radius: 10px; background: var(--navy); color: #fff; font: 700 18px/1.4 var(--font-b); letter-spacing: 2px; direction: ltr; }
.thanks-books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.thanks-books figure { margin: 0; }
.thanks-books img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.thanks-books figcaption { font: 700 13.5px/1.4 var(--font-h); margin-top: 4px; }
.share { display: grid; gap: 10px; margin-top: 18px; }
.btn-wa { background: #128C4B; color: #fff; }
.btn-fb { background: #1A56B0; color: #fff; }

/* ---------- نافذة التفاصيل السفلية ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.sheet-panel { position: absolute; inset: auto 0 0 0; max-height: 88dvh; overflow: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .26s ease both; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 760px) { .sheet-panel { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 560px; border-radius: 22px; animation: none; } }
.sheet-close { position: sticky; top: 0; float: left; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #EFE8D8; font-size: 26px; line-height: 1; cursor: pointer; color: var(--navy); z-index: 2; }
.sheet-img { width: min(320px, 78%); margin: 0 auto 10px; aspect-ratio: 1; object-fit: contain; }
.sheet h3 { font-size: 23px; font-weight: 800; }
.sheet .sub { margin: 6px 0 12px; color: var(--navy-2); }
.sheet ul { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.sheet li { position: relative; padding-inline-start: 26px; }
.sheet li::before { content: ''; position: absolute; inset-inline-start: 2px; top: .62em; width: 12px; height: 3px; background: var(--navy); border-radius: 2px; }
.toast { position: fixed; inset: auto 16px 96px 16px; z-index: 45; margin: 0 auto; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--navy); color: #fff; text-align: center; font-weight: 500; box-shadow: var(--shadow); }
