/*
 * Salaty mosque display (/mosque) – a full-screen prayer-times board for a TV. Self-contained: the page loads only
 * this stylesheet and the board's modules. Night-sky colours of the app's SkyPalette (night / isha rows, gold and
 * emerald accents); build.py replaces data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M19.80 0.00L14.00 5.80L14.00 14.00L5.80 14.00L0.00 19.80L-5.80 14.00L-14.00 14.00L-14.00 5.80L-19.80 0.00L-14.00 -5.80L-14.00 -14.00L-5.80 -14.00L-0.00 -19.80L5.80 -14.00L14.00 -14.00L14.00 -5.80ZM75.80 0.00L70.00 5.80L70.00 14.00L61.80 14.00L56.00 19.80L50.20 14.00L42.00 14.00L42.00 5.80L36.20 0.00L42.00 -5.80L42.00 -14.00L50.20 -14.00L56.00 -19.80L61.80 -14.00L70.00 -14.00L70.00 -5.80ZM19.80 56.00L14.00 61.80L14.00 70.00L5.80 70.00L0.00 75.80L-5.80 70.00L-14.00 70.00L-14.00 61.80L-19.80 56.00L-14.00 50.20L-14.00 42.00L-5.80 42.00L-0.00 36.20L5.80 42.00L14.00 42.00L14.00 50.20ZM75.80 56.00L70.00 61.80L70.00 70.00L61.80 70.00L56.00 75.80L50.20 70.00L42.00 70.00L42.00 61.80L36.20 56.00L42.00 50.20L42.00 42.00L50.20 42.00L56.00 36.20L61.80 42.00L70.00 42.00L70.00 50.20ZM47.80 28.00L42.00 33.80L42.00 42.00L33.80 42.00L28.00 47.80L22.20 42.00L14.00 42.00L14.00 33.80L8.20 28.00L14.00 22.20L14.00 14.00L22.20 14.00L28.00 8.20L33.80 14.00L42.00 14.00L42.00 22.20Z' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='0.7'/%3E%3Cpath d='M7.68 3.18L3.18 7.68L-3.18 7.68L-7.68 3.18L-7.68 -3.18L-3.18 -7.68L3.18 -7.68L7.68 -3.18ZM63.68 3.18L59.18 7.68L52.82 7.68L48.32 3.18L48.32 -3.18L52.82 -7.68L59.18 -7.68L63.68 -3.18ZM7.68 59.18L3.18 63.68L-3.18 63.68L-7.68 59.18L-7.68 52.82L-3.18 48.32L3.18 48.32L7.68 52.82ZM63.68 59.18L59.18 63.68L52.82 63.68L48.32 59.18L48.32 52.82L52.82 48.32L59.18 48.32L63.68 52.82ZM35.68 31.18L31.18 35.68L24.82 35.68L20.32 31.18L20.32 24.82L24.82 20.32L31.18 20.32L35.68 24.82ZM33.94 0.00L28.00 5.94L22.06 0.00L28.00 -5.94ZM5.94 28.00L0.00 33.94L-5.94 28.00L-0.00 22.06ZM61.94 28.00L56.00 33.94L50.06 28.00L56.00 22.06ZM33.94 56.00L28.00 61.94L22.06 56.00L28.00 50.06Z' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='0.6'/%3E%3C/svg%3E (the star lattice). Logical properties throughout, so Arabic
 * mirrors; sizes scale with the viewport so the board is legible from across a room.
 */

:root {
  color-scheme: dark;
  --mb-rounded: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mb-arabic: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
  --mb-naskh: "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Times New Roman", serif;
  --ink: #fff;
  --ink-2: rgba(255, 255, 255, 0.8);
  --ink-3: rgba(255, 255, 255, 0.55);
  --text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --gold: #f3c468;
  --gold-light: #ffe096;
  --emerald: #4fd8ad;
  --glass-bg: rgba(255, 255, 255, 0.09);
  --glass-strong: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-rim: rgba(255, 255, 255, 0.24);
  --sky-top: #03060f;
  --sky-mid: #0a1733;
  --sky-low: #0c2f3e;
  --sky-bottom: #114541;
  --gap: clamp(0.5rem, 1.2vw, 1.5rem);
  --pad: clamp(0.75rem, 2vw, 2.5rem);
  --radius: clamp(14px, 1.8vw, 32px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--sky-top);
  color: var(--ink);
  font-family: var(--mb-rounded);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow: hidden;
}

