:root {
  --bg: #07090d;
  --panel: #101820;
  --panel-strong: #15202a;
  --gold: #d7b46a;
  --gold-soft: #f1d994;
  --text: #f8f2e8;
  --muted: #aeb8bf;
  --line: rgba(215, 180, 106, 0.22);
  --success: #53d58b;
  --warn: #f0bc5e;
  --danger: #ff6978;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(215, 180, 106, 0.13), transparent 26%),
    linear-gradient(135deg, #07090d 0%, #0b1118 42%, #06080c 100%);
}

.tv-shell {
  width: 100vw;
  height: 100vh;
  padding: 2.1vh 2.2vw 1.8vh;
  display: grid;
  grid-template-rows: 11vh minmax(0, 1fr) 17vh 4.8vh;
  gap: 1.5vh;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2vw;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.3vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.2vw;
  min-width: 0;
}

.logo {
  width: 7vh;
  height: 7vh;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
  background: linear-gradient(145deg, #1a2430, #111820);
}

.logo-fallback {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 3.1vh;
  font-weight: 800;
}

.branch-name {
  margin: 0;
  font-size: clamp(30px, 4.3vh, 62px);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  margin-top: 0.7vh;
  display: flex;
  align-items: center;
  gap: 1vw;
  color: var(--muted);
  font-size: clamp(14px, 1.75vh, 26px);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45vw;
  color: var(--success);
  border: 1px solid rgba(83, 213, 139, 0.38);
  background: rgba(83, 213, 139, 0.09);
  border-radius: 999px;
  padding: 0.35vh 0.8vw;
  font-weight: 800;
}

.live-dot {
  width: 0.7vh;
  height: 0.7vh;
  border-radius: 999px;
  background: currentColor;
}

.clock {
  font-size: clamp(22px, 3.1vh, 42px);
  color: var(--gold-soft);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.82fr);
  gap: 1.5vw;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(16, 24, 32, 0.88);
  border-radius: 1.2vw;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.24);
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4vh 1.3vw 0.8vh;
  border-bottom: 1px solid rgba(215, 180, 106, 0.14);
}

.panel-title {
  margin: 0;
  font-size: clamp(18px, 2.1vh, 30px);
  color: var(--gold-soft);
  text-transform: uppercase;
  font-weight: 900;
}

.panel-meta {
  color: var(--muted);
  font-size: clamp(13px, 1.6vh, 22px);
}

.chairs-grid {
  height: calc(100% - 6.6vh);
  padding: 1.1vh 1vw;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05vh 1vw;
  overflow: hidden;
}

.chair-card {
  border: 1px solid rgba(215, 180, 106, 0.18);
  background: linear-gradient(155deg, rgba(21, 32, 42, 0.96), rgba(9, 14, 21, 0.96));
  border-radius: 1vw;
  padding: 1.2vh 1.05vw;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.chair-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1vw;
  color: var(--muted);
  font-size: clamp(14px, 1.65vh, 22px);
  text-transform: uppercase;
  font-weight: 800;
}

.chair-status {
  color: var(--gold-soft);
}

.chair-status.available {
  color: var(--success);
}

.chair-status.paused {
  color: var(--warn);
}

.chair-status.unavailable {
  color: var(--muted);
}

.token-now {
  align-self: center;
  font-size: clamp(42px, 8vh, 118px);
  line-height: 0.95;
  font-weight: 950;
  color: var(--gold-soft);
}

.token-available {
  align-self: center;
  font-size: clamp(34px, 5.3vh, 76px);
  font-weight: 950;
  color: var(--success);
}

