/* =========================================================================
   Namaz Vakti 11.0 – ein Stylesheet für alle Seiten
   -------------------------------------------------------------------------
   Aufbau
   1. Textgröße (folgt der Systemeinstellung)
   2. Farb-Tokens hell/dunkel + Himmel je Gebetszeit (Signatur)
   3. Basis
   4. Leisten (Toolbar, Tab-Leiste) – einzige Glas-Ebene
   5. Inhalte (Karten, Listen, Buttons)
   6. Seiten: Zeiten, Standort, Qibla, Besondere Tage, 32 Farz, Installieren
   7. Sheets, Dialoge, Statusmeldung
   8. Breite Fenster
   9. Barrierefreiheit: weniger Bewegung, weniger Transparenz, mehr Kontrast
   ========================================================================= */

/* ---------- 1. Textgröße ------------------------------------------------ */
/* 1rem = Fließtext des Systems (iOS: Dynamic Type, Standard 17 px). */
html { font-size: 106.25%; }
@supports (font: -apple-system-body) {
  html { font: -apple-system-body; }
}

/* ---------- 2. Tokens --------------------------------------------------- */
:root {
  color-scheme: light dark;

  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Typo-Skala relativ zur Systemgröße (17 px = 1rem) */
  --fs-large: 2rem;        /* 34 */
  --fs-title1: 1.647rem;   /* 28 */
  --fs-title2: 1.294rem;   /* 22 */
  --fs-title3: 1.176rem;   /* 20 */
  --fs-body: 1rem;         /* 17 */
  --fs-callout: .941rem;   /* 16 */
  --fs-subhead: .882rem;   /* 15 */
  --fs-footnote: .765rem;  /* 13 */
  --fs-caption: .706rem;   /* 12 */
  --fs-caption2: .647rem;  /* 11 – kleinste Größe in der App */

  --radius-card: 20px;
  --radius-control: 12px;
  --gutter: 16px;
  --tabbar-h: 58px;

  /* Hell */
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --fill: rgba(120, 120, 128, .12);
  --fill-strong: rgba(120, 120, 128, .2);
  --label: #1c1c1e;
  --label-2: #636366;          /* 5,37:1 auf #f2f2f7, 5,9:1 auf Weiß */
  --separator: rgba(60, 60, 67, .2);
  --accent: #0066cc;           /* 4,99:1 auf #f2f2f7 */
  --accent-tint: rgba(0, 102, 204, .1);
  --on-accent: #ffffff;
  --positive: #1f7a35;
  --positive-tint: rgba(31, 122, 53, .12);
  --warning: #8a5300;
  --warning-tint: rgba(255, 159, 10, .16);
  --danger: #c4281c;
  --bar: rgba(250, 250, 252, .78);
  --bar-border: rgba(60, 60, 67, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(60, 60, 67, .08);
  --on-sky: #1c1c1e;
  --on-sky-2: #3a3a3c;

  /* Himmel je Gebetszeit – hell */
  --sky-imsak: #cdd6ef;
  --sky-gunes: #f5dcc8;
  --sky-ogle: #cfe3f6;
  --sky-ikindi: #f2e2c0;
  --sky-aksam: #f0cdc6;
  --sky-yatsi: #cbd0e2;
  --sky: var(--sky-ogle);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(120, 120, 128, .24);
    --fill-strong: rgba(120, 120, 128, .36);
    --label: #f5f5f7;
    --label-2: #a1a1a6;        /* 6,6:1 auf #1c1c1e */
    --separator: rgba(84, 84, 88, .6);
    --accent: #64a9ff;         /* 7,4:1 auf #1c1c1e */
    --accent-tint: rgba(100, 169, 255, .16);
    --on-accent: #001a3d;
    --positive: #30d158;
    --positive-tint: rgba(48, 209, 88, .16);
    --warning: #ffb340;
    --warning-tint: rgba(255, 159, 10, .16);
    --danger: #ff6961;
    --bar: rgba(30, 30, 32, .72);
    --bar-border: rgba(255, 255, 255, .1);
    --shadow: none;
    --on-sky: #f5f5f7;
    --on-sky-2: #c7c7cc;

    --sky-imsak: #18224a;
    --sky-gunes: #3b2626;
    --sky-ogle: #0f2a48;
    --sky-ikindi: #36290f;
    --sky-aksam: #3d1826;
    --sky-yatsi: #0c1028;
  }
}

