:root {
  --brown-950: #4a3024;
  --brown-900: #5a3a2b;
  --brown-800: #6c4937;
  --brown-700: #805a43;
  --brown-600: #987157;
  --gold: #bc986b;
  --cream: #f6efe4;
  --paper: #fffaf2;
  --ink: #2e2824;
  --muted: #776c64;
  --border: rgba(112, 69, 47, 0.18);
  --shadow: 0 22px 70px rgba(74, 48, 36, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  display: grid;
  min-height: 100svh;
  margin: 0;
  padding: 14px 16px;
  place-items: center;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Tajawal", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(188, 152, 107, 0.2), transparent 33%),
    linear-gradient(145deg, #efe4d5 0%, #faf5ed 48%, #e8d9c7 100%);
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(75, 49, 34, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 49, 34, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page {
  position: relative;
  isolation: isolate;
  width: min(1040px, 100%);
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.page::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.025;
  background-image: url("assets/cover.jpg");
  background-repeat: no-repeat;
  background-position: 7% 50%;
  background-size: contain;
  filter: grayscale(1) sepia(0.35);
  transform: scale(1.02);
}

.ornament {
  height: 6px;
  background: linear-gradient(90deg, var(--brown-900), var(--gold), var(--brown-900));
}

.layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  min-height: 0;
}

.visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 34px;
  overflow: hidden;
  color: white;
  background: linear-gradient(150deg, rgba(74, 48, 36, 0.95), rgba(128, 90, 67, 0.91));
}

.visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.14), transparent 26%),
    linear-gradient(transparent 58%, rgba(50, 31, 23, 0.34));
}

.brand,
.book-wrap,
.quote {
  position: relative;
  z-index: 1;
}

.brand small {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: #ead9c4;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand small::before,
.brand small::after {
  width: 36px;
  height: 1px;
  content: "";
  background: var(--gold);
}

.brand h1 {
  margin: 14px 0 0;
  font-size: clamp(36px, 4.7vw, 62px);
  font-weight: 800;
  line-height: 0.95;
}

.brand h1 span {
  display: block;
  margin-top: 12px;
  color: #e8cba6;
  font-size: 0.54em;
  font-weight: 700;
  text-align: center;
}

.book-wrap {
  display: grid;
  padding: 18px 0 14px;
  place-items: center;
}

.poster-frame {
  position: relative;
  width: min(292px, 78%);
  padding: 5px;
  background: linear-gradient(145deg, #d7b78e 0%, #f2dfc7 42%, #9b765d 100%);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 16px;
  box-shadow:
    0 20px 36px rgba(30, 17, 11, 0.28),
    0 5px 14px rgba(30, 17, 11, 0.18);
}

.poster-frame::before {
  position: absolute;
  inset: 5px;
  z-index: 2;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(86, 58, 43, 0.34);
  border-radius: 11px;
}

.poster-frame::after {
  position: absolute;
  inset: -8px 16px 10px -8px;
  z-index: -1;
  content: "";
  background: rgba(28, 15, 10, 0.18);
  border-radius: 18px;
  filter: blur(10px);
}

.book {
  display: block;
  width: 100%;
  height: auto;
  max-height: 374px;
  object-fit: contain;
  object-position: center;
  background: #eee2d4;
  border-radius: 11px;
}

.quote {
  margin: 0;
  padding: 12px 16px;
  color: #f8efe5;
  font-size: 15px;
  line-height: 1.65;
  background: rgba(255, 255, 255, 0.08);
  border-right: 3px solid var(--gold);
  border-radius: 12px 0 0 12px;
  backdrop-filter: blur(4px);
}

.form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 28px clamp(26px, 4vw, 52px) 20px;
}

.form-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brown-600);
  font-size: 14px;
  font-weight: 800;
}

.mini-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.question-counter {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 13px;
  color: var(--brown-800);
  font-size: 13px;
  font-weight: 800;
  background: rgba(112, 69, 47, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.counter-divider {
  color: var(--gold);
}

.progress-track {
  height: 3px;
  margin: 13px 0 0;
  overflow: hidden;
  background: rgba(112, 69, 47, 0.1);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brown-900), var(--gold));
  transition: width 420ms ease;
}

.form-stage {
  display: grid;
  flex: 1;
  min-height: 480px;
  padding: 34px 0 20px;
  align-items: center;
}

