:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222c;
  --text: #e8eaed;
  --muted: #9aa0ac;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.14);
  --border: #262b36;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --text: #14161a;
    --muted: #626873;
    --accent: #0f9d58;
    --accent-dim: rgba(15, 157, 88, 0.12);
    --border: #e2e5ea;
  }
}

* { box-sizing: border-box; }

/* An explicit `display` on an element (e.g. .qibla-facts { display: grid })
   otherwise beats the browser's default [hidden] rule, since both are
   author-origin once a class rule sets `display`. Keep `[hidden]` absolute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  max-width: 480px;
  margin: 0 auto;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
}

.lang-toggle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.lang-toggle:hover { color: var(--accent); border-color: var(--accent); }

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 4px 16px 48px;
  animation: rise 0.25s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card + .card { margin-top: 16px; }

.page-title {
  margin: 4px 0 6px;
  font-size: 1.2rem;
}

.page-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.city-form {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

#surah-select,
#times-type-select {
  flex: 1;
  min-width: 0;
  padding: 10px 36px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--panel-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa0ac' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

[dir="rtl"] #surah-select,
[dir="rtl"] #times-type-select {
  background-position: left 14px center;
  padding: 10px 12px 10px 36px;
}

#surah-select:focus,
#times-type-select:focus {
  outline: none;
  border-color: var(--accent);
}

.city-go {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.notice {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.notice-kicker {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}

.notice-text {
  margin: 0;
  font-size: 0.95rem;
}

.notice-source {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto 16px;
  padding: 0 16px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.tab[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.tab:hover { color: var(--text); }

.link-pill {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.link-pill:hover { border-color: var(--accent); }

.countdown {
  text-align: center;
  padding: 14px 0 18px;
}

.countdown-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.countdown-clock {
  display: block;
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  color: var(--accent);
}

.dateline {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.hijri {
  display: block;
  font-size: 0.82rem;
  opacity: 0.85;
}

.iqama-note {
  margin: -6px 0 16px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

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

.prayer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px;
  border-radius: 10px;
  font-size: 1.05rem;
}

.prayer + .prayer { margin-top: 6px; }

.prayer-name { font-weight: 600; }

.prayer-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.prayer.is-next {
  background: var(--accent-dim);
}

.prayer.is-next .prayer-name,
.prayer.is-next .prayer-time {
  color: var(--accent);
}

.prayer.is-next .prayer-name::after {
  content: " · next";
  font-weight: 500;
  font-size: 0.78rem;
  opacity: 0.8;
}

[dir="rtl"] .prayer.is-next .prayer-name::after {
  content: " · القادمة";
}

/* Friday: a small tag on Dhuhr where Jumu'ah is simply held at Dhuhr time,
   or — for the one city with a distinct official Jumu'ah clock time — its
   own lighter sub-row right underneath. */