:lang(ar) {
  font-family: var(--mb-arabic);
}

main {
  display: block;
  outline: none;
}

/* Trilingual root page: only the current language's blocks are visible (as site.css does). */
html[data-lang="de"] [data-l]:not([data-l="de"]),
html[data-lang="en"] [data-l]:not([data-l="en"]),
html[data-lang="ar"] [data-l]:not([data-l="ar"]) {
  display: none;
}

.visually-hidden,
.mb-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- Root and sky ---------- */

.mb-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(79, 216, 173, 0.22), transparent 60%),
    radial-gradient(60% 40% at 80% 0%, rgba(58, 79, 154, 0.35), transparent 70%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-low) 78%, var(--sky-bottom) 100%);
}

.mb-root::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M19.80 0.00L14.00 5.80L14.00 14.00L5.80 14.00L0.00 19.80L-5.80 14.00L-14.00 14.00L-14.00 5.80L-19.80 0.00L-14.00 -5.80L-14.00 -14.00L-5.80 -14.00L-0.00 -19.80L5.80 -14.00L14.00 -14.00L14.00 -5.80ZM75.80 0.00L70.00 5.80L70.00 14.00L61.80 14.00L56.00 19.80L50.20 14.00L42.00 14.00L42.00 5.80L36.20 0.00L42.00 -5.80L42.00 -14.00L50.20 -14.00L56.00 -19.80L61.80 -14.00L70.00 -14.00L70.00 -5.80ZM19.80 56.00L14.00 61.80L14.00 70.00L5.80 70.00L0.00 75.80L-5.80 70.00L-14.00 70.00L-14.00 61.80L-19.80 56.00L-14.00 50.20L-14.00 42.00L-5.80 42.00L-0.00 36.20L5.80 42.00L14.00 42.00L14.00 50.20ZM75.80 56.00L70.00 61.80L70.00 70.00L61.80 70.00L56.00 75.80L50.20 70.00L42.00 70.00L42.00 61.80L36.20 56.00L42.00 50.20L42.00 42.00L50.20 42.00L56.00 36.20L61.80 42.00L70.00 42.00L70.00 50.20ZM47.80 28.00L42.00 33.80L42.00 42.00L33.80 42.00L28.00 47.80L22.20 42.00L14.00 42.00L14.00 33.80L8.20 28.00L14.00 22.20L14.00 14.00L22.20 14.00L28.00 8.20L33.80 14.00L42.00 14.00L42.00 22.20Z' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='0.7'/%3E%3Cpath d='M7.68 3.18L3.18 7.68L-3.18 7.68L-7.68 3.18L-7.68 -3.18L-3.18 -7.68L3.18 -7.68L7.68 -3.18ZM63.68 3.18L59.18 7.68L52.82 7.68L48.32 3.18L48.32 -3.18L52.82 -7.68L59.18 -7.68L63.68 -3.18ZM7.68 59.18L3.18 63.68L-3.18 63.68L-7.68 59.18L-7.68 52.82L-3.18 48.32L3.18 48.32L7.68 52.82ZM63.68 59.18L59.18 63.68L52.82 63.68L48.32 59.18L48.32 52.82L52.82 48.32L59.18 48.32L63.68 52.82ZM35.68 31.18L31.18 35.68L24.82 35.68L20.32 31.18L20.32 24.82L24.82 20.32L31.18 20.32L35.68 24.82ZM33.94 0.00L28.00 5.94L22.06 0.00L28.00 -5.94ZM5.94 28.00L0.00 33.94L-5.94 28.00L-0.00 22.06ZM61.94 28.00L56.00 33.94L50.06 28.00L56.00 22.06ZM33.94 56.00L28.00 61.94L22.06 56.00L28.00 50.06Z' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='0.6'/%3E%3C/svg%3E");
  background-size: 112px 112px;
  background-position: center top;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 90%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 90%);
  pointer-events: none;
}

