/* حصن المسلم — الألوان كرموز، والوضع الليلي يعيد تعريفها */
:root {
  --bg: #f6f2e8;
  --bg-2: #efe8d8;
  --card: #fffdf8;
  --ink: #1c2622;
  --ink-2: #4c5a54;
  --ink-3: #7b8781;
  --line: #e2d9c4;
  --brand: #0d4d3a;
  --brand-2: #13664d;
  --brand-ink: #ffffff;
  --gold: #b48a2c;
  --gold-soft: #f3e6c4;
  --ok: #1f7a4d;
  --danger: #a23b2a;
  --shadow: 0 1px 2px rgba(28, 38, 34, .06), 0 8px 24px rgba(28, 38, 34, .06);
  --radius: 18px;
  --dhikr-size: 26px;
  --ui: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --quran: "Amiri", "Traditional Arabic", "Times New Roman", serif;
  --tabbar-h: 64px;
  --player-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1714; --bg-2: #10211c; --card: #132a23; --ink: #ecf1ee; --ink-2: #b9c6c0; --ink-3: #8a9a93;
    --line: #22413a; --brand: #2f9c78; --brand-2: #3cb08a; --brand-ink: #04130e; --gold: #d9b45a; --gold-soft: #2b2a1c;
    --ok: #4cc28a; --danger: #ef8f7c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1714; --bg-2: #10211c; --card: #132a23; --ink: #ecf1ee; --ink-2: #b9c6c0; --ink-3: #8a9a93;
  --line: #22413a; --brand: #2f9c78; --brand-2: #3cb08a; --brand-ink: #04130e; --gold: #d9b45a; --gold-soft: #2b2a1c;
  --ok: #4cc28a; --danger: #ef8f7c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 var(--ui);
  padding-bottom: calc(var(--tabbar-h) + var(--player-h) + env(safe-area-inset-bottom) + 16px);
  overflow-x: hidden;
}
a { color: var(--brand); }
button { font: inherit; color: inherit; }
.i { width: 22px; height: 22px; flex: none; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* الشريط العلوي */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; }
.brand-text small { color: var(--gold); font-size: 12px; font-weight: 600; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px 4px 14px; padding-inline-start: 14px; min-width: 0; max-width: 620px; margin-inline: auto;
}
.search .i { color: var(--ink-3); width: 20px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 8px 0; outline: none; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.mic { border: 0; background: var(--brand); color: var(--brand-ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.mic .i { color: inherit; width: 20px; }
.topnav { display: none; gap: 4px; }
.topnav a { text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.topnav a:hover, .topnav a.on { background: var(--bg-2); color: var(--ink); }
.icon-btn { border: 1px solid var(--line); background: var(--card); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink-2); }

@media (max-width: 639px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; }
  .brand { flex: 1; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}
@media (min-width: 960px) {
  .topnav { display: flex; }
}

main { max-width: 980px; margin: 0 auto; padding: 16px; outline: none; }

/* الرئيسية */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 26px 22px 22px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #1d7a5b 0%, #0d4d3a 55%, #08382a 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 4l7 17 17 7-17 7-7 17-7-17-17-7 17-7z' fill='none' stroke='%23fff' stroke-width='1.2'/%3E%3C/svg%3E");
}
.hero > * { position: relative; z-index: 1; }
.waqf { display: inline-block; background: #fff; color: #0d4d3a; font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 999px; }
.hero h1 { font-family: var(--quran); font-weight: 700; font-size: clamp(34px, 7vw, 52px); margin: 10px 0 0; line-height: 1.3; }
.hero .sub { margin: 2px 0 0; opacity: .92; font-size: 15px; }
.hero .author { margin: 10px 0 0; font-size: 15px; color: #f3e6c4; }
.hero .jariya { margin: 6px 0 0; font-size: 15px; opacity: .92; }
.jariya-about { margin: 10px 0 0; font-weight: 600; color: var(--gold); }
.hero .greet { margin: 14px 0 0; font-family: var(--quran); font-size: 20px; opacity: .95; }

.sessions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.session {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 16px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; min-height: 132px;
}
.session .i { width: 30px; height: 30px; color: var(--gold); }
.session b { font-size: 19px; }
.session small { color: var(--ink-2); font-size: 13px; }
.session, .quick a, .result, .chlist a { transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease; -webkit-tap-highlight-color: transparent; }
.session:active, .quick a:active, .result:active { transform: scale(.97); }
@media (hover: hover) {
  .session:hover, .quick a:hover, .result:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 2px 4px rgba(28,38,34,.06), 0 14px 30px rgba(28,38,34,.10); }
}
/* بطاقة الوقت الحالي: أوضح بلون وظل، ونبضة هادئة واحدة عند الفتح */
.session.now {
  border-color: var(--brand); border-width: 2px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 11%, var(--card)) 0%, var(--card) 70%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), 0 12px 28px color-mix(in srgb, var(--brand) 22%, transparent);
  animation: nowPulse 1.6s ease-out .3s 1;
}
.session.now b { color: var(--brand); }
@keyframes nowPulse {
  0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), 0 12px 28px color-mix(in srgb, var(--brand) 22%, transparent); }
  45% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--brand) 4%, transparent), 0 12px 28px color-mix(in srgb, var(--brand) 22%, transparent); }
  100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), 0 12px 28px color-mix(in srgb, var(--brand) 22%, transparent); }
}
.session.now::before { content: "الآن"; position: absolute; top: 12px; inset-inline-end: 12px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 999px; }
.meter { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-top: auto; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: inherit; width: 0; transition: width .3s; }