.service-name {
  font-size: clamp(17px, 2.3vh, 34px);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chair-detail {
  color: var(--muted);
  font-size: clamp(14px, 1.8vh, 24px);
  margin-top: 0.3vh;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-list {
  padding: 1.2vh 1vw;
  display: grid;
  gap: 1vh;
}

.upcoming-item {
  min-height: 9.2vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1vw;
  align-items: center;
  border: 1px solid rgba(215, 180, 106, 0.16);
  border-radius: 0.9vw;
  padding: 1vh 1vw;
  background: rgba(255, 255, 255, 0.035);
}

.upcoming-token {
  color: var(--gold-soft);
  font-size: clamp(28px, 4.3vh, 58px);
  font-weight: 950;
}

.upcoming-service {
  font-size: clamp(15px, 1.85vh, 24px);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-time {
  margin-top: 0.35vh;
  color: var(--muted);
  font-size: clamp(13px, 1.55vh, 20px);
}

.lower-grid {
  display: grid;
  grid-template-columns: 1.12fr 1fr 1.15fr;
  gap: 1.5vw;
  min-height: 0;
}

.metric-panel,
.offer-panel,
.qr-panel {
  padding: 1.35vh 1.2vw;
}

.metric-label,
.offer-label,
.qr-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: clamp(13px, 1.55vh, 20px);
  font-weight: 900;
}

.wait-range {
  color: var(--gold-soft);
  font-size: clamp(38px, 6vh, 86px);
  line-height: 1;
  font-weight: 950;
  margin-top: 1vh;
}

.next-chair {
  color: var(--text);
  font-size: clamp(17px, 2.2vh, 32px);
  margin-top: 0.7vh;
  font-weight: 800;
}

.offer-title {
  margin-top: 0.9vh;
  color: var(--gold-soft);
  font-size: clamp(25px, 3.8vh, 54px);
  line-height: 1.05;
  font-weight: 950;
}

.offer-copy {
  margin-top: 0.7vh;
  color: var(--muted);
  font-size: clamp(15px, 1.9vh, 26px);
  line-height: 1.25;
}

.qr-row {
  margin-top: 0.8vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9vw;
}

.qr-tile {
  display: grid;
  grid-template-columns: 8.2vh minmax(0, 1fr);
  gap: 0.8vw;
  align-items: center;
}

.qr-tile img {
  width: 8.2vh;
  height: 8.2vh;
  background: #fff;
  border-radius: 0.45vw;
  padding: 0.3vh;
}

.qr-title {
  font-size: clamp(16px, 2vh, 28px);
  font-weight: 900;
}

.qr-copy {
  color: var(--muted);
  font-size: clamp(12px, 1.45vh, 18px);
  margin-top: 0.3vh;
}

.ticker {
  display: flex;
  align-items: center;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--gold-soft);
  font-size: clamp(16px, 2vh, 30px);
  font-weight: 800;
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  gap: 4vw;
  min-width: max-content;
  animation: ticker-scroll 34s linear infinite;
}

.ticker-item::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 1vw;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: middle;
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.connection-badge {
  position: fixed;
  top: 1.6vh;
  right: 2.2vw;
  z-index: 5;
  background: rgba(240, 188, 94, 0.16);
  border: 1px solid rgba(240, 188, 94, 0.45);
  color: var(--warn);
  border-radius: 999px;
  padding: 0.7vh 1vw;
  font-size: clamp(12px, 1.55vh, 20px);
  font-weight: 900;
}

.state-panel {
  width: min(860px, 70vw);
  margin: auto;
  border: 1px solid var(--line);
  background: rgba(16, 24, 32, 0.92);
  border-radius: 1.4vw;
  padding: 5vh 4vw;
  text-align: center;
}

.state-title {
  color: var(--gold-soft);
  font-size: clamp(32px, 5.5vh, 76px);
  font-weight: 950;
}

.state-copy {
  margin-top: 1.5vh;
  color: var(--muted);
  font-size: clamp(18px, 2.4vh, 32px);
}

.state-shell {
  width: 100vw;
  height: 100vh;
  padding: 2vw;
  display: grid;
  place-items: center;
}

.empty-center {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed rgba(215, 180, 106, 0.3);
  border-radius: 1vw;
  color: var(--muted);
}

.empty-center strong {
  display: block;
  color: var(--gold-soft);
  font-size: clamp(36px, 6vh, 82px);
  margin-bottom: 1vh;
}

@media (max-width: 1100px) {
  .tv-shell {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto auto;
  }

  body {
    overflow: auto;
  }

  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .chairs-grid {
    height: auto;
    grid-template-columns: 1fr;
  }
}
