/* Design tokens. One variable vocabulary, eleven palettes selected with
   data-theme on the html element; --map-tiles and --on-* carry what a palette
   cannot express (how the raster map should read, what text sits on a fill).
   The default palette is the sage/green/gold one the whole interface was
   drawn against; every other palette re-tunes the same names. */

:root {
  --color-bg-primary: #f6f7f4;
  --color-bg-secondary: #eef2e9;
  --color-bg-card: #ffffff;
  --color-bg-glass: #ffffffeb;
  --color-bg-hover: #28513f0f;
  --color-accent: #28513f;
  --color-accent-light: #38664e;
  --color-accent-muted: #1f4232;
  --color-gold: #c7a86d;
  --color-gold-light: #d9be8b;
  --color-gold-muted: #a08c5b;
  --color-danger: #b3261e;
  --color-text-primary: #273a31;
  --color-text-secondary: #67746b;
  --color-text-muted: #656f66;
  --color-border: #e6e9e1;
  --color-border-hover: #cdd8c7;
  --color-topbar-bg: #f6f7f4f2;
  --color-topbar-border: #e6e9e1;
  --color-line-soft: #eef1e9;
  --radius-card: 14px;
  --radius-btn: 10px;
  --shadow-card: 0 6px 24px #243a2d0a;
  --shadow-pop: 0 12px 34px #18291b1f;
  --shadow-gold: 0 0 0 3px #c7a86d2e;
  --transition: all .22s cubic-bezier(.4, 0, .2, 1);
  --on-accent: #ffffff;
  --on-gold: #2b2416;
  --map-tiles: saturate(.86);
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --font-arabic: "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Traditional Arabic", serif;
}

[data-theme=cream-mint] {
  --color-bg-primary: #f6f7f4;
  --color-bg-secondary: #eef2e9;
  --color-bg-card: #ffffff;
  --color-bg-glass: #ffffffeb;
  --color-bg-hover: #28513f0f;
  --color-accent: #28513f;
  --color-accent-light: #38664e;
  --color-accent-muted: #1f4232;
  --color-gold: #c7a86d;
  --color-gold-light: #d9be8b;
  --color-gold-muted: #a08c5b;
  --color-text-primary: #273a31;
  --color-text-secondary: #67746b;
  --color-text-muted: #656f66;
  --color-border: #e6e9e1;
  --color-border-hover: #cdd8c7;
  --color-topbar-bg: #f6f7f4f2;
  --color-topbar-border: #e6e9e1;
  --color-line-soft: #eef1e9;
}

[data-theme=ivory] {
  --color-bg-primary: #f7f4ee;
  --color-bg-secondary: #efe9df;
  --color-bg-card: #ffffff;
  --color-bg-glass: #ffffffeb;
  --color-bg-hover: #6d5f4a0f;
  --color-accent: #6f5f45;
  --color-accent-light: #8a785a;
  --color-accent-muted: #574a36;
  --color-gold: #b9964f;
  --color-gold-light: #d0b071;
  --color-gold-muted: #8d7138;
  --color-text-primary: #2f2a24;
  --color-text-secondary: #6d6459;
  --color-text-muted: #746c61;
  --color-border: #e6e0d5;
  --color-border-hover: #d3c8b5;
  --color-topbar-bg: #f7f4eef2;
  --color-topbar-border: #e6e0d5;
  --color-line-soft: #efeae0;
}

[data-theme=sepia] {
  --color-bg-primary: #f6efe1;
  --color-bg-secondary: #ece0c8;
  --color-bg-card: #fdf8ec;
  --color-bg-glass: #fdf8ebeb;
  --color-bg-hover: #8b5a2b0f;
  --color-accent: #8b5a2b;
  --color-accent-light: #a67c52;
  --color-accent-muted: #6d4520;
  --color-gold: #b8860b;
  --color-gold-light: #d4a017;
  --color-gold-muted: #8a6510;
  --color-text-primary: #3d3422;
  --color-text-secondary: #70654f;
  --color-text-muted: #746952;
  --color-border: #e3d6bb;
  --color-border-hover: #cbb68c;
  --color-topbar-bg: #f6efe1f2;
  --color-topbar-border: #e3d6bb;
  --color-line-soft: #ece1ca;
}

[data-theme=editorial] {
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f5f6f5;
  --color-bg-card: #ffffff;
  --color-bg-glass: #fffffff2;
  --color-bg-hover: #0000000a;
  --color-accent: #181818;
  --color-accent-light: #333333;
  --color-accent-muted: #000000;
  --color-gold: #181818;
  --color-gold-light: #3a3a3a;
  --color-gold-muted: #636363;
  --color-text-primary: #181818;
  --color-text-secondary: #616161;
  --color-text-muted: #737373;
  --color-border: #e7e7e7;
  --color-border-hover: #c9c9c9;
  --color-topbar-bg: #fffffff5;
  --color-topbar-border: #ececec;
  --color-line-soft: #f0f0f0;
  --radius-card: 4px;
  --radius-btn: 75px;
  --shadow-card: none;
  --shadow-pop: 0 10px 30px #0000001a;
  --shadow-gold: 0 0 0 3px #00000014;
  --on-gold: #ffffff;
}

