/* Layar TV — kanvas tetap 1920×1080 yang diskalakan (design.md §3) */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
body.hide-cursor, body.hide-cursor * { cursor: none !important; }

#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform-origin: center center;
  display: grid;
  grid-template-rows: 72px 1fr 176px 60px;
  gap: 16px;
  padding: 0 16px 14px;
  background: var(--bg);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

/* ---------- Header ---------- */
.hdr {
  display: flex; align-items: center; gap: 18px;
  border-bottom: 1px solid var(--border);
  margin: 0 -16px; padding: 0 28px;
}
.hdr-controls { display: flex; gap: 8px; opacity: 0; transition: opacity .3s; }
body.show-controls .hdr-controls { opacity: 1; }
.hdr-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted); display: grid; place-items: center; cursor: pointer;
}
.hdr-btn:hover { color: var(--text); }
.hdr-mark { color: var(--accent); }
.hdr-name { font-weight: 800; font-size: 26px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-status { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); flex: none; }
.hdr-status.offline { background: var(--text-muted); }
.hdr-offline { font-size: 18px; color: var(--text-muted); display: none; }
.hdr-status.offline + .hdr-offline { display: inline; }
.hdr-date { margin-left: auto; font-size: 34px; font-weight: 700; white-space: nowrap; }
.hdr-sep { width: 2px; height: 34px; background: var(--border); }
.hdr-hijri { font-size: 34px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ---------- Konten utama ---------- */
.main { display: grid; grid-template-columns: 640px 1fr; gap: 16px; min-height: 0; }
.left { display: grid; grid-template-rows: 270px auto 1fr; gap: 16px; min-height: 0; }

.clock { display: flex; align-items: center; justify-content: center; padding-right: 8px; }
.clock-hm {
  font-family: var(--font-num); font-weight: 800; font-size: 188px; line-height: 1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.clock-sec {
  font-family: var(--font-num); font-weight: 700; font-size: 50px; align-self: flex-end;
  margin: 0 0 62px 10px; width: 62px; font-variant-numeric: tabular-nums;
}

.countdown { padding: 18px 28px 20px; text-align: center; }
.cd-label { font-size: 22px; font-weight: 800; letter-spacing: .02em; color: var(--primary); }
.cd-value { font-family: var(--font-num); font-weight: 700; font-size: 60px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.cd-value.soon { color: var(--accent); }
.cd-value.urgent { color: var(--danger); }
.cd-note {
  display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 21px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  align-items: center; justify-content: center; gap: 10px;
}
.cd-note.show { display: flex; }
.cd-note .ico { flex: none; color: var(--accent); }
.cd-note span { overflow: hidden; text-overflow: ellipsis; }

.quote { padding: 26px 30px; display: flex; flex-direction: column; min-height: 0; }
.quote-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: .08em; color: var(--primary); }
.quote-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; transition: opacity .5s ease-out; padding-top: 8px; }
.quote-body.fade { opacity: 0; }
.quote-inner { flex: none; margin: auto 0; } /* margin auto = tengah, tetapi tidak pernah meluber ke atas */
.quote-arabic { font-family: var(--font-arab); direction: rtl; text-align: right; font-size: 44px; line-height: 1.75; margin-bottom: 8px; }
.quote-text { font-family: var(--font-quote); font-style: italic; font-weight: 800; font-size: 36px; line-height: 1.32; }
.quote-source { margin-top: 12px; font-size: 20px; font-weight: 800; color: var(--text-muted); letter-spacing: .03em; }

/* ---------- Slideshow ---------- */
.slides { background: var(--slide-bg); }
.slide-layer { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease-in-out; display: flex; }
.slide-layer.on { opacity: 1; }
.slide-layer img { width: 100%; height: 100%; object-fit: contain; }
.slide-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.slide-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(128, 128, 128, .35); }
.slide-dots i.on { background: var(--accent); }

