:root {
  --bg: #071633;
  --panel: #102a56;
  --line: rgba(176, 208, 255, 0.22);
  --text: #f4f8ff;
  --muted: #a9bdd8;
  --accent: #4c9dff;
  --danger: #ff6d82;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(76, 157, 255, 0.28), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}
body { display: grid; place-items: center; padding: 16px; }
.shell {
  width: min(960px, 100%);
  background: linear-gradient(180deg, #18407a, #102a56);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(4, 12, 32, 0.45);
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.04em; }
.meta { color: var(--muted); font-size: 13px; }
#stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}
video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}
#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
#spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#error {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 72px;
  background: rgba(40, 8, 16, 0.88);
  border: 1px solid rgba(255, 109, 130, 0.45);
  color: #ffd7de;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px 16px;
}
button, select {
  appearance: none;
  border: 1px solid var(--line);
  background: #1a4580;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
button:active { filter: brightness(1.08); }
#volume { width: min(140px, 30vw); }
#quality { min-width: 120px; }
#status { margin-left: auto; color: var(--muted); font-size: 13px; }

@media (max-width: 640px) {
  body { padding: 0; }
  .shell { border-radius: 0; min-height: 100vh; }
  #status { width: 100%; margin-left: 0; }
}
