:root {
  --bg: #f6f3ea;
  --card: #ffffff;
  --ink: #1d2a26;
  --muted: #6b7a74;
  --line: #e4dfd0;
  --accent: #0f5c4a;
  --accent-ink: #ffffff;
  --soft: #e3efe9;
  --gold: #b58a2b;
  --warn: #b4472f;
  --s1: #8a7a4e; --s2: #b58a2b; --s3: #2f7f93; --s4: #0f5c4a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10201c; --card: #172b26; --ink: #ecf1ec; --muted: #94a8a0; --line: #25403a;
    --accent: #3fb594; --accent-ink: #08201a; --soft: #1e3a33; --gold: #d9b25a; --warn: #e5826a;
    --s1: #b9a876; --s2: #d9b25a; --s3: #6cbdd0; --s4: #3fb594;
  }
}
/* touch-action: быстрые тапы по кнопкам не должны увеличивать экран (двойной тап в iOS) */
* { box-sizing: border-box; touch-action: manipulation; }
button, .btn, .card, .tab { -webkit-user-select: none; user-select: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; font-weight: 600; }
.eyebrow { color: var(--muted); font-size: 14px; margin: 2px 0; }
.eyebrow::first-letter { text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; padding: 24px 0 8px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 44px; }

.btn {
  appearance: none; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; padding: 12px 18px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.round { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; font-weight: 400; }
.btn.big { width: 100%; padding: 18px; font-size: 18px; border-radius: 16px; }
.btn.danger { color: var(--warn); }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; padding: 10px; cursor: pointer; text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stats b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }

.card {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 8px; cursor: pointer;
}
.card.overdue { border-color: var(--warn); }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 600; }
.card-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; color: #fff; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s4 { background: var(--s4); }
@media (prefers-color-scheme: dark) { .badge { color: #10201c; } }
.bar { height: 4px; background: var(--soft); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.check { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }

.empty { text-align: center; padding: 40px 16px; }
.empty p { margin: 0 0 8px; }
.empty .btn { margin-top: 12px; }

/* порция */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; margin: 20px 0 12px; }
.steps li { text-align: center; font-size: 11px; color: var(--muted); position: relative; }
.steps li::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps li.past::before, .steps li.now::before { background: var(--accent); }
.steps i { position: relative; z-index: 1; font-style: normal; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 6px; background: var(--bg); border: 2px solid var(--line); font-weight: 700; font-size: 13px; }
.steps .past i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps .now i { border-color: var(--accent); color: var(--accent); }
.steps .now span { color: var(--ink); font-weight: 600; }
.hint { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 16px; }

@font-face {
  font-family: "UthmanicHafs"; font-display: swap;
  src: url("fonts/UthmanicHafs1Ver18.woff2") format("woff2");
}
.quran {
  font-family: "UthmanicHafs", "Amiri Quran", "Geeza Pro", serif; font-size: 27px; line-height: 2.1;
  text-align: justify; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 18px; margin-bottom: 8px; transition: filter .2s;
}
.quran.veiled { filter: blur(9px); user-select: none; max-height: 220px; overflow: hidden; }
.quran + .btn, .center + .btn { width: 100%; }

.panel { position: sticky; bottom: 0; background: var(--bg); padding: 16px 0 calc(8px + env(safe-area-inset-bottom)); margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.panel .btn:not(.small) { width: 100%; }
.count { display: flex; align-items: baseline; gap: 10px; }
.count b { font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.count span { color: var(--muted); font-size: 14px; }
.status { font-size: 14px; color: var(--muted); }
.status.warn { color: var(--warn); font-weight: 600; }
.dots { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; width: 100%; }
.dots i { height: 6px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--accent); }
.pick { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); }

/* дневник */
.day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 8px; }
.day-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.day-head b::first-letter { text-transform: uppercase; }
.day-head span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.entry { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; padding: 4px 0; }
.entry-t { font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.note { width: 100%; margin-top: 8px; border: 0; border-top: 1px dashed var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 14px; padding: 10px 0 0; resize: none; outline: none; overflow: hidden; }
.note::placeholder { color: var(--muted); }
.backup { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.backup p { margin: 0; }

/* вкладки */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs[hidden] { display: none; }
.tab { flex: 1; max-width: 186px; background: none; border: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 16px 8px; cursor: pointer; border-top: 2px solid transparent; margin-top: -1px; }
.tab.on { color: var(--accent); border-top-color: var(--accent); }

/* форма */
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--bg); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet-body h2 { margin: 0; font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.sheet-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.sheet-body select, .sheet-body input { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.err { color: var(--warn); font-size: 14px; }
.err:empty { display: none; }

.undo { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; }