.mb-root[data-idle] {
  cursor: none;
}

.mb-root[data-idle] .mb-gear,
.mb-root[data-idle] .mb-keys {
  opacity: 0;
}

.mb-boot,
.mb-noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: var(--pad);
  color: var(--ink-2);
  font-size: clamp(1rem, 2vw, 1.5rem);
  text-align: center;
}

.mb-noscript {
  max-width: 40rem;
  margin: auto;
}

.mb-noscript a {
  color: var(--gold);
}

.mb-root[data-ready] .mb-boot {
  display: none;
}

/* ---------- Board ---------- */

.mb-board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  row-gap: max(var(--gap), 1.5vh);
  column-gap: var(--gap);
  padding: calc(var(--pad) * 0.8) var(--pad) calc(var(--pad) * 0.6);
  padding-inline: max(var(--pad), env(safe-area-inset-left)) max(var(--pad), env(safe-area-inset-right));
  text-align: start;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  transition: filter 2s ease;
}

.mb-board[data-dim="true"] {
  filter: brightness(0.7);
}

.mb-board p {
  margin: 0;
}

/* ---------- Top row ---------- */

.mb-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "name clock dates";
  align-items: center;
  gap: var(--gap);
}

.mb-name {
  grid-area: name;
  font-size: clamp(1.1rem, 2.6vw, 3.4rem);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
  text-shadow: var(--text-shadow);
}

.mb-clock {
  grid-area: clock;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.08em;
  /* ≥ 12 vw on a landscape screen, but never taller than a fifth of the screen (4K and 1080p alike). */
  font-size: clamp(3.5rem, 12vw, 16vw);
  font-size: round(up, min(max(3.5rem, 12vw), 15vh), 1px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  direction: ltr;
  color: var(--ink);
  text-shadow: var(--text-shadow);
}

.mb-clock-sec {
  font-size: 0.34em;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
}

.mb-clock-sec::before {
  content: ":";
}

.mb-clock-sec:empty::before {
  content: none;
}

.mb-clock-period {
  margin-inline-start: 0.1em;
  font-size: 0.26em;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
}

.mb-dates {
  grid-area: dates;
  display: grid;
  gap: 0.25em;
  justify-items: end;
  text-align: end;
  font-size: clamp(0.95rem, 2vw, 2.6rem);
  line-height: 1.25;
  text-shadow: var(--text-shadow);
}

.mb-date {
  font-weight: 650;
}

.mb-hijri {
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- Tiles ---------- */

.mb-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 0;
  align-self: center;
}

/*
 * A tile is a grid with the same rows everywhere (name / Arabic / time / iqama / note), so baselines line up across
 * the row. The glass (blur, fill, hairline, ring) lives on ::before, never on the element holding the text – a
 * backdrop filter on the text's own box softens it in Safari and Chrome. Nothing here is scaled or faded.
 */
.mb-tile {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: center;
  justify-items: center;
  row-gap: 0.1em;
  min-width: 0;
  padding: min(clamp(0.6rem, 1.6vw, 2rem), 2vh) clamp(0.4rem, 1vw, 1.2rem);
  border-radius: var(--radius);
  text-align: center;
  font-size: clamp(0.85rem, 1.9vw, 2.4rem);
  font-size: round(up, min(clamp(0.85rem, 1.9vw, 2.4rem), 3.4vh), 1px);
  --tile-fill: linear-gradient(180deg, rgba(26, 38, 74, 0.58), rgba(8, 14, 36, 0.66));
  --tile-ring: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  --tile-glow: 0 24px 48px -28px rgba(0, 0, 0, 0.7);
  --tile-ink: var(--ink);
}

.mb-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tile-fill);
  box-shadow: var(--tile-ring), var(--tile-glow);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  transition: background 0.6s ease, box-shadow 0.6s ease;
}

