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

:root {
  --bg: #212121;
  --surface: #2a2a2a;
  --surface-hover: #333;
  --border: #3a3a3a;
  --border-focus: #737373;
  --text: #ededed;
  --muted: #a3a3a3;
  --accent: #737373;
  --accent-glow: rgba(115, 115, 115, 0.3);
}

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

.hidden { display: none !important; }

/* ── Screens ── */
.screen-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* ── Auth ── */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.blob {
  position: absolute;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.blob-1 { top: -6rem; right: -6rem; background: rgba(115, 115, 115, 0.12); }
.blob-2 { bottom: -6rem; left: -6rem; background: rgba(100, 100, 100, 0.1); }

.auth-inner {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.auth-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #737373, #a3a3a3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 16px rgba(115, 115, 115, 0.3);
  margin-bottom: 0.5rem;
}

.auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.auth-error {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 0.8125rem;
  text-align: center;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form input {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input::placeholder { color: #737373; }
.auth-form input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(115, 115, 115, 0.2); }

/* ── Buttons ── */
.btn-primary {
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, #525252, #737373);
  border: none;
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(115, 115, 115, 0.2);
}
.btn-primary:hover { background: linear-gradient(135deg, #636363, #8a8a8a); }

.btn-secondary {
  padding: 0.7rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-focus); }

/* ── Landing ── */
.landing-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.landing-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
}

.landing-subtitle {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 340px;
}

.landing-actions .btn-primary { width: 100%; }

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

.join-row input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.9375rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  outline: none;
  transition: border-color 0.2s;
}
.join-row input::placeholder { color: #525252; letter-spacing: 0.05em; text-transform: none; }
.join-row input:focus { border-color: var(--border-focus); }

/* ── Room ── */
.room {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #1a1a1a;
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.625rem; }
.topbar-label { font-size: 0.8125rem; color: var(--muted); }

.room-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}
.room-code:hover { color: #fff; }

.toast {
  font-size: 0.6875rem;
  color: #4ade80;
  opacity: 0;
  transition: opacity 0.3s;
}

.peer-indicator { display: flex; align-items: center; gap: 0.375rem; }

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}
.dot-online { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.dot-offline { background: #ef4444; }

.leader-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  background: rgba(115, 115, 115, 0.3);
  border: 1px solid rgba(115, 115, 115, 0.4);
  border-radius: 0.375rem;
  color: #d4d4d4;
}

/* ── Video ── */
.video-area {
  flex: 1;
  position: relative;
  background: #0a0a0a;
  display: flex;
}

.url-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(10, 10, 10, 0.8);
}

.url-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 36rem;
  padding: 0 1rem;
}

.url-row input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
.url-row input::placeholder { color: #525252; }
.url-row input:focus { border-color: var(--border-focus); }

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
video::-webkit-media-controls { display: none !important; }

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: #1a1a1a;
  border-top: 1px solid var(--border);
}

.controls-left, .controls-right { display: flex; align-items: center; gap: 0.5rem; }
.controls-center { flex: 1; }

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: none;
  border: none;
  border-radius: 0.5rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.ctrl-btn:hover { background: var(--surface); }

.icon { width: 1.375rem; height: 1.375rem; }
.icon-sm { width: 1.125rem; height: 1.125rem; }
.muted { color: #525252; }

.time-display {
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap;
}

/* ── Range inputs ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.seek-bar { width: 100%; }
.volume-bar { width: 5rem; }

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: #3a3a3a;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #a3a3a3;
  border-radius: 50%;
  margin-top: -4.5px;
  transition: transform 0.1s, background 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  background: #d4d4d4;
}

input[type="range"]::-moz-range-track {
  height: 3px;
  background: #3a3a3a;
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #a3a3a3;
  border-radius: 50%;
  border: none;
}

/* ── Mic active ── */
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(115, 115, 115, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(115, 115, 115, 0); }
}

.mic-active {
  animation: pulse-mic 2s infinite;
  background: rgba(115, 115, 115, 0.15);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .controls { gap: 0.375rem; padding: 0.5rem; }
  .volume-bar { width: 3rem; }
}
