:root {
  --gold: #d9b515;
  --gold-dark: #7a6000;
  --ink: #17150d;
  --muted: #6d6756;
  --paper: #fffdf5;
  --line: #e7dfc4;
  --green: #276749;
  --green-soft: #e7f5ec;
  --gray-soft: #f0eee6;
  --danger: #9d2929;
  --shadow: 0 16px 50px rgba(37, 31, 10, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Tahoma, Arial, "Noto Sans Arabic", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; inset: 8px auto auto 8px; transform: translateY(-150%); z-index: 100; background: #fff; padding: 8px 12px; }
.skip-link:focus { transform: none; }

.hero {
  min-height: 72svh;
  display: grid;
  grid-template-columns: minmax(300px, 42%) 1fr;
  background: #efd31e;
  overflow: hidden;
}
.hero-image-wrap { min-height: 520px; background: #e0c318; }
.hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.hero-content { padding: clamp(42px, 8vw, 120px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.eyebrow { margin: 0 0 8px; color: var(--gold-dark); font-weight: 800; letter-spacing: .05em; }
.hero h1 { font-size: clamp(2.15rem, 5.5vw, 5.2rem); line-height: 1.18; margin: 0 0 20px; max-width: 900px; }
.hero p:not(.eyebrow) { font-size: clamp(1rem, 2vw, 1.3rem); max-width: 650px; margin: 0 0 28px; }

.button {
  min-height: 50px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 11px 20px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .65; cursor: wait; transform: none; }
.button.primary { color: #fff; background: #17150d; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.button.secondary { background: #fff; border-color: var(--line); }
.button.success { color: #fff; background: var(--green); }
.button.full { width: 100%; }

.status-card, .parts-section, .how-section { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.status-card {
  margin-top: -42px;
  position: relative;
  background: #fff;
  border: 1px solid rgba(122, 96, 0, .2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 42px);
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 28px;
  align-items: center;
}
.status-card h2, .parts-section h2, .how-section h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.5rem); }
.progress-label { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 9px; font-weight: 700; }
.progress { height: 13px; background: #eee9d7; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.mini-stats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px 28px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
.mini-stats strong { color: var(--ink); }

.parts-section { padding-block: 82px 48px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .93rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.available { background: var(--gold); }
.dot.reserved { background: #aaa48f; }
.dot.completed { background: var(--green); }
.parts-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; }
.part-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
button.part-card { cursor: pointer; }
button.part-card:hover { border-color: var(--gold-dark); box-shadow: 0 10px 28px rgba(75, 58, 0, .12); transform: translateY(-2px); }
.part-card small { color: var(--muted); }
.part-card strong { font-size: 2.1rem; line-height: 1.1; }
.part-card span { font-size: .86rem; margin-top: 6px; font-weight: 700; }
.part-card.available { background: linear-gradient(145deg, #fff, #fff9d8); border-color: #dfca62; }
.part-card.reserved { background: var(--gray-soft); color: #777264; }
.part-card.completed { background: var(--green-soft); color: var(--green); border-color: #a8d5b9; }

.how-section { padding-block: 30px 90px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.how-grid article { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 25px; }
.how-grid b { width: 39px; height: 39px; display: grid; place-items: center; background: var(--gold); border-radius: 50%; }
.how-grid h3 { margin: 15px 0 2px; }
.how-grid p { margin: 0; color: var(--muted); }

.reserve-dialog { width: min(520px, calc(100% - 24px)); border: 0; border-radius: 24px; padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.32); }
.reserve-dialog::backdrop { background: rgba(18, 15, 5, .7); backdrop-filter: blur(4px); }
.reserve-dialog form { padding: 30px; position: relative; }
.reserve-dialog h2 { margin: 0 0 20px; font-size: 2rem; }
.dialog-close { position: absolute; left: 14px; top: 10px; border: 0; background: transparent; font-size: 2rem; cursor: pointer; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.choice-row label { padding: 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.field { display: grid; gap: 7px; font-weight: 700; }
.field input { min-height: 50px; border: 1px solid #cfc7aa; border-radius: 12px; padding: 9px 12px; background: #fff; }
.confirm-check { display: flex; gap: 10px; align-items: flex-start; margin-block: 20px; color: var(--muted); }
.confirm-check input { margin-top: 6px; width: 18px; height: 18px; flex: none; }
.form-message { min-height: 24px; color: var(--danger); font-weight: 700; }

.narrow-page { min-height: 80svh; width: min(680px, calc(100% - 28px)); margin: 0 auto; padding-block: 34px 70px; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--muted); text-decoration: none; font-weight: 700; }
.confirmation-card { background: #fff; border: 1px solid var(--line); border-radius: 25px; box-shadow: var(--shadow); padding: clamp(24px, 6vw, 50px); text-align: center; }
.confirmation-card h1 { font-size: clamp(2.4rem, 8vw, 4.6rem); margin: 0; }
.confirmation-card > p { color: var(--muted); }
.confirmation-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--gold); font-size: 2rem; font-weight: 900; }
.reservation-code { margin: 24px 0; padding: 18px; background: #fff9dd; border: 1px dashed #bc9e13; border-radius: 16px; display: grid; gap: 3px; }
.reservation-code strong { direction: ltr; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(1.25rem, 5vw, 2rem); letter-spacing: .08em; }
.text-button, .danger-link { border: 0; background: none; cursor: pointer; text-decoration: underline; font-weight: 700; }
.text-button { color: var(--gold-dark); }
.danger-link { color: var(--danger); padding: 12px; }
.privacy-note { font-size: .9rem; }
.action-stack, .reservation-controls { display: grid; gap: 12px; margin-top: 22px; }
.done-banner { margin-top: 22px; padding: 15px; background: var(--green-soft); color: var(--green); border-radius: 13px; font-weight: 800; }
.error-card { margin-top: 10vh; }

.reader-header { position: sticky; top: 0; z-index: 20; min-height: 72px; background: rgba(255,253,245,.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 10px max(14px, env(safe-area-inset-right)); }
.reader-header .back-link { margin: 0; }
.reader-header div { text-align: center; }
.reader-header p, .reader-header h1 { margin: 0; line-height: 1.2; }
.reader-header p { color: var(--muted); font-size: .8rem; }
.reader-header h1 { font-size: 1.2rem; }
.reader-control { justify-self: end; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.reader-page { width: min(900px, calc(100% - 26px)); margin: 0 auto; padding: 28px 0 75px; }
.surah-block { margin-bottom: 30px; }
.surah-title { text-align: center; padding: 14px; margin-bottom: 16px; background: linear-gradient(90deg, transparent, #f1df81, transparent); }
.surah-title span, .surah-title h2 { display: inline; margin: 0; }
.surah-title h2 { font-size: 1.55rem; }
.quran-text { font-family: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif; font-size: clamp(1.65rem, 4vw, 2.25rem); line-height: 2.15; text-align: justify; }
html[data-reader-size="large"] .quran-text { font-size: clamp(1.9rem, 5vw, 2.65rem); }
html[data-reader-size="xlarge"] .quran-text { font-size: clamp(2.2rem, 6vw, 3.05rem); }
.ayah { display: inline; }
.ayah-number { display: inline-grid; place-items: center; min-width: 1.75em; height: 1.75em; margin-inline: .15em; border: 1px solid #b69209; border-radius: 50%; color: #6c5600; font-family: Tahoma, Arial, sans-serif; font-size: .48em; vertical-align: middle; }
.reader-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 40px; }
.source-note { color: var(--muted); text-align: center; font-size: .82rem; margin-top: 28px; }

.site-footer { padding: 28px 16px; text-align: center; background: #17150d; color: #fff; }
.site-footer p { margin: 0 0 5px; }
.site-footer small { color: #c8c2ad; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-image-wrap { min-height: 56svh; max-height: 680px; }
  .hero-content { padding: 34px 20px 82px; }
  .status-card { grid-template-columns: 1fr; margin-top: -42px; }
  .mini-stats { grid-column: auto; }
  .parts-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  .hero-image-wrap { min-height: 58svh; }
  .hero h1 { font-size: 2.15rem; }
  .status-card, .parts-section, .how-section { width: min(100% - 20px, 1180px); }
  .status-card { padding: 20px; }
  .section-heading { align-items: start; flex-direction: column; }
  .parts-section { padding-top: 60px; }
  .parts-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .part-card { min-height: 105px; border-radius: 14px; padding: 8px; }
  .part-card strong { font-size: 1.65rem; }
  .part-card span { font-size: .75rem; }
  .how-grid { grid-template-columns: 1fr; }
  .reserve-dialog form { padding: 25px 18px; }
  .choice-row { grid-template-columns: 1fr; }
  .reader-header { grid-template-columns: auto 1fr auto; }
  .reader-page { width: min(100% - 20px, 900px); }
  .quran-text { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
