@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;

  /* Color */
  --primary-rgb: 31, 92, 72;
  --accent-rgb: 181, 138, 58;
  --primary: #1f5c48;
  --primary-light: #32745d;
  --primary-strong: #164535;
  --primary-soft: rgba(var(--primary-rgb), 0.09);
  --accent: #b58a3a;
  --accent-strong: #876326;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-variant: #eee7da;
  --surface-raised: #ffffff;
  --surface-translucent: rgba(255, 253, 248, 0.92);
  --glass-surface: rgba(255, 253, 248, 0.84);
  --glass-highlight: rgba(255, 255, 255, 0.72);
  --surface-faint: rgba(255, 255, 255, 0.56);
  --text: #252822;
  --text-secondary: #60665d;
  --text-muted: #7b8177;
  --border: rgba(var(--primary-rgb), 0.16);
  --border-strong: rgba(var(--primary-rgb), 0.3);
  --divider: #e3dccf;
  --success: #2f7658;
  --success-soft: rgba(47, 118, 88, 0.12);
  --error: #a94442;
  --error-soft: rgba(169, 68, 66, 0.1);
  --arabic-text: #193d31;
  --on-primary: #ffffff;
  --overlay: rgba(20, 24, 21, 0.66);
  --focus-ring: rgba(var(--primary-rgb), 0.34);
  --share-surface: #1d241f;
  --share-text: #f5f1e7;
  --share-muted: rgba(245, 241, 231, 0.58);

  /* Typography */
  --font-interface: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-arabic: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --leading-tight: 1.3;
  --leading-body: 1.65;
  --leading-arabic: 2.05;

  /* Spacing and sizing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --touch-target: 44px;
  --content-width: 720px;
  --reader-width: 760px;

  /* Shape, depth and motion */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --radius: var(--radius-lg);
  --shadow-sm: 0 1px 2px rgba(34, 42, 36, 0.06);
  --shadow: 0 8px 28px rgba(34, 42, 36, 0.08);
  --shadow-md: 0 12px 36px rgba(34, 42, 36, 0.1);
  --shadow-lg: 0 18px 52px rgba(34, 42, 36, 0.14);
  --duration-fast: 160ms;
  --duration-normal: 220ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --primary-rgb: 119, 184, 155;
  --accent-rgb: 209, 173, 103;
  --primary: #77b89b;
  --primary-light: #a7d5c0;
  --primary-strong: #5d9e81;
  --primary-soft: rgba(var(--primary-rgb), 0.12);
  --accent: #d1ad67;
  --accent-strong: #e0c484;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --bg: #181b19;
  --surface: #212622;
  --surface-variant: #2a312c;
  --surface-raised: #292f2b;
  --surface-translucent: rgba(33, 38, 34, 0.92);
  --glass-surface: rgba(30, 36, 32, 0.84);
  --glass-highlight: rgba(255, 255, 255, 0.1);
  --surface-faint: rgba(255, 255, 255, 0.06);
  --text: #f1efe8;
  --text-secondary: #c5c8bf;
  --text-muted: #9da39a;
  --border: rgba(220, 230, 222, 0.12);
  --border-strong: rgba(220, 230, 222, 0.24);
  --divider: #343a35;
  --success: #79bc99;
  --success-soft: rgba(121, 188, 153, 0.14);
  --error: #e38b86;
  --error-soft: rgba(227, 139, 134, 0.12);
  --arabic-text: #f2ead6;
  --on-primary: #10291f;
  --overlay: rgba(8, 10, 9, 0.74);
  --focus-ring: rgba(var(--primary-rgb), 0.48);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 52px rgba(0, 0, 0, 0.38);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-interface);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: var(--leading-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

:where(button, input, select, a, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

::selection {
  color: var(--text);
  background: var(--accent-soft);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 500;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--on-primary);
  background: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-160%);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ===== TRANSITIONS ===== */
.card, .hadith-card, .chapter-item, .action-btn, .nav-item, .hadith-fav-btn {
  transition: transform var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard),
              background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard);
}

/* ===== HEADER ===== */
.header {
  background: var(--surface);
  padding: calc(var(--space-3) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-3);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid var(--border);
}

[data-theme="dark"] .header {
  background: var(--surface);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--content-width);
  margin: 0 auto;
}

.header h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.header-arabic {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
  direction: ltr;
  unicode-bidi: isolate;
}

.header-actions { display: flex; gap: 6px; }

.header-btn {
  background: var(--primary-soft);
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast);
}

.header-btn svg,
.search-clear svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-btn:active { transform: scale(0.9); background: var(--border); }

/* ===== SEARCH ===== */
.search-bar {
  padding: 8px 16px 10px;
  background: var(--surface);
  position: sticky;
  top: 56px;
  z-index: 90;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-variant);
  border-radius: 16px;
  padding: 0 14px;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  max-width: var(--content-width);
  min-height: var(--touch-target);
  margin: 0 auto;
}

.search-input-wrap:focus-within {
  border-color: rgba(var(--primary-rgb), 0.28);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

[data-theme="dark"] .search-input-wrap:focus-within {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.search-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-right: var(--space-2);
  color: var(--text-muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
  display: none;
  transition: opacity 0.15s;
}

.search-clear.visible { display: block; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-1) max(var(--space-1), env(safe-area-inset-right, 0px))
    max(var(--space-1), env(safe-area-inset-bottom, 0px))
    max(var(--space-1), env(safe-area-inset-left, 0px));
  z-index: 100;
  box-shadow: 0 -4px 18px rgba(34, 42, 36, 0.05);
}

[data-theme="dark"] .bottom-nav {
  background: var(--surface);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 20%;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 0;
  min-height: 58px;
  position: relative;
}

.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}
.nav-item .nav-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.nav-item:active .nav-icon { transform: scale(0.85); }

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-brand { display: none; }

