:root {
  --bg: #0a0e1a;
  --card: #0d1321;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #818cf8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --muted: #94a3b8;
  --text: #f1f5f9;
  --text-dim: #cbd5e1;
  --border: rgba(148, 163, 184, 0.12);
  --glow: rgba(99, 102, 241, 0.4);
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

body.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.15), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.12), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(10, 14, 26, 0.98), rgba(6, 9, 18, 1));
  position: relative;
  overflow: hidden;
}

/* Planet Design for Login */
body.page-login {
  background: radial-gradient(circle at 10% 15%, rgba(79, 70, 229, 0.25), transparent 55%),
              radial-gradient(circle at 85% 10%, rgba(168, 85, 247, 0.35), transparent 60%),
              linear-gradient(180deg, #05060f 0%, #0a0b18 45%, #070711 100%);
  color: #e7ecff;
}

body.page-register {
  background: radial-gradient(circle at 18% 20%, rgba(59, 130, 246, 0.25), transparent 58%),
              radial-gradient(circle at 82% 12%, rgba(147, 197, 253, 0.22), transparent 64%),
              linear-gradient(180deg, #05060f 0%, #0a0b18 48%, #050513 100%);
  color: #e9edff;
}

body.page-join {
  background: radial-gradient(circle at 22% 18%, rgba(167, 139, 250, 0.2), transparent 60%),
              radial-gradient(circle at 78% 82%, rgba(59, 130, 246, 0.18), transparent 62%),
              linear-gradient(180deg, #05060f 0%, #0a0e1a 45%, #04040f 100%);
  color: var(--text);
}

#spaceCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.planet-container {
  position: absolute;
  top: -25%;
  right: -18%;
  width: 760px;
  height: 760px;
  z-index: 1;
  pointer-events: none;
  animation: floatPlanet 20s ease-in-out infinite;
}

@keyframes floatPlanet {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-20px, 15px) rotate(2deg); }
  50% { transform: translate(-10px, -10px) rotate(-1deg); }
  75% { transform: translate(15px, 5px) rotate(1deg); }
}

.planet {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85) 0%, rgba(206, 180, 255, 0.75) 12%, transparent 42%),
    radial-gradient(circle at 40% 32%, rgba(236, 233, 255, 0.4) 0%, transparent 55%),
    radial-gradient(circle at 30% 35%, #c084fc 0%, #8b5cf6 32%, #5b21b6 65%, rgba(37, 21, 78, 0.95) 100%);
  box-shadow:
    inset -60px -80px 120px rgba(15, 10, 40, 0.85),
    inset 30px 25px 80px rgba(210, 195, 255, 0.45),
    0 0 180px rgba(91, 33, 182, 0.55),
    0 0 260px rgba(99, 102, 241, 0.35);
  animation: rotatePlanet 60s linear infinite;
  overflow: hidden;
}

.planet::before {
  content: '';
  position: absolute;
  top: -35%;
  left: -40%;
  width: 190%;
  height: 190%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.45) 0%, transparent 40%),
    radial-gradient(circle at 60% 55%, rgba(236, 72, 153, 0.32) 0%, transparent 28%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18) 0%, transparent 45%);
  animation: shimmer 15s ease-in-out infinite;
}

@keyframes rotatePlanet {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.05); }
}

.planet-glow {
  position: absolute;
  width: 135%;
  height: 135%;
  top: -17%;
  left: -17%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(182, 148, 255, 0.55) 0%, rgba(124, 58, 237, 0.28) 45%, transparent 72%);
  filter: blur(55px);
  animation: pulse 8s ease-in-out infinite;
}