html[data-phase="imsak"]  { --sky: var(--sky-imsak); }
html[data-phase="gunes"]  { --sky: var(--sky-gunes); }
html[data-phase="ogle"]   { --sky: var(--sky-ogle); }
html[data-phase="ikindi"] { --sky: var(--sky-ikindi); }
html[data-phase="aksam"]  { --sky: var(--sky-aksam); }
html[data-phase="yatsi"]  { --sky: var(--sky-yatsi); }

/* ---------- 3. Basis ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.35;
  color: var(--label);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Himmel: ruhige Farbfläche, die oben die aktuelle Gebetszeit zeigt. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: min(70vh, 640px);
  z-index: -1;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky) 30%, var(--bg) 100%);
  pointer-events: none;
}

a { color: var(--accent); }
img { max-width: 100%; display: block; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: min(100%, 680px);
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
}

.page-header { padding: 8px 4px 16px; }

.large-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-large);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--on-sky);
}

.page-subtitle {
  margin: 6px 0 0;
  font-size: var(--fs-subhead);
  color: var(--on-sky-2);
}

.section-title {
  margin: 28px 4px 8px;
  font-size: var(--fs-title3);
  font-weight: 700;
  line-height: 1.2;
}

.section-note {
  margin: 8px 4px 0;
  font-size: var(--fs-footnote);
  color: var(--label-2);
}

.footer-note {
  margin: 32px 4px 0;
  font-size: var(--fs-caption);
  color: var(--label-2);
  text-align: center;
}

/* ---------- 4. Leisten (Glas nur hier) ---------------------------------- */
.glass {
  background: var(--bar);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--bar-border);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 4px;
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-sky);
  font-size: var(--fs-subhead);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background-color .12s ease;
}

.toolbar-button.icon-only { justify-content: center; padding: 0; width: 44px; }
.toolbar-button svg { width: 22px; height: 22px; flex: none; fill: currentColor; }
.toolbar-button .label {
  max-width: 52vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toolbar-button:active { transform: scale(.96); background: var(--fill-strong); }
.toolbar-button[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent); }

/* Tab-Leiste – schwebt über dem Inhalt */
.tabbar {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 440px);
  min-height: var(--tabbar-h);
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}

.tabbar a {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 999px;
  color: var(--label-2);
  text-decoration: none;
  font-size: min(var(--fs-caption2), 14px);
  font-weight: 600;
  line-height: 1.1;
  transition: background-color .15s ease, color .15s ease;
}

.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a[aria-current="page"] { color: var(--accent); background: var(--accent-tint); }
.tabbar a:active { background: var(--fill); }