[data-theme=medina-night] {
  --color-bg-primary: #131e19;
  --color-bg-secondary: #1c2922;
  --color-bg-card: #1c2922;
  --color-bg-glass: #1c2922e6;
  --color-bg-hover: #ffffff12;
  --color-accent: #90b69c;
  --color-accent-light: #a9ceb5;
  --color-accent-muted: #2c3f32;
  --color-gold: #c7a86d;
  --color-gold-light: #dcc291;
  --color-gold-muted: #a8905c;
  --color-text-primary: #e7ede5;
  --color-text-secondary: #b0bdb3;
  --color-text-muted: #87998d;
  --color-border: #344238;
  --color-border-hover: #4b5e50;
  --color-topbar-bg: #131e19f2;
  --color-topbar-border: #26352c;
  --color-line-soft: #223028;
  --shadow-card: 0 6px 24px #00000047;
  --shadow-pop: 0 14px 38px #00000073;
  --on-accent: #12201a;
  --on-gold: #1d1709;
  --map-tiles: invert(1) hue-rotate(185deg) brightness(.92) saturate(.72);
}

[data-theme=olive-sand] {
  --color-bg-primary: #171c12;
  --color-bg-secondary: #232a1a;
  --color-bg-card: #232a1a;
  --color-bg-glass: #232a1ae6;
  --color-bg-hover: #ffffff12;
  --color-accent: #a3c55e;
  --color-accent-light: #bcd97d;
  --color-accent-muted: #3b4a26;
  --color-gold: #c9a227;
  --color-gold-light: #e0bc44;
  --color-gold-muted: #9a7f22;
  --color-text-primary: #eae7db;
  --color-text-secondary: #b0ac9c;
  --color-text-muted: #949283;
  --color-border: #3a4430;
  --color-border-hover: #525f43;
  --color-topbar-bg: #171c12f2;
  --color-topbar-border: #2c3524;
  --color-line-soft: #262e1e;
  --shadow-card: 0 6px 24px #00000052;
  --shadow-pop: 0 14px 38px #0000007a;
  --on-accent: #16200c;
  --map-tiles: invert(1) hue-rotate(180deg) brightness(.92) saturate(.7);
}

[data-theme=sky-marble] {
  --color-bg-primary: #12101e;
  --color-bg-secondary: #1e1a33;
  --color-bg-card: #1e1a33;
  --color-bg-glass: #1e1a33e6;
  --color-bg-hover: #ffffff12;
  --color-accent: #a78bfa;
  --color-accent-light: #c0a9ff;
  --color-accent-muted: #362a56;
  --color-gold: #c9a227;
  --color-gold-light: #e0bc44;
  --color-gold-muted: #9a7f22;
  --color-text-primary: #ede8f5;
  --color-text-secondary: #aca6c2;
  --color-text-muted: #8d89a8;
  --color-border: #322b4d;
  --color-border-hover: #493f6d;
  --color-topbar-bg: #12101ef2;
  --color-topbar-border: #262040;
  --color-line-soft: #221d38;
  --shadow-card: 0 6px 24px #00000059;
  --shadow-pop: 0 14px 38px #00000080;
  --on-accent: #1a1226;
  --map-tiles: invert(1) hue-rotate(200deg) brightness(.9) saturate(.7);
}

[data-theme=qibla-gold] {
  --color-bg-primary: #191406;
  --color-bg-secondary: #262010;
  --color-bg-card: #262010;
  --color-bg-glass: #262010e6;
  --color-bg-hover: #ffffff12;
  --color-accent: #d4af37;
  --color-accent-light: #f0c84a;
  --color-accent-muted: #4a3c0d;
  --color-gold: #d4af37;
  --color-gold-light: #f0c84a;
  --color-gold-muted: #a8892b;
  --color-text-primary: #f5f0e0;
  --color-text-secondary: #c0b184;
  --color-text-muted: #9c8d5f;
  --color-border: #3d3315;
  --color-border-hover: #5c4d22;
  --color-topbar-bg: #191406f2;
  --color-topbar-border: #322a10;
  --color-line-soft: #241e0e;
  --shadow-card: 0 6px 24px #0000005c;
  --shadow-pop: 0 14px 38px #00000085;
  --on-accent: #1c1503;
  --map-tiles: invert(1) hue-rotate(160deg) brightness(.9) saturate(.8);
}

[data-theme=tender-rose] {
  --color-bg-primary: #1c0f16;
  --color-bg-secondary: #2c1722;
  --color-bg-card: #2c1722;
  --color-bg-glass: #2c1722e6;
  --color-bg-hover: #ffffff12;
  --color-accent: #f472b6;
  --color-accent-light: #fda4cd;
  --color-accent-muted: #4d2236;
  --color-gold: #e8a0b8;
  --color-gold-light: #fbbfd6;
  --color-gold-muted: #b47c90;
  --color-text-primary: #f8e8f0;
  --color-text-secondary: #c7a0ae;
  --color-text-muted: #a17e8b;
  --color-border: #45222f;
  --color-border-hover: #633446;
  --color-topbar-bg: #1c0f16f2;
  --color-topbar-border: #381b28;
  --color-line-soft: #2a1520;
  --shadow-card: 0 6px 24px #0000005c;
  --shadow-pop: 0 14px 38px #00000085;
  --on-accent: #2a1020;
  --map-tiles: invert(1) hue-rotate(200deg) brightness(.9) saturate(.8);
}

