/*
 * The site's UI (docs/UI_ROADMAP.md, design in docs/design/). The look only: app.css keeps the functional rules.
 * Every rule here hangs off classes, ids and attributes the views already have; none changes what is shown or hidden.
 * Sections: 1 tokens · 2 base · 3 shared pieces · 4 navbar · 5 banner · 6 footer · 7 Home.
 */

/* ---- 1. Tokens: Light, Sepia, Dark; Auto follows the OS. The old --fg/--border/--selected/--highlight follow. --bg (the body) keeps
   app.css's values, which the theme tests read; the page tone is painted on #main instead. ---- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/manrope/manrope-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/manrope/manrope-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Amiri Quran"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/amiri/amiri-quran-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Amiri"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/amiri/amiri-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Amiri"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/amiri/amiri-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

:root,
[data-theme="light"] {
  --ui-bg: #F4F5F2; --ui-surface: #FFFFFF; --ui-surface2: #EEF1EC; --ui-ink: #111B17; --ui-muted: #56635D; --ui-line: #E1E6DF;
  --ui-primary: #0E5A47; --ui-primary-ink: #FFFFFF; --ui-primary-soft: #E2EDE8; --ui-gold: #9A6B22; --ui-gold-soft: #F6EBD6;
  --ui-hero: #0F2E27; --ui-hero-ink: #F3F1EA; --ui-hero-muted: #AFC3BB; --ui-hero-line: rgba(255, 255, 255, 0.16); --ui-hero-gold: #D9B46C;
  --ui-shadow: 0 10px 30px rgba(17, 27, 23, 0.08);
  --fg: var(--ui-ink); --muted: var(--ui-muted); --border: var(--ui-line); --selected: var(--ui-primary-soft); --highlight: #FBE7B3;
}
[data-theme="sepia"] {
  --ui-bg: #F1E9D8; --ui-surface: #FAF4E6; --ui-surface2: #ECE2CC; --ui-ink: #33281A; --ui-muted: #67573F; --ui-line: #DED1B6;
  --ui-primary: #2F5A4A; --ui-primary-ink: #FFF8EA; --ui-primary-soft: #E4E2CC; --ui-gold: #8A5F1C; --ui-gold-soft: #F1E1C0;
  --ui-hero: #3A2D1B; --ui-hero-ink: #F7EEDB; --ui-hero-muted: #D2C09D; --ui-hero-line: rgba(255, 248, 230, 0.18); --ui-hero-gold: #E0BD78;
  --fg: var(--ui-ink); --muted: var(--ui-muted); --border: var(--ui-line); --selected: var(--ui-primary-soft); --highlight: #F0D79A;
}
[data-theme="dark"] {
  --ui-bg: #0B1210; --ui-surface: #121B18; --ui-surface2: #18231F; --ui-ink: #E6ECE9; --ui-muted: #98A6A0; --ui-line: #24312C;
  --ui-primary: #5CC6A0; --ui-primary-ink: #06120E; --ui-primary-soft: #163129; --ui-gold: #D8B26E; --ui-gold-soft: #2C2416;
  --ui-hero: #0F1F1A; --ui-hero-ink: #E9EEEA; --ui-hero-muted: #9DB2AA; --ui-hero-line: rgba(255, 255, 255, 0.12); --ui-hero-gold: #D8B26E;
  --ui-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --fg: var(--ui-ink); --muted: var(--ui-muted); --border: var(--ui-line); --selected: var(--ui-primary-soft); --highlight: #4A3D16;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --ui-bg: #0B1210; --ui-surface: #121B18; --ui-surface2: #18231F; --ui-ink: #E6ECE9; --ui-muted: #98A6A0; --ui-line: #24312C;
    --ui-primary: #5CC6A0; --ui-primary-ink: #06120E; --ui-primary-soft: #163129; --ui-gold: #D8B26E; --ui-gold-soft: #2C2416;
    --ui-hero: #0F1F1A; --ui-hero-ink: #E9EEEA; --ui-hero-muted: #9DB2AA; --ui-hero-line: rgba(255, 255, 255, 0.12); --ui-hero-gold: #D8B26E;
    --ui-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --fg: var(--ui-ink); --muted: var(--ui-muted); --border: var(--ui-line); --selected: var(--ui-primary-soft); --highlight: #4A3D16;
  }
}

/* ---- 2. Base ---- */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Manrope", "Amiri", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
#main { padding: 0 16px; background: var(--ui-bg); }
a { color: var(--ui-primary); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: 2px; }

/* An icon drawn in the text colour from public/assets/icons/{name}.svg. */
.home ::before, .site-header ::before, .site-footer ::before { -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }

/* ---- 3. Shared pieces ---- */
.ui-wrap { max-width: 1240px; margin: 0 auto; padding: 0 40px; box-sizing: border-box; }

/* ---- 4. Navbar ---- */
.site-header { background: var(--ui-surface); border-bottom: 1px solid var(--ui-line); }
.site-nav {
  display: flex; align-items: center; gap: 10px;
  max-width: 1240px; min-height: 64px; margin: 0 auto; padding: 0 40px; box-sizing: border-box;
}
.site-nav > * { flex: none; }
.site-nav .nav-menu { order: 1; }
.site-nav .nav-brand { order: 2; margin-right: auto; }
.site-nav .nav-search { order: 3; }
.site-nav .nav-lang { order: 4; }
.site-nav .nav-settings { order: 5; }
.site-nav .nav-theme { order: 6; }
.site-nav .nav-bell { order: 7; }
.site-nav .nav-signin, .site-nav .nav-user { order: 8; }

.nav-icon {
  position: relative; width: 44px; height: 44px; padding: 0; overflow: hidden;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink);
  font-size: 0; cursor: pointer;
}
.nav-icon:hover { background: var(--ui-surface2); }
.nav-icon::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; background: currentColor;
}
.nav-menu::before { -webkit-mask-image: url("/assets/icons/menu.svg"); mask-image: url("/assets/icons/menu.svg"); }
.nav-lang::before { -webkit-mask-image: url("/assets/icons/globe.svg"); mask-image: url("/assets/icons/globe.svg"); }
.nav-settings::before { -webkit-mask-image: url("/assets/icons/sliders.svg"); mask-image: url("/assets/icons/sliders.svg"); }
.nav-theme::before { -webkit-mask-image: url("/assets/icons/moon.svg"); mask-image: url("/assets/icons/moon.svg"); }
[data-theme="dark"] .nav-theme::before { -webkit-mask-image: url("/assets/icons/sun.svg"); mask-image: url("/assets/icons/sun.svg"); }
.nav-bell::before { -webkit-mask-image: url("/assets/icons/bell.svg"); mask-image: url("/assets/icons/bell.svg"); }
.nav-bell:not([data-unread="0"])[data-unread]::after {
  content: ""; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ui-gold);
}
.nav-user { border-radius: 50%; border: 0; background: var(--ui-primary); color: var(--ui-primary-ink); }
.nav-user:hover { background: var(--ui-primary); filter: brightness(1.08); }
.nav-user::before { -webkit-mask-image: url("/assets/icons/user.svg"); mask-image: url("/assets/icons/user.svg"); }

.nav-brand {
  display: inline-flex; align-items: center; gap: 10px; margin-left: 4px;
  color: var(--ui-ink); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none;
}
.nav-brand::before { content: ""; width: 32px; height: 32px; background: url("/assets/brand/mark.svg") center / contain no-repeat; }
[data-theme="dark"] .nav-brand::before { filter: brightness(1.8); }

.nav-search {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; min-width: 220px; padding: 0 14px;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-bg); color: var(--ui-muted);
  font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-search::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask-image: url("/assets/icons/search.svg"); mask-image: url("/assets/icons/search.svg"); }
.nav-search:hover { border-color: var(--ui-primary); }

.nav-signin {
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: 12px;
  background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 15px; font-weight: 700; text-decoration: none;
}
.nav-signin:hover { filter: brightness(1.08); }

.nav-menu-list {
  min-width: 220px; margin: 0; padding: 8px; list-style: none;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 16px; box-shadow: var(--ui-shadow);
}
.nav-menu-list a, .nav-menu-list button {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px; box-sizing: border-box;
  border: 0; border-radius: 10px; background: none; color: var(--ui-ink); font-size: 14px; font-weight: 600; text-align: start; text-decoration: none; cursor: pointer;
}
.nav-menu-list a:hover, .nav-menu-list button:hover, .nav-menu-list [aria-current="true"] { background: var(--ui-surface2); }

/* ---- 5. Announcement banner ---- */
#banner:not([hidden]) {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px;
  background: var(--ui-hero); color: var(--ui-hero-ink); font-size: 14px; font-weight: 600;
}
#banner a { color: var(--ui-hero-gold); }
#banner button {
  height: 30px; padding: 0 12px; border: 1px solid var(--ui-hero-line); border-radius: 8px;
  background: transparent; color: var(--ui-hero-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ---- 6. Footer ---- */
.site-footer { margin-top: 0; background: var(--ui-surface); border-top: 1px solid var(--ui-line); color: var(--ui-ink); }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 40px;
  max-width: 1240px; margin: 0 auto; padding: 56px 40px 40px; box-sizing: border-box;
}
.site-footer h2 { margin: 0 0 14px; font-size: 16px; font-weight: 800; }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.site-footer .footer-col a, .footer-legal a { color: var(--ui-muted); font-size: 14px; text-decoration: none; }
.site-footer .footer-col a:hover, .footer-legal a:hover { color: var(--ui-ink); }
.newsletter-form { display: flex; flex-wrap: wrap; gap: 8px; }
.newsletter-form input {
  flex: 1 1 180px; min-width: 0; height: 44px; padding: 0 14px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-bg); color: var(--ui-ink); font-size: 15px;
}
.newsletter-form button {
  height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--ui-primary); color: var(--ui-primary-ink);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.newsletter-message { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; color: var(--ui-muted); }