/* Gold hairline at the bottom of the next tile: fills from the last adhan to the next one, inset by the corner
   radius so it stays inside the rounded shape. Only the next tile has it. */
.mb-tile[data-state="next"]::after {
  content: "";
  position: absolute;
  inset-block-end: clamp(3px, 0.3vw, 6px);
  inset-inline-start: var(--radius);
  width: calc(var(--mb-progress, 0) * (100% - 2 * var(--radius)));
  height: clamp(2px, 0.25vw, 4px);
  border-radius: 999px;
  background: var(--gold);
  transition: width 1s linear;
}

.mb-tile[data-state="passed"] {
  --tile-ink: rgba(255, 255, 255, 0.72);
}

.mb-tile[data-state="next"] {
  --tile-fill: linear-gradient(180deg, rgba(44, 58, 104, 0.72), rgba(16, 24, 56, 0.78));
  --tile-ring: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 0 2px var(--gold);
  --tile-glow: 0 0 48px -6px rgba(243, 196, 104, 0.5), 0 24px 48px -28px rgba(0, 0, 0, 0.7);
}

.mb-tile[data-state="current"] {
  --tile-fill: linear-gradient(180deg, rgba(22, 64, 66, 0.66), rgba(8, 30, 36, 0.72));
  --tile-ring: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 0 2px rgba(79, 216, 173, 0.8);
}

.mb-tile-name {
  max-width: 100%;
  color: var(--gold);
  font-family: var(--mb-rounded);
  font-weight: 700;
  font-size: 1.15em;
  line-height: 1.2;
  white-space: nowrap;
  hyphens: manual;
  text-shadow: var(--text-shadow);
}

/* Long Latin names ("Sonnenaufgang") step down instead of wrapping or hyphenating. */
.mb-tile-name[data-long="1"] {
  font-size: 0.95em;
}

.mb-tile-name[data-long="2"] {
  font-size: 0.78em;
  letter-spacing: -0.01em;
}

.mb-tile-ar {
  min-height: 1.4em;
  color: var(--ink-2);
  font-family: var(--mb-naskh);
  font-size: 1.05em;
  line-height: 1.4;
}

.mb-tile-time {
  margin-block: 0.15em 0.1em;
  color: var(--tile-ink);
  font-size: clamp(1.6rem, 5vw, 7vw);
  font-size: round(up, min(max(1.6rem, 5vw), 8.5vh), 1px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
  direction: ltr;
  white-space: nowrap;
  text-shadow: var(--text-shadow);
}

.mb-tile-period {
  margin-inline-start: 0.15em;
  font-size: 0.42em;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
}

.mb-tile-period:empty {
  display: none;
}

.mb-tile-iqama {
  min-height: 1.35em;
  color: var(--ink-2);
  font-size: 1em;
  font-weight: 650;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: var(--text-shadow);
}

.mb-tile[data-state="next"] .mb-tile-iqama,
.mb-tile[data-state="current"] .mb-tile-iqama {
  color: var(--ink);
}

.mb-tile-note {
  min-height: 1.4em;
  color: var(--ink-3);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.4;
}

.mb-tile-badge {
  position: absolute;
  inset-block-start: 0.5em;
  inset-inline-end: 0.5em;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: rgba(243, 196, 104, 0.9);
  color: #1c1203;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.02em;
  animation: mb-pulse 2.4s ease-in-out infinite;
}

@keyframes mb-pulse {
  50% {
    opacity: 0.55;
  }
}

/* ---------- Jumuah / Shuruq boxes and facility chips ---------- */

.mb-extras {
  display: grid;
  gap: calc(var(--gap) * 0.7);
  justify-items: center;
}

.mb-boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}

.mb-box {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  padding: 0.35em 1.3em;
  border-radius: 999px;
  font-size: clamp(1rem, 2.4vw, 3.2rem);
  font-size: round(up, min(max(1rem, 2.4vw), 3.6vh), 1px);
  text-shadow: var(--text-shadow);
}