[data-theme=lilac-pearl] {
  --color-bg-primary: #151021;
  --color-bg-secondary: #221a33;
  --color-bg-card: #221a33;
  --color-bg-glass: #221a33e6;
  --color-bg-hover: #ffffff12;
  --color-accent: #b89cef;
  --color-accent-light: #d0bdf7;
  --color-accent-muted: #372a52;
  --color-gold: #d4a5e0;
  --color-gold-light: #e8c8f0;
  --color-gold-muted: #a077aa;
  --color-text-primary: #f0e8f8;
  --color-text-secondary: #b3a3c4;
  --color-text-muted: #8f81a2;
  --color-border: #35294a;
  --color-border-hover: #4d3d69;
  --color-topbar-bg: #151021f2;
  --color-topbar-border: #2a2040;
  --color-line-soft: #201831;
  --shadow-card: 0 6px 24px #0000005c;
  --shadow-pop: 0 14px 38px #00000085;
  --on-accent: #1f1630;
  --map-tiles: invert(1) hue-rotate(195deg) brightness(.9) saturate(.75);
}

[data-theme=full-black] {
  --color-bg-primary: #000000;
  --color-bg-secondary: #101010;
  --color-bg-card: #101010;
  --color-bg-glass: #000000f2;
  --color-bg-hover: #ffffff12;
  --color-accent: #d4af37;
  --color-accent-light: #f0c84a;
  --color-accent-muted: #33290b;
  --color-gold: #d4af37;
  --color-gold-light: #f0c84a;
  --color-gold-muted: #a8892b;
  --color-text-primary: #e6e6e6;
  --color-text-secondary: #a3a3a3;
  --color-text-muted: #808080;
  --color-border: #232323;
  --color-border-hover: #3a3a3a;
  --color-topbar-bg: #000000f5;
  --color-topbar-border: #1c1c1c;
  --color-line-soft: #171717;
  --shadow-card: 0 6px 24px #000000a6;
  --shadow-pop: 0 14px 38px #000000d9;
  --on-accent: #0a0a0a;
  --map-tiles: invert(1) hue-rotate(180deg) brightness(.75) saturate(.55);
}

/* Error copy sits on a card, so the dark palettes need the lighter red. */
[data-theme=medina-night], [data-theme=olive-sand], [data-theme=sky-marble],
[data-theme=qibla-gold], [data-theme=tender-rose], [data-theme=lilac-pearl],
[data-theme=full-black] {
  --color-danger: #ff8a7a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font: 15px/1.5 var(--font-sans);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; transition: background .22s, color .22s; }
/* The bottom bar is fixed, so a phone needs room for it or the last card of
   the list hides behind it for good. The class the old shell used for this
   stopped being applied by the redesigned one, which is how the tail went
   missing on a Mini App. */
@media (max-width: 1023px) { body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); } }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--color-bg-secondary); color: var(--color-accent); }

.no-transition, .no-transition * { transition: none !important; }
[hidden] { display: none !important; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 14px; height: 14px; }

/* ---------- splash ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 18%, var(--color-bg-secondary), var(--color-bg-primary) 62%);
  transition: opacity .55s ease, visibility .55s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-art { width: 150px; height: 150px; }
.splash-art .body { fill: var(--color-accent); transform-origin: 50% 97%; animation: rise 1.15s cubic-bezier(.16,.84,.24,1) both; }
.splash-word {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  animation: fade .9s .35s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@media (prefers-reduced-motion: reduce) {
  .splash-art .body, .splash-word { animation: none; }
  .card { animation: none !important; }
}

/* ---------- shell: sidebar on a wide screen, bottom bar on a phone ---------- */
.shell { display: block; }
.sidebar { display: none; }
.main { min-width: 0; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 234px minmax(0, 1fr); align-items: start; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 26px 16px 16px;
    background: var(--color-bg-card);
    border-inline-end: 1px solid var(--color-border);
  }
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; fill: var(--color-accent); flex: none; }
.brand-name { font-weight: 800; letter-spacing: -.5px; font-size: 17px; color: var(--color-accent); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-name span { font-weight: 500; }
.brand-sub { display: block; font-size: 9.5px; letter-spacing: .3px; font-weight: 500; color: var(--color-text-muted); margin-top: 2px; }
.sidebar .brand { padding: 0 12px 22px; }
.sidebar .brand-mark { width: 32px; height: 32px; }
/* The mark on the pages the Worker writes - a city list, a legal page - where
   there is no app bar to carry it. Same drawing, same accent, one tap home. */
.page-brand { padding: 4px 0 18px; }
.page-brand a { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.page-brand .brand-mark { width: 30px; height: 30px; }

.nav-group { display: grid; gap: 4px; }
.nav-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 12px 8px;
}
.nav-sep { margin: 20px 0 14px; border-top: 1px solid var(--color-line-soft); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
  transition: var(--transition);
}
.nav-item:hover { background: var(--color-bg-secondary); color: var(--color-accent); }
.nav-item.on { background: var(--color-accent); color: var(--on-accent); box-shadow: var(--shadow-card); }
.nav-item .ico { width: 18px; height: 18px; }
.nav-count { margin-inline-start: auto; padding: 1px 6px; border-radius: 5px; background: var(--color-bg-secondary); font-size: 10px; font-weight: 700; color: var(--color-text-muted); }
.nav-item.on .nav-count { background: #ffffff26; color: var(--on-accent); }
.nav-external { margin-inline-start: auto; color: var(--color-text-muted); }
.sidebar-foot { margin-top: auto; padding-top: 18px; }

.copyright { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 14px 12px 2px; font-size: 9px; color: var(--color-text-muted); }
.credit { font-weight: 600; letter-spacing: .2px; }

/* ---------- bottom navigation (phones and tablets) ---------- */
.bottom-nav {
  position: fixed;
  z-index: 950;
  inset: auto 0 0 0;
  display: grid;
  /* 1fr means minmax(auto,1fr): one long word in one of six languages would
     widen its cell and push the fourth one off the phone. The bar has to be
     four equal cells at 320 px, so a label that does not fit loses letters,
     not the screen it belongs to. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
}
.bn-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 2px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 9.5px;
  font-weight: 600;
  transition: var(--transition);
}
.bn-item .ico { width: 20px; height: 20px; }
.bn-item > span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-item.on { color: var(--color-accent); background: var(--color-bg-secondary); }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 10px 16px;
  padding-top: calc(10px + max(env(safe-area-inset-top), var(--tg-top, 0px)));
  background: var(--color-topbar-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--color-topbar-border);
}
.greeting { min-width: 0; }
.greeting-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.greeting-spark { color: var(--color-gold); font-size: 17px; line-height: 1; }
.greeting-date { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 3px; font-size: 10px; color: var(--color-text-muted); }
.greeting-date .sep { color: var(--color-border-hover); }
.topbar .brand { display: none; }
@media (max-width: 1023px) { .topbar .brand { display: flex; } .topbar .greeting { display: none; } }
/* A 360px phone has room for the wordmark, the place pill and two round
   buttons. The star is the fourth one and the bottom bar already carries
   "Saved", so it is the one that goes rather than the brand name. */
@media (max-width: 1023px) {
  .topbar { gap: 9px; padding-left: 12px; padding-right: 12px; }
  .topbar .brand { flex: 0 1 auto; min-width: 0; }
  .brand-name { font-size: 16px; }
  .where-btn { max-width: 34vw; }
  #fav-btn { display: none; }
}
/* On a 320px budget phone the wordmark, the city pill and both round buttons
   cannot all be true: something has to give, and it is the word, not the
   mark. The pin is the brand and it stays; the splash, the sidebar and the
   launcher all still spell the name out. */
@media (max-width: 359px) {
  .topbar .brand-name { display: none; }
  .where-btn { max-width: 42vw; }
}
@media (min-width: 1024px) { .topbar { padding: 14px 30px; min-height: 78px; } }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.where-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 46vw;
  padding: 7px 11px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  font-size: 11.5px;
  font-weight: 700;
  transition: var(--transition);
}
.where-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where-btn small { font-weight: 500; color: var(--color-text-muted); }
.where-btn:hover { border-color: var(--color-border-hover); }
.where-btn .ico { color: var(--color-accent); }
.topbar-sep { width: 1px; height: 20px; background: var(--color-border); margin: 0 2px; }
.icon-btn {
  display: grid;
  place-items: center;
  min-width: 33px;
  height: 33px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-weight: 700;
  font-size: 11px;
  transition: var(--transition);
}
.icon-btn:hover { border-color: var(--color-border-hover); color: var(--color-accent); background: var(--color-bg-secondary); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn.on { border-color: var(--color-gold); color: var(--color-gold); background: var(--color-bg-secondary); }
.icon-btn.on svg { fill: currentColor; }

/* ---------- pages ---------- */
.stage { width: 100%; }
.page { max-width: 1240px; margin: 0 auto; padding: 16px 16px 8px; }
@media (min-width: 1024px) { .page { padding: 22px 30px 12px; } }
/* A maximised window on a 1920 or a 2560 monitor is the desktop this app is
   meant to have, and a 1240px column stranded in the middle of it reads as a
   website inside a browser. The stage grows with the screen until the measure
   gets long enough to hurt, then stops. */
@media (min-width: 1600px) { .page { max-width: 1420px; } }
@media (min-width: 2000px) { .page { max-width: 1620px; } }
.page-title { margin: 4px 0 2px; font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.22; letter-spacing: -.5px; }
.page-lede { margin: 0 0 18px; color: var(--color-text-muted); font-size: 13px; }
.eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--color-text-muted); }
.eyebrow .dotmark { width: 5px; height: 5px; border-radius: 50%; background: var(--color-gold); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-row .page-title { margin: 0; }

/* ---------- prayer strip ---------- */
.strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-card);
}
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2px 4px 0; font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--color-text-muted); }
.strip-head b { color: var(--color-text-primary); font-size: 11.5px; letter-spacing: 0; }
.strip-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--color-bg-secondary);
}
.strip-next-label { display: flex; align-items: center; gap: 7px; font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--color-text-muted); }
.strip-next-label .dotmark { width: 5px; height: 5px; border-radius: 50%; background: var(--color-accent); }
.strip-next-main { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.prayer-next-name { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.prayer-next-at { font-size: 17px; font-weight: 700; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.prayer-next-in { font-size: 11px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.prayer-times { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.pt {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 4px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: center;
  transition: var(--transition);
}
.pt .ico { width: 15px; height: 15px; color: var(--color-text-muted); margin-bottom: 2px; }
.pt span { font-size: 10.5px; color: var(--color-text-muted); }
.pt b { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.pt.on { border-color: var(--color-border-hover); background: var(--color-bg-secondary); }
.pt.on .ico, .pt.on span { color: var(--color-accent); }
.strip-extra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prayer-extra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}
.chip:hover { border-color: var(--color-border-hover); color: var(--color-accent); background: var(--color-bg-secondary); }
.chip-accent { background: var(--color-accent); border-color: transparent; color: var(--on-accent); }
.chip-accent:hover { background: var(--color-accent-light); color: var(--on-accent); }
@media (min-width: 700px) {
  .strip { grid-template-columns: 236px minmax(0, 1fr); align-items: stretch; }
  .strip-side { display: grid; align-content: center; gap: 10px; }
  .strip-head { grid-column: 1 / -1; }
}

/* ---------- search, radius, filters ---------- */
.search-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.search-title { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.count-pill { padding: 3px 9px; border-radius: 999px; background: var(--color-bg-secondary); color: var(--color-text-muted); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.searchrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.searchbox { position: relative; flex: 1 1 240px; min-width: 0; display: flex; align-items: center; }
.searchbox > .ico { position: absolute; inset-inline-start: 13px; color: var(--color-text-muted); pointer-events: none; }
.search {
  flex: 1 1 240px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 12px 14px 12px 40px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}
html[dir=rtl] .search { padding: 12px 40px 12px 14px; }
.search::placeholder { color: var(--color-text-muted); }
.search:focus { border-color: var(--color-border-hover); box-shadow: var(--shadow-gold); }
.radius { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--color-border); border-radius: var(--radius-btn); background: var(--color-bg-card); }
.radius button { border: 0; background: transparent; border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); transition: var(--transition); }
.radius button.on { background: var(--color-accent); color: var(--on-accent); }
.radius button:hover:not(.on) { color: var(--color-accent); background: var(--color-bg-secondary); }
.go-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--color-accent);
  color: var(--on-accent);
  transition: var(--transition);
}
.go-btn:hover { background: var(--color-accent-light); }
.notice {
  padding: 10px 13px;
  border-radius: var(--radius-btn);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 12.5px;
  margin-bottom: 12px;
}

.filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 0 0 14px; }
.filters-label { font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--color-text-muted); margin-inline-end: 2px; }
.f-chip { padding: 8px 12px; font-size: 11.5px; }
.f-chip.on { background: var(--color-accent); border-color: transparent; color: var(--on-accent); }
.f-chip.on:hover { background: var(--color-accent-light); color: var(--on-accent); }
.f-clear { min-width: 32px; font-weight: 800; }

/* ---------- results: map + list ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(min(320px, 100%), .85fr); gap: 14px; align-items: start; }
.map {
  position: relative;
  height: 62vh;
  min-height: 340px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  background: var(--color-bg-secondary);
}
.map .leaflet-tile-pane { filter: var(--map-tiles); }
.map .leaflet-container { background: var(--color-bg-secondary); font-family: var(--font-sans); }
/* Leaflet pins its control rails at 1000, which is above the sticky header;
   the attribution has to slide under it rather than across it. */
.map .leaflet-top, .map .leaflet-bottom { z-index: 700; }
.panel { min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 2px 9px; font-size: 12px; color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }
.list { display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; padding: 2px; }

.card {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  animation: up .4s cubic-bezier(.16,.84,.24,1) both;
  transition: var(--transition);
}
.card:hover { border-color: var(--color-border-hover); transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.card.sel { border-color: var(--color-gold); box-shadow: var(--shadow-gold); }
@keyframes up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card-glyph {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 11px;
  background: var(--color-bg-secondary);
  overflow: hidden;
}
.card-glyph svg { width: 30px; height: 30px; fill: var(--color-accent); opacity: .5; }
.card-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-body { min-width: 0; display: grid; align-content: start; gap: 3px; }
.card-title { margin: 0; font-size: 14.5px; font-weight: 800; letter-spacing: -.2px; overflow-wrap: anywhere; }
.card-ar { color: var(--color-text-muted); font-size: 13px; direction: rtl; font-family: var(--font-arabic); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--color-text-muted); font-size: 11.5px; }
.card-meta .ico { width: 13px; height: 13px; }
.card-photo { display: block; width: 100%; max-height: 210px; object-fit: cover; border-radius: var(--radius-card); border: 1px solid var(--color-border); margin: 10px 0 2px; background: var(--color-bg-secondary); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--color-bg-secondary); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge .ico { width: 12px; height: 12px; }
.badge.gold { color: var(--color-gold-muted); border-color: var(--color-border-hover); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.dist { font-size: 11.5px; font-weight: 700; color: var(--color-accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--color-border);
  background: transparent;
  border-radius: var(--radius-btn);
  padding: 7px 11px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text-secondary);
  transition: var(--transition);
}
.act:hover { border-color: var(--color-border-hover); color: var(--color-accent); background: var(--color-bg-secondary); }
.act-primary { background: var(--color-accent); border-color: transparent; color: var(--on-accent); font-weight: 700; }
.act-primary:hover { background: var(--color-accent-light); color: var(--on-accent); }
.save-act { padding: 7px 9px; }
.save-act.on { border-color: var(--color-gold); color: var(--color-gold); background: var(--color-bg-secondary); }
.skel { height: 100px; border-radius: var(--radius-card); background: linear-gradient(90deg, var(--color-bg-secondary), var(--color-bg-card), var(--color-bg-secondary)); background-size: 300% 100%; animation: sweep 1.2s infinite; }
@keyframes sweep { from { background-position: 150% 0 } to { background-position: -150% 0 } }

/* ---------- times page ---------- */
.day-card { padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-bg-card); box-shadow: var(--shadow-card); }
.day-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.day-cell { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid var(--color-line-soft); border-radius: 12px; background: var(--color-bg-primary); }
.day-cell.on { border-color: var(--color-gold); background: var(--color-bg-secondary); }
.day-cell .ico { width: 19px; height: 19px; color: var(--color-gold-muted); }
.day-cell-name { display: block; font-size: 11.5px; color: var(--color-text-muted); }
.day-cell-time { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.day-note { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 11.5px; color: var(--color-text-muted); }
.stack-cards { display: grid; gap: 12px; }

/* ---------- qibla page ---------- */
.qibla-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) { .qibla-grid { grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); } }
.compass-card { display: grid; justify-items: center; gap: 6px; padding: 26px 16px 22px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-bg-card); box-shadow: var(--shadow-card); }
.compass { width: min(300px, 76vw); height: auto; }
.compass .ring { fill: none; stroke: var(--color-border); stroke-width: 1; }
.compass .ring-in { fill: var(--color-bg-primary); stroke: var(--color-line-soft); }
.compass .tick { stroke: var(--color-border-hover); stroke-width: 1; }
.compass .tick.major { stroke: var(--color-text-muted); stroke-width: 1.6; }
.compass .card-pt { fill: var(--color-text-muted); font-size: 11px; font-weight: 700; font-family: var(--font-sans); }
.compass .needle { stroke: var(--color-accent); stroke-width: 3.4; stroke-linecap: round; }
.compass .needle-tail { stroke: var(--color-border-hover); stroke-width: 3.4; stroke-linecap: round; }
.compass .hub { fill: var(--color-bg-card); stroke: var(--color-accent); stroke-width: 2.4; }
.compass .kaaba { fill: var(--color-gold); }
.compass-deg { margin-top: 10px; font-size: 34px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.compass-deg sup { font-size: 16px; color: var(--color-text-muted); }
.compass-sub { font-size: 11px; color: var(--color-text-muted); }
.qibla-side { display: grid; gap: 12px; }
/* The mark sits beside the dial on a wide screen; stacked over the controls on
   a phone it reads as an orphan, so it stays where it has a partner. */
.qibla-badge { display: none; width: 44px; height: 44px; border-radius: 12px; background: var(--color-bg-secondary); color: var(--color-accent); }
.qibla-badge svg { width: 22px; height: 22px; fill: currentColor; }
@media (min-width: 900px) { .qibla-badge { display: grid; place-items: center; } }
.qibla-coords { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.qibla-line { stroke: var(--color-gold); stroke-width: 3; stroke-dasharray: 12 9; fill: none; }

/* ---------- info callout ---------- */
.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.callout .ico { margin-top: 1px; color: var(--color-text-muted); }

/* ---------- detail sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: end center; }
.sheet-backdrop { position: absolute; inset: 0; background: #0d151285; backdrop-filter: blur(3px); }
.sheet-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: var(--shadow-pop);
  animation: slide .28s cubic-bezier(.16,.84,.24,1) both;
}
@media (min-width: 640px) { .sheet { place-items: center; } .sheet-card { border-radius: var(--radius-card); max-height: 84vh; } }
@keyframes slide { from { transform: translateY(34px); opacity: .5 } to { transform: none; opacity: 1 } }
.sheet-close { position: absolute; top: 14px; inset-inline-end: 14px; }
.sheet h2 { margin: 0 44px 2px 0; font-size: 19px; font-weight: 800; letter-spacing: -.35px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 10px; margin-top: 16px; font-size: 13px; }
.kv dt { color: var(--color-text-muted); }
.kv dd { margin: 0; word-break: break-word; }
.times-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 14px; }
.times-grid div { padding: 10px 8px; border-radius: var(--radius-btn); background: var(--color-bg-secondary); text-align: center; font-size: 11px; border: 1px solid var(--color-border); }
.times-grid b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }

.marker-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--color-accent-light); border: 2.5px solid var(--color-bg-card); box-shadow: 0 1px 5px #00000059; }
.marker-me { width: 17px; height: 17px; border-radius: 50%; background: #2f7bff; border: 3px solid #fff; box-shadow: 0 0 0 6px #2f7bff38; }

/* ---------- map tools, radius ring, selected pin ---------- */
/* Below the sticky top bar (900): the map scrolls under it and these must not
   ride on top of the header. */
.map-tools { position: absolute; z-index: 800; top: 10px; inset-inline-end: 10px; display: grid; gap: 6px; }
.maptool {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.maptool:hover { border-color: var(--color-border-hover); background: var(--color-bg-secondary); }
.map-hint {
  position: absolute;
  z-index: 800;
  inset-inline-start: 10px;
  bottom: 10px;
  pointer-events: none;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 11px;
  opacity: .94;
}
.radius-ring { stroke: var(--color-accent); stroke-width: 1.5; stroke-dasharray: 7 7; fill: var(--color-accent); fill-opacity: .07; }
.marker-pin-wrap { background: none; border: 0; }
.marker-pin {
  position: relative;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--color-gold);
  border: 3px solid var(--color-bg-card);
  box-shadow: 0 2px 6px #0000004d;
}
.marker-pin::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-gold);
  border-bottom: 0;
}
.leaflet-tooltip {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-card);
}
.leaflet-tooltip-top:before { border-top-color: var(--color-border); }
body.map-full .topbar,
body.map-full .bottom-nav,
body.map-full .search-head,
body.map-full .searchrow,
body.map-full .filters,
body.map-full .notice,
body.map-full .panel,
body.map-full .strip,
body.map-full .foot,
body.map-full .sidebar { display: none; }
body.map-full .stage { padding: 0; max-width: none; }
body.map-full .shell { display: block; }
body.map-full .page { padding: 0; max-width: none; }
body.map-full .grid { display: block; }
body.map-full .map { position: fixed; inset: 0; z-index: 1000; height: 100vh; min-height: 0; border: 0; border-radius: 0; }
@supports (height: 100dvh) { body.map-full .map { height: 100dvh; } }
body.map-full .map-hint { display: none; }
body.map-full .sheet { z-index: 1200; }