.newsletter-message:empty { display: none; }
.footer-prefs { display: flex; flex-direction: column; gap: 18px; }
.footer-theme { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ui-surface2); align-self: flex-start; }
.footer-theme::before { content: none; }
.footer-theme button {
  height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ui-muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.footer-theme button[aria-pressed="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.footer-language { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.footer-language button {
  height: 38px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.footer-legal {
  display: flex; flex-wrap: wrap; gap: 8px 20px; max-width: 1240px; margin: 0 auto; padding: 20px 40px 28px; box-sizing: border-box;
  border-top: 1px solid var(--ui-line);
}
.footer-legal a { font-size: 13px; }

/* ---- 7. Home ---- */
/*
 * The page is one grid. The DOM keeps the logged section order (the test reads the h2s in order); the grid only places
 * things: the Verse of the Day sits in the hero beside the search, Verse of the Week and Quran in a Year side by side.
 * Rows (desktop): 1 h1 · 2 search · 3 quick links · 4 Surah List panel · 5 Popular panel · 6 hero padding · 7 reading ·
 * 8 learning · 9 topics · 10 weekly + Quran in a Year · 11 community · 12 the Quran.
 */
.home {
  --gap: 20px;
  display: grid; margin: 0 -16px;
  grid-template-columns: [full-start] minmax(20px, 1fr) [c-start a-start] minmax(0, 620px) [a-end b-start] minmax(0, 540px) [b-end c-end] minmax(20px, 1fr) [full-end];
  color: var(--ui-ink);
}
.home::before {
  content: ""; grid-column: full; grid-row: 1 / 7; z-index: 0;
  background:
    radial-gradient(circle at 78% 28%, rgba(31, 160, 122, 0.5), transparent 30%),
    radial-gradient(circle at 60% 88%, rgba(217, 164, 74, 0.32), transparent 24%),
    radial-gradient(circle at 96% 80%, rgba(59, 111, 176, 0.3), transparent 22%),
    url("/assets/brand/pattern.svg"),
    var(--ui-hero);
}
.home::after { content: ""; grid-column: full; grid-row: 6; height: 80px; }
.home > * { z-index: 1; min-width: 0; }
.home h2, .home h3 { margin: 0; }

/* Hero (left column) */
.home-title {
  grid-column: a; grid-row: 1; margin: 72px 48px 18px 0;
  color: var(--ui-hero-ink); font-size: 54px; line-height: 1.06; font-weight: 800; letter-spacing: -0.03em;
}
.home-search { grid-column: a; grid-row: 2; margin: 0 48px 0 0; }
.home-search form {
  display: flex; align-items: center; gap: 8px; height: 62px; padding: 0 8px 0 18px; box-sizing: border-box;
  border-radius: 16px; background: #FFFFFF; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
.home-search form::before { content: ""; flex: none; width: 22px; height: 22px; background: #56635D; -webkit-mask-image: url("/assets/icons/search.svg"); mask-image: url("/assets/icons/search.svg"); }
.home-search input[type="search"] {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: #111B17; font-size: 17px;
}
.home-search .voice-search {
  position: relative; flex: none; width: 46px; height: 46px; padding: 0; overflow: hidden; border: 0; border-radius: 12px;
  background: #EEF1EC; color: #0E5A47; font-size: 0; cursor: pointer;
}
.home-search .voice-search::before { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; background: currentColor; -webkit-mask-image: url("/assets/icons/mic.svg"); mask-image: url("/assets/icons/mic.svg"); }
.home-search .voice-search[aria-pressed="true"] { background: #0E5A47; color: #FFFFFF; }
/* features/search.js's suggestions and instant results, under the field. */
.home-search [data-search-body] { margin-top: 14px; color: var(--ui-hero-ink); }
.home-search [data-search-body] section { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.home-search [data-search-body] h3 { margin-right: 4px; color: var(--ui-hero-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.home-search [data-search-body] ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.home-search [data-search-body] li > a, .home-search [data-search-body] li > button {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--ui-hero-line); border-radius: 999px; background: rgba(255, 255, 255, 0.06);
  color: var(--ui-hero-ink); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.home-search [data-search-body] li > a:hover, .home-search [data-search-body] li > button:hover { border-color: var(--ui-hero-gold); }
.home-search [data-search-body] ol, .home-search [data-search-body] [role="listbox"] {
  margin: 0; padding: 8px; list-style: none; border-radius: 14px; background: var(--ui-surface); color: var(--ui-ink); box-shadow: var(--ui-shadow);
}
.home-search [data-search-body] ol a, .home-search [data-search-body] [role="listbox"] a { color: var(--ui-ink); }

.home-quick { grid-column: a; grid-row: 3; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 48px 0 0; }
.home-quick button {
  height: 40px; padding: 0 18px; border: 1px solid var(--ui-hero-line); border-radius: 999px; background: transparent;
  color: var(--ui-hero-ink); font-size: 14px; font-weight: 700; cursor: pointer;
}
.home-quick button:hover { border-color: var(--ui-hero-gold); }
.home-quick button[aria-expanded="true"] { background: var(--ui-hero-ink); border-color: var(--ui-hero-ink); color: var(--ui-hero); }

.home-panel {
  margin: 14px 48px 0 0; padding: 18px 20px; border-radius: 18px; color: var(--ui-hero-ink);
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--ui-hero-line);
}
.home-surah-panel { grid-column: a; grid-row: 4; }
.home-surah-panel ul { margin: 0; padding: 0; list-style: none; columns: 3 150px; column-gap: 18px; max-height: 300px; overflow-y: auto; }
.home-surah-panel li { break-inside: avoid; }
.home-surah-panel a { display: block; padding: 5px 0; color: var(--ui-hero-ink); font-size: 14px; text-decoration: none; }
.home-surah-panel a:hover { color: var(--ui-hero-gold); }
.home-popular { grid-column: a; grid-row: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.home-popular h2 { flex: 1; color: var(--ui-hero-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.home-popular [data-home-panel-close] {
  height: 32px; padding: 0 12px; border: 1px solid var(--ui-hero-line); border-radius: 8px; background: transparent;
  color: var(--ui-hero-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
.home-popular h3 { flex-basis: 100%; color: var(--ui-hero-muted); font-size: 13px; font-weight: 700; }
.home-popular ul { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.home-popular ul a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--ui-hero-line); color: var(--ui-hero-ink); font-size: 14px; text-decoration: none;
}
.home-popular ul a:hover { border-color: var(--ui-hero-gold); }
.home-popular > p { flex-basis: 100%; margin: 4px 0 0; }
.home-popular > p a { display: inline-flex; align-items: center; gap: 8px; color: var(--ui-hero-gold); font-weight: 700; text-decoration: none; }
.home-popular > p a::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask-image: url("/assets/icons/headphones.svg"); mask-image: url("/assets/icons/headphones.svg"); }

/* Hero (right column): the Verse of the Day as frosted glass */
.home-daily {
  grid-column: b; grid-row: 1 / 6; align-self: center; margin-top: 56px;
  display: flex; flex-direction: column; gap: 16px; padding: 30px; border-radius: 28px; color: var(--ui-hero-ink);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 24px 60px rgba(0, 0, 0, 0.28);
}
.home-daily h2 { color: var(--ui-hero-gold); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.home-daily [data-home-verse] { display: flex; flex-direction: column; gap: 12px; min-height: 120px; }
.home-daily .verse-arabic { font-size: 36px; }
.home-daily .translation-text { font-size: 16px; line-height: 1.65; }
.home-daily .translation-text ~ .translation-text { display: none; }
.home-daily cite { display: block; margin-top: 6px; color: var(--ui-hero-muted); font-size: 13px; font-style: normal; }
.home-daily [data-home-verse] > p:last-child { padding-top: 14px; border-top: 1px solid var(--ui-hero-line); }
.home-daily [data-home-verse] > p:last-child a { color: var(--ui-hero-gold); font-weight: 700; text-decoration: none; }

/* Verses on Home: Amiri Quran draws every mark of text_uthmani (the mirrored UthmanicHafs is for the qpc text) */
.home .verse-arabic { margin: 0; font-family: "Amiri Quran", "UthmanicHafs", serif; line-height: 2; text-align: right; }
.home .translation-text { margin: 0; }
.home cite { font-style: normal; }

/* Sections below the hero */
.home-reading, .home-learning, .home-topics, .home-community, .home-quran { grid-column: c; }
.home-reading { grid-row: 7; margin-top: 56px; }
.home-learning { grid-row: 8; margin-top: 72px; }
.home-topics { grid-row: 9; margin-top: 72px; }
.home-weekly { grid-column: a; grid-row: 10; margin: 72px 10px 0 0; }
.home-qiay { grid-column: b; grid-row: 10; margin: 72px 0 0 10px; }
.home-community { grid-row: 11; margin-top: 20px; }
.home-quran { grid-row: 12; margin: 80px 0 96px; }
.home-weekly[hidden] + .home-community, .home-weekly[hidden] ~ .home-qiay { margin-top: 72px; }
.home-weekly[hidden] ~ .home-qiay { grid-column: c; margin-left: 0; }

.home-reading > h2, .home-learning > h2, .home-topics > h2, .home-quran > h2 {
  font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2;
}

/* Start / Continue Reading: three cards */
.home-reading { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.home-reading > h2 { grid-column: 1 / -1; }
.home-card {
  position: relative; margin: 0; padding: 26px 26px 26px 92px; min-height: 96px; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 20px; color: var(--ui-muted); font-size: 14px; line-height: 1.5;
}
.home-card:hover { border-color: var(--ui-primary); }
.home-card::before {
  content: ""; position: absolute; left: 26px; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 14px;
  background: var(--ui-primary-soft);
}
.home-card::after {
  content: ""; position: absolute; left: 38px; top: 50%; width: 24px; height: 24px; margin-top: -12px; background: var(--ui-primary);
  -webkit-mask: url("/assets/icons/book.svg") center / contain no-repeat; mask: url("/assets/icons/book.svg") center / contain no-repeat;
}
.home-card-myquran::after { -webkit-mask-image: url("/assets/icons/bookmark.svg"); mask-image: url("/assets/icons/bookmark.svg"); }
.home-card-goal::after { -webkit-mask-image: url("/assets/icons/target.svg"); mask-image: url("/assets/icons/target.svg"); }
.home-card a { color: var(--ui-ink); font-size: 19px; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; }
.home-card a:hover { color: var(--ui-primary); }
.home-card-read { order: 1; background: var(--ui-primary); border-color: var(--ui-primary); }
.home-card-read::before { background-color: rgba(255, 255, 255, 0.16); }
.home-card-read::after { background: var(--ui-primary-ink); }
.home-card-read a, .home-card-read a:hover { color: var(--ui-primary-ink); }
.home-card-myquran { order: 2; }
.home-card-goal { order: 3; }
.home-reading > h2 { order: 0; }

/* The whole card is the link: the link's own box stretches over the card (the card is position: relative). */
.home-card a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 20px; }
.home-card a:focus-visible { outline: none; }
.home-card:has(a:focus-visible) { outline: 2px solid var(--ui-primary); outline-offset: 3px; }
.home-card { cursor: pointer; }

/* Learning plans */
.home-learning { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px; }
.home-more-link { margin: 0; }
.home-more-link a { font-weight: 700; text-decoration: none; }
.home-plans { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.home-plans > h2 { color: var(--ui-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.home-plans > ul { grid-column: 1 / -1; grid-row: 2; margin: 8px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.home-plans > [data-plans-empty] { grid-column: 1 / -1; grid-row: 3; margin: 0; color: var(--ui-muted); }
.home-plans li a {
  display: flex; flex-direction: column; gap: 14px; height: 100%; padding: 12px 12px 18px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 20px;
  color: var(--ui-ink); font-size: 17px; font-weight: 800; line-height: 1.35; text-decoration: none;
}
.home-plans li a:hover { border-color: var(--ui-primary); }
.home-plans li a::before {
  content: ""; display: block; height: 150px; margin-bottom: 2px; border-radius: 14px;
  background: url("/assets/brand/pattern.svg"), #0E5A47;
}
.home-plans li:nth-child(3n+2) a::before { background: url("/assets/brand/pattern.svg"), #1F3A5F; }
.home-plans li:nth-child(3n+3) a::before { background: url("/assets/brand/pattern.svg"), #4A2C4F; }
.home-plans li a { padding-left: 12px; padding-right: 12px; }
.home-step {
  position: relative; width: 44px; height: 44px; padding: 0; overflow: hidden; font-size: 0;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); cursor: pointer;
}
.home-step::before { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; background: currentColor; -webkit-mask-image: url("/assets/icons/cl.svg"); mask-image: url("/assets/icons/cl.svg"); }
.home-step-next::before { -webkit-mask-image: url("/assets/icons/cr.svg"); mask-image: url("/assets/icons/cr.svg"); }
.home-step:hover:not(:disabled) { background: var(--ui-surface2); }
.home-step:disabled { opacity: 0.4; cursor: default; }

/* Topics */
.home-topics { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px; }
.home-topics > ul { grid-column: 1 / -1; grid-row: 2; margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.home-topics > ul h3 { font-size: 17px; font-weight: 800; }
.home-topics > ul a {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 16px 20px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 18px; color: var(--ui-ink); text-decoration: none;
}
.home-topics > ul a::before {
  content: ""; flex: none; width: 22px; height: 22px; background: var(--ui-primary);
  -webkit-mask-image: url("/assets/icons/compass.svg"); mask-image: url("/assets/icons/compass.svg");
}
.home-topics > ul a:hover { border-color: var(--ui-primary); }
.home-more-topics-button {
  grid-column: 2; grid-row: 1; height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: transparent; color: var(--ui-ink); font-size: 14px; font-weight: 600; cursor: pointer;
}
.home-more-topics-button:hover { background: var(--ui-surface2); }
#home-more-topics { grid-column: 1 / -1; padding: 18px 20px; border-radius: 18px; background: var(--ui-surface2); }
#home-more-topics ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
#home-more-topics ul a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--ui-surface); border: 1px solid var(--ui-line); color: var(--ui-ink); font-size: 14px; text-decoration: none;
}
#home-more-topics p { margin: 0; }
#home-more-topics p a { font-weight: 700; text-decoration: none; }

/* Verse of the Week and Quran in a Year */
.home-verse-card {
  display: flex; flex-direction: column; gap: 16px; padding: 30px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 22px;
}
.home-verse-card > h2 { font-size: 20px; font-weight: 800; }
.home-verse-card h3 { color: var(--ui-muted); font-size: 14px; font-weight: 600; }
.home-verse-card [data-home-verse] { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.home-verse-card .verse-arabic { font-size: 30px; }
.home-verse-card .translation-text { font-size: 15px; line-height: 1.65; }
.home-verse-card cite { display: block; margin-top: 4px; color: var(--ui-muted); font-size: 12px; font-weight: 600; }
.home-verse-card [data-home-verse] > p:last-child a { font-weight: 700; text-decoration: none; }
.home-qiay [data-home-verse] { padding: 20px; border-radius: 16px; background: var(--ui-surface2); }
.home-qiay > p { margin: 0; }
.home-qiay > p:first-of-type a, .home-weekly [data-weekly-share] {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: transparent; color: var(--ui-ink); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.home-qiay > p:first-of-type a::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask-image: url("/assets/icons/calendar.svg"); mask-image: url("/assets/icons/calendar.svg"); }
.home-weekly [data-weekly-share]::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask-image: url("/assets/icons/share.svg"); mask-image: url("/assets/icons/share.svg"); }
.home-weekly [data-weekly-share]:disabled { opacity: 0.5; cursor: default; }
.home-qiay > p:last-of-type a {
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: 12px;
  background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 15px; font-weight: 700; text-decoration: none;
}
.home-weekly [data-weekly-views] { margin: 0; color: var(--ui-muted); font-size: 13px; }
.home-weekly > [data-weekly-share] { align-self: flex-start; }

/* Community */
.home-community {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 22px 26px; border-radius: 20px;
  background: var(--ui-gold-soft);
}
.home-community h2 { color: var(--ui-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.home-community ul { margin: 0; padding: 0; list-style: none; color: var(--ui-muted); }
.home-community a { color: var(--ui-ink); font-weight: 800; text-decoration: none; }

/* The surah index as cards (Home "The Quran" section and /surahs) */
.home-quran { display: flex; flex-direction: column; gap: 22px; }
.surah-index { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.surah-index [role="tablist"] { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ui-surface2); justify-self: start; }
.surah-index [role="tab"] {
  height: 38px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--ui-muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
.surah-index [role="tab"][aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.surah-index > [role="group"] { display: flex; align-items: center; gap: 8px; color: var(--ui-muted); font-size: 14px; font-weight: 600; }
.surah-index > [role="group"] button {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 14px; font-weight: 600; cursor: pointer;
}
.surah-index > [role="group"] button::after { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask-image: url("/assets/icons/sort.svg"); mask-image: url("/assets/icons/sort.svg"); }
.surah-index .revelation-order-disclaimer {
  grid-column: 1 / -1; margin: 0; padding: 14px 18px; border-radius: 12px; background: var(--ui-gold-soft); color: var(--ui-ink); font-size: 14px; line-height: 1.6;
}
.surah-index [data-index-panel] { grid-column: 1 / -1; }
.surah-index-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.surah-index-list a {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 14px; row-gap: 2px; align-items: center;
  min-height: 76px; padding: 14px 16px; box-sizing: border-box; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 16px;
  color: var(--ui-ink); text-decoration: none;
}
.surah-index-list a:hover { border-color: var(--ui-primary); }
.surah-index-number {
  grid-column: 1; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 800; font-size: 14px;
  clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%);
}
.surah-index-list a:hover .surah-index-number { background: var(--ui-primary); color: var(--ui-primary-ink); }
.surah-index-name { grid-column: 2; grid-row: 1; font-size: 16px; font-weight: 800; }
.surah-index-translated { grid-column: 2; grid-row: 2; color: var(--ui-muted); font-size: 13px; }
.surah-index-description { grid-column: 3; grid-row: 1 / 3; color: var(--ui-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.surah-index-juz { margin-bottom: 18px; }
.surah-index-juz h2 { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.surah-index-juz h2 a { display: inline-flex; gap: 10px; color: var(--ui-ink); text-decoration: none; }
.surah-index-juz h2 a span + span { color: var(--ui-primary); font-size: 14px; font-weight: 700; }

/* ---- 8. Popups area (features/popups.js puts it after #main): the onboarding checklist on Home ---- */
#popups { background: var(--ui-bg); padding: 0 max(40px, calc((100% - 1160px) / 2)) 56px; }
#popups:empty { display: none; }
[data-popup="onboarding"] {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 20px;
  padding: 28px 30px; border-radius: 24px; color: var(--ui-ink);
  background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow);
  counter-reset: onboarding-step;
}
[data-popup="onboarding"] > h2 { grid-column: 1; grid-row: 1; margin: 0; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
[data-popup="onboarding"] > h2::before {
  content: ""; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--ui-gold-soft) url("/assets/brand/mark.svg") center / 24px no-repeat;
}
[data-popup="onboarding"] > p:first-of-type { grid-column: 1; grid-row: 2; margin: 0; color: var(--ui-muted); font-size: 15px; }
[data-popup="onboarding"] > [data-onboarding-progress] {
  grid-column: 2; grid-row: 2; justify-self: end; margin: 0; padding: 4px 12px; border-radius: 999px;
  background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 700; white-space: nowrap;
}
[data-popup="onboarding"] > p:last-child { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; }
[data-onboarding-end] {
  height: 38px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 10px; background: transparent;
  color: var(--ui-ink); font-size: 14px; font-weight: 700; cursor: pointer;
}
[data-onboarding-end]:hover { background: var(--ui-surface2); }
[data-popup="onboarding"] > ol {
  grid-column: 1 / -1; grid-row: 3; margin: 16px 0 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
[data-popup="onboarding"] li {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 92px; padding: 16px 16px 14px 60px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-bg); color: var(--ui-primary); font-size: 12px; font-weight: 700;
  counter-increment: onboarding-step;
}
[data-popup="onboarding"] li::before {
  content: counter(onboarding-step); position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--ui-surface2); color: var(--ui-muted); font-size: 14px; font-weight: 800;
}
[data-popup="onboarding"] li:hover { border-color: var(--ui-primary); }
[data-popup="onboarding"] li button {
  padding: 0; border: 0; background: none; color: var(--ui-ink); font-size: 15px; font-weight: 700; line-height: 1.35; text-align: start; cursor: pointer;
}
/* The step's button covers the whole tile. */
[data-popup="onboarding"] li button::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
[data-popup="onboarding"] li button:focus-visible { outline: none; }
[data-popup="onboarding"] li:has(button:focus-visible) { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
[data-popup="onboarding"] li[data-onboarding-done="true"] { background: var(--ui-primary-soft); border-color: transparent; }
[data-popup="onboarding"] li[data-onboarding-done="true"]::before {
  content: ""; background: var(--ui-primary);
  -webkit-mask: none; mask: none;
  background-image: none;
}
[data-popup="onboarding"] li[data-onboarding-done="true"]::after {
  content: ""; position: absolute; left: 24px; top: 24px; width: 16px; height: 16px; background: var(--ui-primary-ink);
  -webkit-mask: url("/assets/icons/check.svg") center / contain no-repeat; mask: url("/assets/icons/check.svg") center / contain no-repeat;
  pointer-events: none;
}

/* Tablet */
@media (max-width: 1000px) {
  .site-nav, .footer-grid, .footer-legal { padding-left: 24px; padding-right: 24px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home { grid-template-columns: [full-start] 24px [c-start a-start b-start] minmax(0, 1fr) [c-end a-end b-end] 24px [full-end]; }
  .home::before { grid-row: 1 / 8; }
  .home::after { grid-row: 7; height: 56px; }
  .home-title { margin: 56px 0 18px; font-size: 44px; }
  .home-search, .home-quick, .home-panel { margin-right: 0; }
  .home-daily { grid-row: 6; margin-top: 36px; }
  .home-reading { grid-row: 8; grid-template-columns: minmax(0, 1fr); }
  .home-learning { grid-row: 9; }
  .home-topics { grid-row: 10; }
  .home-weekly { grid-row: 11; margin: 56px 0 0; }
  .home-qiay { grid-row: 12; margin: 20px 0 0; }
  .home-weekly[hidden] ~ .home-qiay { margin-top: 56px; }
  .home-community { grid-row: 13; }
  .home-quran { grid-row: 14; margin-top: 64px; }
  .home-reading, .home-learning, .home-topics { margin-top: 56px; }
  .home-plans > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #popups { padding: 0 24px 48px; }
  [data-popup="onboarding"] > ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-topics > ul, .surah-index .surah-index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone */
@media (max-width: 640px) {
  .site-nav { gap: 6px; min-height: 64px; padding: 0 12px; }
  .nav-brand { font-size: 0; gap: 0; margin-left: 2px; }
  .nav-icon, .nav-search { width: 40px; height: 40px; }
  .home-plans li a::before { height: 110px; }
  .nav-search { min-width: 0; width: 44px; padding: 0; justify-content: center; font-size: 0; }
  .nav-lang { display: none; }
  .nav-signin { height: 40px; padding: 0 14px; font-size: 14px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 40px 18px 28px; }
  .footer-legal { padding: 18px; }
  .home { grid-template-columns: [full-start] 18px [c-start a-start b-start] minmax(0, 1fr) [c-end a-end b-end] 18px [full-end]; }
  .home-title { margin-top: 40px; font-size: 32px; }
  .home-search form { height: 56px; }
  .home-daily { padding: 22px; }
  .home-daily .verse-arabic { font-size: 28px; }
  .home-reading > h2, .home-learning > h2, .home-topics > h2, .home-quran > h2 { font-size: 24px; }
  .home-plans > ul, .home-topics > ul, .surah-index .surah-index-list { grid-template-columns: minmax(0, 1fr); }
  .home-topics { grid-template-columns: minmax(0, 1fr); }
  .home-more-topics-button { grid-column: 1; grid-row: 3; justify-self: start; }
  .surah-index { grid-template-columns: minmax(0, 1fr); }
  .home-verse-card { padding: 22px; }
  .home-card { padding-left: 84px; }
  #popups { padding: 0 18px 40px; }
  [data-popup="onboarding"] { padding: 22px; grid-template-columns: minmax(0, 1fr); }
  [data-popup="onboarding"] > p:last-child { grid-column: 1; grid-row: 4; justify-self: start; margin-top: 8px; }
  [data-popup="onboarding"] > [data-onboarding-progress] { grid-column: 1; grid-row: 3; justify-self: start; margin-top: 4px; }
  [data-popup="onboarding"] > ol { grid-row: 5; grid-template-columns: minmax(0, 1fr); }
  [data-popup="onboarding"] li { min-height: 64px; }
}

/* ---- 9. Reader (screen 2): header strip, chapter header, verse cards, reading modes, end of chapter, player ---- */
/* Shared icon mask for the reader's icon buttons: the name stays in the text or aria-label, the text is hidden. */
.reader-header [data-action="edit-reading-bookmarks"], .reader-header [data-open-drawer="#settings-drawer"],
.verse-card .verse-actions button, .audio-player [data-player="previous"], .audio-player [data-player="next"],
.audio-player [data-player="menu"], .audio-player [data-player="close"] {
  position: relative; width: 36px; height: 36px; padding: 0; overflow: hidden; flex: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ui-muted); font-size: 0; cursor: pointer;
}
.reader-header [data-action="edit-reading-bookmarks"]::before, .reader-header [data-open-drawer="#settings-drawer"]::before,
.verse-card .verse-actions button::before, .audio-player [data-player="previous"]::before, .audio-player [data-player="next"]::before,
.audio-player [data-player="menu"]::before, .audio-player [data-player="close"]::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.reader-header [data-action="edit-reading-bookmarks"]:hover, .reader-header [data-open-drawer="#settings-drawer"]:hover,
.verse-card .verse-actions button:hover, .audio-player [data-player]:hover { background: var(--ui-surface2); color: var(--ui-ink); }

/* Header strip: sticky at the top (app.css), full width under the navbar */
#main > .reader-header {
  margin: 0 -16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 6px max(16px, calc((100% - 1200px) / 2)) 9px;
  background: var(--ui-surface); border-bottom: 1px solid var(--ui-line);
}
.reader-header .chapter-switcher {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ui-ink); font-size: 15px; font-weight: 800; cursor: pointer;
}
.reader-header .chapter-switcher:hover { background: var(--ui-surface2); }
/* Controls stay on the inline-start side, where the original strip had them: an open drawer (inline-end) never covers them. */
.reader-header .chapter-switcher { order: 1; }
.reader-header [role="tablist"] { order: 2; }
.reader-header .reading-submodes { order: 3; }
.reader-header [data-action="edit-reading-bookmarks"] { order: 4; }
.reader-header [data-open-drawer="#settings-drawer"] { order: 5; }
.reader-header .reader-position { order: 6; flex: 1; text-align: end; color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.reader-header .pinned-verses { order: 7; }
.reader-header [data-action="edit-reading-bookmarks"] { --icon: url("/assets/icons/bookmarks.svg"); }
.reader-header [data-open-drawer="#settings-drawer"] { --icon: url("/assets/icons/sliders.svg"); border-color: var(--ui-line); }
.reader-header [role="tablist"], .reader-header .reading-submodes:not([hidden]) {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ui-surface2);
}
.reader-header [role="tab"], .reader-header .reading-submodes button {
  height: 30px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ui-muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.reader-header [role="tab"][aria-selected="true"], .reader-header .reading-submodes [aria-pressed="true"] {
  background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.reader-header .pinned-verses:not([hidden]) { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0 6px; font-size: 13px; }
.reader-header .pinned-verses button { height: 30px; padding: 0 10px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.reader-header .reading-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ui-surface2); }
.reader-header .reading-progress-bar { height: 3px; background: var(--ui-primary); }

/* The reading column */
#main > .chapter-header, #main > .bismillah, #main > .reading-view, #main > #chapter-end { max-width: 1120px; margin-left: auto; margin-right: auto; }

/* Chapter header: the dark card with the calligraphic name */
.chapter-header {
  position: relative; overflow: hidden; margin-top: 16px; padding: 20px 28px 20px; border-radius: 24px; text-align: center;
  color: var(--ui-hero-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(31, 160, 122, 0.5), transparent 32%),
    radial-gradient(circle at 92% 100%, rgba(217, 164, 74, 0.32), transparent 28%),
    url("/assets/brand/pattern.svg"), var(--ui-hero);
}
.chapter-header .surah-name { font-size: 40px; line-height: 1.1; color: var(--ui-hero-ink); }
.chapter-header h1 { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.chapter-header h2 { margin: 2px 0 0; color: var(--ui-hero-gold); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.chapter-header .chapter-summary { max-width: 640px; margin: 8px auto 0; color: var(--ui-hero-muted); font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.chapter-header > p:last-child { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; }
.chapter-header > p:last-child > * {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; box-sizing: border-box;
  border: 1px solid var(--ui-hero-line); border-radius: 10px; background: rgba(255, 255, 255, 0.08);
  color: var(--ui-hero-ink); font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.chapter-header > p:last-child > *:hover { background: rgba(255, 255, 255, 0.16); }
.chapter-header [data-action="play-chapter"] { background: var(--ui-hero-ink); border-color: var(--ui-hero-ink); color: var(--ui-hero); }
.chapter-header [data-action="play-chapter"]:hover { background: var(--ui-hero-ink); filter: brightness(0.95); }
.chapter-header [data-action="play-chapter"]::before, .chapter-header a[href$="/info"]::before {
  content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("/assets/icons/play.svg") center / contain no-repeat; mask: url("/assets/icons/play.svg") center / contain no-repeat;
}
.chapter-header a[href$="/info"]::before { -webkit-mask-image: url("/assets/icons/info.svg"); mask-image: url("/assets/icons/info.svg"); }

.bismillah { margin-top: 14px; margin-bottom: 0; text-align: center; color: var(--ui-muted); font-size: 26px; }

/* Verse cards (the reader, and every other list that renders QK.verseCard) */
.verse-list { font-size: 17px; }
.verse-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 18px; row-gap: 8px;
  padding: 16px 0; border-bottom: 1px solid var(--ui-line); font-size: 17px;
}
.verse-card > * { grid-column: 2; min-width: 0; }
.verse-card > .verse-actions {
  grid-column: 1; grid-row: 1 / span 4; align-self: start;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.verse-card .verse-actions > span { display: contents; }
.verse-card .verse-key {
  display: flex; align-items: center; justify-content: center; min-width: 44px; height: 28px; margin-bottom: 6px; padding: 0 6px; box-sizing: border-box;
  border-radius: 8px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 800; text-decoration: none;
}
.verse-card [data-action="play-verse"] { --icon: url("/assets/icons/play.svg"); }
.verse-card [data-bookmark-verse] { --icon: url("/assets/icons/bookmark.svg"); }
.verse-card [data-bookmark-verse][data-saved="true"] { color: var(--ui-gold); }
.verse-card [data-verse-action="copy-options"] { --icon: url("/assets/icons/copyopt.svg"); }
.verse-card [data-verse-action="copy"] { --icon: url("/assets/icons/copy.svg"); }
.verse-card [data-verse-action="share"] { --icon: url("/assets/icons/share.svg"); }
.verse-card [data-verse-action="note"] { --icon: url("/assets/icons/note.svg"); }
.verse-card [data-verse-action="more"] { --icon: url("/assets/icons/more.svg"); }
.verse-card .verse-actions button:not([data-action]):not([data-bookmark-verse]):not([data-verse-action]) { --icon: url("/assets/icons/more.svg"); }
.verse-card .verse-arabic { margin: 0; line-height: 1.9; text-align: right; }
.verse-card .verse-arabic .word { padding: 0 3px; border-radius: 8px; }
.verse-card .verse-arabic .word:hover { background: var(--highlight); }
.verse-card .verse-arabic .word-end { color: var(--ui-gold); }
.verse-translations { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.verse-card .translation-text { margin: 0; line-height: 1.55; }
.verse-card .translation-name { margin: 2px 0 0; color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.verse-card .footnote-ref {
  min-width: 18px; height: 18px; padding: 0 4px; border: 0; border-radius: 5px; background: var(--ui-primary-soft); color: var(--ui-primary);
  font-size: 11px; font-weight: 800; line-height: 18px; cursor: pointer;
}
.verse-card .footnote:not([hidden]) { margin-top: 8px; padding: 14px 16px; border-radius: 12px; background: var(--ui-surface2); font-size: 14px; line-height: 1.6; }
.verse-card .footnote h4 { margin: 0 0 6px; font-size: 13px; }
.verse-card .footnote p { margin: 0 0 8px; }
.verse-card .footnote-close { height: 30px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; cursor: pointer; }
.verse-card [data-slot="study"] nav { display: flex; flex-wrap: wrap; gap: 6px; }
.verse-card [data-slot="study"] a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 600; text-decoration: none;
}
.verse-card [data-slot="study"] a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.verse-card.audio-verse { background: transparent; }
.verse-card.audio-verse::before {
  content: ""; position: absolute; inset: 12px -16px; border-radius: 18px; background: var(--ui-primary-soft); z-index: -1;
}
.verse-card { position: relative; z-index: 0; }

/* Reading mode: the mushaf page and the translation page as cards */
.reading-view { font-size: 17px; }
.reading-view .mushaf-page, .reading-view .reading-translation-page {
  margin: 28px 0; padding: 40px 48px 24px; border-radius: 22px; background: var(--ui-surface); border: 1px solid var(--ui-line);
}
.reading-view .mushaf-line { line-height: 2.2; }
.reading-view .page-number { margin: 18px 0 0; text-align: center; color: var(--ui-muted); font-size: 13px; font-weight: 700; direction: ltr; }
.reading-view .reading-translation-page p { margin: 0 0 12px; font-size: 17px; line-height: 1.75; }
.reading-view .reading-translation-page sup { color: var(--ui-primary); font-weight: 800; }

/* End of chapter */
#chapter-end:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 48px 0 72px; }
#chapter-end > h2 {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 0 0 8px; color: var(--ui-gold);
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}
#chapter-end > h2::before, #chapter-end > h2::after { content: ""; flex: 1; height: 1px; background: var(--ui-line); }
#chapter-banners:not([hidden]) { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
#chapter-banners li { padding: 16px 18px; border-radius: 16px; background: var(--ui-primary-soft); font-size: 14px; color: var(--ui-muted); }
#chapter-banners li a { display: block; margin-bottom: 4px; color: var(--ui-ink); font-weight: 800; text-decoration: none; }
#chapter-end > p { grid-column: 1 / -1; margin: 0; text-align: center; }
#chapter-end > p a {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 10px;
  color: var(--ui-ink); font-size: 14px; font-weight: 700; text-decoration: none;
}
#chapter-end > p a::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/icons/repeat.svg") center / contain no-repeat; mask: url("/assets/icons/repeat.svg") center / contain no-repeat; }
#chapter-end > section { padding: 24px; border-radius: 20px; background: var(--ui-surface); border: 1px solid var(--ui-line); }
#chapter-end > section:only-of-type { grid-column: 1 / -1; }
#chapter-end h3 { margin: 0 0 12px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#chapter-end article h4 { margin: 0 0 4px; font-size: 18px; }
#chapter-end article h4 a { color: var(--ui-ink); text-decoration: none; }
#chapter-end article p, #chapter-end section > p { margin: 0 0 8px; color: var(--ui-muted); font-size: 14px; line-height: 1.6; }
#chapter-end article p + p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
#chapter-end section > p:last-child a {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 10px;
  background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 14px; font-weight: 700; text-decoration: none;
}
/* The whole "Read More" card follows its link. */
#chapter-end article { position: relative; }
#chapter-end article h4 a::after { content: ""; position: absolute; inset: -24px; border-radius: 20px; }
#chapter-end > section:has(article):hover { border-color: var(--ui-primary); }

/* Audio player bar (fixed at the bottom by app.css) */
.audio-player:not([hidden]) {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 4px 16px;
  padding: 10px max(16px, calc((100% - 1200px) / 2)); background: var(--ui-surface); border-top: 1px solid var(--ui-line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08); color: var(--ui-ink);
}
.audio-player > p { margin: 0; }
.audio-player > p:nth-of-type(1) { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; font-size: 14px; font-weight: 700; }
.audio-player [data-player-verse] { color: var(--ui-muted); font-size: 12px; font-weight: 600; }
.audio-player > p:nth-of-type(2) { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; gap: 10px; color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.audio-player [data-player-seek] { flex: 1; accent-color: var(--ui-primary); }
.audio-player > p:nth-of-type(3) { display: contents; }
.audio-player [data-player="previous"] { grid-column: 2; grid-row: 2; justify-self: end; margin-right: 52px; --icon: url("/assets/icons/prev.svg"); }
.audio-player [data-player="toggle"] {
  grid-column: 2; grid-row: 2; height: 44px; min-width: 96px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 14px; font-weight: 800; cursor: pointer;
}
.audio-player [data-player="next"] { grid-column: 2; grid-row: 2; justify-self: start; margin-left: 52px; --icon: url("/assets/icons/next.svg"); }
.audio-player [data-player="toggle"] { justify-self: center; }
.audio-player > p:nth-of-type(3) > label { grid-column: 3; grid-row: 2; justify-self: end; margin-right: 84px; display: flex; align-items: center; gap: 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.audio-player [data-player-volume] { width: 90px; accent-color: var(--ui-primary); }
.audio-player [data-player="menu"] { grid-column: 3; grid-row: 2; justify-self: end; margin-right: 42px; --icon: url("/assets/icons/more.svg"); }
.audio-player [data-player="close"] { grid-column: 3; grid-row: 2; justify-self: end; --icon: url("/assets/icons/close.svg"); }
.audio-menu.popover {
  padding: 8px; border-radius: 16px; background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow); color: var(--ui-ink);
}
.audio-menu [role^="menuitem"] {
  min-height: 38px; width: 100%; padding: 0 12px; box-sizing: border-box; border: 0; border-radius: 9px; background: transparent;
  color: var(--ui-ink); font-size: 14px; font-weight: 600; text-align: start; text-decoration: none; line-height: 38px; cursor: pointer;
}
.audio-menu [role^="menuitem"]:hover { background: var(--ui-surface2); }
.audio-menu [role="group"] { padding-top: 4px; margin-top: 4px; border-top: 1px solid var(--ui-line); }

@media (max-width: 1000px) {
  .chapter-header .surah-name { font-size: 52px; }
}
@media (max-width: 640px) {
  .reader-header .reader-position { flex-basis: 100%; text-align: start; padding-left: 10px; }
  .reader-header [role="tab"], .reader-header .reading-submodes button { padding: 0 10px; font-size: 13px; }
  .chapter-header { margin-top: 20px; padding: 30px 18px 26px; border-radius: 22px; }
  .chapter-header .surah-name { font-size: 44px; }
  .chapter-header h1 { font-size: 24px; }
  .verse-card { grid-template-columns: minmax(0, 1fr); padding: 22px 0; }
  .verse-card > * { grid-column: 1; }
  .verse-card > .verse-actions { grid-row: auto; position: static; flex-direction: row; flex-wrap: wrap; gap: 0; }
  .verse-card .verse-key { margin: 0 6px 0 0; }
  .reading-view .mushaf-page, .reading-view .reading-translation-page { padding: 24px 16px 16px; }
  #chapter-end:not([hidden]), #chapter-banners:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  .audio-player:not([hidden]) { grid-template-columns: minmax(0, 1fr) auto; }
  .audio-player > p:nth-of-type(1) { grid-column: 1 / -1; grid-row: 2; }
  .audio-player [data-player="previous"], .audio-player [data-player="toggle"], .audio-player [data-player="next"] { grid-row: 3; grid-column: 1; }
  .audio-player > p:nth-of-type(3) > label { display: none; }
  .audio-player [data-player="menu"], .audio-player [data-player="close"] { grid-row: 3; grid-column: 2; }
}

/* ---- 10. Juz / page / hizb / rub and verse ranges (screen 3, views/pages/division.php) ---- */
#main > .reader-header ~ h1 {
  max-width: 1120px; margin: 22px auto 4px; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
}
#main > .reader-header ~ h1::before {
  content: ""; display: block; width: 36px; height: 3px; margin-bottom: 10px; border-radius: 3px; background: var(--ui-gold);
}
/* The heading pages/division.js puts before each chapter's first verse */
.verse-list .chapter-separator {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 18px 0 2px; padding: 14px 18px;
  border-radius: 18px; background: var(--ui-primary-soft); color: var(--ui-ink);
}
.verse-list .chapter-separator h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 800; }
.verse-list .chapter-separator > p { margin: 0; }
.verse-list .chapter-separator > p a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 700; text-decoration: none;
}
.verse-list .chapter-separator > p a::before {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("/assets/icons/info.svg") center / contain no-repeat; mask: url("/assets/icons/info.svg") center / contain no-repeat;
}
.verse-list .chapter-separator .bismillah { flex-basis: 100%; margin: 6px 0 0; font-size: 24px; color: var(--ui-muted); }
@media (max-width: 640px) {
  #main > .reader-header ~ h1 { margin-top: 16px; font-size: 22px; }
}

/* ---- 11. Verse page and Ayatul Kursi (screen 4, views/pages/verse.php) ---- */
.verse-page { max-width: 1040px; margin: 0 auto; padding: 28px 0 72px; }
.verse-location { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ui-line); font-size: 13px; }
.verse-location a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--ui-surface); border: 1px solid var(--ui-line); color: var(--ui-muted); font-weight: 700; text-decoration: none;
}
.verse-location a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.verse-title { margin: 22px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.verse-title::before { content: ""; display: block; width: 36px; height: 3px; margin-bottom: 12px; border-radius: 3px; background: var(--ui-gold); }
.verse-title span[lang="ar"] { display: block; margin-top: 6px; text-align: start; font-family: "Amiri Quran", "Amiri", serif; color: var(--ui-muted); font-size: 24px; font-weight: 400; letter-spacing: 0; line-height: 1.8; }
.verse-page-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 22px; }
/* G-1: previous and next verse */
.verse-steps { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 22px; }
.verse-steps a { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font-weight: 700; text-decoration: none; }
.verse-steps a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.verse-steps a[rel="next"] { margin-inline-start: auto; }
.verse-page-actions a, .verse-page-actions button {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; box-sizing: border-box; border-radius: 12px;
  font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.verse-page-actions a { border: 1px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-ink); }
.verse-page-actions a:hover { background: var(--ui-surface2); }
.verse-page-actions a::before {
  content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("/assets/icons/book.svg") center / contain no-repeat; mask: url("/assets/icons/book.svg") center / contain no-repeat;
}
.verse-page-actions button { border: 0; background: var(--ui-primary); color: var(--ui-primary-ink); }
.verse-page-actions button:hover { filter: brightness(1.08); }
.verse-page-actions button::before {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("/assets/icons/play.svg") center / contain no-repeat; mask: url("/assets/icons/play.svg") center / contain no-repeat;
}
#verse-landing-card .verse-card { padding: 24px 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.verse-tafsir {
  display: flex; flex-direction: column; gap: 12px; margin-top: 28px; padding: 26px 28px; border-radius: 22px;
  background: var(--ui-surface); border: 1px solid var(--ui-line);
}
.verse-tafsir h2 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 20px; font-weight: 800; }
.verse-tafsir h2::before {
  content: ""; flex: none; width: 22px; height: 22px; background: var(--ui-primary);
  -webkit-mask: url("/assets/icons/book.svg") center / contain no-repeat; mask: url("/assets/icons/book.svg") center / contain no-repeat;
}
.verse-tafsir > p { margin: 0; }
.verse-tafsir > p:nth-of-type(1) { align-self: flex-start; padding: 4px 10px; border-radius: 8px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 12px; font-weight: 700; }
.verse-tafsir > p:nth-of-type(2) {
  color: var(--ui-ink); font-size: 16px; line-height: 1.75;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 8; overflow: hidden;
}
.verse-tafsir > p:last-child a { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.verse-tafsir > p:last-child a::after {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("/assets/icons/arrow.svg") center / contain no-repeat; mask: url("/assets/icons/arrow.svg") center / contain no-repeat;
}
@media (max-width: 640px) {
  .verse-page { padding-top: 18px; }
  .verse-title { font-size: 24px; }
  .verse-title span[lang="ar"] { font-size: 22px; }
  #verse-landing-card .verse-card { padding: 18px 16px; }
  .verse-tafsir { padding: 20px 18px; }
}

/* ---- 12. Surah info (screen 5, views/pages/surah-info.php). One grid: the hero band, then the text column. ---- */
#main > .surah-info {
  display: grid; margin: 0 -16px; padding-bottom: 72px;
  grid-template-columns: [full-start] minmax(16px, 1fr) [c-start] minmax(0, 880px) [c-end] minmax(16px, 1fr) [full-end];
  color: var(--ui-ink);
}
.surah-info::before {
  content: ""; grid-column: full; grid-row: 1 / 7;
  background:
    radial-gradient(circle at 80% 10%, rgba(31, 160, 122, 0.5), transparent 32%),
    radial-gradient(circle at 15% 100%, rgba(217, 164, 74, 0.3), transparent 26%),
    url("/assets/brand/pattern.svg"), var(--ui-hero);
}
.surah-info::after { content: ""; grid-column: full; grid-row: 6; height: 44px; }
.surah-info > * { grid-column: c; min-width: 0; z-index: 1; }
.surah-info > .surah-name { grid-row: 1; margin: 40px 0 0; text-align: center; color: var(--ui-hero-ink); font-size: 60px; line-height: 1.2; }
.surah-info > h1 { grid-row: 2; margin: 6px 0 0; text-align: center; color: var(--ui-hero-ink); font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.surah-info > h1 span[lang="ar"] { display: block; margin-bottom: 4px; font-family: "Amiri", serif; color: var(--ui-hero-gold); font-size: 22px; font-weight: 400; letter-spacing: 0; }
.surah-info > p:not([class]):not(:has(a)) { grid-row: 3; margin: 6px 0 0; text-align: center; color: var(--ui-hero-muted); font-size: 16px; }
.surah-info-details { grid-row: 4; margin: 20px 0 0; }
.surah-info-details { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; justify-content: center; column-gap: 12px; }
.surah-info-details dt {
  padding: 10px 18px 0; border-radius: 16px 16px 0 0; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--ui-hero-line); border-bottom: 0;
  color: var(--ui-hero-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-align: center;
}
.surah-info-details dd {
  min-width: 110px; margin: 0; padding: 2px 18px 10px; border-radius: 0 0 16px 16px; background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--ui-hero-line); border-top: 0; color: var(--ui-hero-ink); font-size: 22px; font-weight: 800; text-align: center;
}
.surah-info > p:has(> a) { grid-row: 5; margin: 18px 0 0; text-align: center; }
.surah-info > p:has(> a) a {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px;
  background: var(--ui-hero-ink); color: var(--ui-hero); font-size: 14px; font-weight: 800; text-decoration: none;
}
.surah-info > p:has(> a) a::after {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("/assets/icons/arrow.svg") center / contain no-repeat; mask: url("/assets/icons/arrow.svg") center / contain no-repeat;
}

/* Toolbar: the sources as tabs, the font size control at the end */
.surah-info > nav:not([data-info-pager]) { grid-row: 7; justify-self: start; margin-top: 28px; }
.surah-info > nav:not([data-info-pager]) ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 4px; list-style: none; border-radius: 12px; background: var(--ui-surface2); }
.surah-info > nav:not([data-info-pager]) a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 9px; color: var(--ui-muted);
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.surah-info > nav:not([data-info-pager]) a[aria-current="page"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.surah-info > [data-font-control] { grid-row: 7; justify-self: end; align-self: end; display: flex; align-items: center; gap: 6px; margin-top: 28px; }
.surah-info > [data-font-control] button {
  width: 36px; height: 36px; padding: 0; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface);
  color: var(--ui-ink); font-size: 18px; font-weight: 700; cursor: pointer;
}
.surah-info > [data-font-control] button:hover:not(:disabled) { background: var(--ui-surface2); }
.surah-info > [data-font-control] button:disabled { opacity: 0.4; cursor: default; }
.surah-info > [data-font-control] output { min-width: 24px; text-align: center; color: var(--ui-muted); font-size: 14px; font-weight: 800; }

/* The text card */
.surah-info-source { grid-row: 8; margin: 18px 0 0; color: var(--ui-muted); font-size: 13px; font-weight: 600; }
.surah-info-text {
  grid-row: 9; margin-top: 10px; padding: 32px 36px; border-radius: 22px; background: var(--ui-surface); border: 1px solid var(--ui-line);
  line-height: 1.8;
}
.surah-info-text h2, .surah-info-text h3, .surah-info-text h4 { margin: 1.2em 0 0.4em; font-size: 1.25em; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.surah-info-text section > :first-child { margin-top: 0; }
.surah-info-text p { margin: 0 0 1em; }
.surah-info-text ul, .surah-info-text ol { margin: 0 0 1em; padding-inline-start: 1.4em; }

/* Pager */
.surah-info > [data-info-pager] { grid-row: 10; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.surah-info > [data-info-pager] button {
  min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface);
  color: var(--ui-ink); font-size: 14px; font-weight: 700; cursor: pointer;
}
.surah-info > [data-info-pager] button[aria-current="page"] { background: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-primary-ink); }
.surah-info > [data-info-pager] button:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 640px) {
  .surah-info > .surah-name { margin-top: 28px; font-size: 46px; }
  .surah-info > h1 { font-size: 24px; }
  .surah-info > nav:not([data-info-pager]) { grid-row: 7; justify-self: stretch; }
  .surah-info > [data-font-control] { grid-row: 8; justify-self: start; margin-top: 12px; }
  .surah-info-source { grid-row: 9; }
  .surah-info-text { grid-row: 10; padding: 22px 18px; }
  .surah-info > [data-info-pager] { grid-row: 11; }
}

/* ---- 13. Surah list (/surahs) ---- */
.surahs-page { max-width: 1160px; margin: 0 auto; padding: 40px 24px 64px; }
.surahs-page > .page-eyebrow { margin: 0 0 8px; color: var(--ui-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.surahs-page > h1 {
  margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--ui-line);
  color: var(--ui-ink); font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em;
}
@media (max-width: 640px) {
  .surahs-page { padding: 24px 0 48px; }
  .surahs-page .surah-index-list a { min-height: 68px; padding: 12px 14px; }
}

/* ---- 14. Translations and tafsirs directory (/translations, /tafsirs, /{c}/translations, /{c}/{v}/translations) ----
   pages/translations.js hides items and groups with the hidden attribute, so every display rule here keeps [hidden] winning. */
.directory-page {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 28px; align-items: start;
  max-width: 1160px; margin: 0 auto; padding: 40px 24px 72px;
}
.directory-page > h1 {
  grid-column: 1; grid-row: 1; align-self: end; margin: 0 0 24px;
  color: var(--ui-ink); font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em;
}
.directory-search { grid-column: 2; grid-row: 1; justify-self: end; align-self: end; position: relative; width: min(360px, 100%); margin: 0 0 24px; }
.directory-search::before {
  content: ""; position: absolute; left: 16px; top: 0; bottom: 0; margin: auto; width: 18px; height: 18px; background: var(--ui-muted);
  -webkit-mask-image: url("/assets/icons/search.svg"); mask-image: url("/assets/icons/search.svg"); pointer-events: none;
}
.directory-search input[type="search"] {
  width: 100%; height: 46px; box-sizing: border-box; padding: 0 16px 0 44px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 15px;
}
.directory-search input[type="search"]:focus { outline: 2px solid var(--ui-primary); outline-offset: 1px; border-color: transparent; }
.directory-search input::placeholder { color: var(--ui-muted); }

.directory-languages {
  grid-column: 1; grid-row: 2; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 32px); overflow-y: auto; padding: 10px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 18px;
}
.directory-languages button {
  flex: none; display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 600; text-align: start; cursor: pointer;
}
.directory-languages button:hover { background: var(--ui-surface2); }
.directory-languages button[aria-pressed="true"] { background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 800; }

.directory-results { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.directory-empty { margin: 0; padding: 18px 20px; border-radius: 14px; background: var(--ui-surface2); color: var(--ui-muted); font-size: 15px; }
.directory-group h2 { margin: 0 0 12px; color: var(--ui-ink); font-size: 19px; font-weight: 800; }
.directory-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.directory-list li {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 16px; column-gap: 14px; row-gap: 2px; align-items: center;
  min-height: 72px; padding: 14px 16px; box-sizing: border-box; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 16px;
}
.directory-list li::after {
  content: ""; grid-column: 3; grid-row: 1 / 3; width: 16px; height: 16px; background: var(--ui-muted);
  -webkit-mask-image: url("/assets/icons/cr.svg"); mask-image: url("/assets/icons/cr.svg");
}
.directory-list li:hover { border-color: var(--ui-primary); }
.directory-list li:hover::after { background: var(--ui-primary); }
.directory-list a { grid-column: 2; grid-row: 1; color: var(--ui-ink); font-size: 15px; font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }
.directory-list a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.directory-list a:focus-visible { outline: none; }
.directory-list a:focus-visible::after { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
/* The " · " separator span doubles as the book tile: its text stays in the page, only hidden from view. */
.directory-sep {
  grid-column: 1; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 12px; background: var(--ui-primary-soft); font-size: 0; overflow: hidden;
}
.directory-sep::before {
  content: ""; width: 18px; height: 18px; background: var(--ui-primary);
  -webkit-mask-image: url("/assets/icons/book.svg"); mask-image: url("/assets/icons/book.svg");
}
.directory-by { grid-column: 2; grid-row: 2; color: var(--ui-muted); font-size: 13px; overflow-wrap: anywhere; }
.directory-page [hidden] { display: none !important; }

@media (max-width: 900px) {
  .directory-page { grid-template-columns: minmax(0, 1fr); }
  .directory-page > h1 { grid-column: 1; grid-row: 1; margin-bottom: 16px; }
  .directory-search { grid-column: 1; grid-row: 2; justify-self: stretch; width: 100%; margin-bottom: 14px; }
  .directory-languages {
    grid-column: 1; grid-row: 3; position: static; flex-direction: row; max-height: none; overflow-x: auto; margin-bottom: 22px;
    padding: 0 0 4px; background: none; border: 0; border-radius: 0; gap: 8px; scrollbar-width: thin;
  }
  .directory-languages button { width: auto; white-space: nowrap; padding: 8px 14px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface); }
  .directory-languages button[aria-pressed="true"] { border-color: transparent; }
  .directory-results { grid-column: 1; grid-row: 4; }
}
@media (max-width: 640px) {
  .directory-page { padding: 24px 0 48px; }
  .directory-list { grid-template-columns: minmax(0, 1fr); }
}


/* ---- 15. Study: the page (#study-page, /{c}/{v}/{tab}) and the dialog over the reader (#study) ----
   features/study.js builds the same shell in both. .study-body keeps its rem-based scale from app.css,
   so everything inside it is sized in em. */
.study-page { max-width: 1000px; margin: 0 auto; padding: 32px 24px 80px; }
.study-page > h1 { margin: 0 0 18px; color: var(--ui-ink); font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.02em; }

#study.modal {
  top: 40px; bottom: auto; width: min(920px, calc(100% - 24px)); max-height: calc(100vh - 80px); box-sizing: border-box;
  padding: 0 26px 26px; background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(17, 27, 23, 0.22), 0 0 0 100vmax rgba(8, 14, 12, 0.45);
}
#study > h2 { margin: 22px 0 4px; font-size: 20px; font-weight: 800; }

:is(.study-page, #study) .study-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--ui-line);
}
#study .study-header { position: sticky; top: 0; z-index: 2; margin: 0 -26px 18px; padding: 14px 26px; background: var(--ui-surface); }
:is(.study-page, #study) .study-header label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:is(.study-page, #study) select {
  height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background-color: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 600; max-width: 100%;
}
.study-header #study-surah { width: 200px; }
.study-header #study-verse { width: 96px; }
.study-header button, .study-header [data-study-key] button, [data-study-scale] button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 14px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.study-header button:hover:not(:disabled), [data-study-scale] button:hover { background: var(--ui-surface2); }
.study-header button:disabled { opacity: 0.4; cursor: default; }
/* Icon-only buttons keep their text for the accessible name; font-size 0 hides it. */
.study-header [data-study="previous"], .study-header [data-study="next"], .study-header [data-study="close"], .study-header [data-study-key] [data-verse-action="more"] {
  width: 40px; padding: 0; font-size: 0;
}
.study-header [data-study="previous"]::before, .study-header [data-study="next"]::before, .study-header [data-study="close"]::before,
.study-header [data-verse-action="more"]::before, .study-header [data-study="pin"]::before {
  content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.study-header [data-study="previous"] { --icon: url("/assets/icons/cl.svg"); }
.study-header [data-study="next"] { --icon: url("/assets/icons/cr.svg"); }
.study-header [data-study="close"] { --icon: url("/assets/icons/close.svg"); }
.study-header [data-verse-action="more"] { --icon: url("/assets/icons/more.svg"); }
.study-header [data-study="pin"] { --icon: url("/assets/icons/bookmarks.svg"); margin-left: auto; background: transparent; }
[dir="rtl"] .study-header [data-study="pin"] { margin-left: 0; margin-right: auto; }
.study-header [data-study="pin"][aria-pressed="true"] { background: var(--ui-primary-soft); border-color: transparent; color: var(--ui-primary); }
[dir="rtl"] .study-header [data-study="previous"]::before, [dir="rtl"] .study-header [data-study="next"]::before { transform: scaleX(-1); }

:is(.study-page, #study) [data-study-pins]:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
:is(.study-page, #study) [data-study-pins] button {
  height: 32px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface2); color: var(--ui-ink);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}

:is(.study-page, #study) [role="tablist"] {
  display: flex; gap: 4px; overflow-x: auto; margin: 0 0 20px; border-bottom: 1px solid var(--ui-line); scrollbar-width: none;
}
:is(.study-page, #study) [role="tablist"] [role="tab"] {
  flex: none; height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  color: var(--ui-muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
:is(.study-page, #study) [role="tablist"] [role="tab"]:hover { color: var(--ui-ink); }
:is(.study-page, #study) [role="tablist"] [role="tab"][aria-selected="true"] { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }

#study-panel { display: flex; flex-direction: column; gap: 18px; }
#study-panel [data-study-card] .verse-card {
  padding: 18px 22px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface2);
}
.study-page #study-panel [data-study-card] .verse-card { background: var(--ui-surface); }
#study-panel [data-study-card] .verse-card [data-slot="study"] { display: none; }
/* In the study card the verse actions run along the top, as on phones in the reader. */
#study-panel [data-study-card] .verse-card { grid-template-columns: minmax(0, 1fr); }
#study-panel [data-study-card] .verse-card > * { grid-column: 1; }
#study-panel [data-study-card] .verse-card > .verse-actions { grid-row: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; }
#study-panel [data-study-card] .verse-card .verse-key { margin: 0 6px 0 0; }

[data-study-scale]:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; align-self: flex-end; }
[data-study-scale] button { width: 36px; height: 36px; min-width: 36px; padding: 0; font-size: 18px; }
[data-study-scale] output { min-width: 22px; color: var(--ui-muted); font-size: 14px; font-weight: 700; text-align: center; }

/* Tab bodies */
.study-body { color: var(--ui-ink); line-height: 1.75; }
.study-body h3 { margin: 0 0 0.4em; font-size: 1.05em; font-weight: 800; }
.study-body .tafsir-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 14px; }
.study-body .tafsir-selection label { color: var(--ui-muted); font-weight: 700; }
.study-body .tafsir-selection [role="group"] { display: contents; }
.study-body .tafsir-selection [data-tafsir], .study-body .qr-controls [role="group"] button {
  height: 36px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.study-body .tafsir-selection [data-tafsir][aria-pressed="true"], .study-body .qr-controls [role="group"] button[aria-pressed="true"] {
  border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink);
}
.study-body [data-tafsir-content] { padding: 28px 32px; border: 1px solid var(--ui-line); border-radius: 20px; background: var(--ui-surface); }
#study .study-body [data-tafsir-content] { background: var(--ui-bg); }
.study-body .tafsir-text h2 { margin: 1.2em 0 0.4em; font-size: 1.2em; font-weight: 800; line-height: 1.35; }
.study-body .tafsir-text h2:first-child { margin-top: 0; }
.study-body .tafsir-text p { margin: 0 0 0.9em; }
.study-body .tafsir-text [lang="ar"], .study-body [dir="rtl"][lang="ar"] { font-family: "Amiri", serif; font-size: 1.25em; line-height: 2; }
.study-body .tafsir-nav, .study-body .study-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 18px; }
.study-body .tafsir-nav button, .study-body .study-nav button, .study-body [data-more] button {
  height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.study-body .tafsir-nav button:only-child { margin-left: auto; }
.study-body .study-nav button:disabled { opacity: 0.4; cursor: default; }

.study-body .qr-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 14px; }
.study-body .qr-controls [role="group"] { display: inline-flex; gap: 6px; }
.study-body .qr-controls fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; font-size: 13px; }
.study-body .qr-controls legend { float: left; margin-right: 6px; color: var(--ui-muted); font-weight: 700; }
.study-body .qr-controls fieldset label {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); cursor: pointer;
}
.study-body .qr-controls fieldset label:has(input:checked) { border-color: var(--ui-primary); background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 700; }
.study-body .qr-controls input[type="checkbox"] { accent-color: var(--ui-primary); margin: 0; }
.study-body .study-notice { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--ui-gold-soft); color: var(--ui-ink); font-size: 0.85em; line-height: 1.6; }

.study-body .study-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.study-body .study-list > li > article, .study-body [data-questions] > li {
  padding: 18px 22px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface);
}
#study .study-body .study-list > li > article, #study .study-body [data-questions] > li { background: var(--ui-bg); }
.study-body .study-list article h3 { margin: 0; font-size: 1em; }
.study-body .qr-date, .study-body .qr-social, .study-body .answer-type { margin: 2px 0 10px; color: var(--ui-muted); font-size: 0.8em; font-weight: 600; }
.study-body .qr-social { margin: 10px 0 0; }
.study-body .qr-body { white-space: pre-line; }
.study-body .study-list article > button[aria-expanded] {
  margin-top: 8px; padding: 0; border: 0; background: none; color: var(--ui-primary); font: inherit; font-size: 0.85em; font-weight: 700; cursor: pointer;
}
.study-body .hadith-grade {
  display: inline-block; margin: 6px 0 10px; padding: 3px 10px; border-radius: 8px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 0.75em; font-weight: 700;
}
.study-body .hadith-body p { margin: 0 0 0.6em; }
.study-body [data-questions] > li h3 { margin: 0; }
.study-body [data-questions] > li h3 button {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 0; border: 0; background: none;
  color: var(--ui-ink); font: inherit; font-weight: 800; text-align: start; cursor: pointer;
}
.study-body [data-questions] > li h3 button::after {
  content: ""; flex: none; width: 16px; height: 16px; background: var(--ui-muted); transition: transform 0.15s;
  -webkit-mask: url("/assets/icons/cr.svg") center / contain no-repeat; mask: url("/assets/icons/cr.svg") center / contain no-repeat; transform: rotate(90deg);
}
.study-body [data-questions] > li h3 button[aria-expanded="true"]::after { transform: rotate(-90deg); }
.study-body .answer:not([hidden]) { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ui-line); }
.study-body .answer-body ol, .study-body .answer-body ul { padding-inline-start: 1.4em; }
.study-body a { color: var(--ui-primary); }
.study-body > h3 + .study-list > li > a, .study-body ul.study-list:not([data-questions]) > li > a {
  display: block; padding: 14px 18px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-surface); color: var(--ui-ink); font-weight: 700; text-decoration: none;
}
.study-body ul.study-list:not([data-questions]) > li > a:hover { border-color: var(--ui-primary); }

@media (max-width: 640px) {
  .study-page { padding: 20px 0 56px; }
  #study.modal { top: 0; width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; border: 0; padding: 0 16px 20px; }
  #study .study-header { margin: 0 -16px 14px; padding: 10px 16px; }
  .study-header #study-surah { flex: 1 1 70%; width: auto; min-width: 0; }
  .study-header #study-verse { flex: 0 0 84px; width: 84px; }
  .study-header [data-study="pin"] { flex: 1 1 auto; margin-left: 0; }
  .study-body [data-tafsir-content] { padding: 20px 18px; }
  #study-panel [data-study-card] .verse-card { padding: 14px 14px; }
  #study-panel [data-study-card] .verse-card .verse-actions button { width: 32px; height: 32px; }
}

/* ---- 16. Search page (/search). features/search.js fills [data-search-body] (page mode). ---- */
.search-page { max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; }
.search-page > h1 { margin: 0 0 18px; color: var(--ui-ink); font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; }
.search-page form[role="search"] {
  position: relative; display: flex; align-items: center; height: 60px; margin: 0 0 26px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 16px; box-shadow: 0 10px 30px rgba(17, 27, 23, 0.08);
}
.search-page form[role="search"]:focus-within { border-color: var(--ui-primary); }
.search-page form[role="search"]::before {
  content: ""; flex: none; width: 20px; height: 20px; margin: 0 4px 0 20px; background: var(--ui-muted);
  -webkit-mask-image: url("/assets/icons/search.svg"); mask-image: url("/assets/icons/search.svg");
}
.search-page form[role="search"] input[type="search"] {
  flex: 1; min-width: 0; height: 100%; padding: 0 18px 0 10px; border: 0; background: transparent; color: var(--ui-ink); font: inherit; font-size: 17px; outline: none;
}
.search-page form[role="search"] input::placeholder { color: var(--ui-muted); }

.search-page [data-search-body] section h3 { margin: 0 0 12px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.search-page [data-search-body] section ul { margin: 0 0 24px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.search-page [data-search-body] section a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 14px; font-weight: 700; text-decoration: none;
}
.search-page [data-search-body] section a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.search-page [data-search-body] section button {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px dashed var(--ui-line); border-radius: 999px;
  background: transparent; color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.search-page [data-search-body] section button:hover { border-style: solid; border-color: var(--ui-primary); color: var(--ui-primary); }
.search-page form[role="search"] .voice-search {
  position: relative; flex: none; width: 44px; height: 44px; margin-right: 8px; padding: 0; overflow: hidden; border: 0; border-radius: 12px;
  background: var(--ui-surface2); color: var(--ui-primary); font-size: 0; cursor: pointer;
}
.search-page form[role="search"] .voice-search::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; background: currentColor;
  -webkit-mask-image: url("/assets/icons/mic.svg"); mask-image: url("/assets/icons/mic.svg");
}
.search-page form[role="search"] .voice-search[aria-pressed="true"] { background: var(--ui-primary); color: var(--ui-primary-ink); }

.search-page .search-summary { margin: 0 0 14px; color: var(--ui-muted); font-size: 14px; font-weight: 600; }
.search-page .search-empty { margin: 0 0 6px; color: var(--ui-ink); font-size: 18px; font-weight: 800; }
.search-page .search-empty + p { margin: 0; color: var(--ui-muted); }
.search-page .search-results { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.search-page .search-results > li {
  position: relative; padding: 20px 24px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface);
}
.search-page .search-results > li:hover { border-color: var(--ui-primary); }
.search-page .search-hit { display: flex; align-items: baseline; gap: 12px; color: var(--ui-ink); text-decoration: none; line-height: 1.7; }
.search-page .search-hit::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.search-page .search-hit:focus-visible { outline: none; }
.search-page .search-hit:focus-visible::after { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.search-page .search-hit-key {
  flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px;
  background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 800;
}
.search-page .search-hit-name { min-width: 0; font-size: 16px; }
.search-page .search-hit[data-result-type]:not([data-result-type="ayah"]) .search-hit-name { font-weight: 800; }
.search-page .search-hit-name em { font-style: normal; font-weight: 700; background: var(--highlight); border-radius: 4px; padding: 0 2px; }
.search-page .search-hit-arabic { margin: 12px 0 0; color: var(--ui-ink); font-family: "Amiri Quran", "UthmanicHafs", "Amiri", serif; font-size: 26px; line-height: 2; text-align: right; }
.search-page .search-hit[data-result-type]:not([data-result-type="ayah"]) + .search-hit-arabic { margin-top: 4px; font-family: "Amiri", serif; font-size: 20px; line-height: 1.6; color: var(--ui-muted); }

.search-page nav[aria-label] { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 24px; }
.search-page nav[aria-label] button {
  min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.search-page nav[aria-label] button:hover { background: var(--ui-surface2); }
.search-page nav[aria-label] button[aria-current="page"] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.search-page nav[aria-label] span { color: var(--ui-muted); }

@media (max-width: 640px) {
  .search-page { padding: 24px 0 56px; }
  .search-page form[role="search"] { height: 52px; }
  .search-page .search-results > li { padding: 16px 16px; }
  .search-page .search-hit { flex-direction: column; gap: 6px; }
  .search-page .search-hit-arabic { font-size: 22px; }
}

/* ---- 17. Hero pages (shared; first used by Listen: /reciters, /reciters/{id}, /reciters/{id}/{surah}, /radio).
   Each page is .hero-page with a .page-hero band on top. The page scripts filter with the hidden attribute. ---- */
#main > .hero-page { margin: 0 -16px; padding-bottom: 80px; color: var(--ui-ink); --page-pad: max(24px, calc((100% - 1160px) / 2)); }
.hero-page [hidden] { display: none !important; }
#main > .hero-page:has(> .page-hero:last-child) { padding-bottom: 0; }
.page-hero:last-child { margin-bottom: 0; }
.hero-page > :not(.page-hero) { margin-left: var(--page-pad); margin-right: var(--page-pad); }
.page-hero {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 56px var(--page-pad) 56px; margin-bottom: 36px; color: var(--ui-hero-ink);
  background:
    radial-gradient(circle at 82% 0%, rgba(31, 160, 122, 0.5), transparent 34%),
    radial-gradient(circle at 12% 100%, rgba(217, 164, 74, 0.28), transparent 28%),
    url("/assets/brand/pattern.svg"), var(--ui-hero);
}
.page-hero h1 { margin: 0; color: var(--ui-hero-ink); font-size: clamp(30px, 4vw, 46px); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.page-hero .hero-lead { margin: 0; max-width: 560px; color: var(--ui-hero-muted); font-size: 17px; line-height: 1.6; }
.page-hero .hero-back { margin: 0 0 4px; }
.page-hero .hero-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-hero-muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.page-hero .hero-back a::before {
  content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/icons/cl.svg") center / contain no-repeat; mask: url("/assets/icons/cl.svg") center / contain no-repeat;
}
[dir="rtl"] .page-hero .hero-back a::before { transform: scaleX(-1); }
.page-hero .hero-back a:hover { color: var(--ui-hero-ink); }

/* Hero buttons: the first is solid (play), the rest glass. */
.page-hero .hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 0; }
.page-hero .hero-actions > a, .page-hero .hero-actions > button {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; box-sizing: border-box;
  border: 1px solid var(--ui-hero-line); border-radius: 14px; background: rgba(255, 255, 255, 0.08);
  color: var(--ui-hero-ink); font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.page-hero .hero-actions > a:hover, .page-hero .hero-actions > button:hover { background: rgba(255, 255, 255, 0.16); }
.page-hero .hero-actions > :first-child { border-color: transparent; background: var(--ui-hero-ink); color: var(--ui-hero); }
.page-hero .hero-actions > :first-child:hover { background: #FFFFFF; }
.page-hero .hero-actions > a::before, .page-hero .hero-actions > button::before {
  content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.page-hero [data-reciter-play], .page-hero [data-radio-play] { --icon: url("/assets/icons/play.svg"); }
.page-hero [data-reciter-radio] { --icon: url("/assets/icons/volume.svg"); }
.page-hero .hero-actions > a:not([download]) { --icon: url("/assets/icons/book.svg"); }
.page-hero [data-reciter-copy] { --icon: url("/assets/icons/copy.svg"); }
.page-hero [data-reciter-download] { --icon: url("/assets/icons/download.svg"); }
.page-hero [data-radio-station]:not(:empty) {
  margin: 6px 0 0; padding: 10px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--ui-hero-line);
  color: var(--ui-hero-ink); font-size: 14px; font-weight: 600;
}
.radio-page .page-hero { align-items: center; text-align: center; padding-top: 72px; padding-bottom: 80px; }
.radio-page .page-hero .hero-actions { justify-content: center; }
.radio-page .page-hero [data-radio-play] { height: 56px; padding: 0 28px; border-radius: 999px; font-size: 16px; }

/* Search boxes */
.page-search { position: relative; margin: 0 0 20px; }
.page-search::before {
  content: ""; position: absolute; left: 16px; top: 0; bottom: 0; margin: auto; width: 18px; height: 18px; background: var(--ui-muted); pointer-events: none;
  -webkit-mask: url("/assets/icons/search.svg") center / contain no-repeat; mask: url("/assets/icons/search.svg") center / contain no-repeat;
}
.page-search input {
  width: 100%; max-width: 380px; height: 48px; box-sizing: border-box; padding: 0 16px 0 44px; border: 1px solid var(--ui-line); border-radius: 14px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 15px;
}
.page-search input:focus { outline: 2px solid var(--ui-primary); outline-offset: 1px; border-color: transparent; }
.page-hero .page-search { width: min(380px, 100%); margin: 14px 0 0; }
.page-hero .page-search input { max-width: none; border-color: transparent; }
.page-empty { padding: 18px 20px; border-radius: 14px; background: var(--ui-surface2); color: var(--ui-muted); }

/* /reciters: a grid of reciter cards */
.reciter-grid { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.reciter-grid li {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 18px 22px; box-sizing: border-box;
  text-align: center; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 20px;
}
.reciter-grid li::before {
  content: ""; width: 72px; height: 72px; margin-bottom: 10px; border-radius: 50%;
  background: url("/assets/brand/pattern.svg"), radial-gradient(circle at 30% 20%, rgba(31, 160, 122, 0.7), transparent 60%), var(--ui-hero);
}
.reciter-grid li::after {
  content: ""; position: absolute; top: 46px; left: 0; right: 0; margin: auto; width: 26px; height: 26px; background: var(--ui-hero-ink); pointer-events: none;
  -webkit-mask: url("/assets/icons/headphones.svg") center / contain no-repeat; mask: url("/assets/icons/headphones.svg") center / contain no-repeat;
}
.reciter-grid li:hover { border-color: var(--ui-primary); }
.reciter-grid a { color: var(--ui-ink); font-size: 16px; font-weight: 800; text-decoration: none; }
.reciter-grid a::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.reciter-grid a:focus-visible { outline: none; }
.reciter-grid a:focus-visible::before { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.reciter-grid span { color: var(--ui-muted); font-size: 13px; }

/* /reciters/{id}: the chapter rows */
.reciter-chapters { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.reciter-chapters li {
  display: flex; align-items: center; gap: 6px; min-height: 64px; padding: 10px 12px 10px 10px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 16px;
}
.reciter-chapters li:hover { border-color: var(--ui-primary); }
.reciter-chapters [data-reciter-play] {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px 0 0; border: 0; background: none;
  color: var(--ui-ink); font: inherit; font-size: 15px; font-weight: 800; text-align: start; cursor: pointer;
}
.reciter-chapters [data-reciter-play]::before {
  content: ""; flex: none; width: 44px; height: 44px; border-radius: 50%; background-color: var(--ui-primary-soft);
}
[dir="rtl"] .reciter-chapters [data-reciter-play]::after { left: auto; right: 14px; transform: scaleX(-1); }
.reciter-chapters [data-reciter-play]::after {
  content: ""; position: absolute; left: 15px; top: 14px; width: 16px; height: 16px; background: var(--ui-primary);
  -webkit-mask: url("/assets/icons/play.svg") center / contain no-repeat; mask: url("/assets/icons/play.svg") center / contain no-repeat;
}
.reciter-chapters [data-reciter-play]:hover::before { background-color: var(--ui-primary); }
.reciter-chapters [data-reciter-play]:hover::after { background: var(--ui-primary-ink); }
.reciter-chapters li > a, .reciter-chapters li > button:not([data-reciter-play]) {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; box-sizing: border-box;
  border: 0; border-radius: 10px; background: none; color: var(--ui-muted); font-size: 0; text-decoration: none; cursor: pointer;
}
.reciter-chapters li > a:hover, .reciter-chapters li > button:not([data-reciter-play]):hover { background: var(--ui-surface2); color: var(--ui-ink); }
.reciter-chapters li > a::before, .reciter-chapters li > button:not([data-reciter-play])::before {
  content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.reciter-chapters li > a:not([download]) { --icon: url("/assets/icons/arrow.svg"); }
.reciter-chapters [data-reciter-copy] { --icon: url("/assets/icons/copy.svg"); }
.reciter-chapters [data-reciter-download] { --icon: url("/assets/icons/download.svg"); }

@media (max-width: 1100px) { .reciter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .reciter-chapters { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .reciter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  #main > .hero-page { --page-pad: 16px; }
  .page-hero { padding-top: 36px; padding-bottom: 40px; margin-bottom: 24px; }
  .page-hero .hero-actions > a, .page-hero .hero-actions > button { height: 42px; padding: 0 14px; font-size: 14px; }
  .reciter-grid { gap: 10px; }
  .reciter-grid li { padding: 18px 12px; }
}

/* ---- 18. Dialog base (QK.ui.modal adds .modal.is-open to any role="dialog" element) and Learn: /learning-plans,
   /my-learning-plans, /learning-plans/{slug}, a lesson. Screen 25 refines the dialogs. ---- */
.modal.is-open {
  box-sizing: border-box; width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 80px); top: 40px; padding: 26px 28px;
  background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(17, 27, 23, 0.22), 0 0 0 100vmax rgba(8, 14, 12, 0.45);
}
.modal.is-open > h2:first-child { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.modal.is-open fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.modal.is-open legend { margin-bottom: 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.modal.is-open fieldset > span { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; padding: 6px 12px; border: 1px solid var(--ui-line); border-radius: 999px; font-size: 14px; }
.modal.is-open fieldset > span:has(input:checked) { border-color: var(--ui-primary); background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 700; }
.modal.is-open input[type="checkbox"], .modal.is-open input[type="radio"] { accent-color: var(--ui-primary); margin: 0; }
.modal.is-open textarea {
  width: 100%; min-height: 120px; box-sizing: border-box; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px; resize: vertical;
}
.modal.is-open .dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin: 18px 0 0; }
.modal.is-open .dialog-actions button {
  height: 42px; padding: 0 18px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.modal.is-open .dialog-actions button:hover { background: var(--ui-surface2); }
.modal.is-open .dialog-actions button[type="submit"], .modal.is-open .dialog-actions button[data-close]:last-child:not(:first-child) {
  border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink);
}
.modal.is-open [role="alert"]:not(:empty) { flex-basis: 100%; color: var(--ui-danger, #B42318); font-size: 14px; }
.modal.is-open [role="radiogroup"] { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; font-size: 14px; }
@media (max-width: 640px) {
  .modal.is-open { top: auto; bottom: 0; width: 100%; max-height: 90vh; border-radius: 22px 22px 0 0; padding: 22px 18px 26px; }
}

/* Shared bits for content pages */
.page-hero .hero-badge {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); color: var(--ui-hero-gold); font-size: 13px; font-weight: 700;
}
.page-more { display: flex; justify-content: center; margin-top: 24px; }
.page-more button, .page-more a {
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.page-more button:hover, .page-more a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.page-tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 24px; border-bottom: 1px solid var(--ui-line); scrollbar-width: none; }
.page-tabs [role="tab"] {
  flex: none; height: 46px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  color: var(--ui-muted); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.page-tabs [role="tab"]:hover { color: var(--ui-ink); }
.page-tabs [role="tab"][aria-selected="true"] { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }
.page-prose { color: var(--ui-ink); font-size: 17px; line-height: 1.8; }
.page-prose h2 { margin: 1.6em 0 0.5em; font-size: 21px; font-weight: 800; line-height: 1.3; }
.page-prose > h2:first-child { margin-top: 0; }
.page-prose h3 { margin: 1.2em 0 0.3em; font-size: 17px; font-weight: 800; }
.page-prose p { margin: 0 0 1em; }
.page-prose a { color: var(--ui-primary); }
.page-prose img { max-width: 100%; height: auto; border-radius: 14px; }
.page-prose blockquote { margin: 1em 0; padding: 16px 20px; border-radius: 14px; background: var(--ui-surface2); }
.link-cards { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.link-cards a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 100%; min-height: 60px; padding: 14px 18px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-surface); color: var(--ui-ink); font-size: 15px; font-weight: 700; line-height: 1.4; text-decoration: none;
}
.link-cards a::after {
  content: ""; flex: none; width: 16px; height: 16px; background: var(--ui-muted); -webkit-mask: url("/assets/icons/cr.svg") center / contain no-repeat; mask: url("/assets/icons/cr.svg") center / contain no-repeat;
}
.link-cards a:hover { border-color: var(--ui-primary); }

/* /learning-plans: the hero filter button is glass, the list reuses the Home plan cards */
.plans-page .page-hero .hero-actions > [data-plans-filter-open] { border-color: var(--ui-hero-line); background: rgba(255, 255, 255, 0.08); color: var(--ui-hero-ink); --icon: url("/assets/icons/sliders.svg"); }
.plans-page .page-hero .hero-actions > [data-plans-filter-open]:hover { background: rgba(255, 255, 255, 0.16); }
.plan-grid { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.plan-grid li a {
  display: flex; flex-direction: column; gap: 14px; height: 100%; padding: 12px 12px 18px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 20px;
  color: var(--ui-ink); font-size: 17px; font-weight: 800; line-height: 1.35; text-decoration: none;
}
.plan-grid li a:hover { border-color: var(--ui-primary); }
.plan-grid li a::before { content: ""; display: block; height: 150px; margin-bottom: 2px; border-radius: 14px; background: url("/assets/brand/pattern.svg"), #0E5A47; }
.plan-grid li:nth-child(3n+2) a::before { background: url("/assets/brand/pattern.svg"), #1F3A5F; }
.plan-grid li:nth-child(3n+3) a::before { background: url("/assets/brand/pattern.svg"), #4A2C4F; }

/* /learning-plans/{slug}: Start / Continue is the solid hero button, Share and feedback are glass */
.plan-page .page-hero .hero-actions > :first-child { border-color: var(--ui-hero-line); background: rgba(255, 255, 255, 0.08); color: var(--ui-hero-ink); }
.plan-page .page-hero .hero-actions > [data-plan-start], .plan-page .page-hero .hero-actions > a {
  order: -1; border-color: transparent; background: var(--ui-hero-ink); color: var(--ui-hero); --icon: url("/assets/icons/play.svg");
}
.plan-page .page-hero [data-plan-share] { --icon: url("/assets/icons/share.svg"); }
.plan-page .page-hero [data-plan-feedback-open] { --icon: url("/assets/icons/note.svg"); }
.plan-page > :not(.page-hero) { max-width: 880px; }
@media (min-width: 929px) { .plan-page > :not(.page-hero) { margin-left: max(24px, calc((100% - 880px) / 2)); margin-right: max(24px, calc((100% - 880px) / 2)); } }
.plan-outline { margin: 0; padding: 0; list-style: none; counter-reset: none; display: flex; flex-direction: column; gap: 10px; }
.plan-outline li {
  position: relative; padding: 16px 20px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface);
  color: var(--ui-muted); font-size: 14px; font-weight: 700; line-height: 1.5;
}
.plan-outline li:hover { border-color: var(--ui-primary); }
.plan-outline li a { display: block; color: var(--ui-ink); font-size: 16px; font-weight: 800; text-decoration: none; }
.plan-outline li a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }

/* A lesson: the day list on the side, the lesson on the right */
.lesson-page {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 36px; align-items: start;
  max-width: 1160px; margin: 0 auto; padding: 32px 24px 80px; box-sizing: border-box; color: var(--ui-ink);
}
.lesson-aside {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 14px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 20px; background: var(--ui-surface);
}
.lesson-back { margin: 0 0 12px; padding: 0 8px; }
.lesson-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-primary); font-size: 14px; font-weight: 800; text-decoration: none; }
.lesson-back a::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/icons/cl.svg") center / contain no-repeat; mask: url("/assets/icons/cl.svg") center / contain no-repeat; }
[dir="rtl"] .lesson-back a::before { transform: scaleX(-1); }
.lesson-aside h2 { margin: 0 0 6px; padding: 0 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.lesson-aside ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.lesson-aside li { color: var(--ui-muted); font-size: 12px; }
.lesson-aside li a { display: block; padding: 9px 10px; border-radius: 10px; color: var(--ui-ink); font-size: 14px; font-weight: 600; line-height: 1.4; text-decoration: none; }
.lesson-aside li a:hover { background: var(--ui-surface2); }
.lesson-aside li a[aria-current="page"] { background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 800; }
.lesson-aside [data-lesson-done] { display: block; padding: 0 10px 6px; color: var(--ui-primary); font-weight: 700; }
.lesson-main { max-width: 780px; min-width: 0; }
.lesson-main > h1 { margin: 0 0 22px; font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.lesson-steps, .lesson-reflect { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 0; }
.lesson-steps { padding-top: 22px; border-top: 1px solid var(--ui-line); }
.lesson-steps > a, .lesson-steps > button, .lesson-steps > span, .lesson-reflect button, .lesson-main > p > [data-plan-feedback-open] {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; box-sizing: border-box; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.lesson-steps > a:hover, .lesson-reflect button:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.lesson-steps > [data-lesson-complete] { margin-left: auto; border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.lesson-steps > [data-lesson-completed] { margin-left: auto; border-color: transparent; background: var(--ui-primary-soft); color: var(--ui-primary); cursor: default; }
.lesson-steps > a:last-child:not(:first-child) { margin-left: 0; }
[dir="rtl"] .lesson-steps > [data-lesson-complete], [dir="rtl"] .lesson-steps > [data-lesson-completed] { margin-left: 0; margin-right: auto; }
.lesson-reflect { padding: 18px 20px; border-radius: 16px; background: var(--ui-gold-soft); }
.lesson-reflect [data-lesson-reflect] { border-color: transparent; background: var(--ui-gold); color: #FFFFFF; }

@media (max-width: 1000px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .lesson-page { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lesson-aside { position: static; max-height: 320px; }
}
@media (max-width: 640px) {
  .plan-grid, .link-cards { grid-template-columns: minmax(0, 1fr); }
  .lesson-page { padding: 20px 0 56px; }
  .page-prose { font-size: 16px; }
}

/* ---- 19. Quran in a Year (/calendar) and the Ramadan challenge (/ramadanchallenge) ---- */
.page-card {
  padding: 28px 32px; margin-bottom: 20px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); color: var(--ui-ink);
}
.page-card > h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.page-card > h2 + p { margin: 0 0 16px; color: var(--ui-muted); }
.page-card h3 { margin: 18px 0 6px; font-size: 17px; font-weight: 800; }
.page-card p { line-height: 1.65; }
.page-card a { color: var(--ui-primary); font-weight: 700; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 0; }
.card-actions > button, .card-actions > a {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; box-sizing: border-box; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.card-actions > button:hover:not(:disabled), .card-actions > a:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.card-actions > :first-child { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.card-actions > :first-child:hover:not(:disabled) { color: var(--ui-primary-ink); filter: brightness(1.08); }
.card-actions > button:disabled { opacity: 0.6; cursor: default; }
.calendar-page > :not(.page-hero) { max-width: 880px; }
@media (min-width: 929px) { .calendar-page > :not(.page-hero) { margin-left: max(24px, calc((100% - 880px) / 2)); margin-right: max(24px, calc((100% - 880px) / 2)); } }

/* Hero: text on the left, today's date and the week in a glass card on the right */
.calendar-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); column-gap: 40px; row-gap: 0; align-items: center; }
.calendar-hero > .hero-lead { margin-top: 10px; }
.calendar-hero > .hero-actions { margin-top: 18px; }
.calendar-hero > * { grid-column: 1; }
.calendar-hero > .calendar-today, .calendar-hero > .calendar-week {
  grid-column: 2; margin: 0; padding: 0 28px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--ui-hero-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.calendar-hero > .calendar-today { grid-row: 1 / span 2; align-self: end; padding-top: 24px; padding-bottom: 12px; border-bottom: 0; border-radius: 22px 22px 0 0; color: var(--ui-hero-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.calendar-hero > .calendar-today [data-hijri-date] { display: block; margin-top: 6px; color: var(--ui-hero-ink); font-size: 20px; font-weight: 800; letter-spacing: 0; text-transform: none; line-height: 1.35; }
.calendar-hero > .calendar-week { grid-row: 3; align-self: start; padding-top: 12px; padding-bottom: 22px; border-top: 1px solid var(--ui-hero-line); border-radius: 0 0 22px 22px; color: var(--ui-hero-ink); font-size: 15px; font-weight: 800; }
.calendar-hero > h1 { grid-row: 1; } .calendar-hero > .hero-lead { grid-row: 2; } .calendar-hero > .hero-actions { grid-row: 3; }
.calendar-hero [data-subscribe] { --icon: url("/assets/icons/bell.svg"); }

/* This week */
.calendar-verses [data-week-range] { margin: 0 0 6px; color: var(--ui-ink); font-size: 18px; font-weight: 800; line-height: 1.4; }
.calendar-verses [data-prompts]:not([hidden]) { margin-top: 14px; padding: 18px 22px; border-radius: 16px; background: var(--ui-surface2); }
.calendar-verses [data-prompts] h3 { margin-top: 0; color: var(--ui-gold); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.calendar-verses [data-prompts] ul { margin: 0; padding-inline-start: 1.2em; line-height: 1.7; }
.calendar-verses .card-actions [data-read] { order: -1; border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.calendar-verses .card-actions [data-complete] { border-color: var(--ui-line); background: var(--ui-surface); color: var(--ui-ink); }
.calendar-verses .card-actions [data-complete]:disabled { border-color: transparent; background: var(--ui-primary-soft); color: var(--ui-primary); opacity: 1; }
.page-card [hidden] { display: none !important; }

/* My progress: sections fold open, weeks are rows with a number, the range and a state */
.calendar-progress [data-completed-weeks]:not(:empty) { display: inline-block; margin: 0 0 8px; padding: 4px 12px; border-radius: 999px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 14px; font-weight: 800; }
.calendar-progress h3 { margin: 10px 0 0; }
.calendar-progress h3 button {
  display: flex; align-items: center; justify-content: space-between; width: 100%; height: 52px; padding: 0 18px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.calendar-progress h3 button::after {
  content: ""; width: 16px; height: 16px; background: var(--ui-muted); transform: rotate(90deg); transition: transform 0.15s;
  -webkit-mask: url("/assets/icons/cr.svg") center / contain no-repeat; mask: url("/assets/icons/cr.svg") center / contain no-repeat;
}
.calendar-progress h3 button[aria-expanded="true"] { border-color: var(--ui-primary); }
.calendar-progress h3 button[aria-expanded="true"]::after { transform: rotate(-90deg); background: var(--ui-primary); }
.calendar-progress [data-section-panel] { padding: 6px 4px 8px; }
.calendar-progress h4 { margin: 14px 0 6px; color: var(--ui-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.calendar-weeks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.calendar-weeks li {
  position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
  padding: 8px 14px 8px 10px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface);
}
.calendar-weeks li::before {
  content: attr(data-week); display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--ui-surface2); color: var(--ui-muted); font-size: 13px; font-weight: 800;
}
.calendar-weeks li button {
  padding: 6px 0; border: 0; background: none; color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.45; text-align: start; cursor: pointer;
}
.calendar-weeks li button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.calendar-weeks li:hover { border-color: var(--ui-primary); }
.calendar-weeks li:has(button[aria-pressed="true"]) { border-color: var(--ui-primary); box-shadow: inset 3px 0 0 var(--ui-primary); }
.calendar-weeks [data-week-state]:not(:empty) { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.calendar-weeks li[data-state="completed"]::before { background: var(--ui-primary); color: var(--ui-primary-ink); }
.calendar-weeks li[data-state="completed"] [data-week-state] { background: var(--ui-primary-soft); color: var(--ui-primary); }
.calendar-weeks li[data-state="current"]::before { background: var(--ui-gold); color: #FFFFFF; }
.calendar-weeks li[data-state="current"] [data-week-state] { background: var(--ui-gold-soft); color: var(--ui-gold); }
.calendar-weeks li[data-state="passed"] [data-week-state] { background: var(--ui-surface2); color: var(--ui-muted); }
.calendar-progress > h3:last-of-type { margin-top: 18px; color: var(--ui-gold); font-size: 13px; }
.calendar-progress [data-program-complete] { color: var(--ui-muted); }

/* Ramadan challenge */
.ramadan-page .page-hero { padding-top: 64px; padding-bottom: 64px; }
.ramadan-page .page-hero h1 { max-width: 760px; }
.ramadan-page .page-hero .hero-actions > a:not([download]), .ramadan-page .page-hero .hero-actions > button { height: 50px; --icon: url("/assets/icons/target.svg"); }
.ramadan-page .ramadan-body { max-width: 880px; }
@media (min-width: 929px) { .ramadan-page .ramadan-body { margin-left: max(24px, calc((100% - 880px) / 2)); margin-right: max(24px, calc((100% - 880px) / 2)); } }
.ramadan-body ul, .ramadan-body ol { padding-inline-start: 1.3em; }

@media (max-width: 900px) {
  .calendar-hero { grid-template-columns: minmax(0, 1fr); }
  .calendar-hero > .calendar-today, .calendar-hero > .calendar-week { grid-column: 1; }
  .calendar-hero > .calendar-today { grid-row: 4; margin-top: 18px; }
  .calendar-hero > .calendar-week { grid-row: 5; }
}
@media (max-width: 640px) {
  .page-card { padding: 20px 18px; border-radius: 18px; }
  .calendar-weeks li { grid-template-columns: 32px minmax(0, 1fr); row-gap: 4px; }
  .calendar-weeks li::before { width: 32px; height: 32px; }
  .calendar-weeks [data-week-state]:not(:empty) { grid-column: 2; justify-self: start; }
}

/* ---- 20. Explore (/explore) and an article (/explore/{slug}) ---- */
.topic-grid { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.topic-grid li {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 22px; box-sizing: border-box;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 20px; color: var(--ui-muted); font-size: 14px; line-height: 1.55;
}
.topic-grid li::before {
  content: ""; display: block; height: 130px; margin-bottom: 8px; border-radius: 14px;
  background: radial-gradient(circle at 80% 20%, rgba(31, 160, 122, 0.55), transparent 45%), url("/assets/brand/pattern.svg"), var(--ui-hero);
}
.topic-grid li:nth-child(3n+2)::before { background: radial-gradient(circle at 20% 80%, rgba(217, 164, 74, 0.5), transparent 45%), url("/assets/brand/pattern.svg"), #1F3A5F; }
.topic-grid li:nth-child(3n+3)::before { background: radial-gradient(circle at 70% 70%, rgba(31, 160, 122, 0.45), transparent 45%), url("/assets/brand/pattern.svg"), #4A2C4F; }
.topic-grid li:hover { border-color: var(--ui-primary); }
.topic-grid li > * { padding: 0 6px; }
.topic-grid a { color: var(--ui-ink); font-size: 18px; font-weight: 800; line-height: 1.35; text-decoration: none; }
.topic-grid a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.topic-grid a:focus-visible { outline: none; }
.topic-grid a:focus-visible::after { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.topic-grid span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

.article-page .article-body, .article-page > .page-empty { max-width: 780px; }
@media (min-width: 829px) {
  .article-page .article-body, .article-page > .page-empty { margin-left: max(24px, calc((100% - 780px) / 2)); margin-right: max(24px, calc((100% - 780px) / 2)); }
}
.article-page .page-hero h1 { max-width: 820px; }
.article-body { font-size: 18px; line-height: 1.85; }
.article-body h2 { font-size: 24px; }
.article-body ul, .article-body ol { padding-inline-start: 1.3em; }
.article-body .verse-card {
  margin: 18px 0; padding: 18px 22px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface); font-size: 17px; line-height: 1.6;
}

@media (max-width: 1000px) { .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .topic-grid { grid-template-columns: minmax(0, 1fr); }
  .article-body { font-size: 17px; }
  .article-body .verse-card { padding: 14px; }
}

/* ---- 21. Duas (/duas) and a dua (/duas/{slug}). pages/duas.js filters with the hidden attribute. ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip-row button {
  height: 38px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface);
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.chip-row button:hover { border-color: var(--ui-primary); }
.chip-row button[aria-pressed="true"] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.dua-group { margin-bottom: 32px; }
.dua-group h2 { margin: 0 0 4px; color: var(--ui-ink); font-size: 22px; font-weight: 800; }
.dua-group-lead { margin: 0 0 14px; color: var(--ui-muted); }
.dua-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dua-grid li {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 22px 20px 66px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface); color: var(--ui-muted); font-size: 14px; line-height: 1.55;
}
.dua-grid li::before {
  content: ""; position: absolute; left: 18px; top: 20px; width: 36px; height: 36px; border-radius: 12px; background: var(--ui-gold-soft);
}
.dua-grid li::after {
  content: ""; position: absolute; left: 27px; top: 29px; width: 18px; height: 18px; background: var(--ui-gold);
  -webkit-mask: url("/assets/icons/book.svg") center / contain no-repeat; mask: url("/assets/icons/book.svg") center / contain no-repeat;
}
[dir="rtl"] .dua-grid li { padding: 20px 66px 20px 22px; }
[dir="rtl"] .dua-grid li::before { left: auto; right: 18px; }
[dir="rtl"] .dua-grid li::after { left: auto; right: 27px; }
.dua-grid li:hover { border-color: var(--ui-primary); }
.dua-grid a { color: var(--ui-ink); font-size: 16px; font-weight: 800; line-height: 1.35; text-decoration: none; }
.dua-grid a::before { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.dua-grid a:focus-visible { outline: none; }
.dua-grid a:focus-visible::before { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.dua-grid span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

.dua-page .dua-body { max-width: 780px; }
@media (min-width: 829px) { .dua-page .dua-body { margin-left: max(24px, calc((100% - 780px) / 2)); margin-right: max(24px, calc((100% - 780px) / 2)); } }
.dua-arabic {
  margin: 0 0 18px; padding: 28px 30px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface);
  font-family: "Amiri", serif; font-size: 30px; line-height: 2; text-align: right; color: var(--ui-ink);
}
.dua-line { margin: 0 0 12px; color: var(--ui-ink); font-size: 17px; line-height: 1.75; }
.dua-reference { color: var(--ui-muted); font-size: 14px; font-weight: 700; }
.dua-body .article-body { margin-top: 18px; }

@media (max-width: 1000px) { .dua-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .dua-grid { grid-template-columns: minmax(0, 1fr); }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chip-row button { flex: none; }
  .dua-arabic { padding: 20px; font-size: 24px; }
}

/* ---- 22. Verse of the Day (/daily): the verse in a glass card in the hero, then recommended plans ---- */
.daily-hero { align-items: center; text-align: center; padding-top: 48px; padding-bottom: 64px; }
.daily-hero > h1 { color: var(--ui-hero-gold); font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.daily-card {
  width: min(880px, 100%); box-sizing: border-box; margin-top: 10px; padding: 40px 44px 34px; border: 1px solid var(--ui-hero-line); border-radius: 32px;
  background: rgba(255, 255, 255, 0.07); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
}
.daily-card [data-daily-verse] .verse-arabic {
  margin: 0 0 18px; color: var(--ui-hero-ink); font-family: "Amiri Quran", "UthmanicHafs", "Amiri", serif; font-size: 40px; line-height: 2; text-align: center;
}
.daily-card [data-daily-verse] .translation-text { margin: 0 0 14px; color: var(--ui-hero-ink); font-size: 18px; line-height: 1.65; }
.daily-card [data-daily-verse] .translation-text cite { display: block; margin-top: 4px; color: var(--ui-hero-muted); font-size: 13px; font-style: normal; font-weight: 700; }
.daily-card [data-daily-verse] .footnote-ref {
  margin: 0 2px; padding: 0 5px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.14); color: var(--ui-hero-gold); font-size: 11px; font-weight: 800; cursor: pointer;
}
.daily-card [data-daily-verse] .footnote:not([hidden]) { margin: 8px 0; padding: 12px 16px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); color: var(--ui-hero-ink); font-size: 14px; text-align: start; }
.daily-card [data-daily-verse] > p:last-child a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.12);
  color: var(--ui-hero-gold); font-size: 13px; font-weight: 800; text-decoration: none;
}
.daily-card [data-daily-verse][aria-busy="true"] { min-height: 160px; }
.daily-card .hero-actions { justify-content: center; margin-top: 20px; }
.daily-card [data-daily-action="play"] { --icon: url("/assets/icons/play.svg"); }
.daily-card [data-daily-action="text"] { --icon: url("/assets/icons/copy.svg"); }
.daily-card [data-daily-action="link"] { --icon: url("/assets/icons/share.svg"); }
.daily-card .hero-actions > button:disabled { opacity: 0.5; cursor: default; }
.daily-page .daily-body:not(:has(*)) { display: none; }
.daily-page .daily-body { max-width: 780px; margin-bottom: 32px; }
@media (min-width: 829px) { .daily-page .daily-body { margin-left: max(24px, calc((100% - 780px) / 2)); margin-right: max(24px, calc((100% - 780px) / 2)); } }
.daily-plans h2 { margin: 0 0 18px; color: var(--ui-ink); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
@media (max-width: 640px) {
  .daily-card { padding: 26px 18px 22px; border-radius: 24px; }
  .daily-card [data-daily-verse] .verse-arabic { font-size: 30px; }
  .daily-card [data-daily-verse] .translation-text { font-size: 16px; }
}

/* ---- 23. Media Maker (/media): the preview on the left (sticky), the settings on the right.
   The canvas keeps its drawing size (720x1280 or 1280x720); CSS only scales it. Preview mode hides [data-media-edit]. ---- */
.media-page {
  display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); column-gap: 36px; align-items: start;
  max-width: 1160px; margin: 0 auto; padding: 36px 24px 80px; box-sizing: border-box; color: var(--ui-ink);
}
.media-page [hidden] { display: none !important; }
.media-page > h1 { grid-column: 1 / -1; margin: 0 0 26px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.media-preview {
  grid-column: 1; grid-row: 2 / span 2; position: sticky; top: 16px; padding: 16px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface2);
}
.media-page:has(> h1[hidden]) .media-preview { grid-column: 1 / -1; justify-self: center; width: min(460px, 100%); position: static; }
.media-preview [data-media-stage] { display: flex; justify-content: center; }
.media-preview [data-media-canvas] { display: block; width: 100%; height: auto; max-height: calc(100vh - 200px); object-fit: contain; border-radius: 14px; background: #0F2E27; }
.media-preview [data-media-canvas][width="1280"] { aspect-ratio: 16 / 9; }
.media-preview [data-media-canvas][width="720"] { aspect-ratio: 9 / 16; width: auto; max-width: 100%; height: min(560px, calc(100vh - 200px)); }
.media-controls { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; }
.media-controls button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 0; cursor: pointer;
}
.media-controls button::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.media-controls button:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.media-controls [data-media-play] { --icon: url("/assets/icons/play.svg"); width: 56px; border-color: transparent; background: var(--ui-primary); color: var(--ui-primary-ink); }
.media-controls [data-media-play]:hover { color: var(--ui-primary-ink); filter: brightness(1.08); }
.media-controls [data-media-mute] { --icon: url("/assets/icons/volume.svg"); }
.media-controls [data-media-fullscreen] { --icon: url("/assets/icons/expand.svg"); }
.media-controls [data-media-generate] { width: auto; padding: 0 16px; font-size: 14px; font-weight: 700; }
.media-controls [data-media-generate]::before { display: none; }
:fullscreen [data-media-canvas] { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }

/* Settings: a card with the fields in two columns */
.media-form {
  grid-column: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; align-content: start;
  padding: 26px 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface);
}
.media-form > p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.media-form label { color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.media-form select, .media-form input[type="color"] {
  width: 100%; height: 42px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px;
  background-color: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 14px;
}
.media-form input[type="color"] { padding: 4px; cursor: pointer; }
.media-form > .media-hint { align-self: end; justify-content: center; height: 42px; color: var(--ui-muted); font-size: 13px; }
.media-form fieldset { grid-column: 1 / -1; min-width: 0; margin: 4px 0 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--ui-line); }
.media-form > p:has(> select[name="reciter"]) { grid-column: 1 / -1; }
.media-form legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; color: var(--ui-ink); font-size: 15px; font-weight: 800; }
.media-form legend h2 { margin: 0; font-size: 15px; font-weight: 800; }
.media-form fieldset > div { clear: both; }
.media-form [data-media-translations] {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; max-height: 260px; overflow-y: auto; padding: 4px 2px;
}
.media-form [data-media-translations] label, .media-form [data-media-backgrounds] label {
  display: flex; align-items: center; gap: 8px; color: var(--ui-ink); font-size: 14px; font-weight: 500; cursor: pointer; padding: 4px 0;
}
.media-form input[type="checkbox"], .media-form input[type="radio"] { accent-color: var(--ui-primary); margin: 0; }
.media-form [data-media-backgrounds] { display: flex; flex-wrap: wrap; gap: 8px; }
.media-form [data-media-backgrounds] legend { flex-basis: 100%; }
.media-form [data-media-backgrounds] > div label { padding: 6px 12px; border: 1px solid var(--ui-line); border-radius: 999px; font-size: 13px; }
.media-form [data-media-backgrounds] > div label:has(input:checked) { border-color: var(--ui-primary); background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 700; }

.media-share { grid-column: 2; margin-top: 18px; padding: 22px 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.media-share h2 { margin: 0; font-size: 18px; font-weight: 800; }
.media-share .card-actions > :first-child { border-color: var(--ui-line); background: var(--ui-surface); color: var(--ui-ink); }
.media-share .card-actions > :first-child:hover:not(:disabled) { border-color: var(--ui-primary); color: var(--ui-primary); filter: none; }
.media-share [data-media-video] { border-color: var(--ui-primary) !important; background: var(--ui-primary) !important; color: var(--ui-primary-ink) !important; }
.media-share [data-media-status]:not(:empty) { margin: 12px 0 0; color: var(--ui-muted); font-size: 14px; }
#media-reset-dialog.is-open .dialog-actions [data-media-reset-yes] { border-color: transparent; background: #B42318; color: #FFFFFF; }
#media-reset-dialog.is-open .dialog-actions [data-close] { border-color: var(--ui-line); background: var(--ui-surface); color: var(--ui-ink); }

@media (max-width: 900px) {
  .media-page { grid-template-columns: minmax(0, 1fr); }
  .media-preview { grid-row: auto; position: static; margin-bottom: 18px; }
  .media-form, .media-share { grid-column: 1; }
}
@media (max-width: 640px) {
  .media-page { padding: 20px 0 56px; }
  .media-form { grid-template-columns: minmax(0, 1fr); padding: 20px 18px; }
  .media-form [data-media-translations] { grid-template-columns: minmax(0, 1fr); }
  .media-preview [data-media-canvas][width="720"] { height: min(480px, 70vh); }
}

/* ---- 24. Embed: the builder (/embed) and the widget's own document (/embed/v1, views/embed-widget.php, which loads
   app.css then ui.css; everything for it is under [data-embed]). ---- */
.embed-page {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 32px; align-items: start;
  max-width: 1160px; margin: 0 auto; padding: 36px 24px 80px; box-sizing: border-box; color: var(--ui-ink);
}
.embed-page [hidden] { display: none !important; }
.embed-page > h1 { grid-column: 1 / -1; margin: 0 0 24px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; }
.embed-config, .embed-preview, .embed-snippet { padding: 24px 26px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.embed-config h2, .embed-preview h2, .embed-snippet h2 { margin: 0 0 16px; font-size: 18px; font-weight: 800; }
.embed-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 18px; }
.embed-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.embed-form > p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.embed-form > p > label { color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.embed-form input[type="text"], .embed-form select {
  width: 100%; height: 42px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px;
  background-color: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 14px;
}
.embed-form > .embed-check { justify-content: center; }
.embed-form > .embed-check label { display: flex; align-items: center; gap: 10px; color: var(--ui-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.embed-form input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--ui-primary); }
.embed-form > fieldset { grid-column: 1 / -1; min-width: 0; margin: 6px 0; padding: 16px 0 6px; border: 0; border-top: 1px solid var(--ui-line); border-bottom: 1px solid var(--ui-line); }
.embed-form legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 15px; font-weight: 800; }
.embed-form fieldset > * { clear: both; }
.embed-form [data-embed-selected] { margin: 0 0 10px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.embed-form [data-embed-selected] li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 700; }
.embed-form [data-embed-selected] button {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font-size: 0; cursor: pointer;
}
.embed-form [data-embed-selected] button::before {
  content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: url("/assets/icons/close.svg") center / contain no-repeat; mask: url("/assets/icons/close.svg") center / contain no-repeat;
}
.embed-form [data-embed-selected] button:hover { background: rgba(0, 0, 0, 0.08); }
.embed-translation-search { margin: 0 0 8px; }
.embed-form [data-embed-translations] { max-height: 220px; overflow-y: auto; padding: 2px; font-size: 14px; }
.embed-form [data-embed-translations] label { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.embed-form [data-embed-translations] h3, .embed-form [data-embed-translations] h4 { margin: 10px 0 4px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.embed-form [data-embed-translations] ul { margin: 0; padding: 0; list-style: none; }
.embed-preview iframe { display: block; width: 100%; min-height: 240px; border: 0; border-radius: 16px; background: var(--ui-bg); }
.embed-snippet textarea {
  width: 100%; box-sizing: border-box; padding: 14px 16px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-bg);
  color: var(--ui-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; resize: vertical;
}
.embed-snippet p { margin: 0; }
.embed-snippet .card-actions { margin-top: 12px; }
.embed-snippet [data-embed-copy-snippet] { --icon: url("/assets/icons/copy.svg"); }

/* The widget document */
html:has(body > [data-embed]), body:has(> [data-embed]) { background: var(--ui-bg); color: var(--ui-ink); }
[data-embed] { margin: 0; padding: 18px 20px 16px; box-sizing: border-box; color: var(--ui-ink); }
[data-embed] > p:first-child { margin: 0 0 6px; }
[data-embed] [data-embed-title] { color: var(--ui-primary); font-size: 14px; font-weight: 800; text-decoration: none; }
[data-embed] [data-embed-title]:hover { text-decoration: underline; }
[data-embed] section[data-verse-key] { padding: 10px 0; border-bottom: 1px solid var(--ui-line); }
[data-embed] section[data-verse-key]:last-of-type { border-bottom: 0; }
[data-embed] .verse-arabic { margin: 0 0 8px; font-size: 28px; line-height: 2; text-align: right; color: var(--ui-ink); }
[data-embed] .word-end { color: var(--ui-gold); }
[data-embed] .translation { margin-top: 6px; }
[data-embed] .translation-text { margin: 0; font-size: 16px; line-height: 1.6; }
[data-embed] .translation-name { margin: 2px 0 0; color: var(--ui-muted); font-size: 12px; font-weight: 700; }
[data-embed] .embed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 0; }
[data-embed] .embed-actions > button, [data-embed] .embed-actions > a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer;
}
[data-embed] .embed-actions > :hover { border-color: var(--ui-primary); color: var(--ui-primary); }
[data-embed] .embed-actions > [data-embed-play] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
[data-embed] .embed-actions > [data-embed-read] { margin-left: auto; border-color: transparent; background: none; color: var(--ui-primary); }
[dir="rtl"] [data-embed] .embed-actions > [data-embed-read] { margin-left: 0; margin-right: auto; }

@media (max-width: 960px) {
  .embed-page { grid-template-columns: minmax(0, 1fr); row-gap: 18px; }
  .embed-side { position: static; }
}
@media (max-width: 640px) {
  .embed-page { padding: 20px 0 56px; }
  .embed-form { grid-template-columns: minmax(0, 1fr); }
  .embed-config, .embed-preview, .embed-snippet { padding: 18px; }
}

/* ---- 25a. Static pages (/about-us, /privacy, /terms-and-conditions, /support, ...) and /our-products ---- */
.static-page .static-body { max-width: 780px; }
@media (min-width: 829px) { .static-page .static-body { margin-left: max(24px, calc((100% - 780px) / 2)); margin-right: max(24px, calc((100% - 780px) / 2)); } }
.static-body .static-notice { padding: 14px 18px; border-radius: 14px; background: var(--ui-gold-soft); color: var(--ui-ink); font-size: 15px; }
.static-body > h2 { padding-top: 0.4em; }
.static-body .static-callout, #main > .static-credits { margin: 22px 0; padding: 22px 26px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface); }
.static-body .static-callout h2, #main > .static-credits h2 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
#main > .static-credits { box-sizing: border-box; max-width: 780px; margin: -40px auto 0; color: var(--ui-ink); }
#main:has(> .static-credits) { padding-bottom: 72px; }
#main > .hero-page.static-page:has(+ .static-credits) { padding-bottom: 60px; }
.static-body .static-callout p:last-child { margin-bottom: 0; }
.static-credits ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-size: 15px; }
.static-credits li { padding: 10px 14px; border-radius: 12px; background: var(--ui-surface2); }

.product-grid { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-grid li {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px 24px 24px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 20px; background: var(--ui-surface); color: var(--ui-muted); font-size: 14px; line-height: 1.55;
}
.product-grid li::before {
  content: ""; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 14px;
  background: url("/assets/brand/pattern.svg"), radial-gradient(circle at 30% 20%, rgba(31, 160, 122, 0.7), transparent 60%), var(--ui-hero);
}
.product-grid li:hover { border-color: var(--ui-primary); }
.product-grid a { order: 1; color: var(--ui-ink); font-size: 18px; font-weight: 800; text-decoration: none; }
.product-grid a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.product-grid a:focus-visible { outline: none; }
.product-grid a:focus-visible::after { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.product-grid span { order: 0; align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 12px; font-weight: 700; }
.product-grid li::before { order: -1; }
.product-grid p { order: 2; margin: 0; }
@media (max-width: 1000px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .product-grid, .static-credits ul { grid-template-columns: minmax(0, 1fr); } }

/* ---- 25b. Sign in / up and the account screens (/login, /complete-signup, /forgot-password, /reset-password, /verify-email).
   One centred card; /login adds a decorative brand panel on wide screens (no text, aria-free pseudo element). ---- */
.auth-page { display: flex; justify-content: center; padding: 48px 0 80px; color: var(--ui-ink); }
.auth-card {
  width: min(460px, 100%); box-sizing: border-box; padding: 34px 36px 30px; border: 1px solid var(--ui-line); border-radius: 26px;
  background: var(--ui-surface); box-shadow: 0 10px 30px rgba(17, 27, 23, 0.08);
}
.auth-card h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.auth-card h2 { margin: 18px 0 10px; font-size: 18px; font-weight: 800; }
.auth-card > p, .auth-card form > p { line-height: 1.6; }
.auth-card > p:not([role]) { color: var(--ui-muted); }
.auth-card form { margin: 0; }
.auth-card form > p { margin: 0 0 14px; }
.auth-card form > p:has(> input:not([type="hidden"])) { position: relative; display: flex; flex-direction: column; gap: 6px; }
.auth-card label { color: var(--ui-ink); font-size: 13px; font-weight: 700; }
.auth-card input[type="email"], .auth-card input[type="text"], .auth-card input[type="password"] {
  width: 100%; height: 48px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
.auth-card input:focus { outline: 2px solid var(--ui-primary); outline-offset: 1px; border-color: transparent; }
.auth-card input[aria-invalid="true"] { border-color: #B42318; }
.auth-card [data-toggle-password] {
  position: absolute; right: 8px; bottom: 8px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--ui-surface2);
  color: var(--ui-ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
[dir="rtl"] .auth-card [data-toggle-password] { right: auto; left: 8px; }
/* E-3: a grid row keeps the toggle on the input when an error line follows it (bottom: 8px put it on the error). */
.auth-card form > p:has(> input + [data-toggle-password]) { display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-card form > p:has(> input + [data-toggle-password]) > input { grid-row: 2; grid-column: 1; }
.auth-card form > p:has(> input + [data-toggle-password]) > [data-toggle-password] { position: static; grid-row: 2; grid-column: 1; justify-self: end; align-self: center; margin: 0 8px; }
.auth-card input[type="password"], .auth-card input:has(+ [data-toggle-password]) { padding-inline-end: 70px; }
.auth-card .field-error { color: #B42318; font-size: 13px; font-weight: 600; }
.auth-card [role="alert"], .auth-card .form-error { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: #FDECEA; color: #8A1C12; font-size: 14px; font-weight: 600; }
[data-theme="dark"] .auth-card [role="alert"], [data-theme="dark"] .auth-card .form-error { background: #3A1A17; color: #F2867B; }
.auth-card p[role="status"] { margin: 6px 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--ui-primary-soft); color: var(--ui-ink); font-size: 15px; }
.auth-card button[type="submit"] {
  width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--ui-primary); color: var(--ui-primary-ink);
  font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.auth-card button[type="submit"]:hover { filter: brightness(1.08); }
.auth-card a { color: var(--ui-primary); font-weight: 700; text-decoration: none; }
.auth-card a:hover { text-decoration: underline; }
.auth-card > p:last-child:has(> a:only-child) { margin: 18px 0 0; text-align: center; }
.auth-card ul[aria-label] { margin: -4px 0 16px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; color: var(--ui-muted); font-size: 13px; }
.auth-card ul[aria-label] li::before { content: "• "; color: var(--ui-primary); font-weight: 800; }
.auth-card form[aria-labelledby] { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--ui-line); }
.auth-card form[aria-labelledby] button[type="submit"] { background: var(--ui-surface2); color: var(--ui-ink); }

/* /login: segmented tabs, the forgot link right-aligned, and the brand panel */
.login-page [role="tablist"]:not([hidden]) { display: flex; gap: 4px; margin: 14px 0 20px; padding: 4px; border-radius: 14px; background: var(--ui-surface2); }
.login-page [role="tab"] { flex: 1; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--ui-muted); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.login-page [role="tab"][aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.login-page [role="tabpanel"][hidden] { display: none; }
.login-page form > p:has(> a[href*="forgot"]) { margin-top: -6px; text-align: right; font-size: 13px; }
@media (min-width: 1000px) {
  #main > .login-page {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 0; margin: 0 -16px; padding: 0; min-height: calc(100vh - 140px);
  }
  #main > .login-page::before {
    content: ""; align-self: stretch; min-height: 560px;
    background:
      radial-gradient(circle at 30% 40%, rgba(31, 160, 122, 0.55), transparent 38%),
      radial-gradient(circle at 75% 80%, rgba(217, 164, 74, 0.38), transparent 30%),
      url("/assets/brand/pattern.svg"), var(--ui-hero);
  }
  #main > .login-page > .auth-card { justify-self: center; margin: 48px 24px; }
}
@media (max-width: 640px) {
  .auth-page { padding: 24px 0 56px; }
  .auth-card { padding: 26px 20px 22px; border-radius: 22px; }
}

/* ---- 26. Profile (/profile): a header with the account, then one card per section. The two confirmations are native <dialog>. ---- */
.profile-page { max-width: 820px; margin: 0 auto; padding: 36px 24px 80px; box-sizing: border-box; color: var(--ui-ink); }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 26px; }
.profile-head::before {
  content: ""; flex: none; width: 76px; height: 76px; border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, rgba(31, 160, 122, 0.7), transparent 60%), url("/assets/brand/pattern.svg"), var(--ui-hero);
}
.profile-head h1 { margin: 0; font-size: clamp(28px, 3.4vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
.profile-head dl { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding-left: 96px; color: var(--ui-muted); font-size: 14px; }
[dir="rtl"] .profile-head dl { padding-left: 0; padding-right: 96px; }
.profile-head dl > dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.profile-head dl > dd { margin: 0; }
.profile-head dd[data-field="fullName"] { color: var(--ui-ink); font-weight: 800; }
.profile-head dd[data-field="username"]::before { content: "@"; }
@media (min-width: 641px) { .profile-head h1 { flex: 1; } .profile-head dl { margin-top: -10px; } }

.profile-card { margin-bottom: 18px; padding: 26px 30px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.profile-card > h2 { margin: 0 0 16px; font-size: 19px; font-weight: 800; }
.profile-card form > p, .profile-card fieldset > p { margin: 0 0 14px; }
.profile-card form > p:has(> input) { display: flex; flex-direction: column; gap: 6px; }
.profile-card label { color: var(--ui-ink); font-size: 13px; font-weight: 700; }
.profile-card input[type="email"], .profile-card input[type="text"], .profile-card input[type="password"] {
  width: 100%; max-width: 440px; height: 46px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
.profile-card input:focus { outline: 2px solid var(--ui-primary); outline-offset: 1px; border-color: transparent; }
.profile-card input[aria-invalid="true"] { border-color: #B42318; }
.profile-card form > p > span:not(.field-error) { color: var(--ui-muted); font-size: 13px; }
.profile-card .field-error:not([hidden]) { color: #B42318; font-size: 13px; font-weight: 600; }
.profile-card button {
  display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.profile-card button:hover:not(:disabled) { border-color: var(--ui-primary); color: var(--ui-primary); }
.profile-card button[type="submit"] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.profile-card button[type="submit"]:hover:not(:disabled) { color: var(--ui-primary-ink); filter: brightness(1.08); }
.profile-card button:disabled { opacity: 0.5; cursor: default; }
/* Empty status boxes stay in the page (live regions, and the tests read them by role); they just take no space. */
.profile-card [role="status"]:empty { margin: 0; padding: 0; }
.profile-card [role="status"]:not(:empty) { margin: 4px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--ui-primary-soft); color: var(--ui-ink); font-size: 14px; }
.profile-card [hidden] { display: none !important; }

/* Picture */
.profile-avatar { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; color: var(--ui-muted); font-size: 14px; }
.profile-avatar img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ui-surface2); }
.profile-card input[type="file"] { max-width: 100%; font: inherit; font-size: 14px; color: var(--ui-muted); }
.profile-card input[type="file"]::file-selector-button {
  margin-right: 12px; height: 38px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface2);
  color: var(--ui-ink); font: inherit; font-weight: 700; cursor: pointer;
}
.profile-card form > p:has(> button) { display: flex; flex-wrap: wrap; gap: 8px; }

/* Notifications: switch-like rows */
.profile-card fieldset { margin: 0; padding: 0; border: 0; }
.profile-card fieldset > p:has(> label) { margin: 0; border-top: 1px solid var(--ui-line); }
.profile-card fieldset > p:has(> label):first-of-type { border-top: 0; }
.profile-card fieldset label { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 15px; font-weight: 600; cursor: pointer; flex-direction: row-reverse; }
.profile-card fieldset input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 999px;
  background: var(--ui-line); cursor: pointer; transition: background 0.15s;
}
.profile-card fieldset input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.profile-card fieldset input[type="checkbox"]:checked { background: var(--ui-primary); }
.profile-card fieldset input[type="checkbox"]:checked::after { transform: translateX(18px); }
.profile-card fieldset input[type="checkbox"]:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
[dir="rtl"] .profile-card fieldset input[type="checkbox"]:checked::after { transform: translateX(-18px); }
[dir="rtl"] .profile-card fieldset input[type="checkbox"]::after { left: auto; right: 3px; }

/* Delete account */
.profile-danger { border-color: rgba(180, 35, 24, 0.35); }
.profile-danger > h2 { color: #B42318; }
[data-theme="dark"] .profile-danger > h2 { color: #F2867B; }
.profile-danger > p { color: var(--ui-muted); }
.profile-danger [data-open-delete] { border-color: #B42318; background: #B42318; color: #FFFFFF; }
.profile-danger [data-open-delete]:hover { color: #FFFFFF !important; border-color: #B42318 !important; filter: brightness(1.08); }

/* The native confirm dialogs */
.profile-page dialog {
  width: min(460px, calc(100% - 24px)); box-sizing: border-box; padding: 26px 28px; border: 1px solid var(--ui-line); border-radius: 22px;
  background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 24px 60px rgba(17, 27, 23, 0.25);
}
.profile-page dialog::backdrop { background: rgba(8, 14, 12, 0.45); }
.profile-page dialog h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.profile-page dialog p { margin: 0 0 14px; color: var(--ui-muted); line-height: 1.6; }
.profile-page dialog p:has(> button) { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 18px 0 0; }
.profile-page dialog p:has(> button) > button { flex: 1 1 auto; justify-content: center; }
.profile-page dialog p:has(> input) { display: flex; flex-direction: column; gap: 6px; color: var(--ui-ink); }
.profile-page dialog input[type="text"] { height: 44px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-bg); color: var(--ui-ink); font: inherit; }
.profile-page dialog button { height: 42px; padding: 0 18px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.profile-page dialog [data-remove-avatar-confirm], .profile-page dialog button[type="submit"] { border-color: #B42318; background: #B42318; color: #FFFFFF; }
.profile-page dialog button:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
  .profile-page { padding: 20px 0 56px; }
  .profile-card { padding: 20px 18px; }
  .profile-head dl { padding-left: 0; }
}

/* ---- 27. My Quran (/my-quran) and a collection (/collections/{id}, and inline in My Quran). Most of it is rendered by
   features/my-quran.js and features/collection.js; the selectors follow that markup. Empty status boxes keep their place. ---- */
.mq-page { max-width: 980px; margin: 0 auto; padding: 36px 24px 80px; box-sizing: border-box; color: var(--ui-ink); }
.mq-page [hidden] { display: none !important; }
.mq-page > h1 { margin: 0 0 18px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; }
.mq-card { margin-bottom: 18px; padding: 24px 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.mq-card h3 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.mq-card button, .mq-card select, .mq-card input[type="text"] { font: inherit; }
.mq-card :is(button:not([role="tab"]), select) {
  height: 40px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.mq-card select { padding-right: 30px; font-weight: 600; }
.mq-card button:not([role="tab"]):hover:not(:disabled) { border-color: var(--ui-primary); color: var(--ui-primary); }
.mq-card button[type="submit"] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
.mq-card button[type="submit"]:hover { color: var(--ui-primary-ink) !important; filter: brightness(1.08); }
.mq-card button:disabled { opacity: 0.5; cursor: default; }
.mq-card input[type="text"] { height: 40px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-bg); color: var(--ui-ink); font-size: 14px; }
.mq-card label { color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.mq-card a { color: var(--ui-primary); font-weight: 700; }
.mq-card [role="alert"]:not(:empty) { color: #B42318; font-size: 13px; font-weight: 600; }

/* Saved tab */
.mq-slots [data-reading-slots] { margin: 0 0 14px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mq-slots [data-reading-slots] li { padding: 14px 16px; border-radius: 14px; background: var(--ui-surface2); color: var(--ui-muted); font-size: 14px; line-height: 1.4; }
.mq-slots [data-reading-slots] li > span:first-child { display: block; margin-bottom: 2px; color: var(--ui-ink); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.mq-slots [data-reading-slots] a { font-size: 15px; }
.mq-slots [data-slots-edit]:not([hidden]) { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ui-line); }
.mq-slots [data-slot-fields] > * { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mq-slots [data-slots-edit] button[type="submit"] { align-self: flex-start; }
.mq-recently ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.mq-recently a { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 14px; font-weight: 800; text-decoration: none; }
.mq-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.mq-card .mq-toolbar [data-new-collection-open] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); margin-right: auto; }
.mq-card .mq-toolbar [data-new-collection-open]:hover { color: var(--ui-primary-ink) !important; filter: brightness(1.08); }
[dir="rtl"] .mq-toolbar [data-new-collection-open] { margin-right: 0; margin-left: auto; }
.mq-new:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 14px; border-radius: 14px; background: var(--ui-surface2); }
.mq-new input[type="text"] { flex: 1 1 200px; }
.mq-collection-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mq-collection-grid button {
  display: flex !important; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 2px; width: 100%; height: auto !important;
  min-height: 110px; padding: 16px 18px !important; border-radius: 16px !important; text-align: start;
  background: radial-gradient(circle at 85% 15%, rgba(31, 160, 122, 0.18), transparent 50%), var(--ui-surface2) !important;
}
.mq-collection-grid button > span:first-child { color: var(--ui-ink); font-size: 16px; font-weight: 800; }
.mq-collection-grid button > span + span { color: var(--ui-muted); font-size: 13px; font-weight: 600; }
.mq-all { margin: 14px 0 0; }
[data-sign-in-prompt] { padding: 18px 20px; border-radius: 14px; background: var(--ui-surface2); color: var(--ui-muted); }
[data-sign-in-prompt] ul { margin: 6px 0 10px; padding-inline-start: 1.2em; }
[data-sign-in-prompt] p:last-child { margin-bottom: 0; }

/* Notes tab */
[data-notes] [role="tablist"] { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 12px; background: var(--ui-surface2); }
[data-notes] [role="tab"] { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--ui-muted); font-size: 14px; font-weight: 700; cursor: pointer; }
[data-notes] [role="tab"][aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
[data-notes] [role="tabpanel"] > p:first-child { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0 0 12px; }
[data-notes] ul[aria-label] { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
[data-notes] article { padding: 16px 18px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-bg); }
[data-notes] .note-body { margin: 0 0 8px; color: var(--ui-ink); font-size: 15px; line-height: 1.65; white-space: pre-line; }
[data-notes] article > p:not(.note-body) { margin: 0 0 10px; color: var(--ui-muted); font-size: 13px; }
[data-notes] article button { height: 34px !important; padding: 0 12px !important; font-size: 13px !important; }

/* A collection (page and inline) */
.mq-back { margin: 0 0 12px; }
.mq-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-primary); font-size: 14px; font-weight: 800; text-decoration: none; }
.mq-back a::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/icons/cl.svg") center / contain no-repeat; mask: url("/assets/icons/cl.svg") center / contain no-repeat; }
[dir="rtl"] .mq-back a::before { transform: scaleX(-1); }
:is([data-collection-page], [data-collection-inline]) h1, [data-collection-inline] h2 { margin: 0 0 16px; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.02em; }
:is([data-collection-page], [data-collection-inline]) fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0; border: 0; }
:is([data-collection-page], [data-collection-inline]) legend { float: left; margin-right: 6px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
:is([data-collection-page], [data-collection-inline]) fieldset + p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--ui-line); }
:is([data-collection-page], [data-collection-inline]) ul[aria-label] { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
:is([data-collection-page], [data-collection-inline]) ul[aria-label] > li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 12px 12px 18px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-bg);
}
:is([data-collection-page], [data-collection-inline]) ul[aria-label] > li > a { color: var(--ui-ink); font-size: 15px; font-weight: 800; text-decoration: none; }
:is([data-collection-page], [data-collection-inline]) ul[aria-label] > li > a:hover { color: var(--ui-primary); }
:is([data-collection-page], [data-collection-inline]) ul[aria-label] > li > span { color: var(--ui-muted); font-size: 13px; }
:is([data-collection-page], [data-collection-inline]) ul[aria-label] > li > [data-verse-options] { margin-left: auto; width: 36px; height: 36px; padding: 0; font-size: 18px; }
[dir="rtl"] :is([data-collection-page], [data-collection-inline]) ul[aria-label] > li > [data-verse-options] { margin-left: 0; margin-right: auto; }
:is([data-collection-page], [data-collection-inline]) [data-verse-text]:not([hidden]) { flex-basis: 100%; margin-top: 6px; }
:is([data-collection-page], [data-collection-inline]) [data-verse-text] [lang="ar"] { margin: 6px 0 10px; font-family: "Amiri Quran", "UthmanicHafs", "Amiri", serif; font-size: 26px; line-height: 2; text-align: right; }
:is([data-collection-page], [data-collection-inline]) [data-verse-text] p[dir="auto"] { margin: 0 0 8px; font-size: 15px; line-height: 1.65; }
.mq-card [data-verse-text] .footnote-ref {
  height: auto; margin: 0 2px; padding: 0 5px; border: 0; border-radius: 6px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 11px; font-weight: 800; line-height: 1.6;
}
:is([data-collection-page], [data-collection-inline]) input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--ui-primary); }

@media (max-width: 760px) {
  .mq-slots [data-reading-slots], .mq-collection-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .mq-page { padding: 20px 0 56px; }
  .mq-card { padding: 18px; }
}

/* ---- 28. Reading goal: the wizard (/reading-goal) and progress (/reading-goal/progress) with its four dialogs ---- */
.goal-page { display: flex; justify-content: center; padding: 40px 0 80px; color: var(--ui-ink); }
.goal-page [hidden], .progress-page [hidden] { display: none !important; }
.goal-card {
  width: min(640px, 100%); box-sizing: border-box; padding: 30px 34px; border: 1px solid var(--ui-line); border-radius: 26px;
  background: var(--ui-surface); box-shadow: 0 10px 30px rgba(17, 27, 23, 0.08);
}
.goal-steps { margin: 0 0 22px; }
.goal-steps progress, .progress-goal progress {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--ui-surface2); overflow: hidden;
}
.goal-steps progress::-webkit-progress-bar, .progress-goal progress::-webkit-progress-bar { background: var(--ui-surface2); border-radius: 999px; }
.goal-steps progress::-webkit-progress-value, .progress-goal progress::-webkit-progress-value { background: var(--ui-primary); border-radius: 999px; }
.goal-steps progress::-moz-progress-bar, .progress-goal progress::-moz-progress-bar { background: var(--ui-primary); border-radius: 999px; }
.goal-card section > h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.goal-card section > p:first-of-type { margin: 0 0 18px; color: var(--ui-muted); line-height: 1.6; }
/* Each option is a card; the label's ::after covers the card, so a click anywhere picks it. */
.goal-card [role="radiogroup"] { display: flex; flex-direction: column; gap: 10px; }
.goal-card [role="radiogroup"] > p {
  position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0; padding: 16px 18px;
  border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-bg); cursor: pointer;
}
.goal-card [role="radiogroup"] > p > br { display: none; }
.goal-card [role="radiogroup"] > p > input { position: relative; z-index: 1; grid-row: 1 / 3; margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--ui-primary); }
.goal-card [role="radiogroup"] > p > label { grid-column: 2; color: var(--ui-ink); font-size: 16px; font-weight: 800; cursor: pointer; }
.goal-card [role="radiogroup"] > p > label::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.goal-card [role="radiogroup"] > p > span { grid-column: 2; color: var(--ui-muted); font-size: 14px; line-height: 1.5; }
.goal-card [role="radiogroup"] > p:hover { border-color: var(--ui-primary); }
.goal-card [role="radiogroup"] > p:has(input:checked) { border-color: var(--ui-primary); background: var(--ui-primary-soft); box-shadow: inset 0 0 0 1px var(--ui-primary); }
.goal-card [role="radiogroup"] > p:has(input:focus-visible) { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
/* Target fields (shared with the Edit Goal dialog) */
:is(.goal-card, #edit-goal) [data-goal-input], :is(.goal-card, #edit-goal) [data-goal-duration], :is(.goal-card, #edit-goal) [data-goal-input="QURAN_RANGE"] > p {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px;
}
:is(.goal-card, #edit-goal, #add-reading, .progress-page) :is(select, input[type="number"], input[type="text"]) {
  height: 44px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
:is(.goal-card, #edit-goal, #add-reading) label { color: var(--ui-ink); font-size: 14px; font-weight: 700; }
.goal-card [data-goal-preview] { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.goal-card [data-goal-preview] li { padding: 12px 16px; border-radius: 12px; background: var(--ui-surface2); font-size: 15px; line-height: 1.5; }
.goal-card [data-goal-preview] li > * { margin: 0; font-size: 15px; }
.goal-card [data-goal-preview] li > :first-child { font-weight: 800; }
.goal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--ui-line); }
.goal-nav button {
  height: 46px; padding: 0 22px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink);
  font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.goal-nav [data-goal-next] { margin-left: auto; border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
[dir="rtl"] .goal-nav [data-goal-next] { margin-left: 0; margin-right: auto; }
.goal-nav button:disabled { opacity: 0.5; cursor: default; }
.goal-nav [role="alert"]:not(:empty) { flex-basis: 100%; color: #B42318; font-size: 14px; font-weight: 600; }

/* Progress page */
.progress-page { max-width: 880px; margin: 0 auto; padding: 36px 24px 80px; box-sizing: border-box; color: var(--ui-ink); }
.progress-page > h1 { margin: 0 0 22px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; }
.goal-panel { margin-bottom: 18px; padding: 24px 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-surface); }
.goal-panel > h2 { margin: 0 0 14px; font-size: 19px; font-weight: 800; }
.goal-panel h3 { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
.progress-streak [data-streak] {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 8px 16px 8px 12px; border-radius: 999px; background: var(--ui-gold-soft); color: var(--ui-gold); font-size: 18px; font-weight: 800;
}
.progress-streak [data-streak]::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: url("/assets/icons/target.svg") center / contain no-repeat; mask: url("/assets/icons/target.svg") center / contain no-repeat; }
.progress-streak #progress-week-title { margin: 0 0 8px; color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.progress-streak [data-week] { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.progress-streak [data-week] li { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--ui-muted); font-size: 13px; line-height: 1.4; }
.progress-streak [data-week] li::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ui-line); box-sizing: border-box; background: var(--ui-bg); }
.progress-streak [data-week] li[data-state="filled"]::before { border-color: var(--ui-primary); background: var(--ui-primary-soft); }
.progress-streak [data-week] li[data-state="read"]::before, .progress-streak [data-week] li[data-state="checked"]::before { border-color: var(--ui-primary); background: var(--ui-primary); }
.progress-streak [data-week] li[data-state="future"]::before { border-style: dashed; }
.progress-streak [data-week] li[aria-current="date"] { color: var(--ui-ink); font-weight: 800; }
.progress-streak [data-week] li[aria-current="date"]::before { box-shadow: 0 0 0 3px var(--ui-gold-soft); }
.progress-goal [data-goal] > p:nth-of-type(1) { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.progress-goal [data-goal] progress { flex: 1; height: 12px; }
.progress-goal [data-goal-percent] { min-width: 56px; color: var(--ui-primary); font-size: 18px; font-weight: 800; text-align: right; }
.progress-goal [data-goal-description] { margin: 0; color: var(--ui-muted); }
.progress-goal [data-goal-empty] { padding: 20px; border-radius: 16px; background: var(--ui-surface2); }
.progress-goal [data-goal-empty] a { display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 12px; background: var(--ui-primary); color: var(--ui-primary-ink); font-weight: 800; text-decoration: none; }
.progress-history-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.progress-history-bar [data-add-open], .progress-goal [data-edit-open] {
  height: 42px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.progress-history-bar [data-add-open] { margin-left: auto; }
[dir="rtl"] .progress-history-bar [data-add-open] { margin-left: 0; margin-right: auto; }
.progress-history [data-months] { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.progress-history [data-months] button {
  width: 100%; height: 52px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.progress-history [data-months] button:hover { border-color: var(--ui-primary); color: var(--ui-primary); }

/* The dialogs: month calendar and Manually add readings share .calendar */
.progress-page .calendar { margin: 10px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.progress-page .calendar button {
  width: 100%; aspect-ratio: 1; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.progress-page .calendar button:hover:not(:disabled) { border-color: var(--ui-primary); color: var(--ui-primary); }
.progress-page .calendar button:disabled { opacity: 0.35; cursor: default; }
/* In the month history only the days with reading are enabled. */
#history-month .calendar button:not(:disabled) { border-color: var(--ui-primary); background: var(--ui-primary-soft); color: var(--ui-primary); }
.progress-page .calendar button:not(:disabled):is([data-state], [data-seconds], .read, [aria-pressed="true"]) { border-color: transparent; background: var(--ui-primary); color: var(--ui-primary-ink); }
.progress-page .cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-weight: 800; }
.progress-page .cal-nav button, .progress-page [data-add-back] { height: 36px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.progress-page [data-history-body] > p { color: var(--ui-muted); }
#edit-goal [role="radiogroup"] { display: flex; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
#delete-goal.is-open .dialog-actions button[type="submit"] { border-color: transparent; background: #B42318; color: #FFFFFF; }
#edit-goal.is-open .dialog-actions [data-delete-open] { margin-right: auto; border-color: transparent; background: transparent; color: #B42318; }
#edit-goal.is-open .dialog-actions [data-close] { border-color: var(--ui-line) !important; background: var(--ui-surface) !important; color: var(--ui-ink) !important; }

@media (max-width: 640px) {
  .goal-page { padding: 20px 0 56px; }
  .goal-card { padding: 22px 18px; }
  .progress-page { padding: 20px 0 56px; }
  .goal-panel { padding: 20px 18px; }
  .progress-history [data-months] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- 29. Data deletion (/data-deletion, /data-deletion/confirm): the account card, with the final confirm in red ---- */
.deletion-page .auth-card { border-top: 4px solid #B42318; }
.deletion-page form[action$="/confirm"] button[type="submit"] { background: #B42318; color: #FFFFFF; }
.deletion-page form[action$="/confirm"] { margin-top: 16px; }

/* ---- 30. Drawers (QK.ui.drawer adds .drawer.is-open): navigation, search, settings and the surah navigator. A grid keeps the
   title and its close button in a sticky header; the scrim is a shadow, so the page stays clickable as before. The navigation
   drawer and the surah navigator open from the inline-start side, as in the design; settings stays on the inline-end side,
   which the reader's controls never sit under. ---- */
.drawer.is-open {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; box-sizing: border-box;
  background: var(--ui-surface); color: var(--ui-ink); border-color: var(--ui-line);
  box-shadow: 0 24px 60px rgba(17, 27, 23, 0.18), 0 0 0 100vmax rgba(8, 14, 12, 0.45);
}
.drawer.is-open > * { grid-column: 1 / -1; min-width: 0; }
.drawer.is-open [hidden] { display: none !important; }
.drawer.is-open > h2:first-child {
  grid-column: 1; position: sticky; top: 0; z-index: 2; margin: 0; padding: 18px 8px 18px 20px; min-height: 68px; box-sizing: border-box;
  display: flex; align-items: center; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line); font-size: 20px; font-weight: 800; letter-spacing: -0.01em;
}
.drawer.is-open > h2:first-child + [data-close] {
  grid-column: 2; position: sticky; top: 0; z-index: 2; align-self: start; width: 52px; height: 68px; margin: 0; padding: 0;
  border: 0; border-bottom: 1px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-muted); font-size: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.drawer.is-open > h2:first-child + [data-close]::before {
  content: ""; width: 36px; height: 36px; border-radius: 10px; background: currentColor;
  -webkit-mask: url("/assets/icons/close.svg") center / 18px no-repeat; mask: url("/assets/icons/close.svg") center / 18px no-repeat;
}
.drawer.is-open > h2:first-child + [data-close]:hover { color: var(--ui-ink); }
.drawer.is-open > h2:first-child + [data-close]:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: -8px; }
#nav-drawer.is-open, #navigation-sidebar.is-open { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--ui-line); }
[dir="rtl"] #nav-drawer.is-open, [dir="rtl"] #navigation-sidebar.is-open { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--ui-line); }
#nav-drawer.is-open { width: min(340px, 100%); }
#navigation-sidebar.is-open { width: min(380px, 100%); }
.drawer.is-open h3, .drawer.is-open legend {
  margin: 0; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}

/* Menu rows: the navigation links, the surah navigator's lists and the search drawer's results. */
#nav-drawer nav ul, #navigation-sidebar ul, #search-drawer-body ul { margin: 0; padding: 0; list-style: none; }
#nav-drawer nav { padding: 14px; }
#nav-drawer nav a, #navigation-sidebar [role="tabpanel"] li > a, #navigation-sidebar .recent-navigations a {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--ui-ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
#nav-drawer nav a:hover, #navigation-sidebar [role="tabpanel"] li > a:hover, #navigation-sidebar .recent-navigations a:hover { background: var(--ui-surface2); }
#nav-drawer nav a[aria-current] { background: var(--ui-primary-soft); color: var(--ui-primary); }

/* The surah navigator: tabs and search in the header area, then the lists. */
#navigation-sidebar [role="tablist"] {
  display: flex; gap: 4px; margin: 14px 18px 0; padding: 4px; border-radius: 12px; background: var(--ui-surface2);
}
#navigation-sidebar [role="tab"] {
  flex: 1; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--ui-muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
#navigation-sidebar [role="tab"][aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(17, 27, 23, 0.12); }
#navigation-sidebar .recent-navigations { order: 0; padding: 14px 10px 0; }
#navigation-sidebar .recent-navigations h3 { padding: 0 12px 6px; }
#navigation-sidebar [role="tabpanel"] { padding: 12px 10px 20px; }
#navigation-sidebar .nav-surah-search, #navigation-sidebar .nav-verse-surah, #search-drawer input[type="search"] {
  box-sizing: border-box; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
#navigation-sidebar .nav-surah-search { margin: 0 0 10px; padding-left: 42px; background: var(--ui-bg) url("/assets/icons/search.svg") 14px center / 18px no-repeat; }
#navigation-sidebar .nav-surah-search:focus, #navigation-sidebar .nav-verse-surah:focus, #search-drawer input[type="search"]:focus {
  outline: none; border-color: var(--ui-primary); box-shadow: 0 0 0 3px var(--ui-primary-soft);
}
#navigation-sidebar label[for="nav-verse-surah"] { display: block; margin: 0 12px 6px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#navigation-sidebar .nav-verse-surah { margin-bottom: 10px; }
#navigation-sidebar .nav-surah-list li { display: flex; align-items: center; gap: 4px; border-radius: 10px; color: var(--ui-muted); font-size: 13px; }
#navigation-sidebar .nav-surah-list li > a { flex: 1; min-width: 0; }
#navigation-sidebar .nav-surah-list li { padding-inline-end: 12px; }
#navigation-sidebar .nav-surah-list li:hover { background: var(--ui-surface2); }
#navigation-sidebar .nav-surah-list li > a:hover { background: none; }
#navigation-sidebar a[aria-current], #navigation-sidebar .nav-surah-list li:has(> a[aria-current]) { background: var(--ui-primary-soft); color: var(--ui-primary); }
#navigation-sidebar .nav-verse-list, #nav-panel-juz ul, #nav-panel-page ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; }

/* Search: a panel at the top of the page, as in the design, rather than a side drawer. */
#search-drawer.is-open {
  top: 24px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 48px);
  border: 1px solid var(--ui-line); border-radius: 18px;
}
[dir="rtl"] #search-drawer.is-open { left: 50%; right: auto; border: 1px solid var(--ui-line); }
#search-drawer.is-open > h2:first-child { min-height: 60px; padding: 14px 8px 14px 20px; font-size: 16px; }
#search-drawer.is-open > h2:first-child + [data-close] { height: 60px; }
#search-drawer form { display: flex; align-items: center; gap: 8px; padding: 16px 16px 0; }
#search-drawer input[type="search"] { flex: 1; padding-left: 42px; background: var(--ui-bg) url("/assets/icons/search.svg") 14px center / 18px no-repeat; }
#search-drawer .voice-search {
  flex: none; width: 44px; height: 44px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font-size: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#search-drawer .voice-search::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("/assets/icons/mic.svg") center / contain no-repeat; mask: url("/assets/icons/mic.svg") center / contain no-repeat; }
#search-drawer .voice-search:hover, #search-drawer .voice-search[aria-pressed="true"] { border-color: var(--ui-primary); color: var(--ui-primary); }
#search-drawer-body { padding: 10px 16px 16px; }
#search-drawer-body section { padding: 8px 0; }
#search-drawer-body section h3 { padding: 0 4px 8px; }
#search-drawer-body section ul { display: flex; flex-wrap: wrap; gap: 6px; }
#search-drawer-body section li > a, #search-drawer-body section li > button {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
#search-drawer-body section li > a:hover, #search-drawer-body section li > button:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
#search-drawer-body .search-summary { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#search-drawer-body .search-summary a { color: var(--ui-primary); font-size: 13px; letter-spacing: 0; text-transform: none; text-decoration: none; }
#search-drawer-body .search-summary a:hover { text-decoration: underline; }
#search-drawer-body .search-results > li { position: relative; padding: 8px 12px; border-radius: 10px; }
#search-drawer-body .search-results > li:hover { background: var(--ui-surface2); }
#search-drawer-body .search-hit { display: flex; align-items: baseline; gap: 10px; color: var(--ui-ink); font-size: 14px; line-height: 1.6; text-decoration: none; }
#search-drawer-body .search-hit::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
#search-drawer-body .search-hit:focus-visible { outline: none; }
#search-drawer-body .search-hit:focus-visible::after { outline: 2px solid var(--ui-primary); outline-offset: -2px; }
#search-drawer-body .search-hit[data-result-type]:not([data-result-type="ayah"]) .search-hit-name { font-weight: 800; }
#search-drawer-body .search-hit-key {
  flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 7px;
  background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 12px; font-weight: 800;
}
#search-drawer-body .search-hit-name em { font-style: normal; font-weight: 700; background: var(--highlight); border-radius: 4px; padding: 0 2px; }
#search-drawer-body .search-hit-arabic { margin: 4px 0 0; color: var(--ui-muted); font-family: "Amiri Quran", "UthmanicHafs", "Amiri", serif; font-size: 20px; line-height: 1.9; text-align: right; }
#search-drawer-body .search-hit[data-result-type]:not([data-result-type="ayah"]) + .search-hit-arabic { font-family: "Amiri", serif; font-size: 17px; }
#search-drawer-body [role="status"], #search-drawer-body > p:not([class]) { margin: 8px 4px; color: var(--ui-muted); font-size: 14px; }

/* Settings: the preview, segmented tabs and choices, then the footer with Reset and Done. */
#settings-body { display: flex; flex-direction: column; gap: 18px; padding: 20px 20px 0; }
#settings-body .settings-preview { padding: 14px 16px; border-radius: 16px; background: var(--ui-surface2); }
#settings-body .settings-preview h3 { margin-bottom: 6px; }
#settings-body .settings-preview .verse-card { padding: 0; border: 0; }
#settings-body [role="tablist"], #settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) {
  display: flex; gap: 4px; margin: 0; padding: 4px; border: 0; border-radius: 12px; background: var(--ui-surface2);
}
#settings-body [role="tab"] {
  flex: 1; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--ui-muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
#settings-body [role="tab"][aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(17, 27, 23, 0.12); }
#settings-body [role="tabpanel"] { display: flex; flex-direction: column; gap: 16px; }
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) { position: relative; margin-top: 22px; }
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) > legend { position: absolute; top: -22px; left: 0; padding: 0; }
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) > label {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 9px;
  color: var(--ui-muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) > label > input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) > label:has(input:checked) { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(17, 27, 23, 0.12); }
#settings-body [role="tabpanel"] > fieldset:has(input[type="radio"]) > label:has(input:focus-visible) { outline: 2px solid var(--ui-primary); outline-offset: 1px; }
#settings-body [role="tabpanel"] > fieldset:not(:has(input[type="radio"])) { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; border: 0; }
#settings-body [role="tabpanel"] > fieldset:not(:has(input[type="radio"])) > legend { width: 100%; margin-bottom: 8px; padding: 0; }
#settings-body [role="tabpanel"] label { font-size: 14px; }
#settings-body input[type="checkbox"] { accent-color: var(--ui-primary); }
#settings-body [role="tabpanel"] > p:not(.settings-note) { display: flex; flex-direction: column; gap: 6px; margin: 0; }
#settings-body [role="tabpanel"] > p:not(.settings-note) > label[for] { color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#settings-body [role="tabpanel"] > p[data-script="tajweed"] > label { display: flex; align-items: center; gap: 8px; color: var(--ui-ink); font-size: 14px; letter-spacing: 0; text-transform: none; }
#settings-body select, #settings-body input[type="search"] {
  box-sizing: border-box; width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
#settings-body [data-font-control] { display: flex; align-items: center; gap: 8px; color: var(--ui-ink); font-size: 14px; font-weight: 600; }
#settings-body [data-font-control] > span { flex: 1; }
#settings-body [data-font-step] {
  width: 36px; height: 36px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
#settings-body [data-font-step]:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
#settings-body [data-font-control] output { width: 32px; text-align: center; font-weight: 800; }
#settings-body .selected-reciter, #settings-body .selected-translations { display: flex; flex-direction: column; gap: 6px; }
#settings-body [data-open-reciters], #settings-body [data-open-translations] {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; text-align: start; cursor: pointer;
}
#settings-body [data-open-reciters]::after, #settings-body [data-open-translations]::after {
  content: ""; flex: none; width: 16px; height: 16px; margin-inline-start: auto; background: currentColor;
  -webkit-mask: url("/assets/icons/next.svg") center / contain no-repeat; mask: url("/assets/icons/next.svg") center / contain no-repeat;
}
#settings-body [data-open-reciters]:hover, #settings-body [data-open-translations]:hover { border-color: var(--ui-primary); }
#settings-body .reciter-picker, #settings-body .translation-picker { display: flex; flex-direction: column; gap: 10px; }
#settings-body [data-close-reciters], #settings-body [data-close-translations] {
  align-self: flex-start; height: 34px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
#settings-body [data-reciter-list], #settings-body [data-translation-list] { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
#settings-body [data-reciter-list] label, #settings-body [data-translation-list] label { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer; }
#settings-body [data-reciter-list] label:hover, #settings-body [data-translation-list] label:hover { background: var(--ui-surface2); }
#settings-body [data-reciter-list] input, #settings-body [data-translation-list] input { accent-color: var(--ui-primary); }
#settings-body .settings-note { margin: 0; color: var(--ui-muted); font-size: 13px; }
#settings-body .settings-footer {
  position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; margin: 0 -20px; padding: 16px 20px; border-top: 1px solid var(--ui-line); background: var(--ui-surface);
}
#settings-body .settings-footer button {
  flex: 1; height: 44px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
#settings-body .settings-footer button:hover { background: var(--ui-surface2); }
#settings-body .settings-footer [data-settings-done] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); }
#settings-body .settings-footer [data-settings-done]:hover { filter: brightness(1.08); background: var(--ui-primary); }
#nav-drawer nav li { display: flex; align-items: center; gap: 8px; border-radius: 10px; }
#nav-drawer nav li > a { flex: 1; min-width: 0; }
#nav-drawer nav li:has(> a:hover) { background: var(--ui-surface2); }
#nav-drawer nav li > a:hover { background: none; }
#nav-drawer nav a:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: -2px; }
#nav-drawer [data-whats-new] {
  flex: none; margin-inline-end: 10px; padding: 2px 8px; border-radius: 999px; background: var(--ui-gold-soft, #F6EBD6); color: var(--ui-gold, #9A6B22);
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}

/* app.css parks the skip link at left: -9999px; in a right-to-left page that widens the document to about 11,000px and lets it
   scroll sideways (B-19). Hidden in place instead, it shows at the inline start when focused. */
.skip-link:not(:focus) { left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[dir="rtl"] .skip-link:focus { left: auto; right: 8px; }
[dir="rtl"] #navigation-sidebar .nav-surah-search, [dir="rtl"] #search-drawer input[type="search"] { padding: 0 42px 0 14px; background-position: right 14px center; }
[dir="rtl"] .drawer.is-open > h2:first-child { padding: 18px 20px 18px 8px; }

/* ---- 31. Verse dialogs, popovers and pickers: the ⋯ menu, Copy Options, Save verse (bookmark), Share, Advanced Copy, Repeat,
   Notes, Translation Feedback, the pins menu and picker, and the word tooltip. The scripts build these; QK.ui adds .popover or
   .modal with .is-open and places popovers under their button. The modal card itself is section 18. ---- */
.popover.is-open:not(.audio-menu):not(.nav-menu-list) {
  box-sizing: border-box; min-width: 240px; max-width: min(360px, calc(100vw - 16px)); padding: 8px;
  background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: 16px; box-shadow: 0 24px 60px rgba(17, 27, 23, 0.18);
}
.popover.is-open [hidden] { display: none !important; }
.popover.is-open[role="menu"] { display: flex; flex-direction: column; gap: 2px; }
.popover.is-open[role="menu"] > [role="menuitem"] {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px; box-sizing: border-box; border: 0; border-radius: 10px;
  background: none; color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 600; text-align: start; text-decoration: none; cursor: pointer;
}
.popover.is-open[role="menu"] > [role="menuitem"]:hover, .popover.is-open[role="menu"] > [role="menuitem"]:focus-visible { background: var(--ui-surface2); outline: none; }
.popover.is-open[role="menu"] > [data-pins-menu="clear"] { color: var(--ui-danger, #B42318); }

/* Copy Options */
#copy-options.is-open { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
#copy-options label { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 9px; font-size: 14px; cursor: pointer; }
#copy-options label:hover { background: var(--ui-surface2); }
#copy-options input, .modal.is-open :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ui-primary); }
#copy-options [data-copy-now] { margin-top: 8px; }

/* Shared buttons in these popovers and dialogs: quiet by default, the main action in green. */
:is(#copy-options, #bookmark-popover, #share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #pins-picker) button:not([role="menuitem"]):not([data-close]):not(.word):not([data-set-slot]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
:is(#copy-options, #bookmark-popover, #share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #pins-picker) button:not([role="menuitem"]):not([data-close]):not(.word):not([data-set-slot]):hover { background: var(--ui-surface2); }
:is(#copy-options [data-copy-now], #share-dialog [data-share-copy], #advanced-copy [data-advanced-copy], #audio-repeat [data-repeat-start],
  #translation-feedback button[type="submit"], #note-dialog button[type="submit"], #bookmark-popover form button[type="submit"]) {
  border-color: var(--ui-primary) !important; background: var(--ui-primary) !important; color: var(--ui-primary-ink) !important;
}
:is(#copy-options [data-copy-now], #share-dialog [data-share-copy], #advanced-copy [data-advanced-copy], #audio-repeat [data-repeat-start],
  #translation-feedback button[type="submit"], #note-dialog button[type="submit"]):hover { filter: brightness(1.08); }

/* Dialog layout: the title row leaves room for the close button, which becomes an icon in the top corner. */
:is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #pins-picker).is-open { display: flex; flex-direction: column; gap: 16px; }
:is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #pins-picker).is-open > h2:first-child { margin: 0; padding-right: 40px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
:is(#share-dialog, #advanced-copy) > [data-close]:last-child, #note-dialog > p:last-child > [data-close]:only-child {
  position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none;
  color: var(--ui-muted); font-size: 0; cursor: pointer;
}
:is(#share-dialog, #advanced-copy) > [data-close]:last-child::before, #note-dialog > p:last-child > [data-close]:only-child::before {
  content: ""; display: block; width: 18px; height: 18px; margin: auto; background: currentColor;
  -webkit-mask: url("/assets/icons/close.svg") center / contain no-repeat; mask: url("/assets/icons/close.svg") center / contain no-repeat;
}
:is(#share-dialog, #advanced-copy) > [data-close]:last-child:hover, #note-dialog > p:last-child > [data-close]:only-child:hover { background: var(--ui-surface2); color: var(--ui-ink); }
[dir="rtl"] :is(#share-dialog, #advanced-copy) > [data-close]:last-child, [dir="rtl"] #note-dialog > p:last-child > [data-close]:only-child { right: auto; left: 20px; }
[dir="rtl"] :is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #pins-picker).is-open > h2:first-child { padding-right: 0; padding-left: 40px; }
#note-dialog > p:last-child:has(> [data-close]:only-child) { margin: 0; }
:is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog).is-open p { margin: 0; }

/* Radio groups as segmented switches; checkbox groups as a column of rows. */
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open legend { margin-bottom: 8px; padding: 0; }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset:has(> label > input[type="radio"]) {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ui-surface2); position: relative; margin-top: 26px;
}
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset:has(> label > input[type="radio"]) > legend { position: absolute; top: -26px; left: 0; }
[dir="rtl"] :is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset:has(> label > input[type="radio"]) > legend { left: auto; right: 0; }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset > label:has(> input[type="radio"]) {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--ui-muted); font-size: 14px; font-weight: 700; text-align: center; cursor: pointer;
}
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset > label > input[type="radio"] { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset > label:has(> input:checked) { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(17, 27, 23, 0.12); }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset > label:has(> input:focus-visible) { outline: 2px solid var(--ui-primary); outline-offset: 1px; }
:is(#share-dialog, #advanced-copy, #audio-repeat).is-open fieldset > label:has(> input:disabled) { opacity: 0.5; cursor: default; }
#advanced-copy [data-translation-checks] { display: flex; flex-direction: column; gap: 2px; }
#advanced-copy [data-translation-checks] label { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 9px; font-size: 14px; cursor: pointer; }
#advanced-copy [data-translation-checks] label:hover { background: var(--ui-surface2); }

/* Fields */
:is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #bookmark-popover).is-open :is(input[type="text"], input:not([type]), input[type="number"], select, textarea) {
  box-sizing: border-box; height: 44px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 15px;
}
:is(#translation-feedback, #note-dialog).is-open textarea { width: 100%; height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; }
:is(#share-dialog, #advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #bookmark-popover).is-open :is(input, select, textarea):focus {
  outline: none; border-color: var(--ui-primary); box-shadow: 0 0 0 3px var(--ui-primary-soft);
}
:is(#advanced-copy, #audio-repeat, #translation-feedback, #note-dialog).is-open label[for] { color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#translation-feedback p:has(> label[for]), #note-dialog p:has(> label[for]) { display: flex; flex-direction: column; gap: 6px; }
:is(#translation-feedback, #note-dialog) p:has(> label[for]) > br { display: none; }
#translation-feedback select { width: 100%; }
#translation-feedback [data-feedback-verse] {
  align-self: flex-start; padding: 4px 10px; border-radius: 8px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 800;
}
:is(#advanced-copy, #audio-repeat, #translation-feedback, #note-dialog) [role="alert"]:empty { display: none; }
:is(#advanced-copy, #audio-repeat, #translation-feedback, #note-dialog, #bookmark-popover) [role="alert"]:not(:empty) { color: var(--ui-danger, #B42318); font-size: 14px; }

/* Share: the link and its Copy button on one line, then Copy Embed and Generate Media. */
#share-dialog p:has(> #share-link) { display: flex; align-items: center; gap: 8px; }
#share-dialog label[for="share-link"] { flex: none; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#share-dialog #share-link { flex: 1; min-width: 0; color: var(--ui-muted); font-size: 14px; }
#share-dialog p:has(> [data-share-copy]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#share-dialog [data-share="media"] {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 12px;
  color: var(--ui-ink); font-size: 14px; font-weight: 700; text-decoration: none;
}
#share-dialog [data-share="media"]:hover { background: var(--ui-surface2); }

/* Advanced Copy: the range fields, then Copy with its status. */
#advanced-copy [data-range-row]:not([hidden]) { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px 10px; }
#advanced-copy [data-range-row] input { width: 100%; }
#advanced-copy > [data-advanced-copy] { align-self: flex-start; }
#advanced-copy > output { color: var(--ui-primary); font-size: 14px; font-weight: 700; }
#advanced-copy:has(> output) { gap: 14px; }

/* Repeat: label, field and unit on one row; Cancel and Start Playing at the end. */
#audio-repeat.is-open > p:has(> input) { display: grid; grid-template-columns: minmax(0, 1fr) 120px 64px; align-items: center; gap: 10px; color: var(--ui-muted); font-size: 14px; }
#audio-repeat.is-open > p:has(> input) > input { width: 100%; }
#audio-repeat.is-open > p:has(> input[list]) { grid-template-columns: minmax(0, 1fr) 184px; }
#audio-repeat [data-repeat-cancel] { margin-left: auto; }
/* G-20c: label | − | count | + | unit, in the same grid as the other rows */
#audio-repeat.is-open > p.repeat-count { grid-template-columns: minmax(0, 1fr) 40px 56px 40px 64px; gap: 6px; }
#audio-repeat.is-open > p.repeat-count > input[type="number"] { padding: 0 4px; text-align: center; }
#audio-repeat.is-open > p.repeat-count > button[data-repeat-step][aria-controls] {
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink);
  font: inherit; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
}
#audio-repeat.is-open > p.repeat-count > button[data-repeat-step][aria-controls]:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
#audio-repeat.is-open:has(> [data-repeat-start]) { flex-direction: row; flex-wrap: wrap; }
#audio-repeat.is-open > :not(button) { flex-basis: 100%; }

/* Translation Feedback and Notes: actions at the end. */
#translation-feedback.is-open { flex-direction: row; flex-wrap: wrap; }
#translation-feedback.is-open > :not(button) { flex-basis: 100%; }
#translation-feedback > [data-close] { margin-left: auto; }
#translation-feedback > [data-close] {
  height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
#note-dialog [data-note-editor] { display: flex; flex-wrap: wrap; gap: 8px; }
#note-dialog [data-note-editor] > p { flex-basis: 100%; }
#note-dialog [data-note-list]:empty { display: none; }
#note-dialog [data-note-list] { display: flex; flex-direction: column; gap: 10px; }
#note-dialog [data-note-list] > * { padding: 14px 16px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-bg); }

/* Save verse (the bookmark popover) */
#bookmark-popover.is-open { width: 340px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
#bookmark-popover h2 { margin: 0; padding-right: 8px; font-size: 16px; font-weight: 800; }
#bookmark-popover section { display: flex; flex-direction: column; gap: 6px; }
#bookmark-popover section + section { padding-top: 12px; border-top: 1px solid var(--ui-line); }
#bookmark-popover h3 { margin: 0; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#bookmark-popover section > p { margin: 0; color: var(--ui-muted); font-size: 13px; }
#bookmark-popover section > p[role]:empty { display: none; }
#bookmark-popover ul { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
#bookmark-popover [data-slots] button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: auto; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ui-ink); font-size: 14px; font-weight: 600; text-align: start; line-height: 1.35;
}
#bookmark-popover [data-slots] button::before {
  content: ""; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--ui-gold-soft, #F6EBD6) url("/assets/icons/bookmark.svg") center / 16px no-repeat;
}
#bookmark-popover [data-slots] button:hover { background: var(--ui-surface2); }
#bookmark-popover [data-collections] label { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 9px; font-size: 14px; cursor: pointer; }
#bookmark-popover [data-collections] label:hover { background: var(--ui-surface2); }
#bookmark-popover [data-collections] input { accent-color: var(--ui-primary); }
#bookmark-popover form[data-new-form]:not([hidden]) { display: flex; flex-wrap: wrap; gap: 8px; }
#bookmark-popover form[data-new-form] label { flex-basis: 100%; color: var(--ui-muted); font-size: 12px; font-weight: 700; }
#bookmark-popover form[data-new-form] input { flex-basis: 100%; }
#bookmark-popover [data-guest-prompt]:not([hidden]) { padding: 12px 14px; border-radius: 12px; background: var(--ui-surface2); font-size: 13px; }
#bookmark-popover [data-guest-prompt] p { margin: 0 0 6px; color: var(--ui-ink); font-weight: 600; }
#bookmark-popover [data-guest-prompt] ul { margin: 0 0 10px; padding-left: 18px; list-style: disc; color: var(--ui-muted); }
#bookmark-popover [data-guest-sign-in] { color: var(--ui-primary); font-weight: 700; }
#bookmark-popover > p:last-child { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--ui-line); }
#bookmark-popover > p:last-child > [data-close] {
  height: 36px; padding: 0 16px; border: 1px solid var(--ui-primary); border-radius: 10px; background: var(--ui-primary); color: var(--ui-primary-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}

/* The word tooltip (On hold/hover) */
#wbw-tooltip:not([hidden]) {
  padding: 8px 12px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink);
  box-shadow: 0 10px 30px rgba(17, 27, 23, 0.16); font-family: "Manrope", system-ui, sans-serif; font-weight: 600; line-height: 1.5;
}
#translation-feedback.is-open > [data-feedback-verse] { flex-basis: auto; margin-right: 100%; }
#pins-picker ul { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
#pins-picker ul button { width: 100%; justify-content: flex-start !important; }
#pins-picker > [data-close] {
  align-self: flex-end; height: 40px; padding: 0 16px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}

/* ---- 32. Feedback: toasts, the pinned verses tray, the notifications panel, and the reader's newsletter and donation cards.
   (The banner is section 5 and the onboarding checklist section 8.) ---- */
#toasts { left: 24px; bottom: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100vw - 48px); }
[dir="rtl"] #toasts { left: auto; right: 24px; align-items: flex-end; }
#toasts .toast {
  display: flex; align-items: center; gap: 10px; min-height: 44px; max-width: 420px; padding: 10px 16px; box-sizing: border-box;
  border: 0; border-radius: 12px; background: var(--ui-hero); color: var(--ui-hero-ink);
  box-shadow: 0 10px 30px rgba(17, 27, 23, 0.25); font-size: 14px; font-weight: 600; line-height: 1.4;
}
#toasts .toast a, #toasts .toast button { color: var(--ui-hero-gold); font-weight: 700; background: none; border: 0; cursor: pointer; }
/* G-21a: QK.ui.error / toast(text, {kind: 'error'}) */
#toasts .toast-error { background: var(--ui-danger, #B42318); color: #FFFFFF; }
#toasts .toast-error a, #toasts .toast-error button { color: #FFFFFF; text-decoration: underline; }
@media (max-width: 640px) { #toasts { left: 12px; right: 12px; bottom: 12px; } #toasts .toast { max-width: none; width: 100%; } }

/* Pinned verses tray: each verse and its × as one chip. */
.reader-header .pinned-verses > span:first-child { color: var(--ui-ink); font-weight: 700; }
.reader-header .pinned-chip { display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface); }
.reader-header .pinned-chip button { height: 28px; border: 0; background: none; }
.reader-header .pinned-chip [data-pin-go] { padding: 0 4px 0 12px; font-weight: 700; }
.reader-header .pinned-chip [data-pin-remove] { width: 26px; padding: 0; border-radius: 50%; color: var(--ui-muted); font-size: 15px; }
.reader-header .pinned-chip [data-pin-remove]:hover { color: var(--ui-danger, #B42318); }
.reader-header .pinned-chip:hover { border-color: var(--ui-primary); }
.reader-header .pinned-verses [data-pins-compare] { border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); font-weight: 700; padding: 0 14px; }
.reader-header .pinned-verses [data-pins-more] { width: 30px; padding: 0; }

/* Notifications: a card under the bell, kept inside the window. */
#notifications-panel.is-open {
  left: auto !important; right: max(12px, calc((100vw - 1160px) / 2)); width: min(380px, calc(100vw - 24px)); max-width: none; padding: 0; overflow: hidden;
}
[dir="rtl"] #notifications-panel.is-open { right: auto; left: max(12px, calc((100vw - 1160px) / 2)) !important; }
#notifications-panel h2 { margin: 0; padding: 16px 18px 6px; font-size: 16px; font-weight: 800; }
#notifications-panel > p:first-of-type { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0 12px 12px; border-bottom: 1px solid var(--ui-line); }
#notifications-panel > p:first-of-type button {
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ui-primary); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
#notifications-panel > p:first-of-type button:hover { background: var(--ui-primary-soft); }
#notifications-panel [data-notifications-read-all] { margin-left: auto; }
#notifications-panel [data-notifications-empty]:not([hidden]) { margin: 0; padding: 28px 18px; color: var(--ui-muted); font-size: 14px; text-align: center; }
#notifications-panel [data-notifications-list] { max-height: min(420px, 60vh); overflow-y: auto; margin: 0; padding: 0; list-style: none; }
#notifications-panel [data-notification] {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 14px 18px; border-bottom: 1px solid var(--ui-line);
}
#notifications-panel [data-notification][data-read="false"] { background: var(--ui-primary-soft); }
#notifications-panel [data-notification][data-read="false"] > a::after {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--ui-gold, #9A6B22); vertical-align: middle;
}
#notifications-panel [data-notification] > a { grid-column: 1; color: var(--ui-ink); font-size: 14px; font-weight: 700; text-decoration: none; }
#notifications-panel [data-notification] > a:hover { color: var(--ui-primary); text-decoration: underline; }
#notifications-panel [data-notification] > p { grid-column: 1; margin: 0; color: var(--ui-muted); font-size: 13px; }
#notifications-panel [data-notification] > time { grid-column: 1; color: var(--ui-muted); font-size: 12px; font-weight: 600; }
#notifications-panel [data-notification-read] {
  grid-column: 2; grid-row: 1 / 3; align-self: center; height: 28px; padding: 0 10px; border: 1px solid var(--ui-line); border-radius: 8px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
#notifications-panel [data-notification-read]:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
#notifications-panel > p:last-child { margin: 0; padding: 12px 18px; text-align: center; }
#notifications-panel > p:last-child a { color: var(--ui-primary); font-size: 13px; font-weight: 700; text-decoration: none; }
#notifications-panel > p:last-child a:hover { text-decoration: underline; }

/* The reader's newsletter and donation cards: a dark card with a close button in the corner. */
:is([data-popup="newsletter"], [data-popup="donation"]) {
  position: relative; overflow: hidden; max-width: 720px; margin: 24px auto 0; padding: 28px 30px; box-sizing: border-box; border-radius: 22px;
  background: radial-gradient(260px 260px at 100% 0, rgba(31, 160, 122, 0.45), transparent 70%), var(--ui-hero); color: var(--ui-hero-ink);
}
:is([data-popup="newsletter"], [data-popup="donation"]) h2 { margin: 0 48px 8px 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
:is([data-popup="newsletter"], [data-popup="donation"]) > p { margin: 0 0 16px; color: var(--ui-hero-muted); font-size: 15px; }
:is([data-popup="newsletter"], [data-popup="donation"]) a { color: var(--ui-hero-gold); font-weight: 700; }
[data-popup="newsletter"] .newsletter-form input { flex: 1; min-width: 180px; border-color: var(--ui-hero-line); background: rgba(255, 255, 255, 0.08); color: var(--ui-hero-ink); }
[data-popup="newsletter"] .newsletter-form input::placeholder { color: var(--ui-hero-muted); }
[data-popup="newsletter"] .newsletter-form button { background: var(--ui-hero-ink); color: var(--ui-hero); }
[data-popup="newsletter"] .newsletter-message { color: var(--ui-hero-muted); }
:is([data-popup="newsletter"], [data-popup="donation"]) > button:last-child {
  position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none;
  color: var(--ui-hero-ink); font-size: 0; cursor: pointer;
}
:is([data-popup="newsletter"], [data-popup="donation"]) > button:last-child::before {
  content: ""; display: block; width: 18px; height: 18px; margin: auto; background: currentColor;
  -webkit-mask: url("/assets/icons/close.svg") center / contain no-repeat; mask: url("/assets/icons/close.svg") center / contain no-repeat;
}
:is([data-popup="newsletter"], [data-popup="donation"]) > button:last-child:hover { background: rgba(255, 255, 255, 0.1); }
[dir="rtl"] :is([data-popup="newsletter"], [data-popup="donation"]) > button:last-child { right: auto; left: 18px; }
[dir="rtl"] :is([data-popup="newsletter"], [data-popup="donation"]) h2 { margin: 0 0 8px 48px; }
#popups:not(:empty) { display: flow-root; }

/* ---- 33. Error pages: 404 (a dark hero with the big number), 500 (a centred card with a red mark), and the bare 503 "busy" page
   that App::fail writes without the layout or the database. ---- */
#main:has(> .error-page) { display: flex; padding: 0; }
.error-page {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; box-sizing: border-box;
  min-height: min(720px, calc(100vh - 160px)); padding: 64px 24px; text-align: center;
}
.error-page h1 { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.error-page p { margin: 0; max-width: 460px; font-size: 16px; line-height: 1.6; }
.error-page p:has(> a) { margin-top: 10px; }
.error-page p > a {
  display: inline-flex; align-items: center; height: 46px; padding: 0 22px; border-radius: 12px; font-size: 15px; font-weight: 700; text-decoration: none;
}
.error-404 {
  position: relative; overflow: hidden; color: var(--ui-hero-ink);
  background: radial-gradient(420px 420px at 30% 30%, rgba(31, 160, 122, 0.4), transparent 70%), var(--ui-hero);
}
.error-404::before {
  content: "404"; display: block; color: var(--ui-hero-gold); font-size: clamp(88px, 16vw, 140px); font-weight: 800; letter-spacing: -0.05em; line-height: 1;
}
.error-404 > p:not(:has(> a)) { color: var(--ui-hero-muted); }
.error-404 p > a { background: var(--ui-hero-ink); color: var(--ui-hero); }
.error-404 p > a:hover { filter: brightness(0.95); }
.error-500, .error-503 { background: var(--ui-bg); color: var(--ui-ink); }
.error-500::before, .error-503::before {
  content: ""; width: 72px; height: 72px; margin-bottom: 4px; border-radius: 22px; background: #FDECEA url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B42318' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E") center / 32px no-repeat;
}
[data-theme="dark"] .error-500::before { background-color: #3A1A17; }
.error-500 > p:not(:has(> a)), .error-503 > p { color: var(--ui-muted); }
.error-500 p > a { background: var(--ui-primary); color: var(--ui-primary-ink); }
.error-500 p > a:hover { filter: brightness(1.08); }
/* The 503 page has no layout: only this stylesheet and the light tokens. */
body:has(> .error-503), html:has(.error-503) { margin: 0; background: var(--ui-bg); font-family: "Manrope", system-ui, sans-serif; }
.error-503 { min-height: 100vh; }
@media (max-width: 640px) { .error-page h1 { font-size: 28px; } .error-page { min-height: 70vh; } }

/* ---- 34. Admin (/admin…): its own document (admin/layout.php, body.admin-body). A dark side bar with the sections, then the
   page: headings, cards for sections, tables with a header row, fields and buttons. Everything here hangs off .admin-body. ---- */
.admin-body {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; min-height: 100vh; margin: 0;
  background: linear-gradient(to right, #0F2E27 260px, var(--ui-bg) 260px); color: var(--ui-ink); font-family: "Manrope", system-ui, sans-serif; font-size: 15px; line-height: 1.5;
}
.admin-body [hidden] { display: none !important; }
.admin-side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; box-sizing: border-box; display: flex; flex-direction: column;
  padding: 20px 14px; background: #0F2E27; color: #F3F1EA;
}
.admin-side::before { content: "Admin"; display: block; padding: 6px 10px 18px; color: #D9B46C; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a {
  display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px;
  color: #C9D6D0; font-size: 14px; font-weight: 600; text-decoration: none;
}
.admin-side nav a:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }
.admin-side nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; box-shadow: inset 3px 0 0 #D9B46C; }
.admin-side nav a:focus-visible { outline: 2px solid #D9B46C; outline-offset: -2px; }
.admin-side nav a[href^="/admin/content/"]:first-of-type { margin-top: 14px; }
.admin-side nav .admin-back { margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0; padding-top: 12px; }
.admin-side .admin-who { margin: auto 0 0; padding: 16px 10px 0; color: #AFC3BB; font-size: 12px; overflow-wrap: anywhere; }

.admin-body #main { box-sizing: border-box; min-width: 0; padding: 28px 36px 60px; background: var(--ui-bg); }
.admin-body #main > * { max-width: 1200px; }
.admin-body #main h1 { margin: 0 0 20px; font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; }
.admin-body #main h2 { margin: 0 0 12px; font-size: 18px; font-weight: 800; }
.admin-body #main h3 { margin: 16px 0 8px; font-size: 15px; font-weight: 800; }
.admin-body #main p { margin: 0 0 12px; }
.admin-body #main a { color: var(--ui-primary); font-weight: 600; }
.admin-body #main > section, .admin-body #main > form:not([role="search"]), .admin-body #main > div[id] {
  margin: 0 0 20px; padding: 22px 24px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-surface);
}
.admin-body #main section section { margin: 16px 0 0; }

/* Tables */
.admin-body #main table {
  width: 100%; margin: 0 0 16px; border-collapse: separate; border-spacing: 0; overflow: hidden;
  border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-surface); font-size: 14px;
}
.admin-body #main section table, .admin-body #main div[id] table { margin-bottom: 8px; }
.admin-body #main th {
  padding: 11px 14px; border-bottom: 1px solid var(--ui-line); background: var(--ui-surface2); color: var(--ui-muted);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-align: start; text-transform: uppercase; white-space: nowrap;
}
.admin-body #main td { padding: 12px 14px; border-bottom: 1px solid var(--ui-line); vertical-align: top; overflow-wrap: break-word; }
.admin-body #main td:has(> button) { white-space: nowrap; }
.admin-body #main tbody tr:last-child td { border-bottom: 0; }
.admin-body #main tbody tr:hover td { background: color-mix(in srgb, var(--ui-surface2) 50%, transparent); }
.admin-body #main td pre { margin: 0; max-width: 420px; max-height: 160px; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--ui-bg); font-size: 12px; white-space: pre-wrap; }
.admin-body #main td button + button { margin-left: 6px; }
.admin-body #main [data-overdue] { color: var(--ui-danger, #B42318); }

/* Fields and buttons */
.admin-body #main label { color: var(--ui-ink); font-size: 13px; font-weight: 700; }
.admin-body #main :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  box-sizing: border-box; min-height: 42px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 14px; vertical-align: middle;
}
.admin-body #main textarea { width: 100%; min-height: 90px; resize: vertical; }
.admin-body #main input[type="file"] { font: inherit; font-size: 14px; }
.admin-body #main :is(input, select, textarea):focus { outline: none; border-color: var(--ui-primary); box-shadow: 0 0 0 3px var(--ui-primary-soft); }
.admin-body #main input[type="checkbox"], .admin-body #main input[type="radio"] { accent-color: var(--ui-primary); }
.admin-body #main button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; box-sizing: border-box; vertical-align: middle;
  border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-ink);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.admin-body #main button:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.admin-body #main button[type="submit"] { min-height: 42px; padding: 0 18px; border-color: var(--ui-primary); background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 14px; }
.admin-body #main button[type="submit"]:hover { filter: brightness(1.08); color: var(--ui-primary-ink); }
.admin-body #main button:disabled { opacity: 0.5; cursor: default; }
.admin-body #main button[aria-label^="Delete"], .admin-body #main button[aria-label^="Disable"], .admin-body #main button[aria-label^="Hide"] { color: var(--ui-danger, #B42318); }

/* Search forms, status lines and page links */
.admin-body #main form[role="search"] p, .admin-body #main form[method="get"] p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-body #main form[role="search"] input[type="search"] { flex: 1; min-width: 220px; max-width: 420px; }
.admin-body #main [role="status"]:not(:empty) { color: var(--ui-muted); font-size: 14px; font-weight: 600; }
.admin-body #main [role="alert"]:not(:empty) { padding: 10px 14px; border-radius: 10px; background: #FDECEA; color: #B42318; font-size: 14px; font-weight: 600; }
.admin-body #main [role="status"]:empty, .admin-body #main [role="alert"]:empty { margin: 0; }
.admin-body #main nav[aria-label] { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 16px; }
.admin-body #main nav[aria-label] a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 600; text-decoration: none;
}
.admin-body #main nav[aria-label] a:hover, .admin-body #main nav[aria-label] a[aria-current] { border-color: var(--ui-primary); color: var(--ui-primary); }
.admin-body #main nav[aria-label] a[aria-current] { background: var(--ui-primary-soft); }
.admin-body #main ul { padding-left: 20px; }
.admin-body #main li { margin: 4px 0; }

@media (max-width: 900px) {
  .admin-body { grid-template-columns: minmax(0, 1fr); background: var(--ui-bg); }
  .admin-side { position: static; height: auto; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side nav a[href^="/admin/content/"]:first-of-type, .admin-side nav .admin-back { margin-top: 0; border-top: 0; padding-top: 0; }
  .admin-body #main { padding: 22px 16px 48px; }
  .admin-body #main table { display: block; overflow-x: auto; }
}

/* ---- 35. Fixes after the UI work (docs/FIX_TRACKER.md). Each block names its item. ---- */
/* G-8a: the calendar's English PDF and the week's video as resource cards. */
.calendar-page a[data-pdf]:not([hidden]), .calendar-page a[data-video]:not([hidden]) {
  display: inline-flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 18px 10px 12px; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-surface); color: var(--ui-ink);
  font-size: 15px; font-weight: 700; text-decoration: none;
}
.calendar-page a[data-pdf]::before, .calendar-page a[data-video]::before {
  content: ""; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--ui-gold-soft) var(--res-icon) center / 18px no-repeat;
}
.calendar-page a[data-pdf] { --res-icon: url("/assets/icons/download.svg"); }
.calendar-page a[data-video] { --res-icon: url("/assets/icons/play.svg"); }
.calendar-page a[data-pdf]:hover, .calendar-page a[data-video]:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
/* G-11a: today's date above the Verse of the Day heading. */
.daily-hero > [data-daily-date] { margin: 0 0 6px; color: var(--ui-hero-muted); font-size: 14px; font-weight: 600; }
.daily-hero > [data-daily-date]:empty { display: none; }
/* G-13c: the Copy button sits inside the snippet box, in its bottom corner. */
.embed-snippet textarea { padding-bottom: 60px; }
.embed-snippet .card-actions { position: relative; justify-content: flex-end; margin: -58px 10px 0 0; }
[dir="rtl"] .embed-snippet .card-actions { margin: -58px 0 0 10px; }
/* G-18c: a flame beside the streak count, as in the design. */
.progress-streak [data-streak]::before { width: 22px; height: 22px; -webkit-mask-image: url("/assets/icons/flame.svg"); mask-image: url("/assets/icons/flame.svg"); }
/* G-19b: the brand mark in the navigation drawer's title bar, and dividers between its link groups. */
#nav-drawer.is-open > h2:first-child { gap: 10px; }
#nav-drawer.is-open > h2:first-child::before { content: ""; flex: none; width: 28px; height: 28px; background: url("/assets/brand/mark.svg") center / contain no-repeat; }
[data-theme="dark"] #nav-drawer.is-open > h2:first-child::before { filter: brightness(1.8); }
#nav-drawer nav li:has(> a[href$="/duas"]), #nav-drawer nav li:has(> a[href$="/about-us"]) { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ui-line); border-radius: 0; }
/* G-19c: keyboard hints at the foot of the search panel (Enter and Esc are what it supports). */
#search-drawer .search-hints { display: flex; gap: 16px; margin: 0; padding: 12px 20px 14px; border-top: 1px solid var(--ui-line); color: var(--ui-muted); font-size: 12px; }
#search-drawer .search-hints kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--ui-line); border-radius: 6px; background: var(--ui-surface2); color: var(--ui-ink); font: inherit; font-weight: 700; }
@media (hover: none), (max-width: 640px) { #search-drawer .search-hints { display: none; } }
/* G-20e: an icon on each row of the verse ⋯ menu and the pinned verses menu. */
.popover.is-open[role="menu"] > [data-verse-menu]::before, .popover.is-open[role="menu"] > [data-pins-menu]::before {
  content: ""; display: inline-block; flex: none; width: 18px; height: 18px; margin-inline-end: 12px; vertical-align: -4px; background: var(--ui-muted);
  -webkit-mask: var(--mi) center / contain no-repeat; mask: var(--mi) center / contain no-repeat;
}
.popover.is-open[role="menu"] > [data-pins-menu="clear"]::before { background: currentColor; }
[data-verse-menu="pin"] { --mi: url("/assets/icons/bookmarks.svg"); }
[data-verse-menu="advanced-copy"] { --mi: url("/assets/icons/copyopt.svg"); }
[data-verse-menu="wbw"] { --mi: url("/assets/icons/book.svg"); }
[data-verse-menu="repeat"] { --mi: url("/assets/icons/repeat.svg"); }
[data-verse-menu="translations"] { --mi: url("/assets/icons/globe.svg"); }
[data-verse-menu="feedback"] { --mi: url("/assets/icons/info.svg"); }
[data-verse-menu="embed"] { --mi: url("/assets/icons/expand.svg"); }
[data-verse-menu="settings"] { --mi: url("/assets/icons/sliders.svg"); }
[data-pins-menu="save"] { --mi: url("/assets/icons/bookmark.svg"); }
[data-pins-menu="load"] { --mi: url("/assets/icons/bookmarks.svg"); }
[data-pins-menu="note"] { --mi: url("/assets/icons/note.svg"); }
[data-pins-menu="copy"] { --mi: url("/assets/icons/copy.svg"); }
[data-pins-menu="clear"] { --mi: url("/assets/icons/close.svg"); }
/* G-22a: Search beside "Go to the home page" on the 404. */
.error-page p:has(> a + a) { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.error-404 p > a + a { border: 1px solid var(--ui-hero-line); background: transparent; color: var(--ui-hero-ink); }
.error-404 p > a + a:hover { background: rgba(255, 255, 255, 0.08); }
/* G-23c, G-23d, G-23e: admin side bar icons and a "Content" group heading; a top bar with the admin and Back to the site. */
.admin-page { min-width: 0; }
.admin-body #main > section, .admin-body #main > div[id] { overflow-x: auto; }
.admin-top { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 18px 36px 0; }
.admin-top .admin-who { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; color: var(--ui-muted); font-size: 13px; font-weight: 600; }
.admin-avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ui-primary); color: var(--ui-primary-ink); font-size: 14px; font-weight: 800; }
.admin-top .admin-back {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 700; text-decoration: none;
}
.admin-top .admin-back:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
.admin-body #main { padding-top: 12px; }
.admin-side .admin-group { margin: 16px 0 4px; padding: 0 12px; color: #D9B46C; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.admin-side nav a[href^="/admin/content/"]:first-of-type { margin-top: 0; }
.admin-side nav a::before {
  content: ""; flex: none; width: 16px; height: 16px; margin-right: 10px; background: currentColor; opacity: 0.85;
  -webkit-mask: var(--ai, url("/assets/icons/book.svg")) center / contain no-repeat; mask: var(--ai, url("/assets/icons/book.svg")) center / contain no-repeat;
}
.admin-side nav a[href="/admin"] { --ai: url("/assets/icons/target.svg"); }
.admin-side nav a[href="/admin/audit"] { --ai: url("/assets/icons/note.svg"); }
.admin-side nav a[href="/admin/import"] { --ai: url("/assets/icons/download.svg"); }
.admin-side nav a[href="/admin/users"] { --ai: url("/assets/icons/users.svg"); }
.admin-side nav a[href="/admin/feedback"] { --ai: url("/assets/icons/globe.svg"); }
.admin-side nav a[href="/admin/deletion-requests"] { --ai: url("/assets/icons/close.svg"); }
.admin-side nav a[href="/admin/reflections"] { --ai: url("/assets/icons/bell.svg"); }
.admin-side nav a[href="/admin/assets"] { --ai: url("/assets/icons/cd.svg"); }
.admin-side nav a[href="/admin/media"] { --ai: url("/assets/icons/headphones.svg"); }
.admin-side nav a[href="/admin/snapshot"] { --ai: url("/assets/icons/copy.svg"); }
@media (max-width: 900px) {
  .admin-top { padding: 14px 16px 0; justify-content: space-between; }
  .admin-side .admin-group { flex-basis: 100%; margin: 8px 0 2px; }
}
/* Admin tables: long ids and emails may break anywhere so the table fits; a card scrolls sideways only if it still cannot. */
.admin-body #main td { overflow-wrap: anywhere; }
.admin-body #main td:has(> pre) { min-width: 150px; }
/* G-19d: each surah's Arabic name in the surah navigator, on the row's end. */
#navigation-sidebar .nav-surah-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 10px; align-items: center; padding-inline-end: 12px; }
#navigation-sidebar .nav-surah-meaning { font-size: 12px; text-align: end; }
#navigation-sidebar .nav-surah-ar { min-width: 64px; color: var(--ui-ink); font-family: "Amiri", serif; font-size: 17px; line-height: 1.2; text-align: end; }
/* G-19e: surah, juz and page hits show their number in a badge (CSS generated from data-key, so the link text is unchanged). */
:is(.search-page, #search-drawer-body) .search-hit[data-key]::before {
  content: attr(data-key); flex: none; align-self: center; display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; box-sizing: border-box;
  border-radius: 9px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 12px; font-weight: 800;
}
/* G-20d: the word tooltip's lines styled apart: meaning first and strong, transliteration muted. */
#wbw-tooltip:not([hidden]) { display: flex; flex-direction: column; gap: 2px; }
#wbw-tooltip > br { display: none; }
#wbw-tooltip [data-wbw="translation"] { color: var(--ui-ink); font-size: 14px; font-weight: 700; }
#wbw-tooltip [data-wbw="transliteration"] { color: var(--ui-muted); font-size: 12px; font-style: italic; font-weight: 500; }
/* G-20f: the reading bookmark rows as name, then a muted hint. */
#bookmark-popover [data-slots] button:has(.slot-name) { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; }
#bookmark-popover [data-slots] button:has(.slot-name)::before { grid-row: 1 / 3; }
#bookmark-popover .slot-name { font-weight: 700; }
#bookmark-popover .slot-hint { grid-column: 2; color: var(--ui-muted); font-size: 12px; font-weight: 500; }
/* G-17b: each collection tile gets a cover colour band, cycling through the palette. */
.mq-collection-grid button { position: relative; overflow: hidden; padding-top: 30px; }
.mq-collection-grid button::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 8px; background: var(--cover, var(--ui-primary));
}
.mq-collection-grid li:nth-child(5n+2) button { --cover: #9A6B22; }
.mq-collection-grid li:nth-child(5n+3) button { --cover: #1F4E79; }
.mq-collection-grid li:nth-child(5n+4) button { --cover: #6B3A5B; }
.mq-collection-grid li:nth-child(5n+5) button { --cover: #2F7D6D; }
/* G-18a: the week as seven day circles, the day name under each; the state stays in the text for screen readers and in the tooltip. */
.progress-streak [data-week] { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.progress-streak [data-week] li { flex-direction: column; gap: 6px; padding: 4px 0; font-size: 12px; font-weight: 700; text-align: center; }
.progress-streak [data-week] li::before { width: 34px; height: 34px; }
.progress-streak [data-week] li[data-state="read"]::before, .progress-streak [data-week] li[data-state="checked"]::before {
  background: var(--ui-primary); box-shadow: inset 0 0 0 4px var(--ui-surface);
}
.progress-streak .week-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* G-18b: a progress ring beside the goal bar, from the same percent. */
.progress-goal [data-goal] p:has(> progress) { display: flex; align-items: center; gap: 14px; }
.progress-goal [data-goal] p:has(> progress)::before {
  content: ""; flex: none; width: 56px; height: 56px; border-radius: 50%; order: -1;
  background: radial-gradient(closest-side, var(--ui-surface) 72%, transparent 73%), conic-gradient(var(--ui-primary) calc(var(--goal-pct, 0) * 1%), var(--ui-surface2) 0);
}
/* G-16a: a sticky menu of the profile's sections beside the cards (stacks on top on narrow screens). */
.profile-page:has(> .profile-nav) { max-width: 1100px; display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 32px; align-items: start; }
.profile-page > * { grid-column: 2; }
.profile-page > .profile-nav { grid-column: 1; grid-row: 2 / span 12; position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); }
.profile-nav a { display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px; color: var(--ui-ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.profile-nav a:hover { background: var(--ui-surface2); }
.profile-nav a[href="#profile-delete-account"] { color: var(--ui-danger, #B42318); }
.profile-page section[aria-labelledby] { scroll-margin-top: 24px; }
@media (max-width: 860px) {
  .profile-page:has(> .profile-nav) { display: block; max-width: 820px; }
  .profile-page > .profile-nav { position: static; flex-direction: row; flex-wrap: wrap; margin-bottom: 18px; }
}
.profile-page > .profile-head { grid-column: 1 / -1; }
/* G-16b: the user's picture in the header when they have one (the pattern disc stays otherwise). */
.profile-head:has(> .profile-head-photo)::before { display: none; }
.profile-head-photo { flex: none; width: 76px; height: 76px; border-radius: 50%; object-fit: cover; }
/* G-3: the surah or verse a per-verse translations directory opens, above its title. */
.directory-page > .directory-context { margin: 0 0 6px; color: var(--ui-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
/* G-6a: reciter initials in the avatar instead of the headphones badge. */
.reciter-grid li[data-initials]::after {
  content: attr(data-initials); -webkit-mask: none; mask: none; background: none; width: auto; height: auto; top: 48px;
  color: var(--ui-hero-ink); font-size: 22px; font-weight: 800; letter-spacing: 0.02em; line-height: 1;
}
/* G-6b: a Quran Radio card above the reciters. */
.reciters-page .radio-promo {
  display: flex; align-items: center; gap: 16px; box-sizing: border-box; margin-bottom: 20px; padding: 18px 22px; border-radius: 20px; text-decoration: none;
  background: radial-gradient(260px 180px at 100% 0, rgba(31, 160, 122, 0.45), transparent 70%), var(--ui-hero); color: var(--ui-hero-ink);
}
.reciters-page .radio-promo::before {
  content: ""; flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--ui-hero-ink);
  -webkit-mask: url("/assets/icons/headphones.svg") center / 24px no-repeat; mask: url("/assets/icons/headphones.svg") center / 24px no-repeat;
}
.reciters-page .radio-promo-title { flex: none; font-size: 18px; font-weight: 800; }
.reciters-page .radio-promo-text { color: var(--ui-hero-muted); font-size: 14px; }
.reciters-page .radio-promo::after { content: ""; margin-left: auto; flex: none; width: 20px; height: 20px; background: var(--ui-hero-gold); -webkit-mask: url("/assets/icons/arrow.svg") center / contain no-repeat; mask: url("/assets/icons/arrow.svg") center / contain no-repeat; }
.reciters-page .radio-promo:hover { filter: brightness(1.08); }
@media (max-width: 640px) { .reciters-page .radio-promo-text { display: none; } }
/* G-7c: "Day N of M" and a progress bar above the lesson title. */
.lesson-main > .lesson-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; color: var(--ui-muted); font-size: 13px; font-weight: 700; }
.lesson-main > .lesson-progress progress { flex: 1; max-width: 260px; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--ui-surface2); appearance: none; -webkit-appearance: none; }
.lesson-main > .lesson-progress progress::-webkit-progress-bar { background: var(--ui-surface2); }
.lesson-main > .lesson-progress progress::-webkit-progress-value { background: var(--ui-primary); }
.lesson-main > .lesson-progress progress::-moz-progress-bar { background: var(--ui-primary); }
/* G-9b: reading time under the article title, and a contents list built from its sections. */
.article-page .article-meta { margin: 10px 0 0; color: var(--ui-hero-gold); font-size: 13px; font-weight: 700; }
.article-page > .article-toc:not([hidden]) { max-width: 760px; margin: 0 auto 20px; padding: 16px 20px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); }
.article-toc > p { margin: 0 0 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.article-toc ol { margin: 0; padding-left: 20px; }
.article-toc li { margin: 4px 0; }
.article-toc a { color: var(--ui-primary); font-weight: 600; text-decoration: none; }
.article-toc a:hover { text-decoration: underline; }
.daily-card [data-daily-tafsir] { --icon: url("/assets/icons/book.svg"); }
.page-hero .hero-actions > [hidden] { display: none !important; }
/* G-14a: contents of a long static page, from its sections. */
.static-page > .static-toc { max-width: 760px; margin: 0 auto 20px; padding: 16px 20px; box-sizing: border-box; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); }
.static-toc > p { margin: 0 0 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.static-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 24px; }
.static-toc li { margin: 0 0 6px; break-inside: avoid; }
.static-toc a { color: var(--ui-primary); font-weight: 600; text-decoration: none; }
.static-page .static-body h2 { scroll-margin-top: 24px; }
@media (max-width: 640px) { .static-toc ol { columns: 1; } }
/* G-21d: loading skeletons for content boxes the scripts are still filling (aria-busy and empty). */
#main div[aria-busy="true"]:empty {
  min-height: 96px; border-radius: 14px;
  background: linear-gradient(90deg, var(--ui-surface2) 0%, var(--ui-line) 50%, var(--ui-surface2) 100%) 0 0 / 200% 100%;
  animation: qk-skeleton 1.4s ease-in-out infinite;
}
@keyframes qk-skeleton { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #main div[aria-busy="true"]:empty { animation: none; } }
/* G-23b: the admin's dark mode switch (pages/admin.js). */
.admin-top .admin-theme {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.admin-top .admin-theme::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/icons/moon.svg") center / contain no-repeat; mask: url("/assets/icons/moon.svg") center / contain no-repeat; }
.admin-top .admin-theme[aria-pressed="true"]::before { -webkit-mask-image: url("/assets/icons/sun.svg"); mask-image: url("/assets/icons/sun.svg"); }
.admin-top .admin-theme:hover { border-color: var(--ui-primary); color: var(--ui-primary); }
[data-theme="dark"] .admin-body { background: linear-gradient(to right, #0F2E27 260px, var(--ui-bg) 260px); }
[data-theme="dark"] .admin-body #main [role="alert"]:not(:empty) { background: #3A1A17; color: #F2867B; }
/* G-13b: preview the widget at desktop or phone width (CSS only, the snippet is unchanged). */
.embed-preview { position: relative; }
.embed-preview .embed-width { position: absolute; top: 18px; right: 22px; display: flex; gap: 4px; margin: 0; padding: 3px; border: 0; border-radius: 10px; background: var(--ui-surface2); }
.embed-preview .embed-width label { position: relative; padding: 4px 10px; border-radius: 8px; color: var(--ui-muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.embed-preview .embed-width input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.embed-preview .embed-width label:has(input:checked) { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(17, 27, 23, 0.12); }
.embed-preview .embed-width label:has(input:focus-visible) { outline: 2px solid var(--ui-primary); }
.embed-preview:has(input[value="phone"]:checked) iframe { max-width: 375px; margin: 0 auto; }
[dir="rtl"] .embed-preview .embed-width { right: auto; left: 22px; }
/* G-2a: each surah's Arabic name on its card, above the ayah count (CSS from data-arabic; the card's text is unchanged). */
.surah-index-list a[data-arabic]::after {
  content: attr(data-arabic); grid-column: 3; grid-row: 1; align-self: end; justify-self: end;
  color: var(--ui-ink); font-family: "Amiri", serif; font-size: 18px; line-height: 1.2; direction: rtl;
}
.surah-index-list a[data-arabic] .surah-index-description { grid-row: 2; align-self: start; justify-self: end; }
/* G-20b: the character count under the note. */
#note-dialog .note-count { align-self: flex-end; color: var(--ui-muted); font-size: 12px; font-weight: 600; }
/* G-21f: an icon per notification type. */
#notifications-panel [data-notification] { grid-template-columns: 34px minmax(0, 1fr) auto; }
#notifications-panel [data-notification]::before {
  content: ""; grid-column: 1; grid-row: 1 / 3; align-self: start; width: 34px; height: 34px; border-radius: 10px;
  background: var(--ui-gold-soft) var(--ni, url("/assets/icons/bell.svg")) center / 16px no-repeat;
}
#notifications-panel [data-notification] > a, #notifications-panel [data-notification] > p { grid-column: 2; }
#notifications-panel [data-notification-read] { grid-column: 3; }
#notifications-panel [data-type="goal"] { --ni: url("/assets/icons/target.svg"); }
#notifications-panel [data-type="qiay"] { --ni: url("/assets/icons/calendar.svg"); }
#notifications-panel [data-type^="streak"] { --ni: url("/assets/icons/flame.svg"); }
/* G-12b (part): the colour fields as round swatches with the colour filling them. */
.media-page input[type="color"] { width: 40px; height: 40px; padding: 0; border: 2px solid var(--ui-line); border-radius: 50%; background: none; cursor: pointer; vertical-align: middle; }
.media-page input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.media-page input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.media-page input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.media-page input[type="color"]:hover, .media-page input[type="color"]:focus-visible { border-color: var(--ui-primary); outline: none; }

/* ---- 36. Languages: Coming soon, and the admin's Site settings (D-128) ---- */
#languages-menu { max-height: min(70vh, 560px); overflow-y: auto; }
.nav-menu-list .lang-soon { gap: 8px; justify-content: space-between; color: var(--ui-muted); }
.lang-soon-tag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--ui-surface2); color: var(--ui-muted); font-size: 11px; font-weight: 700; }
#coming-soon-dialog { max-width: 420px; }
#coming-soon-dialog h2 { margin-top: 0; }
.admin-body #settings-language-rows input:not([type="checkbox"]) { width: 100%; min-width: 7em; box-sizing: border-box; }
.admin-body #settings-language-rows td, .admin-body #settings-language-rows th { vertical-align: middle; }
.admin-body #settings-switch-rows th, .admin-body #settings-switch-rows small { text-transform: none; letter-spacing: normal; }
.admin-body #settings-switch-rows th label { font-weight: 700; }
.admin-body #settings-switch-rows small { color: var(--ui-muted); font-weight: 400; }
