/* Ҳадислар (the hadith panel, the same design as Khatt al-Quran) — one interface font (the system UI font), the Arabic font only for Arabic text.
   Colours are tokens; a theme is <html data-theme="…">, without one: light/dark like the system. */

/* Scheherazade New (SIL, OFL, fonts/OFL.txt): the Arabic of the hadiths with all its vowel marks */
@font-face { font-family: 'Hadis Arabic'; src: url(fonts/ScheherazadeNew-Regular.woff2?v=4) format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200A, U+2060; }
@font-face { font-family: 'Hadis Arabic'; src: url(fonts/ScheherazadeNew-Bold.woff2?v=1) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200A, U+2060; }

:root {
  --ui-font: -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --ar-font: 'Hadis Arabic', 'Scheherazade New', serif;
  --radius: 14px; --radius-s: 10px;
  /* light (default) */
  color-scheme: light;
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #f1f3f6; --fg: #14181f; --muted: #667085; --line: #e3e7ed;
  --accent: #0f766e; --accent-fg: #ffffff; --accent-soft: #d5f5ef; --hl: #fdf0c4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --fg: #e7e9ee; --muted: #98a2b3; --line: #2a2f3a;
    --accent: #2dd4bf; --accent-fg: #04201c; --accent-soft: #123a35; --hl: #3b3320;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
[data-theme=light] { color-scheme: light; }
[data-theme=dark] { color-scheme: dark;
  --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --fg: #e7e9ee; --muted: #98a2b3; --line: #2a2f3a;
  --accent: #2dd4bf; --accent-fg: #04201c; --accent-soft: #123a35; --hl: #3b3320;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); }
[data-theme=sepia] { color-scheme: light;
  --bg: #f3ead6; --surface: #fbf6ea; --surface-2: #f2e8d2; --fg: #3b2f22; --muted: #7a6a55; --line: #e2d5ba;
  --accent: #8b5e34; --accent-fg: #fffaf0; --accent-soft: #efdcc0; --hl: #f3d99f; }
[data-theme=ocean] { color-scheme: light;
  --bg: #eaf3fb; --surface: #ffffff; --surface-2: #eef5fc; --fg: #0b2540; --muted: #56708a; --line: #d3e2ef;
  --accent: #0369a1; --accent-fg: #ffffff; --accent-soft: #d6ebfa; --hl: #fff1b8; }
[data-theme=forest] { color-scheme: dark;
  --bg: #0c1813; --surface: #12231b; --surface-2: #183025; --fg: #e1efe7; --muted: #92ad9e; --line: #22392d;
  --accent: #4ade80; --accent-fg: #052e16; --accent-soft: #1b3a29; --hl: #3a3a1c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); }
[data-theme=midnight] { color-scheme: dark;
  --bg: #0a0f1e; --surface: #111a31; --surface-2: #17213d; --fg: #e5e9f5; --muted: #8b96b8; --line: #1f2a4d;
  --accent: #fbbf24; --accent-fg: #1f1300; --accent-soft: #2f2a17; --hl: #3a3215;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3); }
[data-theme=rose] { color-scheme: light;
  --bg: #fcf1f3; --surface: #ffffff; --surface-2: #fbeef1; --fg: #3a1520; --muted: #8a5b67; --line: #f1d3db;
  --accent: #be185d; --accent-fg: #ffffff; --accent-soft: #fbdbe7; --hl: #fde6c8; }
[data-theme=lavender] { color-scheme: light;
  --bg: #f4f2fe; --surface: #ffffff; --surface-2: #f1eefd; --fg: #24183f; --muted: #6f6489; --line: #e2dcf8;
  --accent: #6d28d9; --accent-fg: #ffffff; --accent-soft: #e8defd; --hl: #fdf0c4; }
[data-theme=desert] { color-scheme: light;
  --bg: #f8efe3; --surface: #fffaf3; --surface-2: #f6ead9; --fg: #3d2a1a; --muted: #8a705a; --line: #ecd8bf;
  --accent: #c2410c; --accent-fg: #ffffff; --accent-soft: #fbdcc8; --hl: #fbe5b5; }
[data-theme=graphite] { color-scheme: dark;
  --bg: #161618; --surface: #202024; --surface-2: #29292e; --fg: #ececef; --muted: #a1a1aa; --line: #34343b;
  --accent: #f97316; --accent-fg: #1c0d02; --accent-soft: #3a2614; --hl: #3f2d18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3); }
[data-theme=nord] { color-scheme: dark;
  --bg: #2e3440; --surface: #3b4252; --surface-2: #434c5e; --fg: #eceff4; --muted: #b2bacb; --line: #4c566a;
  --accent: #88c0d0; --accent-fg: #1b2230; --accent-soft: #3f5563; --hl: #5a5440;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 24px rgba(0, 0, 0, .2); }
[data-theme=contrast] { color-scheme: dark;
  --bg: #000000; --surface: #000000; --surface-2: #111111; --fg: #ffffff; --muted: #dddddd; --line: #ffffff;
  --accent: #ffd60a; --accent-fg: #000000; --accent-soft: #3a3200; --hl: #5a4b00; --shadow: none; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--ui-font); -webkit-font-smoothing: antialiased; }
input, select, button, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; position: sticky; top: 0; z-index: 3;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 30px; height: 30px; flex: none; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

@media (max-width: 340px) { .topbar { padding-inline: 8px; gap: 2px; } .topbar .icon-btn { width: 32px; } }

/* ---------- controls ---------- */
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--fg); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.wide { width: 100%; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font-weight: 600; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=search], input[type=text], input[type=number], select {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 9px 11px; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; flex: none; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; padding-inline-start: 40px; }
.small-box input { padding-top: 7px; padding-bottom: 7px; }

/* ---------- layout ---------- */
main { --main-pad: 16px; display: grid; grid-auto-flow: row dense; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); grid-template-rows: auto 1fr; align-content: start; gap: 16px; padding: var(--main-pad); max-width: 1200px; margin: 0 auto; }
main > .pin, main > #found { grid-column: 1; }
main > .selection { grid-column: 2; grid-row: span 2; }
/* «Кун ҳадиси»: across both columns above the rest */
main > #day { grid-column: 1 / -1; }
main:has(> #day:not([hidden])) { grid-template-rows: auto auto 1fr; }
/* one column (Word, narrow windows): the search, the surah and the ayah numbers stay under the top bar while the rest scrolls */
body.office main, body.narrow main { --main-pad: 12px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 800px) { main { display: flex; flex-direction: column; } }
.pin { position: sticky; top: var(--topbar-h, 56px); z-index: 2; margin: calc(-1 * var(--main-pad)) calc(-1 * var(--main-pad)) 0; padding: var(--main-pad) var(--main-pad) 8px; background: var(--bg); }
.pin .card { box-shadow: 0 1px 0 var(--line), 0 6px 10px -8px rgb(0 0 0 / .25); }
@media (min-width: 801px) { body:not(.office):not(.narrow) .pin { position: static; margin: 0; padding: 0; background: none; } }
.pin-card { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; }
#found:has(#status:empty):has(#deep-note:empty):has(#results:empty):has(#marks-panel[hidden]):has(#more[hidden]) { display: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); align-self: start; }
.search { display: flex; flex-direction: column; gap: 10px; }
#q { font-size: 16px; padding-top: 11px; padding-bottom: 11px; }
.pick { display: flex; gap: 8px; align-items: center; }
.pick select { flex: 1; }
.range { display: flex; gap: 8px; align-items: center; }
.range-label { font-weight: 600; color: var(--muted); font-size: 13.5px; }
.range input { width: 84px; text-align: center; }
.dash { color: var(--muted); }
#status:empty { display: none; }

/* search results */
#results { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
#results:empty { display: none; }
body.office #results { max-height: 34vh; }
#results li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
#results li:hover { border-color: var(--accent); }
#results li.active { border-color: var(--accent); background: var(--accent-soft); }
#results .ref { font-size: 12.5px; color: var(--muted); font-weight: 600; }
#results .ar { font-family: var(--ar-script, var(--ar-font)); font-size: 21px; direction: rtl; text-align: right; line-height: 1.9;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* search in every language: the fragment of the translation, the source, the progress line */
#results mark { background: var(--hl); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
#results .ar mark { padding: 0 2px; }
#results .hit { font-size: 13px; line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
#results .src { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
#results .src b { font-weight: 600; color: var(--fg); opacity: .8; }
#deep-note { margin: 0; display: flex; align-items: center; gap: 6px; }
#deep-note:empty { display: none; }
#deep-note.busy::before { content: ''; width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid var(--accent-soft);
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #deep-note.busy::before { animation: none; } }
#more { align-self: center; margin: 2px auto 0; display: block; }
#more[hidden] { display: none; }

/* selection */
.sel-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
#sel-title { font-size: 15.5px; }
.arabic { font-family: var(--ar-script, var(--ar-font)); font-size: 27px; line-height: 2.15; text-align: justify; margin: 10px 0; }
#preview-ar { user-select: none; -webkit-user-select: none; }
#preview-ar .w { cursor: pointer; border-radius: 6px; touch-action: none; transition: background .1s; }
#preview-ar .w:hover { background: var(--accent-soft); }
#preview-ar .w.off { opacity: .3; }
#preview-ar .w.start, #preview-ar .w.end, #preview-ar .w.drag { background: var(--hl); }
#preview-ar.dragging .w { opacity: 1; }
#preview-ar .num { color: var(--accent); }
.basmala { text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
@media (max-width: 340px) { .actions .btn:not(.pic-btn) svg { display: none; } }
.actions .btn { flex: 1; min-width: 0; padding-inline: 10px; }
/* copy as a picture: an icon next to Copy */
.actions .btn.pic-btn { flex: none; padding: 9px 10px; }
/* favourite star on the ayah card */
.sel-head .star { margin-inline-start: auto; width: 34px; height: 34px; color: var(--muted); }
.sel-head .star[aria-pressed=true] { color: #e0a100; }
.sel-head .star[aria-pressed=true] svg { fill: currentColor; }
[data-theme=midnight] .sel-head .star[aria-pressed=true], [data-theme=contrast] .sel-head .star[aria-pressed=true] { color: var(--accent); }

/* «Кун ҳадиси» (the hadith of the day, the same for everyone on a day): only the matn, short */
.day { padding: 12px 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 65%); }
.day-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.day-head > svg { color: var(--accent); width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.day-head h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.day-head a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); text-decoration: none; }
.day-head a:hover { color: var(--accent); text-decoration: underline; }
.day-head .icon-btn { width: 30px; height: 30px; margin: -4px -6px -4px 0; color: var(--muted); }
.day-head .icon-btn svg { width: 16px; height: 16px; }
.day-ar { font-family: var(--ar-script, var(--ar-font)); font-size: 23px; line-height: 2; text-align: justify; margin: 6px 0 2px; }
.day-uz { margin: 4px 0; font-size: 13.5px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.day-ar .gap, .day-uz .gap { color: var(--muted); }
.day-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.day-actions .link { margin-inline-end: auto; }
.day-actions .btn { padding: 6px 14px; font-size: 13.5px; }
.day .star { width: 32px; height: 32px; color: var(--muted); }
.day .star[aria-pressed=true] { color: #e0a100; }
.day .star[aria-pressed=true] svg { fill: currentColor; }
[data-theme=midnight] .day .star[aria-pressed=true], [data-theme=contrast] .day .star[aria-pressed=true] { color: var(--accent); }

/* history and favourites: icons in the top bar; the list opens under the search */
.topbar .icon-btn { position: relative; }
.topbar .icon-btn svg { width: 22px; height: 22px; }
.topbar .icon-btn[aria-expanded=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.topbar .icon-btn .n { position: absolute; top: 1px; inset-inline-end: 1px; min-width: 15px; padding: 0 3px; border-radius: 999px; font-size: 10px; line-height: 15px;
  font-weight: 700; text-align: center; background: var(--accent); color: var(--accent-fg); pointer-events: none; }
.topbar .icon-btn .n:empty { display: none; }
#again:disabled { opacity: .4; cursor: default; }
.marks-panel { scroll-margin-top: calc(var(--topbar-h, 56px) + var(--pin-h, 150px) + 8px); }
.marks-panel { margin-top: 8px; }
#marks-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
body.office #marks-list { max-height: 30vh; }
#marks-list:empty { display: none; }
#marks-list li { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
#marks-list li:hover { border-color: var(--accent); }
.mk-go { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; text-align: start; border: 0; background: none; padding: 6px 10px; cursor: pointer; border-radius: var(--radius-s); }
.mk-ref { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mk-time { font-weight: 400; }
.mk-ar { font-family: var(--ar-font); font-size: 18px; line-height: 1.7; direction: rtl; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-del { width: 30px; height: 30px; color: var(--muted); margin-inline-end: 4px; }
.mk-del svg { width: 16px; height: 16px; }
.marks-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 2px 0; }
.marks-foot:has(#marks-empty:empty) { justify-content: flex-end; }


.note { background: var(--hl); padding: 8px 10px; border-radius: var(--radius-s); margin: 8px 0; }
.author { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.author a { color: inherit; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translate(-50%, 8px); background: var(--fg); color: var(--bg);
  padding: 9px 16px; border-radius: 999px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; font-weight: 600; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- dialogs (sheets) ---------- */
dialog.sheet { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--fg); padding: 0;
  width: min(560px, calc(100% - 20px)); max-height: calc(100% - 20px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.sheet::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(2px); }
dialog.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 20px); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 6px 18px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }
.sheet-body { padding: 8px 18px 14px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { padding: 10px 18px 4px; border-top: 1px solid var(--line); }
.sheet-foot .author { margin: 8px 0 6px; }
footer.author .app-version { white-space: nowrap; }
/* Updates window */
#updates h3 { margin: 0 0 6px; font-size: 15px; }
.upd-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.upd-status { flex: 1; margin: 0; min-width: 160px; }
.upd-status.new { font-weight: 600; color: var(--accent); }
.upd-local p { margin: 6px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upd-local a.btn { text-decoration: none; color: inherit; }
.upd-news .rel { border-top: 1px solid var(--line); padding: 8px 0; }
.upd-news .rel:first-child { border-top: 0; padding-top: 0; }
.upd-news .rel b { display: flex; gap: 8px; align-items: baseline; }
.upd-news .ver { background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.upd-news .date { margin-inline-start: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.upd-news ul { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; } .upd-news li { margin: 3px 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 4px 18px 6px; background: var(--surface-2); border-radius: 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 1 auto; border: 0; background: none; color: var(--muted); padding: 7px 9px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tab { display: flex; flex-direction: column; gap: 12px; }
.tab h3 { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13.5px; }
.field > span { color: var(--muted); }
.field select { font-weight: 400; font-size: 15px; }

/* switches */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch bdi, .switch .muted { font-size: 13px; }
/* Insert tab: grouped rows — label, a sample of what is inserted, the switch at the end */
.opt-group { background: var(--surface-2); border-radius: var(--radius); padding: 4px 14px; margin: 0 0 12px; }
.opt-group h3 { margin: 10px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.switch.opt { padding: 10px 0; border-top: 1px solid var(--line); }
.switch.opt:first-of-type { border-top: 0; }
.switch.opt > span:first-child { flex: 1; }
.switch.opt .sample { padding: 1px 8px; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 13px; white-space: nowrap; }
.switch.opt .sample.ar { font-family: 'Hadis Arabic', 'Scheherazade New', serif; font-size: 17px; line-height: 1.3; color: var(--accent); }
.switch.opt.disabled { opacity: .45; pointer-events: none; }

/* translation / tafsir lists */
.checklist { border: 1px solid var(--line); border-radius: var(--radius-s); max-height: 46vh; overflow: auto; padding: 4px; }
.checklist.off { opacity: .55; }
.checklist .grp { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 8px 4px; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist label:has(input:checked) { background: var(--accent-soft); }
.checklist label span:first-of-type { flex: 1; min-width: 0; }
.checklist label .lang { color: var(--muted); font-size: 12px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* fonts tab */
.fontrow { display: flex; gap: 8px; align-items: center; }
.fontrow > span { flex: 0 1 6.2em; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.fontrow input[type=text] { flex: 1; }
.fontrow input[type=number] { width: 4.8em; text-align: center; }

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.theme { border: 2px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer; background: none; text-align: start; font-weight: 600; font-size: 12.5px; }
.theme[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme .sw { display: flex; height: 38px; }
.theme .sw b { flex: 1; }
.theme .sw b:first-child { flex: 2; }
.theme .nm { display: block; padding: 5px 8px; background: var(--surface); color: var(--fg); line-height: 1.25; overflow-wrap: anywhere; }

/* surah info */
.info-body h2, .info-body h3 { font-size: 16px; }

/* ---------- Format tab ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chips button[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.fmt-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.fmt-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fmt-row #f-font { flex: 1 1 140px; } .fmt-row #f-size { width: 5.2em; text-align: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; color: var(--fg); min-width: 38px; height: 36px; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.seg svg { width: 18px; height: 18px; }
.swatch { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; cursor: pointer; flex: none; }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; }
.swatch span.auto { background: conic-gradient(var(--fg) 0 25%, var(--surface) 0 50%, var(--fg) 0 75%, var(--surface) 0) 0 0 / 12px 12px; opacity: .35; }
.line-sel { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-inline-start: auto; }
.fmt-preview { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 8px 12px; max-height: 220px; overflow: auto; }
.fmt-preview p { margin: 4px 0; }
.fmt-preview .arabic { font-size: 22px; margin: 0; }

/* picture background colour (settings → Insert) */
input[type=color].sample { width: 28px; height: 22px; padding: 0; border: 1px solid var(--line, #8884); border-radius: 4px; background: none; cursor: pointer; }

/* 3.11: toast button, translation chips, "More" menu, basket */
#toast .toast-act { margin-inline-start: 12px; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; pointer-events: auto; }
#toast.show:has(.toast-act) { pointer-events: auto; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.tchips[hidden] { display: none; }
.tchip { max-width: 100%; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tchip.off { background: none; border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.tchip.bad { border-color: #c0392b; color: #c0392b; background: color-mix(in srgb, #c0392b 10%, var(--surface)); }
.menu { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); margin: 4px 0 8px; overflow: hidden; }
.menu[hidden] { display: none; }
.menu button { text-align: start; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg); padding: 9px 12px; cursor: pointer; font: inherit; }
.menu button:last-child { border-bottom: 0; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button[hidden] { display: none; }
.sel-head #next, .sel-head #more-btn { width: 34px; height: 34px; }
.sel-head #next svg { transform: scaleX(var(--dir-flip, 1)); }
.sel-head .star { margin-inline-start: 0; }
.sel-head strong { margin-inline-end: auto; }
.bask-acts { display: flex; gap: 8px; margin: 8px 0 0; }
.bask-acts[hidden] { display: none; }
.bask-acts .btn { flex: 1; min-width: 0; }
.actions.col { flex-direction: column; }
.actions.col .btn { flex: none; }
.sel-head { align-items: center; gap: 4px; }

/* «check a quote»: the pasted text, the verdict, the words of the data with the differences marked */
.quote-in { width: 100%; box-sizing: border-box; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: var(--radius-s); padding: 9px 11px; font-family: var(--ar-font); font-size: 20px; line-height: 1.8; resize: vertical; }
.quote-in:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.quote-out { display: flex; flex-direction: column; gap: 8px; }
.quote-out:empty { display: none; }
.quote-out p { margin: 0; }
.quote-out .verdict { font-size: 15px; font-weight: 700; text-align: start; }
.quote-out .verdict.ok { color: var(--accent); }
.quote-out .verdict.warn { color: #b9770e; }
.quote-out .verdict.bad { color: #c0392b; }
.quote-out .verdict.muted { color: var(--muted); font-weight: 600; }
.q-ref { font-weight: 600; font-size: 13.5px; }
.q-text { background: var(--surface-2); border-radius: var(--radius-s); padding: 8px 12px; overflow-wrap: anywhere; }
.q-text.ar { font-family: var(--ar-script, var(--ar-font)); font-size: 23px; line-height: 2.1; text-align: right; }
.q-text.uz { font-size: 15px; line-height: 1.7; }
.q-text del, .q-text ins, .q-text mark, .q-legend bdi { border-radius: 4px; padding: 0 2px; color: inherit; }
.q-bad, .q-extra { text-decoration: line-through; text-decoration-color: #c0392b; background: color-mix(in srgb, #c0392b 14%, transparent); }
.q-ok { text-decoration: none; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.q-miss { text-decoration: underline dashed var(--accent); text-underline-offset: 4px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.q-mark { background: color-mix(in srgb, #d68910 22%, transparent); text-decoration: underline dotted #b9770e; text-underline-offset: 4px; }
.q-skip, .q-ctx { color: var(--muted); }
.q-legend { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); }
.q-legend bdi { color: var(--fg); }
.q-legend .q-skip { color: var(--muted); }
.quote-out .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.q-others { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; border-top: 1px dashed var(--line); padding-top: 8px; }
.q-others .small.muted { flex-basis: 100%; }


/* ---------- the hadith panel ---------- */
.logo .logo-bg { fill: var(--accent); stroke: none; }
.logo .logo-fg { fill: none; stroke: var(--accent-fg); stroke-width: 1.8; }
.logo { width: 30px; height: 30px; }
.pick #num { width: 92px; text-align: center; flex: none; }
.pick select { min-width: 0; }
#theme-btn[aria-pressed=true] { color: var(--accent); }
/* the card: mode (full / only the words of the Prophet ﷺ), the parts, Cyrillic / Latin */
.modebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 2px; }
.modebar .tchips { margin: 0; flex: 1 1 auto; min-width: 0; }
.seg button { padding: 0 10px; font-size: 13px; font-weight: 600; }
.seg.small-seg button { min-width: 0; height: 30px; padding: 0 9px; font-size: 12.5px; }
#mode button { height: 30px; }
.bob { margin: 10px 0 0; padding: 6px 10px; border-inline-start: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: 13px; color: var(--muted); }
.bob b { color: var(--fg); }
.arabic { font-size: 25px; line-height: 2.05; }
#preview-ar:empty, #preview-uz:empty { display: none; }
.uztext { font-size: 15.5px; line-height: 1.65; margin: 6px 0; text-align: justify; }
.uztext p { margin: 0 0 6px; }
#preview-ar, #preview-uz { user-select: none; -webkit-user-select: none; }
.w { cursor: pointer; border-radius: 5px; touch-action: none; transition: background .1s; }
.w:hover { background: var(--accent-soft); }
.w.off { opacity: .3; }
.w.start, .w.drag { background: var(--hl); }
.dragging .w { opacity: 1; }
#preview-ar .w.m { color: var(--accent); }
.gap { color: var(--muted); padding: 0 .3em; }
.tahrij-box { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.tahrij-box:empty { display: none; }
.tahrij-box .tj { font-weight: 600; }
.tahrij-box .tj-ar { font-family: var(--ar-font); font-size: 18px; direction: rtl; text-align: right; }
.tahrij-box .hk { background: var(--surface-2); border-radius: var(--radius-s); padding: 6px 10px; }
.tahrij-box .hk .by { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; display: block; }
.tahrij-box .hk q { quotes: '«' '»'; }
.tahrij-box .hk [dir=rtl] { font-family: var(--ar-font); font-size: 18px; }
.tahrij-box .g2 { border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 6px 10px; }
.tahrij-box .g2 .by { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; display: block; }
.tahrij-box .g2-r { margin-top: 2px; }
.tahrij-box .g2-ar { font-family: var(--ar-font); font-size: 16px; color: var(--muted); }
.tahrij-box .g2-w { color: var(--muted); }
.tahrij-box .label { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.sel-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 6px 0 2px; flex-wrap: wrap; }
.sel-foot:has(#reset-words:not([hidden])) #pick-hint { display: none; }
#sel-title .bk { font-weight: 400; color: var(--muted); font-size: 13px; }
/* the results: the reference, the Arabic, the Uzbek fragment */
#results .ar { font-size: 19px; }
#results .uz { font-size: 13px; line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
#results .ref b { color: var(--fg); }
.info-body { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.info-body dt { color: var(--muted); font-weight: 600; }
.info-body dd { margin: 0; }
.info-body .note2 { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
@media (max-width: 420px) { .modebar { gap: 6px; } .uztext { font-size: 15px; } .arabic { font-size: 23px; } }
.dim { opacity: .38; }
