/* ═══════════════════════════════════════════════════════════
   Parallax — tema escuro
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #08090d;
  --bg-2: #0d0f15;
  --surface: #13161e;
  --surface-2: #1a1e28;
  --surface-3: #232836;
  --surface-4: #2c3242;
  --border: rgba(255, 255, 255, 0.06);
  --border-2: rgba(255, 255, 255, 0.11);
  --text: #eceef4;
  --text-2: #a9afc0;
  --text-3: #6f768a;
  --accent: #7b6cff;
  --accent-2: #4ea8ff;
  --accent-grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 48%, #3b9eff 100%);
  --danger: #f0435a;
  --danger-2: #ff5d72;
  --success: #2bd47d;
  --warn: #ffb547;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(123, 108, 255, 0.45); }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; display: block; }

.noscript { padding: 40px; text-align: center; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ───────────── fundo com parallax ───────────── */

.backdrop { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.layer { position: absolute; will-change: transform; transition: transform 0.25s ease-out; }
.layer-grid {
  inset: -60px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
}
.orb { border-radius: 50%; filter: blur(80px); opacity: 0.55; }
.orb-a { width: 520px; height: 520px; left: -140px; top: -160px; background: #6d28d9; animation: drift-a 22s ease-in-out infinite alternate; }
.orb-b { width: 460px; height: 460px; right: -120px; bottom: -160px; background: #1d4ed8; animation: drift-b 26s ease-in-out infinite alternate; }
.orb-c { width: 260px; height: 260px; left: 55%; top: 18%; background: #db2777; opacity: 0.28; animation: drift-a 18s ease-in-out infinite alternate-reverse; }
@keyframes drift-a { to { margin-left: 60px; margin-top: 40px; } }
@keyframes drift-b { to { margin-right: 80px; margin-bottom: 30px; } }
body[data-view='room'] .backdrop { display: none; }

/* ───────────── views genéricas ───────────── */

.view { position: relative; z-index: 1; }
.view-center {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  gap: 18px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: rgba(19, 22, 30, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border-2);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

.brand { display: flex; align-items: center; gap: 14px; justify-content: center; }
.brand h1 { margin: 0; font-size: 34px; letter-spacing: -0.03em; font-weight: 800; background: linear-gradient(120deg, #fff 30%, #b9b2ff 70%, #8fc8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sm { justify-content: flex-start; gap: 10px; font-weight: 700; color: var(--text-2); }
.tagline { margin: -4px 0 4px; text-align: center; color: var(--text-2); font-size: 15px; }
.foot { color: var(--text-3); font-size: 12.5px; text-align: center; }

.logo { position: relative; width: 40px; height: 40px; flex: none; }
.logo span { position: absolute; width: 26px; height: 26px; border-radius: 8px; transition: transform 0.3s; }
.logo span:nth-child(1) { left: 0; top: 0; background: rgba(139, 92, 246, 0.38); }
.logo span:nth-child(2) { left: 7px; top: 7px; background: rgba(99, 102, 241, 0.65); }
.logo span:nth-child(3) { left: 14px; top: 14px; background: var(--accent-grad); box-shadow: 0 4px 18px rgba(99, 102, 241, 0.5); }
.brand:hover .logo span:nth-child(1) { transform: translate(-3px, -3px); }
.brand:hover .logo span:nth-child(3) { transform: translate(3px, 3px); }
.logo-sm { width: 28px; height: 28px; }
.logo-sm span { width: 18px; height: 18px; border-radius: 6px; }
.logo-sm span:nth-child(2) { left: 5px; top: 5px; }
.logo-sm span:nth-child(3) { left: 10px; top: 10px; }

/* ───────────── formulários ───────────── */

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.field-label small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-3); margin-left: 6px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type='text'], select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
}
input[type='text']:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123, 108, 255, 0.22); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input.invalid { border-color: var(--danger); animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9afc0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
select option { background: var(--surface-2); }

.input-row, .join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; font-family: var(--mono); letter-spacing: 0.02em; }

.form-error { margin: -6px 0 0; min-height: 0; color: #ff7d8f; font-size: 13.5px; text-align: center; }
.form-error:empty { display: none; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border-2); }

.hint { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.55; }
kbd { font-family: var(--mono); font-size: 11px; background: var(--surface-3); border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--text-2); }

/* toggle */
.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; font-size: 14.5px; color: var(--text); }
.toggle-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch { position: relative; width: 40px; height: 23px; border-radius: 99px; background: var(--surface-4); flex: none; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.3, 1.3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.toggle-row input:checked + .switch { background: var(--accent); }
.toggle-row input:checked + .switch::after { transform: translateX(17px); }
.toggle-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type='range'] { width: 100%; accent-color: var(--accent); cursor: pointer; height: 20px; margin: 0; }

/* ───────────── botões ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 22px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-secondary { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-4); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 14px 20px; font-size: 15.5px; border-radius: 14px; }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.busy { pointer-events: none; opacity: 0.75; }
.btn.busy .icon { display: none; }
.btn.busy::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--text-2); transition: background 0.15s, color 0.15s; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn-accent { background: var(--accent); color: #fff; }
.icon-btn-accent:hover { background: #8c7fff; color: #fff; }

.link-muted { color: var(--text-3); font-size: 13.5px; text-align: center; text-decoration: none; }
.link-muted:hover { color: var(--text-2); text-decoration: underline; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: currentColor; animation: spin 0.75s linear infinite; flex: none; }
.spinner-lg { width: 38px; height: 38px; border-width: 3px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── convite / mensagens ───────────── */

.invite-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 6px 0 2px; }
.eyebrow { color: var(--text-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.room-code-big { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: 0.04em; background: linear-gradient(120deg, #fff, #b9b2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pre-status { color: var(--text-2); font-size: 14px; }
.pre-status.ok::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 8px; box-shadow: 0 0 10px var(--success); vertical-align: 1px; }
.avatars { display: flex; justify-content: center; }
.avatars:empty { display: none; }
.avatars .avatar { width: 36px; height: 36px; font-size: 13px; border: 3px solid var(--surface); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }

.card-message { align-items: center; text-align: center; gap: 12px; }
.card-message h2 { margin: 4px 0 0; font-size: 22px; letter-spacing: -0.02em; }
.msg-text { margin: 0 0 8px; color: var(--text-2); }
.msg-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-2); }
.msg-icon .icon { width: 30px; height: 30px; }
.msg-icon.danger { background: rgba(240, 67, 90, 0.14); color: #ff7d8f; }
.msg-icon.warn { background: rgba(255, 181, 71, 0.13); color: var(--warn); }
.msg-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* ───────────── avatar ───────────── */

.avatar {
  --h: 250;
  width: 64px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(140deg, hsl(var(--h) 62% 58%), hsl(calc(var(--h) + 35) 58% 42%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  user-select: none;
  flex: none;
}

/* ═══════════════════════════════════════════════════════════
   SALA
   ═══════════════════════════════════════════════════════════ */

.room { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 1; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(16px + var(--safe-r)) 10px calc(16px + var(--safe-l));
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.room-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); transition: background 0.15s; min-width: 0; }
.room-chip:hover { background: var(--surface-3); }
.room-chip .icon { width: 16px; height: 16px; color: var(--accent-2); }
.count-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; font-size: 14px; padding: 0 4px; }
.count-chip .icon { width: 17px; height: 17px; }
.net-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 181, 71, 0.12); color: var(--warn); font-size: 13px; font-weight: 600; }

