/* ==========================================================================
   Tathbeet — design system
   Concept: a gilded mushaf page on pale violet paper; the heart is the focal element.
   ========================================================================== */

/* ---------- Fonts (self-hosted, OFL license) ---------- */
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap;
  src: url("../fonts/tajawal-arabic-400-normal.d595af28c13f.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap;
  src: url("../fonts/tajawal-arabic-500-normal.899cfbe65444.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap;
  src: url("../fonts/tajawal-arabic-700-normal.10367de774c9.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap;
  src: url("../fonts/tajawal-arabic-800-normal.93993923a466.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap;
  src: url("../fonts/tajawal-latin-400-normal.f18eb7346bae.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap;
  src: url("../fonts/tajawal-latin-700-normal.e9c38c1110be.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap;
  src: url("../fonts/amiri-arabic-400-normal.b640f7cc5918.woff2") format("woff2"); }
@font-face { font-family: "Amiri"; font-weight: 700; font-display: swap;
  src: url("../fonts/amiri-arabic-700-normal.bb99562a6788.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --paper: #f4effb;        /* pale violet paper */
  --surface: #fdfbff;
  --ink: #2a1640;          /* aubergine ink */
  --ink-soft: #5d4a78;
  --line: #e2d6f3;
  --violet: #6d28d9;
  --violet-strong: #4c1d95;
  --violet-soft: #ede4fb;
  --gold: #b8862f;         /* mushaf gilding */
  --gold-soft: #f3e6c8;
  --danger: #be123c;
  --ok: #047857;
  --violet-mark: #6d28d9;   /* heart color in the logo mark */
  --memorized: #7c3aed;     /* fill for a memorized surah */
  --cell-empty: #fffdfd;
  --cell-stroke: #4c1d95;
  --cell-text: #2a1640;
  --shadow: 0 1px 0 rgba(76, 29, 149, .06), 0 12px 32px -18px rgba(76, 29, 149, .35);

  --font-ui: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-quran: "Amiri", "Traditional Arabic", serif;

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #160c24; --surface: #1f1233; --ink: #f1e9fc; --ink-soft: #c2b0dc;
    --line: #3a2658; --violet: #a78bfa; --violet-strong: #c4b5fd; --violet-soft: #2c1a49;
    --gold: #d9b26a; --gold-soft: #3a2c16; --violet-mark: #8b5cf6; --memorized: #7c3aed; --danger: #fb7185; --ok: #34d399;
    --cell-empty: #251640; --cell-stroke: #b9a2ee; --cell-text: #f1e9fc;
    --shadow: 0 12px 32px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.75;
}
a { color: var(--violet); text-underline-offset: 4px; }
a:hover { color: var(--violet-strong); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 var(--s3); font-weight: 800; }
h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.8rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--s4); max-width: 68ch; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }
main { flex: 1; padding-block: var(--s6) var(--s7); }
.muted { color: var(--ink-soft); }
.quran { font-family: var(--font-quran); }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; gap: var(--s4); min-height: 64px; }
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.25rem; }
.brand .logo { display: block; height: 52px; width: auto; border-radius: 10px; }
.nav { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--ink-soft); text-decoration: none; padding: var(--s1) var(--s2); border-radius: var(--r-sm); font-weight: 500; }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: var(--violet-strong); background: var(--violet-soft); }
.about-icon { display: none; inline-size: 22px; block-size: 22px; }
.avatar {
  inline-size: 36px; block-size: 36px; border-radius: 50%; display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 1rem; flex: none;
}
.avatar.lg { inline-size: 64px; block-size: 64px; font-size: 1.7rem; }
.user-chip { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--ink); font-weight: 500; }

/* ---------- Buttons & fields ---------- */
.btn {
  --bg: var(--violet); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5); border-radius: 999px; border: 2px solid var(--bg);
  background: var(--bg); color: var(--fg); font: 700 1rem var(--font-ui); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}
