*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0f0f0f;
  --bg-surface: #1a1a1a;
  --bg-controls: rgba(0, 0, 0, 0.7);
  --text-primary: #e0e0e0;
  --text-muted: #888;
  --accent: #4a9eff;
  --accent-hover: #6bb3ff;
  --danger: #e04040;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: 100%;
  max-width: 1280px;
  padding: 1rem;
}

.stream-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.stream-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.stream-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s;
}

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

.stream-overlay .status-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stream-overlay .status-text {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.stream-overlay .status-text.error {
  color: var(--danger);
}

.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-controls);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.stream-container:hover .controls,
.stream-container:focus-within .controls {
  opacity: 1;
}

.controls button {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 4px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.controls button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.controls .volume-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.controls input[type="range"] {
  width: 80px;
  accent-color: var(--accent);
  cursor: pointer;
}

.controls .spacer {
  flex: 1;
}

.controls .live-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connect-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.connect-btn:hover {
  background: var(--accent-hover);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--text-muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Fullscreen */
.stream-container:fullscreen {
  border-radius: 0;
  max-width: none;
}

.stream-container:fullscreen .controls {
  opacity: 1;
}

.stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stream-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.stream-header .stream-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}
