:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --text: #1c1f1e;
  --muted: #5d6460;
  --border: #e2dfd6;
  --accent: #0f766e;
  --accent-strong: #0b5a54;
  --accent-soft: #e3f2ef;
  --gold: #b7791f;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --surface: #1a1e1d;
    --surface-2: #222826;
    --text: #e9ecea;
    --muted: #a3aba7;
    --border: #2e3532;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #15302c;
    --gold: #e0a84a;
    --danger: #f97066;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
img, svg { max-width: 100%; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

/* Content */
main { padding: 24px 0 48px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.lede { color: var(--muted); margin: 0 0 20px; font-size: 1.05rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 640px) { .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.tile { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile strong { display: block; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: .9rem; }
.note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: .92rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* Prayer times */
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.today-head .date { font-weight: 600; }
.next { background: var(--accent); color: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { .next { color: #06201d; } }
.next .label { font-size: .9rem; opacity: .9; }
.next .name { font-size: 1.4rem; font-weight: 700; }
.next .countdown { font-size: 1.6rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .times { grid-template-columns: repeat(6, 1fr); } }
.time { background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: center; border: 2px solid transparent; }
.time.is-next { border-color: var(--accent); background: var(--accent-soft); }
.time .n { font-size: .85rem; color: var(--muted); }
.time .v { font-size: clamp(.95rem, 2.6vw, 1.15rem); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; }
tr.is-today td { background: var(--accent-soft); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

/* Forms */
.form { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: 3px; }
input, select, button { font: inherit; }
input[type="number"], input[type="date"], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); min-height: 44px;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06201d; } }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; }

.result { margin-top: 20px; border-top: 1px dashed var(--border); padding-top: 16px; }
.big { font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 800; color: var(--accent-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin-top: 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.warn { color: var(--danger); font-weight: 600; }

/* FAQ */
details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
details + details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }
