@font-face {
  font-family: Thmanyah;
  src: url(fonts/thmanyahsans-Regular.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Thmanyah;
  src: url(fonts/thmanyahsans-Bold.woff2) format("woff2");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  scroll-behavior: auto;
  background: var(--bg);
  transition: background .2s;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: Thmanyah, Tahoma, sans-serif;
  font-size: calc(1rem * var(--reader-scale, .86));
  transition: background .2s, color .2s;
}
button, input { font: inherit; }
button { cursor: pointer; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}

.site-header {
  position: static;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 13px max(16px, 5vw);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.brand-mark {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-title { font-size: .78rem; letter-spacing: -.02em; }
.tools { display: flex; gap: 5px; align-items: center; }

.tools .font-reset {
  font-size: .82rem;
  letter-spacing: -.03em;
}

.tools > button {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.font-size-control {
  display: grid;
  grid-template-columns: repeat(2, 36px);
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
}
.font-size-control .font-size-part {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1;
}
.font-size-control .font-size-part + .font-size-part {
  border-right: 1px solid var(--line);
}
.font-size-control .font-size-part:hover,
.font-size-control .font-size-part:focus-visible {
  background: var(--soft);
}

.home, .ritual {
  max-width: 1160px;
  margin: auto;
  padding: clamp(26px, 5vw, 68px) max(16px, 5vw);
}
.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(12px, 3vw, 36px);
  align-items: center;
  min-height: 42vh;
  padding: 6px 0;
}
.hero h1, .ritual-head h1 {
  font-size: clamp(2rem, 5vw, 4.15rem);
  line-height: 1.08;
  letter-spacing: -.045em;
  margin: 16px 0;
}
.hero h1 {
  font-size: clamp(1.85rem, 4.4vw, 3.55rem);
  white-space: nowrap;
}
.hero p {
  font-size: 1em;
  line-height: 1.85;
  max-width: 640px;
}
.hero-copy > p strong { color: var(--accent); display: block; margin-bottom: 5px; }
.hero-art { width: 100%; height: auto; border-radius: 28px; }
.hero-art-simple { max-width: 470px; margin-inline: auto; display: block; }
.hero-art-simple .simple-art-bg { fill: color-mix(in srgb, var(--card) 72%, var(--soft)); stroke: var(--line); stroke-width: 2; }
.hero-art-simple .simple-art-ring { fill: none; stroke: var(--accent); stroke-width: 3; opacity: .72; }
.hero-art-simple .simple-art-beads circle { fill: var(--accent); }
.hero-art-simple .simple-art-mark { fill: none; stroke: var(--text); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }

.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 20%, transparent);
}

.routes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 42px;
}
.route {
  text-align: right;
  border: 2px solid var(--text);
  background: var(--bg);
  padding: 24px;
  border-radius: var(--radius);
  min-height: 215px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.route:hover { transform: translateY(-4px); }
.route-heading { display: flex; align-items: baseline; gap: 11px; }
.route-num {
  color: var(--accent);
  font-family: Tahoma, sans-serif;
  font-size: .9em;
  font-weight: 700;
  letter-spacing: .04em;
}
.route h2 { font-size: 1.52rem; margin: 0; }
.route p { line-height: 1.75; flex: 1; }
.route-start {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding: 9px 13px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--card);
  font-weight: 700;
  transition: gap .2s, background .2s, color .2s;
}
.route:hover .route-start {
  gap: 14px;
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.route-start b { font-family: Tahoma, sans-serif; font-size: 1.25em; line-height: 1; }

.sources-launch { display: flex; justify-content: center; margin-top: 34px; }
.sources-button {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--text);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--accent);
}
.sources-button b { font-family: Tahoma, sans-serif; font-size: 1.1em; }
.sources-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #081116aa;
  backdrop-filter: blur(8px);
}
.sources-dialog {
  width: min(720px, 100%);
  max-height: min(82vh, 720px);
  overflow: hidden;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--text);
  border-radius: 16px;
  box-shadow: 9px 9px 0 var(--accent);
}
.sources-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.sources-dialog-head h2 { margin: 0; font-size: 1.55rem; }
.sources-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 50%;
  font-family: Tahoma, sans-serif;
  font-size: 1.4rem;
  line-height: 1;
}
.sources-table-wrap { overflow: auto; max-height: calc(82vh - 78px); padding: 14px; }
.sources-table { width: 100%; border-collapse: collapse; }
.sources-table th, .sources-table td {
  padding: 15px 13px;
  text-align: right;
  border: 1px solid var(--line);
  line-height: 1.7;
}
.sources-table th { background: var(--soft); }
.sources-table th:first-child, .sources-table td:first-child { width: 58px; text-align: center; font-family: Tahoma, sans-serif; }

