.tv-purchase-overlay {
  position: fixed;
  inset: 0;
  z-index: 1700;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 16px;
  background: rgba(3, 11, 25, .86);
  overscroll-behavior: contain;
}

.tv-purchase-overlay[hidden] { display: none !important; }

.tv-purchase-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(720px, 100%);
  height: min(820px, calc(100vh - 32px));
  max-height: calc(100dvh - 32px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #4774a5;
  border-radius: 18px;
  background: #091a32;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .62);
}

.tv-purchase-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 15px 18px;
  border-bottom: 1px solid #244669;
  background: #0d2340;
}

.tv-purchase-heading > div { min-width: 0; }

.tv-purchase-heading > div > span {
  display: block;
  margin-bottom: 3px;
  color: #8cc7ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
}

.tv-purchase-heading h2 {
  margin: 0;
  color: #f5f8ff;
  font-size: clamp(18px, 2.5vw, 23px);
  line-height: 1.12;
}

.tv-purchase-heading p {
  margin: 4px 0 0;
  color: #b8cee6;
  font-size: 13px;
  line-height: 1.3;
}

.tv-purchase-heading button {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #456b94;
  border-radius: 50%;
  background: #142d4c;
  color: #eaf3ff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.tv-purchase-heading button:hover,
.tv-purchase-heading button:focus-visible {
  border-color: #ffdc72;
  background: #203f63;
  outline: 2px solid #ffdc72;
  outline-offset: 2px;
}

.tv-purchase-dialog iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #07162b;
}

#tv-purchase-overlay .tv-purchase-dialog {
  box-sizing: border-box;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: var(--tv-purchase-height, 500px);
}
#tv-purchase-overlay .tv-purchase-dialog iframe { grid-row: 3; }

@media (max-width: 600px) {
  .tv-purchase-overlay { padding: 8px; }
  .tv-purchase-dialog {
    width: 100%;
    height: min(900px, calc(100vh - 16px));
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  .tv-purchase-heading { gap: 10px; padding: 12px; }
  .tv-purchase-heading p { font-size: 12px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .tv-purchase-overlay { padding: 8px; }
  .tv-purchase-dialog { width: min(900px, 100%); height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .tv-purchase-heading { padding: 8px 12px; }
  .tv-purchase-heading p { display: none; }
}

@supports not (height: 100dvh) {
  .tv-purchase-dialog { max-height: calc(100vh - 32px); }
  @media (max-width: 600px) {
    .tv-purchase-dialog { max-height: calc(100vh - 16px); }
  }
}

.tv-auth-dialog { width: min(560px, 100%); height: min(760px, calc(100vh - 32px)); }
.tv-auth-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}
.tv-auth-heading-actions { display: flex; align-items: center; gap: 6px; }
.tv-auth-heading-actions button {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  height: 36px;
  padding: 0 12px;
  place-items: center;
  border: 1px solid #456b94;
  border-radius: 10px;
  background: #142d4c;
  color: #c6d9f2;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.tv-auth-heading-actions button.is-active { border-color: #ffdc72; background: #f2c956; color: #14243a; }
.tv-auth-heading .tv-auth-close {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: #102744;
  color: #c6d9f2;
  font-size: 0;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.tv-auth-heading .tv-auth-close svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}
.tv-auth-heading .tv-auth-close:hover,
.tv-auth-heading .tv-auth-close:focus-visible {
  border-color: #ffdc72;
  background: #1b3a5c;
  color: #ffdc72;
  outline: 2px solid rgba(255, 220, 114, .85);
  outline-offset: 2px;
}
.tv-auth-heading .tv-auth-close:active { transform: scale(.96); }
.tv-auth-dialog iframe { color-scheme: dark; }
.tv-auth-link { white-space: nowrap; }
#tv-auth-open[hidden] { display: none !important; }

@media (min-width: 700px) {
  body.tv-broadcast-body > .topbar > nav .buy-tickets-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid #ffe49a;
    border-radius: 11px;
    background: linear-gradient(180deg, #ffe18a, #d4a532);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28), inset 0 1px 1px rgba(255, 255, 255, .62);
    color: #172238;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
  }
  body.tv-broadcast-body > .topbar > nav .buy-tickets-link:hover,
  body.tv-broadcast-body > .topbar > nav .buy-tickets-link:focus-visible {
    border-color: #fff4cc;
    background: linear-gradient(180deg, #ffecb3, #e5bd55);
    outline: 2px solid #fff0b4;
    outline-offset: 2px;
    transform: translateY(-1px);
  }
}

@media (max-width: 600px) {
  .tv-auth-dialog { height: min(780px, calc(100dvh - 16px)); }
  .tv-auth-heading { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .tv-auth-heading > div:first-child { grid-column: 1; grid-row: 1; }
  .tv-auth-heading-actions { grid-column: 1; grid-row: 2; }
  .tv-auth-heading-actions button { height: 34px; padding: 0 14px; }
  .tv-auth-heading .tv-auth-close { grid-column: 2; grid-row: 1; width: 38px; height: 38px; flex-basis: 38px; }
  .tv-auth-heading h2 { font-size: 18px; }
  .tv-auth-heading p { font-size: 11px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .tv-auth-dialog { width: min(700px, 100%); height: calc(100dvh - 16px); }
  .tv-auth-heading { padding: 7px 10px; }
  .tv-auth-heading p { display: none; }
}