/* ---------- 5. Inhalte -------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-padded { padding: 16px; }

.list { list-style: none; margin: 0; padding: 0; }

.list-row {
  position: relative;
  min-height: 52px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-row + .list-row::before,
.list-row + .list-row-sep::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--separator);
  transform: scaleY(.5);
  transform-origin: top;
}

.row-text { flex: 1; min-width: 0; }
.row-title { font-size: var(--fs-body); font-weight: 600; line-height: 1.25; }
.row-sub { margin-top: 2px; font-size: var(--fs-footnote); color: var(--label-2); line-height: 1.3; }
.row-value {
  font-family: var(--font-rounded);
  font-size: var(--fs-title3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  font-size: var(--fs-body);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background-color .12s ease;
}
.button svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.button:active { transform: scale(.98); opacity: .85; }
.button[disabled] { opacity: .45; cursor: default; transform: none; }
.button-block { width: 100%; }
.button-primary { background: var(--accent); color: var(--on-accent); }
.button-secondary { background: var(--accent-tint); color: var(--accent); }
.button-plain { background: transparent; color: var(--accent); min-height: 44px; padding: 0 8px; }
.button-destructive { background: transparent; color: var(--danger); min-height: 44px; padding: 0 8px; }
.button-stack { display: grid; gap: 10px; }

.icon-button {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  cursor: pointer;
  transition: transform .12s ease;
}
.icon-button svg { width: 22px; height: 22px; fill: currentColor; }
.icon-button:active { transform: scale(.94); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-caption2);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.4;
  vertical-align: middle;
}
.badge-accent { background: var(--accent); color: var(--on-accent); }
.badge-soft { background: var(--accent-tint); color: var(--accent); }

/* ---------- 6a. Seite: Gebetszeiten ------------------------------------ */
.hero {
  padding: 20px 4px 24px;
  color: var(--on-sky);
}

.hero-date {
  margin: 0;
  font-size: var(--fs-subhead);
  color: var(--on-sky-2);
}

.hero-eyebrow {
  margin: 20px 0 0;
  font-size: var(--fs-footnote);
  font-weight: 600;
  color: var(--on-sky-2);
}

.hero-name {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: var(--fs-large);
  font-weight: 700;
  line-height: 1.1;
}

.hero-countdown {
  margin: 4px 0 0;
  font-family: var(--font-rounded);
  font-size: clamp(3rem, 15vw, 4.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.hero-at {
  margin: 8px 0 0;
  font-size: var(--fs-callout);
  color: var(--on-sky-2);
}

.hero.is-urgent .hero-countdown { color: var(--accent); }

.hero-clock { display: none; }

.prayer-row.is-active { background: var(--accent-tint); }
.prayer-row.is-active .row-title,
.prayer-row.is-active .row-value { color: var(--accent); }
.prayer-row .badge { margin-left: 6px; }
.prayer-row:not(.is-active) .badge { display: none; }

.sabah-row { background: var(--surface-2); }

.daily-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.daily-tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease;
}
.daily-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.daily-tile span {
  display: block;
  padding: 10px 12px 12px;
  font-size: var(--fs-subhead);
  font-weight: 600;
}
.daily-tile:active { transform: scale(.98); }

.install-hint {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 56px;
  color: var(--label);
  text-decoration: none;
}
.install-hint svg { width: 28px; height: 28px; fill: var(--accent); flex: none; }
.install-hint .chevron { margin-left: auto; color: var(--label-2); font-size: var(--fs-title3); }

.empty-state { text-align: center; padding: 24px 20px; }
.empty-state h2 { margin: 0 0 6px; font-size: var(--fs-title3); }
.empty-state p { margin: 0 0 16px; color: var(--label-2); font-size: var(--fs-subhead); }

/* ---------- 6b. Seite: Standort ---------------------------------------- */
.field { display: grid; gap: 6px; padding: 12px 16px; }
.field + .field { border-top: .5px solid var(--separator); }
.field label { font-size: var(--fs-footnote); font-weight: 600; color: var(--label-2); }
.field select {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  font-size: var(--fs-body);
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field select:disabled { opacity: .5; }

.status-line {
  min-height: 1.4em;
  margin: 12px 4px 0;
  font-size: var(--fs-subhead);
  color: var(--label-2);
}
.status-line[data-status-type="error"] { color: var(--danger); }
.status-line[data-status-type="success"] { color: var(--positive); }

.saved-name { margin: 0 0 8px; font-size: var(--fs-body); }
.split-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0 -8px -8px; }

.privacy-note {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--fill);
  font-size: var(--fs-footnote);
  color: var(--label-2);
}
.privacy-note svg { width: 18px; height: 18px; flex: none; fill: currentColor; margin-top: 1px; }

/* ---------- 6c. Seite: Qibla ------------------------------------------- */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  border-radius: 12px;
  background: var(--fill);
}
.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--label);
  font-size: var(--fs-subhead);
  font-weight: 600;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}

.qibla-view { display: none; }
.qibla-view.is-active { display: block; }

.qibla-compass {
  position: relative;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  margin: 20px auto 8px;
}
.qibla-compass img { width: 100%; height: 100%; object-fit: contain; }
.qibla-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 36%;
  border-radius: 6px 6px 3px 3px;
  background: var(--accent);
  transform: translate(-50%, -100%) rotate(0deg);
  transform-origin: 50% 100%;
  transition: transform .1s linear;
}
.qibla-needle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -16px;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid var(--accent);
}
.qibla-needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
}
.qibla-needle.is-aligned { background: var(--positive); }
body:not(.compass-active) .qibla-needle { opacity: .35; }
.qibla-needle.is-aligned::before { border-bottom-color: var(--positive); }
.qibla-needle.is-aligned::after { background: var(--positive); }

.qibla-note {
  margin: 8px auto 0;
  max-width: 34ch;
  text-align: center;
  font-size: var(--fs-footnote);
  color: var(--label-2);
}

.qibla-aligned-text {
  margin: 8px 0 0;
  text-align: center;
  font-weight: 700;
  color: var(--positive);
  min-height: 1.4em;
}

.metrics { display: grid; grid-template-columns: 1fr 1fr; }
.metric { padding: 14px 16px; }
.metric + .metric { border-left: .5px solid var(--separator); }
.metric strong {
  display: block;
  font-family: var(--font-rounded);
  font-size: var(--fs-title2);
  font-variant-numeric: tabular-nums;
}
.metric span { font-size: var(--fs-footnote); color: var(--label-2); }

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--warning-tint);
  color: var(--warning);
  font-size: var(--fs-subhead);
}

/* Handmodus */
.qibla-hand-scene {
  position: relative;
  aspect-ratio: 4 / 3;
  margin-top: 16px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #000;
}
#qiblaHandImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% center;
  filter: blur(10px) brightness(.6);
  transition: object-position .11s linear, filter .13s linear;
}
.qibla-hand-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "arrow direction" "arrow degrees";
  column-gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
}
.qibla-hand-arrow { grid-area: arrow; font-size: 2.2rem; font-weight: 700; line-height: 1; }
#qiblaHandDirection { grid-area: direction; font-size: var(--fs-callout); white-space: nowrap; }
#qiblaHandDegrees { grid-area: degrees; font-size: var(--fs-footnote); color: rgba(255, 255, 255, .8); }
.qibla-hand-scene.is-aligned .qibla-hand-guide { display: none; }
.qibla-hand-aligned {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .62);
  color: #8ff2a4;
  font-weight: 700;
  display: none;
}
.qibla-hand-scene.is-aligned .qibla-hand-aligned { display: block; }
.qibla-hand-topbar { display: none; }

/* Handmodus im Vollbild */
body.qibla-hand-fullscreen { overflow: hidden; background: #000; }
body.qibla-hand-fullscreen .tabbar,
body.qibla-hand-fullscreen .page-header,
body.qibla-hand-fullscreen #qiblaIntro,
body.qibla-hand-fullscreen #qiblaMetricsCard,
body.qibla-hand-fullscreen #qiblaHandView > .qibla-note { display: none; }
body.qibla-hand-fullscreen #qiblaHandView {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
}
body.qibla-hand-fullscreen .qibla-hand-scene {
  position: absolute;
  inset: 0;
  margin: 0;
  aspect-ratio: auto;
  border-radius: 0;
}
body.qibla-hand-fullscreen #qiblaHandImage { filter: none; }
body.qibla-hand-fullscreen .qibla-hand-topbar {
  position: absolute;
  z-index: 3;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.qibla-hand-topbar strong { font-size: var(--fs-body); }
.qibla-hand-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  cursor: pointer;
}
.qibla-hand-close svg { width: 20px; height: 20px; fill: currentColor; }
body.qibla-hand-fullscreen .qibla-hand-guide,
body.qibla-hand-fullscreen .qibla-hand-aligned { top: 24%; }
body.qibla-hand-fullscreen #qiblaModeCard {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(360px, calc(100% - 24px));
  padding: 6px;
  border-radius: 16px;
  background: rgba(245, 245, 247, .9);
  color: #1c1c1e;
}
body.qibla-hand-fullscreen #qiblaModeCard .qibla-note { display: none; }
body.qibla-hand-fullscreen #qiblaModeCard .segmented button { color: #1c1c1e; }
body.qibla-hand-fullscreen #qiblaModeCard .segmented button[aria-pressed="true"] { background: #fff; }