.global-player {
  position: fixed;
  z-index: 96;
  top: calc(72px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  max-width: 696px;
  margin: auto;
  padding: 12px 14px 11px;
  border: 1px solid var(--glass-highlight);
  border-radius: 18px;
  background: var(--glass-surface);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 14px 38px rgba(18, 29, 23, .22);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  backdrop-filter: blur(20px) saturate(135%);
}
.global-player[hidden] { display: none; }
.global-player-head { display: grid; grid-template-columns: auto minmax(0,1fr) 34px 34px; align-items: center; gap: 9px; }
.global-player-kind { padding: 4px 8px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary); font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.global-player-copy { min-width: 0; display: grid; line-height: 1.25; }
.global-player-copy strong,
.global-player-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-player-copy strong { font-size: .8rem; }
.global-player-copy small { color: var(--text-muted); font-size: .66rem; }
.global-player-head button { width: 34px; height: 34px; min-width: 34px; min-height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface-faint); color: var(--text-secondary); cursor: pointer; }
.global-player-head svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.global-player-progress { width: 100%; height: 18px; margin: 6px 0 1px; accent-color: var(--primary); cursor: pointer; }
.global-player-controls { display: grid; grid-template-columns: 42px 36px 44px 36px 42px 42px; align-items: center; justify-content: space-between; gap: 5px; }
.global-player-controls button { width: 36px; height: 36px; min-width: 36px; min-height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; font-size: 1.35rem; }
.global-player-controls .global-player-play { width: 44px; height: 44px; min-width: 44px; min-height: 44px; background: var(--primary); color: var(--on-primary); }
.global-player-play svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.global-player-play svg .icon-fill { fill: currentColor; stroke: none; }
.global-player-controls .global-player-speed { width: 42px; border-radius: var(--radius-pill); background: var(--surface-faint); color: var(--primary); font-size: .7rem; font-weight: 750; }
.global-player-time { color: var(--text-muted); font-size: .62rem; font-variant-numeric: tabular-nums; text-align: center; }
body.has-global-player main { padding-top: 132px; }
body.has-global-player .sharh-player-dock,
body.has-global-player .chapter-sharh-player { display: none; }

@media (min-width: 768px) {
  .global-player { top: 76px; }
}

@media (min-width: 1024px) {
  .global-player { left: calc(260px + 50%); right: auto; width: min(696px, calc(100vw - 300px)); transform: translateX(-50%); }
}

/* ===== PAGES ===== */
.page {
  display: none;
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  min-height: calc(100vh - 56px);
}

.page.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HOME HERO ===== */
.home-hero {
  background: var(--surface);
  padding: 28px 20px 24px;
  text-align: center;
  border-bottom: 0.5px solid var(--border);
}

.home-hero-arabic {
  font-family: var(--font-ui);
  font-size: 1.55rem;
  color: var(--primary);
  direction: ltr;
  margin-bottom: 4px;
  line-height: var(--leading-tight);
}

.home-hero-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.home-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
}

.library-grid {
  display: grid;
  gap: 10px;
  padding: 6px 16px 10px;
}

.wird-card {
  width: calc(100% - 32px);
  min-width: 0;
  margin: 16px 16px 8px;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--surface), var(--primary-soft));
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.wird-card > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.wird-card strong { font-size: .9rem; }
.wird-card small { color: var(--text-muted); font-size: .74rem; }
.wird-card > b { color: var(--primary); font-size: 1.4rem; font-weight: 400; }
.wird-ring {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 14px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--wird-progress), var(--surface-variant) 0);
  color: var(--text);
  isolation: isolate;
}
.wird-ring::before { content: ''; position: absolute; inset: 5px; z-index: -1; border-radius: 50%; background: var(--surface); }
.wird-ring b { font-size: .9rem; }
.wird-ring small { font-size: .62rem; }
.wird-card.is-complete { border-color: var(--primary); }

.library-category,
.collection-feature-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.library-category > span:nth-child(2),
.collection-feature-card > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.library-category strong,
.collection-feature-card strong { font-size: .9rem; }
.library-category small,
.collection-feature-card small { color: var(--text-muted); font-size: .74rem; line-height: 1.4; }
.library-category > b,
.collection-feature-card > b { color: var(--primary); font-size: 1.45rem; font-weight: 400; }
.library-category-icon,
.collection-feature-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.1rem;
}
.library-category.is-ready { border-color: var(--border-strong); box-shadow: inset 3px 0 0 var(--primary); }
.collection-feature-card { margin: 6px 16px 14px; width: calc(100% - 32px); padding-block: 17px; }
.collection-feature-mark { font-family: var(--font-arabic); font-size: 1.35rem; background: var(--accent-soft); color: var(--accent-strong); }
.collection-feature-card em { min-width: 0; max-width: 100%; overflow: hidden; color: var(--arabic-text); font-family: var(--font-arabic); font-size: .85rem; font-style: normal; text-align: right; direction: rtl; white-space: nowrap; text-overflow: ellipsis; }

