@font-face {
  font-family: 'Amiri Quran';
  src: url('fonts/AmiriQuran.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Amiri';
  src: url('fonts/Amiri-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Amiri';
  src: url('fonts/Amiri-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #071f18;
  --bg2: #0b3d2e;
  --card: #0e3529;
  --gold: #d4af37;
  --gold-soft: #e8cf7a;
  --gold-dim: #9a7f2a;
  --ink: #f5efdd;
  --ink-dim: #b9c4b5;
  --line: rgba(212,175,55,.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #114a38 0%, transparent 60%),
              linear-gradient(180deg, #08281e 0%, var(--bg) 100%);
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'Amiri', serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

#appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(7,31,24,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#appbar-title { font-size: 22px; font-weight: 700; color: var(--gold-soft); flex: 1; text-align: center; }
.iconbtn {
  background: none; border: 1px solid var(--line); color: var(--gold-soft);
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.pillbtn {
  background: linear-gradient(135deg, var(--gold), #b8912e);
  color: #1d1503; border: none; border-radius: 999px;
  padding: 8px 14px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
}

main { max-width: 760px; margin: 0 auto; padding: 14px; }

#hero { text-align: center; padding: 26px 10px 18px; }
.hero-orn { color: var(--gold); font-size: 26px; letter-spacing: 6px; }
#hero h1 { font-size: 34px; color: var(--gold-soft); margin: 8px 0 6px; }
#hero .sub { color: var(--ink-dim); font-size: 15px; line-height: 1.8; max-width: 420px; margin: 0 auto; }

.card {
  background: linear-gradient(160deg, var(--card), #0a2a20);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 12px 0;
}
#resume-card { cursor: pointer; display: flex; align-items: center; gap: 12px; }
#resume-card .rc-label { font-size: 13px; color: var(--ink-dim); }
#resume-card .rc-surah { font-size: 20px; color: var(--gold-soft); font-weight: 700; }
#resume-card .rc-go { margin-inline-start: auto; color: var(--gold); font-size: 22px; }

.searchbox input {
  width: 100%; padding: 12px 16px; font-size: 17px; font-family: inherit;
  background: #0a2a20; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; outline: none;
}
.searchbox input:focus { border-color: var(--gold); }

#reciter-home { display: flex; align-items: center; gap: 10px; cursor: pointer; }
#reciter-home .rh-label { color: var(--ink-dim); font-size: 13px; }
#reciter-home .rh-name { color: var(--gold-soft); font-size: 17px; font-weight: 700; }
#reciter-home .rh-change { margin-inline-start: auto; color: var(--gold); font-size: 13px; }

.surah-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; cursor: pointer;
  border-bottom: 1px solid rgba(212,175,55,.12);
}
.surah-row:active { background: rgba(212,175,55,.08); }
.surah-num {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: var(--gold); font-size: 15px;
  background:
    linear-gradient(45deg, transparent 46%, var(--line) 46%, var(--line) 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, var(--line) 46%, var(--line) 54%, transparent 54%);
  border: 1px solid var(--line);
  transform: rotate(45deg); border-radius: 6px;
}
.surah-num span { transform: rotate(-45deg); }
.surah-mid { flex: 1; }
.surah-name { font-size: 20px; color: var(--ink); font-weight: 700; }
.surah-meta { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
.surah-dl { color: var(--gold); font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }

#read-progress {
  position: fixed; top: 0; right: 0; left: 0; height: 3px; z-index: 30;
  background: rgba(212,175,55,.15);
}
#read-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .3s; }

#surah-head { text-align: center; margin: 18px 0 6px; }
#surah-title-frame {
  display: inline-block; padding: 10px 42px;
  border: 2px solid var(--gold);
  border-radius: 4px;
  position: relative;
  background: linear-gradient(160deg, #0e3529, #08281e);
  box-shadow: 0 0 24px rgba(212,175,55,.12) inset;
}
#surah-title-frame::before, #surah-title-frame::after {
  content: '❖'; position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--gold); font-size: 14px;
}
#surah-title-frame::before { right: 10px; }
#surah-title-frame::after { left: 10px; }
#surah-title { font-size: 26px; color: var(--gold-soft); font-weight: 700; }
#surah-info { color: var(--ink-dim); font-size: 13.5px; margin-top: 8px; }

#basmala {
  text-align: center; font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 30px; color: var(--gold-soft); margin: 18px 0 8px;
}

#ayat {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 27px; line-height: 2.35;
  text-align: justify;
  padding: 6px 4px;
}
.ayah { border-radius: 10px; padding: 2px 6px; transition: background .35s; cursor: pointer; }
.ayah.active {
  background: linear-gradient(90deg, rgba(212,175,55,.30), rgba(212,175,55,.16));
  box-shadow: 0 0 0 1px rgba(212,175,55,.35);
}
.ayah-num {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px; padding: 0 4px;
  margin: 0 6px;
  border: 1.4px solid var(--gold);
  border-radius: 50%;
  color: var(--gold); font-size: 15px; font-family: 'Amiri', serif;
  vertical-align: middle;
}

#player {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 25;
  background: rgba(8,32,24,.97);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
}
#player-status { text-align: center; font-size: 13.5px; color: var(--ink-dim); padding-bottom: 6px; }
#player-controls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.playerbtn {
  background: #0e3529; color: var(--gold-soft);
  border: 1px solid var(--line); border-radius: 50%;
  width: 44px; height: 44px; font-size: 17px; cursor: pointer; flex: none;
  font-family: inherit;
}
.playerbtn.big {
  width: 56px; height: 56px; font-size: 22px;
  background: linear-gradient(135deg, var(--gold), #b8912e); color: #1d1503; border: none;
}
.playerbtn.wide { width: auto; border-radius: 999px; padding: 0 14px; font-size: 13.5px; max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.playerbtn.on { background: var(--gold); color: #1d1503; }
#dl-progress { position: relative; height: 20px; margin-top: 8px; background: #0a2a20; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
#dl-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .2s; }
#dl-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--ink); }

#sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.sheet {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 41;
  background: #0c2f24; border-top: 2px solid var(--gold);
  border-radius: 18px 18px 0 0;
  max-height: 72vh; overflow-y: auto;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
}
.sheet-title { text-align: center; font-size: 19px; color: var(--gold-soft); font-weight: 700; margin-bottom: 10px; }
.reciter-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 12px; cursor: pointer; border-radius: 12px;
  border-bottom: 1px solid rgba(212,175,55,.1);
}
.reciter-row:active { background: rgba(212,175,55,.1); }
.reciter-row.sel { background: rgba(212,175,55,.14); }
.reciter-row .r-name { font-size: 17.5px; font-weight: 700; }
.reciter-row .r-style { color: var(--ink-dim); font-size: 13px; }
.reciter-row .r-check { margin-inline-start: auto; color: var(--gold); font-size: 18px; }

.mem-grid { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; margin: 14px 6px; }
.mem-grid label { color: var(--ink-dim); font-size: 15px; }
.mem-grid select {
  background: #0a2a20; color: var(--gold-soft); font-family: inherit; font-size: 17px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none;
}
.mem-note { color: var(--ink-dim); font-size: 13.5px; line-height: 1.8; text-align: center; margin: 4px 10px 12px; }
.bigbtn {
  display: block; width: 100%; padding: 13px; font-family: inherit; font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #b8912e); color: #1d1503;
  border: none; border-radius: 12px; cursor: pointer;
}

#toast {
  position: fixed; bottom: 110px; right: 50%; transform: translateX(50%);
  background: #123f30; color: var(--ink);
  border: 1px solid var(--gold); border-radius: 999px;
  padding: 10px 20px; font-size: 15px; z-index: 60;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  max-width: 88vw; text-align: center;
}

@media (min-width: 700px) {
  #ayat { font-size: 30px; }
  .sheet { max-width: 560px; margin: 0 auto; right: 0; left: 0; }
}