/* ---------- 6d. Seite: Besondere Tage ---------------------------------- */
.next-event {
  padding: 18px 16px;
  display: grid;
  gap: 4px;
}
.next-event .eyebrow { font-size: var(--fs-footnote); font-weight: 600; color: var(--accent); }
.next-event .name { font-family: var(--font-display); font-size: var(--fs-title1); font-weight: 700; line-height: 1.15; }
.next-event .when { font-size: var(--fs-callout); color: var(--label-2); }
.next-event .button { margin-top: 12px; justify-self: start; }

.event-row .row-title { font-weight: 600; }
.event-row.is-today { background: var(--accent-tint); }

details.disclosure > summary {
  list-style: none;
  min-height: 48px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--label-2);
  border-bottom: 2px solid var(--label-2);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s ease;
  flex: none;
}
details.disclosure[open] > summary::after { transform: translateY(2px) rotate(225deg); }
details.disclosure > summary .count { margin-left: auto; color: var(--label-2); font-weight: 400; }

.past-list .row-title { color: var(--label-2); }

/* ---------- 6e. Seite: 32 Farz ----------------------------------------- */
.farz-list { display: grid; gap: 12px; }
.farz-list details.disclosure > summary { font-size: var(--fs-body); }
.farz-list details.disclosure > summary .count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700;
  font-size: var(--fs-footnote);
  text-align: center;
}
.farz-list ol {
  margin: 0;
  padding: 0 16px 16px 44px;
  display: grid;
  gap: 8px;
  font-size: var(--fs-body);
  line-height: 1.4;
}
.farz-list li::marker { color: var(--label-2); font-variant-numeric: tabular-nums; }

/* ---------- 6f. Seite: Installieren ------------------------------------ */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 60px;
  min-height: 56px;
}
.steps li + li { border-top: .5px solid var(--separator); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700;
  font-size: var(--fs-subhead);
}

