:root {
  --bg: #07271d;
  --bg-2: #0c3a2a;
  --card: #103f2e;
  --card-active: #1b6b48;
  --gold: #ffd874;
  --green: #2fd27f;
  --text: #ffffff;
  --muted: #d4e6da;
  --line: rgba(255, 255, 255, 0.14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 20px; line-height: 1.4;
  height: 100%;
}

/* ===================== HOME ===================== */
#home { padding-bottom: 24px; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-2); border-bottom: 2px solid var(--line); padding: 14px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: #06281d; background: var(--gold); }
.brand-text h1 { margin: 0; font-size: 28px; font-weight: 800; }

.ghost-btn { background: transparent; border: 2px solid var(--gold); color: var(--gold); padding: 10px 16px; border-radius: 12px; font-family: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.ghost-btn.small { padding: 8px 12px; border-color: var(--line); color: var(--text); }
.primary-btn { background: var(--green); color: #06281d; border: none; padding: 13px 20px; border-radius: 12px; font-family: inherit; font-weight: 800; font-size: 20px; cursor: pointer; }

.resume-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card-active); border-bottom: 2px solid var(--line); padding: 14px 16px; flex-wrap: wrap; }
.resume-label { color: var(--gold); font-size: 17px; font-weight: 800; display: block; }
.resume-info strong { font-size: 25px; font-weight: 800; }
.resume-meta { color: var(--muted); font-size: 17px; }
.resume-actions { display: flex; align-items: center; gap: 8px; }

.toolbar { display: flex; gap: 10px; padding: 12px 16px; }
.search-wrap { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 0 16px; }
.search-wrap svg { width: 24px; height: 24px; color: var(--muted); flex-shrink: 0; }
.search-wrap input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 22px; font-weight: 600; padding: 14px 0; }
.search-wrap input::placeholder { color: var(--muted); font-weight: 500; }
.reciter-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 2px solid var(--gold); color: var(--gold); padding: 12px 16px; border-radius: 14px; font-family: inherit; font-weight: 800; font-size: 19px; cursor: pointer; white-space: nowrap; }

.surah-list { display: flex; flex-direction: column; gap: 6px; padding: 6px 16px; }
.surah-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--card); border: 2px solid transparent; border-radius: 14px; cursor: pointer; }
.surah-card:active { background: var(--card-active); }
.surah-num { flex-shrink: 0; min-width: 46px; height: 46px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.10); color: var(--gold); font-size: 22px; font-weight: 800; }
.surah-info { flex: 1; min-width: 0; }
.surah-name { font-size: 30px; font-weight: 800; line-height: 1.25; }
.surah-sub { color: var(--muted); font-size: 18px; font-weight: 600; }
.open-icon { width: 52px; height: 52px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #06281d; }
.open-icon svg { width: 30px; height: 30px; }

.juz-banner { display: flex; align-items: center; gap: 12px; margin: 8px 0 2px; padding: 10px 16px; background: var(--bg-2); border: 2px solid var(--gold); border-radius: 12px; }
.juz-banner .jb-num { background: var(--gold); color: #06281d; font-size: 22px; font-weight: 800; border-radius: 8px; padding: 4px 12px; flex-shrink: 0; }
.juz-banner .jb-name { color: var(--gold); font-size: 24px; font-weight: 800; }

.page-footer { text-align: center; color: var(--muted); font-size: 16px; padding: 18px 16px; }

/* ===================== READER ===================== */
.reader { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }

.reader-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; background: var(--bg-2); border-bottom: 2px solid var(--gold);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.rh-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border: none; color: var(--text); border-radius: 12px; padding: 12px 16px; font-family: inherit; font-size: 19px; font-weight: 800; cursor: pointer; }
.rh-btn svg { width: 26px; height: 26px; }
.rh-btn#rReciter { border: 2px solid var(--gold); color: var(--gold); background: transparent; max-width: 42vw; overflow: hidden; }
.rh-btn#rReciter span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-title { text-align: center; min-width: 0; flex: 1; }
.rh-title strong { display: block; font-size: 24px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-pos { color: var(--gold); font-size: 18px; font-weight: 800; }

.reader-body { flex: 1; overflow-y: auto; padding: 18px 16px 28px; -webkit-overflow-scrolling: touch; }
.reader-status { text-align: center; color: var(--muted); font-size: 24px; padding: 50px 16px; }

/* Surah title: plain, thick, clear (not decorative) */
.reader-surah-title { text-align: center; font-family: "Cairo", sans-serif; font-size: 30px; font-weight: 900; color: var(--gold); padding: 6px 0 14px; }
.basmala { text-align: center; font-family: "Scheherazade New", serif; color: var(--gold); font-size: clamp(34px, 9vw, 46px); font-weight: 700; line-height: 1.9; padding: 8px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }

/* Ayah text: very large by default, clear Naskh, bold */
.ayah {
  font-family: "Scheherazade New", serif;
  font-size: clamp(38px, 10vw, 52px);
  font-weight: 700;
  line-height: 2.05;
  text-align: justify;
  color: var(--text);
  padding: 16px 16px; margin: 10px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ayah-no {
  display: inline-grid; place-items: center;
  min-width: 1.5em; height: 1.5em; padding: 0 .25em;
  margin: 0 8px;
  border: 3px solid var(--gold); color: var(--gold); border-radius: 50%;
  font-family: "Cairo", sans-serif; font-size: .5em; font-weight: 800;
  vertical-align: middle;
}
.ayah.active {
  background: var(--card-active);
  color: #fff;
  outline: 4px solid var(--gold);
  font-size: clamp(42px, 11vw, 58px);
}
.ayah.active .ayah-no { background: var(--gold); color: #06281d; }

/* Controls: big, clear, labeled */
.reader-controls {
  background: var(--bg-2); border-top: 3px solid var(--gold);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; justify-content: center; gap: 10px;
}
.rc-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 78px; padding: 10px 8px; border-radius: 16px;
  border: none; background: rgba(255,255,255,.12); color: var(--text); cursor: pointer;
  font-family: inherit;
}
.rc-btn svg { width: 36px; height: 36px; }
.rc-lbl { font-size: 16px; font-weight: 800; }
.rc-play { background: var(--gold); color: #06281d; min-width: 110px; padding: 14px 8px; }
.rc-play svg { width: 46px; height: 46px; }
.rc-play .rc-lbl { font-size: 19px; }
.rc-small.on { background: var(--green); color: #06281d; }

/* ===================== RECITER SHEET ===================== */
.sheet-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--bg-2); border-top: 3px solid var(--gold); border-radius: 20px 20px 0 0; max-height: 82vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 2px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 26px; font-weight: 800; }
.reciter-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.reciter-item { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; }
.reciter-item.selected { background: var(--card-active); border-color: var(--gold); }
.reciter-item .ri-name { font-weight: 800; font-size: 24px; }
.reciter-item .ri-check { margin-inline-start: auto; color: var(--gold); font-size: 30px; font-weight: 800; }

@media (max-width: 560px) {
  .brand-text h1 { font-size: 24px; }
  .surah-name { font-size: 27px; }
  .rc-btn { width: 54px; height: 54px; }
  .rc-play { width: 76px; height: 76px; }
}