.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; gap: 8px; }
.section-h h2 { margin: 0; font-size: 19px; }
.section-h a { font-size: 14px; font-weight: 600; text-decoration: none; }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick a {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.35;
}
.quick a span.n { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: 14px; }

.daily { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.daily .dtext { font-family: var(--quran); font-size: calc(var(--dhikr-size) - 2px); line-height: 2; margin: 6px 0 10px; }
.daily .dlabel { color: var(--gold); font-weight: 700; font-size: 14px; }

.streak { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.streak span { width: 30px; height: 30px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; font-size: 11px; color: var(--ink-3); }
.streak span.m { background: color-mix(in srgb, var(--gold) 35%, var(--bg-2)); color: var(--ink); }
.streak span.e { background: color-mix(in srgb, var(--brand) 35%, var(--bg-2)); color: var(--ink); }
.streak span.me { background: var(--brand); color: var(--brand-ink); }

/* قائمة الأبواب */
.groups { display: grid; gap: 18px; }
.group h3 { margin: 0 2px 8px; font-size: 16px; color: var(--gold); }
.chlist { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chlist li + li { border-top: 1px solid var(--line); }
.chlist a { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; color: var(--ink); }
.chlist a:hover { background: var(--bg-2); }
.chlist .num { flex: none; min-width: 34px; height: 34px; padding: 0 4px; border-radius: 10px; background: var(--bg-2); color: var(--ink-2); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.chlist .t { flex: 1; font-weight: 600; }
.chlist .c { color: var(--ink-3); font-size: 13px; flex: none; }

/* صفحة الباب والأذكار */
.page-h { margin: 8px 2px 14px; }
.page-h .crumb { font-size: 14px; color: var(--ink-3); }
.page-h .crumb a { text-decoration: none; }
.page-h h1 { margin: 2px 0 0; font-size: clamp(24px, 5vw, 32px); line-height: 1.35; font-family: var(--quran); }
.page-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 15px; min-height: 44px;
}
.btn .i { width: 20px; height: 20px; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.soft { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: default; }

.progress-sticky {
  position: sticky; top: 68px; z-index: 5; margin: 0 -16px 12px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-2);
}
@media (max-width: 639px) { .progress-sticky { top: 118px; } }
.progress-sticky .meter { flex: 1; margin: 0; height: 8px; }

.dhikr {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; margin-bottom: 14px;
  box-shadow: var(--shadow); transition: opacity .25s, border-color .25s;
}
.dhikr.done { opacity: .62; border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.dhikr.playing { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.dhikr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: 13px; }
.dhikr-head .no { font-weight: 700; color: var(--gold); }
.dhikr-text { font-family: var(--quran); font-size: var(--dhikr-size); line-height: 2.05; margin: 10px 0 6px; white-space: pre-line; word-spacing: .04em; }
.dhikr-text .q { color: var(--brand); }
.dhikr-text .note { font-family: var(--ui); font-size: .62em; color: var(--ink-2); }
.dhikr-text .var { background: color-mix(in srgb, var(--gold) 12%, transparent); border-radius: 6px; padding: 0 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.lead { text-align: center; margin: 0 0 14px; padding: 4px 12px 10px; }
.lead .dhikr-text { color: var(--brand); margin: 0; }
.dhikr-variant { margin: 4px 0 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; color: var(--ink-2); }
.dhikr-variant b { color: var(--ink); }
.dhikr-src { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.platform-note { border-top: 0; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); font-style: italic; }
.dhikr-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tool { border: 1px solid var(--line); background: transparent; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.tool.on { color: var(--gold); border-color: var(--gold); }
.tool.playing { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.tool:disabled { opacity: .35; cursor: default; }
.spacer { flex: 1; }
/* العدّاد الدائري */
.counter {
  position: relative; width: 84px; height: 84px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--brand) 10%, var(--card)); color: var(--brand);
  display: grid; place-items: center; align-content: center; gap: 0; flex: none;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: transform .08s, background-color .2s;
}
.counter:active { transform: scale(.93); }
.counter .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.counter .ring circle { fill: none; stroke-width: 3.2; }
.counter .ring .trk { stroke: color-mix(in srgb, var(--brand) 18%, transparent); }
.counter .ring .bar { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .25s ease; }
.counter .cnum { position: relative; font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.counter small { position: relative; font-weight: 600; font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.counter.done { background: var(--ok); color: #fff; }
.counter.done .ring { display: none; }
.counter.done small { color: #fff; }
.counter .i { width: 30px; height: 30px; }
/* الضغط على البطاقة للعدّ: استجابة بصرية خفيفة */
.dhikr { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.dhikr.tick { animation: tick .35s ease-out; }
.dhikr.finish { animation: finish .45s ease-out; }
@keyframes tick { 0% { background: color-mix(in srgb, var(--brand) 9%, var(--card)); } 100% { background: var(--card); } }
@keyframes finish { 0% { transform: scale(1); } 40% { transform: scale(1.015); border-color: var(--ok); } 100% { transform: scale(1); } }
.tap-hint { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); background: var(--gold-soft); border-radius: 12px; padding: 8px 12px; margin: 0 0 12px; }
.tap-hint button { margin-inline-start: auto; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; }
/* أزرار حجم الخط */
.font-tools { display: inline-flex; gap: 4px; flex: none; }
.font-tools button { min-width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 700 15px var(--ui); cursor: pointer; padding: 0 8px; }
.font-tools button:active { transform: scale(.94); }
.font-tools button:disabled { opacity: .4; cursor: default; }

/* التذكير حسب الصلاة */
.remind-card { position: relative; display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; padding: 16px 18px; border-radius: var(--radius); background: color-mix(in srgb, var(--brand) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line)); }
.remind-card > div:first-of-type { display: flex; flex-direction: column; gap: 2px; padding-inline-end: 24px; }
.remind-card b { font-size: 17px; }
.remind-card span { color: var(--ink-2); font-size: 14px; }
.remind-card .page-tools { margin: 0; }
.remind-card .x { position: absolute; top: 8px; inset-inline-end: 10px; border: 0; background: transparent; font-size: 22px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 6px; }
.field.mode-field { flex-direction: column; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--card)); }
.radio input { margin-top: 5px; accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.radio span { display: flex; flex-direction: column; }
.radio small { color: var(--ink-3); font-size: 13px; }
.city-row { display: flex; gap: 8px; flex: 1 1 260px; }
.city-row .btn { flex: none; }
.city-row select { flex: 1; min-width: 0; }
.today-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 0 12px; }
.today-times > div { background: var(--bg-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.today-times span { font-size: 13px; color: var(--ink-2); }
.today-times b { font-size: 22px; color: var(--brand); font-variant-numeric: tabular-nums; }
.today-times small { font-size: 12px; color: var(--ink-3); }
/* «شارك الأجر» */
.share-card {
  display: flex; align-items: center; gap: 14px; margin: 14px 0 0; padding: 16px 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 16%, var(--card)), var(--card) 75%); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
}
.share-card > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.share-card b { font-size: 17px; color: var(--ink); }
.share-card span { font-size: 14px; color: var(--ink-2); }
.share-card .btn { flex: none; background: var(--gold); border-color: var(--gold); color: #241a05; }
.share-ask { font-weight: 600; color: var(--gold); margin: 12px 0 8px; }
.share-text { white-space: pre-line; background: var(--bg-2); border-radius: 12px; padding: 14px; font-size: 15px; line-height: 1.9; margin-bottom: 12px; }
.invite { position: relative; display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; padding: 18px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--gold); box-shadow: var(--shadow); }
.invite b { font-size: 18px; }
.invite span { color: var(--ink-2); }
.invite .btn { align-self: flex-start; margin-top: 6px; background: var(--gold); border-color: var(--gold); color: #241a05; }
.invite .x { position: absolute; top: 8px; inset-inline-end: 10px; border: 0; background: transparent; font-size: 22px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 6px; }
@media (max-width: 480px) { .share-card { flex-direction: column; align-items: stretch; text-align: center; } }
.session-end { text-align: center; padding: 26px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.session-end h2 { font-family: var(--quran); margin: 0 0 6px; font-size: 28px; }

/* البحث */
.results { display: grid; gap: 10px; }
.result { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.result:hover { border-color: var(--brand); }
.result .rt { font-weight: 700; }
.result .rs { color: var(--ink-2); font-family: var(--quran); font-size: 18px; line-height: 1.9; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result .rk { font-size: 12px; color: var(--gold); font-weight: 700; }
.result mark { background: var(--gold-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 16px; }

/* البطاقات العامة والنماذج */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel p { margin: 6px 0; color: var(--ink-2); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.field:first-of-type { border-top: 0; }
.field label { font-weight: 600; }
.field small { display: block; color: var(--ink-3); font-weight: 400; font-size: 13px; }
input[type="time"], select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { inset-inline-start: 21px; }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); color: var(--ink); font-size: 14px; margin: 10px 0; }
.notice.bad { background: color-mix(in srgb, var(--danger) 15%, var(--card)); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--brand); }
.prose { font-size: 16px; color: var(--ink); }
.prose p { color: var(--ink); }
.prose .intro { font-family: var(--quran); font-size: calc(var(--dhikr-size) - 4px); line-height: 2; white-space: pre-line; }
.dedication { text-align: center; padding: 26px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--gold); margin-bottom: 14px; }
.dedication .ttl { font-family: var(--quran); font-size: 26px; color: var(--brand); margin: 8px 0; }
.dedication .du { font-family: var(--quran); font-size: 21px; line-height: 2; }
.credits { font-size: 14px; color: var(--ink-2); }
.credits li { margin: 4px 0; }
footer.site { text-align: center; color: var(--ink-3); font-size: 13px; padding: 26px 16px 8px; }
footer.site a { color: inherit; }

/* البحث الصوتي */
.voice-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(4, 20, 15, .55); display: grid; place-items: end center; padding: 16px; backdrop-filter: blur(4px); }
.voice-card { width: min(520px, 100%); background: var(--card); border-radius: 26px; padding: 26px 20px 20px; text-align: center; box-shadow: var(--shadow); margin-bottom: env(safe-area-inset-bottom); }
.voice-card h2 { margin: 12px 0 4px; font-size: 20px; }
.voice-live { color: var(--ink-2); min-height: 3.4em; font-size: 17px; margin: 0 0 14px; }
.voice-orb { position: relative; width: 84px; height: 84px; margin: 0 auto; display: grid; place-items: center; color: var(--brand-ink); }
.voice-orb span { position: absolute; inset: 0; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-in-out infinite; }
.voice-orb .i { position: relative; width: 34px; height: 34px; }
@keyframes pulse { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 50% { transform: scale(1.06); box-shadow: 0 0 0 18px transparent; } }
@media (min-width: 640px) { .voice-sheet { place-items: center; } }

/* المشغّل */
.player {
  position: fixed; inset-inline: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 40; margin: 0 auto; max-width: 980px;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.08); padding: 8px 12px 10px;
  border-radius: 18px 18px 0 0;
}
.player-row { display: flex; align-items: center; gap: 6px; }
.pbtn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.pbtn.on { color: var(--gold); }
.pbtn.play { background: var(--brand); color: var(--brand-ink); width: 48px; height: 48px; border-radius: 50%; }
.pinfo { flex: 1; min-width: 0; }
.ptitle { display: block; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.pmeta { display: flex; gap: 8px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
#pCount { color: var(--gold); font-weight: 700; }
.ptrack { position: relative; height: 18px; margin-top: 6px; }
.ptrack::before, .pfill, .pseg { content: ""; position: absolute; top: 7px; height: 4px; border-radius: 4px; }
.ptrack::before { left: 0; right: 0; background: var(--bg-2); }
.pfill { left: 0; background: var(--brand); width: 0; }
.pseg { background: color-mix(in srgb, var(--gold) 70%, transparent); height: 8px; top: 5px; display: none; }
.ptrack input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ppanel { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; max-height: 50vh; overflow: auto; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 0; flex-wrap: wrap; }
.plabel { font-size: 13px; color: var(--ink-3); min-width: 76px; font-weight: 600; }
.chips, .seg-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600; min-height: 36px; color: var(--ink); }
.chip[aria-checked="true"], .chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.ghost { background: transparent; color: var(--ink-2); }
.chip input { width: 54px; border: 0; background: transparent; font: inherit; color: inherit; text-align: center; padding: 0; }

/* الشريط السفلي */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.tabbar a.on { color: var(--brand); }
@media (min-width: 960px) {
  :root { --tabbar-h: 0px; }
  .tabbar { display: none; }
  .player { bottom: 16px; border-radius: 18px; border: 1px solid var(--line); }
  .sessions { grid-template-columns: repeat(4, 1fr); }
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--player-h) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 70; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media print {
  .topbar, .tabbar, .player, .dhikr-foot, .page-tools, .progress-sticky { display: none !important; }
  body { background: #fff; padding: 0; }
  .dhikr { box-shadow: none; break-inside: avoid; }
}
