:root {
  --bg: #0d1512; --surface: #15211c; --surface2: #1d2e26; --line: #2a3d34;
  --text: #e9f0eb; --muted: #9fb2a7; --accent: #4fd1a1; --accent-ink: #062a1c;
  --amber: #f0b84a; --danger: #f0786a; --radius: 16px;
  --pad: 16px; --tab: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, system-ui, "Segoe UI", Roboto, "Noto Sans", "Noto Naskh Arabic", sans-serif; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
#app { min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 12px) var(--pad) calc(var(--tab) + env(safe-area-inset-bottom) + 24px); max-width: 560px; margin: 0 auto; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 22px 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
small, .muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 10px; }
.card.hero { background: linear-gradient(160deg, #1a3a2e, #15211c 70%); border-color: #2f5646; padding: 18px; }
.card.alert { border-color: var(--amber); background: #2a2413; }

.btn { appearance: none; border: 0; border-radius: 14px; min-height: 48px; padding: 12px 16px; font: inherit; font-weight: 650; color: var(--text); background: var(--surface2); width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.amber { background: var(--amber); color: #2b2005; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { min-height: 40px; padding: 8px 12px; width: auto; font-size: .92rem; }
.btn[disabled] { opacity: .5; }
.btns { display: grid; gap: 10px; }
.btns.two { grid-template-columns: 1fr 1fr; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface2); color: var(--muted); }
.chip.ok { background: #16402f; color: var(--accent); }
.chip.warn { background: #3d3216; color: var(--amber); }
.chip.bad { background: #43211d; color: var(--danger); }

.prayer { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 56px; color: inherit; text-decoration: none; }
.prayer:last-child { border-bottom: 0; }
.prayer .name { font-weight: 650; }
.prayer .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.prayer.now .name { color: var(--amber); }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); flex: none; }
.dot.ok { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dot.qada { background: var(--amber); border-color: var(--amber); color: #2b2005; }
.dot.bad { border-color: var(--danger); color: var(--danger); }
.dot svg { width: 16px; height: 16px; }

.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.done .label { text-decoration: line-through; color: var(--muted); }
.task.optional .label { color: var(--muted); }
.check { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line); background: transparent; color: var(--accent-ink); display: grid; place-items: center; flex: none; padding: 0; cursor: pointer; }
.check.on { background: var(--accent); border-color: var(--accent); }
.check svg { width: 18px; height: 18px; }

.big { font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.quote { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; color: var(--text); white-space: pre-line; }
.quote .src { color: var(--muted); font-size: .85rem; display: block; margin-top: 6px; }

input[type=text], input[type=number], input[type=time], input[type=password], input[type=date], textarea, select {
  width: 100%; min-height: 48px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 90px; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 10px 0 4px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.toggle input { width: 26px; height: 26px; accent-color: var(--accent); }

.bar { height: 10px; border-radius: 6px; background: var(--surface2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.warn > i { background: var(--amber); }
.bar.bad > i { background: var(--danger); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.spark i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.spark i.low { background: var(--amber); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(13,21,18,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tab); color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current=page] { color: var(--accent); }

.banner { background: #3d3216; color: var(--amber); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: .92rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 14px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 650; z-index: 20; max-width: 90vw; }

.alarm { position: fixed; inset: 0; z-index: 30; background: #000; color: #fff; display: grid; place-content: center; text-align: center; gap: 18px; padding: 24px; }
.alarm .big { font-size: 3.2rem; }
.alarm.ring { background: #5a0f0a; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { background: #5a0f0a; } to { background: #8f1b12; } }
@media (prefers-reduced-motion: reduce) { .alarm.ring { animation: none; } .btn:active { transform: none; } }

code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; word-break: break-all; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
