:root {
  color-scheme: dark;
  --background: #070a12;
  --card: rgba(18, 25, 43, 0.78);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f6f8ff;
  --muted: #9ca8c2;
  --primary: #6379ff;
  --primary-dark: #4963f2;
  --danger: #ff6475;
  --success: #53e6a5;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(83, 105, 255, 0.27),
      transparent 32rem
    ),
    radial-gradient(
      circle at 85% 85%,
      rgba(36, 191, 218, 0.18),
      transparent 30rem
    ),
    linear-gradient(145deg, #060810, #0c1222 55%, #070a12);
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.background-orb {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(4px);
}

.orb-one {
  width: 320px;
  height: 320px;
  left: -140px;
  top: -120px;
  background: rgba(91, 108, 255, 0.18);
}

.orb-two {
  width: 300px;
  height: 300px;
  right: -130px;
  bottom: -120px;
  background: rgba(40, 204, 223, 0.14);
}

.glass-card {
  border: 1px solid var(--border);
  background:
    linear-gradient(
      145deg,
      rgba(25, 34, 58, 0.88),
      rgba(12, 17, 31, 0.76)
    );
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.login-layout {
  width: min(100%, 440px);
}

.login-card {
  padding: 30px;
  border-radius: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: contain;
}

.brand-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 750;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.login-heading {
  margin: 34px 0 10px;
  font-size: clamp(2rem, 7vw, 2.55rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.login-description {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.65;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: #dfe5f6;
  font-size: 0.88rem;
  font-weight: 650;
}

.input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  min-height: 54px;
  padding: 0 52px 0 16px;
  color: var(--text);
  background: rgba(5, 8, 17, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.form-input:focus {
  border-color: rgba(111, 131, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(111, 131, 255, 0.16);
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 42px;
  height: 38px;
  padding: 0 8px;
  color: var(--muted);
  border: 0;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  color: white;
  border: 0;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 14px 34px rgba(79, 108, 255, 0.34);
  font-weight: 750;
  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button:active {
  transform: scale(0.985);
}

.form-message {
  display: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.form-message.show {
  display: block;
}

.form-message.error {
  color: #ffdce1;
  background: rgba(255, 94, 112, 0.13);
  border: 1px solid rgba(255, 94, 112, 0.25);
}

.form-message.success {
  color: #ccf9e5;
  background: rgba(83, 230, 165, 0.12);
  border: 1px solid rgba(83, 230, 165, 0.23);
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
}

@media (max-width: 520px) {
  .login-card {
    padding: 24px;
    border-radius: 25px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .login-heading {
    margin-top: 28px;
  }
}

/* =========================================================
   SPLAY MODERN VIEWER
   ========================================================= */

.viewer-page {
  min-height: 100vh;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.viewer-shell {
  width: min(100%, 1500px);
  margin: 0 auto;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 22px;
}

.viewer-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffbd59;
}

.live-badge.live {
  color: #d8ffed;
  background: rgba(83, 230, 165, 0.11);
  border-color: rgba(83, 230, 165, 0.25);
}

.live-badge.live .live-dot {
  background: #53e6a5;
  animation: splay-live-pulse 1.8s infinite;
}

.live-badge.offline {
  color: #ffdce1;
  background: rgba(255, 94, 112, 0.1);
  border-color: rgba(255, 94, 112, 0.23);
}

.live-badge.offline .live-dot {
  background: #ff5e70;
}

.logout-button,
.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.logout-button:hover,
.control-button:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
}

.logout-button:active,
.control-button:active {
  transform: scale(0.97);
}

.control-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.player-card {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
}

.player-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: min(72vh, 820px);
  overflow: hidden;
  background:
    radial-gradient(
      circle at center,
      rgba(75, 94, 160, 0.2),
      transparent 58%
    ),
    #03050a;
}

.live-video {
  display: block;
  width: 100%;
  height: min(72vh, 820px);
  object-fit: contain;
  background: #000;
}

.player-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

.player-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.status-panel {
  width: min(100%, 410px);
  padding: 30px;
  text-align: center;
  background: rgba(10, 15, 28, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.status-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  color: #cfd6ff;
  font-size: 1.65rem;
  background: rgba(111, 131, 255, 0.14);
  border: 1px solid rgba(111, 131, 255, 0.2);
  border-radius: 22px;
}

.status-title {
  margin: 0 0 9px;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.status-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.error-text {
  margin-top: 13px;
  color: #ffabb5;
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: break-word;
}

.audio-panel {
  display: none;
  width: min(100%, 600px);
  padding: 42px 28px;
  text-align: center;
}

.player-stage.audio-only .live-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.player-stage.audio-only .audio-panel {
  display: block;
}

.audio-icon {
  display: grid;
  place-items: center;
  width: 106px;
  height: 106px;
  margin: 0 auto 23px;
  font-size: 2.7rem;
  background:
    linear-gradient(
      145deg,
      rgba(111, 131, 255, 0.26),
      rgba(66, 214, 237, 0.14)
    );
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 33px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
}

.audio-panel h2 {
  margin: 0 0 9px;
  font-size: 1.6rem;
}

.audio-panel p {
  margin: 0;
  color: var(--muted);
}

.visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 68px;
  margin-top: 30px;
}

.visualizer span {
  width: 7px;
  height: 20%;
  border-radius: 999px;
  background: linear-gradient(to top, #6379ff, #42d6ed);
  animation: splay-bar 1.1s ease-in-out infinite alternate;
}

.visualizer span:nth-child(2) {
  animation-delay: -0.8s;
}

.visualizer span:nth-child(3) {
  animation-delay: -0.35s;
}

.visualizer span:nth-child(4) {
  animation-delay: -0.6s;
}

.visualizer span:nth-child(5) {
  animation-delay: -0.15s;
}

.visualizer span:nth-child(6) {
  animation-delay: -0.72s;
}

.visualizer span:nth-child(7) {
  animation-delay: -0.28s;
}

.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 15px;
  background: rgba(8, 12, 22, 0.93);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.stream-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.meta-item {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@keyframes splay-live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(83, 230, 165, 0.45);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(83, 230, 165, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(83, 230, 165, 0);
  }
}

@keyframes splay-bar {
  from {
    height: 15%;
    opacity: 0.45;
  }

  to {
    height: 100%;
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .viewer-page {
    padding:
      max(12px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .viewer-header {
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 19px;
  }

  .viewer-header .brand-subtitle {
    display: none;
  }

  .viewer-header .brand-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .viewer-header-actions {
    gap: 7px;
  }

  .logout-button {
    width: 40px;
    padding: 0;
  }

  .logout-button span {
    display: none;
  }

  .live-badge {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.7rem;
  }

  .player-card {
    border-radius: 22px;
  }

  .player-stage {
    min-height: 68vh;
  }

  .live-video {
    height: 68vh;
  }

  .status-panel {
    padding: 24px 20px;
  }

  .player-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .control-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-button {
    min-height: 44px;
    padding: 0 9px;
    font-size: 0.8rem;
  }

  .stream-meta {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 420px) {
  .viewer-header .brand-name {
    font-size: 0.98rem;
  }

  .live-badge {
    padding: 0 9px;
  }

  .player-stage {
    min-height: 64vh;
  }

  .live-video {
    height: 64vh;
  }
}

/* SPlay MediaMTX iframe player */

.splay-media-frame {
  display: block;
  width: 100%;
  height: min(76vh, 860px);
  min-height: 560px;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
}

.splay-frame-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 16px;
  color: var(--muted);
  background: rgba(8, 12, 22, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.splay-frame-footer strong {
  color: var(--text);
}

@media (max-width: 760px) {
  .splay-media-frame {
    height: 70vh;
    min-height: 480px;
  }

  .splay-frame-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .splay-frame-footer .control-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .splay-media-frame {
    height: 66vh;
    min-height: 420px;
  }
}
/* =========================================================
   SPLAY LARGE EXTERNAL PLAYER CONTROLS
   ========================================================= */

.splay-frame-shell {
  padding: 16px;
}

.splay-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.big-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  color: var(--text);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    filter 160ms ease;
}

.big-action-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.big-action-button:active {
  transform: scale(0.98);
}

.big-action-button.primary {
  background: linear-gradient(135deg, #6379ff, #4963f2);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 14px 34px rgba(79, 108, 255, 0.28);
}

.big-action-button.primary:hover {
  filter: brightness(1.08);
}

.audio-state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.audio-state-pill.ok {
  color: #d8ffed;
  background: rgba(83, 230, 165, 0.11);
  border-color: rgba(83, 230, 165, 0.22);
}

.audio-state-pill.muted {
  color: #ffdce1;
  background: rgba(255, 94, 112, 0.1);
  border-color: rgba(255, 94, 112, 0.22);
}

.splay-frame-wrap {
  overflow: hidden;
  border-radius: 24px;
  background: #000;
}

.splay-media-frame {
  display: block;
  width: 100%;
  height: min(74vh, 840px);
  min-height: 540px;
  border: 0;
  background: #000;
}

.splay-frame-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  margin-top: 14px;
  padding: 12px 16px;
  color: var(--muted);
  background: rgba(8, 12, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
}

.splay-frame-footer strong {
  color: var(--text);
}

.footer-note {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

@media (max-width: 760px) {
  .splay-frame-shell {
    padding: 12px;
  }

  .splay-action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .audio-state-pill {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .big-action-button {
    min-height: 46px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  .splay-media-frame {
    height: 70vh;
    min-height: 460px;
  }

  .splay-frame-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-note {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .splay-action-bar {
    grid-template-columns: 1fr;
  }

  .splay-media-frame {
    height: 66vh;
    min-height: 420px;
  }
}
