/* ============================================
   DUAS LIBRARY — additions to the design's .dua-* rules in style.css.
   The design built the cards in script; here they are server-rendered, so the
   category entries are links and a few states (hidden, highlighted) are new.
   ============================================ */

/* Category entries are <a> elements so they still work without script. */
a.dua-cat-btn,
a.dua-cat-btn:hover { text-decoration: none; }
.dua-cat-btn:focus-visible,
.dua-action-btn:focus-visible,
.dua-icon-btn:focus-visible,
.dua-view-btn:focus-visible { outline: 2px solid var(--ip-area); outline-offset: 2px; }

/* A dua filtered out by the search box, the category list or the query string. */
.dua-card.dua-hide { display: none; }

/* Category badge and title are links on the library page. */
a.dua-badge { text-decoration: none; }
a.dua-badge:hover { filter: brightness(0.95); }
.dua-card-title-link { color: inherit; text-decoration: none; }
.dua-card-title-link:hover { color: var(--dua-color, var(--ip-area-strong)); }
a.dua-action-btn { text-decoration: none; }

.dua-hero-highlight { color: #ffdca0; }

/* Random dua / deep link target. */
.dua-card.dua-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ip-area-fill) 40%, transparent); }

/* style.css gives the progress row display:flex, which would defeat the hidden attribute. */
.dua-audio-progress[hidden] { display: none; }
.dua-action-btn.dua-audio-btn.loading { opacity: 0.7; cursor: progress; }

/* Says what the recording actually contains: a whole ayah, of which the dua may be only a part. */
.dua-audio-note {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  margin: 10px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #5b6b66;
}
.dua-audio-note .bi { margin-top: 2px; }
/* A two-ayah dua plays straight through, so the bar is a read-out rather than a scrubber. */
.dua-card[data-has-audio="true"] .dua-audio-time { white-space: nowrap; }

/* Compact view: cards are click-to-expand; the repeat pill and footer stay visible. */
.dua-list.compact-view .dua-card { cursor: pointer; }
/* The note stays even in compact view: wherever the Audio button is offered, it must say what it plays. */
.dua-list.compact-view .dua-audio-note { display: flex; }
.dua-list.compact-view .dua-when { margin-bottom: 10px; }
.dua-list.compact-view .dua-card.expanded .dua-when { display: flex; }
.dua-list.compact-view .dua-card.expanded .dua-note { display: flex; }

/* Detail page: one card, centred. */
.dua-detail-wrap { max-width: 860px; margin: 0 auto; }
.dua-card.dua-card-single:hover { transform: none; }
.dua-card.dua-card-single .dua-card-title { font-size: 1.6rem; }
.dua-card.dua-card-single .dua-arabic { font-size: 1.9rem; line-height: 2.3; }

/* Dark theme for the pieces this file introduces. */
body.dark .dua-card-title-link:hover { color: var(--ip-area-strong); }
body.dark .dua-card.dua-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ip-area) 45%, transparent); }
body.dark .dua-audio-note { color: #9fb3ac; }

@media (max-width: 575.98px) {
  .dua-card.dua-card-single .dua-card-title { font-size: 1.3rem; }
  .dua-card.dua-card-single .dua-arabic { font-size: 1.5rem; }
}

/* =====================================================================
   DUA FINDER (Portal 2.0): natural search, life situations, dua of the day,
   memorise studio, flashcards and the quiz on meanings.
   Tokens are local to these pages; body.dark redefines them for the dark theme.
   ===================================================================== */
:root {
  --dfx-ink: var(--ip-ink);
  --dfx-muted: #5b6b66;
  --dfx-emerald: var(--ip-area-fill);
  --dfx-emerald-deep: var(--ip-area-deep);
  --dfx-mint: var(--ip-area-soft);
  --dfx-gold: #8a6414;
  --dfx-gold-bright: #e6b85c;
  --dfx-gold-soft: #f7eed9;
  --dfx-sand: #fbf8f1;
  --dfx-card: #ffffff;
  --dfx-line: rgba(20, 26, 51, .09);
  --dfx-shadow: 0 1px 2px rgba(20, 26, 51, .05), 0 10px 30px rgba(20, 26, 51, .07);
  --dfx-shadow-lift: 0 2px 4px rgba(20, 26, 51, .06), 0 18px 44px rgba(20, 26, 51, .12);
  --dfx-radius: 20px;
  --dfx-arabic: "Amiri", "Amiri Quran", "Noto Naskh Arabic", serif;
  --dfx-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23e6b85c' stroke-opacity='.16' stroke-width='1.2'%3E%3Cpath d='M48 18l9 21 21 9-21 9-9 21-9-21-21-9 21-9z'/%3E%3Cpath d='M27 27h42v42H27z' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='6'/%3E%3C/g%3E%3C/svg%3E");
}
body.dark {
  --dfx-ink: var(--ip-ink);
  --dfx-muted: #9db1aa;
  --dfx-emerald: var(--ip-area);
  --dfx-emerald-deep: var(--ip-area-deep);
  --dfx-mint: color-mix(in srgb, var(--ip-area) 12%, transparent);
  --dfx-gold: #e6b85c;
  --dfx-gold-soft: rgba(230, 184, 92, .12);
  --dfx-sand: var(--ip-bg);
  --dfx-card: var(--ip-surface);
  --dfx-line: rgba(255, 255, 255, .08);
  --dfx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --dfx-shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .5);
}

.dfx-flip { display: inline-block; }
[dir="rtl"] .dfx-flip { transform: scaleX(-1); }

