:root {
  --page-bg: #050608;
  --stage-bg: #000000;

  --footer-bg: #181b20;
  --card-bg: #242830;
  --card-bg-strong: #2b3039;

  --text: #ffffff;
  --muted: #c8cdd5;
  --subtle: #969da8;

  --border: rgba(255, 255, 255, 0.22);
  --border-strong: rgba(255, 255, 255, 0.34);
  --highlight: rgba(255, 255, 255, 0.08);

  --shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    0 2px 8px rgba(0, 0, 0, 0.35);

  --gap: 14px;
  --radius: 12px;
  --footer-height: 158px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

/*
 * Main layout
 */

.broadcast {
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--footer-height);
  width: 100vw;
  height: 100vh;
  padding: var(--gap);
  gap: var(--gap);
  background: var(--page-bg);
}

.main-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#mainVideo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

/*
 * Logo
 */

.station-logo {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 18px;
  pointer-events: none;
}

.station-logo img {
  display: block;
  width: auto;
  height: 58px;
  max-width: min(340px, 32vw);
  object-fit: contain;
  filter:
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.85))
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

/*
 * Loading and empty state
 */

.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(
      circle at center,
      #181b20 0%,
      #08090b 72%
    );
  color: var(--muted);
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 700;
  text-align: center;
}

.is-hidden {
  display: none !important;
}

/*
 * Footer layout
 *
 * Now Playing is widest.
 * Global Pulse and Tech News have equal width.
 * Clock is wider than the old design.
 */

.lower-third {
  display: grid;
  grid-template-columns:
    minmax(240px, 0.95fr)
    minmax(360px, 1.35fr)
    minmax(280px, 1fr)
    minmax(190px, 0.72fr);
  gap: var(--gap);
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  background: var(--footer-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 -3px 14px rgba(0, 0, 0, 0.2),
    var(--shadow);
}

/*
 * Shared footer-card styling
 */

.now-box,
.pulse,
.news-card,
.clock {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px;
  background:
    linear-gradient(
      180deg,
      var(--card-bg-strong) 0%,
      var(--card-bg) 100%
    );
  border: 1px solid var(--border);
  border-top-color: var(--border-strong);
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 6px 16px rgba(0, 0, 0, 0.24);
}

/*
 * Labels
 */

.label,
.eyebrow,
.pulse-label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.label::after,
.eyebrow::after,
.pulse-label::after {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

/*
 * Now Playing
 */

.now-box {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.now-box .label {
  margin-bottom: 10px;
}

#nowPlaying {
  display: block;
  min-width: 0;
  overflow: hidden;
}

#nowPlaying .now-title,
#nowPlaying > span:first-child {
  display: box;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(20px, 1.45vw, 27px);
  font-weight: 900;
  line-height: 1.08;
  line-clamp: 2;
}

#nowPlaying small {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(11px, 0.75vw, 14px);
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#nowPlaying .now-detail {
  color: var(--muted);
}

#nowPlaying .now-meta {
  color: var(--subtle);
}

.now-type {
  margin-top: 8px;
  overflow: hidden;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 380ms ease,
    transform 380ms ease;
}

.now-type span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-type span + span {
  margin-top: 4px;
  color: var(--muted);
}

.now-type.is-changing {
  opacity: 0;
  transform: translateY(20px);
}

/*
 * Global Pulse
 */

.pulse {
  display: block;
}

.pulse-content {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.pulse-slide {
  width: 100%;
  animation: pulse-slide-in 500ms ease-out;
}

.pulse-slide.is-leaving {
  animation: pulse-slide-out 380ms ease-in forwards;
}

.pulse-card {
  width: 100%;
  min-width: 0;
}

.pulse-title {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(18px, 1.25vw, 23px);
  font-weight: 900;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-card .value {
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(20px, 1.6vw, 29px);
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-body {
  width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(13px, 0.9vw, 17px);
  font-weight: 550;
  line-height: 1.25;
  white-space: nowrap;
}

.pulse-body-text {
  display: inline-block;
  min-width: max-content;
  white-space: nowrap;
}

.pulse-body-text.is-scrolling {
  animation:
    pulse-body-scroll
    var(--pulse-scroll-duration)
    linear
    infinite;
}

@keyframes pulse-body-scroll {
  0%,
  25% {
    transform: translateX(0);
  }

  90%,
  100% {
    transform:
      translateX(
        calc(-1 * var(--pulse-scroll-distance))
      );
  }
}

/*
 * Tech News
 */

.news-card {
  display: flex;
  flex-direction: column;
}

.news-content {
  min-width: 0;
  animation: news-slide-in 500ms ease-out;
}

.news-content.is-leaving {
  animation: news-slide-out 380ms ease-in forwards;
}

.news-card h2 {
  display: box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(18px, 1.25vw, 23px);
  font-weight: 900;
  line-height: 1.12;
  line-clamp: 2;
}

.news-card p {
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(12px, 0.82vw, 15px);
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * Clock
 */

.clock,
#clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
}

.clock-day {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(15px, 1vw, 19px);
  font-weight: 750;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.clock-date {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(14px, 0.9vw, 17px);
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock-time {
  margin-top: 9px;
  color: var(--text);
  font-size: clamp(38px, 2.8vw, 52px);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

/*
 * Transitions
 */

@keyframes news-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes news-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(22px);
  }
}

@keyframes pulse-slide-in {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/*
 * Large desktop and projector
 */

@media (min-width: 1600px) {
  :root {
    --gap: 16px;
    --footer-height: 172px;
  }

  .lower-third {
    padding: 14px;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    padding: 18px 20px;
  }

  .station-logo img {
    height: 66px;
  }
}

/*
 * Medium desktop and laptops
 */

@media (max-width: 1200px) {
  :root {
    --gap: 10px;
    --footer-height: 142px;
  }

  .broadcast {
    padding: 10px;
  }

  .lower-third {
    grid-template-columns:
      minmax(190px, 0.95fr)
      minmax(270px, 1.3fr)
      minmax(215px, 1fr)
      minmax(155px, 0.7fr);
    padding: 9px;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    padding: 13px 14px;
  }

  .station-logo {
    top: 13px;
    left: 13px;
  }

  .station-logo img {
    height: 48px;
  }
}

/*
 * Mobile and tablet landscape
 *
 * Keep one horizontal footer row, but compress its height and typography.
 */

@media (orientation: landscape) and (max-height: 650px) {
  :root {
    --gap: 6px;
    --footer-height: 108px;
    --radius: 8px;
  }

  .broadcast {
    padding: 6px;
  }

  .lower-third {
    grid-template-columns:
      minmax(180px, 1.25fr)
      minmax(170px, 1fr)
      minmax(170px, 1fr)
      minmax(118px, 0.7fr);
    gap: 6px;
    padding: 6px;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    padding: 8px 10px;
    border-radius: 6px;
  }

  .label,
  .eyebrow,
  .pulse-label {
    margin-bottom: 5px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .label::after,
  .eyebrow::after,
  .pulse-label::after {
    width: 28px;
    height: 2px;
    margin-top: 4px;
  }

  #nowPlaying .now-title,
  #nowPlaying > span:first-child {
    font-size: 17px;
  }

  #nowPlaying small {
    margin-top: 2px;
    font-size: 10px;
  }

  .now-type {
    margin-top: 4px;
    font-size: 8px;
  }

  .pulse-title,
  .news-card h2 {
    font-size: 15px;
  }

  .pulse-card .value {
    margin-top: 3px;
    font-size: 18px;
  }

  .pulse-body,
  .news-card p {
    margin-top: 4px;
    font-size: 10px;
    line-height: 1.15;
  }

  .clock-day {
    font-size: 10px;
  }

  .clock-date {
    margin-top: 3px;
    font-size: 9px;
  }

  .clock-time {
    margin-top: 4px;
    font-size: 25px;
  }

  .station-logo {
    top: 8px;
    left: 8px;
  }

  .station-logo img {
    height: 36px;
    max-width: 28vw;
  }
}

/*
 * Mobile landscape with very narrow width
 */

@media (
  orientation: landscape
) and (
  max-width: 820px
) and (
  max-height: 500px
) {
  :root {
    --footer-height: 98px;
  }

  .lower-third {
    grid-template-columns:
      minmax(150px, 1.25fr)
      minmax(140px, 1fr)
      minmax(140px, 1fr)
      minmax(100px, 0.7fr);
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    padding: 7px 8px;
  }

  #nowPlaying .now-title,
  #nowPlaying > span:first-child {
    font-size: 15px;
  }

  .pulse-title,
  .news-card h2 {
    font-size: 13px;
  }

  .clock-time {
    font-size: 22px;
  }
}

/*
 * Tablet portrait and larger phones
 */

@media (orientation: portrait) and (max-width: 900px) {
  html,
  body {
    overflow: auto;
  }

  body {
    min-height: 100%;
  }

  .broadcast {
    grid-template-rows: minmax(46vh, 62vh) auto;
    width: 100%;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .lower-third {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "now clock"
      "pulse news";
    overflow: visible;
  }

  .now-box {
    grid-area: now;
  }

  .pulse {
    grid-area: pulse;
  }

  .news-card {
    grid-area: news;
  }

  .clock {
    grid-area: clock;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    min-height: 132px;
  }

  .station-logo img {
    height: 44px;
    max-width: 46vw;
  }
}

/*
 * Narrow phone portrait
 */

@media (orientation: portrait) and (max-width: 520px) {
  :root {
    --gap: 8px;
  }

  .broadcast {
    grid-template-rows: minmax(42vh, 54vh) auto;
    padding: 8px;
  }

  .lower-third {
    grid-template-columns: 1fr;
    grid-template-areas:
      "now"
      "clock"
      "pulse"
      "news";
    gap: 8px;
    padding: 8px;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    min-height: 116px;
    padding: 14px 16px;
  }

  #nowPlaying .now-title,
  #nowPlaying > span:first-child {
    white-space: normal;
  }

  #nowPlaying small,
  .pulse-title,
  .pulse-card .value,
  .news-card p {
    white-space: normal;
  }

  .news-card h2 {
    -webkit-line-clamp: 3;
  }

  .clock-time {
    font-size: 38px;
  }

  .station-logo {
    top: 10px;
    left: 10px;
  }

  .station-logo img {
    height: 38px;
    max-width: 58vw;
  }
}

/*
 * Very small portrait phones
 */

@media (orientation: portrait) and (max-width: 380px) {
  .broadcast {
    grid-template-rows: minmax(38vh, 48vh) auto;
  }

  .now-box,
  .pulse,
  .news-card,
  .clock {
    min-height: 108px;
    padding: 12px 13px;
  }

  .label,
  .eyebrow,
  .pulse-label {
    font-size: 10px;
  }

  #nowPlaying .now-title,
  #nowPlaying > span:first-child {
    font-size: 20px;
  }

  .pulse-title,
  .news-card h2 {
    font-size: 18px;
  }
}

/*
 * Reduced motion
 */

@media (prefers-reduced-motion: reduce) {
  .news-content,
  .news-content.is-leaving,
  .pulse-slide,
  .pulse-slide.is-leaving {
    animation: none;
  }
}