/* ---------- theme picker ---------- */
.themepanel {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: start center;
  padding: 40px 14px 24px;
  background: #0a0f0c99;
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.themepanel-card {
  width: min(640px, 100%);
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
}
.themepanel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.themepanel-head h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(178px, 100%), 1fr)); gap: 10px; }
.theme-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  text-align: left;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  transition: var(--transition);
}
.theme-item:hover { border-color: var(--color-border-hover); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.theme-item.on { border-color: var(--color-gold); box-shadow: var(--shadow-gold); }
.theme-name { display: block; font-size: 13px; font-weight: 700; color: var(--color-text-primary); }
.theme-desc { display: block; font-size: 11px; color: var(--color-text-muted); }
/* The swatch carries its own data-theme, so it paints the palette it previews. */
.theme-swatch {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  flex: none;
}
.theme-swatch span { position: absolute; display: block; }
.theme-swatch .sw-bg { inset: 0; background: var(--color-bg-secondary); }
.theme-swatch .sw-band { left: 0; right: 0; bottom: 0; height: 46%; background: var(--color-accent); }
.theme-swatch .sw-dot { right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-gold); }
.theme-swatch .sw-card { left: 6px; top: 6px; width: 12px; height: 20px; border-radius: 4px; background: var(--color-bg-card); }