.login-card {
  z-index: 10;
  max-width: 440px;
  padding: 48px 40px;
  background: linear-gradient(180deg, rgba(14, 18, 33, 0.92) 0%, rgba(9, 12, 24, 0.94) 100%) !important;
  -webkit-backdrop-filter: blur(26px) !important;
  backdrop-filter: blur(26px) !important;
  border: 1px solid rgba(167, 139, 250, 0.22) !important;
  box-shadow: 
    0 18px 70px rgba(10, 11, 40, 0.65),
    0 0 0 1px rgba(167, 139, 250, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  border-radius: 28px !important;
}

.login-card h1 {
  font-size: 32px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 8px;
  background: none !important;
  -webkit-text-fill-color: #f8fafc !important;
  text-align: left;
}

.auth-tagline {
  color: rgba(203, 213, 225, 0.7);
  font-size: 14px;
  margin-bottom: 32px;
  text-align: left;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(203, 213, 225, 0.9);
  margin-bottom: 8px;
  text-align: left;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  background: rgba(201, 221, 255, 0.22);
  border: 1px solid rgba(134, 181, 255, 0.45);
  border-radius: 10px;
  color: #edf2ff;
  font-size: 15px;
  transition: all 0.35s ease;
  margin: 0;
  box-shadow: inset 0 0 0 1px rgba(134, 181, 255, 0.08);
}

.input-group input:focus {
  background: rgba(213, 229, 255, 0.32);
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.14);
  outline: none;
}

.input-group input::placeholder {
  color: rgba(199, 210, 254, 0.5);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 70px;
}

.show-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: rgba(167, 139, 250, 0.8);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s ease;
}

.show-password:hover {
  color: #a78bfa;
}

.forgot-link {
  display: block;
  text-align: left;
  color: rgba(167, 139, 250, 0.9);
  font-size: 13px;
  font-weight: 500;
  margin: -8px 0 24px 0;
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-link:hover {
  color: #c4b5fd;
}

.btn-signin {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-signin:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.btn-signin:active {
  transform: translateY(0);
}

.divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: rgba(148, 163, 184, 0.15);
}

.divider span {
  position: relative;
  background: rgba(16, 18, 28, 0.85);
  padding: 0 12px;
  color: rgba(148, 163, 184, 0.6);
  font-size: 13px;
}

.btn-apple {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(196, 210, 255, 0.18), rgba(148, 187, 255, 0.12));
  border: 1px solid rgba(148, 181, 255, 0.3);
  border-radius: 10px;
  color: #e2e8ff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 0 0 1px rgba(148, 181, 255, 0.08), 0 10px 30px rgba(76, 29, 149, 0.18);
}

.btn-apple:hover {
  background: linear-gradient(135deg, rgba(213, 229, 255, 0.28), rgba(163, 200, 255, 0.18));
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.12), 0 12px 34px rgba(76, 29, 149, 0.28);
}

.signup-prompt {
  margin-top: 28px;
  text-align: center;
  color: rgba(148, 163, 184, 0.7);
  font-size: 13px;
}

.signup-link {
  color: #a78bfa;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.signup-link:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

.auth-bg {
  position: absolute;
  inset: -50% -30% -50% -30%;
  pointer-events: none;
  filter: blur(110px);
  opacity: 0.75;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(5deg); }
  66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

.auth-bg .blur-circle {
  position: absolute;
  width: clamp(380px, 42vw, 580px);
  height: clamp(380px, 42vw, 580px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.25));
  mix-blend-mode: screen;
  animation: pulse 8s ease-in-out infinite alternate;
}

@keyframes pulse {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0.85; transform: scale(1.08); }
}

.auth-bg .blur-circle:nth-child(1) {
  top: -12%;
  left: 8%;
}