.jumuah-tag {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prayer.prayer-jumuah {
  margin-top: -2px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 0.92rem;
}

.prayer-jumuah .prayer-name {
  font-weight: 500;
  color: var(--muted);
}

.prayer-jumuah .prayer-time {
  font-weight: 600;
  color: var(--accent);
}

.foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.foot a { color: inherit; }

.error h2 { margin-top: 0; font-size: 1.05rem; }

/* ---- Qibla tab ---- */

.warm-btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #0f1115;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.warm-btn:hover { opacity: 0.92; }
.warm-btn:active { transform: scale(0.99); }
.warm-btn:disabled { opacity: 0.6; cursor: default; }

.qibla-or {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

#qibla-locate { margin-top: 4px; width: 100%; }

/* Live camera view with a marker that slides left/right to the Kaaba's
   direction, and centers/glows once you're facing it — the primary Qibla
   experience when the camera and compass are both available. */
.ar-view {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  margin-bottom: 18px;
}

#qibla-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ar-reticle {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.35);
  transform: translateX(-50%);
  transition: background-color 0.15s;
}

.ar-view.is-aligned .ar-reticle { background: var(--accent); }

.ar-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  transition: transform 0.12s linear;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.ar-marker-shape {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1.5;
}

.ar-view.is-aligned .ar-marker-shape { fill: #fff; }

.ar-edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.ar-edge-left { left: 10px; }
.ar-edge-right { right: 10px; }

.ar-status {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.ar-resume {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  transform: translate(-50%, -50%);
}

.compass {
  text-align: center;
  margin-bottom: 18px;
}

#qibla-dial { width: 220px; max-width: 100%; height: auto; }

.compass-ring {
  fill: var(--panel-2);
  stroke: var(--border);
  stroke-width: 2;
}

.compass-n {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#qibla-needle {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.15s linear;
}

.compass-needle {
  fill: var(--accent);
}

.is-aligned .compass-needle { fill: var(--text); }
.is-aligned .compass-ring { stroke: var(--accent); stroke-width: 3; }

.compass-status {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.qibla-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 0;
}

.qibla-facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.qibla-facts dd {
  margin: 4px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.qibla-note {
  margin: 16px 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.qibla-accuracy {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Quran tab ---- */

.surah-meta { text-align: center; margin: 6px 0 18px; }

.surah-name { margin: 0; font-size: 1.5rem; }

.surah-sub {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.ayah {
  padding: 16px 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.ayah-number {
  display: inline-block;
  min-width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ayah-arabic {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 2;
}

.ayah-translation {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.quran-source {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.quran-source a { color: inherit; }

@media (max-width: 380px) {
  .qibla-facts { grid-template-columns: 1fr; }
  .ayah-arabic { font-size: 1.2rem; }
}

/* Searchable city combobox (public/citysearch.js) */
.citysearch {
  position: relative;
  margin-bottom: 18px;
}

.cs-row {
  display: flex;
  gap: 8px;
}

.cs-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

.cs-input:focus { outline: none; border-color: var(--accent); }

.cs-locate {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.cs-locate:hover { border-color: var(--accent); }

.cs-status {
  min-height: 1.1em;
  margin: 4px 2px 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.cs-listbox {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  max-height: 320px;
  overflow-y: auto;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.cs-message {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.cs-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

.cs-option.is-active,
.cs-option:hover { background: var(--accent-dim); }

.cs-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cs-option-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-option-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.cs-star {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.cs-star.is-on { color: var(--accent); }

/* Source-transparency panel (src/page.js, src/qiblaPage.js) */
.source-panel {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.source-panel dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0;
}

.source-panel dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.source-panel dd {
  margin: 3px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-badge.is-calculated { background: var(--accent-dim); color: var(--accent); }
.source-badge.is-official { background: rgba(74, 222, 128, 0.28); color: var(--accent); }

.source-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.source-note a { color: inherit; }

.settings-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.settings-form select {
  flex: 1;
  min-width: 140px;
  padding: 8px 30px 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa0ac' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

[dir="rtl"] .settings-form select {
  background-position: left 10px center;
  padding: 8px 10px 8px 30px;
}

@media (max-width: 380px) {
  .source-panel dl { grid-template-columns: 1fr; }
}

/* Quran memorisation player (public/quran.js) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 14px;
  border-radius: 0 0 10px 0;
  background: var(--accent);
  color: #06210f;
  font-weight: 700;
  z-index: 50;
}

.skip-link:focus { left: 0; }

/* A visible focus ring everywhere — the player is meant to be driven by
   keyboard, so focus must never be ambiguous. */
.player button:focus-visible,
.player select:focus-visible,
.player input:focus-visible,
.ayah-play:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.player {
  margin: 18px 0;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.player-heading {
  margin: 0 0 12px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.player-transport {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* .warm-btn is display:block/width:100% by default (it's a full-width CTA
   elsewhere); inside the transport row it has to size to content instead. */
.player-transport .warm-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 52px;
  min-height: 44px; /* comfortable touch target */
  padding: 12px 14px;
}

.player-transport .pl-main { flex: 1 1 auto; }

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.player-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.player-field select {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  min-height: 40px;
}

.player-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.player-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  cursor: pointer;
  min-height: 40px;
}

.player-check input { width: 18px; height: 18px; accent-color: var(--accent); }

.player-status {
  margin: 14px 0 0;
  min-height: 1.3em;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.player-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 8px;
}

.player-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s linear;
}

.player-help { margin-top: 14px; font-size: 0.82rem; color: var(--muted); }
.player-help summary { cursor: pointer; min-height: 32px; }
.player-help ul { margin: 8px 0 0; padding-inline-start: 18px; }

.player-a11y-note,
.player-meta {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.player-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  background: rgba(220, 80, 80, 0.14);
  color: #ffb4b4;
}

@media (prefers-color-scheme: light) {
  .player-error { color: #8a1f1f; }
}

.ayah-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ayah-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.ayah-play:hover { border-color: var(--accent); }

.ayah.is-playing {
  background: var(--accent-dim);
  border-radius: 10px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Recall practice: blur the text so it can be recited from memory, then
   revealed on hover/focus to check. Never applied to the ayah number, so
   you always know which verse you're on. */
.ayahs.is-hidden-text .ayah-arabic,
.ayahs.is-hidden-text .ayah-translation {
  filter: blur(6px);
  transition: filter 0.15s;
}

.ayahs.is-hidden-text .ayah:hover .ayah-arabic,
.ayahs.is-hidden-text .ayah:focus-within .ayah-arabic,
.ayahs.is-hidden-text .ayah.is-playing .ayah-arabic,
.ayahs.is-hidden-text .ayah:hover .ayah-translation,
.ayahs.is-hidden-text .ayah:focus-within .ayah-translation {
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .player-progress span,
  .ayahs.is-hidden-text .ayah-arabic,
  .ayahs.is-hidden-text .ayah-translation { transition: none; }
}

@media (max-width: 380px) {
  .player-grid { grid-template-columns: 1fr; }
}

/* Header actions: favourites shortcut + tasbih counter (public/header.js) */
.head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.head-icon svg { width: 20px; height: 20px; display: block; }
.head-icon:hover { color: var(--accent); border-color: var(--accent); }
.head-icon[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.head-icon:focus-visible,
.counter-dial:focus-visible,
.fav-link:focus-visible,
.fav-remove:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.head-panel {
  max-width: 480px;
  margin: -6px auto 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.head-panel-title {
  margin: 0 0 12px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.head-panel-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Favourites list */
.fav-list { list-style: none; margin: 0; padding: 0; }

.fav-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fav-item + .fav-item { margin-top: 4px; }

.fav-link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
}

.fav-link:hover { background: var(--accent-dim); }
.fav-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-sub { font-size: 0.76rem; color: var(--muted); }

.fav-remove {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.fav-remove:hover { color: var(--text); border-color: var(--border); }

/* Tasbih counter */
.counter-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 168px;
  height: 168px;
  margin: 4px auto 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.08s ease-out, border-color 0.15s, background 0.15s;
}

.counter-dial:hover { border-color: var(--accent); }
.counter-dial:active { transform: scale(0.97); }

.counter-dial.is-complete {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.counter-value {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--accent);
}

.counter-of {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1em;
}

.counter-hint,
.counter-live {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.1em;
}

.counter-live { color: var(--accent); font-weight: 600; }

.counter-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.counter-target {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--muted);
}

.counter-target select {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  min-height: 40px;
}

.counter-controls .city-go { min-height: 40px; }

@media (prefers-reduced-motion: reduce) {
  .counter-dial { transition: none; }
  .counter-dial:active { transform: none; }
}

/* Four tabs need to fit a phone: shrink type and let them scroll rather than
   wrap onto a second row. */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 8px; font-size: 0.86rem; white-space: nowrap; }

@media (max-width: 400px) {
  .tab { font-size: 0.8rem; padding: 10px 6px; }
}

/* ---- Dua & Adhkar tab ---- */
.dua-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.dua-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.15s, border-color 0.15s;
}

.dua-cat::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat, var(--accent));
  flex: 0 0 auto;
}

.dua-cat:hover { color: var(--text); border-color: var(--cat, var(--accent)); }

.dua-cat.is-active {
  color: var(--text);
  border-color: var(--cat, var(--accent));
  background: color-mix(in srgb, var(--cat, var(--accent)) 16%, transparent);
}

.dua-cat-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dua-heading {
  margin: 0 0 14px;
  padding-inline-start: 11px;
  border-inline-start: 3px solid var(--cat, var(--accent));
  font-size: 1rem;
}

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

.dua {
  padding: 16px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.dua + .dua { margin-top: 10px; }

.dua-ar {
  margin: 0;
  font-size: 1.32rem;
  line-height: 2.1;
  font-weight: 500;
}

.dua-en {
  margin: 12px 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.dua-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dua-source {
  font-size: 0.75rem;
  color: var(--muted);
}

.dua-repeat {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  min-height: 34px;
}

.dua-repeat:hover { background: var(--accent); color: #06210f; }
.dua-repeat:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.dua-note {
  margin: 18px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Category accents. These live here rather than in an inline style=
   attribute because the CSP is `style-src 'self'` with no 'unsafe-inline' —
   an inline style would be dropped and every category would render in the
   default green. tests/dua.test.js asserts these stay in sync with
   src/duas.js. */
.dua-cat[data-cat="morning"],
.dua-heading[data-cat="morning"] { --cat: #f4b740; }
.dua-cat[data-cat="evening"],
.dua-heading[data-cat="evening"] { --cat: #7aa7ff; }
.dua-cat[data-cat="afterprayer"],
.dua-heading[data-cat="afterprayer"] { --cat: #4ade80; }
.dua-cat[data-cat="sleep"],
.dua-heading[data-cat="sleep"] { --cat: #b39aff; }
.dua-cat[data-cat="waking"],
.dua-heading[data-cat="waking"] { --cat: #5fd3c4; }
.dua-cat[data-cat="quran"],
.dua-heading[data-cat="quran"] { --cat: #e78ea9; }

/* Nearest-mosque panel (public/header.js) */
#mosque-find { margin-bottom: 10px; }

.mosque-list { list-style: none; margin: 0; padding: 0; }
.mosque-item + .mosque-item { margin-top: 4px; }

.mosque-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
}

.mosque-link:hover { background: var(--accent-dim); }
.mosque-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.mosque-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mosque-meta { font-size: 0.76rem; color: var(--muted); }

.mosque-attrib {
  margin: 12px 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.mosque-maps { display: block; text-align: center; margin-top: 12px; }

/* Offline banner + downloads panel (public/pwa.js, public/download-quran.js) */
.offline-banner {
  max-width: 480px;
  margin: -6px auto 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(244, 183, 64, 0.14);
  border: 1px solid #f4b740;
  color: #f4b740;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.dl-intro {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.dl-warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(244, 183, 64, 0.1);
  border: 1px solid rgba(244, 183, 64, 0.4);
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.5;
}

.dl-progress-wrap { margin-top: 12px; }

.dl-status {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

.dl-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.dl-controls .city-go { flex: 1; }

.dl-delete {
  display: block;
  margin-top: 14px;
  text-align: center;
  width: 100%;
  border: none;
  cursor: pointer;
  font: inherit;
}

.dl-storage {
  margin: 10px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}