.btn:hover { --bg: var(--violet-strong); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--violet-strong); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--violet); background: var(--violet-soft); }
.btn.danger { --bg: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 var(--s4); font-size: .92rem; }
.btn.block { width: 100%; }
@media (prefers-color-scheme: dark) { .btn { --fg: #1a0e2c; } .btn.danger { --fg: #fff; } }

.field { margin-bottom: var(--s4); }
.field label { display: block; font-weight: 700; margin-bottom: var(--s1); }
.input {
  width: 100%; min-height: 48px; padding: var(--s2) var(--s3); font: 1.05rem var(--font-ui); color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s ease;
}
.input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
.help { font-size: .88rem; color: var(--ink-soft); margin-top: var(--s1); }
.errorlist { list-style: none; padding: 0; margin: var(--s1) 0 0; color: var(--danger); font-size: .92rem; font-weight: 500; }
.form-errors { background: color-mix(in srgb, var(--danger) 10%, transparent); border-inline-start: 4px solid var(--danger); padding: var(--s3) var(--s4); border-radius: var(--r-sm); margin-bottom: var(--s4); }
.choices { display: grid; gap: var(--s2); padding: 0; margin: 0; list-style: none; }
.choices label { display: flex; align-items: center; gap: var(--s2); font-weight: 500; cursor: pointer; }
.choices input { accent-color: var(--violet); inline-size: 20px; block-size: 20px; }
.check { display: flex; align-items: flex-start; gap: var(--s2); font-weight: 500; }
.check input { accent-color: var(--danger); inline-size: 20px; block-size: 20px; margin-top: 5px; }

/* Avatar color picker */
.swatches { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; padding: 0; margin: 0; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches .dot { display: block; inline-size: 40px; block-size: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--line); }
.swatches input:checked + .dot { box-shadow: 0 0 0 3px var(--ink); }
.swatches input:focus-visible + .dot { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- Flash messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s2); }
.messages li { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--violet); }
.messages .success { border-inline-start-color: var(--ok); }
.messages .error { border-inline-start-color: var(--danger); }

/* ---------- Mushaf panel (gilded frame) ---------- */
.mushaf {
  position: relative; background: var(--surface); border-radius: var(--r-lg);
  padding: clamp(.9rem, 2.5vw, 2rem); box-shadow: var(--shadow);
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold); outline-offset: -9px;
}
.mushaf::before, .mushaf::after {
  content: "۞"; position: absolute; top: 2px; color: var(--gold); font-size: 1.2rem; line-height: 1;
  padding: 0 .35rem; background: var(--surface);
}
.mushaf::before { inset-inline-start: 22px; }
.mushaf::after { inset-inline-end: 22px; }
.basmala { font-family: var(--font-quran); font-size: clamp(1.4rem, 1rem + 1.8vw, 2.2rem); text-align: center; margin: var(--s2) 0 var(--s3); color: var(--ink); }
.ayah-foot { font-family: var(--font-quran); text-align: center; font-size: clamp(1.15rem, .95rem + 1vw, 1.6rem); margin: var(--s3) 0 0; color: var(--ink); }
.ayah-foot small { display: block; font-family: var(--font-ui); font-size: .85rem; color: var(--ink-soft); }

/* ---------- Surah map ---------- */
/* touch-action: manipulation keeps native scroll and pinch-zoom but removes double-tap zoom,
   so a quick double tap can't zoom the page or be read as two toggles. */