.auth-bg .blur-circle:nth-child(2) {
  bottom: -20%;
  right: 10%;
  background: radial-gradient(circle at 65% 35%, rgba(139, 92, 246, 0.45), rgba(59, 130, 246, 0.22));
  animation-delay: 2s;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(440px, 94vw);
  padding: 42px 36px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: linear-gradient(145deg, rgba(13, 19, 33, 0.92), rgba(20, 28, 46, 0.88));
  box-shadow: 
    0 50px 100px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 60px 120px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(99, 102, 241, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-card h1 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 28px;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: rgba(13, 19, 33, 0.65);
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.auth-card label::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-card label:hover,
.auth-card label:focus-within {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(13, 19, 33, 0.8);
  box-shadow: 
    0 0 0 4px rgba(99, 102, 241, 0.08),
    0 10px 30px rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}

.auth-card label:focus-within::before {
  opacity: 1;
}

.auth-card label span,
.auth-card label strong {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(203, 213, 225, 0.75);
}

.auth-card input {
  background: transparent;
  border: 0;
  padding: 4px 0 0;
  font-size: 17px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.auth-card input::placeholder {
  color: rgba(148, 163, 184, 0.4);
  font-weight: 500;
}

.auth-card input:focus {
  outline: none;
}

.auth-card .actions,
.auth-card .actions-inline {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.auth-card .actions button,
.auth-card .actions .btn-secondary,
.auth-card button[type="submit"] {
  width: 100%;
  font-size: 15px;
  padding: 15px 22px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: 0;
  box-shadow: 
    0 4px 14px rgba(99, 102, 241, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.auth-card .actions button::before,
.auth-card button[type="submit"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.auth-card .actions button:hover::before,
.auth-card button[type="submit"]:hover::before {
  width: 300px;
  height: 300px;
}

.auth-card .actions button:hover,
.auth-card button[type="submit"]:hover {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 
    0 6px 20px rgba(99, 102, 241, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.auth-card .actions button:active,
.auth-card button[type="submit"]:active {
  transform: translateY(0);
}

.auth-card .actions .btn-secondary {
  background: transparent;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  color: var(--text-dim);
  box-shadow: none;
}

.auth-card .actions .btn-secondary:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: var(--text);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 
    0 0 0 3px rgba(99, 102, 241, 0.08),
    0 4px 12px rgba(99, 102, 241, 0.15);
}

.auth-card .meta {
  margin-top: 28px;
  font-size: 13px;
  text-align: center;
  color: rgba(148, 163, 184, 0.65);
  line-height: 1.6;
}

.auth-card .meta a {
  color: var(--accent-light);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-card .meta a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.auth-subtitle {
  text-align: center;
  font-size: 16px;
  color: rgba(203, 213, 225, 0.75);
  margin-top: -6px;
  margin-bottom: 30px;
  font-weight: 500;
}

.alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecdd3;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.18);
}

.glass-block {
  background: rgba(13, 19, 33, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.glass-block:hover {
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(13, 19, 33, 0.75);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.glass-block h3 {
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.section-copy {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(148, 163, 184, 0.85);
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inline-form button {
  width: 100%;
}

.inline-form label {
  background: rgba(13, 19, 33, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
}

.inline-form label:hover,
.inline-form label:focus-within {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(13, 19, 33, 0.8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.inline-form label span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.7);
}

.inline-form input {
  background: transparent;
  border: 0;
  padding: 4px 0;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.auth-footer {
  margin-top: 36px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: rgba(148, 163, 184, 0.6);
}

.auth-footer a {
  color: #a78bfa;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-footer a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

.card {
  max-width: 420px;
  margin: 6vh auto;
  padding: 24px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--text);
}

label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(13, 19, 33, 0.5);
  color: var(--text);
  font-size: 14px;
  margin-top: 6px;
  transition: all 0.25s ease;
  font-family: inherit;
}

input::placeholder {
  color: rgba(148, 163, 184, 0.4);
}

input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(13, 19, 33, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button, .btn-primary, .btn-secondary {
  padding: 11px 18px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

button:hover, .btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  color: var(--accent-light);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.danger:hover {
  background: linear-gradient(135deg, var(--danger-hover), #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-logout {
  background: rgba(148, 163, 184, 0.12) !important;
  color: var(--text-dim) !important;
  border: 1.5px solid rgba(148, 163, 184, 0.25) !important;
  box-shadow: none !important;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

/* Room layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: linear-gradient(135deg, #0a0e1a 0%, #151b2e 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(13, 19, 33, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 100;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.4), transparent);
}

.topbar .title {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .title strong {
  color: var(--accent-light);
  font-weight: 700;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-control {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  transition: all 0.25s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn-control:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.btn-control.off {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-control.off:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-control.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-control.danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger-hover);
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding: 20px;
  overflow: auto;
  background: rgba(10, 14, 26, 0.4);
}

.videoBox {
  position: relative;
  background: linear-gradient(135deg, #0d1321 0%, #1a1f35 100%);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(99, 102, 241, 0.15);
  transition: all 0.3s ease;
}

.videoBox:hover {
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.videoBox video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.videoBox .caption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(13, 19, 33, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Chat panel */
.chat {
  position: fixed;
  right: 20px;
  top: 90px;
  width: 340px;
  max-height: calc(100vh - 120px);
  background: rgba(13, 19, 33, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(99, 102, 241, 0.15);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.chat-header {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatLog {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: rgba(10, 14, 26, 0.6);
  border-radius: 10px;
  max-height: 450px;
  margin-bottom: 12px;
  border: 1px solid rgba(99, 102, 241, 0.08);
}

.chatLog::-webkit-scrollbar {
  width: 8px;
}

.chatLog::-webkit-scrollbar-track {
  background: rgba(10, 14, 26, 0.3);
  border-radius: 4px;
}

.chatLog::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.chatLog::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

#chatForm {
  display: flex;
  gap: 10px;
}

#chatForm input {
  flex: 1;
  margin: 0;
  background: rgba(10, 14, 26, 0.5);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
}

#chatForm input:focus {
  border-color: var(--accent);
  background: rgba(10, 14, 26, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#chatForm button {
  padding: 11px 18px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
}

#chatForm button:hover {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Participants list */
#participants_list {
  position: fixed;
  left: 20px;
  top: 90px;
  background: rgba(13, 19, 33, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 16px;
  border-radius: 16px;
  max-height: 65vh;
  overflow: auto;
  min-width: 220px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.12);
}

#participants_list::-webkit-scrollbar {
  width: 8px;
}

#participants_list::-webkit-scrollbar-track {
  background: rgba(10, 14, 26, 0.3);
  border-radius: 4px;
}

#participants_list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}

#participants_list::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 28px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1e293b;
  padding: 12px 20px;
  border-radius: 12px;
  z-index: 9999;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 
    0 8px 24px rgba(251, 191, 36, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .planet-container {
    width: 450px;
    height: 450px;
    top: -10%;
    right: -25%;
  }
  
  .login-card {
    max-width: 90vw;
    padding: 32px 28px;
  }
  
  .chat {
    width: calc(100% - 40px);
    right: 20px;
    left: 20px;
    top: 80px;
  }
  
  #participants_list {
    max-width: calc(100% - 40px);
    left: 20px;
    top: 80px;
  }
  
  .controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .btn-control {
    font-size: 12px;
    padding: 8px 12px;
  }
  
  .topbar {
    padding: 12px 16px;
  }
  
  .topbar .title {
    font-size: 15px;
  }
  
  .grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  
  .auth-card {
    padding: 32px 28px;
  }
  
  .auth-card h1 {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .planet-container {
    width: 350px;
    height: 350px;
    top: -5%;
    right: -35%;
  }
  
  .login-card {
    padding: 28px 24px;
  }
  
  .login-card h1 {
    font-size: 26px;
  }
  
  .auth-card {
    padding: 28px 24px;
  }
  
  .auth-card h1 {
    font-size: 24px;
  }
  
  .glass-block {
    padding: 18px;
  }
  
  .btn-control {
    font-size: 11px;
    padding: 7px 10px;
  }
}

.section {
  margin: 16px 0;
}