.collection-shelf-card,
.volume-card {
  width: calc(100% - 32px);
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 16px 10px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  box-shadow: var(--shadow-sm);
}
.collection-shelf-card.is-ready,
.volume-card { cursor: pointer; box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm); }
.collection-shelf-card.is-planned { opacity: .68; }
.collection-shelf-mark,
.volume-card-number {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-arabic);
  font-size: 1.3rem;
  font-weight: 700;
}
.volume-card-number { font-family: inherit; }
.collection-shelf-copy,
.volume-card-copy { min-width: 0; display: grid; gap: 3px; }
.collection-shelf-copy strong,
.volume-card-copy strong { font-size: .92rem; line-height: 1.3; }
.collection-shelf-copy > span { color: var(--arabic-text); font-family: var(--font-arabic); font-size: .9rem; line-height: 1.45; text-align: right; }
.collection-shelf-copy small,
.volume-card-copy small { color: var(--text-muted); font-size: .72rem; line-height: 1.4; }
.collection-shelf-card > b,
.volume-card > b { color: var(--primary); font-size: 1.5rem; font-weight: 400; }
.collection-shelf-card > em,
.volume-card-copy em { padding: 4px 8px; border-radius: var(--radius-pill); background: var(--surface-faint); color: var(--text-muted); font-size: .64rem; font-style: normal; white-space: nowrap; }
.volume-card-copy em { justify-self: start; background: var(--primary-soft); color: var(--primary); }

.library-section-head { padding: 22px 18px 8px; }
.library-section-head > p { margin: 22px 0 4px; color: var(--primary); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.library-section-head h2 { margin: 0 0 8px; font-size: 1.65rem; line-height: 1.2; }
.library-section-head > div { color: var(--text-secondary); font-size: .9rem; }
.library-source-card { margin: 16px; padding: 16px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.library-source-card > span:nth-child(2) { display: grid; min-width: 0; }
.library-source-card small { color: var(--text-muted); }
.library-source-card a { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 700; text-decoration: none; }
.library-source-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); }
.library-empty-card { margin: 16px; padding: 28px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--text-secondary); text-align: center; }
.library-empty-card > span { display: block; margin-bottom: 8px; color: var(--accent); font-size: 1.5rem; }
.library-empty-card strong { display: block; color: var(--text); }
.library-empty-card p { margin-top: 6px; font-size: .8rem; }

.stat-item { text-align: center; }

.stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  display: block;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ===== SECTION ===== */
.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 18px 16px 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#chapters-title,
#hadiths-title {
  text-transform: none;
  letter-spacing: normal;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.inline-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  margin: var(--space-3) var(--space-4);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
}

.inline-search svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.inline-search input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: none;
  margin: 0 16px 12px;
  padding: 17px 18px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.card:active { transform: scale(0.98); box-shadow: var(--shadow); }

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-info { flex: 1; min-width: 0; }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
  line-height: var(--leading-tight);
}

.card-title-ar {
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  color: var(--arabic-text);
  margin-bottom: 2px;
  font-weight: 500;
  line-height: 1.4;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.card-meta {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== BOOK NUM ===== */
.book-num {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
  line-height: 1;
  padding-top: 2px;
}

.book-sharh-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin: 0 16px 12px;
  padding: 14px 16px;
}

.book-sharh-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--divider);
}

.book-sharh-title {
  font-family: var(--font-arabic);
  font-size: 1rem;
  color: var(--arabic-text);
  direction: rtl;
  text-align: right;
  line-height: 1.3;
}

.book-sharh-title-ru {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.book-sharh-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.book-sharh-toggle,
.book-sharh-play,
.book-sharh-timecode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  min-height: 38px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.book-sharh-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.book-sharh-toggle:hover:not(:disabled),
.book-sharh-play:hover,
.book-sharh-timecode-btn:hover {
  background: var(--accent-soft);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.book-sharh-text {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-variant);
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
  direction: rtl;
  text-align: right;
  line-height: var(--leading-arabic);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-arabic);
  color: var(--arabic-text);
}

.book-sharh-player {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.book-sharh-current {
  font-weight: 600;
  color: var(--text);
}

.book-sharh-timecodes {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.book-sharh-timecodes-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.book-sharh-timecode-btn {
  width: 100%;
  text-align: left;
}

.book-sharh-timecode-btn span {
  font-weight: 600;
}

.book-sharh-text[hidden],
.book-sharh-player[hidden] {
  display: none !important;
}

.sharh-transcript-notice {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--surface));
  color: var(--text-secondary);
  font-size: .78rem;
  line-height: 1.45;
}
.sharh-transcript-notice strong { color: var(--text); font-size: .82rem; }

.sharh-pdf-viewer {
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 154px;
}
.sharh-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.sharh-pdf-toolbar strong { font-size: .86rem; }
.sharh-pdf-toolbar span { color: var(--text-muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.sharh-pdf-frame {
  position: relative;
  min-height: 360px;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 10px;
  background: #d6d5d0;
  touch-action: pan-y;
}
.sharh-pdf-frame[aria-busy="true"] { place-items: center; }
.sharh-pdf-frame[aria-busy="true"]::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(31, 92, 72, .18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: pdf-spin .8s linear infinite;
}
@keyframes pdf-spin { to { transform: rotate(360deg); } }
.sharh-pdf-frame canvas {
  display: block;
  max-width: 100%;
  background: #fff;
  box-shadow: 0 8px 26px rgba(18, 29, 23, .18);
}
.sharh-pdf-controls {
  display: grid;
  grid-template-columns: 46px 1fr 1fr 46px;
  align-items: center;
  gap: 8px;
  padding: 10px;
}
.sharh-pdf-controls button,
.sharh-pdf-controls a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-faint);
  color: var(--primary);
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  text-decoration: none;
}
.sharh-pdf-controls button { font-size: 1.45rem; cursor: pointer; }
.sharh-pdf-controls button:disabled { opacity: .34; cursor: default; }