.heart-svg {
  display: block; width: 100%; height: auto; margin-inline: auto;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.heart-svg .cell { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: center; }
.heart-svg .cell path { fill: var(--cell-empty); stroke: var(--cell-stroke); stroke-width: 1.6; stroke-linejoin: round; transition: fill .3s ease; }
.heart-svg .cell .paint { stroke: none; pointer-events: none; }
.heart-svg .cell text {
  font-family: var(--font-quran); font-weight: 700; fill: var(--cell-text); pointer-events: none;
  text-anchor: middle; dominant-baseline: central; transition: fill .2s ease;
}
/* Fill comes from the chosen color (inline style); the label switches to the more readable ink */
.heart-svg .cell.on text { fill: #22113a; }
.heart-svg .cell.on.light text { fill: #ffffff; }
.heart-svg .cell:focus-visible path { stroke: var(--gold); stroke-width: 5; }
@media (hover: hover) { .heart-svg .cell:hover path { stroke-width: 3.2; } }
.heart-svg .outline { fill: none; stroke: var(--cell-stroke); stroke-width: 5; pointer-events: none; }
/* A small bounce when a surah is colored */
.heart-svg .cell.pop { animation: cell-pop .38s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes cell-pop { 0% { transform: scale(1); } 45% { transform: scale(1.09); } 100% { transform: scale(1); } }

/* ---------- Tracker (board page and guest demo) ---------- */
.tracker { width: min(760px, 100%); margin-inline: auto; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.board-head h1 { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.tracker-hint { color: var(--ink-soft); margin: 0 0 var(--s3); }

/* Sticky bar: progress, pen colors and tools, always within thumb reach */
.tracker-bar {
  position: sticky; bottom: 0; z-index: 20; margin-top: var(--s4);
  display: grid; gap: var(--s2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--s3) var(--s4) calc(var(--s2) + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px -16px rgba(42, 22, 64, .35);
}
.bar-row { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.tracker-count { margin: 0; white-space: nowrap; font-size: .95rem; color: var(--ink-soft); }
.tracker-count b { display: inline-block; font-size: 1.6rem; color: var(--violet-strong); font-variant-numeric: tabular-nums; }
.tracker-count b.bump { animation: count-bump .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes count-bump { 40% { transform: scale(1.35); color: var(--gold); } }
.tracker-actions { display: flex; gap: var(--s2); flex: none; }
.save-state { margin: 0; min-height: 1.1em; font-size: .8rem; color: var(--ink-soft); }
.save-state[data-state="saving"] { color: var(--gold); }
.save-state[data-state="error"] { color: var(--danger); font-weight: 700; }
.save-state[data-state="saved"] { color: var(--ok); }

.meter { flex: 1; block-size: 12px; border-radius: 999px; background: var(--violet-soft); overflow: hidden; }
.meter span {
  display: block; block-size: 100%; border-radius: 999px; transition: inline-size .6s cubic-bezier(.22, 1, .36, 1);
  background: linear-gradient(90deg, var(--violet), #a855f7, var(--gold), var(--violet));
  background-size: 300% 100%; animation: meter-flow 6s linear infinite;
}
@keyframes meter-flow { to { background-position: 300% 0; } }

/* Pen colors */
.pens { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; padding: 4px; scrollbar-width: none; }
.pens::-webkit-scrollbar { display: none; }
.pen {
  flex: none; inline-size: 34px; block-size: 34px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--pen); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pen[aria-checked="true"] { transform: scale(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.pen:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pen-custom {
  position: relative; display: grid; place-items: center; overflow: hidden;
  background: conic-gradient(#e11d48, #f59e0b, #facc15, #16a34a, #0284c7, #7c3aed, #db2777, #e11d48);
}
.pen-custom[aria-checked="true"] { background: var(--pen); }
.pen-custom::after { content: "+"; font: 800 1.1rem/1 var(--font-ui); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); pointer-events: none; }
.pen-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; inline-size: 100%; block-size: 100%; }

.tool-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.tool-btn {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-sm);
  font: 700 .92rem var(--font-ui); cursor: pointer; padding: 0 var(--s3); white-space: nowrap;
}
.tool-btn:hover { border-color: var(--violet); }
.tool-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { inline-size: 42px; padding: 0; flex: none; }
.icon-btn svg { inline-size: 22px; block-size: 22px; }

/* Toast: names the surah, adds a word of encouragement, offers undo */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 2rem);
  display: flex; align-items: center; gap: var(--s3);
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: var(--s2) var(--s2) var(--s2) var(--s4);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45); font-weight: 700;
}
.toast[hidden] { display: none; }
.toast.in { animation: toast-in .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
.toast-body { display: grid; line-height: 1.35; }
.toast-body small { font-weight: 500; opacity: .85; font-size: .85rem; }
.toast-body small[hidden] { display: none; }
.toast.celebrate {
  border-radius: var(--r-lg); padding: var(--s3) var(--s4); font-size: 1.15rem;
  background: linear-gradient(135deg, var(--violet-strong), var(--violet) 55%, var(--gold));
  color: #fff; box-shadow: 0 16px 40px -12px rgba(109, 40, 217, .65);
}
.toast-undo {
  min-height: 36px; border: 0; border-radius: 999px; padding: 0 var(--s3); cursor: pointer;
  background: var(--gold); color: #22113a; font: 800 .92rem var(--font-ui);
}
.toast-undo[hidden] { display: none; }
.confetti { position: fixed; inset: 0; inline-size: 100vw; block-size: 100vh; z-index: 50; pointer-events: none; }

dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); background: var(--surface); color: var(--ink); width: min(520px, calc(100% - 2rem)); }
dialog::backdrop { background: rgba(22, 12, 36, .55); }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.range label { display: grid; gap: var(--s1); font-weight: 700; }

/* ---------- Dashboard ---------- */
.page-head { margin-bottom: var(--s5); }
.page-head h1 { margin-bottom: var(--s1); }
.board-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); align-items: start; }
.board-tile {
  display: grid; gap: var(--s1); padding: var(--s4); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.board-tile:hover { border-color: var(--violet); color: var(--ink); }
.board-tile h2 { margin: 0; font-size: 1.2rem; }
.tile-count { margin: 0; }
.tile-count b { color: var(--violet-strong); font-size: 1.25rem; }
.board-tile .meta { font-size: .85rem; color: var(--ink-soft); }
.new-board { border: 2px dashed var(--line); border-radius: var(--r-md); padding: var(--s4); }
.new-board h2 { font-size: 1.2rem; }
.heart-mini { display: block; width: 100%; max-width: 200px; height: auto; margin: 0 auto var(--s2); }
.heart-mini path { fill: var(--cell-empty); stroke: var(--cell-stroke); stroke-width: 2; stroke-linejoin: round; }
.heart-mini path.on { fill: var(--memorized); }
.heart-mini .outline { fill: none; stroke-width: 6; }

/* ---------- Landing page ---------- */
.intro { width: min(760px, 100%); margin: 0 auto var(--s5); }
.hero-ayah { font-family: var(--font-quran); font-size: clamp(1.3rem, 1rem + 1vw, 1.7rem); color: var(--gold); margin: 0 0 var(--s2); }
.intro h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3rem); }
.intro .lead { font-size: 1.15rem; color: var(--ink-soft); }
.intro .actions { display: flex; gap: var(--s3); flex-wrap: wrap; margin: var(--s4) 0 var(--s2); }
.guest-note { font-size: .92rem; margin: 0; }

/* ---------- Auth pages ---------- */
.auth { width: min(460px, 100%); margin-inline: auto; }
.auth .mushaf { padding: var(--s6) clamp(1.1rem, 4vw, 2.4rem); }
.auth h1 { text-align: center; font-size: 1.8rem; }
.auth .sub { text-align: center; color: var(--ink-soft); margin-inline: auto; }
.auth .alt { text-align: center; margin: var(--s4) 0 0; }
.narrow { width: min(640px, 100%); margin-inline: auto; }
.profile-head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s5); }
.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); border-radius: var(--r-md); padding: var(--s4); margin-top: var(--s6); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--s5) 0; font-size: .92rem; color: var(--ink-soft); text-align: center; }
.site-footer p { margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .site-header .container { gap: var(--s2); }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  /* One-row header on phones: logo, then a compact nav */
  .site-header .container { min-height: 56px; padding-block: var(--s1); }
  .brand .logo { height: 42px; border-radius: 8px; }
  .nav { gap: var(--s1); flex-wrap: nowrap; }
  .nav a:not(.btn) { padding: var(--s1) 6px; font-size: .92rem; white-space: nowrap; }
  .nav .btn { white-space: nowrap; }
  .nav .btn.sm { min-height: 34px; padding: 0 var(--s3); font-size: .85rem; }
  .user-chip span:not(.avatar) { display: none; }
  .avatar { inline-size: 32px; block-size: 32px; font-size: .9rem; }
  /* "About" stays reachable on phones as a compact info icon */
  .nav a.about-link { display: inline-grid; place-items: center; padding: 6px; }
  .nav a.about-link .about-text { display: none; }
  .nav a.about-link .about-icon { display: block; }
  main { padding-block: var(--s3) 0; }
  .intro h1 { font-size: 1.7rem; }
  .intro .actions .btn { flex: 1; white-space: nowrap; padding-inline: var(--s3); }
  .board-head h1 { font-size: 1.35rem; }
  .board-head-actions .btn.sm { font-size: .82rem; padding: 0 var(--s3); }
  .tracker-hint { font-size: .9rem; }
  /* Give the map the full screen width on phones: bigger cells = fewer mistaken taps */
  .tracker .mushaf { margin-inline: -1rem; border-radius: 0; border-inline: 0; outline: none; padding: var(--s2) 2px; box-shadow: none; }
  .tracker .mushaf::before, .tracker .mushaf::after { display: none; }
  .basmala { font-size: 1.35rem; margin-block: var(--s1) var(--s2); }
  .ayah-foot { font-size: 1.1rem; }
  .tracker-bar { margin-inline: -1rem; border-inline: 0; border-radius: var(--r-md) var(--r-md) 0 0; padding: var(--s2) var(--s3) calc(var(--s1) + env(safe-area-inset-bottom)); gap: 6px; }
  .bar-row { gap: var(--s2); }
  .tracker-count { font-size: .85rem; }
  .tracker-count b { font-size: 1.35rem; }
  .pen { inline-size: 32px; block-size: 32px; }
  .tracker-actions .tool-btn { min-height: 38px; padding: 0 10px; font-size: .85rem; }
  .icon-btn { inline-size: 38px; }
  .toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .board-page .site-footer { padding-block: var(--s3); }
  .board-page .site-footer p:not(.source-credit) { display: none; }
}
@media (max-width: 380px) {
  .tracker-count span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .site-header, .site-footer, .no-print, .tracker-bar, .tracker-hint, .toast { display: none !important; }
  .mushaf { box-shadow: none; }
}