/* ---------- 7. Sheets, Dialoge, Statusmeldung -------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, .32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 0;
  width: min(100%, 520px);
  max-height: 88dvh;
  overflow: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .22);
  transform: translate(-50%, 100%);
  visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
}
.sheet.is-open {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 0 auto 6px;
  border-radius: 3px;
  background: var(--fill-strong);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.sheet-title { margin: 0; font-size: var(--fs-title3); font-weight: 700; }
.sheet-text { margin: 4px 0 16px; font-size: var(--fs-subhead); color: var(--label-2); }

.sheet .card { background: var(--surface-2); box-shadow: none; }

.sheet-row {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: transparent;
  font-size: var(--fs-body);
  text-align: left;
  text-decoration: none;
  color: var(--label);
  cursor: pointer;
  position: relative;
}
.sheet-row + .sheet-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: .5px solid var(--separator);
}
.sheet-row .value { color: var(--label-2); }
.sheet-row svg { width: 20px; height: 20px; fill: var(--accent); }

.switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: none;
  border-radius: 999px;
  background: var(--fill-strong);
  transition: background-color .2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}
[aria-checked="true"] .switch { background: #34c759; }
[aria-checked="true"] .switch::after { transform: translateX(20px); }

/* Vollbild-Ansicht Tagesinhalt */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, .94);
  color: #fff;
}
.viewer.is-open { display: flex; }
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.viewer-header h2 { margin: 0; font-size: var(--fs-body); font-weight: 700; }
.viewer-header .button-plain { color: #8cc4ff; }
.viewer-body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px 16px;
}
.viewer-body img { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: 12px; }
.viewer-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 8px 16px max(16px, env(safe-area-inset-bottom));
}
.viewer-footer .icon-button { background: rgba(255, 255, 255, .16); color: #fff; }
.viewer-dots { display: flex; gap: 8px; }
.viewer-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .4); }
.viewer-dots span.is-active { background: #fff; }

/* Statusmeldung (Toast) */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  background: #1c1c1e;
  color: #fff;
  font-size: var(--fs-subhead);
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast[data-status-type="error"] { background: #8e1a12; }
.toast[data-status-type="warning"] { background: #6b4100; }
@media (prefers-color-scheme: dark) {
  .toast { background: #3a3a3c; }
}

/* ---------- 8. Breite Fenster (iPad, Desktop, Wanddisplay) ------------- */
@media (min-width: 900px) {
  .page { width: min(100%, 1120px); padding-top: calc(var(--tabbar-h) + 32px); }

  /* Tab-Leiste wandert nach oben, wie unter iPadOS */
  .tabbar { top: max(14px, env(safe-area-inset-top)); bottom: auto; width: 420px; }

  .page-times {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "toolbar toolbar"
      "hero list"
      "daily list"
      "extra extra";
    column-gap: 40px;
    align-items: start;
  }
  .page-times > .toolbar { grid-area: toolbar; }
  .page-times > .hero { grid-area: hero; padding-top: 32px; }
  .page-times > #prayerSection { grid-area: list; margin-top: 32px; }
  .page-times > #dailySection { grid-area: daily; }
  .page-times > .page-extra { grid-area: extra; }
  .page-times #dailySection .section-title { margin-top: 8px; }

  .hero-clock {
    display: block;
    margin: 0 0 12px;
    font-family: var(--font-rounded);
    font-size: var(--fs-title1);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--on-sky-2);
  }
  .hero-countdown { font-size: clamp(4rem, 7vw, 6rem); }

  .page-narrow { width: min(100%, 720px); }

  .sheet {
    bottom: auto;
    top: 50%;
    border-radius: 24px;
    transform: translate(-50%, -46%);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  }
  .sheet.is-open {
    transform: translate(-50%, -50%);
    opacity: 1;
    transition: opacity .2s ease, transform .2s ease, visibility 0s;
  }
  .sheet-grabber { display: none; }
}

@media (hover: hover) {
  .tabbar a:hover:not([aria-current="page"]) { background: var(--fill); }
  .toolbar-button:hover, .sheet-row:hover { background: var(--fill); }
  .button-primary:hover { filter: brightness(1.08); }
}

/* ---------- 9. Barrierefreiheit ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .sheet, .sheet.is-open { transform: translate(-50%, 0); }
  .button:active, .icon-button:active, .toolbar-button:active, .daily-tile:active { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --label-2: #3a3a3c;
    --separator: rgba(60, 60, 67, .5);
    --accent: #0040dd;
    --bar-border: rgba(0, 0, 0, .4);
    --on-sky-2: #1c1c1e;
  }
  .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .card { border: 1px solid var(--separator); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --label-2: #d1d1d6;
    --separator: rgba(255, 255, 255, .45);
    --accent: #9cc8ff;
    --bar-border: rgba(255, 255, 255, .45);
    --on-sky-2: #f5f5f7;
  }
}

@media (forced-colors: active) {
  .tabbar a[aria-current="page"] { outline: 2px solid CanvasText; }
  .switch { border: 1px solid CanvasText; }
}