/* ===== CHAPTER LIST ===== */
.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 15px 18px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--divider);
  cursor: pointer;
}

.chapter-item:active { background: var(--surface-variant); }

.chapter-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 30px;
  text-align: center;
}

.chapter-info { flex: 1; min-width: 0; }

.chapter-title-ar {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  font-size: 1.05rem;
  color: var(--arabic-text);
  margin-bottom: 2px;
  font-weight: 500;
}

.chapter-title-ru {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== HADITH CARD ===== */
.hadith-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: none;
  margin: 0 16px 12px;
  padding: 18px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.hadith-card:active { transform: scale(0.985); box-shadow: var(--shadow); }

.hadith-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-variant);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hadith-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hadith-card-head > span { color: var(--text-muted); font-size: .68rem; }

.hadith-arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  line-height: var(--leading-arabic);
  color: var(--arabic-text);
  margin-bottom: 10px;
  word-break: break-word;
}

.hadith-russian {
  font-size: 0.92rem;
  line-height: var(--leading-body);
  color: var(--text);
  margin-bottom: 8px;
}

.hadith-russian b,
.prophet-quote {
  font-weight: 700;
  color: var(--text);
}

.hadith-arabic .prophet-quote-ar,
.hadith-detail-arabic .prophet-quote-ar {
  font-family: inherit;
  font-weight: 700;
  color: var(--arabic-text);
}

.hadith-detail-russian .prophet-quote {
  color: var(--primary-strong);
}

[data-theme="dark"] .hadith-detail-russian .prophet-quote {
  color: var(--primary-light);
}

.hadith-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 0.5px solid var(--divider);
  gap: 8px 12px;
  flex-wrap: wrap;
}

.hadith-location {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.hadith-footer-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-inline-start: auto;
}

.hadith-grading {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--text);
}

.hadith-grading.weak {
  background: var(--error-soft);
  color: var(--error);
}

.hadith-source {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

.hadith-source-link,
.hadith-source-text {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 450;
  line-height: 1.45;
  text-decoration: none;
}

.hadith-source-link { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.hadith-source-link.compact,
.hadith-source-text.compact { font-size: 0.64rem; opacity: .82; }

.hadith-grading-text {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.6;
}
.grading-source-link { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }

/* ===== SEARCH & SAVED ===== */
.search-history {
  padding: var(--space-4);
}

.search-hint,
.results-limit {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

.search-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 650;
}

.search-history-heading button {
  min-height: var(--touch-target);
  padding: 0 var(--space-2);
  border: 0;
  background: transparent;
  color: var(--primary-light);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
}

[data-theme="light"] .search-history-heading button { color: var(--primary); }

.search-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.search-history-chips button {
  min-height: var(--touch-target);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
}

.results-limit {
  margin: var(--space-4);
  text-align: center;
}

.saved-summary {
  padding: var(--space-5) var(--space-4) var(--space-3);
}

.saved-summary h2 {
  margin: 0;
  font-size: var(--text-xl);
}

.saved-summary p {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1);
  margin: 0 var(--space-4);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  background: var(--surface-variant);
}

.segment {
  min-height: var(--touch-target);
  padding: 0 var(--space-2);
  border: 0;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 650;
}

.segment span {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  margin-left: var(--space-1);
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.segment.active {
  background: var(--surface);
  color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .segment.active { color: var(--primary); }

.saved-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  margin: var(--space-3) var(--space-4) var(--space-4);
}

.saved-toolbar input,
.saved-toolbar select {
  min-width: 0;
  min-height: var(--touch-target);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  outline: 0;
}

.saved-card-head,
.saved-card-head > div {
  display: flex;
  align-items: center;
}

.saved-card-head {
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.saved-card-head > div { gap: var(--space-2); min-width: 0; }

.saved-location {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-remove {
  display: grid;
  width: var(--touch-target);
  height: var(--touch-target);
  flex: 0 0 var(--touch-target);
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-light);
  cursor: pointer;
}

[data-theme="light"] .saved-remove { color: var(--primary); }

.saved-remove svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.saved-card .hadith-arabic,
.saved-card .hadith-russian {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.saved-card .hadith-arabic { -webkit-line-clamp: 3; }
.saved-card .hadith-russian { -webkit-line-clamp: 4; }

.hadith-fav-btn {
  display: grid;
  width: var(--touch-target);
  height: var(--touch-target);
  place-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--text-muted);
}

.hadith-fav-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hadith-fav-btn.active { color: var(--error); }
.hadith-fav-btn.active svg { fill: currentColor; }

@keyframes heartPulse {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.hadith-fav-btn.pulse,
.action-btn.pulse {
  animation: heartPulse 0.35s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}

/* ===== HADITH DETAIL ===== */
.hadith-detail { padding: 16px; }

.hadith-detail-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}

.hadith-detail-arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  line-height: var(--leading-arabic);
  color: var(--arabic-text);
  margin-bottom: 16px;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.hadith-detail-russian {
  font-size: 0.95rem;
  line-height: var(--leading-body);
  color: var(--text);
  margin-bottom: 14px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hadith-detail-russian b {
  font-weight: 600;
}

.hadith-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.7rem;
  background: var(--surface-variant);
  color: var(--text-secondary);
  border: 0.5px solid var(--border);
}

.meta-source {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-muted);
  font-size: .7rem;
}
.meta-source small { opacity: .72; font-size: .64rem; }

.detail-actions {
  display: flex;
  gap: 6px;
  padding: 10px 0;
  border-top: 0.5px solid var(--divider);
}

.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 500;
}

.action-btn .action-icon { font-size: 1.05rem; }
.action-btn:hover { background: var(--surface-variant); border-color: var(--border); }
.action-btn:active { transform: scale(0.96); background: var(--accent-soft); }
.action-btn.fav-active { color: var(--error); border-color: var(--error); background: var(--error-soft); }

/* ===== READER ===== */
.hadith-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4) calc(92px + env(safe-area-inset-bottom, 0px));
}

