/* ==========================================================================
   Layar Antrian (TV) — MPP Kabupaten Landak
   Designed for 16:9 screens (1366×768 … 4K). Sizes scale with the viewport.
   ========================================================================== */

:root {
  --bg: #04110f;
  --bg-2: #072420;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f1f5f9;
  --muted: #8ba3a0;
  --primary: #14b8a6;
  --primary-2: #0f766e;
  --accent: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --radius: clamp(14px, 1.4vw, 28px);
  --gap: clamp(10px, 1.2vw, 24px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(60vw 60vw at 10% -10%, rgba(20, 184, 166, 0.16), transparent 60%),
    radial-gradient(50vw 50vw at 110% 110%, rgba(251, 191, 36, 0.08), transparent 60%),
    linear-gradient(160deg, var(--bg-2), var(--bg));
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

body.is-idle { cursor: none; }

.ds {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--gap);
  padding: var(--gap);
}

/* ---------- top bar ---------- */
.ds-top { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
.ds-brand { display: flex; align-items: center; gap: clamp(10px, 1vw, 20px); }
.ds-brand img { height: clamp(40px, 6vh, 84px); width: auto; background: #fff; border-radius: 50%; padding: 3px; }
.ds-brand strong { display: block; font-size: clamp(1rem, 2.2vh, 2rem); font-weight: 800; letter-spacing: -0.01em; }
.ds-brand span { display: block; color: var(--muted); font-size: clamp(0.75rem, 1.5vh, 1.3rem); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.ds-top__right { display: flex; align-items: center; gap: clamp(12px, 1.5vw, 32px); }
.ds-clock { text-align: right; }
.ds-clock strong { display: block; font-size: clamp(1.6rem, 4.6vh, 4.2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ds-clock span { color: var(--muted); font-size: clamp(0.75rem, 1.6vh, 1.4rem); font-weight: 600; }


/* ---------- main grid ---------- */
.ds-main { display: grid; grid-template-columns: 1fr 1.15fr; gap: var(--gap); min-height: 0; }
.ds-left, .ds-right { display: grid; gap: var(--gap); min-height: 0; }
.ds-left { grid-template-rows: 1.35fr 1fr; }
.ds-right { grid-template-rows: auto 1fr; }

/* ---------- current call ---------- */
.ds-call {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: clamp(16px, 2.4vh, 40px) clamp(16px, 2vw, 40px);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(20, 184, 166, 0.35), transparent 60%),
    linear-gradient(160deg, #0d4a43, #072a26);
  border: 1px solid rgba(20, 184, 166, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 0;
}

.ds-call__label { font-size: clamp(0.8rem, 2vh, 1.8rem); font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: #99f6e4; }

.ds-call__number {
  font-size: clamp(4rem, 19vh, 17rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: clamp(4px, 1vh, 16px) 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0.05em 0.4em rgba(20, 184, 166, 0.45);
}

.ds-call__to { display: flex; align-items: center; gap: clamp(8px, 1vw, 20px); font-size: clamp(0.9rem, 2.6vh, 2.4rem); color: #ccfbf1; font-weight: 600; }
.ds-call__to strong { background: var(--accent); color: #1f1300; padding: 0.2em 0.7em; border-radius: 999px; font-weight: 800; }
.ds-call__meta { margin-top: clamp(8px, 1.6vh, 24px); color: #a7c7c2; font-size: clamp(0.8rem, 2vh, 1.7rem); font-weight: 600; max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ds-call__ring { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.ds-call.is-new { animation: callIn 1.2s var(--ease); }
.ds-call.is-new .ds-call__ring { animation: ring 1.6s var(--ease) 3; }
.ds-call.is-new .ds-call__number { animation: numIn 0.9s var(--ease); }
@keyframes callIn { 0% { transform: scale(0.97); } 40% { transform: scale(1.01); } 100% { transform: none; } }
@keyframes ring { 0% { box-shadow: inset 0 0 0 0 rgba(251, 191, 36, 0.9); } 100% { box-shadow: inset 0 0 0 clamp(6px, 1vh, 14px) rgba(251, 191, 36, 0); } }
@keyframes numIn { 0% { opacity: 0; transform: translateY(18%) scale(0.92); filter: blur(6px); } 100% { opacity: 1; transform: none; filter: none; } }

/* ---------- recent calls ---------- */
.ds-recent, .ds-board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(12px, 1.8vh, 28px) clamp(14px, 1.4vw, 28px); min-height: 0; display: flex; flex-direction: column; }
.ds-recent h2, .ds-board h2 { font-size: clamp(0.75rem, 1.7vh, 1.5rem); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: clamp(8px, 1.4vh, 20px); }

.ds-recent ol { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: clamp(6px, 1vh, 14px); flex: 1; min-height: 0; }
.ds-recent li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 clamp(10px, 1vw, 20px);
  border-radius: clamp(10px, 1vw, 18px);
  background: var(--surface-2);
  min-height: 0;
  animation: slideIn 0.6s var(--ease) both;
}
.ds-recent li b { font-size: clamp(1.2rem, 4vh, 3.4rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ds-recent li span { text-align: right; color: var(--muted); font-size: clamp(0.65rem, 1.5vh, 1.25rem); font-weight: 600; line-height: 1.3; overflow: hidden; }
.ds-recent li span em { display: block; font-style: normal; color: var(--accent); font-weight: 800; font-size: 1.15em; }
.ds-recent li.is-empty { justify-content: center; color: var(--muted); font-size: clamp(0.8rem, 1.6vh, 1.3rem); grid-column: 1 / -1; background: transparent; border: 1px dashed var(--line); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ---------- video ---------- */
.ds-video { position: relative; aspect-ratio: 16 / 9; max-height: 52vh; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); justify-self: center; }
.ds-video video, .ds-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.ds-video__fallback { position: absolute; inset: 0; margin: auto; height: 50%; opacity: 0.4; }

/* ---------- organization board ---------- */
.ds-board__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ds-totals { display: flex; gap: clamp(10px, 1.2vw, 24px); color: var(--muted); font-size: clamp(0.7rem, 1.5vh, 1.25rem); font-weight: 600; }
.ds-totals b { color: var(--text); font-variant-numeric: tabular-nums; }
.ds-board__grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: clamp(6px, 1vh, 14px); min-height: 0; }
.ds-org { background: var(--surface-2); border-radius: clamp(10px, 1vw, 18px); padding: clamp(8px, 1.2vh, 18px) clamp(10px, 0.9vw, 18px); display: flex; flex-direction: column; justify-content: space-between; min-width: 0; min-height: 0; border: 1px solid transparent; transition: border-color 0.4s, background 0.4s; animation: fadeIn 0.6s var(--ease) both; }
.ds-org.is-hot { border-color: rgba(251, 191, 36, 0.7); background: rgba(251, 191, 36, 0.1); }
.ds-org h3 { font-size: clamp(0.65rem, 1.45vh, 1.2rem); font-weight: 700; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-org__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.ds-org__row b { font-size: clamp(1rem, 3.2vh, 2.8rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.ds-org__row span { color: var(--muted); font-size: clamp(0.6rem, 1.3vh, 1.05rem); font-weight: 600; text-align: right; white-space: nowrap; }
.ds-org__row span em { font-style: normal; color: var(--accent); font-weight: 800; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.ds-board__dots { display: flex; justify-content: center; gap: 6px; margin-top: clamp(6px, 1vh, 12px); min-height: 8px; }
.ds-board__dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all 0.3s; }
.ds-board__dots i.is-active { width: 22px; border-radius: 6px; background: var(--primary); }

/* ---------- ticker ---------- */
.ds-ticker { display: flex; align-items: stretch; border-radius: 999px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); height: clamp(36px, 6vh, 80px); }
.ds-ticker__tag { display: flex; align-items: center; padding: 0 clamp(14px, 1.4vw, 32px); background: var(--accent); color: #1f1300; font-weight: 800; letter-spacing: 0.16em; font-size: clamp(0.7rem, 1.7vh, 1.4rem); }
.ds-ticker__track { flex: 1; overflow: hidden; display: flex; align-items: center; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ds-ticker__move { display: flex; white-space: nowrap; animation: ticker var(--ticker-duration, 60s) linear infinite; will-change: transform; }
.ds-ticker__move span { font-size: clamp(0.85rem, 2.3vh, 2rem); font-weight: 600; padding: 0 2.5em; position: relative; }
.ds-ticker__move span::after { content: "◆"; position: absolute; right: -0.4em; color: var(--primary); font-size: 0.6em; top: 50%; transform: translateY(-50%); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- full screen flash on a new call ---------- */
.ds-flash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(4, 17, 15, 0.82); backdrop-filter: blur(10px); opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }
.ds-flash.is-show { opacity: 1; visibility: visible; }
.ds-flash > div { text-align: center; padding: 4vh 6vw; border-radius: calc(var(--radius) * 1.5); background: linear-gradient(160deg, #0f766e, #064e47); border: 2px solid rgba(251, 191, 36, 0.8); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6); transform: scale(0.9); transition: transform 0.5s var(--ease); }
.ds-flash.is-show > div { transform: scale(1); animation: glow 1.4s ease-in-out infinite; }
.ds-flash small { display: block; font-size: clamp(1rem, 3vh, 2.6rem); font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: #99f6e4; }
.ds-flash strong { display: block; font-size: clamp(6rem, 30vh, 26rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ds-flash span { display: inline-block; margin-top: 2vh; font-size: clamp(1.4rem, 5vh, 4.4rem); font-weight: 800; background: var(--accent); color: #1f1300; padding: 0.15em 0.8em; border-radius: 999px; }
@keyframes glow { 50% { box-shadow: 0 0 0 3vh rgba(251, 191, 36, 0); } }

/* ---------- start overlay ---------- */
.ds-start { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5vh; border: 0; color: var(--text); font-family: inherit; background: rgba(4, 17, 15, 0.9); backdrop-filter: blur(8px); cursor: pointer; }
.ds-start__icon { font-size: clamp(3rem, 10vh, 8rem); animation: bob 2.4s ease-in-out infinite; }
.ds-start strong { font-size: clamp(1.2rem, 3.6vh, 3rem); font-weight: 800; }
.ds-start small { color: var(--muted); font-size: clamp(0.85rem, 2vh, 1.6rem); }
.ds-start.is-hidden { display: none; }
@keyframes bob { 50% { transform: translateY(-10px); } }

/* ---------- small / portrait screens ---------- */
@media (max-aspect-ratio: 4/3), (max-width: 900px) {
  body { overflow: auto; }
  .ds { height: auto; min-height: 100vh; }
  .ds-main { grid-template-columns: 1fr; }
  .ds-left { grid-template-rows: auto auto; }
  .ds-call { min-height: 40vh; }
  .ds-recent ol, .ds-board__grid { grid-auto-rows: minmax(64px, auto); }
  .ds-board__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* refinements: keep org cards readable on short screens */
.ds-video { max-height: 47vh; }
.ds-org { justify-content: center; gap: clamp(2px, 0.5vh, 8px); }
.ds-org h3 { line-height: 1.25; flex-shrink: 0; }
.ds-org__row b { font-size: clamp(1rem, 2.8vh, 2.6rem); }
@media (max-height: 820px) {
  .ds-video { max-height: 44vh; }
  .ds-board { padding-top: 10px; padding-bottom: 10px; }
  .ds-board h2 { margin-bottom: 6px; }
}

/* large screens (2K / 4K TVs): scale the rem-based caps up */
@media (min-height: 1300px) { html { font-size: 24px; } }
@media (min-height: 1900px) { html { font-size: 32px; } }
