@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-arabic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}

:root {
  --bg: #0f1419;
  --bg-2: #141c24;
  --surface: #1a2332;
  --surface-2: #222d3f;
  --line: rgba(212, 175, 55, 0.20);
  --text: #f5f5f0;
  --muted: #a0aec0;
  --accent: #1e293b;
  --accent-deep: #0f172a;
  --accent-bright: #3ddc97;
  --gold: #D4AF37;
  --gold2: #C9A227;
  --mint: #3ddc97;
  --sun: #D4AF37;
  --ok: #3ddc97;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  --font: "Cairo", "Amiri", "Segoe UI", sans-serif;
  --dock: 64px;
  --header: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  overscroll-behavior: none;
  background-color: #0b1015 !important;
  background-image: 
    radial-gradient(ellipse at 20% 30%, rgba(212, 175, 55, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(212, 175, 55, 0.06) 0%, transparent 60%) !important;
  background-attachment: fixed !important;
}

#app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 10%, rgba(212, 175, 55, 0.08), transparent 50%);
  z-index: 0;
}
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

#app {
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: var(--header) minmax(0, 1fr) var(--dock);
  overflow: hidden;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 18, 13, 0.92);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.15; }
.brand p { margin: 0; color: var(--muted); font-size: 11px; }
.net {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px;
}
.net i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: block; }
.net.off i { background: var(--danger); }

#stage { min-height: 0; position: relative; overflow: hidden; }
.view { height: 100%; min-height: 0; overflow: hidden; }
.view[hidden] { display: none !important; }

/* Radio */
.radio {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 8px;
  gap: 10px;
}
.chassis {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(212, 175, 55, 0.18), transparent 55%), linear-gradient(180deg, #1a2530, #0f1620); border: 1.5px solid rgba(212, 175, 55, 0.45);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.screen {
  background: #080d12;
  border-radius: 18px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 12px 14px 10px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), inset 0 0 40px rgba(21, 64, 47, 0.5);
}
.freq {
  font-variant-numeric: tabular-nums;
  font-size: clamp(40px, 8vh, 64px);
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  color: #f4ecff;
  direction: ltr;
}
.freq span { font-size: 0.38em; color: var(--accent-bright); margin-inline-start: 6px; }
.station-name { margin: 6px 0 0; font-size: clamp(16px, 2.4vh, 22px); font-weight: 700; }
.station-meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.scale {
  direction: ltr;
  position: relative;
  height: 46px;
  margin: 0 6px;
  touch-action: none;
}
.scale-track {
  position: absolute;
  left: 0; right: 0; top: 22px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #14352a, var(--mint), var(--gold));
}
.ticks {
  position: absolute; inset: 0 0 16px;
  background: repeating-linear-gradient(90deg, rgba(247,244,255,.45) 0 1px, transparent 1px 8.5%);
  mask-image: linear-gradient(#000, #000);
}
.needle {
  position: absolute;
  top: 6px;
  width: 2px;
  height: 28px;
  background: var(--sun);
  border-radius: 2px;
  transform: translateX(-1px);
  box-shadow: 0 0 10px rgba(232, 163, 23, 0.8);
}
.needle::after {
  content: "";
  position: absolute;
  left: -5px; top: -4px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--sun);
}
.scale-labels {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 10px; direction: ltr; padding: 0 2px;
}

