/* Homework-link pages: one bright, friendly style for the home page, the builder, the dashboard and the student. */
@font-face { font-family: 'WajibHafs'; src: url('fonts/UthmanicHafs1Ver18.woff2') format('woff2'); font-display: swap; }

:root {
  --blue: #2f6fde; --blue-2: #4f8cf7; --green: #22b07d; --amber: #ffb627; --pink: #ff5d8f; --purple: #8b5cf6; --teal: #14b8a6; --red: #e5484d;
  --bg: #f4f7fb; --card: #ffffff; --ink: #1b2437; --muted: #6b7690; --line: #e3e8f1; --soft: #eef3fb;
  --focus: #ffe58a; --playing: #fff6d6; --playing-line: #ffb627; --wa: #1fa855;
  --shadow: 0 2px 4px rgba(27, 36, 55, .04), 0 8px 24px rgba(27, 36, 55, .07);
  --radius: 20px;
  --k-new: #22b07d; --k-near: #2f6fde; --k-far: #8b5cf6; --k-tilawa: #14b8a6; --k-listen: #64748b; --k-tajweed: #f97316; --k-custom: #6b7280;
  --hero-a: #2f6fde; --hero-b: #6a5cf0; --hero-c: #a855f7; --bar: #2f6fde; --bar-deep: #1e3a8a;
  --page-bg: #fffdf6; --page-line: #eadfc3;
  color-scheme: light;
}
/* Themes the reader can pick (🎨). "auto" follows the phone: light by day, dark at night. */
:root[data-theme="paper"] {
  --bg: #f6efdf; --card: #fffaf0; --ink: #3b2f1e; --muted: #7a6a55; --line: #e8dcc2; --soft: #f3e8d0; --blue: #8a5a2b; --blue-2: #a87038;
  --playing: #fff1c2; --hero-a: #8a5a2b; --hero-b: #b07a3c; --hero-c: #c99a4b; --bar: #8a5a2b; --bar-deep: #5d3b1a; --page-bg: #fffaf0;
}
:root[data-theme="green"] {
  --bg: #eef7f1; --ink: #16301f; --muted: #5d7a68; --line: #d6e9dc; --soft: #e3f2e8; --blue: #1f8a5b; --blue-2: #2fae74;
  --hero-a: #1f8a5b; --hero-b: #25a06a; --hero-c: #14b8a6; --bar: #1f8a5b; --bar-deep: #145c3c;
}
:root[data-theme="ocean"] {
  --bg: #eef8fd; --line: #d3e9f5; --soft: #e0f2fb; --blue: #0e8ac2; --blue-2: #19a7e0;
  --hero-a: #0e8ac2; --hero-b: #2f6fde; --hero-c: #14b8a6; --bar: #0e8ac2; --bar-deep: #0b4f73;
}
:root[data-theme="kids"] {
  --bg: #fff6fb; --line: #f6d9e8; --soft: #ffe9f3; --blue: #e0457b; --blue-2: #ff6fa2; --radius: 26px;
  --hero-a: #ff5d8f; --hero-b: #ff8a3d; --hero-c: #8b5cf6; --bar: #e0457b; --bar-deep: #8b2d5c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1424; --card: #151f33; --ink: #e9eef8; --muted: #9aa8c2; --line: #263552; --soft: #1b2842;
    --focus: #6b5410; --playing: #2a3420; --shadow: none; --blue: #5b8ff5; --page-bg: #161f31; --page-line: #2c3b5a; --bar: #1e3a8a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --card: #151f33; --ink: #e9eef8; --muted: #9aa8c2; --line: #263552; --soft: #1b2842;
  --focus: #6b5410; --playing: #2a3420; --shadow: none; --blue: #5b8ff5; --page-bg: #161f31; --page-line: #2c3b5a; --bar: #1e3a8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Cairo', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.6;
  background-image: radial-gradient(circle at 10% 0, rgba(47, 111, 222, .08), transparent 40%), radial-gradient(circle at 95% 20%, rgba(34, 176, 125, .08), transparent 35%);
  background-attachment: fixed;
}
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.center-msg { min-height: 50vh; display: grid; place-content: center; justify-items: center; text-align: center; padding: 24px 16px; color: var(--muted); gap: 6px; }
.center-msg.small-msg { min-height: 120px; }
.big-emoji { font-size: 3.4rem; line-height: 1.2; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.spinner { display: inline-block; width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.spinner.small { width: 22px; height: 22px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink) !important; text-decoration: none; font-weight: 800; font-size: 1.08rem; white-space: nowrap; min-width: 0; }
.brand svg { flex: none; }
.brand svg { border-radius: 10px; box-shadow: 0 2px 8px rgba(47, 111, 222, .25); }
.topbar-end { display: flex; align-items: center; gap: 8px; }
.nav-link { text-decoration: none; font-size: 1.3rem; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--soft); }
.lang-pick { display: flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 12px; padding: 0 6px; }
.lang-pick select { background: transparent; border: 0; padding: 8px 2px; max-width: 38vw; font-weight: 600; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.wrap.student { padding-bottom: 150px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; box-shadow: var(--shadow); animation: rise .35s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
h1 { font-size: 1.5rem; margin: 0 0 4px; line-height: 1.35; font-weight: 800; }
h2 { font-size: 1.12rem; margin: 0 0 12px; font-weight: 800; }

/* fields */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; min-width: 0; }
.grid .field { margin: 0; }
.field > span:first-child { font-size: .9rem; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea, .search {
  width: 100%; min-width: 0; padding: 11px 13px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .search:focus { outline: none; border-color: var(--blue); background: var(--card); }
.field .row select { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 8px 16px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 700;
  transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { border-color: var(--blue); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--blue-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(47, 111, 222, .3); }
.btn.big { width: 100%; min-height: 58px; font-size: 1.15rem; border-radius: 18px; }
.btn.small { min-height: 38px; padding: 4px 12px; font-size: .92rem; }
.btn.soft { background: var(--soft); border-color: transparent; }
.btn.wa { background: linear-gradient(135deg, #1fa855, #28c76f); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(31, 168, 85, .28); }
.btn.danger { color: var(--red); }
.btn.done { background: var(--green); border-color: var(--green); color: #fff; }
.btn.start { background: linear-gradient(135deg, var(--green), #2fd39b); border: 0; color: #fff; box-shadow: 0 8px 20px rgba(34, 176, 125, .32); margin: 6px 0 12px; }
.btn.start svg { width: 26px; height: 26px; }
.btn.shine { position: relative; overflow: hidden; }
.btn.shine::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(120%); } }
.ghost-btn { min-height: 46px; padding: 0 12px; }
.link { background: none; border: 0; padding: 6px 4px; color: var(--blue); cursor: pointer; font-weight: 700; text-decoration: none; }
.link:disabled { color: var(--muted); opacity: .45; cursor: default; }
.link.danger { color: var(--red); }
.link.strong { color: var(--green); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn.small { width: 46px; height: 46px; background: var(--blue); color: #fff; flex: none; border-radius: 14px; }
[dir="rtl"] .icon-btn.flip svg { transform: scaleX(-1); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font-size: .92rem; font-weight: 700; color: var(--ink); transition: transform .12s, background .15s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
[class*="kind-"] { --k: var(--k-custom); }
.kind-new { --k: var(--k-new); } .kind-near { --k: var(--k-near); } .kind-far { --k: var(--k-far); }
.kind-tilawa { --k: var(--k-tilawa); } .kind-listen { --k: var(--k-listen); } .kind-tajweed { --k: var(--k-tajweed); }
.chip[class*="kind-"] { color: var(--k); border-color: color-mix(in srgb, var(--k) 35%, transparent); }
.chip[class*="kind-"].on { background: var(--k); border-color: var(--k); color: #fff; }
.small-chips .chip { font-size: .82rem; padding: 2px 10px; cursor: default; }
.pill { display: inline-block; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: .9rem; }

/* home */
.hero { text-align: center; padding: 18px 8px 8px; }
.hero h1 { font-size: 1.75rem; }
.hero p { color: var(--muted); max-width: 520px; margin: 4px auto 0; }
.hero-art { display: flex; justify-content: center; gap: 14px; font-size: 2.3rem; margin-bottom: 6px; }
.hero-art span { animation: bob 2.6s ease-in-out infinite; }
.hero-art span:nth-child(2) { animation-delay: .3s; } .hero-art span:nth-child(3) { animation-delay: .6s; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; margin: 18px 0; }
.choice {
  display: flex; align-items: center; gap: 14px; padding: 20px 18px; border-radius: 24px; text-decoration: none; color: #fff;
  box-shadow: var(--shadow); transition: transform .15s; animation: rise .4s ease-out both;
}
.choice:hover { transform: translateY(-3px); }
.choice.teacher { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); }
.choice.student { background: linear-gradient(135deg, #22b07d, #14b8a6); animation-delay: .08s; }
.choice-icon { font-size: 2.6rem; background: rgba(255, 255, 255, .2); width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; flex: none; }
.choice b { display: block; font-size: 1.25rem; }
.choice small { display: block; opacity: .92; font-size: .95rem; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.feature span { font-size: 1.4rem; }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mini-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--soft); text-decoration: none; color: var(--ink); }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* progress ring */
.ring { --pct: 0; width: 74px; height: 74px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--amber) calc(var(--pct) * 1%), rgba(255, 255, 255, .25) 0); }
.ring span { width: 58px; height: 58px; border-radius: 50%; background: rgba(0, 0, 0, .12); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: .95rem; white-space: nowrap; direction: ltr; }
.ring.small { width: 46px; height: 46px; background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--line) 0); }
.ring.small span { width: 36px; height: 36px; background: var(--card); color: var(--ink); font-size: .78rem; }
.stars-count { font-weight: 800; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 2px 12px; }
.stars-count.small { background: var(--card); font-size: .9rem; }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { border-radius: 18px; padding: 12px; color: #fff; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tile b { font-size: 1.8rem; line-height: 1.2; }
.tile span { font-size: .85rem; font-weight: 700; opacity: .95; }
.tile.blue { background: linear-gradient(135deg, #2f6fde, #4f8cf7); }
.tile.amber { background: linear-gradient(135deg, #f59e0b, #ffb627); }
.tile.green { background: linear-gradient(135deg, #22b07d, #2fd39b); }
.sent-list { display: grid; gap: 0; }
.sent-card .chips { margin: 8px 0; }
.status { border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.status.done { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.status.listen { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.status.open { background: color-mix(in srgb, var(--amber) 22%, transparent); color: #b7791f; }
.status.wait, .status.na { background: var(--soft); color: var(--muted); }
.students { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.students li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; background: var(--soft); border-radius: 12px; padding: 8px 12px; }
.card-acts { display: flex; flex-wrap: wrap; gap: 0 8px; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* builder */
.page-head { display: flex; align-items: flex-start; gap: 12px; margin: 6px 0 16px; }
.page-head > div { flex: 1; }
.page-head p { margin: 0; }
.back { flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; text-decoration: none; font-size: 1.3rem; color: var(--ink); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.step-head h2 { margin: 0; }
.step-n { width: 32px; height: 32px; border-radius: 11px; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
section.step:not(.card) .step-head { margin: 22px 4px 12px; }
.profile-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; background: var(--soft); border-radius: 14px; padding: 10px 14px; }
.part-edit { border-top: 5px solid var(--k); }
.pe-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.pe-num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--k); color: #fff; display: grid; place-items: center; font-weight: 800; }
.range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.surah-btn {
  flex: 1 1 230px; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--bg); cursor: pointer; text-align: start; margin-bottom: 12px;
}
.surah-btn:hover { border-color: var(--blue); }
.surah-btn span[lang="ar"] { font-weight: 800; font-size: 1.1rem; }
.surah-btn small { color: var(--muted); }
.surah-btn .caret { margin-inline-start: auto; color: var(--muted); }
.surah-no { min-width: 30px; height: 30px; padding: 0 4px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: var(--blue); }
.range-nums { display: flex; gap: 10px; }
.range-nums .ayah-num { width: 92px; }
.range-end { flex: 1 1 100%; display: flex; flex-direction: column; }
.range-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin: -4px 0 10px; font-size: .92rem; }
.presets, .method { margin: 8px 0; }
.lbl { display: block; font-size: .9rem; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.chip.preset { font-size: .98rem; padding: 7px 14px; }
.method { background: var(--soft); border-radius: 16px; padding: 12px; }
.method p { margin: 6px 0 0; }
.steppers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; margin-top: 10px; }
.stepper { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.stepper > span { font-size: .85rem; color: var(--muted); font-weight: 700; }
.stepper-ctl { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stepper-ctl button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--soft); font-size: 1.35rem; font-weight: 800; cursor: pointer; color: var(--blue); }
.stepper-ctl output { font-weight: 800; font-size: 1.2rem; min-width: 2.4em; text-align: center; }
.pe-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 10px 0; }
.pe-sum .plan-sum { margin: 0; }
.pe-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.pe-tools .btn { flex: 1 1 auto; }
.custom { margin: 10px 0; padding: 10px; background: var(--soft); border-radius: 16px; }
.custom .mushaf.edit .ayah { background: var(--card); margin-bottom: 6px; border: 1px solid var(--line); }
.mini-editor { border: 2px solid var(--amber); border-radius: 14px; padding: 10px; margin: 6px 0; background: var(--card); animation: rise .2s ease-out; }
.mini-editor .row { gap: 8px; }
.pe-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 18px; }
.add-row > span { font-weight: 800; }
.mode-switch { display: flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 4px; margin: 4px 0 10px; }
.mode-switch button { flex: 1; min-width: 0; border: 0; background: transparent; border-radius: 11px; padding: 8px 4px; font-weight: 700; cursor: pointer; color: var(--muted); font-size: .86rem; line-height: 1.3; }
.mode-switch button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.make .est { margin: 0 0 10px; font-weight: 700; color: var(--muted); text-align: center; }
.result { margin-top: 14px; display: grid; gap: 10px; }
.result .ok { color: var(--green); font-weight: 800; font-size: 1.2rem; text-align: center; }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); font-size: .9rem; }
.result .btns, .rec .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.result .btns .btn { flex: 1 1 140px; }
.pop-in { animation: popin .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes popin { from { opacity: 0; transform: scale(.92); } }
.qr { display: flex; justify-content: center; }
.qr img, .qr canvas { background: #fff; padding: 10px; border-radius: 14px; }

/* student */
.hero-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px; border-radius: 24px; margin-bottom: 14px;
  color: #fff; background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 55%, var(--hero-c) 100%); box-shadow: 0 10px 28px rgba(79, 70, 229, .3); animation: rise .35s ease-out both;
}
.hero-card h1 { color: #fff; font-size: 1.45rem; }
.hero-card .from { margin: 0 0 6px; opacity: .95; font-weight: 600; }
.hero-text { min-width: 0; }
.hero-stats { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.bubble { background: #fff7e0; border: 2px solid #ffe2a1; color: #5b4300; border-radius: 18px; padding: 12px 14px; margin: 0 0 14px; white-space: pre-line; position: relative; }
:root[data-theme="dark"] .bubble { background: #2b2614; border-color: #4d3f12; color: #f5e3b0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .bubble { background: #2b2614; border-color: #4d3f12; color: #f5e3b0; } }
.small-bubble { margin: 6px 0 8px; padding: 8px 12px; }
.name-ask label { font-weight: 800; display: block; margin-bottom: 8px; }
.name-ask input { flex: 1; min-width: 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: thin; }
.tab { flex: none; display: flex; flex-direction: column; align-items: flex-start; padding: 8px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer; text-align: start; transition: transform .12s; }
.tab .tab-kind { font-weight: 800; color: var(--k); }
.tab .tab-range { font-size: .85rem; color: var(--muted); }
.tab.on { border-color: var(--k); background: color-mix(in srgb, var(--k) 10%, var(--card)); transform: translateY(-2px); }
.tab.done .tab-kind::after { content: ''; }
.part { border-top: 6px solid var(--k); }
.part-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.kind-badge { background: color-mix(in srgb, var(--k) 14%, transparent); color: var(--k); border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.part h2 { font-size: 1.45rem; margin: 10px 0 0; }
.sub-ar { font-family: 'WajibHafs', serif; color: var(--muted); font-size: 1.1rem; }
.plan-sum { list-style: none; padding: 0; margin: 10px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.plan-sum li { background: var(--soft); border-radius: 12px; padding: 3px 10px; font-size: .9rem; font-weight: 700; }
.reciter-pill { display: flex; align-items: center; gap: 6px; background: var(--soft); border-radius: 14px; padding: 4px 10px; margin-bottom: 10px; }
.reciter-pill select { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 2px; font-weight: 700; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.tool { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 6px 10px; cursor: pointer; font-size: .9rem; font-weight: 700; color: var(--ink); }
.tool.on { background: #fff4d1; border-color: var(--amber); color: #5b4300; }
.tool-group { display: inline-flex; gap: 4px; }
.legend { background: var(--soft); border-radius: 14px; padding: 8px 12px; margin-bottom: 8px; }
.legend summary { cursor: pointer; font-weight: 700; }
.legend ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; font-size: .88rem; }
.legend .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-inline-end: 6px; vertical-align: -2px; }
.part-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 12px; }

/* Quran text */
.mushaf { --qfont: 32px; }
.surah-head { text-align: center; margin: 16px 0 4px; }
.surah-head span {
  display: inline-block; font-family: 'WajibHafs', serif; font-size: calc(var(--qfont) * .78); padding: 2px 28px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(47, 111, 222, .1), rgba(34, 176, 125, .12)); border: 2px solid rgba(47, 111, 222, .25);
}
.basmala { text-align: center; font-size: calc(var(--qfont) * .88); margin: 4px 0 8px; font-family: 'WajibHafs', serif; }
.basmala.indopak { font-family: 'wq-indopak', 'WajibHafs', serif; }
.ayah { padding: 6px 10px; border-radius: 16px; border: 2px solid transparent; transition: background .25s, border-color .25s; scroll-margin: 90px; }
.ayah + .ayah { margin-top: 2px; }
.ayah.extra { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.ayah.playing { background: var(--playing); border-color: var(--playing-line); box-shadow: 0 4px 14px rgba(255, 182, 39, .25); }
.ar { font-size: var(--qfont); line-height: 2.1; margin: 0; text-align: right; color: var(--ink); }
.ar.hafs { font-family: 'WajibHafs', 'Amiri Quran', serif; }
.ar.indopak { font-family: 'wq-indopak', 'WajibHafs', serif; line-height: 2.4; }
.ar.glyph { line-height: 2.05; word-spacing: -.04em; }
.w { border-radius: 10px; padding: 0 1px; cursor: pointer; transition: background .15s; }
.w:hover { background: color-mix(in srgb, var(--amber) 22%, transparent); }
.w.focus { background: var(--focus); box-shadow: inset 0 -3px 0 var(--amber); }
.num { font-size: inherit; color: var(--blue); background: none; border: 0; padding: 0 2px; cursor: pointer; border-radius: 10px; font-family: inherit; line-height: 1; }
.ar.hafs .num, .ar.indopak .num { font-size: calc(var(--qfont) * .9); }
.num:hover { background: var(--soft); }
.ayah-note { font-size: .92rem; margin: 2px 0 4px; }
.badge { display: inline-block; background: var(--amber); color: #3b2d00; border-radius: 999px; padding: 0 9px; font-size: .85rem; font-weight: 800; font-family: 'Cairo', sans-serif; vertical-align: middle; }
.tr { color: var(--ink); opacity: .88; font-size: 1rem; line-height: 1.75; margin: 2px 0 6px; }
.tl { color: var(--muted); font-size: .95rem; font-style: italic; margin: 0 0 6px; text-align: left; }
.tl u { text-decoration-color: var(--amber); }
/* Older phones that cannot recolour the tajweed font at night get a light mushaf page instead. */
@supports not (font-palette: normal) {
  :root[data-theme="dark"] .mushaf.tj { background: #fbf6e9; color: #1b2437; border-radius: 16px; padding: 4px; --playing: #fff1c2; }
  :root[data-theme="dark"] .mushaf.tj .ar { color: #1b2437; }
}
@media (prefers-color-scheme: dark) {
  @supports not (font-palette: normal) {
    :root:not([data-theme]) .mushaf.tj { background: #fbf6e9; color: #1b2437; border-radius: 16px; padding: 4px; --playing: #fff1c2; }
    :root:not([data-theme]) .mushaf.tj .ar { color: #1b2437; }
  }
}
/* self-test: words hidden until tapped (the colour layers of the tajweed font are hidden too) */
.mushaf.test-hide .w:not(.shown) .g, .mushaf.test-first .w:not(.first):not(.shown) .g { opacity: 0; }
.mushaf.test-hide .w:not(.shown), .mushaf.test-first .w:not(.first):not(.shown) {
  background: linear-gradient(to bottom, transparent 64%, color-mix(in srgb, var(--muted) 45%, transparent) 64%, color-mix(in srgb, var(--muted) 45%, transparent) 70%, transparent 70%);
  box-shadow: none; border-radius: 0;
}
.w.shown { animation: popin .25s ease-out; }

/* finish + recording */
.finish { display: grid; gap: 12px; }
.rec { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rec.on { color: var(--red); font-weight: 800; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
.rec audio { width: 100%; }
.rec-btn { background: var(--soft); border-color: transparent; }
@keyframes blink { 50% { opacity: .2; } }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 18px 8px; color: var(--muted); font-size: .92rem; text-align: center; }

/* the player at the bottom */
.player {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; color: #fff;
  background: linear-gradient(135deg, var(--bar-deep), var(--bar)); padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; box-shadow: 0 -8px 26px rgba(30, 58, 138, .3);
}
.pl-top { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.pl-info { flex: 1; min-width: 0; }
.pl-label { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: .82rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-ctrl { display: flex; align-items: center; gap: 2px; flex: none; }
.pl-ctrl .icon-btn.main { width: 58px; height: 58px; background: var(--amber); color: #1b2437; box-shadow: 0 4px 14px rgba(255, 182, 39, .45); }
.pl-ctrl .icon-btn.main svg { width: 30px; height: 30px; }
.pl-ctrl .icon-btn.main.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255, 182, 39, 0); transform: scale(1.04); } 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 182, 39, .5); } }
.pl-bar { max-width: 760px; margin: 6px auto 0; height: 5px; background: rgba(255, 255, 255, .22); border-radius: 5px; overflow: hidden; }
#pl-fill { height: 100%; width: 0; background: var(--amber); transition: width .3s; border-radius: 5px; }
[dir="rtl"] .pl-bar { transform: scaleX(-1); }
.turn { max-width: 760px; margin: 0 auto 8px; background: var(--amber); color: #1b2437; border-radius: 14px; padding: 8px 12px; font-weight: 800; text-align: center; font-size: 1.08rem; animation: popin .25s ease-out; }

/* bottom sheet */
#sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 30, .45); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
#sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41; max-height: 86vh; overflow: auto; background: var(--card);
  border-radius: 24px 24px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .25); animation: up .22s ease-out;
}
#sheet.tall { height: 86vh; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-inner { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 4px auto 12px; }
.sheet-title { font-weight: 800; font-size: 1.15rem; margin-bottom: 10px; }
.sheet-label { font-weight: 700; color: var(--muted); margin: 10px 0 6px; font-size: .9rem; }
.sheet-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sheet-btns .btn { flex: 1; }
#sheet .chips { margin-bottom: 8px; }
.word-big { font-size: 46px; text-align: center; line-height: 2; }
.word-big.hafs { font-family: 'WajibHafs', serif; }
.focus-note { background: #fff4d1; color: #5b4300; border-radius: 12px; padding: 8px 12px; margin: 6px 0; font-weight: 700; }
.word-info { text-align: center; min-height: 1.6em; }
.wi-tl { font-style: italic; color: var(--muted); }
.wi-tr { font-size: 1.2rem; font-weight: 800; }
.search { margin-bottom: 10px; position: sticky; top: 0; z-index: 1; }
.surah-list { display: grid; gap: 4px; }
.surah-row { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; text-align: start; }
.surah-row:hover, .surah-row.on { background: var(--soft); }
.surah-row .surah-ar { font-weight: 800; font-size: 1.1rem; }
.surah-row .surah-en { color: var(--muted); font-size: .9rem; }
.surah-row .surah-n { color: var(--muted); font-size: .8rem; }

/* celebration */
.celebrate { position: fixed; inset: 0; z-index: 80; background: rgba(10, 16, 30, .5); display: grid; place-items: center; animation: fade .2s; }
.celebrate canvas { position: absolute; inset: 0; pointer-events: none; }
.celebrate-card { position: relative; background: var(--card); border-radius: 28px; padding: 26px 24px; text-align: center; width: min(88vw, 360px); animation: popin .45s cubic-bezier(.2, 1.5, .4, 1); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.celebrate-big { font-size: 4.2rem; line-height: 1.2; animation: bob 1.6s ease-in-out infinite; }
.celebrate-text { font-weight: 800; font-size: 1.2rem; margin: 6px 0 16px; }

#toast {
  position: fixed; inset-inline: 16px; bottom: 140px; z-index: 90; max-width: 520px; margin: 0 auto; text-align: center;
  background: #1b2437; color: #fff; padding: 12px 16px; border-radius: 16px; font-weight: 700;
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }

@media (max-width: 400px) {
  .hero-card { padding: 16px 14px; }
  .hero-card h1 { font-size: 1.22rem; }
  .brand span { font-size: .98rem; }
  .lang-pick select { max-width: 30vw; }
}
@media (min-width: 700px) {
  h1 { font-size: 1.75rem; }
  .wrap { padding: 22px 20px; }
  .hero h1 { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* the printed mushaf page (15 lines, fitted to the width) */
.mushaf.pages { padding: 2px 0; }
.mpage { background: var(--page-bg); border: 2px solid var(--page-line); border-radius: 16px; padding: 12px 12px 6px; margin: 10px auto; max-width: 600px; box-shadow: var(--shadow); }
.mpage-lines { --pf: 26px; direction: rtl; }
.mpage .ln { display: flex; justify-content: space-between; align-items: center; white-space: nowrap; font-size: var(--pf); line-height: 1.95; min-height: calc(var(--pf) * 1.95); }
.mpage .ln.center { justify-content: center; gap: .18em; }
.mpage .ln.head, .mpage .ln.bsm { justify-content: center; font-family: 'WajibHafs', serif; }
.mpage .ln.head span { font-size: .72em; padding: 0 1.6em; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--blue) 35%, transparent); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.mpage .ln.bsm { font-size: calc(var(--pf) * .82); }
.mpage-lines.measure .ln { width: max-content; justify-content: flex-start; }
.mpage .w, .mpage .num { padding: 0; border-radius: 6px; font-size: inherit; line-height: inherit; }
.mpage .playing { background: var(--playing); box-shadow: inset 0 -3px 0 var(--playing-line); }
.mushaf.focus-dim .mpage .out { opacity: .28; }
.mushaf.focus-only .mpage .out { visibility: hidden; }
.mpage-no { text-align: center; font-size: .85rem; color: var(--muted); font-weight: 700; padding-top: 2px; }
.ayah-no { display: inline-block; font-size: .78rem; font-weight: 800; color: var(--blue); background: var(--soft); border-radius: 999px; padding: 0 10px; }
.views { margin-top: -4px; }

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-swatch { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; color: var(--ink); text-align: start; }
.theme-swatch.on { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.theme-swatch .sw { flex: none; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--sw-bg) 50%, var(--sw-ac) 50%); border: 1px solid rgba(0, 0, 0, .12); }

/* ready-made programs */
.programs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.program { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer; text-align: start; color: var(--ink); transition: transform .12s, border-color .15s; }
.program:hover { border-color: var(--blue); transform: translateY(-2px); }
.program-icon { flex: none; font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--soft); border-radius: 14px; }
.program-text b { display: block; }
.program-text small { color: var(--muted); }

/* badges and the leaderboard */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--soft); opacity: .35; filter: grayscale(1); text-align: center; }
.badge-item.got { opacity: 1; filter: none; animation: popin .4s ease-out; }
.badge-item span { font-size: 1.8rem; }
.badge-item small { font-size: .74rem; font-weight: 700; line-height: 1.3; }
.board-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.board-list li { display: grid; grid-template-columns: 2.2em 1fr auto; align-items: center; gap: 8px; background: var(--soft); border-radius: 12px; padding: 8px 12px; font-weight: 700; }
.board-list li.me { outline: 2px solid var(--amber); }
.big-board .board-list li { font-size: 1.1rem; padding: 12px 14px; }
.pill.solid { background: var(--amber); color: #3b2d00; }
.board-link { margin-bottom: 14px; }

/* AI helper and the personal key */
.ai-box { border-style: dashed; background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 9%, var(--card)), var(--card)); }
.ai-box .row { align-items: stretch; margin-top: 8px; }
.ai-box textarea { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 14px; padding: 10px; background: var(--bg); resize: vertical; }
.key-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--soft); border-radius: 14px; padding: 10px 14px; }
.key-box b { font-size: 1.2rem; letter-spacing: .08em; }
.restore { margin-top: 10px; }
.restore input { flex: 1; min-width: 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); text-transform: uppercase; }