@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

/* ===== Pre-game overlay (no live game) ===== */
.public-broadcast-overlay {
  --broadcast-top: 0.5rem;
  --broadcast-bottom: 44px;
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  height: 100dvh;
  max-height: 100dvh;
  padding:
    calc(var(--broadcast-top) + env(safe-area-inset-top, 0px))
    0
    calc(var(--broadcast-bottom) + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background: #081a13;
}

.public-broadcast-overlay[hidden] {
  display: none !important;
}

.broadcast-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.broadcast-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: broadcast-float 18s ease-in-out infinite;
}

.broadcast-bg-orb--gold {
  width: min(520px, 70vw);
  height: min(520px, 70vw);
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, #f6d98a 0%, transparent 70%);
}

.broadcast-bg-orb--maroon {
  width: min(480px, 65vw);
  height: min(480px, 65vw);
  top: 8%;
  right: -10%;
  background: radial-gradient(circle, #c1495a 0%, transparent 70%);
  animation-delay: -6s;
}

.broadcast-bg-orb--emerald {
  width: min(400px, 55vw);
  height: min(400px, 55vw);
  bottom: -15%;
  left: 35%;
  background: radial-gradient(circle, #3fae76 0%, transparent 70%);
  animation-delay: -12s;
}

.broadcast-bg-shimmer {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(165deg, rgba(250, 244, 228, 0.06) 0%, transparent 40%),
    radial-gradient(900px 600px at 50% 120%, rgba(15, 43, 34, 0.92), transparent 60%);
}

@keyframes broadcast-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(1.5%, 2%) scale(1.03); }
}

/* Main card */
.broadcast-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1200px, calc(100% - 10vw));
  height: calc(100dvh - 10vh - var(--broadcast-top) - var(--broadcast-bottom));
  max-height: calc(100dvh - 10vh - var(--broadcast-top) - var(--broadcast-bottom));
  margin: 5vh 5vw;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 22px;
  overflow: hidden;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: clamp(0.92rem, 1.4vw, 1rem);
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(155deg, #fffefb 0%, #f6efdc 100%);
  border: 1px solid rgba(214, 161, 60, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45) inset,
    0 28px 70px -24px rgba(8, 26, 19, 0.6);
}

.broadcast-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, #f6d98a, #d6a13c 45%, #8c2436);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.8;
}

/* Top bar */
.broadcast-topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(0.65rem, 1.5vw, 1rem);
  flex-shrink: 0;
  margin-bottom: clamp(0.65rem, 1.5vh, 1rem);
  padding-bottom: clamp(0.55rem, 1.2vh, 0.85rem);
  border-bottom: 1px solid rgba(214, 161, 60, 0.28);
}

.broadcast-topbar-logo {
  flex-shrink: 0;
  width: clamp(44px, 7vw, 56px);
  height: auto;
}

.broadcast-topbar-copy {
  flex: 1;
  min-width: 0;
}

.broadcast-kicker {
  display: block;
  font-size: clamp(0.62rem, 1.2vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 0.2rem;
}

.broadcast-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.public-broadcast-title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.1rem, 2.2vw, 1.75rem);
  font-weight: 800;
  line-height: 1.12;
  color: var(--ink);
}

.broadcast-topbar .broadcast-start-time {
  margin: 0;
  font-family: inherit;
  font-size: clamp(1rem, 2.1vw, 1.35rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink-deep);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(155deg, #fff9ea 0%, #f6d98a 55%, #e8c56a 100%);
  border: 1px solid rgba(163, 113, 31, 0.45);
  box-shadow: 0 2px 10px -4px rgba(163, 113, 31, 0.55);
}

.broadcast-stage-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #17402f, #0f2b22);
  border: 1px solid rgba(214, 161, 60, 0.55);
}

.broadcast-stage-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(246, 217, 138, 0.35);
  animation: broadcast-pulse 2s ease-in-out infinite;
}

.public-broadcast-overlay.is-tickets .broadcast-stage-badge {
  background: linear-gradient(135deg, #8c2436, #5c1624);
}

.public-broadcast-overlay.is-idle .broadcast-stage-badge {
  color: var(--ink);
  background: linear-gradient(135deg, #f6d98a, #d6a13c);
}

.public-broadcast-overlay.is-idle .broadcast-stage-badge::before {
  background: var(--ink);
  box-shadow: 0 0 0 3px rgba(15, 43, 34, 0.2);
}

@keyframes broadcast-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.85); }
}

/* Poster — full width below top bar */
.broadcast-layout {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.broadcast-layout:not(.has-poster) .broadcast-poster {
  display: none;
}

.broadcast-layout:not(.has-embed) .broadcast-embed {
  display: none;
}

.broadcast-poster[hidden],
.broadcast-embed[hidden] {
  display: none !important;
}

.broadcast-embed {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 18px;
  background: #fff;
  border: 2px solid rgba(214, 161, 60, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.broadcast-iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: 0;
  background: #fff;
}

.broadcast-poster {
  margin: 0;
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 18px;
  background: linear-gradient(160deg, #0f2b22, #081a13);
  border: 2px solid rgba(214, 161, 60, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.broadcast-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.broadcast-start-time[hidden] {
  display: none !important;
}

/* Pre-game chrome */
.public-page.broadcast-active .game-window {
  visibility: hidden;
  pointer-events: none;
}

.public-page.broadcast-active .site-credit-badge {
  z-index: 1300;
}

/* Stage 1 iframe — full viewport (no card split) */
.public-broadcast-overlay.is-embed-full {
  --broadcast-top: 0;
  --broadcast-bottom: 0;
  padding: 0;
  background: #000;
}

.public-broadcast-overlay.is-embed-full .broadcast-bg {
  display: none;
}

.public-broadcast-overlay.is-embed-full .broadcast-shell {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

.public-broadcast-overlay.is-embed-full .broadcast-shell::before {
  display: none;
}

.public-broadcast-overlay.is-embed-full .broadcast-topbar {
  display: none;
}

.public-broadcast-overlay.is-embed-full .broadcast-layout {
  flex: 1;
  height: 100%;
}

.public-broadcast-overlay.is-embed-full .broadcast-embed {
  flex: 1;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #000;
}

.public-broadcast-overlay.is-embed-full .broadcast-iframe {
  min-height: 0;
  height: 100%;
}

.public-broadcast-overlay.is-embed-full ~ .site-credit-badge {
  display: none;
}

@media (max-width: 900px) {
  .broadcast-shell {
    width: calc(100% - 10vw);
    margin: 5vh 5vw;
    padding: 10px;
    height: calc(100dvh - 10vh - var(--broadcast-top) - var(--broadcast-bottom));
    max-height: calc(100dvh - 10vh - var(--broadcast-top) - var(--broadcast-bottom));
  }

  .broadcast-topbar {
    flex-wrap: wrap;
  }

  .broadcast-stage-badge {
    width: 100%;
    justify-content: center;
  }

  .broadcast-poster,
  .broadcast-embed {
    min-height: 0;
    flex: 1;
  }

  .broadcast-topbar .broadcast-start-time {
    font-size: clamp(0.92rem, 3.8vw, 1.15rem);
    padding: 0.3rem 0.65rem;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .broadcast-shell {
    padding: 10px;
  }

  .public-broadcast-title {
    font-size: clamp(1rem, 2vw, 1.4rem);
  }

}

@media (prefers-reduced-motion: reduce) {
  .broadcast-bg-orb,
  .broadcast-stage-badge::before {
    animation: none;
  }
}
