:root {
  --g: #1f5a45; --g2: #2f7a5e; --g3: #6fa58b; --g4: #e3efe8;
  --gold: #c9a227; --gold-s: #f4e8c1;
  --bg: #f6f1e7; --card: #fffdf8; --line: #e4dccb; --chip: #ece4d2;
  --tx: #1f2b24; --mu: #6b6b5e; --top-tx: #f6f1e7;
  --danger: #a23b2a;
  --ar-font: "Noto Naskh Arabic", "Geeza Pro", "Amiri", "Traditional Arabic", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --g: #1d4a3a; --g2: #2a6a52; --g3: #4f8c72; --g4: #1d3a2f;
    --gold: #d6b13d; --gold-s: #3b3420;
    --bg: #111814; --card: #1a231e; --line: #2b372f; --chip: #26312a;
    --tx: #e8e4d9; --mu: #9aa298; --top-tx: #f2efe6;
    --danger: #e07a66;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ================= HALAMAN DEPAN ================= */
.landing { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.hero {
  background: var(--g); color: var(--top-tx); text-align: center;
  padding: calc(40px + env(safe-area-inset-top)) 22px 32px; border-radius: 0 0 28px 28px;
  background-image: radial-gradient(circle at 85% 10%, rgba(201,162,39,.25), transparent 45%);
}
.hero-logo { border-radius: 22px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.hero h1 { margin: 14px 0 4px; font-size: 34px; letter-spacing: .5px; }
.hero-sub { margin: 0 auto 22px; max-width: 300px; opacity: .9; }
.btn-install {
  background: var(--gold); color: #1f2b24; border: 0; border-radius: 16px;
  font-size: 18px; font-weight: 700; padding: 15px 28px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.btn-install:active { transform: scale(.97); }
.hero-note { font-size: 13px; opacity: .75; margin: 12px 0 0; }
.features { padding: 20px 16px 8px; flex: 1; }
.feat {
  display: flex; gap: 14px; align-items: flex-start; background: var(--card); color: var(--tx);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px;
}
.feat-i { font-size: 26px; line-height: 1; }
.feat b { display: block; }
.feat small { color: var(--mu); font-size: 14px; }
.how { margin-top: 18px; padding: 0 4px; }
.how h2 { font-size: 18px; margin: 0 0 6px; }
.how ol { margin: 0; padding-left: 22px; color: var(--tx); }
.how li { margin: 4px 0; }
.foot { text-align: center; color: var(--mu); font-size: 12px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 520px; margin: 0 auto;
  background: var(--card); color: var(--tx); border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet h3 { margin: 0 0 12px; font-size: 19px; }
.step { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.step .n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--g); color: var(--top-tx);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.ico { display: inline-block; padding: 0 4px; border-radius: 6px; background: var(--chip); color: var(--tx); }
.sheet-note { color: var(--mu); font-size: 14px; }
.btn-plain {
  width: 100%; margin-top: 14px; border: 0; border-radius: 14px; padding: 13px;
  background: var(--g); color: var(--top-tx); font-weight: 700;
}

/* ================= APLIKASI ================= */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--g); color: var(--top-tx);
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px; border-radius: 0 0 22px 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.dnav { display: flex; align-items: center; gap: 8px; }
.dmid { flex: 1; text-align: center; min-width: 0; }
.d1 { font-size: 14px; font-weight: 600; }
.d2 { font-size: 12px; opacity: .8; }
.dbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: var(--top-tx);
  font-size: 22px; line-height: 1;
}
.dbtn:disabled { opacity: .25; cursor: default; }
.big { font-size: 21px; font-weight: 800; margin-top: 8px; text-align: center; }
.loc { font-size: 13px; opacity: .85; text-align: center; }
.link-light { display: block; margin: 8px auto 0; background: rgba(255,255,255,.15); color: var(--top-tx); border: 0; border-radius: 12px; padding: 6px 12px; font-size: 14px; }
.bar { height: 8px; border-radius: 5px; background: rgba(255,255,255,.18); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 5px; transition: width .3s; }
.bar-l { font-size: 12px; opacity: .85; margin-top: 4px; text-align: center; }

.view { padding: 12px 12px 0; }
.hint { color: var(--mu); font-size: 13px; text-align: center; margin: 12px 8px; }
.hint.left { text-align: left; margin: 8px 0; }
.top-hint { margin-top: 2px; }

.prow {
  display: flex; align-items: center; gap: 10px; background: var(--card); color: var(--tx);
  border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 8px;
  user-select: none; transition: background .15s;
}
.prow:active { transform: scale(.99); }
.prow.done { background: var(--g4); border-color: var(--g3); }
.prow.now { border: 2px solid var(--gold); }
.prow.off { opacity: .45; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-size: 18px; font-weight: 700; }
.ptime { font-size: 14px; color: var(--mu); }
.chk {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--g2);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: var(--g2);
}
.prow.done .chk { background: var(--g); border-color: var(--g); color: var(--top-tx); }
.pill { font-size: 12px; border-radius: 10px; padding: 4px 9px; border: 0; background: var(--chip); color: var(--tx); white-space: nowrap; }
.pill.on { background: var(--gold); color: #1f2b24; font-weight: 700; }
.pill.now { background: var(--gold-s); color: var(--tx); font-weight: 600; vertical-align: 2px; }
.sunrise { font-size: 13px; color: var(--mu); padding: 0 16px 8px; }

.card { display: block; background: var(--card); color: var(--tx); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.card.nopad { padding: 4px 0; }
.card-h { font-weight: 700; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--chip); color: var(--tx); border-radius: 12px; padding: 8px 13px; font-size: 14px; }
.chip.on { background: var(--g); border-color: var(--g); color: var(--top-tx); }

.sw-row { display: flex; align-items: center; gap: 12px; cursor: pointer; position: relative; }
.sw-row > span:first-child { flex: 1; }
.sw-row small { display: block; color: var(--mu); font-size: 13px; }
.sw-row.in { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sw-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { flex: none; width: 46px; height: 26px; border-radius: 14px; background: var(--line); position: relative; transition: background .2s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sw-row input:checked + .sw { background: var(--g2); }
.sw-row input:checked + .sw::after { left: 23px; }
.sw-row input:focus-visible + .sw { outline: 2px solid var(--gold); outline-offset: 2px; }

/* dzikir */
.seg { display: flex; background: rgba(255,255,255,.14); border-radius: 14px; padding: 4px; margin-top: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--top-tx); padding: 8px; border-radius: 10px; font-weight: 600; }
.seg button.on { background: var(--card); color: var(--g); }
.seg.small { background: var(--chip); margin: 6px 0 0; }
.seg.small button { color: var(--tx); font-weight: 500; padding: 6px; }
.seg.small button.on { background: var(--g); color: var(--top-tx); }
.sz { padding-top: 10px; }

.dz { background: var(--card); color: var(--tx); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 12px; scroll-margin-top: 190px; }
.dz.done { border-color: var(--g3); background: var(--g4); }
.dz-h { display: flex; align-items: center; gap: 10px; }
.dz-h b { flex: 1; font-size: 15px; }
.dz-no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--chip); color: var(--tx); font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.dz.done .dz-no { background: var(--g); color: var(--top-tx); }
.dz-x { font-size: 13px; font-weight: 700; color: var(--g2); background: var(--chip); border-radius: 10px; padding: 2px 8px; }
.arab { font-family: var(--ar-font); line-height: 2.1; margin: 12px 0 6px; text-align: right; }
.ar-s { font-size: 21px; } .ar-m { font-size: 25px; } .ar-l { font-size: 31px; }
.pembuka { opacity: .75; margin-bottom: 0; font-size: .85em; }
.latin { font-style: italic; color: var(--g2); margin: 6px 0; font-size: 15px; }
@media (prefers-color-scheme: dark) { .latin { color: var(--g3); } }
.arti { color: var(--mu); font-size: 14px; margin: 6px 0; }
.dz-f { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 10px; }
.src { font-size: 12px; color: var(--mu); }
.reset { border: 0; background: none; color: var(--mu); font-size: 13px; text-decoration: underline; padding: 4px; }
.tap {
  width: 100%; border: 0; border-radius: 14px; background: var(--g); color: var(--top-tx);
  padding: 14px; display: flex; align-items: baseline; justify-content: center; gap: 6px;
  user-select: none; touch-action: manipulation;
}
.tap:active { transform: scale(.98); background: var(--g2); }
.tap-c { font-size: 26px; font-weight: 800; }
.tap-n { opacity: .8; }
.tap-l { margin-left: 10px; font-weight: 600; opacity: .9; }
.tap.full { background: var(--gold-s); color: var(--tx); font-weight: 700; }

/* riwayat */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.stats div { background: var(--card); color: var(--tx); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; }
.stats b { display: block; font-size: 22px; color: var(--g2); }
.stats b span { font-size: 12px; color: var(--mu); font-weight: 500; }
@media (prefers-color-scheme: dark) { .stats b { color: var(--g3); } }
.stats small { font-size: 11px; color: var(--mu); }
.key { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--mu); margin: 4px 4px 10px; }
.key span { display: inline-flex; align-items: center; gap: 4px; }
.drow { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--tx); padding: 10px 14px; text-align: left; }
.drow:last-child { border-bottom: 0; }
.dt { width: 74px; font-size: 14px; }
.dots { flex: 1; display: flex; gap: 6px; }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--line); }
.dot.y { background: var(--g2); } .dot.j { background: var(--gold); } .dot.h { background: var(--mu); opacity: .5; }
.dzi { font-size: 15px; letter-spacing: 2px; }
.faded { opacity: .2; filter: grayscale(1); }
.mrow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.ok { margin: 0; color: var(--g2); }

/* atur */
.input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--tx); font-size: 16px; }
.btn { display: block; width: 100%; text-align: center; margin-top: 10px; border: 0; border-radius: 12px; padding: 12px; background: var(--g); color: var(--top-tx); font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--chip); color: var(--tx); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

/* bawah */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: 560px; margin: 0 auto;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav button { flex: 1; border: 0; background: none; color: var(--mu); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0; }
.nav button span { font-size: 22px; filter: grayscale(.7); opacity: .7; }
.nav button.on { color: var(--g2); font-weight: 700; }
@media (prefers-color-scheme: dark) { .nav button.on { color: var(--gold); } }
.nav button.on span { filter: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--tx); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 30; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
button:focus-visible, .prow:focus-visible, .drow:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