.controls, .tools { display: flex; align-items: center; justify-content: center; gap: 10px; }
.fab, .tool {
  border: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
}
.fab { width: 52px; height: 52px; }
.fab.play {
  width: 68px; height: 68px;
  background: linear-gradient(145deg, #1f5c44, #123829); border: 1px solid rgba(233, 196, 106, 0.4); color: var(--gold);
}
.fab[aria-pressed="true"] { color: #fecdd3; background: #3b1220; }
.tool { height: 40px; padding: 0 14px; gap: 6px; font-size: 13px; font-weight: 700; }
.tool svg, .fab svg { width: 22px; height: 22px; }
.vol { width: min(140px, 28vw); accent-color: var(--accent); }

/* Dock */
.dock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(6, 18, 13, 0.94);
}
.dock a {
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  min-height: 48px;
}
.dock a[aria-current="page"] { color: white; background: rgba(61, 220, 151, 0.22); }
.dock svg { width: 20px; height: 20px; }

/* Sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 4, 12, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
}
.sheet[hidden] { display: none !important; }
.sheet-card {
  width: min(560px, 100%);
  height: 100%;
  max-height: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sheet-head, .sheet-tools { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.sheet-head { justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 16px; }
.search {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 14px;
}
.chips { display: flex; gap: 6px; overflow: hidden; padding: 0 12px 8px; }
.chips button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.chips button[aria-pressed="true"] { background: var(--accent-deep); color: white; border-color: transparent; }
.sheet-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; min-height: 0; flex: 1; }
.sheet-list button {
  width: 100%;
  text-align: right;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.sheet-list .on { color: var(--accent-bright); }
.sheet-list small { color: var(--muted); }

/* Mushaf */
.mushaf { position: relative; height: 100%; background: #07060b; overflow: hidden; touch-action: none; }
.mushaf-frame { position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center; }
.mushaf-frame img { width: 100%; height: 100%; object-fit: contain; background: #f4efe4; transform-origin: center center; user-select: none; }
.mushaf-top, .mushaf-bar {
  position: absolute;
  left: 10px; right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
  transition: opacity .25s ease, transform .25s ease;
}
.mushaf-top {
  top: 8px;
  background: rgba(11, 9, 18, 0.78);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 10px;
  backdrop-filter: blur(8px);
}
.mushaf-top.is-hidden { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.mushaf-bar {
  bottom: 10px;
  justify-content: center;
}
.pill, .iconbtn {
  border: 0;
  background: rgba(18, 14, 28, 0.82);
  color: white;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; }
.iconbtn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); }
.pill { padding: 8px 12px; font-weight: 700; font-size: 13px; }
.reciter {
  background: transparent; border: 0; color: white; font-weight: 700; max-width: 42vw;
}
.lock-shield {
  position: absolute; inset: 0; z-index: 4;
  background: transparent;
}
.lock-shield[hidden] { display: none !important; }
.unlock {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: rgba(11,9,18,.88);
  border: 1px solid var(--line);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}

/* Azan */
.azan {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 8px;
  gap: 8px;
  min-height: 0;
}
.next-card, .times, .azan-actions {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.next-card { padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.next-card strong { font-size: 20px; }
.next-card em { font-style: normal; color: var(--sun); font-weight: 700; font-variant-numeric: tabular-nums; }
.place { margin: 0; color: var(--muted); font-size: 12px; }
.times {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
}
.times article {
  background: var(--bg-2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px;
}
.times .k { color: var(--muted); font-size: 12px; }
.times .t { font-weight: 700; font-size: clamp(14px, 2.2vh, 20px); font-variant-numeric: tabular-nums; }
.times article.soon { outline: 1px solid var(--accent); background: rgba(124,58,237,.18); }
.azan-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; align-items: center; justify-content: space-between; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.wizard {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6,4,12,.62);
  display: grid; place-items: center; padding: 16px;
}
.wizard[hidden] { display: none !important; }
.wizard-card {
  width: min(420px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}
.wizard-card h2 { margin: 0 0 6px; font-size: 18px; }
.wizard-card ol { margin: 8px 0 12px; padding: 0 18px 0 0; }
.wizard-card li { margin: 6px 0; color: var(--muted); }
.wizard-card li.on { color: white; font-weight: 700; }
.wizard-card .row { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  bottom: calc(var(--dock) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: #2a2140;
  border: 1px solid var(--line);
  color: white;
  border-radius: 999px;
  padding: 8px 14px;
  z-index: 50;
  font-size: 13px;
  max-width: 90vw;
}
.toast[hidden] { display: none !important; }

@media (min-width: 900px) {
  .radio { padding-inline: 8vw; }
  .chassis { max-width: 760px; margin: 0 auto; width: 100%; }
  .azan { max-width: 860px; margin: 0 auto; width: 100%; }
  .times { grid-template-columns: repeat(6, 1fr); }
}

@media (max-height: 700px) {
  :root { --header: 48px; --dock: 56px; }
  .freq { font-size: 36px; }
  .fab.play { width: 58px; height: 58px; }
  .chassis { padding: 10px; gap: 8px; }
}
/* Islamic Arabesque Geometric Background & Highlights */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 80% -10%, #12402f 0, transparent 60%),
    radial-gradient(900px 500px at 0% 110%, #0d3a2a 0, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(233, 196, 106, 0.035) 1px, transparent 1px),
    linear-gradient(45deg, rgba(233, 196, 106, 0.02) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(233, 196, 106, 0.02) 25%, transparent 25%),
    linear-gradient(135deg, rgba(61, 220, 151, 0.015) 25%, transparent 25%),
    linear-gradient(-135deg, rgba(61, 220, 151, 0.015) 25%, transparent 25%);
  background-size: 100% 100%, 100% 100%, 32px 32px, 64px 64px, 64px 64px, 64px 64px, 64px 64px;
  background-attachment: fixed;
}

/* 4-Tab Dock Layout */
.dock {
  grid-template-columns: repeat(4, 1fr) !important;
}

/* Islamic Attractive Lock Shield */
.lock-shield {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(4, 12, 9, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-shield[hidden] {
  display: none !important;
}
.lock-card {
  width: min(360px, 92%);
  background: linear-gradient(165deg, #0f2a20, #0a1d15);
  border: 1px solid rgba(233, 196, 106, 0.35);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: lockPop .25s ease-out;
}
@keyframes lockPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.lock-icon {
  font-size: 38px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(233, 196, 106, 0.4));
}
.lock-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--gold);
  font-weight: 700;
}
.lock-card p {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.unlock-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1f5c44, #143e2e);
  border: 1px solid rgba(61, 220, 151, 0.5);
  border-radius: 14px;
  color: #eaf6ef;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform .15s ease, background .2s ease;
}
.unlock-btn:active {
  transform: scale(0.97);
  background: #143e2e;
}

/* Settings View Styles */
.settings-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-header-banner {
  background: linear-gradient(135deg, #14352a, #0b1f17);
  border: 1px solid rgba(233, 196, 106, 0.28);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: inset 0 0 30px rgba(61, 220, 151, 0.08);
}
.banner-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}
.banner-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.settings-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-item strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}
.settings-item p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-inp, .num-inp {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.num-inp {
  width: 54px;
  text-align: center;
}
.styled-chk {
  width: 20px;
  height: 20px;
  accent-color: var(--mint);
  cursor: pointer;
}
.dhikr-quick-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.dhikr-pill {
  flex: 1;
  white-space: nowrap;
  background: var(--bg-2);
  border: 1px solid rgba(233, 196, 106, 0.25);
  border-radius: 12px;
  color: var(--gold);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
  cursor: pointer;
  transition: background .2s ease;
}
.dhikr-pill:active {
  background: #14352a;
}
.about-card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

/* Dhikr Card Modal Styles */
.dhikr-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.dhikr-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.dhikr-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dhikr-badge {
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}
.dhikr-count-btn {
  height: 32px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--text);
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}


/* ==========================================================================
   Mesue Dynamic Fine-Line Gold Islamic Geometric Background
   ========================================================================== */
#mesue-islamic-bg-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: screen;
}

.mesue-islamic-svg {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.70; /* نقوش إسلامية أصيلة واضحة وناعمة */
  filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.28));
  animation: mesueSubtleBreath 14s ease-in-out infinite alternate;
}

/* إطار زخرفي علوي ناعم جداً بشعاع ذهبي رفيع */
.mesue-top-arch-ornament {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(197, 155, 39, 0.25) 20%,
    rgba(255, 243, 176, 0.95) 50%,
    rgba(197, 155, 39, 0.25) 80%,
    transparent 100%
  );
  box-shadow: 0 1px 12px rgba(212, 175, 55, 0.55);
  border-radius: 999px;
}

@keyframes mesueSubtleBreath {
  0% {
    opacity: 0.60;
    transform: scale(1);
  }
  100% {
    opacity: 0.82;
    transform: scale(1.018);
  }
}

/* التأكد من أن محتوى التطبيق الرئيسي يظهر فوق طبقة الزخارف الذهبية */
/* Isolate Islamic Background layer behind content */
/* v4.7: كانت body > * تكسر العناصر الثابتة (التوست/المعالج) — نطبقها على #app فقط */
#app {
  position: relative;
  z-index: 1;
}