/* ========== Sacred Ayat — App ========== */
:root {
  --bg:        #060f17;
  --bg-soft:   #0c1923;
  --bg-card:   #11202c;
  --bg-card-2: #15293a;
  --gold:      #f5d061;
  --gold-deep: #a88c2b;
  --ivory:     #f6f1e3;
  --muted:     #8c9aa8;
  --line:      rgba(245,208,97,0.12);
  --safe-top:    env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html { background: var(--bg); }
body {
  background: radial-gradient(1200px 800px at 50% -200px, #11253a 0%, var(--bg) 60%);
  color: var(--ivory);
  font-family: Georgia, "Cormorant Garamond", "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

/* Splash */
#splash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: grid; place-items: center;
  z-index: 1000;
  transition: opacity .6s ease;
}
#splash.hidden { opacity: 0; pointer-events: none; }
.splash-mark { text-align: center; }
.splash-mark img { display:block; margin: 0 auto 18px; opacity: .92; }
.splash-name {
  font-family: 'Anton', 'Arial Narrow', Arial, sans-serif;
  font-size: 32px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ivory);
}
.splash-name span { color: var(--gold); }
.splash-tag {
  margin-top: 10px;
  font-style: italic; font-size: 14px;
  color: var(--gold-deep);
  letter-spacing: .04em;
}

/* Top bar */
#topbar {
  position: sticky; top: 0; z-index: 50;
  padding: calc(var(--safe-top) + 14px) 18px 12px;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, rgba(6,15,23,.92), rgba(6,15,23,.6));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: 'Anton', 'Arial Narrow', Arial, sans-serif;
  font-size: 18px; letter-spacing: .22em; text-transform: uppercase;
}
.brand span { color: var(--gold); }

/* Main + tabs */
#app {
  padding: 14px 14px calc(96px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}
.tab { display: none; }
.tab.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px);} to {opacity:1; transform:none;}}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.card-eyebrow {
  font-family: Arial, sans-serif;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 10px;
}
.card-body { color: var(--ivory); margin: 4px 0 14px; line-height: 1.55; }
.muted { color: var(--muted); font-style: italic; }
.caption { font-size: 12px; color: var(--muted); margin-top: 6px; display:block; }

/* Hero today card */
.hero-card {
  background:
    radial-gradient(600px 280px at 50% -10%, rgba(245,208,97,.15), transparent 60%),
    linear-gradient(180deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid rgba(245,208,97,0.18);
  border-radius: 22px;
  padding: 28px 20px 30px;
  text-align: center;
  margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.hero-card::after {
  content:''; position:absolute; inset:0;
  background: radial-gradient(circle at 80% 110%, rgba(245,208,97,.08), transparent 50%);
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 12px; letter-spacing: .18em;
  color: var(--gold-deep); text-transform: uppercase;
}
.hero-prayer { color: var(--muted); font-size: 13px; margin-top: 16px; letter-spacing: .04em;}
.hero-countdown {
  font-family: 'Anton', sans-serif;
  font-size: 56px; letter-spacing: .04em;
  color: var(--ivory);
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 24px rgba(245,208,97,0.25);
}
.hero-prayer-name {
  font-size: 22px; color: var(--gold);
  letter-spacing: .03em;
}
.hero-time { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* Today ayah */
.today-ayah .ayah-arabic {
  font-family: 'Amiri', 'Scheherazade New', serif;
  font-size: 26px; line-height: 1.7; text-align: right;
  color: var(--ivory); margin-bottom: 12px;
  direction: rtl;
}
.today-ayah .ayah-trans {
  font-style: italic; color: var(--ivory);
  line-height: 1.6;
}
.today-ayah .ayah-cite {
  margin-top: 8px; color: var(--gold-deep); font-size: 13px;
  letter-spacing: .04em;
}

/* Mecca live */
.ratio-16x9 {
  position: relative; width: 100%; padding-top: 56.25%;
  border-radius: 12px; overflow: hidden;
  background: #000;
}
.ratio-16x9 iframe {
  position: absolute; inset:0; width:100%; height:100%;
}

/* Buttons */
.primary-btn {
  background: var(--gold); color: var(--bg);
  border: 0; border-radius: 999px;
  padding: 13px 22px; font-weight: 700; font-size: 15px;
  font-family: Arial, sans-serif; letter-spacing: .04em;
  cursor: pointer; transition: transform .1s ease;
}
.primary-btn:active { transform: scale(.97); }
.primary-btn.big { padding: 18px 36px; font-size: 17px; }
.primary-btn.full { width: 100%; }
.ghost-btn {
  background: transparent; color: var(--gold);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  padding: 10px 18px; font-size: 13px;
  font-family: Arial, sans-serif; letter-spacing: .06em;
  cursor: pointer;
}
.ghost-btn.full { width: 100%; display:block; text-align:center; text-decoration:none; }

/* Prayer tab */
.location-card { display:flex; justify-content:space-between; align-items:center; }
.location-card .card-eyebrow { margin: 0; }
.location-line { color: var(--ivory); font-size: 14px; flex:1; padding: 0 12px;}
.prayer-list { list-style: none; padding: 0; margin: 0; }
.prayer-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.prayer-list li:last-child { border-bottom: 0; }
.prayer-list li[data-active="true"] {
  color: var(--gold);
  font-weight: 600;
}
.prayer-list span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--ivory);
}

/* Qibla */
.qibla-wrap { text-align: center; padding: 12px 0 0; }
.qibla-dial {
  position: relative;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  background: radial-gradient(circle at center, var(--bg-card-2), var(--bg-card));
  margin: 0 auto;
  cursor: pointer;
}
.qibla-tick {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(-100px) rotate(calc(-1 * var(--a)));
  color: var(--gold-deep);
  font-size: 13px;
  font-family: Arial, sans-serif;
  letter-spacing: .1em;
}
.qibla-needle {
  position: absolute; inset:0;
  transition: transform .3s ease;
}
.qibla-arrow {
  position: absolute; left: 50%; top: 50%;
  width: 4px; height: 92px;
  background: linear-gradient(to top, transparent, var(--gold));
  transform: translate(-50%, -100%);
  border-radius: 2px;
}
.qibla-kaaba {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -180px);
  font-size: 28px;
}
.qibla-help { color: var(--muted); margin-top: 12px; font-size: 13px; }
.qibla-bearing { color: var(--gold); margin-top: 4px; font-family: 'Anton', sans-serif; font-size: 18px; letter-spacing: .12em; }