.room-main { flex: 1; min-height: 0; display: flex; position: relative; overflow: hidden; }

.stage-area {
  --gap: 12px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap) calc(var(--gap) + var(--safe-r)) var(--gap) calc(var(--gap) + var(--safe-l));
  position: relative;
}
.stage { display: none; }
.tiles {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: var(--gap);
}
.tiles > .tile { width: var(--tw, 260px); height: var(--th, 162px); }

.room.has-stage .stage { display: flex; flex: 1; min-height: 0; flex-wrap: wrap; align-content: center; justify-content: center; gap: var(--gap); }
.room.has-stage .stage > .screen-tile { width: var(--sw, 640px); height: var(--sh, 360px); }
.room.has-stage .tiles {
  flex: none;
  height: var(--strip-h, 116px);
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-content: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}
.room.has-stage .tiles > * { height: 100%; width: auto; aspect-ratio: 16 / 10; flex: none; }
.room.has-stage .tiles > :first-child { margin-left: auto; }
.room.has-stage .tiles > :last-child { margin-right: auto; }
/* Na faixa com rolagem, o realce por fora seria cortado: desenha por dentro. */
.room.has-stage .tiles > .tile.speaking { box-shadow: inset 0 0 0 2px var(--success), inset 0 0 18px rgba(43, 212, 125, 0.25); }

