/* =====================================================================
   Layar Display TV ruang tunggu — ukuran mengikuti viewport (vw/vh)
   ===================================================================== */
html, body.display { height: 100%; }
body.display {
  overflow: hidden;
  background:
    radial-gradient(80vw 60vh at 100% 0%, var(--primary-100), transparent 70%),
    radial-gradient(60vw 50vh at 0% 100%, var(--primary-50), transparent 70%),
    #f6faf8;
  font-size: clamp(14px, 1.05vw, 26px);
}
.d-wrap { height: 100vh; display: grid; grid-template-rows: auto 1fr auto auto; gap: 1.6vh; padding: 2vh 2vw 0; }

/* Header */
.d-header { display: flex; align-items: center; gap: 1.2vw; background: var(--surface); border: 1px solid var(--border); border-radius: 1.4vw; padding: 1.4vh 1.6vw; box-shadow: var(--shadow); }
.d-header .brand-logo { width: 4.2vw; height: 4.2vw; min-width: 44px; min-height: 44px; border-radius: 1vw; }
.d-title { flex: 1; min-width: 0; }
.d-title h1 { font-size: 1.9em; font-weight: 900; color: var(--primary-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-title p { color: var(--text-2); font-weight: 600; font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-clock { text-align: right; }
.d-clock .time { font-size: 2.6em; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); letter-spacing: -.01em; }
.d-clock .date { font-size: .95em; color: var(--text-2); font-weight: 600; margin-top: .3em; }
.d-tools { display: flex; align-items: center; gap: .6vw; padding-left: 1vw; border-left: 1px solid var(--border); }
.d-tools .btn { border-radius: 12px; }

/* Main */
.d-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 1.6vw; min-height: 0; }
.d-now {
  position: relative; overflow: hidden;
  border-radius: 2vw;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-700) 60%, var(--primary-800) 100%);
  color: #fff;
  display: grid; place-items: center; text-align: center;
  padding: 3vh 3vw;
  box-shadow: 0 2vh 5vh var(--primary-soft);
}
.d-now::before, .d-now::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); pointer-events: none; }
.d-now::before { width: 45vw; height: 45vw; right: -18vw; top: -22vw; }
.d-now::after { width: 30vw; height: 30vw; left: -12vw; bottom: -16vw; }
.d-now-inner { position: relative; z-index: 1; display: grid; gap: 1.2vh; justify-items: center; }
.d-label { font-size: 1.5em; font-weight: 700; letter-spacing: .35em; text-transform: uppercase; opacity: .9; padding-left: .35em; }
.d-number { font-size: min(15vw, 30vh); font-weight: 900; line-height: .95; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-shadow: 0 .6vh 2vh rgba(0,0,0,.18); }
.d-go { font-size: 1.35em; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; opacity: .85; display: flex; align-items: center; gap: .6em; padding-left: .3em; }
.d-counter { font-size: min(6.4vw, 11vh); font-weight: 900; line-height: 1; background: #fff; color: var(--primary-800); padding: .12em .5em; border-radius: .25em; box-shadow: 0 1vh 3vh rgba(0,0,0,.15); }
.d-service { font-size: 1.7em; font-weight: 700; opacity: .95; }
.d-now.is-empty .d-number { opacity: .5; }

/* Animasi panggilan baru */
.d-now.calling { animation: now-glow 1.2s ease-in-out 3; }
.d-now.calling .d-number { animation: num-in .7s cubic-bezier(.2, .9, .3, 1.3); }
.d-now.calling .d-counter { animation: counter-in .8s .15s cubic-bezier(.2, .9, .3, 1.3) both; }
.d-now .ring { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.d-now.calling .ring { animation: ring 1.2s ease-out 3; }
@keyframes num-in { 0% { transform: scale(.5) translateY(4vh); opacity: 0; filter: blur(8px); } 60% { transform: scale(1.06); opacity: 1; filter: none; } 100% { transform: none; } }
@keyframes counter-in { 0% { transform: translateY(3vh) scale(.8); opacity: 0; } }
@keyframes now-glow { 50% { box-shadow: 0 0 0 1vw var(--primary-soft), 0 2vh 6vh var(--primary-soft); } }
@keyframes ring { 0% { box-shadow: inset 0 0 0 0 rgba(255,255,255,.55); } 100% { box-shadow: inset 0 0 0 3vw rgba(255,255,255,0); } }

/* Riwayat */
.d-side { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 2vw; box-shadow: var(--shadow); overflow: hidden; }
.d-side h2 { font-size: 1.2em; font-weight: 800; padding: 2vh 1.6vw; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .6em; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.d-history { list-style: none; margin: 0; padding: 1vh 1vw; display: grid; align-content: start; gap: 1vh; overflow: hidden; }
.d-history li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1vw; padding: 1.4vh 1vw; border-radius: 1vw; background: var(--surface-2); border: 1px solid var(--border); animation: slide-in .5s ease both; }
.d-history li:first-child { background: var(--primary-50); border-color: var(--primary-100); }
.d-history .h-code { font-size: 2.1em; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); min-width: 4.2em; }
.d-history .h-arrow { color: var(--muted); display: flex; align-items: center; gap: .6vw; font-size: .95em; min-width: 0; }
.d-history .h-arrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-history .h-counter { font-size: 1.35em; font-weight: 800; color: var(--primary-800); white-space: nowrap; }
.d-history .icon { width: 1.3em; height: 1.3em; flex: none; }
@keyframes slide-in { from { opacity: 0; transform: translateX(3vw); } }

/* Status meja */
.d-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(12vw, 1fr)); gap: 1vw; }
.d-cnt { background: var(--surface); border: 1px solid var(--border); border-radius: 1.2vw; padding: 1.4vh 1.2vw; display: grid; gap: .5vh; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: border-color .4s, background .4s, transform .4s; }
.d-cnt::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: .35vw; min-width: 4px; background: var(--border-strong); transition: background .4s; }
.d-cnt.serving::before { background: var(--primary); }
.d-cnt.closed { opacity: .55; }
.d-cnt .c-top { display: flex; justify-content: space-between; align-items: center; gap: .5vw; }
.d-cnt .c-name { font-weight: 800; font-size: 1.1em; }
.d-cnt .c-label { font-size: .8em; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-cnt .c-code { font-size: 2.3em; font-weight: 900; line-height: 1.05; color: var(--primary-800); font-variant-numeric: tabular-nums; }
.d-cnt .c-code.none { color: var(--border-strong); }
.d-cnt .badge { font-size: .72em; }
.d-cnt.flash { animation: cnt-flash 1.4s ease 2; }
@keyframes cnt-flash { 40% { background: var(--primary-100); border-color: var(--primary); transform: translateY(-.4vh); } }

/* Running text */
.d-ticker { margin: 0 -2vw; background: var(--primary-800); color: #fff; overflow: hidden; white-space: nowrap; font-weight: 600; font-size: 1.15em; padding: 1.1vh 0; display: flex; align-items: center; }
.d-ticker .t-badge { background: var(--primary); padding: 0 1.4vw; height: 100%; display: flex; align-items: center; gap: .5em; font-weight: 800; position: relative; z-index: 1; box-shadow: 1vw 0 1vw var(--primary-800); }
.d-ticker .t-track { display: inline-block; padding-left: 100%; animation: ticker var(--ticker-dur, 30s) linear infinite; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* Overlay mulai (dibutuhkan browser agar suara boleh diputar) */
.d-start { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(6, 30, 20, .72); backdrop-filter: blur(6px); padding: 20px; }
.d-start-card { background: #fff; border-radius: 28px; padding: 40px; max-width: 520px; text-align: center; display: grid; gap: 16px; box-shadow: var(--shadow-lg); }
.d-start-card h2 { font-size: 28px; font-weight: 900; }
.d-start-card p { color: var(--text-2); font-size: 16px; }
.d-start-card .btn { min-height: 64px; font-size: 20px; }

/* Panel pengaturan suara (drawer) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); z-index: 250; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .25s ease; font-size: 15px; }
.drawer.open { transform: none; }
.drawer .modal-body { flex: 1; display: grid; gap: 18px; align-content: start; }

/* Sembunyikan kursor & tombol saat idle di layar penuh */
body.display.idle { cursor: none; }
body.display.idle .d-tools { opacity: 0; transition: opacity .6s; }

@media (max-width: 900px) {
  body.display { overflow: auto; font-size: 14px; }
  .d-wrap { height: auto; min-height: 100vh; padding: 12px 12px 0; gap: 12px; }
  .d-header { flex-wrap: wrap; border-radius: 16px; padding: 12px 14px; }
  .d-header .brand-logo { width: 44px; height: 44px; }
  .d-title h1 { font-size: 18px; }
  .d-clock .time { font-size: 26px; }
  .d-tools { border-left: 0; padding-left: 0; width: 100%; justify-content: flex-end; }
  .d-main { grid-template-columns: 1fr; }
  .d-now { border-radius: 22px; padding: 28px 16px; }
  .d-number { font-size: 26vw; }
  .d-counter { font-size: 12vw; }
  .d-label, .d-go { letter-spacing: .2em; font-size: 14px; }
  .d-service { font-size: 18px; }
  .d-side { border-radius: 18px; }
  .d-side h2 { padding: 14px 16px; font-size: 14px; }
  .d-history { padding: 10px; gap: 8px; }
  .d-history li { padding: 10px 12px; border-radius: 12px; gap: 10px; }
  .d-history .h-code { font-size: 22px; }
  .d-history .h-counter { font-size: 16px; }
  .d-counters { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .d-cnt { border-radius: 14px; padding: 12px; }
  .d-cnt .c-code { font-size: 26px; }
  .d-ticker { margin: 0 -12px; padding: 10px 0; font-size: 14px; }
}