/* Slide info (design.md §3.8) */
.info {
  width: 100%; height: 100%; padding: 52px 64px 36px; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); position: relative;
}
.info::after {
  content: ''; position: absolute; right: -40px; bottom: -40px; width: 420px; height: 420px;
  background: url('/img/pattern.svg') repeat; opacity: .06; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 100% 100%, #000 30%, transparent 70%);
  mask-image: radial-gradient(circle at 100% 100%, #000 30%, transparent 70%);
}
.info-head { display: flex; align-items: center; gap: 18px; }
.info-head .ico { color: var(--accent); flex: none; }
.info-title { font-size: 46px; font-weight: 800; letter-spacing: 0; }
.info-head .brand-mark { color: var(--accent); }
.info-badge { font-size: 22px; font-weight: 800; letter-spacing: .01em; padding: 6px 14px; border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.info-sub { margin-left: auto; font-size: 26px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.info-rule { width: 120px; height: 3px; background: var(--accent); margin: 18px 0 26px; border-radius: 2px; }
.info-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.info-foot { display: flex; align-items: center; gap: 12px; font-size: 18px; color: var(--text-muted); margin-top: 12px; }
.info-foot img { height: 30px; }
.info-foot .brand-mark { color: var(--text-muted); }

.kas-row { display: flex; align-items: baseline; font-size: 34px; padding: 6px 0; }
.kas-row .lbl { flex: 1; }
.kas-row .val { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.kas-row.in .val, .kas-row.in .lbl b { color: var(--primary); }
.kas-row.out .val, .kas-row.out .lbl b { color: var(--danger); opacity: .9; }
.kas-cats { font-size: 22px; color: var(--text-muted); padding: 0 0 6px 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kas-total { border-top: 2px solid var(--border); margin-top: 10px; padding-top: 14px; }
.kas-total .lbl { font-weight: 800; letter-spacing: .04em; }
.kas-total .val { font-size: 54px; font-weight: 800; color: var(--text); }
.kas-bottom { margin-top: auto; display: flex; align-items: flex-end; gap: 24px; }
.kas-note { flex: 1; font-size: 26px; line-height: 1.4; }
.kas-note b { color: var(--accent); }
.kas-qris { width: 150px; height: 150px; background: #fff; border-radius: 10px; padding: 8px; object-fit: contain; }

.jm-grid { display: grid; grid-template-columns: 220px 1fr; row-gap: 18px; align-items: baseline; margin-top: 10px; }
.jm-lbl { font-size: 26px; font-weight: 700; letter-spacing: .01em; color: var(--text-muted); }
.jm-val { font-size: 44px; font-weight: 700; }
.jm-theme { margin-top: 30px; font-family: var(--font-quote); font-style: italic; font-weight: 700; font-size: 32px; color: var(--accent); }
.jm-next { margin-top: auto; font-size: 22px; color: var(--text-muted); }

.ag-row { display: grid; grid-template-columns: 170px 250px 1fr; gap: 16px; align-items: center; padding: 12px 16px; border-radius: 12px; font-size: 27px; }
.ag-row + .ag-row { margin-top: 6px; }
.ag-row.today { background: rgba(78, 138, 94, .18); background: color-mix(in srgb, var(--primary) 18%, transparent); }
.ag-day { font-weight: 800; }
.ag-row.today .ag-day { color: var(--primary); }
.ag-time { color: var(--text-muted); font-weight: 600; }
.ag-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-title small { font-weight: 400; color: var(--text-muted); font-size: 24px; }
.ag-aud { font-size: 18px; font-weight: 700; letter-spacing: 0; border: 1.5px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 2px 10px; margin-left: 10px; vertical-align: middle; }
.ag-more { margin-top: 10px; font-size: 22px; color: var(--text-muted); padding-left: 16px; }

/* Kartu ayat besar pengganti slideshow kosong */
.bigquote { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 60px 90px; background: var(--surface); }
.bigquote .quote-arabic { font-size: 60px; text-align: center; }
.bigquote .quote-text { font-size: 46px; text-align: center; }
.bigquote .quote-source { text-align: center; font-size: 26px; }

/* ---------- Jadwal ---------- */
.sched { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; transition: background .6s, color .6s; }
.tile-lbl { font-size: 32px; font-weight: 800; letter-spacing: .01em; color: var(--text-muted); }
.tile-time { font-family: var(--font-num); font-weight: 800; font-size: 84px; line-height: 1.05; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 20px; color: var(--text-muted); height: 24px; }
.tile.next { border-top: 5px solid var(--accent); }
.tile.next .tile-lbl, .tile.next .tile-time { color: var(--text); }
.tile.active { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); box-shadow: 0 0 0 2px var(--primary), 0 0 28px color-mix(in srgb, var(--primary) 55%, transparent); }
.tile.active .tile-lbl, .tile.active .tile-time, .tile.active .tile-sub { color: var(--on-primary); }

/* ---------- Teks berjalan ---------- */
.ticker { display: flex; align-items: center; overflow: hidden; }
.ticker-icon { flex: none; width: 64px; height: 100%; display: grid; place-items: center; color: var(--accent); border-right: 1px solid var(--border); background: var(--surface); z-index: 1; }
.ticker-track { position: relative; flex: 1; height: 100%; overflow: hidden; }
.ticker-text { position: absolute; top: 50%; left: 0; white-space: nowrap; font-size: 32px; font-weight: 600; transform: translate(100vw, -50%); will-change: transform; }
.ticker-text .sep { color: var(--accent); margin: 0 26px; }

/* ---------- Overlay layar penuh (design.md §4) ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .7s ease-out;
}
.overlay.on { opacity: 1; pointer-events: auto; }
.overlay::before {
  content: ''; position: absolute; inset: 0; background: url('/img/pattern.svg') repeat; opacity: .035;
}
.ov-frame {
  position: relative; width: 1660px; height: 900px; border: 3px solid var(--primary); border-radius: 60px / 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 120px;
  transform: scale(.98); transition: transform .7s ease-out; background: rgba(30, 34, 44, .55); background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.overlay.on .ov-frame { transform: scale(1); }
.ov-frame::before {
  content: ''; position: absolute; inset: 14px; border: 1px solid rgba(78, 138, 94, .45); border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
  border-radius: 48px; pointer-events: none;
}
.ov-icon { color: var(--primary); margin-bottom: 18px; line-height: 0; }
.ov-icon .brand-mark { color: var(--accent); }
.ov-count { font-family: var(--font-num); font-weight: 800; font-size: 250px; line-height: 1; font-variant-numeric: tabular-nums; transition: transform .3s; }
.ov-count.final { transform: scale(1.06); color: var(--accent); }
.ov-pillrow { display: flex; align-items: center; gap: 22px; margin: 26px 0 22px; width: 900px; }
.ov-pillrow::before, .ov-pillrow::after { content: ''; flex: 1; height: 3px; background: var(--primary); border-radius: 2px; }
.ov-pill { display: flex; align-items: center; gap: 10px; background: var(--accent); color: var(--on-accent); padding: 8px 26px; border-radius: 999px; font-family: var(--font-num); font-weight: 700; font-size: 38px; font-variant-numeric: tabular-nums; }
.ov-title { font-size: 76px; font-weight: 800; line-height: 1.15; }
.ov-sub { margin-top: 16px; font-size: 38px; font-weight: 700; color: var(--accent); }
.ov-arabic { font-family: var(--font-arab); direction: rtl; font-size: 44px; line-height: 1.7; margin-top: 22px; max-width: 1350px; }
.ov-msg { margin-top: 18px; font-size: 32px; line-height: 1.45; color: var(--text-muted); max-width: 1300px; display: flex; align-items: center; gap: 30px; justify-content: center; }
.ov-msg .ico { flex: none; color: var(--text); }
.ov-test { position: absolute; top: 24px; right: 30px; background: var(--danger); color: #fff; font-weight: 800; letter-spacing: .02em; font-size: 24px; padding: 6px 16px; border-radius: 8px; }
.ov-dim { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 3s linear; pointer-events: none; z-index: 5; }
.overlay.dim-75 .ov-dim { opacity: .75; }
.overlay.dim-60 .ov-dim { opacity: .6; }

/* ---------- Banner kecil ---------- */
.banner {
  position: absolute; z-index: 30; left: 50%; top: 84px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 24px;
  font-size: 24px; display: none; align-items: center; gap: 12px; cursor: pointer;
}
.banner.show { display: flex; }
.banner .ico { color: var(--accent); }

.loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; color: var(--text-muted); z-index: 40; background: var(--bg); }
.loading[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .slide-layer, .quote-body, .overlay, .ov-frame, .tile { transition-duration: .15s !important; }
}
