/* Mushaf reader spike. Same palette as Quran Radio. */
:root {
  --bg: #F6F1E7; --paper: #FFFCF4; --ink: #1B1B18; --muted: #66716C; --line: #E4D9C3;
  --primary: #0F5C4D; --gold: #B08236; --gold-soft: #E9D9B4; --hl: rgba(212, 168, 85, .32);
  --shadow: 0 1px 2px rgba(30, 43, 39, .06), 0 8px 24px rgba(30, 43, 39, .08);
  --ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1714; --paper: #10201C; --ink: #EFE8D8; --muted: #97A7A0; --line: #213833;
    --primary: #3FA58C; --gold: #D4A855; --gold-soft: #4A3F27; --hl: rgba(212, 168, 85, .28);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-btn { width: 44px; height: 44px; border-radius: 50%; font-size: 30px; line-height: 1; color: var(--primary); display: grid; place-items: center; }
.bar-btn:active { background: var(--gold-soft); }
.bar-mid { flex: 1; text-align: center; min-width: 0; }
.bar-surah { display: block; font-family: "Amiri Quran", serif; font-size: 19px; color: var(--primary); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-meta { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }

.page {
  max-width: 560px; margin: 12px auto 0; padding: 0 12px;
}
.sheet-paper {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px 12px 10px;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.lines { display: flex; flex-direction: column; }
.lines.center { min-height: 60vh; justify-content: center; }
.line { display: flex; justify-content: space-between; align-items: center; white-space: nowrap; height: var(--lh); }
.line.center { justify-content: center; }
.w { font-size: var(--fs); line-height: 1; color: var(--ink); border-radius: 6px; padding: 0 1px; }
.w.hl { background: var(--hl); }
.w.pending { opacity: .35; }
.header {
  height: var(--lh); display: flex; align-items: center; justify-content: center; position: relative;
  border: 1.5px solid var(--gold); border-radius: 8px; margin: 2px 0;
  background: linear-gradient(90deg, transparent, var(--gold-soft) 30%, var(--gold-soft) 70%, transparent);
  font-family: "Amiri Quran", serif; font-size: calc(var(--fs) * .78); color: var(--primary);
}
.header::before, .header::after { content: "۞"; position: absolute; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: calc(var(--fs) * .6); }
.header::before { right: 10px; } .header::after { left: 10px; }
.bismillah { height: var(--lh); display: flex; align-items: center; justify-content: center; font-family: "Amiri Quran", serif; font-size: calc(var(--fs) * .82); }
.page-no { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.loading { text-align: center; color: var(--muted); padding: 30vh 0; }

.credit { max-width: 560px; margin: 18px auto 28px; padding: 0 16px; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.6; }
.credit a { color: inherit; }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 19, 15, .4); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 82vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0; }
.sheet-title { margin: 2px 0 10px; font-size: 19px; }
.ayah-preview { font-family: "Amiri Quran", serif; font-size: 22px; line-height: 2; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; margin-bottom: 12px; max-height: 30vh; overflow-y: auto; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); text-align: left; font-weight: 600; }
.opt:active { background: var(--gold-soft); }
.opt:disabled { opacity: .55; cursor: default; }
.opt small { margin-left: auto; font-weight: 600; font-size: 11.5px; color: var(--muted); background: var(--bg); border-radius: 99px; padding: 2px 8px; }
.opt-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); flex: none; font-size: 16px; }
.field { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 0 12px; font: 16px var(--ui); margin-bottom: 10px; }
.btn { width: 100%; height: 48px; border-radius: 99px; background: var(--primary); color: #fff; font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; }