/* Hijri */
.hijri-line { color: var(--ivory); font-size: 18px; }

/* Map */
.map { width: 100%; height: 320px; border-radius: 12px; }
/* Leaflet dark feel */
.leaflet-tile-pane { filter: brightness(.7) saturate(.8); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-card); color: var(--ivory);
}
.leaflet-popup-content { font-family: Georgia, serif; font-size: 13px; }
.leaflet-popup-content a { color: var(--gold); }

.mosques-list { list-style: none; margin: 0; padding: 0; }
.mosques-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.mosques-list li:last-child { border-bottom: 0; }
.m-name { color: var(--ivory); font-size: 15px; }
.m-meta { color: var(--muted); font-size: 12px; }
.m-actions { margin-top: 6px; display: flex; gap: 8px; }
.m-actions a { color: var(--gold); text-decoration: none; font-size: 12px;
               border: 1px solid var(--gold-deep); padding: 4px 10px; border-radius: 999px;}

/* Watch */
.videos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; margin-bottom: 14px; }
.videos-grid a { display:block; text-decoration:none; color: var(--ivory); }
.videos-grid img { width:100%; border-radius: 10px; aspect-ratio: 16/9; object-fit: cover; background: #000; }
.videos-grid .v-title { font-size: 12px; line-height: 1.35; margin-top: 6px; color: var(--ivory);
                        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}

/* Tasbih */
.tasbih-card { text-align: center; }
.tasbih-count {
  font-family: 'Anton', sans-serif;
  font-size: 88px; line-height: 1;
  color: var(--gold);
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 30px rgba(245,208,97,.3);
}
.tasbih-dhikr {
  font-style: italic; color: var(--ivory); font-size: 18px;
  margin-bottom: 22px;
}
.tasbih-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Hadith */
.hadith-text { color: var(--ivory); font-style: italic; line-height: 1.65; }
.hadith-cite { color: var(--gold-deep); font-size: 13px; margin-top: 8px; }

/* Charity */
.charity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.charity-pill {
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ivory);
  text-align: center;
  font-size: 13px;
}

/* Tabbar */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; justify-content: space-around;
  background: linear-gradient(0deg, rgba(6,15,23,.96), rgba(6,15,23,.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 4px calc(10px + var(--safe-bottom));
}
.tab-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  flex: 1;
}
.tab-btn .tab-ico { font-size: 18px; }
.tab-btn .tab-lbl { font-size: 11px; letter-spacing: .04em; }
.tab-btn.active { color: var(--gold); }
.tab-btn:active { transform: scale(.94); }

/* iframe in mecca live larger watch tab */
.tab[data-tab="watch"] .ratio-16x9 { padding-top: 56.25%; }

/* Install card */
.install-card {
  background: linear-gradient(135deg, rgba(245,208,97,.15), rgba(126,197,197,.06));
  border: 1px solid var(--gold);
  position: relative;
}
.install-row { display: flex; align-items: center; gap: 12px; }
.install-icon img { width: 56px; height: 56px; border-radius: 14px; }
.install-body { flex: 1; min-width: 0; }
.install-title { color: var(--gold); font-weight: 700; font-size: 15px; }
.install-sub { color: var(--ivory); font-size: 13px; line-height: 1.4; margin: 4px 0 10px; }
.install-cta { padding: 10px 18px; font-size: 13px; }
.install-close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: 0; color: var(--muted);
  font-size: 22px; cursor: pointer;
}

/* iOS install modal */
.ios-modal-bg {
  position: fixed; inset: 0;
  background: rgba(6,15,23,.85);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.ios-modal-bg.show { display: flex; animation: fadein .25s; }
.ios-modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 24px 22px 20px;
  max-width: 360px; width: 100%;
  text-align: center;
}
.ios-modal h3 { color: var(--gold); margin: 0 0 6px; font-size: 20px; }
.ios-modal p { color: var(--ivory); font-size: 14px; line-height: 1.55; margin: 6px 0; }
.ios-step {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px; text-align: left;
}
.ios-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.ios-step-text { color: var(--ivory); font-size: 13px; line-height: 1.4; flex: 1; }
.ios-share-icon {
  display: inline-block; width: 18px; height: 22px;
  vertical-align: middle; margin: 0 2px;
}
.ios-modal-close {
  margin-top: 16px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  font-family: Arial, sans-serif;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
