body {
  margin: 0;
  font-family: "Fira Code", sans-serif;
  background-color: black;
  color: white;
  text-align: center;
}

#screen {
  display: flex;
  height: 90vh;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  justify-content: center;
  z-index: 999;
  position: relative;
}

#content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: none; /* Hidden by default until content is loaded */
}

#content.active {
  display: block;
}

#content video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video.js customization - no controls */
#content .video-js {
  width: 100%;
  height: 100%;
}

/* Hide all video.js controls since we use custom overlay */
#content .video-js .vjs-control-bar {
  display: none;
}

/* Hide the big play button since we autoplay */
#content .video-js .vjs-big-play-button {
  display: none;
}

/* Optimize for performance */
#content .video-js video {
  will-change: transform;
}

/* Persistent overlay controls */
#overlay-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  gap: 10px;
  transition: opacity 0.3s ease;
}

#overlay-controls.hidden {
  opacity: 0;
}

.overlay-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.overlay-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.overlay-button:active {
  transform: scale(0.95);
}

/* TV remote focus indicator */
.overlay-button.tv-focused {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
  border-width: 3px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  transform: scale(1.15);
}

.overlay-button svg {
  width: 24px;
  height: 24px;
}

/* Media download progress overlay */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 1);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(50px);
  transform-origin: center center;
  animation: progressEnter 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.progress-container {
  text-align: center;
  min-width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-text {
  color: white;
  font-size: calc(4vmin + 20px);
  font-weight: 500;
  margin-top: 20px;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(30px);
  animation: progressTextEnter .8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s forwards;
}

.progress-bar-container {
  width: 70vw;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #FA6841, #ff8c42);
  border-radius: 10px;
  width: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(250, 104, 65, 0.5);
  min-width: 2px;
}

.progress-percentage {
  color: #FA6841;
  font-size: 14px;
}

/* Progress bar animations */
@keyframes progressEnter {
  0% {
    opacity: 0;
    transform: translateY(50px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressTextEnter {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressExit {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(calc(-100vh - 100px));
  }
}

@keyframes progressTextExit {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(calc(-100vh + 40vh));
  }
}

/* Exit animation services */
.progress-overlay.exiting {
  animation: progressExit .8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.progress-overlay.exiting .progress-text {
  animation: progressTextExit .8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

#screen-code {
  font-size: 10vw;
  color: #FA6841;
}

#progress-container {
  width: 300px;
  height: 10px;
  background-color: #333;
  border-radius: 5px;
  margin-top: 20px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background-color: #FA6841;
  width: 100%;
  transition: width 0.1s ease;
  border-radius: 5px;
}

#button-wrapper, .signals-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  vertical-align: middle;
  column-gap: 15px;
}

.button {
  z-index: 1001;
  position: relative;
}

.signal-light{
  padding: 11px 10px 10px 10px;
  color: grey;
  border: 1px solid grey;
  background: none;
  border-radius: 5px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* A simple spinner */
.loading-spinner::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