.reader {
  display: grid;
  gap: var(--space-4);
}

.reader button svg,
.reading-settings button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-back {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: var(--space-1);
  min-height: var(--touch-target);
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
}

.reader-heading {
  text-align: center;
  padding: 0 var(--space-2) var(--space-2);
}

.reader-heading h2 {
  max-width: 620px;
  margin: var(--space-2) auto;
  color: var(--text);
  font-size: clamp(var(--text-lg), 4.5vw, var(--text-2xl));
  line-height: var(--leading-tight);
}

.reader-chapter-link {
  min-height: var(--touch-target);
  padding: var(--space-2);
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 650;
}

.reader-number {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: var(--text-sm);
  font-weight: 700;
}

.reader-heading-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.reader-favorite {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.reader-favorite svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.reader-favorite.active { border-color: color-mix(in srgb, var(--error) 30%, var(--border)); background: var(--error-soft); color: var(--error); }
.reader-favorite.active svg { fill: currentColor; }

.reader-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.reader-arabic-block {
  padding: clamp(var(--space-4), 5vw, var(--space-8));
}

.reader .hadith-detail-arabic {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-wrap: anywhere;
}

.audio-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  margin-top: var(--space-5);
  padding: 0 var(--space-4);
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-light);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 650;
}

[data-theme="light"] .audio-play-btn { color: var(--primary); }
.audio-play-btn.playing { background: var(--primary); color: var(--on-primary); }

.reader-translation {
  padding: clamp(var(--space-4), 5vw, var(--space-6));
}

.reader-translation h3 {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reader .hadith-detail-russian {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.reader .hadith-grading-text { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--divider); }

.reader-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.reader-context > span { min-width: 0; }
.reader-context small,
.reader-context strong,
.reader-context b { display: block; }
.reader-context small { color: var(--primary); font-size: var(--text-xs); }
.reader-context strong { margin-top: var(--space-1); font-size: var(--text-sm); }
.reader-context b {
  margin-top: var(--space-1);
  color: var(--arabic-text);
  font-family: var(--font-arabic);
  font-size: var(--text-base);
  font-weight: 400;
  text-align: right;
}

.reader-note {
  margin: calc(var(--space-4) * -1) var(--space-2) 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.reader-sharh-shortcut {
  width: 100%;
  min-height: 58px;
  margin-top: calc(var(--space-3) * -1);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  text-align: left;
  cursor: pointer;
}
.reader-sharh-shortcut > svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; }
.reader-sharh-shortcut > svg .icon-fill { fill: currentColor; stroke: none; }
.reader-sharh-shortcut > span { min-width: 0; display: grid; gap: 2px; }
.reader-sharh-shortcut strong { color: var(--text); font-size: .82rem; }
.reader-sharh-shortcut small { color: var(--text-muted); font-size: .72rem; }

.reader .hadith-detail-meta { margin: 0; }

.reader-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.reader-action {
  display: flex;
  min-width: 0;
  min-height: 70px;
  padding: var(--space-2);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
}

.reader-action.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-light);
}

[data-theme="light"] .reader-action.is-active { color: var(--primary); }
.reader-action span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.reader-pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--divider);
}

.reader-pagination button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 60px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 650;
  text-align: left;
}

.reader-pagination small {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.reader-pagination .reader-next {
  justify-content: flex-end;
  text-align: right;
}

/* ===== READING SETTINGS SHEET ===== */
.reading-settings {
  width: min(100% - var(--space-4), 520px);
  max-width: none;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.reading-settings::backdrop {
  background: rgba(12, 16, 14, 0.58);
  backdrop-filter: blur(3px);
}

.reading-settings form {
  padding: var(--space-2) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.sheet-header,
.sheet-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.sheet-header { min-height: 56px; }
.sheet-header h2 { margin: 0; font-size: var(--text-lg); }

.sheet-close {
  display: grid;
  place-items: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-variant);
  color: var(--text-secondary);
  cursor: pointer;
}

.sheet-setting {
  min-height: 64px;
  border-top: 1px solid var(--divider);
  font-size: var(--text-sm);
}

.sheet-setting output {
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-secondary);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-size: 0.9rem; margin-bottom: 4px; font-weight: 500; }
.empty-subtext { font-size: 0.78rem; opacity: 0.7; }

.loading-skeleton {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
}

.loading-skeleton span {
  display: block;
  height: 82px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, var(--surface-variant) 30%, var(--surface) 50%, var(--surface-variant) 70%);
  background-size: 220% 100%;
  animation: skeletonShift 1.2s ease-in-out infinite;
}

