:root {
  --slate-950: #1f2b34;
  --slate-900: #2a3944;
  --slate-800: #394a56;
  --slate-700: #526571;
  --slate-600: #71818b;
  --slate-500: #8ea0aa;
  --silver-300: #c9d4da;
  --silver-200: #dce5e9;
  --silver-100: #edf2f4;
  --pearl: #f7f9fa;
  --paper: #eef2f4;
  --white: #ffffff;
  --ink: #26343e;
  --muted: #6b7a84;
  --accent: #7f9aa9;
  --accent-strong: #6d8999;
  --border: rgba(63, 82, 94, 0.15);
  --shadow: 0 22px 64px rgba(35, 48, 58, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--paper); }
body {
  min-height: 100dvh;
  padding: 10px 14px;
  color: var(--ink);
  font-family: "Tajawal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(167, 183, 192, 0.26), transparent 30%),
    radial-gradient(circle at 90% 90%, rgba(184, 197, 204, 0.24), transparent 28%),
    linear-gradient(145deg, #e4eaed 0%, #f5f7f8 52%, #dfe6e9 100%);
  overflow-x: hidden;
}
body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(69, 88, 100, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 88, 100, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
}
button, textarea, input { font: inherit; }
button { color: inherit; }

.page {
  position: relative;
  isolation: isolate;
  width: min(1140px, calc(100vw - 28px));
  margin: 0 auto;
  overflow: hidden;
  background: rgba(249, 251, 252, 0.97);
  border: 1px solid rgba(255,255,255,0.88);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.page::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.018;
  background-image: url("assets/cover.jpg");
  background-repeat: no-repeat;
  background-position: 8% 50%;
  background-size: contain;
  filter: grayscale(1);
}
.ornament {
  height: 4px;
  background: linear-gradient(90deg, var(--slate-800), var(--silver-300), var(--accent), var(--slate-800));
}
.layout {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  min-height: 0;
}

/* الغلاف */
.visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 24px 30px 22px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(72, 88, 100, 0.98), rgba(99, 116, 127, 0.97));
}
.visual::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.075;
  background-image: url("assets/cover.jpg");
  background-position: center;
  background-size: cover;
  filter: grayscale(1) contrast(1.05);
}
.visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 34% 7%, rgba(255,255,255,0.17), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.015), rgba(20,31,39,0.16));
}
.brand, .book-wrap, .quote { position: relative; z-index: 1; }
.brand small {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: #eef3f5;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand small::before, .brand small::after {
  width: 34px;
  height: 1px;
  content: "";
  background: #c7d3d9;
}
.brand h1 {
  margin: 10px 0 0;
  color: #fff;
  font-size: clamp(38px, 4.4vw, 58px);
  font-weight: 800;
  line-height: 0.98;
}
.brand h1 span {
  display: block;
  margin-top: 10px;
  color: #e4ebef;
  font-size: 0.52em;
  font-weight: 700;
  text-align: center;
}
.book-wrap {
  display: grid;
  padding: 8px 0 6px;
  place-items: center;
}
.poster-frame {
  position: relative;
  width: min(260px, 76%);
  padding: 5px;
  background: linear-gradient(145deg, #f7f9fa 0%, #c6d2d8 48%, #7e909b 100%);
  border: 1px solid rgba(255,255,255,0.66);
  border-radius: 15px;
  box-shadow: 0 18px 38px rgba(26, 37, 45, 0.27);
}
.poster-frame::before {
  position: absolute;
  inset: 5px;
  z-index: 2;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(150, 166, 176, 0.38);
  border-radius: 10px;
}
.book {
  display: block;
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  background: #252b30;
  border-radius: 10px;
}
.quote {
  margin: 0;
  padding: 10px 14px;
  color: #f3f7f8;
  font-size: 14px;
  line-height: 1.6;
  background: rgba(255,255,255,0.085);
  border-right: 3px solid #c4d1d7;
  border-radius: 11px 0 0 11px;
  backdrop-filter: blur(4px);
}

/* جانب النموذج */
.form-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px clamp(24px, 3vw, 40px) 16px;
  background: linear-gradient(180deg, rgba(252,253,253,0.98), rgba(247,249,250,0.98));
}
.form-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--slate-700);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}
.mini-title {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}
.question-counter {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 7px 12px;
  color: var(--slate-800);
  font-size: 14px;
  font-weight: 800;
  background: rgba(121, 145, 160, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.counter-divider { color: var(--accent-strong); }
.progress-track {
  height: 3px;
  margin-top: 11px;
  overflow: hidden;
  background: rgba(79, 99, 111, 0.10);
  border-radius: 999px;
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--slate-700), #9db2bd, var(--accent));
  transition: width 420ms ease;
}
.form-stage {
  display: grid;
  flex: 1;
  min-height: 0;
  padding: 22px 0 12px;
  align-items: center;
}
.welcome-panel, .question-panel, .success-panel {
  width: 100%;
  animation: panel-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.welcome-panel h2, .success-panel h2, .question-title {
  color: var(--slate-950);
  font-weight: 800;
}
.welcome-panel h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.2;
}
.welcome-copy {
  max-width: 490px;
  margin: 11px 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}
.primary-button, .secondary-button, .back-button, .option-button, .star-button {
  border: 0;
  cursor: pointer;
}
.primary-button {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 46px;
  padding: 10px 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #41535f, #6b7f8b);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(56, 73, 84, 0.20);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.primary-button:hover, .primary-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(56, 73, 84, 0.24);
  outline: none;
}
.primary-button:disabled { cursor: not-allowed; opacity: 0.58; transform: none; }
.primary-button.compact { min-width: 120px; min-height: 44px; }
.privacy-note {
  margin: 12px 0 0;
  color: #87949c;
  font-size: 12px;
}
.question-index {
  margin-bottom: 8px;
  color: var(--slate-600);
  font-size: 16px;
  font-weight: 700;
}
.question-title {
  max-width: 600px;
  margin: 0;
  font-size: clamp(26px, 3.1vw, 36px);
  line-height: 1.3;
}
.question-hint {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 500;
}
.options-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.option-button {
  display: flex;
  gap: 11px;
  align-items: center;
  min-height: 54px;
  padding: 10px 13px;
  color: var(--ink);
  font-size: 15px;
  text-align: right;
  background: rgba(255,255,255,0.90);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.option-button:hover, .option-button:focus-visible {
  transform: translateY(-2px);
  background: #fff;
  border-color: #8fa3ae;
  box-shadow: 0 7px 18px rgba(65, 82, 93, 0.09);
  outline: none;
}
.option-button.is-selected {
  color: #fff;
  background: linear-gradient(135deg, #435661, #6f818c);
  border-color: #435661;
}
.option-key {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--slate-800);
  font-size: 11px;
  font-weight: 800;
  background: #edf2f4;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.option-button.is-selected .option-key {
  color: #32434d;
  background: #e6edf0;
  border-color: #e6edf0;
}
.text-answer, .notes-answer {
  width: 100%;
  color: var(--ink);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  resize: vertical;
  transition: border 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.text-answer { height: 52px; padding: 0 14px; }
.notes-answer { min-height: 96px; padding: 13px 14px; line-height: 1.7; }
.text-answer:focus, .notes-answer:focus {
  background: #fff;
  border-color: #8198a5;
  box-shadow: 0 0 0 4px rgba(112, 139, 153, 0.10);
}
.stars-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.star-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #c6d1d6;
  font-size: 31px;
  line-height: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.star-button:hover, .star-button:focus-visible, .star-button.is-active {
  color: #7795a5;
  background: #f7fafb;
  border-color: #8ea8b6;
  outline: none;
  transform: translateY(-2px);
}
.notes-label {
  display: block;
  margin-bottom: 7px;
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 700;
}
.optional { color: #8c99a1; font-size: 11px; font-weight: 400; }
.form-message { min-height: 18px; margin: 7px 0 0; color: #9a3d35; font-size: 12px; }
.navigation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.back-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  background: transparent;
}
.back-button:hover, .back-button:focus-visible { color: var(--slate-800); outline: none; }

/* شاشة الشكر */
.success-panel {
  padding: 20px 20px 18px;
  text-align: center;
  background: linear-gradient(145deg, #edf3f5, #fbfcfc);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.success-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  place-items: center;
  color: #fff;
  font-size: 22px;
  background: linear-gradient(135deg, #435661, #71848f);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(54, 71, 82, 0.20);
}
.success-panel h2 { margin: 0 0 6px; font-size: clamp(27px, 3.2vw, 36px); }
.success-panel > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.7; }
.social-card {
  width: min(500px, 100%);
  margin: 14px auto 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(57, 72, 82, 0.07);
}
.social-title {
  margin: 0 0 9px !important;
  color: var(--slate-800) !important;
  font-size: 13px;
  font-weight: 800;
}
.social-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.social-link {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 7px 7px;
  color: var(--slate-900);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  background: #f1f5f6;
  border: 1px solid rgba(68, 88, 100, 0.12);
  border-radius: 11px;
  overflow: hidden;
}
.social-link:hover, .social-link:focus-visible {
  transform: translateY(-1px);
  background: #fff;
  border-color: #93a7b1;
  outline: none;
}
.social-badge {
  display: grid;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  place-items: center;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 8px;
  font-weight: 800;
  background: linear-gradient(135deg, #566c79, #8aa0ac);
  border-radius: 50%;
}
.linktree-button {
  display: flex;
  width: 100%;
  min-height: 39px;
  margin-top: 8px;
  padding: 8px 13px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: #344650;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(135deg, #e7eef1, #f4f7f8);
  border: 1px solid rgba(104, 129, 143, 0.22);
  border-radius: 11px;
}
.linktree-button:hover, .linktree-button:focus-visible { background: #edf3f5; outline: none; }
.secondary-button {
  margin-top: 12px;
  padding: 9px 16px;
  color: var(--slate-800);
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.secondary-button:hover, .secondary-button:focus-visible { background: #fff; border-color: #8fa3ae; outline: none; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  color: #85939b;
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.site-footer p { margin: 0; line-height: 1.55; }
.visitor-count { display: flex; gap: 6px; align-items: center; }
.visitor-count strong { color: var(--slate-800); }
.visitor-dot {
  width: 7px;
  height: 7px;
  background: #718995;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(113, 137, 149, 0.12);
}
.is-hidden { display: none !important; }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* سطح المكتب: يدخل كامل التصميم داخل النافذة بدون بار تمرير */
@media (min-width: 821px) {
  body { display: grid; place-items: center; }
  .page {
    height: min(720px, calc(100dvh - 20px));
    max-height: calc(100dvh - 20px);
  }
  .layout { height: calc(100% - 4px); }
  .visual, .form-side { min-height: 0; }
  .form-stage { overflow: visible; }
}

@media (max-height: 760px) and (min-width: 821px) {
  .page { height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); border-radius: 22px; }
  body { padding: 6px 10px; }
  .visual { padding: 18px 26px 16px; }
  .brand h1 { font-size: 42px; }
  .poster-frame { width: min(220px, 70%); }
  .book { max-height: 280px; }
  .quote { padding: 8px 12px; font-size: 13px; }
  .form-side { padding-top: 17px; padding-bottom: 12px; }
  .form-stage { padding-top: 16px; padding-bottom: 8px; }
  .question-title { font-size: 30px; }
  .question-hint { margin-bottom: 14px; }
  .option-button { min-height: 49px; }
  .navigation-row { margin-top: 15px; }
}

@media (max-width: 820px) {
  body { padding: 0; background: var(--paper); }
  .page { width: 100%; min-height: 100dvh; border-radius: 0; }
  .layout { grid-template-columns: 1fr; }
  .visual { min-height: 440px; padding: 34px 26px; }
  .poster-frame { width: min(270px, 82%); }
  .book { max-height: 350px; }
  .form-side { min-height: 600px; padding: 28px 23px 22px; }
  .form-stage { min-height: 470px; }
}

@media (max-width: 560px) {
  .brand h1 { font-size: 44px; }
  .visual { min-height: 410px; }
  .options-list { grid-template-columns: 1fr; }
  .form-header { align-items: flex-start; }
  .mini-title { max-width: 190px; font-size: 14px; }
  .question-title { font-size: 27px; line-height: 1.4; }
  .question-index, .question-hint, .back-button { font-size: 15px; }
  .option-button { font-size: 16px; }
  .welcome-copy { font-size: 16px; }
  .primary-button, .secondary-button { font-size: 15px; }
  .social-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .social-link { font-size: 13px; }
  .site-footer > p:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
