/* زَاد | ZAD — design system */

@font-face{font-family:'Amiri';src:url('../fonts/amiri-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;}
@font-face{font-family:'Amiri';src:url('../fonts/amiri-700.woff2') format('woff2');font-weight:700;font-style:normal;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;}
@font-face{font-family:'Noto Naskh Arabic';src:url('../fonts/noto-naskh-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:'Scheherazade New';src:url('../fonts/scheherazade-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:'Cairo';src:url('../fonts/cairo-var.woff2') format('woff2');font-weight:300 700;font-style:normal;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;}

:root{
  --emerald:#0d5c4a; --emerald-2:#0a7a5f; --emerald-soft:#e3efe9;
  --gold:#b3873b; --gold-soft:#f0e3c6; --gold-line:#d9c08a;
  --ivory:#f8f5ee; --surface:#fffdf8; --surface-2:#f1ece0;
  --ink:#1e2622; --muted:#6b746f; --line:#e4dccb;
  --danger:#a8412f;
  --shadow:0 1px 2px rgba(30,38,34,.05), 0 10px 30px -18px rgba(30,38,34,.35);
  --radius:18px; --radius-sm:12px;
  --maxw:760px;
  --ff-ui:'Cairo','Segoe UI',system-ui,-apple-system,'Helvetica Neue',sans-serif;
  --ff-quran:'Noto Naskh Arabic','Scheherazade New','Amiri','Traditional Arabic',serif;
  --ff-serif:'Amiri',serif;
  color-scheme:light;
}
html[data-theme="dark"]{
  --emerald:#3aa384; --emerald-2:#4fbf9c; --emerald-soft:#12332b;
  --gold:#d3ac63; --gold-soft:#2b2417; --gold-line:#4a3f28;
  --ivory:#0c1311; --surface:#121b18; --surface-2:#18231f;
  --ink:#eae4d6; --muted:#9aa8a2; --line:#243029;
  --danger:#e08a76;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 12px 30px -18px rgba(0,0,0,.8);
  color-scheme:dark;
}

*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  font-family:var(--ff-ui); background:var(--ivory); color:var(--ink);
  line-height:1.65; font-size:16px; min-height:100vh;
  padding-bottom:calc(76px + env(safe-area-inset-bottom));
  background-image:
    radial-gradient(1200px 400px at 50% -200px, rgba(13,92,74,.07), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%230d5c4a' stroke-opacity='.05' stroke-width='1'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3C/g%3E%3C/svg%3E");
}
html[data-theme="dark"] body{background-image:radial-gradient(1200px 400px at 50% -200px, rgba(58,163,132,.10), transparent 70%),url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%233aa384' stroke-opacity='.07' stroke-width='1'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3C/g%3E%3C/svg%3E")}

body[dir="ltr"]{--ff-quran:'Amiri Quran','Amiri',serif}

img,svg{max-width:100%}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px;border-radius:6px}
.skip{position:absolute;inset-inline-start:-9999px;top:8px;background:var(--surface);padding:.6rem 1rem;border-radius:10px;z-index:99}
.skip:focus{inset-inline-start:8px}

/* ---------- top bar ---------- */
.topbar{
  position:sticky;top:0;z-index:40;display:flex;align-items:center;justify-content:space-between;
  gap:.75rem;padding:.55rem clamp(.75rem,3vw,1.25rem);
  background:color-mix(in srgb,var(--ivory) 86%,transparent);
  backdrop-filter:saturate(160%) blur(12px);-webkit-backdrop-filter:saturate(160%) blur(12px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:.6rem;min-width:0}
.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;
  background:linear-gradient(160deg,var(--emerald),var(--emerald-2));color:#f7f2e4;
  box-shadow:0 6px 16px -8px rgba(13,92,74,.9)}
.brand-text{display:flex;flex-direction:column;line-height:1.15;min-width:0}
.brand-text b{font-family:var(--ff-serif);font-size:1.35rem;letter-spacing:.5px;color:var(--emerald)}
.brand-text small{font-size:.68rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html[data-theme="dark"] .brand-text b{color:var(--emerald-2)}
.top-actions{display:flex;gap:.4rem}
.icon-btn{display:grid;place-items:center;min-width:38px;height:38px;padding:0 .5rem;border-radius:11px;
  border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:.8rem;font-weight:600}
.icon-btn:active{transform:scale(.96)}

/* ---------- layout ---------- */
main{max-width:var(--maxw);margin:0 auto;padding:1rem clamp(.75rem,3vw,1.25rem) 2rem}
.page-head{margin:.25rem 0 1rem}
.page-head h1{font-family:var(--ff-serif);font-size:1.7rem;margin:0 0 .15rem;color:var(--emerald);letter-spacing:.3px}
html[data-theme="dark"] .page-head h1{color:var(--emerald-2)}
.page-head p{margin:0;color:var(--muted);font-size:.9rem}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:1rem}
.card + .card{margin-top:.85rem}
.section-title{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin:1.35rem 0 .6rem}
.section-title h2{font-size:1.02rem;margin:0;font-weight:600;letter-spacing:.2px}
.section-title a,.linkish{font-size:.8rem;color:var(--emerald-2);font-weight:600}

/* ---------- hero / date ---------- */
.hero{position:relative;overflow:hidden;padding:1.15rem 1.1rem;border-radius:22px;
  background:linear-gradient(155deg,var(--emerald) 0%,#0b4c3e 55%,#093f34 100%);color:#f6f1e3;
  box-shadow:0 18px 40px -26px rgba(9,63,52,.9)}
.hero::after{content:"";position:absolute;inset-inline-end:-40px;top:-40px;width:180px;height:180px;border-radius:50%;
  border:1px solid rgba(240,227,198,.25);box-shadow:0 0 0 18px rgba(240,227,198,.07),0 0 0 38px rgba(240,227,198,.05)}
.hero-top{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;position:relative;z-index:1}
.hero .hijri{font-family:var(--ff-serif);font-size:1.5rem;line-height:1.25;margin:0}
.hero .greg{font-size:.8rem;opacity:.82;margin:.15rem 0 0}
.hero .next-prayer{text-align:end}
.hero .next-prayer .label{font-size:.7rem;opacity:.8;letter-spacing:.5px}
.hero .next-prayer .name{font-size:1.15rem;font-weight:600}
.hero .next-prayer .time{font-variant-numeric:tabular-nums;font-size:1.05rem;color:var(--gold-soft)}
.hero .countdown{margin-top:.85rem;padding-top:.75rem;border-top:1px solid rgba(240,227,198,.22);
  display:flex;align-items:center;gap:.5rem;font-size:.85rem;position:relative;z-index:1}
.hero .countdown b{font-variant-numeric:tabular-nums;letter-spacing:1px;font-size:1.05rem;color:#fff}

/* ---------- grids ---------- */
.grid{display:grid;gap:.6rem}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
@media(max-width:420px){.grid-3{grid-template-columns:repeat(2,1fr)}}
.tile{display:flex;flex-direction:column;gap:.3rem;align-items:flex-start;padding:.7rem .65rem;border-radius:15px;
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);min-height:74px;transition:transform .15s}
.tile:active{transform:scale(.98)}
.tile .ico{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--emerald-soft);color:var(--emerald)}
html[data-theme="dark"] .tile .ico{color:var(--emerald-2)}
.tile b{font-size:.86rem;font-weight:600;line-height:1.3}
.tile small{font-size:.68rem;color:var(--muted);line-height:1.3}

/* ---------- list rows ---------- */
.rows{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.row{display:flex;align-items:center;gap:.75rem;padding:.7rem .85rem;border-bottom:1px solid var(--line)}
.row:last-child{border-bottom:0}
.row:active{background:var(--surface-2)}
.row .num{flex:0 0 auto;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;
  border:1px solid var(--gold-line);color:var(--gold);font-size:.75rem;font-weight:600;font-variant-numeric:tabular-nums;
  background:var(--gold-soft)}
.row .body{min-width:0;flex:1}
.row .body b{display:block;font-size:.95rem;font-weight:600}
.row .body small{display:block;color:var(--muted);font-size:.72rem}
.row .chev{color:var(--muted);font-size:.9rem}

/* ---------- quran ---------- */
.searchbar{display:flex;align-items:center;gap:.5rem;padding:.55rem .8rem;border-radius:14px;background:var(--surface);
  border:1px solid var(--line);box-shadow:var(--shadow)}
.searchbar input{flex:1;border:0;background:transparent;font:inherit;color:inherit;outline:none;min-width:0}
.searchbar input::placeholder{color:var(--muted)}
.surah-head{text-align:center;padding:1.2rem 1rem;border-radius:20px;border:1px solid var(--gold-line);
  background:linear-gradient(180deg,var(--gold-soft),transparent);margin-bottom:1rem}
.surah-head h1{font-family:var(--ff-serif);font-size:1.9rem;margin:0;color:var(--emerald)}
html[data-theme="dark"] .surah-head h1{color:var(--emerald-2)}
.surah-head .meta{font-size:.75rem;color:var(--muted);margin-top:.2rem}
.bismillah{font-family:var(--ff-quran);font-size:1.35rem;text-align:center;margin:1rem 0;color:var(--emerald)}
html[data-theme="dark"] .bismillah{color:var(--emerald-2)}
.ayat{font-family:var(--ff-quran);font-size:1.6rem;line-height:2.4;text-align:start;text-align-last:start;word-spacing:normal;hyphens:none;padding-bottom:4.2rem}
.ayah{display:inline;padding:.1em .12em;border-radius:8px;cursor:pointer;transition:background .2s}
.ayah:hover,.ayah.active{background:var(--gold-soft)}
.ayah .mark{display:inline-grid;place-items:center;min-width:1.5em;height:1.5em;margin:0 .18em;font-family:var(--ff-ui);
  font-size:.5em;vertical-align:middle;color:var(--gold);border:1px solid var(--gold-line);border-radius:50%;
  font-variant-numeric:tabular-nums;transform:translateY(-.1em)}
.ayah-mark{background:var(--emerald-soft);color:var(--emerald)}
.ayah-tools{position:fixed;inset-inline:0;bottom:calc(64px + env(safe-area-inset-bottom));display:flex;gap:.4rem;justify-content:center;
  margin:0 auto;padding:.5rem;max-width:var(--maxw);flex-wrap:wrap;
  background:color-mix(in srgb,var(--ivory) 90%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.ayah-tools button{padding:.45rem .8rem;border-radius:999px;border:1px solid var(--line);background:var(--surface);
  font-size:.78rem;box-shadow:var(--shadow)}
.pager{display:flex;justify-content:space-between;gap:.6rem;margin:1.2rem 0 0}
.pager a{padding:.55rem .9rem;border-radius:12px;border:1px solid var(--line);background:var(--surface);font-size:.82rem}

/* ---------- adhkar ---------- */
.dhikr{padding:.95rem 1rem;border-radius:16px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow)}
.dhikr + .dhikr{margin-top:.7rem}
.dhikr .txt{font-family:var(--ff-quran);font-size:1.3rem;line-height:2.1;text-align:start}
.dhikr .ref{margin-top:.6rem;font-size:.72rem;color:var(--muted);border-inline-start:2px solid var(--gold-line);padding-inline-start:.6rem}
.dhikr .fadl{margin-top:.5rem;font-size:.75rem;color:var(--emerald-2)}
.dhikr-foot{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin-top:.7rem}
.counter{display:flex;align-items:center;gap:.5rem}
.count-btn{display:inline-flex;align-items:center;gap:.4rem;padding:.42rem .8rem;border-radius:999px;border:1px solid var(--emerald);
  background:var(--emerald-soft);color:var(--emerald);font-size:.78rem;font-weight:600}
html[data-theme="dark"] .count-btn{color:var(--emerald-2)}
.count-btn.done{background:var(--emerald);color:#f7f2e4;border-color:var(--emerald)}
.repeat-tag{font-size:.7rem;color:var(--muted)}

/* ---------- prayer ---------- */
.city-select{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
select,input[type="number"]{font:inherit;color:inherit;background:var(--surface);border:1px solid var(--line);
  border-radius:12px;padding:.5rem .7rem}
.prayer-list{display:grid;gap:.4rem}
.prayer-row{display:flex;align-items:center;justify-content:space-between;padding:.6rem .85rem;border-radius:13px;
  background:var(--surface);border:1px solid var(--line)}
.prayer-row.next{border-color:var(--emerald);background:var(--emerald-soft)}
.prayer-row .nm{font-weight:600;font-size:.92rem}
.prayer-row .tm{font-variant-numeric:tabular-nums;color:var(--emerald);font-weight:600;font-size:1.1rem;letter-spacing:.01em;unicode-bidi:isolate}
html[data-theme="dark"] .prayer-row .tm{color:var(--emerald-2)}
.qibla{display:flex;align-items:center;gap:1rem;margin-top:.6rem}
.compass{position:relative;width:112px;height:112px;border-radius:50%;border:2px solid var(--gold-line);flex:0 0 auto;
  background:radial-gradient(circle at 50% 50%,var(--surface-2),var(--surface))}
.compass .needle{position:absolute;inset:0;display:grid;place-items:center;transition:transform .6s ease}
.compass .needle::before{content:"";width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;
  border-bottom:34px solid var(--emerald);transform:translateY(-14px)}
.compass .dot{position:absolute;left:50%;top:50%;width:7px;height:7px;border-radius:50%;background:var(--gold);transform:translate(-50%,-50%)}
.compass .cardinal{position:absolute;font-size:.6rem;color:var(--muted)}
.compass .n{top:4px;left:50%;transform:translateX(-50%)}
.compass .s{bottom:4px;left:50%;transform:translateX(-50%)}
.compass .e{right:5px;top:50%;transform:translateY(-50%)}
.compass .w{left:5px;top:50%;transform:translateY(-50%)}

/* ---------- hijri calendar ---------- */
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:3px;margin-top:.6rem}
.cal .dow{text-align:center;font-size:.66rem;color:var(--muted);padding:.25rem 0}
.cal .day{aspect-ratio:1;display:grid;place-items:center;border-radius:10px;font-size:.8rem;background:var(--surface-2);font-variant-numeric:tabular-nums}
.cal .day.out{opacity:.35}
.cal .day.today{background:var(--emerald);color:#f7f2e4;font-weight:700}
.cal .day.event{outline:2px solid var(--gold-line);outline-offset:-2px}

/* ---------- misc ---------- */
.pill{display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .6rem;border-radius:999px;font-size:.7rem;
  background:var(--emerald-soft);color:var(--emerald);border:1px solid transparent}
html[data-theme="dark"] .pill{color:var(--emerald-2)}
.pill.gold{background:var(--gold-soft);color:var(--gold)}
.muted{color:var(--muted)}
.small{font-size:.8rem}
.empty{text-align:center;padding:2.2rem 1rem;color:var(--muted)}
.empty b{display:block;color:var(--ink);margin-bottom:.3rem;font-size:1rem}
.soon{border:1px dashed var(--gold-line);background:linear-gradient(180deg,var(--gold-soft),transparent);border-radius:var(--radius);padding:1.2rem}
.soon h2{margin:.1rem 0 .4rem;font-family:var(--ff-serif);font-size:1.3rem;color:var(--emerald)}
html[data-theme="dark"] .soon h2{color:var(--emerald-2)}
.soon ul{margin:.5rem 0 0;padding-inline-start:1.1rem;color:var(--muted);font-size:.85rem}
.soon ul li{margin:.25rem 0}
.badge-soft{display:inline-block;padding:.15rem .5rem;border-radius:6px;font-size:.68rem;background:var(--gold-soft);color:var(--gold);border:1px solid var(--gold-line)}
.hadith-text{font-family:var(--ff-quran);font-size:1.3rem;line-height:2.1}
.toast{position:fixed;inset-inline:0;bottom:calc(88px + env(safe-area-inset-bottom));display:flex;justify-content:center;z-index:60;pointer-events:none}
.toast span{background:var(--ink);color:var(--ivory);padding:.5rem .9rem;border-radius:999px;font-size:.8rem;
  box-shadow:0 10px 30px -12px rgba(0,0,0,.6);opacity:0;transform:translateY(8px);transition:.25s}
.toast.show span{opacity:1;transform:none}
.tasbih{display:grid;place-items:center;gap:1rem;padding:1.5rem 0}
.tasbih .ring{width:210px;height:210px;border-radius:50%;display:grid;place-items:center;border:2px solid var(--gold-line);
  background:radial-gradient(circle at 50% 40%,var(--surface),var(--surface-2));box-shadow:var(--shadow);position:relative}
.tasbih .ring b{font-size:3.2rem;font-variant-numeric:tabular-nums;color:var(--emerald);font-weight:700}
html[data-theme="dark"] .tasbih .ring b{color:var(--emerald-2)}
.tasbih .ring small{position:absolute;bottom:52px;font-size:.75rem;color:var(--muted)}
.tasbih .tap{padding:.9rem 2.4rem;border-radius:999px;border:0;background:var(--emerald);color:#f7f2e4;font-size:1rem;font-weight:600;
  box-shadow:0 14px 26px -14px rgba(13,92,74,.9)}
.tasbih .tap:active{transform:scale(.97)}
.tasbih .opts{display:flex;gap:.5rem}
.tasbih .opts button{padding:.4rem .8rem;border-radius:999px;border:1px solid var(--line);background:var(--surface);font-size:.78rem}
.tasbih .opts button[aria-pressed="true"]{border-color:var(--emerald);background:var(--emerald-soft);color:var(--emerald)}
.credits{font-size:.82rem;color:var(--muted);line-height:1.9}
.credits a{color:var(--emerald-2);text-decoration:underline;text-underline-offset:3px}

/* ---------- tabbar ---------- */
.tabbar{position:fixed;inset-inline:0;bottom:0;z-index:50;display:flex;justify-content:space-around;
  padding:.35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  border-top:1px solid var(--line)}
.tabbar a{display:flex;flex-direction:column;align-items:center;gap:.15rem;padding:.35rem .5rem;border-radius:12px;
  color:var(--muted);font-size:.66rem;min-width:56px;min-height:48px;justify-content:center}
.tabbar a svg{width:22px;height:22px}
.tabbar a[aria-current="page"]{color:var(--emerald);background:var(--emerald-soft)}
html[data-theme="dark"] .tabbar a[aria-current="page"]{color:var(--emerald-2)}

@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@media(min-width:720px){
  .ayat{font-size:1.75rem}
  .tabbar{max-width:var(--maxw);margin:0 auto;border-radius:20px 20px 0 0;border:1px solid var(--line);border-bottom:0}
}
