:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #1d2b2a;
  --muted: #5e6b67;
  --line: #e4dccb;
  --accent: #1f5c4f;
  --accent-ink: #ffffff;
  --gold: #b08a3e;
  --soft: #e9f0ec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101816;
    --surface: #17221f;
    --ink: #ece6d8;
    --muted: #9fa9a4;
    --line: #2a3733;
    --accent: #3f9a82;
    --accent-ink: #0d1412;
    --gold: #d2b06a;
    --soft: #1d2c28;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-family: 'Amiri', serif; font-size: 26px; color: var(--accent); letter-spacing: .5px; }
.brand small { color: var(--muted); font-size: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; margin-bottom: 18px;
}
h1, h2 { font-family: 'Amiri', serif; font-weight: 700; line-height: 1.35; margin: 0 0 10px; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
.muted { color: var(--muted); }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text] {
  width: 100%; font: inherit; font-size: 18px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: flex; gap: 8px; }
.seg label {
  flex: 1; margin: 0; text-align: center; padding: 10px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; font-weight: 500; background: var(--bg);
}
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); font-weight: 700; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 17px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); padding: 13px 20px;
  border-radius: 14px; text-decoration: none; width: 100%;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.err { color: #b3402f; min-height: 1.5em; margin-top: 8px; }
.dua {
  font-family: 'Amiri', serif; font-size: 21px; line-height: 2.1; text-align: justify;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  font: inherit; font-size: 15px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.current-dhikr { font-family: 'Amiri', serif; font-size: 26px; text-align: center; margin: 4px 0 18px; min-height: 2.2em; }
.bead {
  display: block; margin: 0 auto; width: 210px; height: 210px; border-radius: 50%;
  border: 0; cursor: pointer; font: inherit; color: var(--accent-ink);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 70%, white), var(--accent) 60%);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 -8px 18px rgba(0,0,0,.18);
  transition: transform .08s ease; user-select: none; touch-action: manipulation;
}
.bead:active { transform: scale(.96); }
.bead .n { font-size: 56px; font-weight: 700; line-height: 1; display: block; }
.bead .l { font-size: 14px; opacity: .9; }
.stats { display: flex; justify-content: space-around; text-align: center; margin-top: 20px; }
.stats b { display: block; font-size: 24px; color: var(--gold); }
.stats span { font-size: 13px; color: var(--muted); }
.links a {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600;
}
.links a:last-child { border-bottom: 0; }
.links small { color: var(--gold); font-weight: 500; }
.quran {
  font-family: 'Amiri Quran', 'Amiri', serif; font-size: 25px; line-height: 2.4; text-align: justify;
}
.basmala { font-family: 'Amiri Quran', 'Amiri', serif; font-size: 26px; text-align: center; margin-bottom: 12px; }
.ayah-n { color: var(--gold); font-size: .85em; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px;
  opacity: 0; transition: opacity .2s; pointer-events: none; font-size: 15px;
}
.toast.show { opacity: 1; }
.mypages a { display: block; padding: 8px 0; }
footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 30px; }

.dedication {
  margin-top: 28px; padding: 18px 16px; text-align: center;
  border-top: 1px solid var(--line); color: var(--muted);
  font-family: 'Amiri', serif; font-size: 18px; line-height: 1.8;
}
.dedication b { color: var(--accent); font-weight: 700; }