/* Quran quotes rendered from the registry ({% quran %} tag) */
.quran-quote { font-family: var(--font-quran); }
.quran-ref { font-family: var(--font-ui); font-style: normal; font-size: .6em; color: var(--ink-soft); white-space: nowrap; }
.ayah-foot .quran-ref { display: block; font-size: .85rem; margin-top: var(--s1); }
.about-ayah { font-size: 1.5rem; line-height: 2; }
/* About page: "under development" note */
.dev-note { margin-block: var(--s5); padding: var(--s4) var(--s5); border-radius: var(--r-md, 14px); background: var(--violet-soft); border: 1px solid var(--line); }
.dev-note h2 { margin-top: 0; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.dev-note p:last-child { margin-bottom: 0; }
.dev-badge { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--gold, #c8962e); color: #1a1033; }
.source-credit { font-size: .82rem; margin-top: var(--s1) !important; }

/* ---------- Shape picker ---------- */
.board-head-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.shape-dialog { width: min(640px, calc(100% - 1.5rem)); }
.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-top: var(--s3); }
.shape-option { position: relative;
  display: grid; justify-items: center; gap: var(--s1); padding: var(--s2);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--r-md); font: 700 .95rem var(--font-ui);
}
.shape-option:hover { border-color: var(--violet); color: var(--ink); }
.shape-option[aria-current="true"], .shape-option:has(input:checked) { border-color: var(--violet-strong); background: var(--violet-soft); }
.shape-option .heart-mini { max-width: 150px; margin: 0; }
.shape-option input { position: absolute; opacity: 0; pointer-events: none; }
.shape-option:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.shape-field { border: 0; padding: 0; margin: 0 0 var(--s4); }
.shape-field legend { font-weight: 700; margin-bottom: var(--s1); }
.shape-grid.compact { grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: 0; }
.shape-grid.compact .shape-option { padding: var(--s1); font-size: .85rem; }
.shape-grid.compact .heart-mini { max-width: 64px; }
.shape-grid.compact .heart-mini path { stroke-width: 3; }
@media (max-width: 560px) { .shape-grid:not(.compact) { grid-template-columns: repeat(2, 1fr); } }
.shape-option span { text-align: center; line-height: 1.4; }
.input[readonly] { background: var(--violet-soft); color: var(--ink-soft); cursor: not-allowed; }
.tile-goal { margin: 0; font-size: .88rem; font-weight: 700; color: var(--gold); }
.board-tile .meter { flex: none; block-size: 8px; }

