:root {
  color-scheme: dark;
}

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

body {
  overflow: hidden;
  display: block;
  background: #0f172a;
  color: #e2e8f0;
  font-family: Arial, sans-serif;
}

.player-shell {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #020617;
}

.video-js {
  width: 100% !important;
  height: 100% !important;
}

.video-js .vjs-tech {
  object-fit: contain;
}

.player-loading .video-js {
  visibility: hidden;
}

.viewer-count-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.viewer-count-badge[hidden] {
  display: none;
}

.debug-info-box {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  min-width: 116px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  white-space: nowrap;
}

.debug-info-box[hidden] {
  display: none;
}

.player-message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  max-width: min(520px, calc(100% - 48px));
  padding: 12px 16px;
  text-align: center;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.68);
  color: #f8fafc;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}

.player-message[hidden] {
  display: none;
}

/* Match WordPress plugin big play (wpstream_style.css + optional videojs-wpstream.css) */
.player-shell .video-js .vjs-big-play-button {
  line-height: 90px !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  margin-left: -45px;
  margin-top: -45px;
  border: 2px solid #494848 !important;
  font-size: 57px !important;
  border-radius: 50% !important;
  background-color: #2b333f !important;
  width: 1.63332em;
}

.player-shell .video-js .vjs-big-play-button .vjs-icon-placeholder:before {
  left: 2px;
}

.player-shell .video-js .vjs-big-play-button .vjs-control-text {
  width: max-content !important;
}

.player-shell .video-js .vjs-big-play-button .vjs-icon-placeholder {
  opacity: 0.8;
  transition: 0.3s ease-out;
}

.player-shell .video-js .vjs-big-play-button:focus .vjs-icon-placeholder,
.player-shell .video-js:hover .vjs-icon-placeholder {
  opacity: 1;
}

/* Hide centered big-play while muted autoplay is still starting (player.js removes class after `playing`). */
.player-shell .video-js.vjs-wpstream-autoplay-pending .vjs-big-play-button {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Hide Video.js internal spinner while blocked/off-air overlay message is shown. */
.player-shell .video-js.vjs-wpstream-hide-spinner .vjs-loading-spinner {
  display: none !important;
}

/* Show Video.js spinner while waiting for host i18n before blocked/off-air text. */
.player-shell .video-js.vjs-wpstream-force-spinner .vjs-loading-spinner {
    display: flex !important;
    justify-content: center;
    align-items: center;
    animation: vjs-spinner-show 0s linear 0.3s forwards;
}

.player-shell .video-js.vjs-wpstream-force-spinner .vjs-loading-spinner:before,
.player-shell .video-js.vjs-wpstream-force-spinner .vjs-loading-spinner:after {
    animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite,
    vjs-spinner-fade 1.1s linear infinite;
}

.player-shell .video-js.vjs-wpstream-force-spinner .vjs-loading-spinner:after {
    animation-delay: 0.44s;
}

/* Same as plugin `videojs-wpstream.css` when player root has .vjs-wpstream (narrower border) */
.player-shell .video-js.vjs-wpstream .vjs-big-play-button {
  border: 0.06666em solid #595656;
}

/* Overwrite some styling for different player skins */
/* Root-relative: player server only exposes /static/<file> from public/static/ */
.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before {
    content: "";
    background-repeat: no-repeat;
    background-image: url('pip_player.svg');
    background-position: center;
    background-size: 39%;
}
.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,
.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before {
    content: "";
}
.video-js .vjs-fullscreen-control {
    content: "";
    background-repeat: no-repeat;
    background-image: url('fullscreen_simple.svg');
    background-position: center;
    background-size: 39%;
}
.video-js.vjs-fullscreen .vjs-fullscreen-control {
    content: "";
    background-image: url('fullscreen_full.svg');
}
.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before {
    content: "";
}

/* City skin */
.video-js.vjs-theme-city .vjs-picture-in-picture-control .vjs-icon-placeholder:before {
    background-size: 13%;
}

/* Sea skin */
.video-js.vjs-theme-sea .vjs-picture-in-picture-control {
    display: block;
}
.video-js.vjs-theme-sea .vjs-big-play-button {
    height: 1.63332em;
}

/* Forest skin */
.video-js.vjs-theme-forest .vjs-big-play-button {
    background: none;
    color: white;
}
.video-js.vjs-theme-forest .vjs-big-play-button .vjs-icon-placeholder {
    display: inline;
}
.video-js.vjs-theme-forest .vjs-big-play-button .vjs-icon-placeholder:before {
    content: "\f101";
}
.video-js.vjs-theme-forest:hover .vjs-big-play-button {
    background: none;
}

/* Fantasy skin */
.video-js.vjs-theme-fantasy .vjs-big-play-button {
    height: 1.63332em;
    color: white;
}

/* Quality selector icon */
.vjs-icon-placeholder::before {
    font-family: 'VideoJS', serif;
    content: "\f114";
}
.vjs-wpstream-quality .vjs-wpstream-quality-item:hover {
    background-color: rgb(92 94 93) !important;
    color: white !important;
}
/* Cast button (wpstream-cast.js); overrides the global icon glyph above */
.video-js .vjs-wpstream-cast .vjs-icon-placeholder::before {
    content: none;
}
.video-js .vjs-wpstream-cast .vjs-icon-placeholder svg {
    width: 1.6em;
    height: 1.6em;
    vertical-align: middle;
}

/* While casting the local player sits paused; the overlay drives the cast device */
.video-js.vjs-wpstream-casting .vjs-control-bar,
.video-js.vjs-wpstream-casting .vjs-big-play-button,
.video-js.vjs-wpstream-casting .vjs-loading-spinner,
.video-js.vjs-wpstream-casting .vjs-logo-content {
    display: none !important;
}
.wpstream-cast-overlay {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.78);
    color: #f8fafc;
    font-size: 14px;
    text-align: center;
}
.wpstream-cast-overlay[hidden] {
    display: none;
}
.wpstream-cast-overlay-label {
    margin-bottom: 8px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wpstream-cast-overlay-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.wpstream-cast-overlay button {
    padding: 6px 12px;
    border: 1px solid rgba(248, 250, 252, 0.4);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.wpstream-cast-overlay button:hover {
    background: rgba(248, 250, 252, 0.12);
}
