html {
  box-sizing: border-box;
  min-width: 280px;
  background: #090b10;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #f7f5f2;
  background:
    radial-gradient(circle at 12% 6%, rgba(216, 68, 72, 0.16), transparent 31rem),
    #090b10;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-card {
  width: 100%;
  max-width: 1120px;
  overflow: hidden;
  border: 1px solid #292d35;
  border-radius: 18px;
  background: #11141a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.player-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.player-heading {
  padding: 20px 24px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #e25256;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.connection-state {
  flex: 0 0 auto;
  color: #aeb4bf;
  font-size: 13px;
}

.video-stage {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  overflow: hidden;
  background: #000;
}

video {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.loading-indicator,
.error-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-indicator {
  gap: 12px;
  color: #d7dae0;
  background: #07090d;
  font-size: 14px;
  pointer-events: none;
}

.loading-indicator.is-hidden {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #414650;
  border-top-color: #e25256;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-panel {
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(7, 9, 13, 0.96);
}

.error-panel[hidden] {
  display: none;
}

.error-panel strong {
  font-size: 18px;
}

.error-panel span {
  max-width: 540px;
  color: #b8bec8;
  font-size: 14px;
  line-height: 1.5;
}

button {
  border: 1px solid #3a404b;
  border-radius: 9px;
  color: #f7f5f2;
  background: #1b1f27;
  font: inherit;
}

button {
  margin-top: 4px;
  padding: 9px 16px;
  cursor: pointer;
}

button:hover,
button:focus {
  border-color: #e25256;
  outline: none;
}

.quality-control {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  opacity: 1;
  transition: opacity 140ms ease;
}

.quality-control.is-idle {
  opacity: 0;
  pointer-events: none;
}

.quality-control:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.quality-control[hidden],
.quality-menu[hidden] {
  display: none;
}

.quality-button {
  min-width: 64px;
  margin: 0;
  padding: 7px 10px;
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(12, 14, 18, 0.88);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(5px);
}

.quality-button sup {
  margin-left: 4px;
  color: #ff777b;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.quality-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 176px;
  overflow: hidden;
  border: 1px solid #3a404b;
  border-radius: 9px;
  background: rgba(17, 20, 26, 0.97);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(7px);
}

.quality-option {
  display: flex;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 9px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 0;
  color: #f7f5f2;
  background: transparent;
  text-align: left;
}

.quality-option:hover,
.quality-option:focus {
  border-color: transparent;
  background: #272c35;
}

.quality-option[aria-selected="true"] {
  color: #ff777b;
}

.quality-option[aria-selected="true"]::before {
  content: "✓";
  width: 13px;
}

.quality-option:not([aria-selected="true"])::before {
  content: "";
  width: 13px;
}

.quality-option small {
  margin-left: auto;
  color: #aeb4bf;
  font-size: 11px;
  font-weight: 400;
}

@media (max-width: 620px) {
  .page-shell {
    min-height: auto;
    padding: 0;
  }

  .player-card {
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .player-heading {
    padding: 15px 16px 13px;
  }

  h1 {
    font-size: 18px;
  }

  .connection-state {
    display: none;
  }

  .quality-control {
    top: 9px;
    right: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}
