/* Fonts, all served by this site (they work offline and need no requests elsewhere).
   Inter for text, Lexend for headings, the King Fahd Complex Uthmanic Hafs font for the Qur'an;
   the others load only when chosen (fonts/opt/). */
@font-face { font-family: "Inter"; src: url(/fonts/inter-latin.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-latin-ext.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lexend"; src: url(/fonts/lexend-latin.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lexend"; src: url(/fonts/lexend-latin-ext.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Uthmanic Hafs"; src: url(/fonts/uthmanic-hafs.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0020-002F, U+0600-060B, U+060D-061A, U+061C-061E, U+0620-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Amiri Quran"; src: url(/fonts/opt/amiri-quran-arabic.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Scheherazade New"; src: url(/fonts/opt/scheherazade-400-arabic.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Scheherazade New"; src: url(/fonts/opt/scheherazade-700-arabic.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; src: url(/fonts/opt/amiri-400-arabic.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; src: url(/fonts/opt/amiri-400-latin.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Amiri"; src: url(/fonts/opt/amiri-700-arabic.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; src: url(/fonts/opt/amiri-700-latin.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "El Messiri"; src: url(/fonts/opt/elmessiri-latin.woff2) format("woff2"); font-weight: 500 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "El Messiri"; src: url(/fonts/opt/elmessiri-arabic.woff2) format("woff2"); font-weight: 500 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/fonts/opt/atkinson-400.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/fonts/opt/atkinson-700.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manjari"; src: url(/fonts/manjari-ml-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manjari"; src: url(/fonts/manjari-ml-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f7f5ef; --card: #ffffff; --ink: #1f2a24; --muted: #5b6b62; --line: #e3ded2;
  --green: #1f6b4f; --green-ink: #ffffff; --soft: #e8f1ec; --gold: #a07a22; --bad: #a33a2b; --mark: #fff1b8;
  --fs: 17px; --ar: 1.9em; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --head: "Lexend", "Inter", system-ui, sans-serif; --qfont: "Uthmanic Hafs";
  /* tajweed: green = nasal sound (ghunnah), blue = qalqalah, reds and orange = madd by length, grey = not pronounced */
  --tj-grey: #9a9a9a; --tj-green: #12924a; --tj-blue: #0a72c2;
  --tj-madd6: #a3001b; --tj-madd45: #df1f1a; --tj-madd246: #ee7a10; --tj-madd2: #c19300;
  color-scheme: light;
}
.dark {
  --bg: #101614; --card: #18211d; --ink: #e8eee9; --muted: #9fb0a6; --line: #2a3530;
  --green: #5fbf94; --green-ink: #0d1a14; --soft: #1e2d26; --gold: #d8b45a; --bad: #ff8a78; --mark: #4a4220;
  --tj-grey: #8e98a8; --tj-green: #4fd68c; --tj-blue: #5ab4ff;
  --tj-madd6: #ff4d6d; --tj-madd45: #ff7b54; --tj-madd246: #ffab4d; --tj-madd2: #e9c46a;
  color-scheme: dark;
}
/* Muṣḥaf look: cream paper, green and gold, printed-book lettering */
[data-look="mushaf"] { --bg: #f6efdc; --card: #fffaf0; --line: #d9c9a0; --ink: #2a2418; --muted: #6b5d43; --soft: #efe6cc; --font: "Amiri", Georgia, serif; }
[data-look="mushaf"].dark { --bg: #14110b; --card: #1d1912; --line: #3d3424; --ink: #efe6cc; --muted: #b3a37f; --soft: #2a2418; }
[data-look="mushaf"] .card { border: 1px solid var(--line); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px var(--line); }
[data-look="mushaf"] .top { border-bottom: 3px double var(--gold); }
[data-look="mushaf"] .surah-head { border: 2px solid var(--gold); border-radius: 10px; background: var(--card); padding: 1rem; outline: 1px solid var(--gold); outline-offset: 4px; margin: 6px 6px 1rem; }
[data-look="mushaf"] h1, [data-look="mushaf"] h2 { font-family: "Amiri", Georgia, serif; }
/* high contrast */
.contrast { --ink: #000; --muted: #222; --line: #000; --bg: #fff; --card: #fff; --green: #004d2e; --soft: #e6f2ec; }
.contrast.dark { --ink: #fff; --muted: #eee; --line: #fff; --bg: #000; --card: #000; --green: #7dffc0; --green-ink: #000; --soft: #102018; }
.contrast .card, .contrast .btn { border-width: 2px; }
.easy { --font: "Atkinson Hyperlegible", "Inter", system-ui, sans-serif; }
.ui-ml { --font: "Manjari", system-ui, sans-serif; }

[data-size="s"] { --fs: 15px; --ar: 1.6em; }
[data-size="l"] { --fs: 19px; --ar: 2.2em; }
[data-size="xl"] { --fs: 22px; --ar: 2.6em; }

* { box-sizing: border-box; }
html { font-size: var(--fs); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.6 var(--font); }
body.noscroll { overflow: hidden; }
body.has-player { padding-bottom: 7.5rem; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.3; }
.ar { font-family: var(--qfont), "Uthmanic Hafs", "Amiri Quran", "Traditional Arabic", serif; }
[data-arfont="amiri"] { --qfont: "Amiri Quran"; }
[data-arfont="scheherazade"] { --qfont: "Scheherazade New"; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.15rem; }
.center { text-align: center; justify-content: center; }
.pad { padding: 2rem 0; }
.grow { flex: 1; min-width: 0; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 50; background: var(--card); padding: .5rem 1rem; }
mark { background: var(--mark); color: inherit; }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 .35em; background: var(--card); font-family: inherit; }

/* top bar (the tab bar moves to the bottom on phones, see below) */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .35rem; padding: .45rem .75rem; background: var(--green); color: var(--green-ink); }
.brand { color: inherit; text-decoration: none; font-weight: 600; font-size: 1.2rem; white-space: nowrap; margin-right: .5rem; }
.icon-btn { color: inherit; background: none; border: 0; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; cursor: pointer; position: relative; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.16); }
.acct.on-user::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 9px; height: 9px; border-radius: 50%; background: #ffd75e; border: 2px solid var(--green); }
.tabbar { display: flex; flex: 1; justify-content: center; gap: .2rem; }
.tabbar a { display: inline-flex; align-items: center; gap: .4rem; color: inherit; text-decoration: none; padding: .45rem .8rem; border-radius: 99px; font: 500 .95rem/1 var(--head); white-space: nowrap; opacity: .9; }
.tabbar a .ic { width: 20px; height: 20px; }
.tabbar a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.tabbar a.on { background: rgba(255,255,255,.22); opacity: 1; }
.dark .tabbar a.on, .dark .tabbar a:hover { background: rgba(0,0,0,.2); }
main { max-width: 780px; margin: 0 auto; padding: 1rem; outline: none; }
.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 2rem 1rem; max-width: 780px; margin: auto; }

/* cards & buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.card.error { border-color: var(--bad); }
.btn { font: inherit; font-size: .95rem; cursor: pointer; border-radius: 8px; padding: .45rem .9rem; border: 1px solid var(--green); background: var(--soft); color: var(--ink); text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--green); color: var(--green-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: .25rem .65rem; font-size: .85rem; }
.btn.on { color: var(--gold); border-color: var(--gold); }
.btn.warn { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; width: 100%; }
button.src.linkish { display: inline; color: var(--green); width: auto; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .w:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.toggle { display: inline-flex; gap: .45rem; align-items: center; cursor: pointer; margin: .2rem 1rem .2rem 0; }
.toggle input { width: 1.15rem; height: 1.15rem; accent-color: var(--green); flex: none; }
.toggle.big { font-size: 1.1rem; font-weight: 600; }
.pill { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 99px; background: var(--soft); color: var(--green); }
.src { font-size: .8rem; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 0 .4em; text-decoration: none; }
a.src { color: var(--green); }
.note { background: var(--card); border: 1px solid var(--line); padding: .75rem 1rem; border-radius: 10px; }
.note.ok, .formmsg.ok { color: var(--green); }
.note.bad, .formmsg.bad { color: var(--bad); }
.bar { height: .5rem; background: var(--soft); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.bar.big { height: .9rem; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* home */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.hello h1 { margin: 0; font-size: 1.5rem; }
.hello p { margin: 0; }
.streak { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--gold); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .4rem .9rem; }
.streak b { font-size: 1.5rem; line-height: 1; }
.streak span { font-size: .75rem; color: var(--muted); }
.continue { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); border-left: 4px solid var(--green); }
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.rings a { text-decoration: none; color: var(--ink); background: var(--soft); border-radius: 10px; padding: .6rem; text-align: center; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.rings b { font-size: 1.35rem; }
.rings small { font-size: .8rem; color: var(--muted); font-weight: 400; }
.rings span { font-size: .8rem; color: var(--muted); }
.rings i { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p); background: var(--green); }
.votd-ar { font-size: 1.6em; line-height: 2; text-align: right; margin: .2rem 0 .5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 0 0 1rem; }
.tiles a { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 1rem .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); text-align: center; }
.tiles a:hover { border-color: var(--green); }
.tiles .ic { width: 28px; height: 28px; color: var(--green); }
.menu-group h2 { font-size: 1rem; color: var(--muted); margin: 1rem 0 .5rem; }

/* lists */
.search input, .field input, .field select, .field textarea, .search-form input, .search-form select, .row > input {
  font: inherit; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.search input, .field input, .field select, .field textarea { width: 100%; }
.search { margin-bottom: 1rem; }
.search-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search-form input { flex: 1 1 14rem; }
.surahs { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.surahs a { display: flex; align-items: center; gap: .9rem; padding: .65rem .9rem; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.surahs a:hover { border-color: var(--green); }
.num { flex: none; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--green); font-weight: 600; font-size: .85rem; }
.names { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.names small { color: var(--muted); }
.surahs .ar { font-size: 1.35rem; color: var(--green); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.list li { display: flex; align-items: center; gap: .75rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
.list li.answered { opacity: .8; }
.list a { flex: 1; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); min-width: 0; }
.card .list li { border-color: var(--line); background: transparent; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.cards .col { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: var(--ink); height: 100%; margin: 0; }
.cards .col:hover { border-color: var(--green); }
.cards .ar { font-size: 1.3rem; color: var(--green); }
.results { list-style: none; padding: 0; display: grid; gap: .5rem; }
.results a { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.results .ar { font-size: 1.4rem; text-align: right; }

/* tabs */
.tabs { display: flex; gap: .25rem; margin: .5rem 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a, .tabs button { font: inherit; background: none; border: 0; padding: .5rem .9rem; cursor: pointer; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs [aria-selected="true"] { color: var(--ink); border-color: var(--green); font-weight: 600; }

/* reader */
.surah-head { text-align: center; padding: .5rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.surah-head h1 { margin: .2rem 0; font-size: 1.4rem; }
.title { font-size: 2.2rem; margin: 0; color: var(--green); }
.bismillah { font-size: 1.8rem; margin: 1rem 0 0; }
.viewopts { text-align: left; margin-top: 1rem; }
.field.inline { display: inline-flex; align-items: center; gap: .5rem; margin: .3rem 0; }
.field.inline select, .field.inline input { width: auto; }
.ayah { padding: 1.1rem .5rem; border-bottom: 1px solid var(--line); scroll-margin-top: 4rem; border-radius: 8px; transition: background .3s; }
.ayah.playing { background: var(--soft); }
.ayah .text { font-size: var(--ar-px, calc(var(--ar) * var(--qscale, 1))); line-height: 2.2; margin: 0 0 .5rem; text-align: right; }
.end { font-family: var(--font); line-height: 1; display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; font-size: .55em; border: 1.5px solid var(--gold); border-radius: 50%; color: var(--gold); padding: 0 .2em; vertical-align: middle; }
.w { display: inline-block; text-align: center; border-radius: 6px; }
.w[role="button"] { cursor: pointer; }
.w[role="button"]:hover { background: var(--soft); }
.wt { display: block; font-family: var(--font); font-size: max(11px, .32em); line-height: 1.3; color: var(--muted); direction: ltr; max-width: 9em; margin: -.3em auto .3em; }
.tl { font-style: italic; color: var(--muted); margin: 0 0 .5rem; }
.tr { margin: 0 0 .6rem; }
.trn { display: block; font-size: .75rem; color: var(--muted); }
.note-text { background: var(--soft); border-radius: 8px; padding: .4rem .7rem; font-size: .9rem; }
.tools { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.key { color: var(--muted); font-size: .8rem; margin-right: auto; }
.pager { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0; }
.tj[data-r] { color: var(--tj-c, inherit); }
[data-r='ham_wasl'], [data-r='slnt'], [data-r='laam_shamsiyah'], [data-r='idgham_wo_ghunnah'], [data-r^='idgham_muta'], [data-r='grey'] { --tj-c: var(--tj-grey); }
[data-r='ghunnah'], [data-r='ikhafa'], [data-r='ikhafa_shafawi'], [data-r='idgham_ghunnah'], [data-r='idgham_shafawi'], [data-r='iqlab'], [data-r='green'] { --tj-c: var(--tj-green); }
[data-r='qalaqah'] { --tj-c: var(--tj-blue); }
[data-r='madda_necessary'] { --tj-c: var(--tj-madd6); } [data-r^='madda_obligatory'] { --tj-c: var(--tj-madd45); }
[data-r='madda_permissible'] { --tj-c: var(--tj-madd246); } [data-r='madda_normal'] { --tj-c: var(--tj-madd2); }
.legend { list-style: none; padding: 0; display: grid; gap: .6rem; }
.legend li { display: flex; gap: .6rem; align-items: flex-start; }
.tj-dot { flex: none; width: 1rem; height: 1rem; border-radius: 50%; background: var(--tj-c); margin-top: .3rem; }
/* memorise */
.memo-hide .ayah:not(.reveal) .text { filter: blur(7px); cursor: pointer; }
.memo-hidetr .ayah:not(.reveal) .tr { filter: blur(6px); cursor: pointer; }
.memo-first .text { cursor: pointer; }

/* side panel */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(640px, 100%); background: var(--bg); display: flex; flex-direction: column; box-shadow: -4px 0 20px rgba(0,0,0,.2); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.sheet-body { overflow-y: auto; padding: 1rem; }
.quote { font-size: 1.6em; line-height: 2; text-align: right; margin: 0 0 1rem; }
.big-word { font-size: 3rem; text-align: center; }
.prose { line-height: 1.75; }
.prose.rtl { font-family: "Amiri", "Noto Naskh Arabic", serif; font-size: 1.2rem; line-height: 2; }
.prose h2, .prose h3 { font-size: 1.05rem; }
.menu-list { display: grid; gap: .4rem; }
.menu-list button { font: inherit; text-align: left; padding: .75rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.menu-list button:hover { border-color: var(--green); }
.share-canvas { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); margin: .5rem 0; }
.recite span { border-radius: 6px; padding: 0 .1em; transition: color .2s; }
.recite span.ok { color: var(--green); background: var(--soft); }
.recite span.miss { color: var(--bad); }
.recite.hidden-words span:not(.ok) { filter: blur(8px); }
.keys td { padding: .3rem .8rem .3rem 0; }

/* player */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom)); }
.p-main, .p-opts { display: flex; align-items: center; gap: .5rem; max-width: 780px; margin: auto; flex-wrap: wrap; }
.p-opts { font-size: .85rem; color: var(--muted); margin-top: .35rem; }
.p-opts select { font: inherit; font-size: .85rem; padding: .2rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 13rem; }
.p-now { flex: 1; font-size: .9rem; }
.adhan-stop { position: fixed; top: 4.5rem; left: 50%; transform: translateX(-50%); z-index: 30; }
#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--ink); color: var(--bg); padding: .6rem 1.1rem; border-radius: 10px; z-index: 40; transition: transform .25s; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); }
body.has-player #toast { bottom: 8rem; }

/* forms */
.page-title { font-size: 1.45rem; margin: .4rem 0 1rem; }
.form { display: grid; gap: .7rem; }
.field { display: grid; gap: .3rem; margin-bottom: .7rem; }
.form .field { margin: 0; }
.field > span { font-size: .9rem; color: var(--muted); }
.formmsg { margin: 0; min-height: 1em; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 700; margin-bottom: .5rem; color: var(--green); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .1rem; max-height: 16rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; }
.sample { font-size: var(--ar-px, var(--ar)); text-align: center; margin: .2rem 0 .8rem; }
.danger summary { cursor: pointer; color: var(--bad); }
.danger .form { margin-top: .75rem; }
input[type="range"] { accent-color: var(--green); }

/* prayer */
.pt { list-style: none; padding: 0; margin: .5rem 0 0; }
.pt-row { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center; padding: .55rem .6rem; border-radius: 8px; }
.pt-row.next { background: var(--soft); font-weight: 600; }
.pt-row.sub { color: var(--muted); font-size: .9rem; }
.pt-row .ar { color: var(--muted); }
.time { font-variant-numeric: tabular-nums; }
.tick { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--line); background: transparent; color: transparent; cursor: pointer; font-weight: 700; }
.tick.on { border-color: var(--green); background: var(--green); color: var(--green-ink); }
.week { width: 100%; border-collapse: collapse; text-align: center; font-size: .85rem; }
.week th { font-weight: 500; color: var(--muted); padding: .2rem; }
.week td { padding: .15rem; }
.week .tick { width: 1.7rem; height: 1.7rem; }
.compass { --size: 220px; width: var(--size); height: var(--size); margin: 1rem auto; }
.dial { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--line); position: relative; transform: rotate(var(--h)); transition: transform .2s; background: var(--card); }
.dial .n { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--bad); }
.needle { position: absolute; left: 50%; top: 50%; width: 4px; height: 45%; background: var(--green); transform-origin: top center; transform: translateX(-50%) rotate(calc(var(--q) + 180deg)); border-radius: 2px; }
.kaaba { position: absolute; left: 50%; top: 50%; transform: rotate(var(--q)) translateY(calc(var(--size) / -2 + 18px)) rotate(calc(var(--q) * -1)); margin: -.7em 0 0 -.5em; font-size: 1.4rem; }
.compass.facing .dial { border-color: var(--green); box-shadow: 0 0 0 6px var(--soft); }

/* calendar */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.month > b { font-size: .75rem; color: var(--muted); font-weight: 500; }
.month button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: .25rem 0; display: flex; flex-direction: column; cursor: default; }
.month button small { font-size: .65rem; color: var(--muted); }
.month button.today { border: 2px solid var(--green); }
.month button.ev { background: var(--soft); cursor: pointer; color: var(--green); font-weight: 700; }
.month button.white { border-style: dashed; }
.ram-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: .8rem 0 .3rem; }
.ram-grid button { font: inherit; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); cursor: pointer; font-size: .8rem; }
.ram-grid button.on { background: var(--green); color: var(--green-ink); }
.ram-grid button.today { outline: 2px solid var(--gold); }
.ram-grid button.last10 { border-color: var(--gold); }

/* dhikr */
.dhikr-ar { font-size: 1.6rem; line-height: 2; text-align: right; margin: .2rem 0; }
.dhikr.done { opacity: .65; }
.btn.count { min-width: 6rem; font-size: 1rem; }
.counter { text-align: center; padding: 1rem 0; }
.counter .ar { font-size: 2rem; margin: .5rem 0; }
.tap { width: min(70vw, 240px); aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--green); background: var(--soft); color: var(--ink); font: inherit; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.tap:active { transform: scale(.97); }
.tap b { font-size: 3.5rem; line-height: 1; }
.tap small { color: var(--muted); }
.dua h2 { font-size: 1rem; }

/* hadith */
.hadith-ar { font-size: 1.3rem; line-height: 2; text-align: right; }
.grade.ok { color: var(--green); font-weight: 600; }
.grade.bad { color: var(--bad); font-weight: 600; }

/* hajj */
.steps { list-style: none; padding: 0; }
.step { display: flex; gap: .9rem; align-items: flex-start; }
.step .n { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--green); font-weight: 700; }
.step h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.step.done { opacity: .7; }
.checklist { list-style: none; padding: 0; }

/* zakat */
.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* progress */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stats .card { margin: 0; display: flex; flex-direction: column; }
.stats b { font-size: 1.4rem; }
.stats span { color: var(--muted); font-size: .9rem; }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; overflow-x: auto; }
.heat i { width: 14px; height: 14px; border-radius: 3px; background: var(--soft); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--green) 30%, var(--soft)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--green) 55%, var(--soft)); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--green) 80%, var(--soft)); }
.heat i[data-l="4"] { background: var(--green); }
.badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.badges li { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; display: flex; flex-direction: column; text-align: center; opacity: .5; filter: grayscale(1); }
.badges li.on { opacity: 1; filter: none; border-color: var(--gold); }
.badges span { font-size: 1.8rem; }
.badges small { color: var(--muted); font-size: .8rem; }
.badges em { font-style: normal; color: var(--gold); font-size: .8rem; }
.wrap-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .4rem; }
.wrap-list b { color: var(--green); font-size: 1.2rem; }

