:root {
  --bg0: #0b1220;
  --bg1: #121a2b;
  --bg2: #1a2438;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eef8;
  --muted: #93a0b8;
  --brand: #2dd4bf;
  --brand2: #38bdf8;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 212, 191, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.14), transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 45%, #0e1626);
  color: var(--text);
}
a { color: var(--brand2); text-decoration: none; }
button, input, select { font: inherit; }

.shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.2rem;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display: grid;
  place-items: center;
  color: #042f2e;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.35);
}

.hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.55;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: rgba(18, 26, 43, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.field { margin-bottom: 0.85rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}
.field input:focus, .field select:focus {
  outline: 2px solid rgba(45, 212, 191, 0.35);
  border-color: rgba(45, 212, 191, 0.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #14b8a6);
  color: #042f2e;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }

.msg {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

.room-list { display: grid; gap: 0.65rem; }
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.room-item strong { display: block; }
.room-item small { color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Sala de vídeo */
.room-page {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(11, 18, 32, 0.95);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.room-stage {
  position: relative;
  min-height: 0;
  background: #000;
}
#jitsiContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#jitsiContainer > iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.caption-layer {
  position: absolute;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 2rem));
  z-index: 5;
  pointer-events: none;
}
.caption-bubble {
  background: rgba(8, 12, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.caption-bubble .who {
  font-size: 0.75rem;
  color: var(--brand);
  margin-bottom: 0.25rem;
}
.caption-bubble .txt {
  font-size: 1.05rem;
  line-height: 1.4;
}
.caption-bubble .orig {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.side-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: min(280px, calc(100% - 1.5rem));
  z-index: 6;
  max-height: calc(100% - 1.5rem);
  overflow: auto;
}
.peer-chip {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.peer-chip:last-child { border-bottom: 0; }
.listening-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}
.listening-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.2);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.install-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(18, 26, 43, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.install-banner.show { display: flex; }