.mb-box::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(26, 38, 74, 0.5), rgba(8, 14, 36, 0.6));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

.mb-box-label {
  color: var(--gold);
  font-weight: 700;
}

.mb-box-value {
  color: var(--ink);
  font-size: 1.25em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.mb-box[data-empty="true"] .mb-box-value {
  color: var(--ink-3);
}

.mb-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(0.75rem, 1.3vw, 1.7rem);
  font-size: round(up, min(clamp(0.75rem, 1.3vw, 1.7rem), 2.2vh), 1px);
}

.mb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.8em 0.25em 0.6em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}

[dir="rtl"] .mb-chip {
  padding: 0.25em 0.6em 0.25em 0.8em;
}

.mb-chip .mb-check-icon {
  width: 1em;
  height: 1em;
  color: var(--emerald);
}

.mb-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.5rem 1rem;
}

/* ---------- Bottom ---------- */

.mb-bottom {
  display: grid;
  gap: calc(var(--gap) * 0.6);
}

.mb-status {
  padding: 0.3em 0.9em;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  box-shadow: inset 0 1px 0 var(--glass-rim);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  justify-self: center;
  max-width: 100%;
  font-size: clamp(1.1rem, 3vw, 4rem);
  font-size: round(up, min(clamp(1.1rem, 3vw, 4rem), 4.2vh), 1px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: center;
  color: var(--gold-light);
  text-shadow: var(--text-shadow);
}

.mb-board[data-iqama="true"] .mb-status {
  color: var(--emerald);
}

.mb-janaza {
  color: var(--gold-light);
  font-size: clamp(1.1rem, 2.8vw, 3.6rem);
  font-size: round(up, min(max(1.1rem, 2.8vw), 5.5vh), 1px);
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  text-shadow: var(--text-shadow);
}

.mb-announce,
.mb-ramadan,
.mb-events {
  font-size: clamp(1rem, 2.2vw, 2.8rem);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.mb-announce {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
}

.mb-announce-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.mb-announce[data-scrolling="true"] {
  text-overflow: clip;
}

.mb-announce[data-scrolling="true"] .mb-announce-text {
  max-width: none;
  overflow: visible;
  padding-inline: 0;
  animation: mb-marquee var(--mb-duration, 20s) linear infinite;
  will-change: transform;
}

@keyframes mb-marquee {
  from {
    transform: translateX(var(--mb-start, 100vw));
  }

  to {
    transform: translateX(calc(var(--mb-start, 100vw) + var(--mb-shift, -200vw)));
  }
}

.mb-ramadan {
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
}

.mb-events {
  color: var(--gold);
}

.mb-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 1em;
  color: var(--ink-3);
  font-size: clamp(0.75rem, 1.2vw, 1.4rem);
  font-weight: 600;
}

.mb-brand {
  color: var(--ink-2);
  text-decoration: none;
}

.mb-brand:hover,
.mb-brand:focus-visible {
  color: var(--gold);
}

.mb-footer-text {
  flex: 1 1 auto;
}

.mb-keys {
  transition: opacity 0.6s ease;
}

.mb-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(2.75rem, 3.5vw, 4rem);
  height: clamp(2.75rem, 3.5vw, 4rem);
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--ink-2);
  cursor: pointer;
  transition: opacity 0.6s ease, background 0.2s ease;
}

.mb-gear:hover,
.mb-gear:focus-visible {
  background: var(--glass-strong);
  color: var(--ink);
}

