/* =====================================================================
   MyMasjid · tampilan TV
   Semua warna dan font berasal dari variabel CSS yang diatur oleh JS
   sesuai pengaturan Tema & Warna masing-masing masjid.
   ===================================================================== */
:root {
  --bg: #04191a;
  --bg2: #0a3a34;
  --gold: #e8c15a;          /* warna aksen */
  --gold2: #b8892a;         /* aksen lebih gelap */
  --gold-light: #f4d371;    /* aksen lebih terang */
  --gold-soft: rgba(232, 193, 90, 0.35);
  --gold-glow: rgba(232, 193, 90, 0.45);
  --gold-tint: rgba(232, 193, 90, 0.16);
  --on-gold: #1c1503;       /* teks di atas aksen */
  --fg: #f6f2e4;
  --muted: #a9c3b8;
  --teal: #3fd0a5;
  --glass: rgba(255, 255, 255, 0.055);
  --glass2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.11);
  --shadow: rgba(0, 0, 0, 0.35);
  --panel-bg: rgba(0, 0, 0, 0.32);
  --run-bg: rgba(0, 0, 0, 0.42);
  --jam-top: #fff8dc;
  --glow1: rgba(63, 208, 165, 0.20);
  --font-teks: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-jam: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --jam-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-teks);
  cursor: none;
}

#app {
  position: relative;
  width: 100vw; height: 100vh;
  display: grid;
  gap: 1.6vh;
  padding: 1.6vh 2vw 0;
  background:
    radial-gradient(ellipse 70% 60% at 15% 0%, var(--glow1), transparent 60%),
    radial-gradient(ellipse 60% 60% at 100% 100%, var(--gold-tint), transparent 60%),
    linear-gradient(165deg, var(--bg2), var(--bg) 70%);
  overflow: hidden;
}
.top { grid-area: top; }
.tengah { grid-area: tengah; }
.jadwal { grid-area: jadwal; }
.runtext { grid-area: run; }

/* Mode 2 layar: dua panel, jadwal di bawah */
#app, #app.layout-2 {
  grid-template-columns: 1fr;
  grid-template-rows: 18vh 1fr 20vh 6.5vh;
  grid-template-areas: "top" "tengah" "jadwal" "run";
}

/* Pola bintang: warna mengikuti aksen */
.bg-pattern {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-color: var(--gold); opacity: 0.09;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='black' stroke-width='1.3'><path d='M60 8L72 34 98 22 86 48 112 60 86 72 98 98 72 86 60 112 48 86 22 98 34 72 8 60 34 48 22 22 48 34Z'/><circle cx='60' cy='60' r='17'/></g></svg>"), radial-gradient(ellipse at center, transparent 35%, #000 100%);
  -webkit-mask-size: 9vh 9vh, 100% 100%;
  -webkit-mask-repeat: repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='black' stroke-width='1.3'><path d='M60 8L72 34 98 22 86 48 112 60 86 72 98 98 72 86 60 112 48 86 22 98 34 72 8 60 34 48 22 22 48 34Z'/><circle cx='60' cy='60' r='17'/></g></svg>"), radial-gradient(ellipse at center, transparent 35%, #000 100%);
  mask-size: 9vh 9vh, 100% 100%;
  mask-repeat: repeat, no-repeat;
  mask-composite: intersect;
}
.tanpa-pola .bg-pattern { display: none; }
#app > *:not(.bg-pattern):not(.overlay) { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2vw;
  padding: 0 2vw;
  border-radius: 2.6vh;
  background: linear-gradient(160deg, var(--glass2), var(--glass));
  border: 1px solid var(--border);
  box-shadow: 0 1.6vh 4vh var(--shadow);
  min-width: 0;
}

