* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: radial-gradient(circle at 15% 20%, #1e293b 0%, #0f172a 38%, #020617 100%);
  color: #e2e8f0;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(500px 260px at 8% 12%, rgba(14, 165, 233, 0.2), transparent 68%),
    radial-gradient(420px 240px at 92% 20%, rgba(34, 197, 94, 0.17), transparent 66%),
    radial-gradient(440px 220px at 55% 92%, rgba(59, 130, 246, 0.16), transparent 72%);
  filter: blur(22px) saturate(1.1);
  opacity: 0.9;
  z-index: -2;
}

body::after {
  background:
    linear-gradient(rgba(2, 6, 23, 0.42), rgba(2, 6, 23, 0.42)),
    repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.03) 0 2px,
      rgba(2, 6, 23, 0) 2px 12px
    );
  backdrop-filter: blur(2px);
  z-index: -1;
}

.container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 24, 39, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 12px 24px 24px 24px;
  backdrop-filter: blur(12px);
}

.logo {
  width: 200px;
  height: 80px;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}

h1,
h2 {
  margin: 0 0 8px;
}

p {
  margin: 0 0 18px;
  color: #94a3b8;
}

.form {
  display: grid;
  gap: 8px;
}

label {
  font-size: 14px;
  color: #cbd5e1;
}

input,
select,
button {
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #e2e8f0;
  padding: 10px;
}

button {
  cursor: pointer;
}

.row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.primary {
  margin-top: 10px;
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #082f49;
  font-weight: bold;
}

.secondary {
  margin-top: 4px;
  background: #111827;
  border-color: #334155;
  color: #cbd5e1;
}

.secondary:hover {
  border-color: #475569;
}

.form-hint {
  min-height: 18px;
  margin-top: 2px;
  color: #93c5fd;
  font-size: 12px;
}

.auth-actions {
  display: flex;
  gap: 8px;
}

.auth-actions .secondary {
  flex: 1;
}

.is-hidden {
  display: none;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 18px;
  color: #e2e8f0;
}

.auth-panel,
.prejoin-panel {
  display: grid;
  gap: 8px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tab {
  border-radius: 999px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #cbd5e1;
  padding: 8px 10px;
}

.auth-tab[aria-pressed="true"] {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #082f49;
  font-weight: 700;
}

.auth-panel.is-hidden,
.prejoin-panel.is-hidden,
.is-hidden {
  display: none !important;
}

.prejoin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prefs-grid {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.prejoin-media {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.prejoin-media__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cbd5e1;
}

.prejoin-media__item .icon-btn {
  width: 40px;
  height: 40px;
}

.prejoin-voice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.pref-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.pref-check input {
  width: auto;
  margin: 0;
}

.room-container {
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.room-container::before,
.room-container::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(38px);
  opacity: 0.35;
  z-index: -1;
  animation: floatGlow 14s ease-in-out infinite;
}

.room-container::before {
  width: 280px;
  height: 280px;
  left: -60px;
  top: 70px;
  background: #0ea5e9;
}

.room-container::after {
  width: 320px;
  height: 320px;
  right: -80px;
  bottom: 90px;
  background: #22c55e;
  animation-delay: -6s;
}

.room-header {
  display: grid;
  gap: 10px;
}

.room-header__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.room-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.room-toggle-btn {
  margin-top: 0;
  padding: 6px 10px;
}

.room-header__panel {
  display: grid;
  gap: 8px;
}

.room-header.is-collapsed .room-header__panel {
  display: none;
}

.room-controls-stack {
  display: grid;
  gap: 10px;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  font-size: 14px;
  color: #cbd5e1;
  cursor: pointer;
}

.voice-toggle input {
  width: auto;
  margin: 0;
}

.voice-gender {
  display: grid;
  gap: 6px;
  margin-top: 0;
}

.voice-gender__label {
  font-size: 13px;
  color: #cbd5e1;
}

.voice-gender__buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.voice-gender__btn {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.voice-gender__btn[aria-pressed="true"] {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

.voice-gender__btn:hover:not([aria-pressed="true"]) {
  border-color: #64748b;
  color: #e2e8f0;
}

.room-status {
  margin: 0 0 8px;
  font-size: 14px;
  color: #94a3b8;
}

.room-note {
  margin: 0 0 8px;
  font-size: 12px;
  color: #93c5fd;
}

.room-share-row {
  display: grid;
  gap: 4px;
  margin-top: 0;
}

.room-share-btn {
  margin-top: 0;
  padding: 8px 12px;
}

/* Browser compatibility warning */
.browser-warning {
  text-align: center;
  max-width: 480px;
}

.browser-warning__icon {
  font-size: 48px;
  margin: 8px 0;
}

.browser-warning__title {
  font-size: 22px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 16px;
}

.browser-warning__text {
  font-size: 15px;
  color: #94a3b8;
  line-height: 1.6;
  margin: 0 0 12px;
}

.browser-warning__text strong {
  color: #e2e8f0;
}

.link-button {
  text-decoration: none;
  color: #0ea5e9;
}

.videos {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  align-content: start;
}

.video-panel,
.captions {
  background: rgba(11, 18, 32, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  backdrop-filter: blur(10px);
}

.video-panel {
  border-radius: 12px;
  padding: 12px;
}

video {
  width: 100%;
  min-height: 220px;
  border-radius: 10px;
  background: #000;
  transition: opacity 140ms ease, visibility 140ms ease;
}

.local-preview {
  position: relative;
}

#local-video-canvas {
  display: none;
  width: 100%;
  min-height: 220px;
  border-radius: 10px;
  background: #000;
}

#local-video-canvas.is-active {
  display: block;
}

#local-video.video-hidden {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  inset: 0;
  transform: scale(1.02);
}

.video-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-btn {
  font-size: 13px;
  padding: 8px 10px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.85);
  position: relative;
}

.icon-btn .icon-on,
.icon-btn .icon-off {
  line-height: 1;
  width: 20px;
  height: 20px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .icon-off {
  display: none;
}

.icon-btn[aria-pressed="false"] {
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.5);
}

.icon-btn[aria-pressed="false"] .icon-on {
  display: none;
}

.icon-btn[aria-pressed="false"] .icon-off {
  display: inline;
}

.remote-video-wrap {
  position: relative;
}

.mute-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.88);
  border: 1px solid #7f1d1d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mute-overlay[hidden] {
  display: none;
}

.mute-overlay svg {
  width: 18px;
  height: 18px;
  stroke: #fca5a5;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.captions {
  width: 100%;
  margin-top: auto;
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 14px;
}

#captions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
}

#captions-list li {
  padding: 8px;
  background: #111827;
  border-radius: 8px;
}

@keyframes floatGlow {
  0%,
  100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-14px) scale(1.05);
  }
}
