:root {
  --bg: #f4efe6;
  --surface: #fffaf2;
  --ink: #1b2433;
  --muted: #6b7280;
  --line: #e5dccb;
  --accent: #b8862f;
  --accent-ink: #ffffff;
  --hero-bg: linear-gradient(160deg, #13243b 0%, #1d3557 60%, #2b4a6f 100%);
  --hero-ink: #f6efe1;
  --hero-muted: #c9c2b3;
  --now: rgba(184, 134, 47, .22);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b131f;
    --surface: #121d2c;
    --ink: #ece6da;
    --muted: #8d97a6;
    --line: #223147;
    --accent: #d4a24c;
    --accent-ink: #1a1306;
    --hero-bg: linear-gradient(160deg, #0f1c2e 0%, #17304f 70%, #1f3d63 100%);
    --now: rgba(212, 162, 76, .2);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

/* ---------- üst çubuk ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px;
  max-width: 720px; width: 100%; margin: 0 auto;
}
.place-name { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.place-sub { color: var(--muted); font-size: .85rem; }
.btn-loc {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .9rem; cursor: pointer;
}
.btn-loc:active { transform: scale(.97); }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px 16px; }

/* ---------- bugün ---------- */
.hero {
  background: var(--hero-bg); color: var(--hero-ink);
  border-radius: var(--radius); padding: 20px 18px 16px;
  box-shadow: 0 10px 30px rgba(10, 20, 35, .18);
}
.dates { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .92rem; }
.greg { font-weight: 600; }
.hijri { color: var(--hero-muted); }
.next-box { text-align: center; margin: 18px 0 16px; }
.now-label { display: inline-block; font-size: .8rem; color: var(--hero-muted); border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.now-label:empty { display: none; }
.countdown-sub { margin-top: 6px; color: var(--hero-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.countdown-sub b { color: var(--hero-ink); font-weight: 600; }
.next-label { color: var(--hero-muted); font-size: .95rem; }
.countdown {
  font-size: clamp(1.7rem, 8.6vw, 2.8rem); font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums; letter-spacing: .01em; line-height: 1.15; margin-top: 2px;
}
.times { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; align-items: stretch; gap: 8px; }
.times li {
  background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 10px 6px; text-align: center;
  border: 1px solid transparent;
}
.times .n { display: block; font-size: .8rem; color: var(--hero-muted); }
.times .t { display: block; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.times .r { display: block; white-space: nowrap; font-size: .7rem; color: var(--hero-muted); min-height: 1.1em; margin-top: 1px; }
.times li.is-next .r { color: var(--accent); font-weight: 600; }
.times li.is-current { border-color: var(--accent); background: rgba(212, 162, 76, .18); }
.times li.is-next .n { color: var(--accent); font-weight: 600; }
.times li.is-past .t { opacity: .55; }

/* ---------- ileri günler ---------- */
.upcoming { margin-top: 22px; }
.upcoming h2 { font-size: 1rem; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .8rem; }
th, td { padding: 8px 2px; text-align: center; }
th { font-weight: 600; color: var(--muted); font-size: .74rem; border-bottom: 1px solid var(--line); }
td:first-child, th:first-child { text-align: left; padding-left: 10px; white-space: nowrap; }
td:last-child, th:last-child { padding-right: 10px; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr.today td { background: var(--now); font-weight: 600; }
td .dow { display: block; color: var(--muted); font-size: .7rem; line-height: 1.1; }

/* ---------- durum ---------- */
.state { text-align: center; padding: 48px 12px; color: var(--muted); }
.btn {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px;
  padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.foot {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  max-width: 720px; width: 100%; margin: 0 auto; padding: 8px 16px 16px;
  color: var(--muted); font-size: .76rem;
}

/* ---------- konum seçici ---------- */
dialog {
  border: 0; padding: 0; border-radius: 20px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(8, 14, 24, .55); backdrop-filter: blur(2px); }
.picker { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.picker h2 { margin: 0 0 2px; font-size: 1.15rem; }
.picker label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); }
.picker select {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%;
}
.geo { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.geo-note { margin: -4px 0 0; font-size: .74rem; color: var(--muted); }
.picker-err { margin: 0; color: #c2410c; font-size: .85rem; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

@media (min-width: 560px) {
  .times { grid-template-columns: repeat(6, 1fr); }
  table { font-size: .92rem; }
  th, td { padding: 9px 4px; }
  td .dow { display: inline; margin-left: 4px; font-size: .75rem; }
}