.welcome-panel,
.question-panel,
.success-panel {
  width: 100%;
  animation: panel-in 430ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.welcome-panel h2,
.success-panel h2,
.question-title {
  color: var(--brown-950);
  font-weight: 800;
}

.welcome-panel h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.18;
}

.welcome-copy {
  max-width: 490px;
  margin: 13px 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.primary-button,
.secondary-button,
.back-button,
.option-button,
.star-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 50px;
  padding: 12px 22px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brown-900), var(--brown-700));
  border-radius: 15px;
  box-shadow: 0 12px 28px rgba(108, 73, 55, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(108, 73, 55, 0.25);
  outline: none;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.primary-button.compact {
  min-width: 125px;
  min-height: 46px;
  font-size: 14px;
}

.privacy-note {
  margin: 14px 0 0;
  color: #9a8f87;
  font-size: 11px;
}

.question-index {
  margin-bottom: 10px;
  color: var(--brown-600);
  font-size: 12px;
  font-weight: 800;
}

.question-title {
  max-width: 600px;
  margin: 0;
  font-size: clamp(27px, 3.5vw, 39px);
  line-height: 1.28;
}

.question-hint {
  margin: 9px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.options-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.option-button {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  color: var(--ink);
  text-align: right;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 180ms ease, border 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.option-button:hover,
.option-button:focus-visible {
  transform: translateY(-2px);
  background: white;
  border-color: var(--brown-600);
  box-shadow: 0 8px 20px rgba(108, 73, 55, 0.1);
  outline: none;
}

.option-button.is-selected {
  color: white;
  background: linear-gradient(135deg, var(--brown-900), var(--brown-700));
  border-color: var(--brown-900);
}

.option-key {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--brown-800);
  font-size: 11px;
  font-weight: 800;
  background: rgba(112, 69, 47, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.option-button.is-selected .option-key {
  color: var(--brown-950);
  background: #e8cba6;
  border-color: #e8cba6;
}

.text-answer,
.notes-answer {
  width: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  resize: vertical;
  transition: border 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.text-answer {
  height: 54px;
  padding: 0 15px;
}

.notes-answer {
  min-height: 105px;
  padding: 14px 15px;
  line-height: 1.7;
}

.text-answer:focus,
.notes-answer:focus {
  background: white;
  border-color: var(--brown-600);
  box-shadow: 0 0 0 4px rgba(138, 91, 61, 0.1);
}

.stars-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 20px;
}

.star-button {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: rgba(188, 152, 107, 0.34);
  font-size: 34px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: transform 160ms ease, color 160ms ease, border 160ms ease, background 160ms ease;
}

.star-button:hover,
.star-button:focus-visible,
.star-button.is-active {
  color: var(--gold);
  background: #fffdf9;
  border-color: var(--gold);
  outline: none;
  transform: translateY(-2px);
}

.notes-label {
  display: block;
  margin-bottom: 8px;
  color: var(--brown-900);
  font-size: 13px;
  font-weight: 700;
}

.optional {
  color: #9a8f87;
  font-size: 11px;
  font-weight: 400;
}

.form-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: #942f21;
  font-size: 12px;
}

.navigation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
}

.back-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
  background: transparent;
}

.back-button:hover,
.back-button:focus-visible {
  color: var(--brown-800);
  outline: none;
}

.success-panel {
  padding: 34px 30px;
  text-align: center;
  background: linear-gradient(145deg, #f2e4d1, #fbf5ec);
  border: 1px solid var(--border);
  border-radius: 22px;
}

.success-mark {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  place-items: center;
  color: white;
  font-size: 25px;
  background: linear-gradient(135deg, var(--brown-900), var(--brown-700));
  border-radius: 50%;
  box-shadow: 0 12px 25px rgba(108, 73, 55, 0.22);
}

.success-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 40px);
}