.ritual-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.ritual-head h1 { font-size: clamp(1.9rem, 4.5vw, 3.75rem); }
.ritual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 900px;
  gap: 20px;
  margin: 30px auto 0;
}
.stage-content {
  overflow-anchor: none;
  background: var(--card);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stage-copy {
  height: clamp(420px, 48vh, 460px);
  min-height: 0;
  padding: clamp(18px, 3vw, 30px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 96px auto;
  align-content: stretch;
}
.stage-kicker { color: var(--accent); font-weight: 700; font-size: .82em; }
.adhkar-progress {
  margin: 12px 0 18px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 999px;
}
.adhkar-progress > span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width .25s ease;
}
.dhikr-text {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 5px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.dhikr-text p {
  margin: 0;
  font-size: clamp(1.15em, 2.25vw, 1.45em);
  line-height: 2.15;
  text-align: center;
}
.stage-copy:has(.interaction-zone:empty) {
  grid-template-rows: auto auto minmax(0, 1fr) 0 auto;
}
.interaction-zone:empty { min-height: 0; padding: 0; }
.interaction-zone {
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 8px 0 4px;
}
.count-button {
  min-width: 178px;
  min-height: 82px;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 12px 24px;
  border: 2px solid var(--text);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 5px 5px 0 var(--accent);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .08s, box-shadow .08s, background .2s;
}
.count-button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--accent);
}
.count-button.complete { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.count-number {
  direction: ltr;
  font-family: Tahoma, Arial, sans-serif;
  font-size: clamp(1.75rem, 5vw, 2.65rem);
  font-weight: 700;
  line-height: 1;
}
.count-hint { font-size: .8em; opacity: .76; }
.choice-box {
  width: min(470px, 100%);
  text-align: center;
}
.choice-box h3 { margin: 0 0 13px; font-size: 1em; line-height: 1.7; }
.choice-buttons { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); gap: 9px; }
.choice-buttons.two { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
.choice-buttons button {
  min-height: 48px;
  border: 2px solid var(--text);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  font-family: Tahoma, Thmanyah, sans-serif;
  font-weight: 700;
  opacity: 1;
}
.choice-buttons button:hover { border-color: var(--accent); }
.choice-buttons button.choice-accent {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.stage-actions {
  display: grid;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  margin-top: 18px;
}
.stage-actions button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 11px 14px;
}
.stage-actions button:last-child { justify-self: end; }
.stage-actions .finish-button {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 700;
}

.completion-page { min-height: calc(100dvh - 70px); display: grid; place-items: center; }
.completion-card {
  width: min(690px, 100%);
  text-align: center;
  padding: clamp(40px, 8vw, 86px) 24px;
  border: 2px solid var(--text);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.completion-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-family: Tahoma, sans-serif;
  font-size: 2rem;
  font-weight: 700;
}
.completion-card h1 { margin: 0 0 28px; font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 1.45; }
.completion-home { border-radius: 11px; padding: 12px 20px; font-weight: 700; }

@media (max-width: 800px) {
  .site-header { grid-template-columns: auto auto; gap: 10px; padding: 10px 13px; }
  .brand-title { display: inline; font-size: .72rem; }
  .tools { justify-content: flex-end; }
  .tools > button { flex-basis: 34px; width: 34px; height: 34px; }
  .font-size-control { grid-template-columns: repeat(2, 32px); height: 34px; }
  .font-size-control .font-size-part { width: 32px; height: 32px; }
  .home { padding-top: 10px; }
  .ritual { padding-top: 20px; }
  .hero { grid-template-columns: 1fr; gap: 0; text-align: center; min-height: 0; padding: 0; }
  .hero-copy { display: grid; justify-items: center; }
  .hero-visual { order: -1; line-height: 0; margin-block: -10px -8px; }
  .hero-art-simple { width: min(220px, 72%); }
  .hero h1 { font-size: clamp(1.55rem, 7.2vw, 2.25rem); }
  .routes { grid-template-columns: 1fr; margin-top: 32px; }
  .route { min-height: 190px; }
  .ritual-head { align-items: center; }
  .ritual-head h1 { font-size: 2.15rem; }
  .stage-copy {
    height: 420px;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) 94px auto;
  }
  .dhikr-text p { font-size: clamp(1.12em, 4.3vw, 1.34em); }
  .stage-actions { grid-template-columns: repeat(2, 1fr); }
  .stage-actions button:nth-child(2) { display: none; }
  .stage-actions button:last-child { justify-self: stretch; }
  .sources-dialog { box-shadow: 6px 6px 0 var(--accent); }
}

@media (max-width: 390px) {
  .brand-title { max-width: 88px; white-space: normal; line-height: 1.1; }
  .tools { gap: 3px; }
  .tools > button { flex-basis: 31px; width: 31px; height: 31px; font-size: .9rem; }
  .font-size-control { grid-template-columns: repeat(2, 29px); height: 31px; }
  .font-size-control .font-size-part { width: 29px; height: 29px; font-size: .84rem; }
  .choice-buttons { gap: 6px; }
  .choice-buttons button { padding-inline: 7px; }
  .stage-copy { height: 410px; min-height: 0; padding-inline: 18px; }
  .count-button { min-width: 164px; }
}

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