/* feelings */
.moods { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
.mood { font: inherit; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .7rem .3rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; }
.mood span { font-size: 1.7rem; }
.mood:hover { border-color: var(--green); }
.items { display: grid; gap: .6rem; margin: .6rem 0; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.item .kind { font-size: .75rem; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.item .ar { font-size: 1.45rem; line-height: 2; text-align: right; margin: .2rem 0; }
.item p { margin: .3rem 0; }

@media (max-width: 600px) {
  .top { flex-wrap: wrap; padding: .45rem .6rem; gap: .3rem; }


  main { padding: .75rem; }
  .rings b { font-size: 1.1rem; }
  .ram-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ==========================================================================================
   THEMES (Settings → Look). Each has a day and a night version; none of them move.
   ========================================================================================== */
/* Zellige: emerald and gold on ivory, faint girih tiles, a zellige strip under the bar */
[data-look="zellige"] { --bg: #f5eedd; --card: #fffaf0; --line: #e0cfa6; --ink: #18261f; --muted: #5b5a48; --green: #0f6b52; --soft: #eee4c8; --gold: #9a6a12; --mark: #f1e4bf;
  --font: "Atkinson Hyperlegible", system-ui, sans-serif; --head: "El Messiri", Georgia, serif;
  --z-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg stroke-opacity='.45'%3E%3Cpolygon points='48.00,18.00 54.31,32.76 69.21,26.79 63.24,41.69 78.00,48.00 63.24,54.31 69.21,69.21 54.31,63.24 48.00,78.00 41.69,63.24 26.79,69.21 32.76,54.31 18.00,48.00 32.76,41.69 26.79,26.79 41.69,32.76' fill='%230f6b52' fill-opacity='.05' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cpolygon points='54.31,32.76 54.36,41.64 63.24,41.69 57.00,48.00 63.24,54.31 54.36,54.36 54.31,63.24 48.00,57.00 41.69,63.24 41.64,54.36 32.76,54.31 39.00,48.00 32.76,41.69 41.64,41.64 41.69,32.76 48.00,39.00' fill='none' stroke='%23b48a3c' stroke-width='1'/%3E%3Cpolygon points='0.00,-30.00 6.31,-15.24 21.21,-21.21 15.24,-6.31 30.00,0.00 15.24,6.31 21.21,21.21 6.31,15.24 0.00,30.00 -6.31,15.24 -21.21,21.21 -15.24,6.31 -30.00,0.00 -15.24,-6.31 -21.21,-21.21 -6.31,-15.24' fill='none' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cpolygon points='96.00,-30.00 102.31,-15.24 117.21,-21.21 111.24,-6.31 126.00,0.00 111.24,6.31 117.21,21.21 102.31,15.24 96.00,30.00 89.69,15.24 74.79,21.21 80.76,6.31 66.00,0.00 80.76,-6.31 74.79,-21.21 89.69,-15.24' fill='none' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cpolygon points='0.00,66.00 6.31,80.76 21.21,74.79 15.24,89.69 30.00,96.00 15.24,102.31 21.21,117.21 6.31,111.24 0.00,126.00 -6.31,111.24 -21.21,117.21 -15.24,102.31 -30.00,96.00 -15.24,89.69 -21.21,74.79 -6.31,80.76' fill='none' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cpolygon points='96.00,66.00 102.31,80.76 117.21,74.79 111.24,89.69 126.00,96.00 111.24,102.31 117.21,117.21 102.31,111.24 96.00,126.00 89.69,111.24 74.79,117.21 80.76,102.31 66.00,96.00 80.76,89.69 74.79,74.79 89.69,80.76' fill='none' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cline x1='48.0' y1='0' x2='48.0' y2='18.0' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cline x1='48.0' y1='96' x2='48.0' y2='78.0' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cline x1='0' y1='48.0' x2='18.0' y2='48.0' stroke='%23b48a3c' stroke-width='1.2'/%3E%3Cline x1='96' y1='48.0' x2='78.0' y2='48.0' stroke='%23b48a3c' stroke-width='1.2'/%3E%3C/g%3E%3C/svg%3E"); --z-strip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Crect width='28' height='14' fill='%230f6b52'/%3E%3Cpolygon points='7.00,0.50 8.30,3.86 11.60,2.40 10.14,5.70 13.50,7.00 10.14,8.30 11.60,11.60 8.30,10.14 7.00,13.50 5.70,10.14 2.40,11.60 3.86,8.30 0.50,7.00 3.86,5.70 2.40,2.40 5.70,3.86' fill='%23ffffff'/%3E%3Cpolygon points='21,1.5 26.5,7 21,12.5 15.5,7' fill='%23ffffff' fill-opacity='.55'/%3E%3C/svg%3E"); --z-rose: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50.00,2.00 61.48,22.28 83.94,16.06 77.72,38.52 98.00,50.00 77.72,61.48 83.94,83.94 61.48,77.72 50.00,98.00 38.52,77.72 16.06,83.94 22.28,61.48 2.00,50.00 22.28,38.52 16.06,16.06 38.52,22.28' fill='none' stroke='%23b48a3c' stroke-width='2'/%3E%3Cpolygon points='68.37,5.65 71.21,28.79 94.35,31.63 80.00,50.00 94.35,68.37 71.21,71.21 68.37,94.35 50.00,80.00 31.63,94.35 28.79,71.21 5.65,68.37 20.00,50.00 5.65,31.63 28.79,28.79 31.63,5.65 50.00,20.00' fill='none' stroke='%23b48a3c' stroke-width='2'/%3E%3Ccircle cx='50' cy='50' r='14' fill='none' stroke='%23b48a3c' stroke-width='2'/%3E%3Cpolygon points='50.00,37.00 52.30,44.46 59.19,40.81 55.54,47.70 63.00,50.00 55.54,52.30 59.19,59.19 52.30,55.54 50.00,63.00 47.70,55.54 40.81,59.19 44.46,52.30 37.00,50.00 44.46,47.70 40.81,40.81 47.70,44.46' fill='%23b48a3c'/%3E%3C/svg%3E"); }
[data-look="zellige"].dark { --bg: #0a1714; --card: #10241e; --line: #2a4238; --ink: #f4ecd8; --muted: #b8ad92; --green: #4fc9a4; --green-ink: #08201a; --soft: #183229; --gold: #e2b95b; --mark: #1b3a30;
  --z-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg stroke-opacity='.22'%3E%3Cpolygon points='48.00,18.00 54.31,32.76 69.21,26.79 63.24,41.69 78.00,48.00 63.24,54.31 69.21,69.21 54.31,63.24 48.00,78.00 41.69,63.24 26.79,69.21 32.76,54.31 18.00,48.00 32.76,41.69 26.79,26.79 41.69,32.76' fill='%232fae8a' fill-opacity='.06' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cpolygon points='54.31,32.76 54.36,41.64 63.24,41.69 57.00,48.00 63.24,54.31 54.36,54.36 54.31,63.24 48.00,57.00 41.69,63.24 41.64,54.36 32.76,54.31 39.00,48.00 32.76,41.69 41.64,41.64 41.69,32.76 48.00,39.00' fill='none' stroke='%23d9b25a' stroke-width='1'/%3E%3Cpolygon points='0.00,-30.00 6.31,-15.24 21.21,-21.21 15.24,-6.31 30.00,0.00 15.24,6.31 21.21,21.21 6.31,15.24 0.00,30.00 -6.31,15.24 -21.21,21.21 -15.24,6.31 -30.00,0.00 -15.24,-6.31 -21.21,-21.21 -6.31,-15.24' fill='none' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cpolygon points='96.00,-30.00 102.31,-15.24 117.21,-21.21 111.24,-6.31 126.00,0.00 111.24,6.31 117.21,21.21 102.31,15.24 96.00,30.00 89.69,15.24 74.79,21.21 80.76,6.31 66.00,0.00 80.76,-6.31 74.79,-21.21 89.69,-15.24' fill='none' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cpolygon points='0.00,66.00 6.31,80.76 21.21,74.79 15.24,89.69 30.00,96.00 15.24,102.31 21.21,117.21 6.31,111.24 0.00,126.00 -6.31,111.24 -21.21,117.21 -15.24,102.31 -30.00,96.00 -15.24,89.69 -21.21,74.79 -6.31,80.76' fill='none' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cpolygon points='96.00,66.00 102.31,80.76 117.21,74.79 111.24,89.69 126.00,96.00 111.24,102.31 117.21,117.21 102.31,111.24 96.00,126.00 89.69,111.24 74.79,117.21 80.76,102.31 66.00,96.00 80.76,89.69 74.79,74.79 89.69,80.76' fill='none' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cline x1='48.0' y1='0' x2='48.0' y2='18.0' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cline x1='48.0' y1='96' x2='48.0' y2='78.0' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cline x1='0' y1='48.0' x2='18.0' y2='48.0' stroke='%23d9b25a' stroke-width='1.2'/%3E%3Cline x1='96' y1='48.0' x2='78.0' y2='48.0' stroke='%23d9b25a' stroke-width='1.2'/%3E%3C/g%3E%3C/svg%3E"); }
[data-look="zellige"] body { background: var(--z-tile) repeat fixed, var(--bg); background-size: 96px 96px, auto; }
[data-look="zellige"] .top { background: #0f6b52; color: #fdf7e6; }
[data-look="zellige"].dark .top { background: #0d3a2e; color: #f4ecd8; }
[data-look="zellige"] .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; background: var(--z-strip) repeat-x; background-size: 20px 10px; pointer-events: none; }
[data-look="zellige"] main { padding-top: 1.4rem; }
[data-look="zellige"] .card { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 5px color-mix(in srgb, var(--gold) 28%, transparent); }
[data-look="zellige"] .card h2 { display: flex; align-items: center; gap: .45rem; }
[data-look="zellige"] .card h2::before { content: ""; flex: none; width: 14px; height: 14px; background: var(--z-rose) center / contain no-repeat; }
[data-look="zellige"] .btn.primary { border-color: var(--gold); }
[data-look="zellige"] .surah-head { border: 2px solid color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 50% 50% 14px 14px / 56px 56px 14px 14px; background: var(--card); padding: 2rem 1rem 1rem; position: relative; }
[data-look="zellige"] .surah-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 26px; height: 26px; margin-left: -13px; background: var(--z-rose) center / contain no-repeat; }

/* Ocean: calm blue and teal */
[data-look="ocean"] { --bg: #f1f6f9; --card: #ffffff; --line: #d3e2ea; --ink: #14303d; --muted: #4e6b78; --green: #1d6f8f; --soft: #e1eff5; --gold: #b07a1a; --mark: #fff0c2; }
[data-look="ocean"].dark { --bg: #0b1a22; --card: #12252f; --line: #23404d; --ink: #e3f1f7; --muted: #9bb7c4; --green: #5cc3e6; --green-ink: #06202b; --soft: #173341; --gold: #e3bd62; --mark: #3b3618; }

/* Rose: soft rose and deep plum */
[data-look="rose"] { --bg: #fbf4f4; --card: #ffffff; --line: #efd9dc; --ink: #3a1f28; --muted: #7a5862; --green: #8e3b5a; --soft: #f6e4e9; --gold: #a8742a; --mark: #fbe7b5; }
[data-look="rose"].dark { --bg: #1a1014; --card: #24171d; --line: #43292f; --ink: #f6e6ea; --muted: #c3a1ab; --green: #f08fb2; --green-ink: #2a0c17; --soft: #36212a; --gold: #e3bd62; --mark: #4a3a1a; }

/* Desert: sand and terracotta */
[data-look="desert"] { --bg: #f7efe3; --card: #fffaf2; --line: #e6d3b8; --ink: #3b2a1a; --muted: #7a6249; --green: #a4512b; --soft: #f1e2cc; --gold: #8a6a16; --mark: #f6e2a8; }
[data-look="desert"].dark { --bg: #1b140d; --card: #261c13; --line: #45341f; --ink: #f5e8d6; --muted: #c4ab8a; --green: #f09a6a; --green-ink: #2a1206; --soft: #3a2a1a; --gold: #e6c36a; --mark: #4a3a1a; }

/* Night sky: indigo and gold (always dark) */
[data-look="sky"] { --bg: #0e1230; --card: #161b42; --line: #2b3266; --ink: #eef0ff; --muted: #a9b0dc; --green: #f2c45a; --green-ink: #1a1400; --soft: #20275a; --gold: #f2c45a; --mark: #3a3260; color-scheme: dark; }
[data-look="sky"] .top { background: #161b42; color: #f2c45a; border-bottom: 1px solid #2b3266; }
[data-look="sky"] body { background: radial-gradient(circle at 20% 10%, #1c2360, transparent 50%), var(--bg); background-attachment: fixed; }

/* Custom: your own accent colour (Settings → Look), over the Simple colours */
[data-look="custom"] { --green: var(--custom, #1f6b4f); --soft: color-mix(in srgb, var(--custom, #1f6b4f) 12%, #fff); }
[data-look="custom"].dark { --green: color-mix(in srgb, var(--custom, #1f6b4f) 70%, #fff); --soft: color-mix(in srgb, var(--custom, #1f6b4f) 22%, #101614); }

/* headings font for themes that have one */
h1, h2, h3 { font-family: var(--head, inherit); }

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: .3rem 0 1rem; }
.theme { font: inherit; text-align: left; cursor: pointer; border: 2px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; background: var(--card); color: var(--ink); }
.theme[aria-pressed="true"] { border-color: var(--green); box-shadow: 0 0 0 3px var(--soft); }
.theme .pv { display: block; height: 64px; position: relative; background: var(--pv-bg); }
.theme .pv::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 16px; background: var(--pv-bar); }
.theme .pv::after { content: "بِسْمِ ٱللَّهِ"; position: absolute; right: 10px; bottom: 6px; font: 18px "Amiri Quran", serif; color: var(--pv-ink); }
.theme .pv i { position: absolute; left: 10px; bottom: 10px; width: 46px; height: 14px; border-radius: 4px; background: var(--pv-bar); }
.theme b { display: block; padding: .4rem .6rem 0; }
.theme small { display: block; padding: 0 .6rem .5rem; color: var(--muted); font-size: .75rem; }

[hidden] { display: none !important; }
input[type="color"] { width: 3.2rem; height: 2.2rem; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; }
[data-look="zellige"] .ayah, [data-look="zellige"] .pager { background: color-mix(in srgb, var(--card) 88%, transparent); margin-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: .45rem; }
.logo { width: 28px; height: 28px; flex: none; }
.brand { font-family: "Lexend", system-ui, sans-serif !important; }

/* practice and voice counter */
.big-btn { font-size: 1.1rem; padding: .7rem 1.2rem; }
.practice .recite { font-size: var(--ar-px, 2rem); line-height: 2.2; margin: 1rem 0; }
.p-heard { min-height: 1.4em; }
.good { color: var(--green); }
.weak { color: var(--bad); }
.small-ar { font-size: 1.3rem; line-height: 2; margin: .2rem 0; text-align: right; }
.okw { color: var(--green); }
.missw { color: var(--bad); text-decoration: underline dotted; }
.voice-box { margin: 1rem auto; max-width: 30rem; }
.voice-box .btn { font-size: 1.05rem; padding: .6rem 1.2rem; }
#cHeard { min-height: 2.6em; margin: .5rem 0 0; }
#cPresets small { opacity: .75; font-size: .75rem; }

/* learn, offline, search */
.lv { font-size: .95rem; color: var(--gold); margin: 1rem 0 .4rem; }
.lessons li.done { border-color: var(--green); }
.lessons .ar { color: var(--green); font-size: 1.1rem; }
.lesson-head .title { font-size: 1.8rem; }
.lesson-part ul { padding-left: 1.2rem; }
.ar-inline { font-family: "Amiri Quran", "Amiri", serif; font-size: 1.25em; }
.example { border-top: 1px solid var(--line); padding: .6rem 0; }
.example:first-of-type { border-top: 0; }
.ex-ar { font-size: 1.7rem; line-height: 2.1; text-align: right; margin: 0; }
mark.ex { background: color-mix(in srgb, var(--gold) 25%, transparent); color: inherit; border-radius: 4px; padding: 0 .1em; }
.quiz .q { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin: 0 0 .7rem; }
.quiz legend { font-weight: 600; padding: 0 .3rem; color: var(--ink); }
.quiz .toggle { display: flex; margin: .3rem 0; }
.quiz .q.right { border-color: var(--green); }
.quiz .q.wrong { border-color: var(--bad); }
.why { font-size: .9rem; margin: .4rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .85rem; padding: .15rem .6rem; border-radius: 99px; text-decoration: none; border: 1px solid var(--line); color: var(--ink); }
.chip.ok { border-color: var(--green); color: var(--green); }
.chip.bad { border-color: var(--bad); color: var(--bad); }
.dl-list .pill { white-space: nowrap; }
.s-part h2 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
.result-btn { gap: .2rem; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; color: var(--ink); }
.result-btn .ar { font-size: 1.15rem; line-height: 1.9; text-align: right; }


/* ==========================================================================================
   Menus: tab bar (top on wide screens, bottom on phones) and the ☰ panel
   ========================================================================================== */
h1, h2, h3, legend, .btn, .tabs a, .page-title { font-family: var(--head); }
h1, h2, h3, .page-title { font-weight: 600; letter-spacing: -.01em; }
.drawer { position: fixed; inset: 0; z-index: 25; }
.drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.drawer-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(330px, 86vw); background: var(--bg); overflow-y: auto; box-shadow: 4px 0 24px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; background: var(--green); color: var(--green-ink); font: 600 1.1rem var(--head); position: sticky; top: 0; }
.drawer-head .btn { color: inherit; border-color: transparent; }
.drawer-body { padding: .4rem .6rem 1rem; }
.drawer-foot { padding: .8rem .4rem; border-top: 1px solid var(--line); margin-top: .5rem; }
.drawer-foot .btn { display: inline-flex; align-items: center; gap: .5rem; }
.drawer-foot .ic { width: 18px; height: 18px; }
.menu-group h2 { font: 600 .78rem var(--head); text-transform: uppercase; letter-spacing: .06em; color: var(--gold); margin: 1rem .5rem .3rem; }
.menu-group ul { list-style: none; margin: 0; padding: 0; }
.menu-group li a { display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem; border-radius: 10px; color: var(--ink); text-decoration: none; }
.menu-group li a:hover, .menu-group li a:focus-visible { background: var(--soft); }
.menu-group li .ic { width: 22px; height: 22px; color: var(--green); flex: none; }
.menu-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1rem; }
.menu-page .menu-group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .2rem .4rem .5rem; margin-bottom: 1rem; }

/* reader: the tajweed colour key */
.tj-key { display: flex; flex-wrap: wrap; gap: .35rem .5rem; justify-content: center; margin: .8rem 0 0; font-size: .8rem; }
.tj-key a { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; }
.tj-key i { width: .8rem; height: .8rem; border-radius: 50%; background: var(--tj-c); }

@media (max-width: 760px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 14; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    background: var(--card); border-top: 1px solid var(--line); padding: .2rem .2rem calc(.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0,0,0,.06); }
  .tabbar a { flex-direction: column; gap: .15rem; padding: .35rem 0 .25rem; border-radius: 10px; color: var(--muted); font-size: .7rem; opacity: 1; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.on, .dark .tabbar a.on { color: var(--green); background: var(--soft); }
  .tabbar a:hover, .dark .tabbar a:hover { background: var(--soft); }
  .brand { margin-right: auto; }
  body { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
  body.has-player { padding-bottom: calc(11rem + env(safe-area-inset-bottom)); }
  .player { bottom: calc(3.65rem + env(safe-area-inset-bottom)); }
  #toast { bottom: 5rem; }
  body.has-player #toast { bottom: 12rem; }
  .foot { padding-bottom: 1rem; }
}
[data-look="sky"] .tabbar { color: #f2c45a; }
@media (max-width: 760px) { [data-look="zellige"] .top::after { display: none; } }
.btn .ic { width: 1.1em; height: 1.1em; vertical-align: -.18em; }
[data-arfont="hafs"] { --qscale: 1.15; }

/* adhan alarm */
.alarm { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--green) 92%, #000); color: #fff; display: grid; place-items: center; padding: 1.5rem; text-align: center; overflow-y: auto; }
.alarm-in { max-width: 32rem; }
.alarm h2 { font-size: 2rem; margin: .2rem 0; color: #fff; }
.alarm-ar { font-size: 3.2rem; margin: 0; color: #f3e7c4; }
.alarm .big { font-size: 1.4rem; opacity: .9; }
.alarm-stop { font-size: 1.3rem; padding: 1rem 2.2rem; margin: 1.5rem 0; background: #fff !important; color: var(--green) !important; border-color: #fff !important; border-radius: 99px; }
.alarm-dua .ar { font-size: 1.6rem; line-height: 2; color: #fff; }
.alarm-dua .muted, .alarm-dua .small { color: #e7f2ec; }
.alarm .btn { color: #fff; border-color: rgba(255,255,255,.6); background: transparent; }
.alarm .src { background: rgba(255,255,255,.15); color: #fff; }
.bell { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--line); background: transparent; cursor: pointer; filter: grayscale(1); opacity: .45; font-size: .9rem; }
.bell.on { filter: none; opacity: 1; border-color: var(--gold); }
.pt-row { grid-template-columns: 1fr auto auto auto; }
.chip-toggle { border: 1px solid var(--line); border-radius: 99px; padding: .2rem .7rem; margin: 0; }
.pill.warn { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.adhan-card h3 { margin: .8rem 0 0; font-size: 1rem; }
.modes { border-collapse: collapse; }
.modes th { text-align: left; font-weight: 500; padding: .25rem 1rem .25rem 0; }
.modes select { font: inherit; padding: .35rem .5rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.bell { filter: none; opacity: .5; }
.bell.on { opacity: 1; }

/* special days */
.eid-card { text-align: center; border: 2px solid var(--gold); background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, var(--card)), var(--card)); }
.eid-card h3 { margin: 1rem 0 .3rem; font-size: 1rem; color: var(--gold); }
.eid-ar { font-size: 2.6rem; color: var(--gold); margin: 0; }
.eid-card .ar { font-size: 1.5rem; line-height: 2; }
.eid-list { text-align: left; padding-left: 1.2rem; }
.special-card { border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; }
.moon-card { border: 2px dashed var(--gold); }
.hijri-src { margin-top: .6rem; }
/* counter: dhikr choices in one swipeable row so the circle stays on screen */
#cPresets { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: .3rem; scrollbar-width: thin; }
#cPresets .btn { flex: none; white-space: nowrap; }
@media (max-width: 760px) { .tap { width: min(58vw, 220px); } .counter { padding-top: .2rem; } .counter .ar { font-size: 1.7rem; margin: .3rem 0; } }