@keyframes skeletonShift {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ===== SETTINGS ===== */
.settings-group {
  margin: var(--space-4);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}

.settings-group-title {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.theme-choice {
  display: flex;
  min-width: 0;
  min-height: 86px;
  padding: var(--space-2);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-variant);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
}

.theme-choice.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-light);
  box-shadow: inset 0 0 0 1px var(--primary);
}

[data-theme="light"] .theme-choice.active { color: var(--primary); }

.theme-preview {
  width: 42px;
  height: 28px;
  border: 1px solid rgba(80, 86, 82, 0.3);
  border-radius: 7px;
  box-shadow: inset 10px 0 0 rgba(31, 92, 72, 0.85);
}

.theme-preview-light { background: #f6f1e7; }
.theme-preview-dark { background: #181b19; }
.theme-preview-system { background: linear-gradient(90deg, #f6f1e7 50%, #181b19 50%); }

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 58px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.setting-item:last-child { border-bottom: 0; }
.setting-label { font-size: var(--text-sm); }

.setting-item-button {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--divider);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.setting-item-button:active { opacity: .72; }
.setting-item-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: var(--radius-xs); }

.version-check-value {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-2);
}

.version-chevron {
  color: var(--text-muted);
  font-size: 1.45rem;
  font-weight: 300;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}

.setting-item-button.has-update .setting-label,
.setting-item-button.has-update .setting-value,
.setting-item-button.has-update .version-chevron { color: var(--primary-light); }

[data-theme="light"] .setting-item-button.has-update .setting-label,
[data-theme="light"] .setting-item-button.has-update .setting-value,
[data-theme="light"] .setting-item-button.has-update .version-chevron { color: var(--primary); }

.setting-item-button.is-checking .version-chevron { transform: rotate(90deg); color: var(--primary); }

.setting-desc {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-body);
}

.setting-value {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.settings-action {
  min-height: var(--touch-target);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary-light);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
}

[data-theme="light"] .settings-action { color: var(--primary); }
.settings-action:active { transform: scale(0.96); }

.settings-action.danger {
  border-color: color-mix(in srgb, var(--error) 35%, var(--border));
  background: var(--error-soft);
  color: var(--error);
}

.settings-danger-zone {
  border-color: color-mix(in srgb, var(--error) 26%, var(--border));
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 1px var(--border);
}

.status-dot[data-status="ready"] { background: var(--success); }
.status-dot[data-status="pending"] { background: var(--accent); }
.status-dot[data-status="offline"] { background: var(--error); }

.settings-select {
  min-height: 40px;
  max-width: 132px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-variant);
  color: var(--text);
  font: inherit;
  font-size: .8rem;
}

.home-resource-card {
  margin: 16px 16px 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}
.home-resource-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 1.1rem; }
.home-resource-icon.pdf { background: var(--accent-soft); color: var(--accent-strong); font-family: var(--font-interface); font-size: .66rem; font-weight: 800; letter-spacing: .03em; }
.home-pdf-card { margin-bottom: 10px; }
.home-resource-card > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.home-resource-card strong { font-size: .88rem; }
.home-resource-card small { color: var(--text-muted); font-size: .7rem; line-height: 1.4; }
.home-resource-card a { min-height: 38px; padding: 0 11px; display: inline-flex; align-items: center; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: .72rem; font-weight: 650; text-decoration: none; }

.settings-link {
  min-height: 62px;
  padding: 11px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  text-decoration: none;
}
.settings-link:last-child { border-bottom: 0; }
.settings-link[hidden] { display: none !important; }
.settings-link > span { min-width: 0; display: grid; gap: 3px; }
.settings-link strong { font-size: .86rem; font-weight: 620; }
.settings-link small { color: var(--text-muted); font-size: .7rem; line-height: 1.45; }
.settings-link b { color: var(--primary); font-size: 1rem; font-weight: 500; }

@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .header,
  .bottom-nav,
  .sharh-player-dock,
  .glass-panel {
    background: var(--glass-surface);
    border-color: var(--glass-highlight);
    backdrop-filter: blur(20px) saturate(118%);
    -webkit-backdrop-filter: blur(20px) saturate(118%);
  }
  .header,
  .bottom-nav,
  .sharh-player-dock { box-shadow: inset 0 1px 0 var(--glass-highlight), 0 8px 28px rgba(24, 38, 30, .10); }
}

.toggle {
  position: relative;
  width: 46px;
  height: var(--touch-target);
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  inset: 9px 0;
  border-radius: var(--radius-pill);
  background: var(--border);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px var(--focus-ring); }

.font-control {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.font-btn {
  display: flex;
  width: var(--touch-target);
  height: var(--touch-target);
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-sm);
}

.font-btn:active { transform: scale(0.9); }

.font-size-val {
  min-width: 32px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.confirm-dialog {
  width: min(calc(100% - var(--space-8)), 430px);
  max-width: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
  background: rgba(12, 16, 14, 0.6);
  backdrop-filter: blur(3px);
}

.confirm-dialog form { padding: var(--space-5); }

.confirm-dialog h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
}

.confirm-dialog p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--primary-light);
  text-decoration: none;
  cursor: pointer;
}