.success-panel > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.secondary-button {
  margin-top: 18px;
  padding: 11px 18px;
  color: var(--brown-800);
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: white;
  border-color: var(--brown-600);
  outline: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 13px;
  color: #9a8f87;
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

.visitor-count {
  display: flex;
  gap: 6px;
  align-items: center;
}

.visitor-count strong {
  color: var(--brown-800);
}

.visitor-dot {
  width: 7px;
  height: 7px;
  background: #8f7357;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(143, 115, 87, 0.11);
}

.is-hidden {
  display: none !important;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 821px) {
  .page {
    height: min(740px, calc(100svh - 28px));
    max-height: calc(100svh - 28px);
  }

  .layout {
    height: calc(100% - 6px);
  }

  .visual,
  .form-side {
    min-height: 0;
  }

  .book-wrap {
    padding: 10px 0 8px;
  }
}

@media (max-width: 820px) {
  body {
    padding: 0;
    background: var(--paper);
  }

  .page {
    min-height: 100svh;
    border-radius: 0;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .visual {
    min-height: 460px;
    padding: 38px 28px;
  }

  .poster-frame {
    width: min(286px, 86%);
  }

  .book {
    max-height: 370px;
  }

  .form-side {
    min-height: 640px;
    padding: 30px 24px 24px;
  }

  .form-stage {
    min-height: 500px;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 46px;
  }

  .visual {
    min-height: 430px;
  }

  .options-list {
    grid-template-columns: 1fr;
  }

  .form-header {
    align-items: flex-start;
  }

  .mini-title {
    max-width: 180px;
  }

  .site-footer > p:last-child {
    display: none;
  }
}

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

/* =========================================================
   تحسين وضوح النصوص الثانوية
   ========================================================= */

/* كلمة: السؤال ١ */
.question-index {
    font-size: 17px !important;
    font-weight: 700 !important;
}

/* اختر الإجابة الأقرب لك / اختر إجابة واحدة */
.question-hint {
    font-size: 17px !important;
    line-height: 1.8 !important;
    font-weight: 500 !important;
}

/* زر السابق */
.back-button {
    font-size: 17px !important;
    font-weight: 600 !important;
}

/* عدد الزيارات */
.visitor-count {
    font-size: 16px !important;
    font-weight: 500 !important;
}

/* اسم نضال حسين آل مسيري أسفل الصفحة */
.site-footer p {
    font-size: 16px !important;
    line-height: 1.7 !important;
}

/* للجوال */
@media (max-width: 700px) {
    .question-index {
        font-size: 16px !important;
    }

    .question-hint {
        font-size: 16px !important;
    }

    .back-button {
        font-size: 16px !important;
    }

    .visitor-count,
    .site-footer p {
        font-size: 15px !important;
    }
}


/* تكبير عنوان رأس نموذج التقييم */
.form-header .eyebrow {
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.6 !important;
}

.form-header .mini-title {
    font-size: 17px !important;
    font-weight: 500 !important;
    line-height: 1.8 !important;
}

/* للجوال */
@media (max-width: 700px) {
    .form-header .eyebrow {
        font-size: 17px !important;
    }

    .form-header .mini-title {
        font-size: 16px !important;
    }
}


/* =========================================================
   MOBILE TYPOGRAPHY — تحسين القراءة على الجوال
   ========================================================= */

@media (max-width: 700px) {

    /* عنوان السؤال الرئيسي */
    .question-title {
        font-size: 28px !important;
        line-height: 1.45 !important;
        font-weight: 800 !important;
    }

    /* السؤال 1 */
    .question-index {
        font-size: 18px !important;
        font-weight: 700 !important;
    }

    /* اختر الإجابة الأقرب / اختر إجابة واحدة */
    .question-hint {
        font-size: 17px !important;
        line-height: 1.8 !important;
    }

    /* خيارات الإجابة */
    .option-button {
        font-size: 18px !important;
        line-height: 1.6 !important;
    }

    /* السابق */
    .back-button {
        font-size: 17px !important;
        font-weight: 600 !important;
    }

    /* الأزرار الرئيسية */
    .primary-button,
    .secondary-button {
        font-size: 17px !important;
    }

    /* رأي القارئ */
    .form-header .eyebrow {
        font-size: 18px !important;
        font-weight: 800 !important;
    }

    /* اسم الكتاب */
    .form-header .mini-title {
        font-size: 17px !important;
        line-height: 1.7 !important;
    }

    /* شاشة البداية */
    .welcome-panel h2 {
        font-size: 27px !important;
        line-height: 1.45 !important;
    }

    .welcome-copy {
        font-size: 17px !important;
        line-height: 1.9 !important;
    }

    .privacy-note {
        font-size: 15px !important;
    }

    /* عداد الأسئلة */
    .question-counter {
        font-size: 17px !important;
    }

    /* الفوتر */
    .visitor-count,
    .site-footer p {
        font-size: 16px !important;
        line-height: 1.7 !important;
    }
}