/* ───────────── tile de participante ───────────── */

.tile {
  --h: 250;
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  container-type: size;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
  animation: tile-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}
@keyframes tile-in { from { opacity: 0; transform: scale(0.94); } }
.tile::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, hsl(var(--h) 60% 45% / 0.22), transparent 68%); pointer-events: none; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--border-2); }
.tile .avatar { position: relative; width: clamp(36px, 34cqmin, 112px); font-size: clamp(13px, 12cqmin, 38px); transition: box-shadow 0.15s; }
.tile.speaking { border-color: transparent; box-shadow: 0 0 0 2px var(--success), 0 0 26px rgba(43, 212, 125, 0.22); }
.tile.speaking .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--success); }

.tile-footer { position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.tile-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.tile-name .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-name .icon { width: 15px; height: 15px; }
.tile-name .ic-off { color: #ff6b7f; }
.tile-name .ic-dim { color: var(--warn); }

.tile-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.live-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; }
.live-badge .icon { width: 12px; height: 12px; }

.tile-status {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-2);
}
.tile-status:empty { display: none; }
.tile-status .spinner { width: 12px; height: 12px; }
.tile-status.failed { background: rgba(240, 67, 90, 0.2); color: #ff8a9a; pointer-events: auto; cursor: pointer; }

@container (max-height: 130px) {
  .tile .avatar { width: clamp(22px, 30cqh, 44px); font-size: clamp(10px, 11cqh, 15px); transform: translateY(-11px); }
}
@container (max-height: 90px) {
  .tile-name { font-size: 11.5px; padding: 2px 7px; }
  .tile-status { font-size: 10.5px; padding: 2px 7px; }
  .live-badge { font-size: 9px; padding: 2px 5px; }
}

/* ───────────── tile de tela ───────────── */

.screen-tile {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  animation: tile-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}
.screen-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.screen-tile.thumb { cursor: pointer; }
.screen-tile.thumb:hover { border-color: var(--border-2); }

.screen-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); font-size: 13.5px; background: radial-gradient(circle, #141824, #05060a); }
.screen-loading .spinner { width: 28px; height: 28px; border-width: 3px; color: var(--accent); }
.screen-tile.has-video .screen-loading { display: none; }
.preview-off-msg { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; color: var(--text-2); font-size: 13.5px; background: radial-gradient(circle, #161a26, #07080c); }
.preview-off-msg .icon { width: 34px; height: 34px; color: var(--danger-2); }
.preview-off-msg b { color: var(--text); font-size: 15px; }
.preview-off-msg span { max-width: 360px; }
.screen-tile.preview-off .preview-off-msg { display: flex; }
.screen-tile.thumb .preview-off-msg span { display: none; }

.screen-label {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 20px);
  padding: 5px 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.25s;
  pointer-events: none;
}
.screen-label .icon { width: 15px; height: 15px; color: var(--danger-2); }
.screen-label .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent 32%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.screen-tile.show-ui .screen-overlay { opacity: 1; }
.screen-tile.show-ui .screen-overlay > * { pointer-events: auto; }
.screen-tile:not(.show-ui) .screen-label { opacity: 0.85; }
.screen-tile:fullscreen:not(.show-ui), .screen-tile:-webkit-full-screen:not(.show-ui) { cursor: none; }
.screen-tile:fullscreen:not(.show-ui) .screen-label { opacity: 0; }

.screen-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; }
.screen-bar .spacer { flex: 1; }
.screen-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background 0.15s; flex: none; }
.screen-btn:hover { background: rgba(255, 255, 255, 0.22); }
.screen-btn.active { background: var(--accent); }
.screen-btn .icon { width: 19px; height: 19px; }
.screen-stop { display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; height: 38px; border-radius: 10px; background: var(--danger); color: #fff; font-weight: 600; font-size: 13.5px; }
.screen-stop:hover { background: var(--danger-2); }
.screen-stop .icon { width: 17px; height: 17px; }
.screen-vol { display: flex; align-items: center; gap: 4px; padding-right: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.screen-vol .screen-btn { background: none; }
.screen-vol input { width: 110px; }
.screen-vol.no-audio { opacity: 0.55; }
.screen-quick { display: none; justify-content: center; gap: 6px; padding: 0 12px 2px; }
.screen-tile:fullscreen .screen-quick, .screen-tile:-webkit-full-screen .screen-quick { display: flex; }
.quick-react { width: 44px; height: 44px; border-radius: 12px; font-size: 24px; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform 0.12s, background 0.15s; }
.quick-react:hover { transform: translateY(-3px) scale(1.12); background: rgba(255, 255, 255, 0.2); }

.screen-tile.thumb .screen-bar, .screen-tile.thumb .screen-quick { display: none; }
.screen-tile.thumb .screen-label { top: auto; bottom: 6px; left: 6px; font-size: 11.5px; padding: 3px 7px; }
.room:not(.multi-screen) .pin-btn { display: none; }

.screen-tile:fullscreen, .screen-tile:-webkit-full-screen { width: 100% !important; height: 100% !important; border: 0; border-radius: 0; }

/* Tela cheia própria (iPhone) */
.screen-tile.pseudo-fs { position: fixed !important; inset: 0; z-index: 75; width: auto !important; height: auto !important; border: 0; border-radius: 0; animation: none; }
.screen-tile.pseudo-fs .screen-quick { display: flex; }
.screen-tile.pseudo-fs .screen-bar { padding: 10px calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); }
.screen-tile.pseudo-fs .screen-label { top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); }
.room.ptt-mode .screen-tile.pseudo-fs, .room.ptt-mode .screen-tile:fullscreen { touch-action: none; }
.screen-chip { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 10px; color: #fff; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); white-space: nowrap; }


/* ───────────── controles ───────────── */

.controls {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px calc(16px + var(--safe-r)) calc(10px + var(--safe-b)) calc(16px + var(--safe-l));
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.controls-group { display: flex; align-items: center; gap: 8px; }
.controls-side-end { display: flex; justify-content: flex-end; }

.ctrl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 66px;
  height: 58px;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.15s, transform 0.1s, color 0.15s;
  user-select: none;
}
.ctrl:hover { background: var(--surface-3); }
.ctrl:active { transform: scale(0.95); }
.ctrl .icon { width: 22px; height: 22px; }
.ctrl-label { font-size: 11px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.ctrl.is-off { background: rgba(240, 67, 90, 0.16); color: #ff6b7f; }
.ctrl.is-off:hover { background: rgba(240, 67, 90, 0.26); }
.ctrl.is-off .ctrl-label { color: #ff8a9a; }
.ctrl.is-warn { color: var(--warn); }
.ctrl.is-active { background: var(--accent-grad); color: #fff; }
.ctrl.is-active .ctrl-label { color: rgba(255, 255, 255, 0.92); }
.ctrl.is-open { background: var(--surface-4); }
.ctrl-danger { background: var(--danger); color: #fff; }
.ctrl-danger:hover { background: var(--danger-2); }
.ctrl-danger .ctrl-label { color: rgba(255, 255, 255, 0.92); }
.split-btn { display: flex; gap: 2px; }
.split-btn .ctrl:first-child { border-radius: 14px 4px 4px 14px; }
.ctrl-caret { min-width: 26px; width: 26px; padding: 0; border-radius: 4px 14px 14px 4px; }
.ctrl-caret .icon { width: 16px; height: 16px; }
.badge { position: absolute; top: 5px; right: 9px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg-2); }

/* ───────────── chat ───────────── */

.chat {
  --chat-w: 340px;
  width: var(--chat-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  margin-right: calc(var(--chat-w) * -1);
  visibility: hidden;
  transition: margin-right 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.25s;
}
.room.chat-open .chat { margin-right: 0; visibility: visible; transition: margin-right 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.chat-head h3 { margin: 0; font-size: 15px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.chat-empty { margin: auto; color: var(--text-3); font-size: 13.5px; text-align: center; padding: 20px; }
.msg { --h: 250; padding: 6px 8px; border-radius: 10px; margin-top: 8px; }
.msg:hover, .msg-cont:hover { background: rgba(255, 255, 255, 0.025); }
.msg-cont { padding: 1px 8px; border-radius: 10px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.msg-name { font-weight: 700; font-size: 13.5px; color: hsl(var(--h) 85% 74%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head time { font-size: 11px; color: var(--text-3); flex: none; }
.msg-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: #dfe2ea; }
.msg-text a { color: #8fc0ff; }
.msg-system { margin: 10px 0 2px; text-align: center; font-size: 12px; color: var(--text-3); }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); }
.chat-form textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 12px; line-height: 1.4; border-radius: 12px; }
.chat-form .icon-btn { width: 40px; height: 40px; border-radius: 12px; }

/* ───────────── push-to-talk ───────────── */

.ptt-btn {
  position: absolute;
  left: 50%;
  bottom: 18px;
  /* fica acima da faixa de participantes quando há transmissão */
  z-index: 25;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: rgba(26, 30, 40, 0.7);
  border: 1px solid var(--border-2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.85);
  transition: opacity 0.2s, transform 0.2s, background 0.15s, box-shadow 0.15s, color 0.15s;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ptt-btn .icon { width: 26px; height: 26px; }
.ptt-btn.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }
.ptt-btn.active { color: #06210f; background: var(--success); border-color: transparent; box-shadow: 0 0 0 8px rgba(43, 212, 125, 0.18), 0 0 30px rgba(43, 212, 125, 0.5); transform: translateX(-50%) scale(1.08); }
.ptt-btn.visible.active { opacity: 1; }
.room.has-stage .ptt-btn { left: auto; right: 14px; bottom: calc(var(--strip-h, 84px) + 22px); transform: scale(0.85); }
.room.has-stage .ptt-btn.visible { transform: none; }
.room.has-stage .ptt-btn.active { transform: scale(1.08); }
.room.chat-open .ptt-btn { opacity: 0; pointer-events: none; }
.ctrl:disabled { opacity: 0.35; pointer-events: none; }

.ptt-glow {
  position: absolute;
  inset: 0;
  z-index: 56;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  box-shadow: inset 0 0 0 3px rgba(43, 212, 125, 0.85), inset 0 0 70px rgba(43, 212, 125, 0.28);
}
.room.glow-on .ptt-glow { opacity: 1; animation: ptt-pulse 1.6s ease-in-out infinite; }
@keyframes ptt-pulse { 50% { box-shadow: inset 0 0 0 3px rgba(43, 212, 125, 0.55), inset 0 0 40px rgba(43, 212, 125, 0.16); } }
.room.ptt-mode .stage-area { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.screen-tile video { -webkit-touch-callout: none; }

.notice-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(255, 181, 71, 0.1); border: 1px solid rgba(255, 181, 71, 0.28); color: #f3d9ae; font-size: 13px; line-height: 1.5; }
.notice-warn .icon { width: 18px; height: 18px; color: var(--warn); margin-top: 1px; }
.notice-warn b { color: #ffd591; }
.key-capture { min-width: 110px; font-family: var(--mono); }

/* Botão de segurar para falar dentro da tela cheia (aparece ao tocar na tela) */
.ptt-hold { display: none; width: 52px; height: 52px; border-radius: 50%; touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.ptt-hold .icon { width: 24px; height: 24px; }
.room.ptt-mode .screen-tile.pseudo-fs .ptt-hold,
.room.ptt-mode .screen-tile:fullscreen .ptt-hold { display: inline-grid; }
.ptt-hold.active { background: var(--success); color: #06210f; box-shadow: 0 0 0 6px rgba(43, 212, 125, 0.22), 0 0 24px rgba(43, 212, 125, 0.5); }
.key-capture.capturing { border-color: var(--accent); color: var(--accent-2); }

/* ───────────── popovers ───────────── */

.popover {
  position: fixed;
  z-index: 50;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px;
  animation: pop-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: calc(100vw - 16px);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(0.97); } }

.reaction-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.reaction-picker button { width: 46px; height: 46px; border-radius: 12px; font-size: 27px; line-height: 1; transition: transform 0.12s, background 0.12s; }
.reaction-picker button:hover { background: var(--surface-4); transform: scale(1.18); }
.reaction-picker button:active { transform: scale(0.92); }

.menu-title { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; padding: 6px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; font-size: 14px; color: var(--text); }
.menu-item:hover { background: var(--surface-3); }
.menu-item .check { width: 16px; height: 16px; color: var(--accent); flex: none; visibility: hidden; }
.menu-item.selected .check { visibility: visible; }
.menu-item .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; background: var(--border-2); margin: 6px 4px; }
.device-menu { width: 320px; }

.peer-menu { width: 290px; display: flex; flex-direction: column; gap: 4px; }
.peer-menu-head { display: flex; align-items: center; gap: 12px; padding: 6px 6px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.peer-menu-head .avatar { width: 40px; font-size: 15px; }
.peer-menu-head .who { min-width: 0; }
.peer-menu-head .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-menu-head .who span { font-size: 12.5px; color: var(--text-3); }
.slider-row { padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.slider-row .row-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); font-weight: 600; }
.slider-row .row-head output { color: var(--text); font-variant-numeric: tabular-nums; }

/* ───────────── reações flutuantes ───────────── */

.reactions-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.reaction {
  position: absolute;
  left: var(--x, 50%);
  bottom: var(--y0, 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: float-up var(--dur, 3.6s) cubic-bezier(0.25, 0.6, 0.35, 1) var(--delay, 0s) both;
  will-change: transform, opacity;
}
.reaction-emoji { display: block; font-size: calc(46px * var(--scale, 1)); line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45)); animation: wobble 0.9s ease-in-out infinite alternate; }
.reaction-name { margin-top: 4px; padding: 2px 9px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.reaction.mini .reaction-emoji { font-size: calc(24px * var(--scale, 1)); }
@keyframes float-up {
  0% { transform: translate(-50%, 30px) scale(0.3); opacity: 0; }
  10% { transform: translate(-50%, -2vh) scale(1.12); opacity: 1; }
  18% { transform: translate(calc(-50% + var(--drift, 0px) * 0.15), -8vh) scale(1); }
  75% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--drift, 0px)), var(--rise, -68vh)) rotate(var(--rot, 0deg)) scale(0.85); opacity: 0; }
}
@keyframes wobble { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }

/* ───────────── toasts ───────────── */

.toasts { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
body:not([data-view='room']) .toasts { bottom: calc(24px + var(--safe-b)); }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(35, 40, 54, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: default;
}
.toast.clickable { cursor: pointer; }
.toast.out { animation: toast-out 0.2s ease forwards; }
.toast .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--accent-2); }
.toast.success .icon { color: var(--success); }
.toast.error .icon { color: #ff7d8f; }
.toast.warn .icon { color: var(--warn); }
.toast-body { min-width: 0; }
.toast-title { font-weight: 700; font-size: 13px; color: var(--text); }
.toast-text { color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.toast-title + .toast-text { font-size: 13.5px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.97); } }
:fullscreen > .toasts, :-webkit-full-screen > .toasts { bottom: 90px; }

/* ───────────── overlays ───────────── */

.room-loading { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--bg); color: var(--text-2); }
.audio-unlock { position: absolute; top: calc(72px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 45; animation: pop-in 0.25s; }

/* ───────────── modal ───────────── */

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 8, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in 0.18s; }
@keyframes fade-in { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 540px; max-height: min(86vh, 860px); max-height: min(86dvh, 860px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-radius: 22px; box-shadow: var(--shadow); animation: card-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { overflow-y: auto; padding: 8px 24px 24px; overscroll-behavior: contain; }
.settings-section { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; padding-bottom: 4px; }
.settings-section h3 { margin: 0; font-size: 14px; color: var(--text); letter-spacing: -0.01em; }
.meter { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #2bd47d, #9be15d 60%, #ffb547 85%, #f0435a); transition: transform 0.06s linear; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVO
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .chat { position: absolute; top: 0; right: 0; bottom: 0; z-index: 30; margin-right: 0; transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.25s; box-shadow: var(--shadow); }
  .room.chat-open .chat { transform: none; transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s; }
}

@media (max-width: 760px) {
  .controls { display: flex; justify-content: space-between; gap: 6px; padding-top: 8px; padding-bottom: calc(8px + var(--safe-b)); }
  .controls-side { display: none; }
  .controls-side-end, .controls-group { display: contents; }
  .ctrl { min-width: 0; flex: 1; height: 50px; padding: 0 4px; border-radius: 13px; max-width: 64px; }
  .ctrl-label { display: none; }
  .ctrl-caret { display: none; }
  .split-btn { flex: 1; max-width: 64px; }
  .split-btn .ctrl:first-child { border-radius: 13px; max-width: none; }
  .badge { top: 3px; right: 5px; }
  .hide-sm { display: none; }
  .btn-sm .icon + .hide-sm { display: none; }
  .topbar { padding-top: calc(8px + var(--safe-t)); padding-bottom: 8px; }
  .chat { width: 100%; --chat-w: 100%; border-left: 0; }
  .stage-area { --gap: 8px; }
  .room.has-stage .tiles { height: var(--strip-h, 84px); }
  .screen-vol input { width: 80px; }
  .reaction-picker { grid-template-columns: repeat(6, 1fr); }
  .reaction-picker button { width: 42px; height: 42px; font-size: 25px; }
  .card { padding: 26px 20px; border-radius: 20px; }
  .brand h1 { font-size: 30px; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; max-height: 92dvh; }
  .modal-body { padding: 4px 18px calc(18px + var(--safe-b)); }
  .field-grid { grid-template-columns: 1fr; }
  /* no celular os avisos ficam no topo: não cobrem o botão do microfone nem o campo do chat */
  .toasts { top: calc(64px + var(--safe-t)); bottom: auto; flex-direction: column; }
  body:not([data-view='room']) .toasts { top: auto; bottom: calc(24px + var(--safe-b)); flex-direction: column-reverse; }
}

@media (max-width: 420px) {
  .hide-xs { display: none; }
  .room-chip { font-size: 12.5px; padding: 6px 9px; }
  .ctrl { height: 46px; }
  .tile-name { font-size: 12px; }
}

/* telas baixas (celular deitado) */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding-top: 6px; padding-bottom: 6px; }
  .controls { padding-top: 6px; padding-bottom: calc(6px + var(--safe-b)); }
  .ctrl { height: 42px; }
  .ctrl-label { display: none; }
  .room.has-stage .tiles { height: var(--strip-h, 64px); }
  .view-center { justify-content: flex-start; }
}

@media (hover: none) {
  .tile.clickable:hover { border-color: var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .tile, .screen-tile, .card { animation: none !important; }
  .reaction-emoji { animation: none; }
}