/* ===== CLICKABLE ===== */
.clickable { cursor: pointer; }
.clickable:active { transform: scale(0.98); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: var(--on-primary);
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .page {
    max-width: var(--content-width);
    margin: 0 auto;
  }

  .bottom-nav {
    max-width: var(--content-width);
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .hadith-detail {
    padding-top: var(--space-6);
  }

  .reader-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .reading-settings {
    margin: auto;
    border-radius: var(--radius-xl);
  }
}

@media (min-width: 1024px) {
  .header,
  .search-bar,
  main {
    margin-left: 260px;
  }

  .header {
    padding-inline: var(--space-8);
  }

  .header-top,
  .search-input-wrap {
    max-width: 960px;
  }

  .page {
    max-width: 960px;
    padding: 0 var(--space-6) var(--space-12);
  }

  .bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 260px;
    max-width: none;
    padding: var(--space-6) var(--space-4);
    transform: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: var(--space-1);
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 64px;
    margin-bottom: var(--space-6);
    padding: 0 var(--space-2);
    color: var(--text);
  }

  .nav-brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: var(--radius-md);
    font-family: var(--font-arabic);
    font-size: var(--text-xl);
    color: var(--on-primary);
    background: var(--primary);
  }

  .nav-brand strong,
  .nav-brand small {
    display: block;
  }

  .nav-brand strong {
    font-size: var(--text-sm);
    line-height: var(--leading-tight);
  }

  .nav-brand small {
    margin-top: 2px;
    font-family: var(--font-arabic);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .nav-item {
    flex: 0 0 auto;
    width: 100%;
    min-height: 52px;
    padding: 0 var(--space-4);
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
  }

  .nav-item:hover {
    color: var(--text);
    background: var(--surface-variant);
  }

  .nav-item.active {
    color: var(--primary-light);
    background: var(--primary-soft);
  }

  .nav-item.active::after {
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    height: auto;
    transform: none;
  }

  .nav-item .nav-icon {
    width: 22px;
    height: 22px;
  }

  .nav-label {
    white-space: normal;
  }
}

/* ===== SEARCH HIGHLIGHT ===== */
.search-hl {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 1px 2px;
  border-radius: 3px;
  font-weight: 600;
}

[data-theme="dark"] .search-hl {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ===== SHARE CARD (canvas overlay) ===== */
.share-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.share-card {
  background: var(--share-surface);
  border-radius: 18px;
  padding: 32px;
  width: min(100%, 400px);
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  border: 1px solid var(--surface-faint);
}

.share-card-arabic {
  font-family: var(--font-arabic);
  font-size: 22px;
  color: var(--share-text);
  line-height: var(--leading-arabic);
  direction: rtl;
  text-align: right;
  margin: 16px 0;
  padding: 16px;
  background: var(--surface-faint);
  border-radius: 12px;
}

.share-card-russian {
  font-size: 15px;
  color: var(--share-text);
  line-height: var(--leading-body);
  margin: 16px 0;
  padding: 16px;
  background: var(--surface-faint);
  border-radius: 12px;
}

.share-card-footer {
  color: var(--accent);
  font-size: 14px;
  margin-top: 12px;
}

.share-card-watermark {
  color: var(--share-muted);
  font-size: 12px;
  margin-top: 16px;
  letter-spacing: 2px;
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  justify-content: stretch;
}

.share-actions .share-btn-secondary { grid-column: 1 / -1; }

.share-btn {
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.share-btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-md);
}

.share-btn-secondary {
  background: var(--surface-faint);
  color: var(--share-text);
  border: 1px solid var(--share-muted);
}

/* ===== SHARH EXPERIENCE ===== */
.sharh-entry-card {
  width: calc(100% - 32px);
  margin: 0 16px 14px;
  padding: 16px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.sharh-entry-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font: 700 1.7rem/1 var(--font-arabic);
}

.sharh-entry-copy { min-width: 0; display: grid; gap: 2px; }
.sharh-entry-ar {
  font: 600 1.02rem/1.55 var(--font-arabic);
  color: var(--arabic-text);
  text-align: left;
  direction: rtl;
  justify-self: start;
}
.sharh-entry-title { font-size: .92rem; font-weight: 700; }
.sharh-entry-meta { color: var(--text-muted); font-size: .76rem; }
.sharh-entry-arrow { color: var(--primary); font-size: 1.8rem; }

.page-sharh {
  padding: 20px 16px calc(178px + env(safe-area-inset-bottom, 0px));
}

.sharh-reader-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.sharh-reader-back {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}
.sharh-reader-back svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sharh-reader-head > div { min-width: 0; }
.sharh-kicker { margin: 0 0 4px; color: var(--primary); font-size: .72rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.sharh-reader-head h2 { margin: 0; color: var(--arabic-text); font: 700 1.4rem/1.55 var(--font-arabic); text-align: right; }
.sharh-book-context { margin: 7px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--text-muted); font-size: .8rem; line-height: 1.45; }
.sharh-book-context span:last-child { font-family: var(--font-arabic); color: var(--text-secondary); }

