/* Jom Hafaz — same family as Jom Usrah (Inter, KFGQPC mushaf fonts, soft cards), with a teal-blue accent. */
@font-face { font-family: "Surah Names"; src: url("/fonts/sura_names.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "KFGQPC Hafs"; src: url("/fonts/UthmanicHafs1Ver18.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #f0f0f3; --text: #1d1d1f; --text-2: #6e6e73; --text-3: #8e8e93;
  --line: rgba(0, 0, 0, 0.08); --accent: #0b6e8a; --accent-2: #1a9bb8; --accent-soft: rgba(11, 110, 138, 0.1); --on-accent: #fff;
  --gold: #b7892b; --danger: #c62f37; --warn: #a15c00; --ok: #0a7d5a;
  --sheet: #ffffff; --sheet-text: #1d1d1f; --hidden-slot: rgba(11, 110, 138, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 20px; --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ar: "KFGQPC Hafs", "Amiri Quran", "Noto Naskh Arabic", serif;
  --ar-size: 30px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.1); --accent: #3cc3e0; --accent-2: #6fd6ec; --accent-soft: rgba(60, 195, 224, 0.15); --on-accent: #00262f;
    --sheet: #1c1a15; --sheet-text: #f1ead8; --hidden-slot: rgba(60, 195, 224, 0.16); --ok: #30d19a; --danger: #ff6b6b; --warn: #f0b45a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93;
  --line: rgba(255, 255, 255, 0.1); --accent: #3cc3e0; --accent-2: #6fd6ec; --accent-soft: rgba(60, 195, 224, 0.15); --on-accent: #00262f;
  --sheet: #1c1a15; --sheet-text: #f1ead8; --hidden-slot: rgba(60, 195, 224, 0.16); --ok: #30d19a; --danger: #ff6b6b; --warn: #f0b45a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); color-scheme: dark;
}
:root[data-size="s"] { --ar-size: 24px; }
:root[data-size="l"] { --ar-size: 36px; }
:root[data-size="xl"] { --ar-size: 44px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.2; }
.title { margin: 8px 0 14px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.gap { gap: 8px; }
.ar { font-family: var(--font-ar); direction: rtl; }

/* layout */
main { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.page { max-width: 720px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 24px; }
.page.narrow { max-width: 560px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.pad { padding: 20px; }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin: 24px 4px 8px; font-weight: 600; }
.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.skel { height: 64px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 12px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; font-size: 11px; font-weight: 500; color: var(--text-2); border-radius: 12px; min-width: 64px; }
.tabs a.on { color: var(--accent); }
.tabs svg { width: 22px; height: 22px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; transition: transform 0.1s, opacity 0.2s; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.ghost.on { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.on.p-mic, .p-mic.on { background: var(--danger); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 999px; background: var(--surface-2); font-size: 14px; font-weight: 500; }
.chip.sm { padding: 5px 10px; font-size: 13px; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip svg { width: 16px; height: 16px; }
.chips { display: flex; gap: 8px; margin: 14px 0; }
.chips.wrap { flex-wrap: wrap; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: var(--surface-2); font-size: 22px; flex: none; }
.input, .select { width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.select { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field > span { font-size: 14px; font-weight: 600; }
.form .field:first-child { margin-top: 0; }
.switch { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg.big { display: flex; }
.seg.big button { flex: 1; padding: 10px; font-size: 15px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* wizard */
.wz-bar { height: 4px; background: var(--surface-2); border-radius: 4px; margin: 6px 0 18px; overflow: hidden; }
.wz-bar div { height: 100%; background: var(--accent); transition: width 0.3s; }
.wz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.opt { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 13px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }

/* home */
.hello { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 16px; }
.hello p { margin: 0; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 18px; flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.stat b small { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat span { font-size: 12px; color: var(--text-2); }
.tasks { display: flex; flex-direction: column; gap: 10px; }
.task { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.task p { margin: 2px 0 0; }
.task.done { box-shadow: none; background: transparent; }
.task-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--surface-2); font-weight: 700; color: var(--text-2); flex: none; font-size: 20px; }
.task-ico.new { background: var(--accent); color: var(--on-accent); font-size: 17px; }
.task-ico.sabqi { background: #e8f3ff; color: #1f62b5; font-size: 17px; }
.task-ico.manzil { background: #fff3e0; color: #a15c00; font-size: 17px; }
.task.done .task-ico { color: var(--ok); }
.list { overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; margin: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { display: flex; flex-direction: column; }
.li.on { background: var(--accent-soft); }
.bar { display: block; height: 6px; border-radius: 6px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.small-ar { font-size: 18px; color: var(--text-2); text-align: right; }

/* session */
.s-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.s-head p { margin: 0; }
.s-head h1 { margin: 0; }
.steps { display: flex; gap: 6px; margin: 6px 0 12px; }
.steps span { flex: 1; text-align: center; font-size: 12px; font-weight: 600; padding: 6px 0; border-radius: 999px; background: var(--surface-2); color: var(--text-3); }
.steps span.on { background: var(--accent); color: var(--on-accent); }
.steps span.done { background: var(--accent-soft); color: var(--accent); }
.lead { color: var(--text-2); font-size: 15px; margin: 4px 0 12px; }
.sheet { background: var(--sheet); color: var(--sheet-text); padding: 18px 16px; }
.tr { font-size: 15px; color: var(--text-2); margin: 14px 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
.s-actions { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; flex-wrap: wrap; }
.counter { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; }
.dot { width: 26px; height: 26px; border-radius: 999px; border: 2px solid var(--accent); }
.dot.on { background: var(--accent); }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 18px; }
.grades .btn { padding: 0 8px; font-size: 14px; }
.btn.again { background: var(--danger); color: #fff; }
.btn.some { background: var(--warn); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.done-card { margin-top: 30px; }
.big-ico { font-size: 52px; }
.ok-text { color: var(--ok); display: flex; align-items: center; justify-content: center; gap: 6px; }

/* verses and hiding */
.verses { font-size: var(--ar-size); line-height: 2; text-align: right; }
.ayah { display: inline; }
.w { display: inline-block; cursor: pointer; border-radius: 8px; position: relative; transition: background 0.15s; }
.w-h { display: none; }
.w-m { display: block; font-family: var(--font); font-size: 12px; line-height: 1.3; color: var(--text-2); text-align: center; direction: ltr; max-width: 9em; margin: -4px auto 4px; }
.v-end { display: inline-grid; place-items: center; min-width: 1.3em; height: 1.3em; font-size: 0.6em; border: 1.5px solid var(--gold); border-radius: 999px; color: var(--gold); line-height: 1; margin: 0 0.15em; vertical-align: middle; }
/* hidden: the word keeps its place as a soft slot */
.m-hide .w:not(.on):not(.miss) .w-t { color: transparent; }
.m-hide .w:not(.on):not(.miss) { background: linear-gradient(transparent 28%, var(--hidden-slot) 28%, var(--hidden-slot) 82%, transparent 82%); }
.m-hint .w:not(.on):not(.miss) .w-t { display: none; }
.m-hint .w:not(.on):not(.miss) .w-h { display: inline; color: var(--text-3); }
.m-faint .w:not(.on):not(.miss) .w-t { opacity: 0.15; }
.w.on { animation: wIn 0.25s ease-out; }
.w.on.peek .w-t { color: var(--warn); }
.w.miss { background: rgba(198, 47, 55, 0.12); }
.w.miss .w-t { color: var(--danger); }
@keyframes wIn { from { opacity: 0; transform: translateY(3px); } }
.p-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.p-prog { margin-left: auto; }
.p-heard { direction: rtl; text-align: right; color: var(--text-2); margin: 4px 0; }

/* progress */
.juz-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.juz { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; font-size: 13px; }
.juz::before { content: ""; position: absolute; inset: auto 0 0 0; height: calc(var(--p) * 100%); background: var(--accent-soft); }
.juz b, .juz span { position: relative; }
.juz span { font-size: 10px; color: var(--accent); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 320px; }
.cal i { aspect-ratio: 1; border-radius: 5px; background: var(--surface-2); }
.cal i.l1 { background: color-mix(in srgb, var(--ok) 40%, transparent); }
.cal i.l2 { background: color-mix(in srgb, var(--ok) 70%, transparent); }
.cal i.l3 { background: var(--ok); }
.cal i.lu { background: #8e6bd6; opacity: 0.6; }
.about { margin-top: 30px; line-height: 1.6; }

/* mushaf (from Jom Usrah) */
.mushaf-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mushaf-bar .select { flex: 1; }
.m-pageno { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.m-pageno .input { width: 62px; padding: 0 6px; }
.mushaf-sheet { background: var(--sheet); color: var(--sheet-text); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px 10px; border: 1px solid var(--line); touch-action: pan-y; }
.m-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-2); padding-bottom: 8px; border-bottom: 1px solid rgba(183, 137, 43, 0.25); margin-bottom: 6px; }
.m-head select { font: inherit; color: inherit; background: transparent; border: 0; }
.m-foot { text-align: center; font-size: 13px; color: var(--text-2); padding-top: 6px; }
.m-lines { font-family: var(--font-ar); line-height: 2.05; text-align: initial; }
.m-line { display: flex; justify-content: space-between; align-items: baseline; white-space: nowrap; gap: 0.12em; }
.m-line.short, .m-lines.centered .m-line { justify-content: center; gap: 0.35em; }
.m-lines.measure .m-line { justify-content: flex-start; width: max-content; gap: 0.35em; }
.m-lines .w { display: inline; border-radius: 6px; }
.m-lines .m-line:not(.m-title) { -webkit-text-stroke: 0.025em currentColor; paint-order: stroke fill; }
.m-lines.m-hide .w:not(.on):not(.miss) .w-t { -webkit-text-stroke: 0; }
.m-end { color: inherit; }
.m-lines:not(.qcf) .m-end { display: inline-grid; place-items: center; min-width: 1.25em; height: 1.25em; font-size: 0.62em; border: 1.5px solid var(--gold); border-radius: 999px; color: var(--gold); line-height: 1; }
.m-bism { justify-content: center; font-size: 0.95em; font-family: var(--font-ar); }
.m-lines .m-title { position: relative; display: block; margin: 0.15em 0; }
.m-frame { display: block; width: 100%; height: auto; }
.m-frame .m-cart { fill: var(--sheet); }
.m-sname { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; gap: 0.25em; font-family: "Surah Names"; font-size: 1.7em; line-height: 1; direction: ltr; }

/* modal and toast */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.4); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 440px; width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 90; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .grades .btn { font-size: 13px; }
  .stat b { font-size: 19px; }
  .juz-grid { grid-template-columns: repeat(5, 1fr); }
}
