:root {
  color-scheme: light;
  --paper: #EEF2F0;
  --sheet: #F8FAF9;
  --line: #D3DED9;
  --ink: #16302C;
  --muted: #5A706B;
  --pine: #1F5E57;
  --pine-deep: #174943;
  --pine-soft: #DCE8E4;
  --lv-very_low: #CFDCD7;
  --lv-low: #A9C2BA;
  --lv-mid: #D49A33;
  --lv-high: #BC5A2B;
  --lv-very_high: #7C2F45;
  --danger: #A63A2B;
  --night: #0E2925;
  --night-2: #143832;
  --gold: #D6B25E;
  --gold-deep: #B8913A;
  --mist: #CFE0DA;
  --ui: "Readex Pro", system-ui, sans-serif;
  --read: "Noto Naskh Arabic", "Readex Pro", serif;
  --r-sm: 10px;
  --r-md: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--ui);
}
.wrap { max-width: 600px; margin: 0 auto; padding: 0 16px max(24px, env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
a { color: var(--pine); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; border-radius: 6px; }

/* شريط علوي */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 0 8px; position: relative; z-index: 3; }
.bar .link-btn { margin-inline-start: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.brand img { border-radius: 10px; }

/* عناوين عامة */
h1 {
  font-weight: 700; font-size: clamp(38px, 11vw, 56px); line-height: 1.15; margin: 0 0 16px;
  letter-spacing: -0.5px;
}
h2 { font-weight: 600; font-size: 26px; line-height: 1.35; margin: 8px 0 6px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.fine { font-size: 13px; color: var(--muted); line-height: 1.7; }
.center { text-align: center; }
.actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.resume-note { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; margin: 0 0 4px; font-size: 15px; }

/* الفسيفساء: 15 مخططاً في 5 مجالات */
.mosaic { display: grid; gap: 10px; }
.mosaic .dom { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; }
.mosaic .dom-name { font-size: 12px; color: var(--muted); line-height: 1.35; }
.mosaic .tiles { display: flex; gap: 6px; }
.mosaic .tile {
  flex: 0 0 auto; width: clamp(38px, 11vw, 54px); aspect-ratio: 1; border-radius: 9px;
  background: var(--pine); position: relative; border: 0; padding: 0;
}
.mosaic.home .tile { opacity: .9; }
.mosaic.home .dom:nth-child(1) .tile { background: #1F5E57; }
.mosaic.home .dom:nth-child(2) .tile { background: #3E7A70; }
.mosaic.home .dom:nth-child(3) .tile { background: #6C9A8F; }
.mosaic.home .dom:nth-child(4) .tile { background: #96B6AC; }
.mosaic.home .dom:nth-child(5) .tile { background: #BCD0C9; }
@media (prefers-reduced-motion: no-preference) {
  .mosaic.home .tile { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 45ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.92); } }
}
.mosaic.result .tile { cursor: pointer; }
.mosaic.result .tile span {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff;
}
.mosaic.result .tile.lv-very_low span, .mosaic.result .tile.lv-low span { color: var(--ink); }
.lv-very_low { background: var(--lv-very_low) !important; }
.lv-low { background: var(--lv-low) !important; }
.lv-mid { background: var(--lv-mid) !important; }
.lv-high { background: var(--lv-high) !important; }
.lv-very_high { background: var(--lv-very_high) !important; }

/* أزرار */
.btn {
  display: inline-flex; justify-content: center; align-items: center; min-height: 54px; padding: 0 22px;
  border-radius: var(--r-md); border: 1.5px solid transparent; font-weight: 600; font-size: 17px; cursor: pointer;
  text-decoration: none; width: 100%;
}
.btn.primary { background: var(--pine); color: #fff; }
.btn.primary:hover { background: var(--pine-deep); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.outline { background: var(--sheet); border-color: var(--pine); color: var(--pine); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { pointer-events: none; opacity: .7; }
.link-btn { background: none; border: 0; padding: 8px 4px; color: var(--pine); font-weight: 500; cursor: pointer; font-size: 15px; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.back { background: none; border: 0; padding: 6px 0; color: var(--muted); cursor: pointer; font-size: 14px; margin-top: 8px; }
.back::before { content: "› "; }

/* نماذج */
form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 14px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 6px; }
input:not([type=radio]), select {
  width: 100%; min-height: 52px; padding: 10px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: #fff; font-size: 17px;
}
input:focus, select:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 3px var(--pine-soft); }
.phone { display: grid; grid-template-columns: 104px 1fr; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; }
.choices span {
  display: grid; place-items: center; min-height: 52px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: #fff; font-weight: 500; cursor: pointer;
}
.choices input:checked + span { border-color: var(--pine); background: var(--pine-soft); color: var(--pine-deep); }
.choices input:focus-visible + span { outline: 3px solid var(--pine); outline-offset: 2px; }
.error { color: var(--danger); font-size: 14px; margin: -6px 0 0; min-height: 1px; }
.error:empty { display: none; }
.otp { text-align: center; font-size: 30px !important; letter-spacing: 12px; font-weight: 600; min-height: 64px !important; }

/* الأسئلة */
.progress { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 10px 0 12px; }
.progress-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.track { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.track i { display: block; height: 100%; background: var(--pine); width: 0; transition: width .4s ease; }
.legend { list-style: none; margin: 0 0 12px; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-md); display: grid; gap: 4px; font-size: 14px; }
.legend b { display: inline-block; width: 22px; color: var(--pine); }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }

.q { padding: 22px 0 24px; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 8px; }
.q-num { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.q-text { font-family: var(--read); font-size: 20px; line-height: 1.85; font-weight: 600; margin: 0 0 14px; }
.scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.scale button {
  min-height: 50px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  font-weight: 600; font-size: 18px; color: var(--muted); transition: background .15s, border-color .15s, color .15s;
}
.scale button[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.choice-label { font-size: 14px; color: var(--pine-deep); font-weight: 500; margin-top: 8px; min-height: 22px; }
.q.missing .q-text { color: var(--danger); }
.pager { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 8px; }

/* النتيجة */
.r-head { padding: 18px 0 6px; }
.r-head h1 { font-size: clamp(30px, 8.5vw, 42px); margin-bottom: 8px; }
.r-date { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.r-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.r-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 5px; vertical-align: -1px; }
.r-list { list-style: none; padding: 0; margin: 30px 0 0; }
.r-item { padding: 18px 0; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.r-item.flash { background: linear-gradient(90deg, transparent, var(--pine-soft), transparent); }
.r-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.r-name { font-weight: 600; font-size: 19px; }
.r-score { font-weight: 600; font-size: 20px; white-space: nowrap; }
.r-score small { color: var(--muted); font-weight: 400; font-size: 14px; }
.r-bar { height: 8px; background: var(--line); border-radius: 8px; margin: 10px 0; overflow: hidden; }
.r-bar i { display: block; height: 100%; border-radius: 8px; }
.pill { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 20px; color: #fff; margin-left: 6px; }
.r-text { margin: 6px 0 0; font-family: var(--read); font-size: 17px; line-height: 1.9; }
.note { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin: 24px 0 0; font-size: 15px; }
.note.warn { border-color: #E5C98F; background: #FBF5E8; }
.note p { margin: 0 0 10px; }
.note p:last-child { margin: 0; }
.offer { margin: 34px 0 0; padding: 24px 20px; border-radius: var(--r-md); background: var(--pine); color: #fff; }
.offer h3 { margin: 0 0 6px; font-size: 21px; font-weight: 600; }
.offer p { margin: 0 0 18px; color: #D7E7E2; font-size: 15px; }
.offer .btn { background: #fff; color: var(--pine-deep); }
.offer .price { font-weight: 700; margin-right: 6px; }
.consult { margin: 14px 0 0; padding: 20px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--sheet); }
.consult h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.consult p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.paid-box { margin: 34px 0 0; padding: 20px; border-radius: var(--r-md); background: var(--pine-soft); }
.paid-box h3 { margin: 0 0 6px; font-size: 19px; }
.expl { border-top: 1px solid var(--line); }
.expl summary { padding: 14px 0; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.expl summary::after { content: "+"; color: var(--pine); font-size: 20px; }
.expl[open] summary::after { content: "−"; }
.expl div { font-family: var(--read); font-size: 17px; line-height: 1.95; padding-bottom: 14px; }
.r-foot { margin: 28px 0 0; display: flex; justify-content: center; }

/* أخرى */
.loading { display: flex; justify-content: center; gap: 8px; padding: 120px 0; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--pine); animation: pulse 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.toast {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; max-width: calc(100% - 32px); z-index: 20;
}
.foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); line-height: 1.9; }
.foot a { color: var(--muted); }

@media (max-width: 360px) {
  .mosaic .dom { grid-template-columns: 74px 1fr; }
  .scale { gap: 4px; }
  .phone { grid-template-columns: 92px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.source { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.source b { color: var(--ink); font-weight: 600; }

/* ===== الصفحة الرئيسية ===== */
body[data-screen="home"] { background: var(--night); }
body[data-screen="home"] .wrap { padding-bottom: 0; }
body[data-screen="home"] .brand { color: #fff; }
body[data-screen="home"] .bar .link-btn { color: var(--gold); }
body[data-screen="home"] .foot { background: var(--paper); margin: 0 calc(50% - 50vw); padding: 22px 16px max(28px, env(safe-area-inset-bottom)); border: 0; }

.hero-dark {
  position: relative; color: #fff; text-align: center;
  margin: -76px calc(50% - 50vw) 0; padding: 76px 20px 0;
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 70% at 50% 108%, #1E4A42 0%, transparent 60%),
    var(--night);
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 2; max-width: 520px; width: 100%; padding: 4vh 0 0; }
.hero-title {
  font-weight: 700; font-size: clamp(50px, 16vw, 84px); line-height: 1.02; letter-spacing: -1px; margin: 0 0 22px;
  color: #F4F1E6;
}
.hero-q { font-family: var(--read); font-weight: 600; font-size: clamp(21px, 6vw, 27px); line-height: 1.6; color: var(--gold); margin: 0 0 8px; }
.hero-line { font-size: 17px; line-height: 1.8; color: var(--mist); margin: 0 auto 32px; max-width: 26em; }
.hero-dark .actions { max-width: 360px; margin: 0 auto; }
.hero-dark .resume-note { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--mist); }
.btn.gold { background: var(--gold); color: var(--night); box-shadow: 0 10px 30px -12px rgba(214,178,94,.7); }
.btn.gold:hover { background: #E2C277; }
.link-btn.light { color: var(--mist); text-decoration: none; text-align: center; }

.roots { position: relative; z-index: 1; width: min(420px, 100%); margin: 28px auto 0; display: block; flex: 0 0 auto; }
.roots path { fill: none; stroke: rgba(214,178,94,.55); stroke-width: 1.3; stroke-linecap: round; }
.roots path.leaf { stroke: rgba(207,224,218,.32); stroke-width: 1; }
.roots circle { fill: var(--gold); }
.roots circle:nth-child(3n) { fill: #E9D7A7; }
.roots circle:nth-child(4n) { fill: #8FB5AA; }
@media (prefers-reduced-motion: no-preference) {
  .roots path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; animation-delay: var(--d); }
  .roots circle { opacity: 0; transform-box: fill-box; transform-origin: center; animation: bloom .6s ease-out forwards; animation-delay: var(--d); }
  .hero-inner > * { animation: lift .8s cubic-bezier(.2,.7,.2,1) both; }
  .hero-inner > :nth-child(2) { animation-delay: .12s; } .hero-inner > :nth-child(3) { animation-delay: .22s; } .hero-inner > :nth-child(4) { animation-delay: .34s; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes bloom { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
  @keyframes lift { from { opacity: 0; transform: translateY(14px); } }
}
.scroll-cue {
  position: relative; z-index: 2; display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--mist); text-decoration: none; font-size: 13px; padding: 14px 0 max(22px, env(safe-area-inset-bottom)); opacity: .8;
}

/* المحتوى تحت الواجهة */
.about { background: var(--paper); margin: 0 calc(50% - 50vw); padding: 8px max(16px, calc(50vw - 284px)) 12px; }
.block { padding: 48px 0 8px; }
.block + .block { border-top: 1px solid var(--line); }
.block-title { font-size: clamp(26px, 7.4vw, 34px); font-weight: 700; line-height: 1.3; margin: 0 0 22px; letter-spacing: -.3px; }
.intro-lede { font-family: var(--read); font-size: 19px; line-height: 2; margin: 0 0 24px; }
.intro-lede span { font-family: var(--ui); font-size: 14px; color: var(--muted); }

.acc { border-top: 1px solid var(--line); }
.acc:last-of-type { border-bottom: 1px solid var(--line); }
.acc summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 2px; font-weight: 600; font-size: 18px;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: ""; flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--pine-soft) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 1v12M1 7h12' stroke='%231F5E57' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  transition: transform .25s ease, background-color .25s ease;
}
.acc[open] summary::after { transform: rotate(45deg); background-color: #F3E7C6; }
.acc-body { padding: 0 2px 22px; font-size: 16px; line-height: 1.9; }
.acc-body p { margin: 0 0 12px; }
.meta { margin: 0; display: grid; gap: 14px; }
.meta dt { font-size: 13px; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 500; }
.schema-list { list-style: none; counter-reset: s; padding: 0; margin: 4px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 15px; }
.schema-list li { counter-increment: s; display: flex; gap: 8px; align-items: baseline; }
.schema-list li::before { content: counter(s, arabic-indic); color: var(--gold-deep); font-weight: 700; min-width: 1.3em; }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.ticks li { position: relative; padding-right: 26px; }
.ticks li::before { content: ""; position: absolute; right: 0; top: .62em; width: 12px; height: 12px; border-radius: 4px; background: var(--gold); }
.ticks b { font-weight: 600; }
.quotes { display: grid; gap: 14px; }
.quotes blockquote { margin: 0; padding: 16px 18px; background: var(--sheet); border-radius: var(--r-md); border-right: 3px solid var(--gold); }
.quotes blockquote p { font-family: var(--read); font-size: 17px; line-height: 1.9; margin: 0 0 8px; }
.quotes cite { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.gains { list-style: none; padding: 0; margin: 0; }
.gains li { font-family: var(--read); font-size: 20px; line-height: 1.75; font-weight: 600; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.gains li span { font-family: var(--ui); font-weight: 500; font-size: 15px; color: var(--gold-deep); margin-left: 6px; }
.pull { font-size: clamp(25px, 7vw, 32px); font-weight: 700; line-height: 1.45; margin: 30px 0 10px; color: var(--pine); }

.who { margin: 0; display: grid; gap: 0; }
.who > div { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.who dt { font-weight: 600; font-size: 18px; }
.who dd { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.who .quote dd { font-family: var(--read); font-size: 21px; color: var(--pine); font-weight: 600; }

.band {
  margin: 44px calc(-1 * max(16px, calc(50vw - 284px))) 0; padding: 8px max(16px, calc(50vw - 284px));
  background: var(--night); color: #fff;
}
.band-item { padding: 34px 0; }
.band-item + .band-item { border-top: 1px solid rgba(255,255,255,.12); }
.band h2 { font-size: clamp(25px, 7vw, 32px); font-weight: 700; line-height: 1.35; margin: 0 0 10px; color: var(--gold); }
.band p { margin: 0; font-size: 17px; line-height: 1.9; color: var(--mist); }

.final .facts { list-style: none; padding: 0; margin: 0 0 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.final .facts li { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 8px; text-align: center; }
.final .facts b { display: block; font-size: 30px; font-weight: 700; color: var(--pine); line-height: 1.2; }
.final .facts span { font-size: 13px; color: var(--muted); }
.final .actions { margin-bottom: 8px; }
