/* Large-format TV screens: always dark, high contrast, readable from a distance. */
:root {
  --d-bg: #070d1a;
  --d-panel: #0f1a30;
  --d-panel-2: #142241;
  --d-line: #1e2f52;
  --d-text: #f1f5f9;
  --d-muted: #93a4c3;
  --d-token: #fde047;
  --d-accent: #38bdf8;
  --d-green: #4ade80;
  --d-amber: #fbbf24;
  --d-red: #f87171;
  color-scheme: dark;
}
html, body { height: 100%; }
.hidden { display: none !important; }
body.display { background: var(--d-bg); color: var(--d-text); font-family: system-ui, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif; overflow: hidden; margin: 0; font-size: clamp(14px, 1.15vw, 28px); }
.d-wrap { height: 100vh; display: flex; flex-direction: column; }

.d-header { display: flex; align-items: center; justify-content: space-between; padding: 1vh 2vw; background: linear-gradient(90deg, #0b2a6b, #0f1a30); border-bottom: 2px solid var(--d-line); gap: 2vw; }
.d-title { display: flex; align-items: center; gap: 1vw; }
.d-title .mark { width: 3.2vw; height: 3.2vw; min-width: 36px; min-height: 36px; border-radius: 22%; background: #fff; color: #0b2a6b; font-weight: 900; display: grid; place-items: center; font-size: 2vw; }
.d-title h1 { font-size: 1.9vw; font-weight: 800; }
.d-title p { margin: 0; color: var(--d-muted); font-size: 1.05vw; }
.d-clock { text-align: right; font-variant-numeric: tabular-nums; }
.d-clock .t { font-size: 2.2vw; font-weight: 800; }
.d-clock .d { font-size: 1vw; color: var(--d-muted); }

.d-main { flex: 1; min-height: 0; padding: 1.5vh 1.5vw; display: grid; gap: 1.5vw; }
.panel { background: var(--d-panel); border: 1px solid var(--d-line); border-radius: 1vw; padding: 1.4vh 1.2vw; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.panel-title { font-size: 1.25vw; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--d-accent); margin-bottom: 1.2vh; display: flex; justify-content: space-between; align-items: baseline; gap: 1vw; }
.panel-title .hi { text-transform: none; color: var(--d-muted); font-weight: 600; letter-spacing: 0; }

.token { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 900; color: var(--d-token); letter-spacing: .03em; }
.token.priority { color: var(--d-amber); }

/* Counter tiles (registration / lab desks) */
.tiles { display: grid; gap: 1vw; grid-template-columns: repeat(auto-fit, minmax(16vw, 1fr)); }
.tile { background: var(--d-panel-2); border: 2px solid var(--d-line); border-radius: .9vw; padding: 1.4vh 1vw; text-align: center; transition: border-color .3s, background .3s; }
.tile .who { font-size: 1.3vw; font-weight: 700; color: var(--d-muted); }
.tile .token { font-size: 4.6vw; line-height: 1.1; margin-top: .4vh; }
.tile .none { font-size: 1.6vw; color: var(--d-muted); padding: 2.2vh 0; }
.tile.closed { opacity: .45; }
.tile.flash { animation: flash 1s ease-in-out 6; border-color: var(--d-token); }
@keyframes flash { 50% { background: #3b3a12; } }

.chips { display: flex; flex-wrap: wrap; gap: .6vw; align-content: flex-start; }
.chip { font-family: ui-monospace, Consolas, monospace; font-weight: 800; font-size: 1.6vw; padding: .5vh .8vw; border-radius: .5vw; background: var(--d-panel-2); border: 1px solid var(--d-line); }
.chip.priority { color: var(--d-amber); border-color: #5c4510; }

.d-table { width: 100%; border-collapse: collapse; }
.d-table th { text-align: left; color: var(--d-muted); font-size: .9vw; text-transform: uppercase; letter-spacing: .05em; padding: .6vh .6vw; border-bottom: 1px solid var(--d-line); font-weight: 700; }
.d-table td { padding: 1vh .6vw; border-bottom: 1px solid var(--d-line); font-size: 1.25vw; }
.d-table tr:last-child td { border-bottom: none; }
.d-table .floor { font-weight: 800; color: var(--d-accent); white-space: nowrap; }

.pill { font-size: .85vw; font-weight: 800; padding: .3vh .6vw; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.pill.open { background: #064e3b; color: var(--d-green); }
.pill.break { background: #451a03; color: var(--d-amber); }
.pill.closed { background: #450a0a; color: var(--d-red); }

.ticker { background: #0b2a6b; border-top: 2px solid var(--d-line); padding: 1.2vh 1.5vw; display: flex; align-items: center; gap: 1.2vw; overflow: hidden; white-space: nowrap; }
.ticker .label { background: var(--d-token); color: #111; font-weight: 900; padding: .4vh .8vw; border-radius: .4vw; font-size: 1.1vw; flex: none; }
.ticker .items { flex: 1; min-width: 0; overflow: hidden; font-size: 1.3vw; }
.mq-track { display: flex; width: max-content; will-change: transform; }
.mq-seg { display: flex; gap: 4vw; padding-right: 4vw; flex: none; }
@keyframes mq { to { transform: translateX(var(--mq-dist)); } }
.scroll-box { flex: 1; min-height: 0; overflow: hidden; }
.d-table td.nowrap { white-space: nowrap; }
.ticker .items span b { color: var(--d-token); font-family: ui-monospace, Consolas, monospace; }

.empty-d { color: var(--d-muted); font-size: 1.3vw; text-align: center; padding: 3vh 0; }

/* Sound unlock overlay (browsers block audio until first interaction) */
#soundGate { position: fixed; inset: 0; background: rgba(2, 6, 23, .82); display: grid; place-items: center; z-index: 50; cursor: pointer; }
#soundGate div { background: var(--d-panel); border: 2px solid var(--d-accent); border-radius: 16px; padding: 28px 36px; text-align: center; font-size: 22px; max-width: 90vw; }
#soundGate small { display: block; color: var(--d-muted); font-size: 15px; margin-top: 8px; }

.offline { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: var(--d-red); color: #111; font-weight: 800; padding: 6px 14px; border-radius: 8px; z-index: 40; }

@media (max-width: 900px) {
  body.display { overflow: auto; font-size: 15px; }
  .d-wrap { height: auto; min-height: 100vh; }
  .d-main { grid-template-columns: 1fr !important; padding: 12px 16px; }
  .d-title h1 { font-size: 18px; } .d-title p, .d-clock .d { font-size: 12px; } .d-clock .t { font-size: 20px; }
  .panel-title { font-size: 15px; } .tile .who { font-size: 15px; } .tile .token { font-size: 44px; } .chip { font-size: 18px; }
  .d-table td { font-size: 15px; } .d-table th, .pill { font-size: 11px; } .ticker .items, .ticker .label { font-size: 14px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