/* ---------- Feedback page: private review + contact ---------- */
.feedback-card { margin-bottom: var(--s5); }
.feedback-card h2 { margin-top: 0; }
.stars-field { border: 0; padding: 0; margin: 0 0 var(--s4); }
.stars-field legend { font-weight: 700; margin-bottom: var(--s2); }
/* Radios come 5..1; row-reverse puts 1 at the start (right in RTL), and "~" lights the stars after the hovered/checked one */
.stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label {
  inline-size: 44px; block-size: 44px; cursor: pointer; transition: transform .15s ease;
  background: var(--line);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6-4.9-4.6 6.6-.8z'/%3E%3C/svg%3E") center / 36px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6-4.9-4.6 6.6-.8z'/%3E%3C/svg%3E") center / 36px no-repeat;
}
.stars input:checked ~ label,
.stars label:hover, .stars label:hover ~ label { background: var(--gold); }
.stars label:hover { transform: scale(1.12); }
.stars input:focus-visible + label { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 8px; }
.footer-links { margin-top: var(--s1) !important; }
.footer-links a { color: var(--violet-strong); }
@media (prefers-reduced-motion: reduce) { .stars label { transition: none; } .stars label:hover { transform: none; } }

/* Very narrow phones (≈320–380px): tighten the header so nothing overflows */
@media (max-width: 380px) {
  .site-header .container { gap: 4px; }
  .brand .logo { height: 36px; }
  .nav { gap: 2px; }
  .nav a:not(.btn) { padding: 4px; font-size: .85rem; }
  .nav a.about-link { padding: 4px; }
  .nav .btn.sm { padding: 0 10px; font-size: .8rem; min-height: 32px; }
  .avatar { inline-size: 30px; block-size: 30px; }
}