/* ---------- language picker ---------- */
.langpanel {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: start center;
  padding: 40px 14px 24px;
  background: #0a0f0c99;
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.langpanel-card { width: min(400px, 100%); }
.langpanel-grid { display: grid; gap: 8px; }
.lang-item {
  padding: 13px 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  transition: var(--transition);
}
.lang-item:hover { border-color: var(--color-border-hover); }
.lang-item.on { border-color: var(--color-gold); color: var(--color-accent); box-shadow: var(--shadow-gold); }

/* ---------- open-in-maps picker ---------- */
.mapsheet { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: end center; }
.mapsheet-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 18px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: var(--shadow-pop);
  animation: slide .28s cubic-bezier(.16,.84,.24,1) both;
}
@media (min-width: 640px) { .mapsheet { place-items: center; } .mapsheet-card { border-radius: var(--radius-card); } }
.mapsheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.mapsheet-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.mapapps { display: grid; gap: 8px; }
.mapapp {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border-radius: var(--radius-btn);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.mapapp:hover { border-color: var(--color-border-hover); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.mapapp-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
  font-weight: 800;
  font-size: 13px;
}
.mapapp-text { display: grid; gap: 2px; min-width: 0; }
.mapapp-name { font-weight: 700; font-size: 13.5px; }
.mapapp-note { font-size: 11px; color: var(--color-text-muted); }
.mapapp-go { color: var(--color-text-muted); font-size: 15px; }
.mapsheet-hint { margin-top: 12px; font-size: 11.5px; line-height: 1.5; color: var(--color-text-muted); }

/* ---------- add-a-masjid row and form ---------- */
.add-cta {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  text-align: start;
  border: 1px dashed var(--color-border-hover);
  border-radius: var(--radius-card);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.add-cta:hover { border-color: var(--color-accent); background: var(--color-bg-secondary); color: var(--color-text-primary); }
.add-cta b { display: block; font-size: 13.5px; font-weight: 800; }
.add-cta span { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.add-cta-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--color-bg-secondary); color: var(--color-accent); }
.add-cta-mark svg { width: 20px; height: 20px; fill: currentColor; }
.add-row {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--color-border-hover);
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}
.add-row:hover { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-bg-secondary); }