.clock { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.jam {
  font-family: var(--font-jam);
  font-size: calc(9.6vh * var(--jam-scale)); font-weight: 800; line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--jam-top), var(--gold) 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0.4vh 1vh var(--shadow));
  white-space: nowrap;
}
.next { margin-top: 1.2vh; width: 100%; max-width: 34vw; }
.next-row { display: flex; align-items: baseline; justify-content: center; gap: 0.9vw; font-size: 2.9vh; white-space: nowrap; }
.next .label { color: var(--muted); font-size: 1.9vh; text-transform: uppercase; letter-spacing: 0.12em; }
.next .nama { color: var(--gold); font-weight: 800; }
.next .countdown { font-variant-numeric: tabular-nums; font-weight: 800; font-family: var(--font-jam); }
.bar { margin-top: 0.9vh; height: 0.8vh; border-radius: 1vh; background: var(--glass2); overflow: hidden; }
.bar-fill { height: 100%; width: 0%; border-radius: 1vh; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 1s linear; }
.state-pre .next-row { animation: blink 1s ease-in-out infinite; }
.state-pre .bar-fill { background: var(--gold); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Logo + nama masjid */
.brand { display: flex; align-items: center; justify-content: flex-start; gap: 1.2vw; min-width: 0; text-align: left; }
.logo { height: 10.4vh; width: 10.4vh; color: var(--gold); flex: none; filter: drop-shadow(0 0.4vh 1vh var(--shadow)); }
.logo-img { height: 11vh; width: 11vh; flex: none; object-fit: contain; border-radius: 1.6vh; filter: drop-shadow(0 0.4vh 1vh var(--shadow)); }
.logo-img[hidden], .logo[hidden] { display: none; }
.brand-text { min-width: 0; max-width: 28vw; }
.brand .nama { font-size: 4vh; font-weight: 800; letter-spacing: 0.01em; line-height: 1.12; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand .alamat { font-size: 1.9vh; color: var(--muted); margin-top: 0.6vh; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.tanggal { text-align: right; min-width: 0; }
.tanggal .masehi { font-size: 3vh; font-weight: 700; }
.tanggal .hijri { font-size: 2.5vh; color: var(--gold); margin-top: 0.6vh; font-weight: 600; }

/* Penanda hari puasa di bawah tanggal */
.puasa-chip {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0.2vh;
  margin-top: 1vh; padding: 0.7vh 1.1vw; border-radius: 1.4vh;
  background: var(--gold-tint); border: 1px solid var(--gold-soft);
}
.puasa-chip[hidden] { display: none; }
.puasa-chip b { font-size: 2vh; font-weight: 800; color: var(--gold); white-space: nowrap; }
.puasa-chip span { font-size: 1.9vh; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Kotak Imsak dan Maghrib disorot di hari puasa */
.waktu.puasa-imsak:not(.aktif), .waktu.puasa-buka:not(.aktif) { border-color: var(--gold-soft); background: var(--gold-tint); opacity: 1; }
.waktu.puasa-buka .n { color: var(--gold); font-weight: 800; }
.waktu.aktif.puasa-buka .n { color: var(--on-gold); }

/* Layar imsak dan doa berbuka */
.imsak-sisa { display: flex; align-items: baseline; gap: 1.4vw; margin-top: 3vh; font-size: 3.4vh; color: var(--muted); }
.imsak-sisa b { font-family: var(--font-jam); font-variant-numeric: tabular-nums; font-size: 7vh; color: var(--fg); }
.imsak-lbl { margin-top: 1.6vh; font-size: 2.6vh; font-weight: 700; color: var(--gold); }
.imsak-lbl:empty { display: none; }
.adz-doa { margin-top: 3vh; max-width: 76vw; padding: 2.4vh 3vw; border-radius: 3vh; background: var(--glass); border: 1px solid var(--gold-soft); }
.adz-doa[hidden] { display: none; }
.doa-ar { font-size: 4.6vh; line-height: 1.8; color: var(--fg); font-family: "Traditional Arabic", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif; }
.doa-arti { font-size: 2.3vh; color: var(--muted); line-height: 1.5; margin-top: 1vh; font-style: italic; }
.berbuka .ov-besar { font-size: 15vh; }

/* ---------- Panel ---------- */
.tengah { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6vw; min-height: 0; }
.panel {
  position: relative;
  border-radius: 3vh; overflow: hidden; min-height: 0;
  background: linear-gradient(160deg, var(--glass2), var(--glass));
  border: 1px solid var(--gold-soft);
  box-shadow: 0 2vh 5vh var(--shadow);
}
.player { background: var(--panel-bg); }
.pl-stage { position: absolute; inset: 0; }
.pl-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s ease; overflow: hidden; }
.pl-layer.on { opacity: 1; }
.pl-bg { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(2.8vh) brightness(0.5); }
.pl-img, .pl-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pl-video { background: #000; }
.pl-teks {
  display: flex; flex-direction: column; justify-content: center;
  padding: 3vh 2.8vw 5vh;
  background: linear-gradient(160deg, var(--glass2), var(--panel-bg));
}
.slide-judul { font-size: 4.6vh; font-weight: 800; color: var(--gold); margin-bottom: 1.8vh; line-height: 1.15; }
.slide-judul::after { content: ""; display: block; width: 10vh; height: 0.6vh; border-radius: 1vh; background: var(--gold); margin-top: 1.4vh; }
.slide-isi { font-size: 3.4vh; line-height: 1.5; color: var(--fg); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
/* ---------- Slide laporan kas, ayat Al-Quran, hadits ---------- */
.pl-kas, .pl-quran, .pl-hadits { background: linear-gradient(160deg, var(--glass2), var(--panel-bg)); }
.pl-isi {
  --skala: 1; --u: 1vh;
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; justify-content: safe center;
  padding: calc(var(--u) * 3.4) 3vw calc(var(--u) * 5); overflow: hidden;
}
.q-label { display: flex; align-items: center; gap: 1vw; margin-bottom: calc(var(--u) * 1.6 * var(--skala)); font-size: calc(var(--u) * 2.2 * var(--skala)); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.q-label::before { content: ""; flex: none; width: calc(var(--u) * 4); height: calc(var(--u) * 0.5); border-radius: 1vh; background: var(--gold); }
.q-arab { font-family: "Traditional Arabic", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif; font-size: calc(var(--u) * 6 * var(--skala)); line-height: 1.8; color: var(--fg); text-align: right; }
.h-arab { font-size: calc(var(--u) * 3.6 * var(--skala)); line-height: 1.7; opacity: 0.9; }
.q-latin { margin-top: calc(var(--u) * 1 * var(--skala)); font-size: calc(var(--u) * 2.4 * var(--skala)); font-style: italic; line-height: 1.45; color: var(--teal); }
.q-arti { margin-top: calc(var(--u) * 1.6 * var(--skala)); font-size: calc(var(--u) * 3 * var(--skala)); line-height: 1.5; color: var(--fg); }
.q-ref { margin-top: calc(var(--u) * 1.6 * var(--skala)); font-size: calc(var(--u) * 2.2 * var(--skala)); font-weight: 700; color: var(--gold); }
.pl-suara { position: absolute; left: 50%; bottom: calc(var(--u) * 1.4); transform: translateX(-50%); padding: calc(var(--u) * 0.8) 1.4vw; border-radius: 3vh; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: calc(var(--u) * 1.8); white-space: nowrap; }
.pl-suara[hidden] { display: none; }
.pl-kas .slide-judul { font-size: calc(var(--u) * 4 * var(--skala)); }
.kas-saldo { margin: calc(var(--u) * 0.6) 0 calc(var(--u) * 2 * var(--skala)); padding: calc(var(--u) * 2 * var(--skala)) 2vw; border-radius: 2vh; background: linear-gradient(135deg, var(--gold-light), var(--gold2)); color: var(--on-gold); box-shadow: 0 1vh 3vh var(--shadow); }
.kas-saldo small { display: block; font-size: calc(var(--u) * 2 * var(--skala)); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.kas-saldo b { display: block; white-space: nowrap; font-family: var(--font-jam); font-size: calc(var(--u) * 7 * var(--skala)); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2vw; }
.kas-grid > div { padding: calc(var(--u) * 1.6 * var(--skala)) 1.4vw; border-radius: 1.6vh; background: var(--glass); border: 1px solid var(--border); }
.kas-grid small { display: block; font-size: calc(var(--u) * 1.8 * var(--skala)); font-weight: 700; color: var(--muted); }
.kas-grid b { display: block; white-space: nowrap; font-family: var(--font-jam); font-size: calc(var(--u) * 3.8 * var(--skala)); font-weight: 800; font-variant-numeric: tabular-nums; }
.kas-in b { color: var(--teal); }
.kas-out b { color: #ff9f8a; }
.tema-terang .kas-out b { color: #c2410c; }
.kas-foot { margin-top: calc(var(--u) * 1.8 * var(--skala)); font-size: calc(var(--u) * 2.1 * var(--skala)); color: var(--muted); }
.pl-dots { position: absolute; z-index: 3; right: 1.6vw; bottom: 1.6vh; display: flex; gap: 0.5vw; padding: 0.7vh 0.9vw; border-radius: 2vh; background: rgba(0, 0, 0, 0.35); }
.pl-dots:empty { display: none; }
.pl-dots span { width: 1.2vh; height: 1.2vh; border-radius: 50%; background: rgba(255, 255, 255, 0.4); }
.pl-dots span.on { background: var(--gold); width: 3vh; border-radius: 1vh; }
.pl-kosong { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); opacity: 0.6; }
.pl-ikon { font-size: 9vh; color: var(--gold); line-height: 1; }
.pl-teks-kosong { margin-top: 1.4vh; font-size: 3vh; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- Jadwal ---------- */
.jadwal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.9vw; padding-top: 0.8vh; min-height: 0; }
.waktu {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.5vh;
  border-radius: 2.4vh;
  background: linear-gradient(160deg, var(--glass2), var(--glass));
  border: 1px solid var(--border);
  transition: transform 0.3s;
  min-height: 0;
}
.waktu .ar { font-family: "Traditional Arabic", "Amiri", "Noto Naskh Arabic", "Segoe UI", serif; font-size: 3vh; color: var(--gold); line-height: 1; }
.waktu .n { font-size: 2.3vh; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.waktu .t { font-family: var(--font-jam); font-size: 5.8vh; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.05; }
.waktu.info .t { color: var(--teal); }
.waktu.lewat { opacity: 0.5; }
.waktu.aktif {
  background: linear-gradient(160deg, var(--gold-light), var(--gold2));
  border-color: var(--gold-light); color: var(--on-gold);
  box-shadow: 0 0.8vh 2.4vh var(--shadow), 0 0 2.6vh var(--gold-glow);
  opacity: 1;
}
.waktu.aktif .ar, .waktu.aktif .n, .waktu.aktif .t { color: var(--on-gold); }

/* ---------- Mode 1 layar: satu panel besar, jadwal tegak di samping ---------- */
#app.layout-1 {
  grid-template-columns: 1fr 26vw;
  grid-template-rows: 18vh 1fr 6.5vh;
  grid-template-areas: "top top" "tengah jadwal" "run run";
}
.layout-1 .tengah { grid-template-columns: 1fr; }
.layout-1 #panelKanan { display: none; }
.jadwal.ada-kas { grid-template-columns: repeat(8, 1fr); }
.waktu.kas-kotak { border-color: var(--gold-soft); background: linear-gradient(160deg, var(--gold-tint), var(--glass)); }
.waktu.kas-kotak .n { color: var(--gold); white-space: nowrap; }
.waktu.kas-kotak .t { font-size: 3.6vh; white-space: nowrap; }
.waktu.kas-kotak .t small { font-size: 0.5em; font-weight: 700; margin-right: 0.25em; color: var(--muted); }
.layout-1 .jadwal.ada-kas { grid-template-rows: repeat(8, 1fr); }
.layout-1 .waktu.kas-kotak .t { font-size: 3.8vh; }
.layout-1 .jadwal { grid-template-columns: 1fr; grid-template-rows: repeat(7, 1fr); gap: 1vh; padding: 0 0 1.6vh; }
.layout-1 .waktu {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  align-content: center; align-items: center; column-gap: 1vw; row-gap: 0.3vh;
  padding: 0 1.6vw; border-radius: 2vh;
}
.layout-1 .waktu .ar { grid-column: 1; grid-row: 1; font-size: 2.4vh; text-align: left; }
.layout-1 .waktu .n { grid-column: 1; grid-row: 2; font-size: 1.9vh; text-align: left; }
.layout-1 .waktu .t { grid-column: 2; grid-row: 1 / 3; font-size: 5vh; }
.layout-1 .waktu.aktif { transform: none; box-shadow: 0 0.8vh 2.4vh var(--shadow), 0 0 2.6vh var(--gold-glow); }

/* ---------- Running text tanpa putus ---------- */
.runtext {
  display: flex; align-items: stretch; overflow: hidden;
  margin: 0 -2vw; border-top: 1px solid var(--gold-soft);
  background: var(--run-bg);
}
.rt-label {
  display: flex; align-items: center; padding: 0 2vw; flex: none;
  background: linear-gradient(160deg, var(--gold-light), var(--gold2));
  color: var(--on-gold); font-weight: 900; letter-spacing: 0.18em; font-size: 2.6vh;
}
.rt-track { flex: 1; overflow: hidden; display: flex; align-items: center; min-width: 0; }
.runtext-inner {
  display: flex; white-space: nowrap; font-size: 3.4vh; will-change: transform;
  animation: rtjalan linear infinite; animation-duration: var(--dur, 40s);
}
.rt-seg { display: inline-flex; align-items: center; flex: none; }
.rt-item { padding: 0 0.4vw; }
.rt-sep { color: var(--gold); margin: 0 1.6vw; font-size: 0.85em; }
@keyframes rtjalan { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

/* ---------- Overlay ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: none; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 8vw;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, var(--gold-tint), transparent 70%),
    linear-gradient(160deg, var(--bg2), var(--bg));
}
.overlay.show { display: flex; }
.overlay-gelap { background: #000; }
.ov-kecil { font-size: 5vh; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.ov-besar { font-size: 20vh; font-weight: 800; color: var(--gold); line-height: 1.1; margin: 2vh 0; }
.ov-besar-kecil { font-size: 9vh; }
.ov-timer { font-family: var(--font-jam); font-variant-numeric: tabular-nums; font-size: 30vh; }
.ov-sub { font-size: 4vh; color: var(--fg); margin-top: 2vh; line-height: 1.5; max-width: 80vw; }
.overlay-gelap .ov-besar { color: #8c8c8c; }
.overlay-gelap .ov-sub { color: #8a8a8a; transition: opacity 0.6s; }
.overlay-gelap .ov-sub.fade { opacity: 0; }
#ovAdzan .ov-besar { animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- Layar iqomah (warna, font, ukuran bisa diatur sendiri) ---------- */
.ov-iq { padding: 0; align-items: stretch; justify-content: stretch; color: var(--fg); font-family: var(--iq-font-judul, var(--font-teks)); }
.iq-isi { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4vh 6vw; gap: 4vh; }
.iq-utama { display: flex; flex-direction: column; align-items: center; }
.iq-label { font-size: 4.2vh; color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; }
.iq-nama { font-size: calc(11vh * var(--iq-nama, 1)); font-weight: 800; line-height: 1.1; margin-top: 1.4vh; color: var(--fg); }
.iq-waktu { color: var(--gold); }
.iq-timer {
  font-family: var(--iq-font-timer, var(--font-jam)); font-variant-numeric: tabular-nums;
  font-size: calc(25vh * var(--iq-timer, 1)); font-weight: 800; line-height: 1; margin-top: 2vh;
  color: var(--gold); text-shadow: 0 0 6vh var(--gold-glow);
}
.iq-bar { width: 46vw; height: 1.1vh; border-radius: 1vh; background: var(--glass2); margin-top: 3.4vh; overflow: hidden; }
.iq-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold2), var(--gold-light)); transition: width 0.5s linear; }

.iq-himbau { display: flex; align-items: center; gap: 2vw; transition: opacity 0.5s; }
.iq-himbau.fade { opacity: 0; }
.iq-ikon { flex: none; display: flex; align-items: center; justify-content: center; color: var(--gold); }
.iq-ikon svg { width: 100%; height: 100%; }
.iq-teks { font-weight: 700; line-height: 1.3; }
.iq-dots { display: none; gap: 0.8vw; }
.iq-dots span { width: 1.2vh; height: 1.2vh; border-radius: 1vh; background: var(--border); transition: width 0.3s, background 0.3s; }
.iq-dots span.on { width: 3.6vh; background: var(--gold); }
.iq-tanpa-himbau .iq-himbau { display: none; }

/* mode 1: satu layar penuh, himbauan di bawah hitung mundur */
.iq-m1 .iq-himbau {
  max-width: 82vw; padding: 2.2vh 3vw; border-radius: 10vh;
  background: var(--glass); border: 1px solid var(--gold-soft);
}
.iq-m1 .iq-ikon { width: 6vh; height: 6vh; }
.iq-m1 .iq-teks { font-size: 4.6vh; }

/* mode 2: dua bagian, hitung mundur di kiri, himbauan besar di kanan */
.iq-m2:not(.iq-tanpa-himbau) .iq-isi { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; padding: 5vh 4vw; align-items: stretch; }
.iq-m2:not(.iq-tanpa-himbau) .iq-utama,
.iq-m2:not(.iq-tanpa-himbau) .iq-himbau {
  justify-content: center; border-radius: 4vh; padding: 5vh 3vw;
  background: var(--glass); border: 1px solid var(--border); box-shadow: 0 2vh 5vh var(--shadow);
}
.iq-m2:not(.iq-tanpa-himbau) .iq-timer { font-size: calc(21vh * var(--iq-timer, 1)); }
.iq-m2:not(.iq-tanpa-himbau) .iq-nama { font-size: calc(9.5vh * var(--iq-nama, 1)); text-align: center; }
.iq-m2:not(.iq-tanpa-himbau) .iq-bar { width: 80%; }
.iq-m2 .iq-himbau { flex-direction: column; text-align: center; gap: 4vh; border-color: var(--gold-soft) !important; }
.iq-m2 .iq-ikon { width: 22vh; height: 22vh; padding: 5vh; border-radius: 50%; background: var(--gold-tint); border: 1px solid var(--gold-soft); }
.iq-m2 .iq-teks { font-size: 6.4vh; max-width: 38vw; }
.iq-m2 .iq-dots { display: flex; }

.iq-run { flex: none; height: 7vh; margin: 0; }

/* layar khutbah Jumat (mode kustom) */
.ov-jumat { padding: 0; align-items: stretch; justify-content: stretch; color: var(--fg); font-family: var(--font-teks); }
.jm-isi { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.4vh; padding: 3vh 6vw 6vh; text-align: center; }
.jm-judul { font-family: var(--jm-font, var(--font-teks)); font-size: calc(13vh * var(--jm-uk, 1)); font-weight: 800; line-height: 1.05; color: var(--gold); text-shadow: 0 0 6vh var(--gold-glow); }
.jm-petugas { display: flex; gap: 2.4vw; justify-content: center; flex-wrap: wrap; }
.jm-petugas[hidden], .jm-p[hidden] { display: none; }
.jm-p { min-width: 24vw; padding: 2.2vh 2.6vw; border-radius: 3vh; background: var(--glass); border: 1px solid var(--border); }
.jm-p small { display: block; font-size: 2.2vh; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.jm-p b { display: block; font-size: 4.6vh; font-weight: 800; margin-top: 0.6vh; }
.jm-pesan { max-width: 80vw; font-size: 3.6vh; line-height: 1.4; padding: 1.8vh 3vw; border-radius: 10vh; background: var(--glass); border: 1px solid var(--gold-soft); }
.jm-pesan:empty { display: none; }
.jm-bar { width: 50vw; margin-top: 0; }

/* layar sholat kustom: keredupan di atas semua isi */
.ov-sk::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--sk-redup, 0.4); pointer-events: none; }
.sk-judul { font-family: var(--sk-font, var(--font-teks)); font-size: calc(13vh * var(--sk-uk, 1)); }
.ov-sk .jm-pesan { transition: opacity 0.6s; }
.ov-sk .jm-pesan.fade { opacity: 0; }

/* bagian atas layar iqomah: logo, nama masjid, jam, tanggal */
.iq-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 3vw;
  margin: 3vh 4vw 0; padding: 2vh 2vw; border-radius: 3vh;
  background: var(--glass); border: 1px solid var(--border);
}
.iq-tanpa-kepala .iq-head, .tanpa-kepala .iq-head { display: none; }
/* layar adzan: bagian atas yang sama dengan layar iqomah */
.ov-adzan { padding: 0; align-items: stretch; justify-content: stretch; }
.adz-isi { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 8vw 4vh; }
.ov-adzan.tanpa-kepala .adz-isi { padding-bottom: 0; }
.iq-brand { display: flex; align-items: center; gap: 1.4vw; min-width: 0; text-align: left; }
.iq-logo { flex: none; width: 8vh; height: 8vh; color: var(--gold); display: flex; }
.iq-logo svg, .iq-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 1.2vh; }
.iq-brand-t { min-width: 0; }
.iq-mnama { font-size: 3.4vh; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-malamat { font-size: 1.8vh; color: var(--muted); margin-top: 0.4vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-waktu-kini { display: flex; align-items: center; gap: 2vw; flex: none; text-align: right; }
.iq-jam { font-family: var(--iq-font-timer, var(--font-jam)); font-variant-numeric: tabular-nums; font-size: 5.2vh; font-weight: 800; line-height: 1; padding-right: 2vw; border-right: 1px solid var(--border); }
.iq-tgl { font-size: 2.4vh; font-weight: 700; line-height: 1.35; }
.iq-hijri { color: var(--gold); font-weight: 600; font-size: 2.2vh; }
.ov-iq:not(.iq-tanpa-kepala) .iq-isi { padding-top: 2vh; gap: 3vh; }
.iq-m2:not(.iq-tanpa-himbau):not(.iq-tanpa-kepala) .iq-isi { padding-top: 3vh; padding-bottom: 3vh; }
.ov-iq:not(.iq-tanpa-kepala) .iq-timer { font-size: calc(22vh * var(--iq-timer, 1)); }
.iq-m2:not(.iq-tanpa-himbau):not(.iq-tanpa-kepala) .iq-timer { font-size: calc(19vh * var(--iq-timer, 1)); }
.iq-m2:not(.iq-tanpa-himbau):not(.iq-tanpa-kepala) .iq-ikon { width: 18vh; height: 18vh; padding: 4vh; }
.iq-run[hidden] { display: none; }

/* ---------- Tema terang ---------- */
.tema-terang .pl-dots { background: rgba(255, 255, 255, 0.7); }
.tema-terang .pl-dots span { background: rgba(0, 0, 0, 0.2); }
.tema-terang .slide-isi { color: var(--fg); }

/* =====================================================================
   Layar tegak (HP, tablet portrait)
   ===================================================================== */
@media (max-aspect-ratio: 1/1) {
  html { height: auto; overflow-x: hidden; overflow-y: auto; -webkit-text-size-adjust: 100%; }
  body { height: auto; overflow: visible; cursor: auto; }

  #app, #app.layout-1, #app.layout-2 {
    height: auto; min-height: 100vh; min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: none; grid-auto-rows: auto;
    grid-template-areas: "top" "tengah" "jadwal" "run";
    gap: 3.4vw; padding: 3.4vw 3.4vw 0;
  }
  .bg-pattern { position: fixed; -webkit-mask-size: 22vw 22vw, 100% 100%; mask-size: 22vw 22vw, 100% 100%; }

  .top { grid-template-columns: 1fr; gap: 4vw; padding: 5vw 4vw; border-radius: 5vw; justify-items: stretch; }
  .brand { order: 1; gap: 3vw; justify-content: center; text-align: left; }
  .logo, .logo-img { height: 15vw; width: 15vw; }
  .brand-text { max-width: 66vw; }
  .brand .nama { font-size: 5.8vw; -webkit-line-clamp: 3; }
  .brand .alamat { font-size: 3.3vw; }

  .clock { order: 2; align-items: center; border-top: 1px solid var(--border); padding-top: 4vw; }
  .jam { font-size: calc(17.5vw * var(--jam-scale)); }
  .next { max-width: none; margin-top: 3vw; }
  .next-row { font-size: 5.4vw; gap: 2vw; justify-content: center; flex-wrap: wrap; }
  .next .label { font-size: 3.4vw; }
  .bar { margin-top: 2.6vw; height: 1.6vw; }

  .tanggal { order: 3; display: flex; justify-content: space-between; align-items: baseline; gap: 2vw; text-align: left; border-top: 1px solid var(--border); padding-top: 3vw; }
  .tanggal .masehi { font-size: 3.5vw; }
  .tanggal .hijri { font-size: 3.2vw; margin-top: 0; text-align: right; }

  .tengah { grid-template-columns: 1fr; gap: 3.4vw; }
  .panel { border-radius: 5vw; min-height: 56vw; }
  .pl-teks { padding: 6vw 5vw 9vw; }
  .pl-isi { --u: 1.15vw; padding: 5vw 5vw 8vw; }
  .slide-judul { font-size: 6vw; margin-bottom: 3vw; }
  .slide-judul::after { width: 14vw; height: 1vw; margin-top: 2.4vw; }
  .slide-isi { font-size: 4.2vw; -webkit-line-clamp: 7; }
  .pl-dots { right: 3.4vw; bottom: 3vw; gap: 1.2vw; padding: 1.4vw 2.4vw; border-radius: 4vw; }
  .pl-dots span { width: 2vw; height: 2vw; }
  .pl-dots span.on { width: 5vw; }
  .pl-ikon { font-size: 14vw; }
  .pl-teks-kosong { font-size: 4vw; margin-top: 2vw; }

  .jadwal, .layout-1 .jadwal { grid-template-columns: repeat(2, 1fr); grid-template-rows: none; gap: 3vw; padding: 0; }
  .jadwal .waktu, .layout-1 .waktu { display: flex; flex-direction: column; padding: 3.6vw 2vw; gap: 1vw; border-radius: 4.4vw; }
  .jadwal .waktu:last-child:nth-child(odd) { grid-column: span 2; }
  .waktu .ar, .layout-1 .waktu .ar { font-size: 5.4vw; }
  .waktu .n, .layout-1 .waktu .n { font-size: 3.4vw; }
  .waktu .t, .layout-1 .waktu .t { font-size: 10vw; }
  .waktu.aktif, .layout-1 .waktu.aktif { transform: none; }

  #app > .runtext { position: sticky; bottom: 0; margin: 0 -3.4vw; height: 12vw; z-index: 5; }
  .rt-label { font-size: 3.6vw; padding: 0 4vw; }
  .runtext-inner { font-size: 4.6vw; }

  .overlay { position: fixed; padding: 0 6vw; }
  .ov-kecil { font-size: 5.4vw; }
  .ov-besar { font-size: 17vw; }
  .ov-besar-kecil { font-size: 9vw; }
  .ov-timer { font-size: 30vw; }
  .ov-sub { font-size: 4.6vw; max-width: 88vw; }
  .ov-iq, .ov-adzan, .ov-jumat { padding: 0; }
  .tanggal .puasa-chip { margin-top: 0; padding: 1.4vw 2.6vw; border-radius: 3vw; }
  .puasa-chip b { font-size: 3.2vw; }
  .puasa-chip span { font-size: 3vw; }
  .imsak-sisa { font-size: 4vw; gap: 2vw; }
  .imsak-sisa b { font-size: 10vw; }
  .imsak-lbl { font-size: 3.8vw; }
  .adz-doa { max-width: none; padding: 4vw; border-radius: 4vw; }
  .doa-ar { font-size: 6vw; }
  .doa-arti { font-size: 3.4vw; }
  .berbuka .ov-besar { font-size: 15vw; }
  .jm-isi { padding: 6vw 5vw 10vw; gap: 5vw; }
  .jm-judul { font-size: calc(11vw * var(--jm-uk, 1)); }
  .sk-judul { font-size: calc(11vw * var(--sk-uk, 1)); }
  .jm-p { min-width: 0; width: 100%; padding: 3.4vw 4vw; border-radius: 4vw; }
  .jm-p small { font-size: 3vw; }
  .jm-p b { font-size: 5.4vw; }
  .jm-pesan { font-size: 4.2vw; padding: 3vw 5vw; border-radius: 6vw; max-width: none; }
  .jm-bar { width: 70vw; }
  .adz-isi { padding: 6vw 6vw 10vw; }
  .iq-isi, .iq-m2:not(.iq-tanpa-himbau) .iq-isi { display: flex; flex-direction: column; padding: 8vw 5vw; gap: 6vw; }
  .iq-label { font-size: 3.6vw; }
  .iq-nama, .iq-m2:not(.iq-tanpa-himbau) .iq-nama { font-size: calc(10vw * var(--iq-nama, 1)); text-align: center; }
  .iq-timer, .iq-m2:not(.iq-tanpa-himbau) .iq-timer { font-size: calc(24vw * var(--iq-timer, 1)); }
  .iq-bar, .iq-m2:not(.iq-tanpa-himbau) .iq-bar { width: 70vw; height: 1.6vw; }
  .iq-m2:not(.iq-tanpa-himbau) .iq-utama, .iq-m2:not(.iq-tanpa-himbau) .iq-himbau { width: 100%; padding: 6vw 4vw; border-radius: 5vw; }
  .iq-m1 .iq-himbau { padding: 3vw 5vw; border-radius: 6vw; }
  .iq-m1 .iq-ikon { width: 8vw; height: 8vw; }
  .iq-m1 .iq-teks { font-size: 4.4vw; }
  .iq-m2 .iq-ikon { width: 22vw; height: 22vw; padding: 5vw; }
  .iq-m2 .iq-teks { font-size: 5.6vw; max-width: none; }
  .iq-dots span { width: 2vw; height: 2vw; }
  .iq-dots span.on { width: 6vw; }
  .iq-run { height: 12vw; }
  .iq-head { flex-direction: column; align-items: stretch; gap: 3vw; margin: 4vw 4vw 0; padding: 4vw; border-radius: 4vw; }
  .iq-brand { gap: 3vw; }
  .iq-logo { width: 12vw; height: 12vw; }
  .iq-mnama { font-size: 4.6vw; white-space: normal; }
  .iq-malamat { font-size: 3vw; white-space: normal; }
  .iq-waktu-kini { justify-content: space-between; border-top: 1px solid var(--border); padding-top: 3vw; }
  .iq-jam { font-size: 7vw; }
  .iq-tgl { font-size: 3.2vw; }
  .iq-hijri { font-size: 3vw; }
  .ov-iq:not(.iq-tanpa-kepala) .iq-isi { padding-top: 6vw; }
  .ov-iq:not(.iq-tanpa-kepala) .iq-timer, .iq-m2:not(.iq-tanpa-himbau):not(.iq-tanpa-kepala) .iq-timer { font-size: calc(22vw * var(--iq-timer, 1)); }
  .iq-m2:not(.iq-tanpa-himbau):not(.iq-tanpa-kepala) .iq-ikon { width: 20vw; height: 20vw; padding: 4.5vw; }
}

@media (max-aspect-ratio: 1/1) and (min-width: 700px) {
  .jadwal, .layout-1 .jadwal { grid-template-columns: repeat(4, 1fr); }
  .jadwal .waktu:last-child:nth-child(odd) { grid-column: auto; }
  .jam { font-size: calc(14vw * var(--jam-scale)); }
}

/* ---------- Tombol layar penuh ---------- */
.btn-fs {
  position: fixed; z-index: 200; top: 2.4vh; right: 1.6vw;
  display: flex; align-items: center; gap: 1vh; padding: 1.2vh 1.6vh;
  border: 1px solid var(--gold-soft); border-radius: 1.6vh;
  background: rgba(0, 0, 0, 0.72); color: #fff; font: inherit; cursor: pointer;
  box-shadow: 0 1vh 3vh rgba(0, 0, 0, 0.4); animation: fsMasuk 0.3s ease;
}
.btn-fs[hidden] { display: none; }
.btn-fs svg { width: 3.4vh; height: 3.4vh; color: var(--gold); flex: none; }
.btn-fs span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.btn-fs b { font-size: 2.2vh; }
.btn-fs small { font-size: 1.5vh; opacity: 0.75; }
.btn-fs:focus-visible { outline: 0.4vh solid var(--gold); }
@keyframes fsMasuk { from { opacity: 0; transform: translateY(-1vh); } }
@media (max-aspect-ratio: 1/1) {
  .btn-fs { top: 3vw; right: 3vw; padding: 2vw 3vw; border-radius: 3vw; gap: 2vw; }
  .btn-fs svg { width: 6vw; height: 6vw; }
  .btn-fs b { font-size: 3.8vw; }
  .btn-fs small { font-size: 2.8vw; }
}

/* ---------- Pengumuman sebelum adzan ---------- */
.pengumuman {
  position: fixed; z-index: 150; left: 50%; top: 3vh; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1.6vh; max-width: 80vw;
  padding: 1.8vh 3vh; border-radius: 2.4vh;
  background: linear-gradient(135deg, var(--gold-light), var(--gold2)); color: var(--on-gold);
  font-size: 3.2vh; font-weight: 800; line-height: 1.3;
  box-shadow: 0 2vh 5vh rgba(0, 0, 0, 0.45); animation: pgMasuk 0.5s cubic-bezier(.2, .9, .3, 1.2);
}
.pengumuman[hidden] { display: none; }
.pengumuman svg { width: 4.4vh; height: 4.4vh; flex: none; animation: pgGoyang 1.2s ease-in-out infinite; }
@keyframes pgMasuk { from { opacity: 0; transform: translate(-50%, -2vh) scale(0.96); } }
@keyframes pgGoyang { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@media (max-aspect-ratio: 1/1) { .pengumuman { font-size: 4.4vw; padding: 3vw 4vw; border-radius: 4vw; gap: 3vw; top: 3vw; max-width: 92vw; } .pengumuman svg { width: 7vw; height: 7vw; } }
