:root {
  color-scheme: dark;
  --bg: #050008;
  --panel: rgba(14, 5, 29, 0.92);
  --purple: #7c3aed;
  --purple-light: #c4b5fd;
  --cyan: #52e4ff;
  --gold: #ffd45c;
  --white: #ffffff;
  --muted: #c9bce2;
  --danger: #ff9aab;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(124, 58, 237, 0.40), transparent 32%),
    radial-gradient(circle at 90% 15%, rgba(19, 173, 214, 0.25), transparent 30%),
    linear-gradient(150deg, #170328 0%, #071827 50%, #050008 100%);
}

.tv-shell {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: clamp(16px, 2vw, 34px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(12px, 1.7vh, 22px);
}

.brand {
  text-align: center;
}

.brand-kicker {
  color: var(--cyan);
  font-size: clamp(12px, 1.2vw, 20px);
  font-weight: 900;
  letter-spacing: 0.24em;
}

.brand h1 {
  margin: 3px 0 0;
  color: var(--gold);
  font-size: clamp(40px, 6vw, 92px);
  line-height: 0.95;
  letter-spacing: 0.035em;
  font-weight: 1000;
  text-shadow:
    0 0 14px rgba(255, 212, 92, 0.65),
    0 0 34px rgba(124, 58, 237, 0.70);
}

.brand-tagline {
  margin-top: 8px;
  color: var(--purple-light);
  font-size: clamp(13px, 1.35vw, 22px);
  font-weight: 900;
  letter-spacing: 0.13em;
}

.display-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.65fr);
  gap: clamp(16px, 2vw, 32px);
}

.signup-card,
.rotation-card {
  min-height: 0;
  border: 2px solid rgba(196, 181, 253, 0.44);
  border-radius: clamp(20px, 2vw, 34px);
  background: var(--panel);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    inset 0 0 48px rgba(124, 58, 237, 0.10);
}

.signup-card {
  padding: clamp(15px, 2vw, 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.signup-label {
  margin-bottom: clamp(10px, 1.4vh, 18px);
  color: var(--gold);
  font-size: clamp(22px, 2.7vw, 44px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: 0.045em;
  text-shadow: 0 0 18px rgba(255, 212, 92, 0.35);
}

.qr-frame {
  width: min(35vh, 90%, 410px);
  aspect-ratio: 1;
  padding: clamp(8px, 1vw, 14px);
  border-radius: clamp(18px, 1.8vw, 28px);
  background: #fff;
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(82, 228, 255, 0.20);
}

.qr-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.signup-url {
  margin-top: clamp(10px, 1.3vh, 18px);
  color: var(--cyan);
  font-size: clamp(14px, 1.35vw, 23px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.rotation-card {
  position: relative;
  padding: clamp(18px, 2.2vw, 36px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  overflow: hidden;
}

.rotation-topline {
  min-height: 25px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: clamp(11px, 0.9vw, 15px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.connection-status.connected {
  color: #9ff7c2;
}

.connection-status.error {
  color: var(--danger);
}

.slide-stage {
  min-height: 0;
  position: relative;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 3%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  pointer-events: none;
  transition:
    opacity 420ms ease,
    transform 420ms ease;
}

.slide.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.slide-label {
  margin-bottom: clamp(12px, 2vh, 26px);
  color: var(--cyan);
  font-size: clamp(21px, 2.5vw, 43px);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 0 24px rgba(82, 228, 255, 0.32);
}

.primary-name {
  max-width: 100%;
  color: var(--white);
  font-size: clamp(38px, 6vw, 94px);
  line-height: 0.98;
  font-weight: 1000;
  overflow-wrap: anywhere;
  text-shadow:
    0 5px 22px rgba(0, 0, 0, 0.75),
    0 0 30px rgba(124, 58, 237, 0.42);
}

.song-line {
  margin-top: clamp(12px, 2vh, 24px);
  max-width: 95%;
  color: var(--gold);
  font-size: clamp(18px, 2vw, 34px);
  line-height: 1.2;
  font-weight: 900;
}

.next-five-list {
  width: min(94%, 900px);
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(7px, 1vh, 13px);
  list-style: none;
  counter-reset: performer;
}

.next-five-list li {
  counter-increment: performer;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: clamp(8px, 1vh, 14px) clamp(11px, 1.4vw, 20px);
  border: 1px solid rgba(196, 181, 253, 0.24);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.next-five-list li::before {
  content: counter(performer);
  color: var(--cyan);
  font-size: clamp(18px, 1.7vw, 28px);
  font-weight: 1000;
  text-align: center;
}

.queue-name {
  min-width: 0;
  color: var(--white);
  font-size: clamp(18px, 1.8vw, 31px);
  line-height: 1.05;
  font-weight: 1000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-wait {
  color: var(--gold);
  font-size: clamp(14px, 1.25vw, 21px);
  font-weight: 900;
  white-space: nowrap;
}

.empty-slot {
  opacity: 0.42;
}

.wait-time {
  color: var(--gold);
  font-size: clamp(48px, 8vw, 126px);
  line-height: 0.95;
  font-weight: 1000;
  text-shadow:
    0 0 24px rgba(255, 212, 92, 0.40),
    0 0 46px rgba(124, 58, 237, 0.30);
}

.wait-subline {
  margin-top: clamp(12px, 2vh, 24px);
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 29px);
  font-weight: 900;
}

.slide-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: transform 220ms ease, background 220ms ease;
}

.dot.active {
  transform: scale(1.35);
  background: var(--cyan);
}

.rotating-banner {
  min-height: clamp(58px, 7.5vh, 88px);
  overflow: hidden;
  border: 1px solid rgba(82, 228, 255, 0.48);
  border-radius: clamp(15px, 1.5vw, 22px);
  background:
    linear-gradient(
      90deg,
      rgba(74, 20, 138, 0.96),
      rgba(14, 121, 161, 0.90),
      rgba(74, 20, 138, 0.96)
    );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  box-shadow: 0 0 32px rgba(82, 228, 255, 0.14);
}

.banner-text {
  width: 100%;
  text-align: center;
  color: var(--white);
  font-size: clamp(19px, 2.2vw, 37px);
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-shadow: 0 3px 15px rgba(0, 0, 0, 0.75);
  animation: bannerPulse 1.8s ease-in-out infinite alternate;
}

@keyframes bannerPulse {
  from { opacity: 0.86; }
  to { opacity: 1; }
}

@media (max-aspect-ratio: 4/3) {
  html,
  body {
    overflow: auto;
  }

  .tv-shell {
    min-height: 100vh;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  .display-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(600px, 1fr);
  }

  .signup-card {
    display: grid;
    grid-template-columns: minmax(145px, 30vw) minmax(0, 1fr);
    grid-template-areas:
      "qr label"
      "qr url";
    gap: 8px 22px;
    min-height: 230px;
  }

  .signup-label {
    grid-area: label;
    margin: 0;
    align-self: end;
  }

  .qr-frame {
    grid-area: qr;
    width: min(30vw, 225px);
  }

  .signup-url {
    grid-area: url;
    margin: 0;
    align-self: start;
  }

  .rotation-card {
    min-height: 610px;
  }
}

@media (max-width: 720px) {
  .tv-shell {
    padding: 12px;
  }

  .signup-card {
    grid-template-columns: 130px minmax(0, 1fr);
  }

  .qr-frame {
    width: 130px;
  }

  .rotation-card {
    min-height: 550px;
  }

  .next-five-list li {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .queue-wait {
    grid-column: 2;
  }
}