dialog.form-card {
  width: min(520px, calc(100vw - 26px));
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-pop);
}
dialog.form-card::backdrop { background: #0d151285; }
.form-card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.form-card form { display: grid; gap: 10px; margin-top: 14px; }
.form-card label { display: grid; gap: 5px; font-size: 11px; font-weight: 600; color: var(--color-text-muted); }
.form-card input, .form-card textarea {
  font: inherit;
  font-size: 15px;
  color: var(--color-text-primary);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg-primary);
}
.form-card input:focus, .form-card textarea:focus {
  border-color: var(--color-border-hover);
  outline: none;
  box-shadow: var(--shadow-gold);
}
.form-card .sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; inset-inline-start: -9999px; }
.error { margin: 0; font-size: 12.5px; color: var(--color-danger); }

/* A focused field under 16px makes iOS zoom the whole page and keep it there. */
@media (pointer: coarse) {
  .search, .form-card input, .form-card textarea { font-size: 16px; }
}

/* ---------- autocomplete ---------- */
.suggest {
  position: absolute;
  z-index: 1300;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-pop);
}
.sg-head {
  padding: 8px 10px 4px;
  font-size: 10px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.sg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.sg:hover, .sg:focus-visible { background: var(--color-bg-secondary); outline: none; }
.sg-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }
.sg-place .sg-name { color: var(--color-accent); }