.mb-icon {
  width: 55%;
  height: 55%;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Portrait and phones ---------- */

@media (orientation: portrait) {
  .mb-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "clock clock" "name dates";
    row-gap: calc(var(--gap) * 0.5);
  }

  .mb-clock {
    font-size: clamp(3.5rem, 22vw, 10rem);
    font-size: round(up, min(max(3.5rem, 22vw), 14vh), 1px);
  }

  .mb-name {
    font-size: clamp(1.1rem, 4.5vw, 2.6rem);
  }

  .mb-dates {
    font-size: clamp(0.9rem, 3.4vw, 2rem);
  }

  .mb-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: stretch;
  }

  .mb-tile {
    font-size: clamp(0.9rem, 3.4vw, 2rem);
  }

  .mb-tile-time {
    font-size: clamp(1.8rem, 9vw, 5rem);
  }

  .mb-status {
    font-size: clamp(1.05rem, 4.6vw, 2.8rem);
  }

  .mb-announce,
  .mb-ramadan,
  .mb-events {
    font-size: clamp(0.95rem, 3.6vw, 2rem);
  }
}

/* Phones and small screens: the board scrolls instead of squeezing the tiles; no keyboard hints. */
@media (max-width: 48rem), (max-height: 30rem) {
  .mb-board {
    grid-template-rows: auto auto auto auto;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .mb-tiles {
    min-height: auto;
  }

  .mb-keys {
    display: none;
  }
}

@media (max-width: 48rem) and (orientation: portrait) {
  .mb-tile {
    padding-block: 0.9rem;
  }

  .mb-tile-time {
    font-size: clamp(1.8rem, 10vw, 4rem);
  }
}

/* ---------- Setup overlay ---------- */

.mb-setup {
  box-sizing: border-box;
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: #0b1327;
  color: var(--ink);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  font-size: 1rem;
  overscroll-behavior: contain;
}

.mb-setup::backdrop {
  background: rgba(3, 6, 15, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.mb-form {
  display: grid;
  gap: 1.1rem;
  padding: 1.25rem clamp(1rem, 4vw, 1.75rem) 1.5rem;
}

.mb-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mb-form h2 {
  margin: 0;
  font-size: 1.35rem;
}

.mb-close {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-bg);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.mb-lead,
.mb-hint,
.mb-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.45;
}

.mb-sub {
  margin-block-start: 0.5rem;
  color: var(--ink);
  font-weight: 600;
}

.mb-group {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-bg);
  min-width: 0;
}

.mb-group legend {
  padding-inline: 0.4rem;
  color: var(--gold);
  font-weight: 700;
}

.mb-field {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.mb-field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.mb-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.mb-prayer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.75rem, 1fr));
  gap: 0.6rem;
}

.mb-prayer-grid label {
  overflow-wrap: anywhere;
  hyphens: auto;
}

.mb-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.mb-input[aria-invalid="true"] {
  border-color: #ff6961;
}

.mb-input::placeholder {
  color: var(--ink-3);
}

select.mb-input option {
  background: #0b1327;
  color: var(--ink);
}

.mb-link {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.mb-search {
  position: relative;
}

.mb-results {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  inset-block-start: calc(100% + 0.25rem);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: #121c35;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
  max-height: 16rem;
  overflow-y: auto;
}

.mb-result {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
}

.mb-result[aria-selected="true"],
.mb-result:hover {
  background: var(--glass-strong);
}

.mb-result-detail {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.mb-locate {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
}

.mb-geo {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.mb-checkrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}

.mb-check {
  width: 1.3rem;
  height: 1.3rem;
  accent-color: var(--gold);
}

.mb-error {
  margin: 0;
  color: #ffb0a8;
  font-weight: 600;
}

.mb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.mb-button {
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.mb-button:hover {
  background: rgba(255, 255, 255, 0.26);
}

.mb-button-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #ffe3a0 0%, #e7b75f 100%);
  color: #1c1203;
}

.mb-button-danger {
  color: #ffb0a8;
}

.mb-copied {
  color: var(--emerald);
  font-weight: 600;
}

.mb-privacy {
  margin-inline-start: auto;
  color: var(--ink-2);
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
  .mb-tile-badge {
    animation: none;
  }

  .mb-tile[data-state="next"]::after {
    transition: none;
  }

  .mb-announce[data-scrolling="true"] .mb-announce-text {
    animation-duration: calc(var(--mb-duration, 20s) * 2);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .mb-tile::before,
  .mb-status,
  .mb-gear {
    background: rgba(20, 28, 48, 0.92);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