.sharh-sections {
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.sharh-sections summary { min-height: 52px; padding: 13px 16px; cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.sharh-sections summary::-webkit-details-marker { display: none; }
.sharh-sections summary span { color: var(--primary); }
.sharh-sections-list { max-height: 280px; overflow: auto; border-top: 1px solid var(--divider); }
.sharh-sections-list button {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--divider);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.sharh-sections-list button:last-child { border-bottom: 0; }
.sharh-sections-list button.active { background: var(--primary-soft); }
.sharh-sections-list button.active time { color: var(--primary-strong); }
.sharh-sections-list time { min-width: 62px; color: var(--primary); font-variant-numeric: tabular-nums; font-weight: 700; }
.sharh-sections-list button span { flex: 1; font-family: var(--font-arabic); font-size: 1rem; text-align: right; line-height: 1.55; }

.sharh-reading-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
}
.sharh-reading-label {
  min-height: 48px;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .75rem;
}
.sharh-reading-label span:last-child { font-family: var(--font-arabic); color: var(--primary); }
.sharh-reading-text {
  padding: 24px 20px 32px;
  font-family: var(--font-arabic);
  color: var(--arabic-text);
  direction: rtl;
  text-align: right;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}
.sharh-reading-text p {
  width: 100%;
  margin: 0 0 .72em;
  padding: 2px 8px;
  border-radius: 10px;
  direction: rtl;
  unicode-bidi: isolate;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.sharh-reading-text p.is-section-active {
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset -3px 0 0 var(--accent);
}
.sharh-reading-text p.is-audio-active {
  color: var(--arabic-text);
  background: var(--primary-soft);
  box-shadow: inset -3px 0 0 var(--primary);
}
.sharh-reading-text p.is-section-active.is-audio-active {
  color: var(--primary);
  background: var(--accent-soft);
  box-shadow: inset -3px 0 0 var(--accent);
}

.sharh-player-dock {
  position: fixed;
  z-index: 90;
  left: 16px;
  right: 16px;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  max-width: 696px;
  margin: auto;
  padding: 12px 16px 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(25, 40, 31, 0.16);
}
.sharh-now-playing { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; margin-bottom: 8px; color: var(--text-secondary); font-size: .78rem; }
.sharh-now-playing-title { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.sharh-now-playing-title > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.sharh-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.sharh-follow-toggle {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-faint);
  color: var(--text-muted);
  font-size: .7rem;
  line-height: 1;
  cursor: pointer;
}
.sharh-follow-toggle.active { border-color: var(--border-strong); background: var(--primary-soft); color: var(--primary); }

.media-controls { display: flex; align-items: center; gap: 10px; }
.media-main-button,
.media-stop-button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}
.media-main-button { border: 0; background: var(--primary); color: var(--on-primary); box-shadow: none; }
.media-stop-button { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); }
.media-main-button svg, .media-stop-button svg, .chapter-sharh-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.media-main-button svg .icon-fill,
.media-stop-button svg .icon-fill { fill: currentColor; stroke: none; }
.media-main-button:disabled, .media-stop-button:disabled { opacity: .45; cursor: not-allowed; }
.media-timeline { min-width: 0; flex: 1; }
.media-timeline input { width: 100%; height: 24px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.media-time { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .7rem; font-variant-numeric: tabular-nums; }

.chapter-sharh-player {
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.chapter-sharh-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chapter-sharh-heading > span:last-child { min-width: 0; display: grid; gap: 2px; }
.chapter-sharh-heading strong { font-size: .9rem; }
.chapter-sharh-heading small { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-sharh-heading .chapter-sharh-reciter { color: var(--text-secondary); font-size: .78rem; }
.chapter-sharh-heading .chapter-sharh-topic { font-size: .72rem; }
.chapter-sharh-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); }

.share-card { max-height: calc(100vh - 32px); overflow: auto; padding: 16px; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-lg); }
.share-card img { display: block; width: 100%; max-height: 65vh; object-fit: contain; border-radius: 14px; background: var(--bg); }
.share-carousel { display: grid; gap: 10px; }
.share-carousel-nav { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--text-secondary); font-size: .78rem; font-variant-numeric: tabular-nums; }
.share-carousel-nav button { width: 36px; height: 36px; min-width: 36px; min-height: 36px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-variant); color: var(--text); font-size: 1.35rem; cursor: pointer; }
.share-preview-heading { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 12px; color: var(--text); text-align: left; }
.share-preview-heading span { color: var(--text-muted); font-size: .75rem; }
.share-btn-secondary { color: var(--text); background: var(--surface-variant); border-color: var(--border); }

.search-result-card { margin: 0 16px 10px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.search-result-card summary { min-height: 68px; padding: 12px 14px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.search-result-card summary::-webkit-details-marker { display: none; }
.search-result-card summary > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.search-result-card summary strong { font-size: .82rem; }
.search-result-card summary small { overflow: hidden; color: var(--text-muted); font-size: .72rem; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.search-result-card summary > b { color: var(--primary); transition: transform var(--duration-fast); }
.search-result-card[open] summary > b { transform: rotate(180deg); }
.search-result-body { padding: 16px; border-top: 1px solid var(--divider); }
.search-result-body > button { width: 100%; min-height: 44px; margin-top: 10px; border: 0; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); font-weight: 700; cursor: pointer; }

@media (min-width: 768px) {
  .sharh-player-dock { bottom: 20px; }
}

@media (min-width: 1024px) {
  .sharh-player-dock { left: calc(260px + 50%); right: auto; width: min(696px, calc(100vw - 300px)); transform: translateX(-50%); }
}

@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .sharh-player-dock {
    background: var(--glass-surface);
    border-color: var(--glass-highlight);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 12px 34px rgba(24, 38, 30, .16);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