/* ---------- buttons, pills, chips ---------- */
.dfx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; font-size: .92rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}
.dfx-btn:hover { transform: translateY(-1px); }
.dfx-btn:focus-visible, .dfx-chip:focus-visible, .dfx-situation:focus-visible, .dfx-tool:focus-visible,
.dfx-example:focus-visible, .dfx-link:focus-visible, .dmz-tab:focus-visible, .dmz-level:focus-visible,
.dmz-word:focus-visible, .dmz-rate:focus-visible, .dqz-option:focus-visible, .dfc-card:focus-visible {
  outline: 3px solid var(--dfx-gold-bright); outline-offset: 2px;
}
.dfx-btn-primary { background: linear-gradient(135deg, var(--ip-area-fill), var(--ip-area-fill)); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--ip-area-fill) 25%, transparent); }
.dfx-btn-primary:hover { color: #fff; box-shadow: 0 12px 26px color-mix(in srgb, var(--ip-area-fill) 32%, transparent); }
.dfx-btn-gold { background: linear-gradient(135deg, #e9c46f, #c8962f); color: #2a1d04; box-shadow: 0 8px 20px rgba(184, 137, 43, .28); }
.dfx-btn-gold:hover { color: #2a1d04; }
.dfx-btn-ghost { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; }
.dfx-btn-ghost:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.dfx-btn-soft { background: var(--dfx-mint); color: var(--ip-link); border-color: transparent; }
.dfx-btn-soft:hover { color: var(--dfx-emerald); border-color: var(--dfx-emerald); }
.dfx-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.dfx-pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: #f3e6c4;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(230, 184, 92, .35);
}
.dfx-pill-solid { background: linear-gradient(135deg, #e9c46f, #c8962f); color: #2a1d04; border-color: transparent; }

.dfx-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 999px;
  background: var(--dfx-card); border: 1px solid var(--dfx-line); color: var(--dfx-ink);
  font-size: .85rem; font-weight: 500; text-decoration: none; white-space: nowrap; min-height: 38px;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.dfx-chip:hover { border-color: var(--dfx-emerald); color: var(--dfx-emerald); }
.dfx-chip.is-active { background: var(--dfx-emerald); border-color: var(--dfx-emerald); color: #fff; }
.dfx-chip .bi { color: var(--sit, var(--dfx-emerald)); }
.dfx-chip.is-active .bi { color: inherit; }
.dfx-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.dfx-chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; margin-top: 1.25rem; }
.dfx-link { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--dfx-emerald); text-decoration: none; }
.dfx-link:hover { text-decoration: underline; color: var(--dfx-emerald); }

/* ---------- hero: the finder ---------- */
.dfx-hero.dua-hero {
  padding: 56px 0 64px;
  background: var(--ip-jewel);
}
body.dark .dfx-hero.dua-hero {
  background: var(--ip-jewel);
}
.dfx-hero.dua-hero::before { background: var(--dfx-star) 0 0 / 96px 96px; opacity: .9; }
.dfx-hero.dua-hero::after { display: none; }
.dfx-hero-grid {
  position: relative; z-index: 1; display: grid; gap: 40px; align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
}
.dfx-hero-title { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; margin: 0 0 .75rem; color: #fff; }
.dfx-hero-desc { font-size: 1.02rem; line-height: 1.65; color: rgba(255, 255, 255, .82); max-width: 40rem; margin: 0 0 1.5rem; }

.dfx-finder-form { max-width: 640px; }
.dfx-finder-label { display: block; font-weight: 600; color: #f3e6c4; margin-bottom: .55rem; font-size: .95rem; }
.dfx-finder-field {
  display: flex; align-items: center; gap: .5rem; background: #fff; border-radius: 18px;
  padding-block: 6px; padding-inline: 16px 6px; box-shadow: 0 18px 40px rgba(0, 0, 0, .25), 0 0 0 4px rgba(230, 184, 92, .18);
}
.dfx-finder-field > .bi { color: var(--ip-area-strong); font-size: 1.15rem; }
.dfx-finder-field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1.05rem; color: var(--ip-ink); padding: .7rem .25rem;
}
.dfx-finder-field input::placeholder { color: #6b7a75; }
.dfx-finder-field:focus-within { box-shadow: 0 18px 40px rgba(0, 0, 0, .25), 0 0 0 4px rgba(230, 184, 92, .55); }
.dfx-finder-go {
  border: 0; border-radius: 13px; padding: .75rem 1.25rem; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--ip-area-fill), var(--ip-area-fill)); min-height: 46px;
}
.dfx-finder-go:hover { filter: brightness(1.08); }
.dfx-finder-go:focus-visible { outline: 3px solid #e6b85c; outline-offset: 2px; }
.dfx-finder-examples { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin-top: .85rem; font-size: .85rem; color: rgba(255, 255, 255, .72); }
.dfx-example {
  color: #fff; text-decoration: none; padding: .3rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16); transition: background-color .15s ease;
}
.dfx-example:hover { background: rgba(230, 184, 92, .22); color: #fff; }

.dfx-hero .dua-hero-stats.dfx-hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.75rem; }
.dfx-hero .dua-hero-stat { padding: 10px 16px; border-radius: 14px; min-width: 0; display: flex; align-items: baseline; gap: .5rem; }
.dfx-hero .dua-hero-stat-num { font-size: 1.25rem; margin: 0; }
.dfx-hero .dua-hero-stat-label { font-size: 11px; }

/* Dua of the day */
.dfx-today {
  position: relative; background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  border: 1px solid rgba(230, 184, 92, .38); border-radius: 26px; padding: 26px 26px 22px; color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 30px 60px rgba(0, 0, 0, .25);
}
.dfx-today::before {
  content: ""; position: absolute; inset: 8px; border-radius: 20px; border: 1px dashed rgba(230, 184, 92, .25); pointer-events: none;
}
.dfx-today > * { position: relative; }
.dfx-today-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: .75rem; }
.dfx-today-kicker { display: inline-flex; align-items: center; gap: .4rem; color: #ffdca0; font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.dfx-today-date { font-size: .78rem; color: rgba(255, 255, 255, .6); }
.dfx-today-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 .2rem; color: #fff; }
.dfx-today-when { font-size: .85rem; color: rgba(255, 255, 255, .72); margin: 0 0 .9rem; }
.dfx-today-arabic {
  font-family: var(--dfx-arabic); font-size: 1.75rem; line-height: 2.05; text-align: center; margin: 0 0 .9rem; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.dfx-today-translation { font-size: .95rem; line-height: 1.6; color: rgba(255, 255, 255, .86); font-style: italic; margin: 0 0 .6rem;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.dfx-today-source { font-size: .8rem; color: #ffdca0; margin: 0 0 1rem; display: flex; gap: .4rem; align-items: center; }
.dfx-today-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- life situations band ---------- */
.dfx-band { background: var(--dfx-sand); padding: 48px 0 36px; }
.dfx-band-flush { padding-top: 32px; }
.dfx-band-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.dfx-band-title { font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 800; color: var(--dfx-ink); margin: 0 0 .25rem; letter-spacing: -.01em; }
.dfx-band-lead { color: var(--dfx-muted); margin: 0; max-width: 42rem; }

.dfx-situations { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dfx-situation {
  --sit: var(--ip-area-fill);
  position: relative; display: flex; flex-direction: column; gap: .35rem; padding: 16px; border-radius: 18px;
  background: var(--dfx-card); border: 1px solid var(--dfx-line); text-decoration: none; color: var(--dfx-ink);
  box-shadow: var(--dfx-shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; overflow: hidden;
}
.dfx-situation::after {
  content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%;
  background: var(--sit); opacity: .07; transition: opacity .2s ease, transform .2s ease;
}
.dfx-situation:hover { transform: translateY(-3px); box-shadow: var(--dfx-shadow-lift); border-color: color-mix(in srgb, var(--sit) 45%, transparent); color: var(--dfx-ink); }
.dfx-situation:hover::after { opacity: .14; transform: scale(1.15); }
.dfx-situation-icon {
  width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sit) 13%, transparent); color: var(--sit); font-size: 1.25rem;
}
body.dark .dfx-situation-icon { background: color-mix(in srgb, var(--sit) 22%, transparent); color: color-mix(in srgb, var(--sit) 60%, #fff); }
.dfx-situation-name { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.dfx-situation-count { font-size: .78rem; color: var(--dfx-muted); }
.dfx-situation.is-general .dfx-situation-count { color: var(--dfx-gold); }
.dfx-situation-more { --sit: #b8892b; background: var(--dfx-gold-soft); border-style: dashed; }
.dfx-situations-all { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.dfx-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.dfx-tool {
  display: flex; align-items: center; gap: .85rem; padding: 14px 16px; border-radius: 18px; text-decoration: none;
  background: var(--dfx-card); border: 1px solid var(--dfx-line); color: var(--dfx-ink);
  box-shadow: var(--dfx-shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.dfx-tool:hover { transform: translateY(-2px); box-shadow: var(--dfx-shadow-lift); color: var(--dfx-ink); }
.dfx-tool-icon {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; background: linear-gradient(135deg, var(--ip-area-fill), var(--ip-area-fill));
}
.dfx-tool:nth-child(2) .dfx-tool-icon { background: linear-gradient(135deg, #7c5cd6, #4f39a8); }
.dfx-tool:nth-child(3) .dfx-tool-icon { background: linear-gradient(135deg, #e9c46f, #c8962f); color: #2a1d04; }
.dfx-tool:nth-child(4) .dfx-tool-icon { background: linear-gradient(135deg, #e0627a, #b23a55); }
.dfx-tool-text { display: flex; flex-direction: column; min-width: 0; }
.dfx-tool-text strong { font-size: .95rem; }
.dfx-tool-text small { color: var(--dfx-muted); font-size: .8rem; line-height: 1.35; }

/* Search suggestions and empty state */
.dfx-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--dfx-gold-soft); }
.dfx-suggest-label { font-size: .85rem; font-weight: 600; color: var(--dfx-ink); }
#dfxSuggestLinks { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.dfx-empty-dua { max-width: 30rem; margin-inline: auto; font-style: italic; }

/* ---------- page heroes (situations, flashcards, quiz, saved) ---------- */
.dfx-page-hero {
  --sit: #e6b85c;
  position: relative; color: #fff; padding: 36px 0 40px; overflow: hidden;
  background: var(--ip-jewel);
}
body.dark .dfx-page-hero {
  background: var(--ip-jewel);
}
.dfx-page-hero::before { content: ""; position: absolute; inset: 0; background: var(--dfx-star) 0 0 / 96px 96px; pointer-events: none; }
.dfx-page-hero > .container { position: relative; }
.dfx-page-hero-tight { padding: 28px 0 30px; }
.dfx-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-size: .82rem; color: rgba(255, 255, 255, .72); margin-bottom: 1rem; }
.dfx-crumbs a { color: rgba(255, 255, 255, .88); text-decoration: none; }
.dfx-crumbs a:hover { color: #fff; text-decoration: underline; }
.dfx-crumbs .bi { font-size: .7rem; opacity: .7; }
.dfx-page-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 .4rem; color: #fff; }
.dfx-page-lead { color: rgba(255, 255, 255, .84); max-width: 44rem; margin: 0; line-height: 1.6; }
.dfx-finder-compact { margin-top: 1.25rem; }
.dfx-situation-hero { display: flex; align-items: center; gap: 18px; }
.dfx-situation-hero-icon {
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; background: color-mix(in srgb, var(--sit) 55%, rgba(255, 255, 255, .1));
  border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 14px 30px rgba(0, 0, 0, .2);
}
.dfx-page-hero .dfx-chip { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; }
.dfx-page-hero .dfx-chip:hover { background: rgba(255, 255, 255, .16); }
.dfx-page-hero .dfx-chip .bi { color: #ffdca0; }
.dfx-page-hero .dfx-chip.is-active { background: #fff; color: var(--ip-area-deep); }
.dfx-page-hero .dfx-chip.is-active .bi { color: var(--ip-area-deep); }

.dfx-situation-body { padding-top: 28px; padding-bottom: 56px; max-width: 980px; }
.dfx-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 18px 0 12px; }
.dfx-section-head h2 { font-size: 1.15rem; font-weight: 800; color: var(--dfx-ink); margin: 0; }
.dfx-section-lead { color: var(--dfx-muted); margin: -4px 0 14px; }
.dfx-label-tag { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .3rem .65rem; border-radius: 999px; background: var(--dfx-gold-soft); color: var(--dfx-gold); }
.dfx-cards { display: flex; flex-direction: column; gap: 16px; }
.dfx-callout {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: 18px; margin-bottom: 18px;
  background: var(--dfx-mint); color: var(--dfx-ink); border: 1px solid color-mix(in srgb, var(--dfx-emerald) 25%, transparent);
}
.dfx-callout > .bi { font-size: 1.4rem; color: var(--dfx-emerald); line-height: 1; margin-top: 2px; }
.dfx-callout p { margin: .25rem 0 0; color: var(--dfx-muted); line-height: 1.6; }
.dfx-callout-honest { background: var(--dfx-gold-soft); border-color: color-mix(in srgb, var(--dfx-gold) 35%, transparent); }
.dfx-callout-honest > .bi { color: var(--dfx-gold); }
.dfx-honest { display: flex; gap: .5rem; align-items: flex-start; color: var(--dfx-muted); font-size: .88rem; margin: 18px 0 0; line-height: 1.55; }
.dfx-honest .bi { color: var(--dfx-gold); margin-top: 2px; }
.dfx-honest a, .dmz-note a { color: var(--dfx-emerald); font-weight: 600; }
body.dark .dfc-option .form-select, body.dark .dmz-options .form-select {
  background-color: var(--ip-surface); color: var(--ip-area-strong); border-color: rgba(255, 255, 255, .14);
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cfe3da' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* ---------- dua page ---------- */
.dfx-detail { background: var(--dfx-sand); }
.dfx-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.dfx-detail-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 16px; }
.dfx-today-flag {
  display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 12px; padding: .35rem .8rem; border-radius: 999px;
  background: var(--dfx-gold-soft); color: var(--dfx-gold); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
}
.dfx-panel { background: var(--dfx-card); border: 1px solid var(--dfx-line); border-radius: var(--dfx-radius); padding: 18px; box-shadow: var(--dfx-shadow); }
.dfx-panel-title { font-size: .95rem; font-weight: 800; color: var(--dfx-ink); margin: 0 0 12px; }
.dfx-panel-note { font-size: .8rem; color: var(--dfx-muted); margin: 10px 0 0; }
.dfx-related { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dfx-related a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--dfx-ink); }
.dfx-related a:hover { background: var(--dfx-mint); }
.dfx-related-title { font-weight: 600; font-size: .92rem; }
.dfx-related-when { font-size: .78rem; color: var(--dfx-muted); }

/* Memorise studio */
.dmz {
  margin-top: 22px; background: var(--dfx-card); border: 1px solid var(--dfx-line); border-radius: 24px;
  padding: 24px; box-shadow: var(--dfx-shadow); scroll-margin-top: 90px;
}
.dmz-kicker { display: inline-flex; gap: .4rem; align-items: center; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dfx-gold); }
.dmz-title { font-size: 1.35rem; font-weight: 800; margin: .2rem 0 .3rem; color: var(--dfx-ink); }
.dmz-lead { color: var(--dfx-muted); margin: 0 0 16px; }
.dmz-tabs { display: flex; gap: 6px; padding: 5px; background: var(--dfx-sand); border-radius: 16px; margin-bottom: 18px; overflow-x: auto; }
.dmz-tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0; background: transparent;
  color: var(--dfx-muted); font-weight: 600; font-size: .9rem; padding: .65rem .9rem; border-radius: 12px; cursor: pointer; min-height: 44px;
}
.dmz-tab.is-active { background: var(--dfx-card); color: var(--dfx-emerald); box-shadow: 0 2px 10px rgba(20, 26, 51, .1); }
.dmz-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.dmz-level {
  border: 1px solid var(--dfx-line); background: transparent; color: var(--dfx-ink); border-radius: 999px; padding: .45rem .9rem;
  font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 38px;
}
.dmz-level.is-active { background: var(--dfx-emerald); border-color: var(--dfx-emerald); color: #fff; }
body.dark .dmz-level.is-active { color: #03140b; }
.dmz-words {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .5rem; padding: 22px 18px; margin: 0 0 8px; border-radius: 18px;
  background: linear-gradient(135deg, var(--ip-area-soft), var(--ip-area-soft)); border: 1px solid color-mix(in srgb, var(--ip-area-fill) 10%, transparent);
}
body.dark .dmz-words { background: linear-gradient(135deg, var(--ip-surface), var(--ip-surface)); border-color: color-mix(in srgb, var(--ip-area) 12%, transparent); }
.dmz-word {
  font-family: var(--dfx-arabic); font-size: 1.85rem; line-height: 1.9; color: var(--ip-area-deep); background: transparent; border: 0; padding: 0 .15rem;
  border-radius: 10px; cursor: default; transition: background-color .2s ease, color .2s ease;
}
body.dark .dmz-word { color: var(--ip-area-strong); }
.dmz-word.is-hidden { color: transparent; background: color-mix(in srgb, var(--ip-area-fill) 14%, transparent); cursor: pointer; }
.dmz-word.is-hidden:hover { background: color-mix(in srgb, var(--ip-area-fill) 22%, transparent); }
body.dark .dmz-word.is-hidden { background: color-mix(in srgb, var(--ip-area) 16%, transparent); color: transparent; }
.dmz-word.is-hidden.is-peeked { color: var(--ip-area-deep); background: rgba(230, 184, 92, .22); }
body.dark .dmz-word.is-hidden.is-peeked { color: #f3e6c4; }
.dmz-help { font-size: .82rem; color: var(--dfx-muted); display: flex; gap: .4rem; align-items: center; margin: 0 0 12px; }
.dmz-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 10px; }
.dmz-switch { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--dfx-ink); cursor: pointer; }
.dmz-switch input { width: 18px; height: 18px; accent-color: var(--ip-area-strong); }
.dmz-translit { font-style: italic; color: var(--dfx-muted); margin: 6px 0; }
.dmz-meaning { color: var(--dfx-ink); margin: 6px 0 0; line-height: 1.65; }

.dmz-player { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 18px; background: var(--dfx-sand); }
.dmz-play {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.8rem; color: #fff;
  background: linear-gradient(135deg, var(--ip-area-fill), var(--ip-area-fill)); box-shadow: 0 10px 24px color-mix(in srgb, var(--ip-area-fill) 30%, transparent); display: inline-flex; align-items: center; justify-content: center;
}
.dmz-play:focus-visible { outline: 3px solid #e6b85c; outline-offset: 3px; }
.dmz-player-body { flex: 1; min-width: 0; }
.dmz-player-status { font-weight: 600; color: var(--dfx-ink); margin-bottom: 8px; }
.dmz-progress { height: 6px; border-radius: 99px; background: var(--dfx-line); overflow: hidden; }
.dmz-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ip-area-fill), #e6b85c); transition: width .2s linear; }
.dmz-options { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 6px; }
.dmz-options label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--dfx-muted); min-width: 110px; }
.dmz-note { display: flex; gap: .45rem; align-items: flex-start; font-size: .83rem; color: var(--dfx-muted); margin: 8px 0 0; line-height: 1.5; }
.dmz-note .bi { color: var(--dfx-gold); margin-top: 2px; }
.dmz-empty { text-align: center; padding: 24px; color: var(--dfx-muted); }
.dmz-empty .bi { font-size: 2rem; color: var(--dfx-gold); }

.dmz-rate-q { font-weight: 700; color: var(--dfx-ink); }
.dmz-rates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dmz-rate {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px;
  border: 1px solid var(--dfx-line); background: var(--dfx-card); color: var(--dfx-ink); cursor: pointer; min-height: 64px;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
.dmz-rate strong { font-size: .95rem; }
.dmz-rate small { font-size: .74rem; color: var(--dfx-muted); text-align: center; }
.dmz-rate kbd { position: absolute; top: 6px; inset-inline-end: 8px; font-size: .65rem; background: var(--dfx-sand); color: var(--dfx-muted); border-radius: 5px; padding: 1px 5px; }
.dmz-rate:hover { transform: translateY(-2px); }
.dmz-rate.is-again:hover { border-color: #dc2626; background: rgba(220, 38, 38, .06); }
.dmz-rate.is-hard:hover { border-color: #d97706; background: rgba(217, 119, 6, .07); }
.dmz-rate.is-good:hover { border-color: #16a34a; background: rgba(22, 163, 74, .07); }
.dmz-rate.is-easy:hover { border-color: #2563eb; background: rgba(37, 99, 235, .06); }
.dmz-rate.is-again strong { color: #b91c1c; }
.dmz-rate.is-hard strong { color: #b45309; }
.dmz-rate.is-good strong { color: #15803d; }
.dmz-rate.is-easy strong { color: #1d4ed8; }
body.dark .dmz-rate.is-again strong { color: #f87171; }
body.dark .dmz-rate.is-hard strong { color: #fbbf24; }
body.dark .dmz-rate.is-good strong { color: #4ade80; }
body.dark .dmz-rate.is-easy strong { color: #93c5fd; }
.dmz-result { min-height: 1.4em; margin: 12px 0 0; font-weight: 600; color: var(--dfx-emerald); }

/* ---------- flashcards ---------- */
.dfc-wrap, .dqz-wrap { max-width: 760px; padding-top: 24px; padding-bottom: 56px; }
.dfc-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 14px; }
.dfc-option { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; font-weight: 700; color: var(--dfx-muted); text-transform: uppercase; letter-spacing: .05em; min-width: 150px; flex: 1; }
.dfc-option .form-select { text-transform: none; letter-spacing: 0; font-weight: 500; border-radius: 12px; min-height: 42px; }
.dfc-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dfc-stat { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; background: var(--dfx-card); border: 1px solid var(--dfx-line); color: var(--dfx-muted); font-size: .85rem; }
.dfc-stat .bi { color: var(--dfx-gold); }
.dfc-stat strong { color: var(--dfx-ink); }
.dfc-progress, .dqz-progress { height: 6px; border-radius: 99px; background: var(--dfx-line); overflow: hidden; }
.dfc-progress span, .dqz-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ip-area-fill), #e6b85c); transition: width .35s ease; }
.dfc-counter { font-size: .82rem; color: var(--dfx-muted); margin: 8px 0 12px; text-align: center; }

.dfc-card {
  --dua-color: var(--ip-area-fill);
  position: relative; min-height: 360px; perspective: 1400px; cursor: pointer; border-radius: 26px; outline: none;
}
.dfc-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  padding: 28px 26px; border-radius: 26px; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1); background: var(--dfx-card); border: 1px solid var(--dfx-line); box-shadow: var(--dfx-shadow-lift);
  overflow: auto;
}
.dfc-front {
  background:
    var(--dfx-star) 0 0 / 96px 96px,
    linear-gradient(150deg, color-mix(in srgb, var(--dua-color) 80%, var(--ip-surface)), var(--ip-surface));
  color: #fff; border-color: transparent;
}
.dfc-back { transform: rotateY(180deg); }
.dfc-card.is-flipped .dfc-front { transform: rotateY(-180deg); }
.dfc-card.is-flipped .dfc-back { transform: rotateY(0); }
.dfc-badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: .3rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.dfc-front-title { font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 800; margin: 0; line-height: 1.2; }
.dfc-front-when { color: rgba(255, 255, 255, .84); margin: 0; }
.dfc-prompt { margin: .6rem 0 0; font-size: .9rem; color: rgba(255, 255, 255, .8); }
.dfc-front .dfc-arabic { color: #fff; }
.dfc-back-title { font-weight: 800; color: var(--dfx-ink); margin: 0; }
.dfc-arabic { font-family: var(--dfx-arabic); font-size: clamp(1.5rem, 3.8vw, 2rem); line-height: 2; color: var(--ip-area-deep); margin: 0; }
body.dark .dfc-back .dfc-arabic { color: var(--ip-area-strong); }
.dfc-translit { font-style: italic; color: var(--dfx-muted); margin: 0; }
.dfc-translation { color: var(--dfx-ink); margin: 0; line-height: 1.6; }
.dfc-ref { font-size: .82rem; color: var(--dfx-gold); margin: 0; font-weight: 600; }
.dfc-open { font-size: .82rem; font-weight: 600; color: var(--dfx-emerald); text-decoration: none; }
.dfc-controls { margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dfc-reveal { min-width: 240px; }
.dfc-reveal[hidden] { display: none; }
.dfc-reveal kbd { font-size: .7rem; background: rgba(255, 255, 255, .2); border-radius: 5px; padding: 1px 6px; }
.dfc-rates { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dfc-rates[hidden] { display: none; }
.dfc-done, .dfc-empty { text-align: center; padding: 40px 20px; background: var(--dfx-card); border: 1px solid var(--dfx-line); border-radius: 26px; box-shadow: var(--dfx-shadow); }
.dfc-done[hidden], .dfc-empty[hidden], .dfc-stage[hidden] { display: none; }
.dfc-done h2 { font-weight: 800; color: var(--dfx-ink); font-size: 1.5rem; }
.dfc-done p, .dfc-empty p { color: var(--dfx-muted); }
.dfc-done-icon {
  width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #2a1d04; background: linear-gradient(135deg, #e9c46f, #c8962f); box-shadow: 0 14px 30px rgba(184, 137, 43, .3);
}

/* ---------- quiz ---------- */
.dqz-list { list-style: none; padding: 0; margin: 0; }
.dqz-q[hidden] { display: none; }
.dqz-q fieldset { background: var(--dfx-card); border: 1px solid var(--dfx-line); border-radius: 24px; padding: 24px; box-shadow: var(--dfx-shadow); }
.dqz-ask { font-size: 1rem; font-weight: 700; color: var(--dfx-muted); margin-bottom: 12px; }
.dqz-arabic { font-family: var(--dfx-arabic); font-size: clamp(1.5rem, 3.6vw, 2rem); line-height: 2; text-align: center; color: var(--ip-area-deep); margin: 0 0 10px; }
body.dark .dqz-arabic { color: var(--ip-area-strong); }
.dqz-occasion { display: flex; gap: .5rem; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; color: var(--dfx-ink); text-align: center; margin: 4px 0 14px; }
.dqz-occasion .bi { color: var(--dfx-gold); }
.dqz-hint { margin: 0 0 12px; text-align: center; }
.dqz-hint summary { cursor: pointer; color: var(--dfx-emerald); font-size: .85rem; font-weight: 600; }
.dqz-hint p { font-style: italic; color: var(--dfx-muted); margin: 6px 0 0; }
.dqz-options { display: flex; flex-direction: column; gap: 8px; }
.dqz-option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: start; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--dfx-line); background: var(--dfx-card); color: var(--dfx-ink); cursor: pointer; line-height: 1.5; font-size: .95rem;
  transition: border-color .15s ease, background-color .15s ease;
}
.dqz-option:hover:not([disabled]) { border-color: var(--dfx-emerald); background: var(--dfx-mint); }
.dqz-letter { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--dfx-sand); font-weight: 700; font-size: .8rem; color: var(--dfx-muted); }
.dqz-option.is-correct { border-color: #16a34a; background: rgba(22, 163, 74, .1); }
.dqz-option.is-correct .dqz-letter { background: #16a34a; color: #fff; }
.dqz-option.is-wrong { border-color: #dc2626; background: rgba(220, 38, 38, .08); }
.dqz-option.is-wrong .dqz-letter { background: #dc2626; color: #fff; }
.dqz-option[disabled] { cursor: default; color: var(--dfx-ink); opacity: 1; }
.dqz-feedback { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.dqz-feedback[hidden] { display: none; }
.dqz-verdict { font-weight: 800; margin: 0; flex-basis: 100%; }
.dqz-verdict.is-right { color: #15803d; }
.dqz-verdict.is-wrong { color: #b91c1c; }
body.dark .dqz-verdict.is-right { color: #4ade80; }
body.dark .dqz-verdict.is-wrong { color: #f87171; }
.dqz-source { margin: 0; font-size: .85rem; color: var(--dfx-muted); }
.dqz-source a { color: var(--dfx-emerald); font-weight: 600; }
.dqz-review { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dqz-review a { display: inline-block; padding: .35rem .75rem; border-radius: 999px; background: var(--dfx-gold-soft); color: var(--dfx-ink); text-decoration: none; font-size: .85rem; }

/* ---------- responsive ---------- */
@media (max-width: 1199.98px) {
  .dfx-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .dfx-hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .dfx-detail-grid { grid-template-columns: 1fr; }
  .dfx-detail-aside { position: static; }
}
@media (max-width: 575.98px) {
  .dfx-hero.dua-hero { padding: 32px 0 40px; }
  .dfx-finder-field { padding-inline-start: 12px; }
  .dfx-finder-field input { font-size: 1rem; padding: .6rem .1rem; }
  .dfx-finder-go { padding: .7rem .9rem; }
  .dfx-today { padding: 20px 18px; }
  .dfx-today-arabic { font-size: 1.5rem; }
  .dfx-situations { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dfx-situation { padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 0; align-items: center; }
  .dfx-situation-icon { grid-row: span 2; width: 36px; height: 36px; font-size: 1.05rem; border-radius: 11px; }
  .dfx-situation-name { font-size: .88rem; }
  .dfx-situation-count { font-size: .74rem; }
  .dfx-situations:not(.dfx-situations-all) .dfx-situation:nth-child(n+8):not(.dfx-situation-more) { display: none; }
  .dfx-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dfx-tool { flex-direction: column; align-items: flex-start; gap: .5rem; padding: 12px; }
  .dfx-tool-icon { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 12px; }
  .dmz { padding: 18px 14px; }
  .dmz-tab { font-size: .82rem; padding: .55rem .6rem; }
  .dmz-word { font-size: 1.5rem; }
  .dmz-rates, .dfc-rates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dfc-card { min-height: 400px; }
  .dfx-situation-hero-icon { width: 56px; height: 56px; font-size: 1.5rem; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .dfc-face { transition: none; }
  .dfx-situation, .dfx-tool, .dfx-btn, .dmz-rate { transition: none; }
  .dfx-situation:hover, .dfx-tool:hover, .dfx-btn:hover, .dmz-rate:hover { transform: none; }
}

/* =====================================================================
   The finder (/duas): a sticky bar with instant search and category chips, moment chips, a grid of cards that
   open into a focused view, "show more" paging and a flashcard practice mode. Only transform and opacity animate.
   ===================================================================== */
.dfx-find { background: var(--dfx-sand); padding: 30px 0 34px; }
.dfx-find-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 16px; }
.dfx-find-head .dfx-band-lead { font-size: .95rem; }
.dua-shell.dfx-shell { display: block; max-width: none; margin: 0; padding: 0; }

.dfx-modes { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--dfx-card); border: 1px solid var(--dfx-line); box-shadow: var(--dfx-shadow); }
.dfx-modes[hidden] { display: none; }
.dfx-mode {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .4rem 1rem; border: 0; border-radius: 10px;
  background: transparent; color: var(--dfx-muted); font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.dfx-mode:hover { color: var(--dfx-emerald); }
.dfx-mode.is-active { background: var(--dfx-emerald); color: #fff; box-shadow: 0 8px 18px -10px var(--dfx-emerald); }
body.dark .dfx-mode.is-active { color: #03140b; }
.dfx-mode:focus-visible { outline: 2px solid var(--ip-focus); outline-offset: 2px; }

/* Sticky bar */
.dfx-bar {
  position: sticky; top: calc(var(--ip-header-h) - 6px); z-index: 25;
  display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 10px 14px; align-items: center;
  padding: 10px; margin-bottom: 12px; border: 1px solid var(--dfx-line); border-radius: 18px;
  background: color-mix(in srgb, var(--dfx-card) 92%, transparent); box-shadow: var(--dfx-shadow);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.dfx-bar-search { position: relative; display: flex; align-items: center; margin: 0; }
.dfx-bar-search > .bi { position: absolute; inset-inline-start: 14px; color: var(--dfx-emerald); pointer-events: none; }
.dfx-bar-search input {
  width: 100%; min-height: 44px; padding: .5rem 2.4rem; padding-inline-start: 2.5rem; border: 1px solid var(--dfx-line); border-radius: 12px;
  background: var(--ip-bg-elevated); color: var(--dfx-ink); font-size: .98rem; transition: border-color .2s ease, box-shadow .2s ease;
}
.dfx-bar-search input:focus { outline: none; border-color: var(--dfx-emerald); box-shadow: 0 0 0 4px var(--dfx-mint); }
.dfx-kbd {
  position: absolute; inset-inline-end: 10px; padding: 1px 7px; border: 1px solid var(--dfx-line); border-radius: 6px;
  background: var(--dfx-sand); color: var(--dfx-muted); font-size: .75rem; font-family: var(--ip-font-sans); box-shadow: none;
}
.dfx-bar-search:focus-within .dfx-kbd { opacity: 0; }

.dfx-rail {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
[dir="rtl"] .dfx-rail { -webkit-mask-image: linear-gradient(-90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(-90deg, #000 calc(100% - 28px), transparent); }
.dfx-rail::-webkit-scrollbar { display: none; }
.dfx-rail > *:last-child { margin-inline-end: 24px; }
.dua-cat-list.dfx-rail { display: flex; flex-direction: row; }
.dua-cat-btn.dfx-cat {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: .4rem; width: auto; min-height: 40px; margin: 0;
  padding: .35rem .5rem; padding-inline-start: .75rem; border: 1px solid var(--dfx-line); border-radius: 999px; background: var(--dfx-card); color: var(--dfx-ink);
  font-size: .86rem; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.dua-cat-btn.dfx-cat.d-none { display: none; }
.dfx-cat .dua-cat-icon { margin: 0; font-size: .95rem; color: var(--cat, var(--dfx-emerald)); }
.dfx-cat--saved .dua-cat-icon { color: #d97706; }
.dfx-cat .dua-cat-count {
  min-width: 24px; margin: 0; padding: 1px 7px; border-radius: 999px; background: var(--dfx-sand); color: var(--dfx-muted);
  font-size: .72rem; font-weight: 700; text-align: center;
}
.dua-cat-btn.dfx-cat:hover { border-color: var(--dfx-emerald); color: var(--dfx-emerald); background: var(--dfx-card); }
.dua-cat-btn.dfx-cat.active { background: var(--dfx-emerald); border-color: var(--dfx-emerald); color: #fff; }
.dua-cat-btn.dfx-cat.active .dua-cat-icon { color: #fff; }
.dua-cat-btn.dfx-cat.active .dua-cat-count { background: rgba(0, 0, 0, .22); color: #fff; }
body.dark .dua-cat-btn.dfx-cat.active,
body.dark .dua-cat-btn.dfx-cat.active .dua-cat-icon,
body.dark .dua-cat-btn.dfx-cat.active .dua-cat-count { color: #03140b; }
.dua-cat-btn.dfx-cat:focus-visible { outline: 2px solid var(--ip-focus); outline-offset: 2px; }

/* Moments */
.dfx-moments { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.dfx-moments-label { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dfx-gold); }
html[lang="ar"] .dfx-moments-label, html[lang="ur"] .dfx-moments-label { letter-spacing: 0; font-size: .9rem; }
.dfx-moment {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: .4rem; min-height: 36px; padding: .3rem .75rem; border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--sit, var(--dfx-emerald)) 45%, transparent); background: color-mix(in srgb, var(--sit, var(--dfx-emerald)) 7%, var(--dfx-card));
  color: var(--dfx-ink); font-size: .84rem; font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: transform .2s var(--ip-spring), background-color .2s ease, color .2s ease;
}
.dfx-moment .bi { color: var(--sit, var(--dfx-emerald)); }
.dfx-moment small { padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--sit, var(--dfx-emerald)) 14%, transparent); color: var(--dfx-muted); font-size: .7rem; font-weight: 700; }
.dfx-moment:hover { transform: translateY(-2px); color: var(--dfx-ink); }
.dfx-moment.is-active { border-style: solid; border-color: var(--sit); background: var(--sit); color: #fff; }
.dfx-moment.is-active .bi, .dfx-moment.is-active small { color: #fff; }
.dfx-moment.is-active small { background: rgba(255, 255, 255, .25); }
body.dark .dfx-moment .bi { color: color-mix(in srgb, var(--sit) 55%, #fff); }
.dfx-moment--all { border-style: solid; border-color: var(--dfx-line); background: var(--dfx-gold-soft); }
.dfx-moment--all .bi { color: var(--dfx-gold); }

/* Results line */
.dfx-results { margin-bottom: 14px; }
.dfx-results-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.dfx-results-title { font-weight: 800; font-size: 1.02rem; color: var(--dfx-ink); }
.dfx-results-count { color: var(--dfx-muted); font-size: .88rem; }
.dfx-clear-moment {
  display: inline-flex; align-items: center; gap: .3rem; margin-inline-start: 6px; padding: .15rem .35rem; padding-inline-start: .65rem; border: 0; border-radius: 999px;
  background: var(--dfx-mint); color: var(--dfx-emerald); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.dfx-clear-moment[hidden] { display: none; }
.dfx-views { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--dfx-line); border-radius: 12px; background: var(--dfx-card); }
.dfx-views.d-none { display: none; }
.dfx-views .dua-view-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 34px; padding: .25rem .7rem; border: 0; border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--dfx-muted); background: transparent; }
.dfx-views .dua-view-btn.active { background: var(--dfx-mint); color: var(--dfx-emerald); }

/* The card grid */
.dua-card.dfx-page-hide { display: none; }
.dua-list.dfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.dfx-grid .dua-card:not(.is-focused) {
  display: flex; flex-direction: column; padding: 16px 18px 14px; border-start-start-radius: 0; border-start-end-radius: 18px; border-end-end-radius: 18px; border-end-start-radius: 0; border-inline-start-width: 4px;
  cursor: pointer; box-shadow: var(--dfx-shadow);
  transition: transform .25s var(--ip-ease), box-shadow .25s var(--ip-ease), border-color .25s var(--ip-ease);
}
[dir="rtl"] .dfx-grid .dua-card:not(.is-focused) { border-radius: 18px 0 0 18px; }
.dfx-grid .dua-card:not(.is-focused):hover { transform: translateY(-4px); box-shadow: var(--dfx-shadow-lift); }
.dfx-grid .dua-card:not(.is-focused) :is(.dua-latin-block, .dua-note, .dua-card-footer, .dua-audio-note, .dua-audio-progress, .dua-repeat, .dua-latin-label) { display: none; }
.dfx-grid .dua-card:not(.is-focused) .dua-card-top { margin-bottom: 8px; }
.dfx-grid .dua-card:not(.is-focused) .dua-card-title { font-size: 1.02rem; line-height: 1.35; }
.dfx-grid .dua-card:not(.is-focused) .dua-when { margin-bottom: 10px; }
.dfx-grid .dua-card:not(.is-focused) .dua-arabic-block { padding: 10px 14px 8px; margin-bottom: 10px; }
.dfx-grid .dua-card:not(.is-focused) .dua-arabic {
  font-size: 1.28rem; line-height: 1.95; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dfx-grid .dua-card:not(.is-focused) .dua-trans-block { margin: auto 0 0; }
.dfx-grid .dua-card:not(.is-focused) .dua-translation {
  font-size: .86rem; line-height: 1.55; color: var(--dfx-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dfx-more-wrap { display: flex; justify-content: center; margin-top: 18px; }
.dfx-more[hidden] { display: none; }
.dfx-empty { margin-top: 10px; padding: 40px 20px; border: 1px dashed var(--dfx-line); border-radius: var(--dfx-radius); background: var(--dfx-card); }
.dfx-empty p { color: var(--dfx-muted); margin: .35rem auto 0; max-width: 32rem; }
.dfx-empty-title { font-size: 1.15rem; font-weight: 800; color: var(--dfx-ink); margin: 14px 0 0; }
.dfx-empty .dfx-btn { margin-top: 14px; }

/* The focused view */
.dfx-placeholder { border-radius: 18px; border: 2px dashed var(--dfx-line); }
.dfx-focus { position: fixed; inset: 0; z-index: 1060; }
.dfx-focus[hidden] { display: none; }
.dfx-focus-backdrop { position: absolute; inset: 0; background: rgba(4, 18, 12, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: dfx-fade .25s ease both; }
html.dfx-locked { overflow: hidden; }
.dua-card.is-focused {
  position: fixed; z-index: 1062; inset: 72px max(12px, calc(50vw - 400px)) auto; max-height: calc(100dvh - 160px); overflow-y: auto;
  border-radius: 22px; border-inline-start-width: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); overscroll-behavior: contain;
  animation: dfx-pop .32s var(--ip-ease) both; transform: none;
}
.dua-card.is-focused:hover { transform: none; }
.dua-card.is-focused:focus { outline: none; }
.dua-card.is-focused .dua-card-title { font-size: 1.4rem; }
.dua-card.is-focused .dua-arabic { font-size: 1.9rem; line-height: 2.2; }
.dfx-focus-nav {
  position: fixed; z-index: 1063; inset-inline: 0; bottom: 18px; display: flex; justify-content: center; align-items: center; gap: 6px;
  width: max-content; margin-inline: auto; padding: 6px; border-radius: 999px; background: rgba(13, 59, 41, .92); box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  animation: dfx-rise .3s var(--ip-ease) both;
}
.dfx-focus-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.1rem; cursor: pointer; transition: background-color .2s ease; }
.dfx-focus-btn:hover { background: rgba(255, 255, 255, .22); }
.dfx-focus-btn:focus-visible { outline: 2px solid #e6b85c; outline-offset: 2px; }
.dfx-focus-close { background: #e6b85c; color: #2a1d04; }
.dfx-focus-close:hover { background: #f1cf85; }
.dfx-focus-pos { min-width: 64px; padding: 0 6px; text-align: center; color: rgba(255, 255, 255, .85); font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes dfx-pop { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes dfx-fade { from { opacity: 0; } }
@keyframes dfx-rise { from { opacity: 0; transform: translateY(16px); } }

/* Practise */
.dfx-practice { padding: 20px; border: 1px solid var(--dfx-line); border-radius: 24px; background: var(--dfx-card); box-shadow: var(--dfx-shadow); }
.dfx-practice[hidden], .dfx-browse[hidden] { display: none; }
.dfx-practice-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.dfx-practice-title { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--dfx-ink); }
.dfx-practice-lead { margin: .25rem 0 0; color: var(--dfx-muted); font-size: .9rem; max-width: 42rem; }
.dfx-practice-count { padding: .3rem .8rem; border-radius: 999px; background: var(--dfx-mint); color: var(--dfx-emerald); font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums; }
.dfx-practice-count:empty { display: none; }
.dfx-practice-bar { height: 6px; margin-bottom: 18px; border-radius: 99px; background: var(--dfx-line); overflow: hidden; }
.dfx-practice-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--dfx-emerald), #e6b85c); transform: scaleX(0); transform-origin: left center; transition: transform .4s var(--ip-ease); }
[dir="rtl"] .dfx-practice-bar span { transform-origin: right center; }
.dfx-deck { display: flex; justify-content: center; perspective: 1400px; }
.dfx-deck[hidden] { display: none; }
.dfx-flash { width: min(100%, 680px); padding: 0; border: 0; background: none; color: inherit; text-align: center; cursor: pointer; border-radius: 24px; }
.dfx-flash:focus-visible { outline: 3px solid var(--ip-focus); outline-offset: 4px; }
.dfx-flash-inner { display: grid; transform-style: preserve-3d; transition: transform .6s var(--ip-ease); }
.dfx-flash.is-flipped .dfx-flash-inner { transform: rotateY(180deg); }
.dfx-flash-face {
  grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 300px; padding: 28px 24px;
  border-radius: 24px; -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.dfx-flash-front {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(500px 200px at 85% -10%, rgba(230, 184, 92, .3), transparent 60%), linear-gradient(150deg, #0b3324, #10503a 60%, #1a6b55);
  box-shadow: 0 24px 50px -28px rgba(13, 59, 41, .9);
}
.dfx-flash-front::before { content: ""; position: absolute; inset: 0; background: var(--dfx-star) 0 0 / 96px 96px; opacity: .8; pointer-events: none; }
.dfx-flash-front > * { position: relative; }
.dfx-flash-back { transform: rotateY(180deg); background: var(--dfx-sand); border: 1px solid var(--dfx-line); box-shadow: var(--dfx-shadow); }
.dfx-flash-kicker { padding: .25rem .75rem; border-radius: 999px; background: rgba(230, 184, 92, .2); color: #ffdca0; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.dfx-flash-title { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); font-weight: 800; line-height: 1.25; }
.dfx-flash-when { color: rgba(255, 255, 255, .78); font-size: .95rem; }
.dfx-flash-prompt { display: inline-flex; align-items: center; gap: .4rem; margin-top: 10px; color: #ffdca0; font-size: .85rem; font-weight: 600; }
.dfx-flash-arabic { font-family: var(--dfx-arabic); font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem); line-height: 2; color: var(--ip-area-deep); }
body.dark .dfx-flash-arabic { color: var(--ip-area-strong); }
.dfx-flash-latin { font-style: italic; color: var(--dfx-muted); font-size: .92rem; }
.dfx-flash-meaning { color: var(--dfx-ink); font-size: .98rem; line-height: 1.6; }
.dfx-flash-source { color: var(--dfx-gold); font-size: .8rem; font-weight: 600; }
.dfx-flash [hidden] { display: none; }
.dfx-practice-actions { display: flex; justify-content: center; margin-top: 16px; min-height: 52px; }
.dfx-practice-actions .dfx-btn[hidden] { display: none; }
.dfx-rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(100%, 520px); }
.dfx-rates[hidden] { display: none; }
.dfx-rate {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 50px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; cursor: pointer; transition: transform .15s var(--ip-spring), filter .15s ease;
}
.dfx-rate:hover { transform: translateY(-2px); }
.dfx-rate:active { transform: scale(.97); }
.dfx-rate:focus-visible { outline: 3px solid var(--ip-focus); outline-offset: 2px; }
.dfx-rate--again { background: var(--ip-tile-rose-bg); color: var(--ip-tile-rose-fg); border-color: color-mix(in srgb, var(--ip-tile-rose-fg) 25%, transparent); }
.dfx-rate--good { background: var(--dfx-emerald); color: #fff; }
body.dark .dfx-rate--good { color: #03140b; }
.dfx-rate--easy { background: var(--ip-tile-gold-bg); color: var(--ip-tile-gold-fg); border-color: color-mix(in srgb, var(--ip-tile-gold-fg) 25%, transparent); }
.dfx-practice-done { display: grid; justify-items: center; gap: 6px; padding: 24px 12px; text-align: center; }
.dfx-practice-done[hidden] { display: none; }
.dfx-practice-done h3 { margin: 6px 0 0; font-size: 1.3rem; font-weight: 800; color: var(--dfx-ink); }
.dfx-practice-done p { margin: 0; color: var(--dfx-muted); }
.dfx-done-burst { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--dfx-mint); color: var(--dfx-emerald); font-size: 2.4rem; animation: dfx-burst .6s var(--ip-spring) both; }
@keyframes dfx-burst { from { opacity: 0; transform: scale(.4) rotate(-20deg); } }
.dfx-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.dfx-practice-note { display: flex; justify-content: center; gap: .4rem; margin: 14px 0 0; color: var(--dfx-muted); font-size: .8rem; text-align: center; }

/* Sources and what next */
.dfx-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 18px; }
.dfx-sources-label { display: inline-flex; align-items: center; gap: .35rem; margin-inline-end: 4px; font-weight: 800; font-size: .82rem; color: var(--dfx-ink); }
.dfx-sources-label .bi { color: var(--dfx-emerald); }
.dfx-source { padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--dfx-line); background: var(--dfx-card); color: var(--dfx-muted); font-size: .8rem; text-decoration: none; }
a.dfx-source:hover { color: var(--dfx-emerald); border-color: var(--dfx-emerald); }
.dfx-next { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.dfx-next-link {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--dfx-line); border-radius: 16px; background: var(--dfx-card);
  color: var(--dfx-ink); text-decoration: none; transition: transform .2s var(--ip-ease), box-shadow .2s var(--ip-ease);
}
.dfx-next-link > .bi { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: var(--dfx-mint); color: var(--dfx-emerald); font-size: 1.15rem; }
.dfx-next-link span { display: flex; flex-direction: column; min-width: 0; }
.dfx-next-link strong { font-size: .95rem; }
.dfx-next-link small { color: var(--dfx-muted); font-size: .8rem; }
.dfx-next-link:hover { transform: translateY(-2px); box-shadow: var(--dfx-shadow-lift); color: var(--dfx-ink); }

@media (max-width: 991.98px) {
  .dfx-bar { grid-template-columns: minmax(0, 1fr); }
  .dfx-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
  .dfx-find { padding-top: 22px; }
  .dfx-find-head { align-items: stretch; }
  .dfx-modes { width: 100%; }
  .dfx-mode { flex: 1; justify-content: center; }
  .dfx-bar { top: calc(var(--ip-header-h) - 14px); margin-inline: -4px; padding: 8px; border-radius: 16px; }
  .dfx-kbd { display: none; }
  .dfx-moments { flex-direction: column; align-items: stretch; gap: 6px; }
  .dfx-views .dua-view-btn span { display: none; }
  .dua-list.dfx-grid { gap: 10px; }
  .dfx-grid .dua-card:not(.is-focused) { padding: 14px 14px 12px; }
  .dua-card.is-focused { inset: 12px 8px auto; max-height: calc(100dvh - 96px); padding: 18px 16px; border-radius: 18px; }
  .dua-card.is-focused .dua-arabic { font-size: 1.55rem; }
  .dfx-focus-nav { bottom: 12px; }
  .dfx-flash-face { min-height: 260px; padding: 22px 16px; }
  .dfx-practice { padding: 14px; border-radius: 18px; }
  .dfx-next { grid-template-columns: minmax(0, 1fr); }
  .dfx-tools { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .dfx-flash-inner, .dfx-practice-bar span, .dfx-grid .dua-card, .dfx-moment, .dfx-rate, .dfx-next-link { transition: none; }
  .dua-card.is-focused, .dfx-focus-backdrop, .dfx-focus-nav, .dfx-done-burst { animation: none; }
}
/* Hidden cards stay hidden in the grid (these come after the grid's display rule on purpose). */
.dfx-grid .dua-card.dua-hide,
.dfx-grid .dua-card.dfx-page-hide,
.dua-list .dua-card.dfx-page-hide { display: none; }
@media (max-width: 575.98px) {
  .dfx-grid .dua-card:not(.is-focused) .dua-arabic { -webkit-line-clamp: 1; font-size: 1.15rem; line-height: 1.9; }
  .dfx-grid .dua-card:not(.is-focused) .dua-arabic-block { padding: 6px 12px; margin-bottom: 8px; }
  .dfx-grid .dua-card:not(.is-focused) .dua-translation { -webkit-line-clamp: 1; }
  .dfx-grid .dua-card:not(.is-focused) .dua-card-top { margin-bottom: 4px; }
  .dfx-grid .dua-card:not(.is-focused) .dua-when { margin-bottom: 8px; }
}
/* The legacy dark theme restyles every category button; the finder's chips keep their own look. */
body.dark .dua-cat-btn.dfx-cat { background: var(--ip-surface); color: var(--ip-ink-2); }
body.dark .dua-cat-btn.dfx-cat:hover { background: var(--ip-surface-2); color: var(--ip-area-strong); }
body.dark .dua-cat-btn.dfx-cat.active { background: var(--ip-area); border-color: var(--ip-area); color: #03140b; }
body.dark .dua-cat-btn.dfx-cat.active .dua-cat-count { background: rgba(3, 20, 11, .2); color: #03140b; }
body.dark .dfx-cat .dua-cat-icon { color: color-mix(in srgb, var(--cat, var(--ip-area)) 55%, #fff); }
body.dark .dfx-cat--saved .dua-cat-icon { color: #f0b54a; }
body.dark .dfx-cat .dua-cat-count { background: var(--ip-surface-2); }