/* ---------- install hint, footer ---------- */
.install-hint {
  position: fixed;
  z-index: 1350;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100% - 24px));
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  background: var(--color-bg-glass);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-pop);
  color: var(--color-text-primary);
  font-size: 12px;
}
@media (min-width: 1024px) { .install-hint { bottom: calc(18px + env(safe-area-inset-bottom)); } }
.install-hint span { min-width: 0; }
.install-hint.can-install #install-text { color: var(--color-accent); font-weight: 700; text-decoration: underline; cursor: pointer; }

.foot { padding: 22px 16px calc(26px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--color-text-muted); text-align: center; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--color-accent); }
/* The sidebar carries the About entry on a wide screen and is hidden on a
   phone, so the footer repeats it as a plain word rather than a button frame. */
.foot .foot-link { padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.foot .foot-link:hover { color: var(--color-accent); }
.dot { margin: 0 5px; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .map { height: 42vh; min-height: 260px; }
  .list { max-height: none; overflow: visible; }
  .prayer-times { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- right-to-left languages ---------- */
html[dir=rtl] .sheet-close { top: 14px; }
html[dir=rtl] .card-meta, html[dir=rtl] .badges { direction: rtl; }
html[dir=rtl] .mapapp, html[dir=rtl] .theme-item { text-align: right; }
html[dir=rtl] .theme-swatch .sw-dot { right: auto; left: 6px; }
html[dir=rtl] .theme-swatch .sw-card { left: auto; right: 6px; }
/* Numerals, times and bearings are always read left to right. */
html[dir=rtl] .pt b, html[dir=rtl] .day-cell-time, html[dir=rtl] .compass-deg,
html[dir=rtl] .dist, html[dir=rtl] .count-pill, html[dir=rtl] .qibla-coords,
html[dir=rtl] .prayer-next-at, html[dir=rtl] .prayer-next-in { direction: ltr; }

/* ---------- server-rendered legal and city pages ---------- */
.legal h1 { font-size: 24px; font-weight: 800; letter-spacing: -.4px; margin: 6px 0 10px; }
.legal h2 { font-size: 16px; margin: 22px 0 6px; }
.legal p, .legal li { font-size: 14px; line-height: 1.65; color: var(--color-text-secondary); max-width: 74ch; }
.legal ul { padding-inline-start: 20px; }
.plain-list { list-style: none; display: grid; gap: 8px; padding: 0; margin: 12px 0; }
.plain-list li { font-size: 14px; }
.plain-list a { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.plain-list a:hover { text-decoration: underline; }

/* ---------- the separator the server-rendered pages use ---------- */
/* The legal and city pages are built as strings, where a middle dot would have
   to be typed into source. The dot is drawn instead, so the same footer rule
   reads correctly wherever it is rendered. */
.foot .sep::after { content: "\00b7"; margin: 0 5px; }

/* ---------- the interface is not content ---------- */
/* A long press on a phone turns any word into a picked, copied fragment. The
   brand, the navigation, the buttons and the footer carry nothing a person
   needs to take out of the app, so their words stay put. What is genuinely
   copied - a name, an address, a phone number, a prayer time - lives in the
   cards and is left alone, and every field still takes a selection. */
.topbar, .brand, .bottom-nav, .sidebar-foot, .copyright, .credit, .foot, .filters,
.map-tools, .install-hint, .splash, .splash-word, .nav-item, .chip, .count-pill,
.icon-btn, .maptool, .go-btn, .act, .add-cta, .tabs, button {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, select, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
/* The mark is a drawing of ours; it should not be drag-saved off the page. */
.brand-mark, .splash-art, .dotmark, .greeting-spark, .add-cta-mark, svg { -webkit-user-drag: none; }
