:root {
  --bg: #f4f6f9;
  --bg-accent: #e8eef5;
  --panel: #ffffff;
  --accent: #b8860b;
  --accent-bright: #d4a017;
  --text: #1a2332;
  --muted: #5c6b7e;
  --line: rgba(26, 35, 50, 0.12);
  --shadow: 0 4px 24px rgba(26, 35, 50, 0.06);
  --input-bg: #f8fafc;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(165deg, var(--bg-accent) 0%, var(--bg) 45%, #fafbfc 100%);
  color: var(--text);
  min-height: 100vh;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  outline: 2px solid var(--accent-bright);
}
.hero-eyebrow {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-eyebrow a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.hero-eyebrow a:hover { text-decoration: underline; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.45rem, 2.8vw, 1.85rem);
  line-height: 1.25;
  color: var(--text);
  max-width: 52rem;
}
.hero-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
  max-width: 52rem;
}
.hero strong { color: var(--text); font-weight: 600; }
.grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .grid {
    align-items: start;
  }
  .preview-panel {
    position: sticky;
    top: 24px;
    align-self: start;
    overflow: visible;
  }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 16px; font-size: 1.1rem; color: var(--text); }
label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: var(--muted); font-weight: 500; }
select, input[type="number"], input[type="text"], input[type="file"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
}
select:focus, input:focus {
  outline: 2px solid rgba(212, 160, 23, 0.35);
  outline-offset: 1px;
}
input[type="file"] {
  padding: 8px;
  font-size: 0.85rem;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ayah-range-wrap { margin-bottom: 8px; }
@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
}
.hint { font-size: 0.8rem; color: var(--muted); margin: -6px 0 12px; }
.bg-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
}
.bg-picker-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 6px;
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.bg-picker-legend-text {
  flex: 1;
  min-width: 0;
}
.bg-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
@media (max-width: 520px) {
  .bg-picker-legend {
    flex-wrap: wrap;
  }
  .bg-picker-toolbar {
    width: 100%;
    justify-content: flex-end;
  }
}
.bg-picker-hint { margin-top: 0; }
.bg-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
}
@media (max-width: 520px) {
  .bg-grid { grid-template-columns: repeat(3, 1fr); }
}
.bg-tile {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: #111;
  box-shadow: 0 2px 8px rgba(26, 35, 50, 0.08);
}
.bg-tile:hover { border-color: rgba(212, 160, 23, 0.45); }
.bg-tile.is-selected {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.25);
}
.bg-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  background: #1a1a1a;
}
.bg-tile.bg-tile--error::after {
  content: 'Preview unavailable';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  background: #222;
}
.bg-tile span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 4px 5px;
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  line-height: 1.2;
}
.bg-load-more {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.bg-page-info {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.bg-page-info:empty {
  display: none;
}
.bg-upload-label { margin-bottom: 6px; }
#bg-selected-label { margin: 0 0 10px; font-weight: 500; color: var(--text); }
.hint code {
  background: var(--bg-accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}
.btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.btn.primary {
  background: linear-gradient(135deg, #e8c547, #c9a227);
  color: #1a1200;
  box-shadow: 0 2px 8px rgba(180, 140, 30, 0.25);
}
.btn.primary:hover { filter: brightness(1.03); }
.btn.secondary {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn.secondary:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.generate-block {
  margin-top: 10px;
}
.generate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a1200;
  background: linear-gradient(135deg, #e8c547 0%, #c9a227 55%, #d4a017 100%);
  box-shadow: 0 4px 14px rgba(180, 140, 30, 0.35);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.generate-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.generate-btn:disabled {
  cursor: wait;
  opacity: 0.92;
  transform: none;
}
.generate-btn.is-generating {
  background: linear-gradient(135deg, #d4c06a 0%, #b8921f 100%);
}
.generate-btn__icon {
  font-size: 1.15rem;
  line-height: 1;
}
.generate-btn__label {
  line-height: 1.25;
  text-align: center;
}
.generate-progress {
  margin-top: 10px;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  overflow: hidden;
}
.generate-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c9a227, #e8c547);
  transition: width 0.45s ease;
}
.generate-status {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}
.generate-status.is-error {
  border-color: rgba(231, 76, 60, 0.35);
  background: #fff5f5;
}
.generate-status.is-success {
  border-color: rgba(13, 148, 136, 0.35);
  background: #f0fdf9;
}
.download {
  margin-top: 10px;
}
.download a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: #1a1200;
  background: linear-gradient(135deg, #5eead4, #0d9488);
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.25);
}
.download a:hover {
  filter: brightness(1.05);
  color: #0a3d36;
}
.phone {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #0a0a0a;
  box-shadow: 0 8px 32px rgba(26, 35, 50, 0.15);
  container-type: inline-size;
}
.phone video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}
.reel-layer--verse.verse-animate .reel-verse {
  animation: verseFadeInUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes verseFadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.reel-verse .reel-kw {
  transition: color 0.08s ease;
}
.audio { width: 100%; margin-top: 14px; }

.seo-content {
  margin-top: 28px;
}
.seo-content h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  color: var(--text);
}
.seo-content h3 {
  margin: 22px 0 10px;
  font-size: 1rem;
  color: var(--text);
}
.seo-content > p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
}
.seo-list {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
}
.seo-list--ordered { padding-left: 1.35rem; }
.seo-list li { margin-bottom: 6px; }
.faq-list { margin-top: 8px; }
.faq-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 0 14px;
  background: var(--input-bg);
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 0;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-q {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.faq-a {
  margin: 0 0 14px;
  padding-top: 4px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}
.site-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}
.site-footer a {
  color: var(--accent);
  font-weight: 500;
}
.site-footer a:hover { color: var(--accent-bright); }
.noscript {
  max-width: 1100px;
  margin: 16px auto;
  padding: 12px 16px;
  background: #fff3cd;
  color: #5c4a00;
  border-radius: 8px;
  text-align: center;
}
