:root {
  color-scheme: dark;
  --ink: #f7f7f2;
  --muted: #a8b1b7;
  --panel: #151a1f;
  --panel-strong: #0b1014;
  --green: #31d07d;
  --red: #ff4f5f;
  --amber: #ffca5f;
  --blue: #0d5eaf;
  --blue-bright: #67b7ff;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0a0d0f;
  color: var(--ink);
}

.viewer-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: stretch;
}

.hidden {
  display: none !important;
}

.live-panel {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #050708;
}

.video-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #000;
}

.stream-overlay {
  position: absolute;
  inset: auto 24px 24px 24px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(5, 7, 8, 0.78);
  color: var(--ink);
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
}

.stream-overlay.ready {
  opacity: 0;
  pointer-events: none;
}

.live-meta {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr) auto;
  gap: clamp(10px, 2vw, 22px);
  align-items: center;
  padding: clamp(7px, 1.4vh, 13px) clamp(12px, 3.2vw, 42px);
  background:
    linear-gradient(90deg, rgba(13, 94, 175, 0.92), rgba(17, 31, 45, 0.96) 34%, var(--panel) 100%);
  border-top: 3px solid white;
}

.live-meta::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='10' viewBox='0 0 64 10'%3E%3Cpath d='M0 8H8V2H25V8H17V5H22V4H12V9H33V2H50V8H42V5H47V4H37V9H64' fill='none' stroke='white' stroke-width='1.7' stroke-linejoin='miter' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 64px 10px;
  opacity: 0.86;
  pointer-events: none;
}

.live-brand {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.live-badge,
.standby-badge {
  display: inline-grid;
  min-width: 58px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0;
  font-size: 0.72rem;
}

.live-badge {
  background: var(--red);
  color: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.festival-title {
  min-width: 0;
  color: white;
  font-size: clamp(0.84rem, 1.35vw, 1.04rem);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standby-badge {
  background: rgba(103, 183, 255, 0.16);
  color: var(--blue-bright);
  border: 1px solid rgba(103, 183, 255, 0.42);
}

.live-meta h1,
.standby-copy h1 {
  margin: 0;
  font-size: clamp(1.22rem, 2.5vw, 2.5rem);
  letter-spacing: 0;
}

.dance-slot-label {
  display: inline-block;
  margin-bottom: 3px;
  color: #d7ecff;
  font-size: clamp(0.68rem, 1vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dance-slot-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dance-slot-copy h1 {
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-meta p,
.standby-copy p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.45vw, 1rem);
}

.connection-state {
  justify-self: end;
  color: var(--green);
  font-size: clamp(0.78rem, 1.15vw, 0.95rem);
  font-weight: 800;
  white-space: nowrap;
}

.standby-panel {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(13, 94, 175, 0.5), transparent 38%),
    linear-gradient(310deg, rgba(255, 202, 95, 0.12), transparent 34%),
    #071a31;
}

.standby-panel::before,
.standby-panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background-color: rgba(13, 94, 175, 0.76);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='10' viewBox='0 0 64 10'%3E%3Cpath d='M0 8H8V2H25V8H17V5H22V4H12V9H33V2H50V8H42V5H47V4H37V9H64' fill='none' stroke='white' stroke-width='1.7' stroke-linejoin='miter' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 64px 10px;
  opacity: 0.88;
  pointer-events: none;
}

.standby-panel::before {
  top: 0;
}

.standby-panel::after {
  bottom: 0;
}

.standby-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}

.standby-copy {
  position: relative;
  width: min(980px, calc(100% - 32px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: clamp(14px, 4.5vmin, 56px);
  text-align: center;
}

.standby-festival {
  display: block;
  margin-bottom: clamp(10px, 2vh, 16px);
  color: #d7ecff;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.standby-copy h1 {
  margin-top: clamp(10px, 2vh, 18px);
}

.next-broadcast {
  width: min(620px, 100%);
  margin: clamp(14px, 4vh, 34px) auto 0;
  padding: clamp(10px, 2.5vh, 18px);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.next-broadcast span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-broadcast strong,
.next-broadcast time,
.countdown {
  display: block;
  margin-top: 8px;
}

.next-broadcast strong {
  font-size: 1.2rem;
}

.next-broadcast time {
  color: var(--muted);
}

.countdown {
  color: var(--amber);
  font-size: clamp(1.15rem, 3.4vw, 2.35rem);
  font-weight: 800;
}

@media (max-width: 720px) {
  .live-meta {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 9px 12px 8px;
  }

  .live-brand {
    grid-column: 1 / -1;
  }

  .festival-title {
    font-size: 0.82rem;
  }

  .dance-slot-copy h1 {
    font-size: clamp(1.05rem, 6vw, 1.45rem);
  }

  .connection-state {
    justify-self: end;
    align-self: end;
  }

  .stream-overlay {
    inset: auto 12px 12px 12px;
  }
}

@media (max-height: 560px) {
  .live-badge,
  .standby-badge {
    min-width: 54px;
    height: 24px;
    font-size: 0.66rem;
  }

  .dance-slot-label,
  .next-broadcast span {
    font-size: 0.7rem;
  }

  .live-meta h1,
  .standby-copy h1 {
    font-size: clamp(1rem, 4.4vh, 1.5rem);
  }

  .live-meta p,
  .standby-copy p,
  .next-broadcast time {
    font-size: 0.86rem;
  }
}
