* {
  box-sizing: border-box;
}

:root {
  --panel: rgba(6, 25, 21, 0.78);
  --panel-border: rgba(148, 163, 184, 0.22);
  --panel-border-soft: rgba(148, 163, 184, 0.2);
  --focus-ring: rgba(96, 165, 250, 0.9);
  --text: #e2e8f0;
  --shadow: 0 22px 50px rgba(2, 6, 23, 0.45);
  --live: #f43f5e;
  --radius-lg: 10px;
  --panel-padding: 18px;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, rgba(2, 10, 8, 0.0), rgba(2, 10, 8, 0.0)), var(--page-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 1430px;
  margin: 0 auto;
  padding: clamp(18px, 2.2vw, 28px);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.layout {
  width: 100%;
}

.player-panel {
  width: 70vw;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--panel-padding);
}

.video-shell {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #000;
  border: 1px solid var(--panel-border-soft);
  position: relative;
}

.video-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2, 6, 23, 0.92);
  text-align: center;
  padding: 16px;
}

.video-fallback[hidden] {
  display: none;
}

.video-fallback-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
}

.video-fallback-image[hidden] {
  display: none;
}

.video-fallback-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  color: #f8fafc;
  font-size: clamp(1.2rem, 2.0vw, 1.6rem);
  font-weight: 600;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.38);
}

.meta-row {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.player-status-row {
  flex-shrink: 0;
}

.stream-title {
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  height: 20px;
  padding: 0 7px;
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.03em;
  font-weight: 550;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(248, 250, 252, 0.16);
  box-shadow: 0 1px 4px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(1.5px);
  color: inherit;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
}

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

button.status-badge {
  font-family: inherit;
}

#statusText {
  display: block;
  line-height: 1;
  position: relative;
  top: 0.2px;
}

button.status-badge:not(:disabled) {
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, opacity 140ms ease;
}

button.status-badge:not(:disabled):hover {
  border-color: rgba(248, 250, 252, 0.3);
  background: rgba(15, 23, 42, 0.56);
}

button.status-badge:disabled {
  opacity: 0.7;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-badge.is-live .status-dot {
  background: var(--live);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.14);
}

.status-badge.is-live {
  color: #ffdbe3;
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.06);
}

#video:focus-visible,
.status-badge:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.powered-by {
  position: fixed;
  right: 14px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #ffffff;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

.powered-by img {
  display: block;
  width: 42px;
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55));
}

@media (max-width: 640px) {
  :root {
    --panel-padding: 12px;
  }

  .app {
    padding: 14px;
  }
}
