:root {
  --green: #1b7f5a;
  --green-dark: #0f3d2e;
  --accent: #2fb57f;
  --bg: #f3f6f4;
  --card: #ffffff;
  --text: #10231a;
  --muted: #5d6f66;
  --line: #dfe6e2;
  --tab-bg: rgba(255,255,255,0.92);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1612;
    --card: #15241d;
    --text: #e8f1ec;
    --muted: #93a79c;
    --line: #22352c;
    --tab-bg: rgba(16,28,22,0.94);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: calc(72px + var(--sab));
  overscroll-behavior-y: none;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
h2 { font-size: 17px; margin: 18px 4px 8px; }
h3 { margin: 4px 0 12px; font-size: 19px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.row.between { justify-content: space-between; }

/* Header */
.top {
  background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; padding: calc(var(--sat) + 12px) 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.city-btn {
  background: rgba(255,255,255,0.15); border: 0; border-radius: 999px;
  padding: 8px 14px; color: #fff; font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.city-btn .chev { opacity: .8; font-size: 13px; }
.date-line { font-size: 13px; opacity: .9; text-align: right; line-height: 1.3; }

main { padding: 12px 14px 0; max-width: 560px; margin: 0 auto; }

/* Hero countdown */
.hero {
  background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; border-radius: 22px; padding: 18px 16px 20px; text-align: center;
  box-shadow: 0 8px 24px rgba(27,127,90,0.25);
}
.hero-label { font-size: 13px; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
.hero-name { font-size: 28px; font-weight: 700; margin-top: 4px; }
.hero-countdown { font-size: 54px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 6px 0 2px; line-height: 1.05; }
.hero-sub { font-size: 14px; opacity: .9; }

/* Segmented */
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; margin: 14px 0 10px; }
.seg.small { margin: 0; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-weight: 600; font-size: 15px; min-height: 40px; }
.seg-btn.active { background: var(--card); color: var(--green); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* Times list */
.times { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 18px; overflow: hidden; }
.times li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 18px;
}
.times li:last-child { border-bottom: 0; }
.times li .n { display: flex; align-items: center; gap: 10px; }
.times li .t { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 22px; }
.times li.now { background: rgba(47,181,127,0.14); }
.times li.now .n::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.times li.past { opacity: .5; }
.times li .bell { background: none; border: 0; font-size: 18px; padding: 4px 6px; opacity: .35; }
.times li .bell.on { opacity: 1; }

/* Week table */
.week-wrap { background: var(--card); border-radius: 18px; overflow-x: auto; }
.week { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.week th, .week td { padding: 9px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.week th { color: var(--muted); font-weight: 600; }
.week td:first-child, .week th:first-child { text-align: left; padding-left: 12px; font-weight: 600; }
.week tr.today td { background: rgba(47,181,127,0.14); }

.note { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 14px 4px; }

/* Buttons */
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; font-size: 17px; font-weight: 600;
  background: var(--card); color: var(--text); min-height: 50px; margin: 10px 0;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; min-height: 36px; margin: 0; background: var(--green); color: #fff; }
.btn.ghost.small { background: transparent; color: var(--text); }
.btn:active { transform: scale(.98); }

/* Compass */
.compass-wrap { display: flex; justify-content: center; padding: 10px 0; }
.compass { position: relative; width: min(78vw, 300px); height: min(78vw, 300px); }
.dial {
  position: absolute; inset: 0; border-radius: 50%; background: var(--card);
  border: 6px solid var(--line); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .15s linear;
}
.dial .dir { position: absolute; font-weight: 700; font-size: 16px; color: var(--muted); }
.dial .n { top: 8px; left: 50%; transform: translateX(-50%); color: #d04040; }
.dial .s { bottom: 8px; left: 50%; transform: translateX(-50%); }
.dial .e { right: 8px; top: 50%; transform: translateY(-50%); }
.dial .w { left: 8px; top: 50%; transform: translateY(-50%); }
.qibla-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.arrow-head {
  position: absolute; left: -7px; bottom: 0; width: 14px; height: calc(min(78vw, 300px) / 2 - 44px);
  background: linear-gradient(to top, transparent 0, var(--green) 40%, var(--green) 100%);
  border-radius: 7px 7px 0 0;
}
.arrow-head::before {
  content: ""; position: absolute; top: -14px; left: -8px; border: 15px solid transparent; border-top: 0;
  border-bottom: 20px solid var(--green);
}
.kaaba { position: absolute; left: -16px; top: calc(-1 * (min(78vw, 300px) / 2 - 36px)); font-size: 28px; width: 32px; text-align: center; transform: translateY(-50%); }
.needle { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--text); }
.qibla-info { text-align: center; margin: 6px 0 10px; }
.qibla-info .big { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tasbeh */
.tasbeh-top { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 16px; }
.tasbeh-top .seg { width: 220px; }
.tasbeh-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: min(80vw, 320px); height: min(80vw, 320px); margin: 0 auto; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #35c48b, var(--green) 60%, var(--green-dark));
  color: #fff; box-shadow: 0 14px 34px rgba(27,127,90,0.4), inset 0 -10px 24px rgba(0,0,0,.2);
  touch-action: manipulation;
}
.tasbeh-btn:active { transform: scale(.96); }
.tasbeh-btn .count { font-size: 88px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.tasbeh-btn .of { font-size: 18px; opacity: .85; margin-top: 6px; }

/* Soon */
.soon { text-align: center; padding: 50px 20px; }
.soon-icon { font-size: 56px; }

/* Settings */
.card { background: var(--card); border-radius: 18px; padding: 12px 16px; margin-bottom: 12px; }
.toggles, .offsets { list-style: none; margin: 0; padding: 0; }
.toggles li, .offsets li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.toggles li:last-child { border-bottom: 0; }
.offsets .stepper { display: flex; align-items: center; gap: 4px; }
.offsets .stepper button { width: 40px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: transparent; font-size: 20px; }
.offsets .stepper span { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.switch { position: relative; width: 52px; height: 32px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--tab-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--sab));
}
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; }
.tab .ic { font-size: 22px; }
.tab.active { color: var(--green); }

/* Sheets */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); color: var(--text);
  border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + var(--sab)); max-height: 80vh; overflow-y: auto;
}
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.city-list { list-style: none; margin: 0; padding: 0; }
.city-list li { padding: 14px 6px; border-bottom: 1px solid var(--line); font-size: 17px; display: flex; justify-content: space-between; }
.city-list li.active { color: var(--green); font-weight: 700; }
.steps { padding-left: 20px; line-height: 1.6; font-size: 16px; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 5px; padding: 0 5px; font-size: 14px; }

/* Tartib */
.tartib-card { background: var(--card); border-radius: 18px; padding: 4px 16px; margin-bottom: 12px; }
.tartib-card > details { border-bottom: 1px solid var(--line); }
.tartib-card > details:last-child { border-bottom: 0; }
.tartib-card summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; -webkit-tap-highlight-color: transparent; }
.tartib-card summary::-webkit-details-marker { display: none; }
.tartib-card summary::after { content: '▾'; color: var(--muted); font-size: 14px; transition: transform .15s; flex: none; }
.tartib-card details[open] > summary::after { transform: rotate(180deg); }
.tartib-card summary .sub { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tartib-card .body { padding: 0 0 16px; font-size: 15.5px; line-height: 1.55; }
.tartib-card ol, .tartib-card ul { padding-left: 20px; margin: 6px 0; }
.tartib-card li { margin: 5px 0; }
.tartib-card li b { color: var(--green); }
.rakat-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rakat-row:last-child { border-bottom: 0; }
.rakat-row .nm { font-weight: 700; font-size: 16px; min-width: 76px; }
.chip { font-size: 13px; padding: 4px 9px; border-radius: 999px; background: var(--line); color: var(--text); font-weight: 600; white-space: nowrap; }
.chip.farz { background: var(--green); color: #fff; }
.chip.vitr { background: #b7791f; color: #fff; }
.rakat-row .izoh { flex-basis: 100%; }
.ayah { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ayah:last-child { border-bottom: 0; }
.ar { direction: rtl; text-align: right; font-size: 27px; line-height: 2; font-family: "Geeza Pro", "Al Nile", "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", "Times New Roman", serif; margin: 2px 0 6px; unicode-bidi: isolate; }
.ar .num { font-size: 15px; color: var(--muted); margin-right: 6px; vertical-align: middle; }
.tr { font-size: 15.5px; line-height: 1.5; color: var(--text); }
.ma { font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: 3px; }
.izoh-box { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.niyat { font-style: italic; }
