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

:root {
  --bg: #0f1218;
  --panel: #1a1f2a;
  --panel-2: #232a38;
  --text: #e8ebf0;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --accent-hover: #3a76e8;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid #333c4e;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

button:hover {
  background: #2b3445;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-hover);
}

input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #333c4e;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ------------------------- lobby ------------------------- */

#lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.25rem;
  padding: 2rem;
}

#lobby h1 {
  font-size: 2.5rem;
  letter-spacing: 0.02em;
}

.tagline {
  color: var(--muted);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.lobby-actions .primary {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
}

.join-row {
  display: flex;
  gap: 0.5rem;
}

.join-row input {
  width: 10rem;
  text-align: center;
}

.error {
  color: #ff7676;
}

/* ------------------------- room ------------------------- */

#room {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.room-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
}

.room-info {
  color: var(--muted);
}

.room-info strong {
  color: var(--text);
  letter-spacing: 0.1em;
}

.room-info button {
  margin-left: 0.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.viewers {
  margin-left: auto;
  color: var(--muted);
}

/* ------------------------- player ------------------------- */

.player-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(10, 12, 16, 0.75);
  color: var(--muted);
  z-index: 2;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  z-index: 3;
}

.ctrl {
  background: none;
  border: none;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
}

.ctrl:hover {
  background: rgba(255, 255, 255, 0.12);
}

.time {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: center;
}

#seek-bar {
  flex: 1;
  accent-color: var(--accent);
}

#volume-bar {
  width: 90px;
  accent-color: var(--accent);
}

/* ------------------------- library ------------------------- */

.library {
  background: var(--panel);
  border-radius: 10px;
  padding: 1rem;
}

.library h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.upload-row input[type="file"] {
  color: var(--muted);
}

#upload-progress {
  flex: 1;
  min-width: 120px;
}

#video-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#video-list li {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  background: var(--panel-2);
}

#video-list li:hover {
  background: #2b3445;
}

#video-list li.active {
  outline: 2px solid var(--accent);
}

#video-list li.empty {
  cursor: default;
  color: var(--muted);
  background: none;
}

/* ------------------------- toast ------------------------- */

#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid #333c4e;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  z-index: 10;
}
