/* CallZinha: todos os estilos da página (antes ficavam dentro do index.html) */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1115;
  color: #eaeaea;
  min-height: 100vh;
}
/* ---- Tela de entrada ---- */
#joinScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}
#joinScreen h1 { font-size: 28px; margin-bottom: 8px; }
#joinScreen p.sub { color: #9aa0a6; margin-bottom: 28px; text-align: center; }
.card {
  background: #1a1d24;
  border: 1px solid #2a2e37;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.card label { display: block; font-size: 13px; color: #9aa0a6; margin-bottom: 6px; margin-top: 16px; }
.card label:first-child { margin-top: 0; }
.card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2a2e37;
  background: #0f1115;
  color: #eaeaea;
  font-size: 15px;
}
.card input:focus { outline: 2px solid #5b8cff; }
.row-btns { display: flex; gap: 10px; margin-top: 22px; }
button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 16px;
  transition: opacity .15s ease;
}
button:hover { opacity: .88; }
button:active { opacity: .7; }
.btn-primary { background: #5b8cff; color: white; flex: 1; }
.btn-ghost { background: #2a2e37; color: #eaeaea; }
#genRoomBtn { width: 100%; margin-top: 6px; }
#status { margin-top: 16px; font-size: 13px; color: #9aa0a6; text-align: center; min-height: 18px; }

/* ---- Tela da chamada ---- */
#callScreen { display: none; min-height: 100vh; flex-direction: column; }
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #14161c;
  border-bottom: 1px solid #2a2e37;
}
#topbar .roomInfo { font-size: 14px; color: #9aa0a6; }
#topbar .roomInfo b { color: #eaeaea; }
#copyLinkBtn { background: #2a2e37; color: #eaeaea; font-size: 13px; padding: 8px 12px; }

#mediaBanner {
  background: #20161a;
  border-bottom: 1px solid #d64545;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  align-content: start;
}
.tile {
  position: relative;
  background: #14161c;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16/10;
  border: 1px solid #2a2e37;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: none;
}
.tile video.has-video { display: block; }
.tile .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #2a2e37;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #9aa0a6;
}
.tile.avatar-tile { }
.tile video.has-video ~ .avatar { display: none; } /* com vídeo, a bolinha do nome não espreme a imagem */
.tile .tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(0,0,0,.55);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.tile .vol-control {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.55);
  padding: 4px 8px;
  border-radius: 8px;
}
.tile .vol-control span { font-size: 12px; }
.tile .vol-control input[type="range"] {
  width: 60px;
  accent-color: #5b8cff;
  cursor: pointer;
}
.tile .screen-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: rgba(91,140,255,.9);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  display: none;
}
.tile .volbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: #1a1d24;
}
.tile .volfill {
  height: 100%;
  width: 0%;
  background: #5b8cff;
  transition: width .08s linear;
}
.tile.speaking { border-color: #5b8cff; box-shadow: 0 0 0 2px #5b8cff55; }

#controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #14161c;
  border-top: 1px solid #2a2e37;
}
.ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a2e37;
  color: #eaeaea;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ctrl-btn.off { background: #d64545; }
.ctrl-btn.active { background: #5b8cff; }
.ctrl-btn.leave { background: #d64545; }
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1d24;
  border: 1px solid #2a2e37;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  display: none;
  max-width: 90vw;
  text-align: center;
}
/* ---- Celular / tela cheia ---- */
#joinScreen, #callScreen { min-height: 100dvh; }
#topbar { flex-wrap: wrap; gap: 8px; }
#toast { z-index: 2000; }
img.emoji { display: inline-block; width: 1.2em; height: 1.2em; margin: 0 .05em; vertical-align: -.22em; object-fit: contain; pointer-events: none; user-select: none; }
#updateBar { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 2100;
  display: flex; align-items: center; gap: 12px; max-width: 440px; padding: 10px 10px 10px 16px;
  background: var(--cz-surface-2); color: var(--cz-text); border: 1px solid var(--cz-line); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); font-size: 14px; }
#updateBar span { flex: 1; min-width: 0; }
#updateBar a { background: var(--cz-aqua); color: var(--cz-ink); font-weight: 700; text-decoration: none; padding: 7px 14px; border-radius: 10px; white-space: nowrap; }
#updateBar button { background: none; border: 0; color: var(--cz-muted); font-size: 22px; line-height: 1; padding: 2px 6px; cursor: pointer; }
.tile video.has-video { object-fit: contain; }
.tile-actions { position: absolute; right: 8px; bottom: 8px; display: none; gap: 8px; }
.tile.has-screen .tile-actions { display: flex; }
.tile-actions .act { width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; padding: 0; }
.tile:not(.theater) .act-rotate, .tile:not(.theater) .act-exit { display: none; }
.tile.theater .act-full { display: none; }
body.theater-open { overflow: hidden; }
.tile.theater { position: fixed; top: 0; left: 0; z-index: 1000; border: none; border-radius: 0; aspect-ratio: auto; background: #000; }

/* ================= v10: topo, estados, notificações ================= */
#topbar .topActions { display: flex; align-items: center; gap: 8px; }
.top-btn { background: #2a2e37; color: #eaeaea; font-size: 13px; padding: 8px 12px; }
#netBadge { display: none; font-size: 12px; padding: 7px 10px; border-radius: 10px; background: #2a2e37; color: #9aa0a6; }
#netBadge.good { color: #5fd38d; }
#netBadge.warn { color: #f5b942; }
#netBadge.bad  { color: #ff6b6b; }
#notices { position: fixed; top: 64px; right: 14px; z-index: 1500; display: flex; flex-direction: column; gap: 6px; pointer-events: none; max-width: min(320px, 80vw); }
.notice { background: rgba(26,29,36,.96); border: 1px solid #2a2e37; border-radius: 10px; padding: 8px 12px; font-size: 13px; animation: noticeIn .18s ease-out; }
@keyframes noticeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

#micAlert { display: none; background: #241d12; border-bottom: 1px solid #f5b942; padding: 9px 20px; font-size: 13px; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#micAlert.show { display: flex; }
#micAlert button { background: #f5b942; color: #1a1d24; padding: 6px 12px; font-size: 13px; }

.tile .state-badges { position: absolute; left: 10px; top: 36px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tile .sbadge { background: rgba(0,0,0,.62); border-radius: 8px; padding: 2px 7px; font-size: 11px; }
.tile .sbadge.muted { background: rgba(214,69,69,.85); }
.tile .sbadge.warn { background: rgba(245,185,66,.92); color: #1a1d24; }
.tile .sbadge.bad { background: rgba(214,69,69,.92); }
.tile.reconnecting video { opacity: .35; }
.tile.reconnecting .avatar { opacity: .5; }
.tile.pinned { border-color: #3d4a6b; }

/* ================= v10: layouts (grade / foco / lateral) ================= */
#grid.layout-focus { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
#grid.layout-focus .tile.focus { grid-column: 1 / -1; aspect-ratio: auto; height: calc(100dvh - 300px); min-height: 240px; }
#grid.layout-focus .tile:not(.focus) .vol-control { display: none; }
#grid.layout-focus .tile:not(.focus) .avatar { width: 40px; height: 40px; font-size: 16px; }
#grid.layout-side { grid-template-columns: minmax(0, 1fr) 190px; grid-auto-rows: min-content; gap: 8px; }
#grid.layout-side .tile.focus { grid-column: 1; grid-row: 1 / span 60; aspect-ratio: auto; height: calc(100dvh - 200px); min-height: 240px; }
#grid.layout-side .tile:not(.focus) { grid-column: 2; }
#grid.layout-side .tile:not(.focus) .vol-control { display: none; }
#grid.layout-side .tile:not(.focus) .avatar { width: 40px; height: 40px; font-size: 16px; }
@media (max-width: 700px) {
  #grid.layout-side { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  #grid.layout-side .tile.focus { grid-column: 1 / -1; grid-row: auto; height: calc(100dvh - 300px); }
  #grid.layout-side .tile:not(.focus) { grid-column: auto; }
}

/* ================= v10: painel de configurações ================= */
#settingsOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1800; }
#settingsPanel { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: #14161c; border-left: 1px solid #2a2e37; z-index: 1900; transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; visibility: hidden; }
body.settings-open #settingsOverlay { display: block; }
body.settings-open #settingsPanel { transform: none; visibility: visible; }
#settingsPanel header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #2a2e37; }
#settingsPanel header h2 { font-size: 16px; }
#settingsClose { background: #2a2e37; color: #eaeaea; padding: 6px 10px; font-size: 14px; }
#settingsBody { overflow-y: auto; padding: 4px 16px 24px; flex: 1; }
.sset { border-bottom: 1px solid #22252d; padding: 14px 0; }
.sset h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #9aa0a6; margin-bottom: 10px; }
.srow { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.srow > label, .srow .lbl { font-size: 13px; color: #c9ccd1; }
.srow .hint, .sset > .hint { font-size: 11px; color: #7b818a; line-height: 1.35; margin-bottom: 8px; }
#grid.layout-focus .tile:not(.focus) .tag, #grid.layout-side .tile:not(.focus) .tag { max-width: calc(100% - 16px); left: 8px; bottom: 8px; padding: 2px 6px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#grid.layout-focus .tile:not(.focus) .avatar, #grid.layout-side .tile:not(.focus) .avatar { margin-bottom: 14px; }
.srow select, .srow input[type="text"] { width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid #2a2e37; background: #0f1115; color: #eaeaea; font-size: 14px; }
.srow input[type="range"] { width: 100%; accent-color: #5b8cff; }
.srow.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.srow.inline input[type="checkbox"] { width: 18px; height: 18px; accent-color: #5b8cff; }
.sbtn { background: #2a2e37; color: #eaeaea; font-size: 13px; padding: 8px 12px; }
.sbtn.on { background: #5b8cff; color: #fff; }
#micMeter { position: relative; height: 10px; background: #0f1115; border: 1px solid #2a2e37; border-radius: 6px; overflow: hidden; }
#micMeterFill { height: 100%; width: 0%; background: #5fd38d; transition: width .06s linear; }
#micMeterGate { position: absolute; top: 0; bottom: 0; width: 2px; background: #f5b942; display: none; }
#micInfo, #screenInfo { font-size: 11px; color: #7b818a; }

/* ================= v10: diagnóstico ================= */
#diagPanel { display: none; position: fixed; left: 12px; bottom: 96px; width: min(460px, calc(100vw - 24px)); max-height: 50vh; overflow-y: auto; background: rgba(20,22,28,.97); border: 1px solid #2a2e37; border-radius: 12px; z-index: 1700; font-size: 12px; }
#diagPanel.show { display: block; }
#diagPanel .dhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #2a2e37; color: #9aa0a6; position: sticky; top: 0; background: #14161c; }
#diagPanel .dhead button { background: none; color: #9aa0a6; padding: 2px 6px; font-size: 14px; }
#diagPanel table { width: 100%; border-collapse: collapse; }
#diagPanel td, #diagPanel th { padding: 5px 10px; text-align: left; font-weight: 400; }
#diagPanel th { color: #7b818a; width: 46%; }
#diagPanel .peerhead td { color: #eaeaea; font-weight: 600; padding-top: 10px; border-top: 1px solid #22252d; }
#diagPanel .ok { color: #5fd38d; } #diagPanel .wn { color: #f5b942; } #diagPanel .bd { color: #ff6b6b; }
#diagPanel .dfoot { padding: 6px 12px 10px; color: #7b818a; font-size: 11px; }
@media (max-width: 520px) { #controls { gap: 8px; padding: 12px 8px; } .ctrl-btn { width: 46px; height: 46px; } }
/* ================= música compartilhada ================= */
#musicPanel { position: fixed; right: 12px; bottom: 96px; width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 120px); overflow-y: auto; background: rgba(20,22,28,.97); border: 1px solid #2a2e37; border-radius: 12px; z-index: 1750; font-size: 13px; }
#musicPanel.closed { visibility: hidden; pointer-events: none; }
#musicPanel .mhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #2a2e37; color: #9aa0a6; position: sticky; top: 0; background: #14161c; z-index: 1; }
#musicPanel .mhead button { background: none; color: #9aa0a6; padding: 2px 6px; font-size: 14px; }
#musicPanel .mhbtns { gap: 2px; }
#musicPanel .mgrip { width: 14px; height: 14px; margin-right: -4px; color: #5c626b; display: none; }
@media (min-width: 700px) { #musicPanel .mgrip { display: block; } #musicHead { cursor: grab; touch-action: none; user-select: none; } }
#musicPanel.dragging { opacity: .92; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
#musicPanel.dragging #musicHead { cursor: grabbing; }
#musicPanel.dragging iframe { pointer-events: none; }
#musicPanel.out-left, #musicPanel.out-right, #musicPanel.out-top, #musicPanel.out-bottom { outline: 2px dashed #5b8cff; outline-offset: 2px; }
#musicPopNote { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; color: #9aa0a6; font-size: 12px; }
#musicPopNote[hidden] { display: none; }
#musicPopBack { background: #2a2e37; color: #eaeaea; padding: 6px 10px; font-size: 12px; }
#musicPanel.pip { position: static; width: auto; max-height: none; border: 0; border-radius: 0; background: #14161c; }
#musicVideo { position: relative; aspect-ratio: 16 / 9; background: #0f1115; }
#musicVideo iframe, #musicPlayer { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#musicEmpty { position: absolute; inset: 0; z-index: 1; background: #0f1115; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #7b818a; font-size: 12px; }
#musicBody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
#musicTitle { color: #eaeaea; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#musicBy, #musicTime, #musicPanel .hint { color: #7b818a; font-size: 11px; }
#musicSeek, #musicVol { width: 100%; accent-color: #5b8cff; }
#musicPanel .mctrl { display: flex; align-items: center; gap: 6px; }
#musicPanel .mctrl button { background: #2a2e37; color: #eaeaea; padding: 6px 10px; font-size: 14px; }
#musicPanel .mctrl label { display: flex; align-items: center; gap: 6px; flex: 1; margin-left: 6px; color: #9aa0a6; }
#musicUnlock { background: #5b8cff; color: #fff; padding: 8px; }
#musicAddForm { display: flex; gap: 6px; }
#musicUrl { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 9px; border: 1px solid #2a2e37; background: #0f1115; color: #eaeaea; font-size: 13px; }
#musicAddForm button { background: #2a2e37; color: #eaeaea; padding: 8px 10px; font-size: 13px; }
#musicResults { list-style: none; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 10px; border: 1px solid #2a2e37; background: #0f1115; }
#musicResults[hidden] { display: none; }
#musicResults button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 6px 8px; border-radius: 8px; background: none; color: #eaeaea; font-size: 12.5px; font-weight: 500; text-align: left; }
#musicResults button:hover, #musicResults button:focus-visible { background: #22252d; opacity: 1; outline: none; }
#musicResults button small { color: #7b818a; font-size: 11px; font-weight: 400; }
#musicResults .mr-msg { padding: 6px 8px; color: #7b818a; font-size: 12px; }
#musicQueue { list-style: none; display: flex; flex-direction: column; gap: 2px; }
#musicQueue li { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; }
#musicQueue li.cur { background: #22252d; }
#musicQueue li.done { opacity: .5; }
#musicQueue .qt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9ccd1; }
#musicQueue .qb { color: #7b818a; font-size: 11px; white-space: nowrap; }
#musicQueue button { background: none; color: #9aa0a6; padding: 2px 5px; font-size: 12px; }
/* ================= ícones e botões ================= */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.ctrl-btn { width: 52px; height: 52px; border-radius: 16px; background: #1d2027; border: 1px solid #2a2e37; color: #e6e8eb; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease; }
.ctrl-btn:hover { opacity: 1; background: #262a33; border-color: #353a45; }
.ctrl-btn:active { opacity: 1; transform: scale(.95); }
.ctrl-btn .ic { width: 22px; height: 22px; }
.ctrl-btn.active { background: #5b8cff; border-color: #5b8cff; color: #fff; }
.ctrl-btn.off, .ctrl-btn.leave { background: #e5484d; border-color: #e5484d; color: #fff; }
.ctrl-btn.leave { width: 64px; }
.ctrl-btn.leave:hover, .ctrl-btn.off:hover { background: #f05a5f; border-color: #f05a5f; }
#micBtn.active { background: #1d2027; border-color: #2a2e37; color: #e6e8eb; }   /* microfone ligado é o normal: só o mudo chama atenção */
.ctrl-btn.on { color: #8fb0ff; border-color: #3d4a6b; }
.top-btn, #copyLinkBtn, #netBadge { display: inline-flex; align-items: center; gap: 6px; }
.tile .vol-control .ic { width: 14px; height: 14px; }
.tile .screen-badge .ic, .tile .sbadge .ic { width: 12px; height: 12px; margin-right: 3px; }
.tile-actions .act { display: inline-flex; align-items: center; justify-content: center; }
.tile-actions .act .ic { width: 20px; height: 20px; }
#musicPanel .mctrl button, #musicPanel .mhead button, #chatPanel .chead button, #diagPanel .dhead button, #musicQueue button { display: inline-flex; align-items: center; justify-content: center; }
#musicPanel .mhead span, #chatPanel .chead span, #diagPanel .dhead span { display: inline-flex; align-items: center; gap: 8px; }
#musicQueue button .ic { width: 14px; height: 14px; }
#musicUnlock { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#joinScreen h1 { display: flex; align-items: center; gap: 10px; }
#joinScreen h1 .ic { width: 30px; height: 30px; color: #5b8cff; }
#genRoomBtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#settingsPanel header h2 { display: inline-flex; align-items: center; gap: 8px; }
/* ================= visuais da sala: Cinema, Roda e Ao vivo ================= */
/* participantes em cartões (em todos os visuais); a tela compartilhada continua sendo o palco */
#grid .tile:not(.focus) { width: var(--card-w, 242px); height: var(--card-h, 178px); aspect-ratio: auto; background: #151a24; border: 1px solid #232a37; border-radius: 16px; overflow: visible; flex-direction: column; padding: 0; box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease; }
#grid .tile:not(.focus) video { display: none !important; }
#grid .tile:not(.focus) .avatar { display: flex !important; width: var(--av, 64px); height: var(--av, 64px); font-size: calc(var(--av, 64px) * .36); margin: 0 0 var(--av-gap, 18px); background: var(--av-bg, #2a3558); color: var(--av-fg, #c7d4ff); }
#grid .tile:not(.focus) .screen-badge, #grid .tile:not(.focus) .tile-actions { display: none !important; }
#grid .tile:not(.focus) .vol-control { opacity: 0; transition: opacity .15s ease; }
#grid .tile:not(.focus):hover .vol-control, #grid .tile:not(.focus):focus-within .vol-control { opacity: 1; }
#grid .tile:not(.focus) .state-badges { top: 10px; }
#grid .tile.focus { border-radius: 16px; aspect-ratio: auto; order: -1; }   /* o palco vem sempre primeiro */
/* sem palco: cartões no centro */
#grid:not(.has-stage) { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 14px; }
/* Cinema: palco grande, pessoas numa coluna fina, barra de botões flutuante que some com o mouse parado */
body.v-cinema #callScreen { height: 100dvh; }
body.v-cinema #grid { min-height: 0; }
body.v-cinema #grid.has-stage { display: grid; grid-template-columns: repeat(var(--stages, 1), minmax(0, 1fr)) 168px; grid-template-rows: repeat(8, min-content) minmax(0, 1fr); gap: 2px 12px; padding: 12px; overflow: hidden; }
body.v-cinema #grid.has-stage .tile.focus { grid-row: 1 / -1; height: 100%; }   /* várias telas: uma coluna para cada */
body.v-cinema #grid.multi-stage .tile.focus { height: auto; max-height: 100%; aspect-ratio: 16 / 9; align-self: center; }
body.v-cinema #grid.has-stage .tile:not(.focus) { grid-column: -2 / -1; --card-w: 100%; --card-h: 104px; --av: 40px; --av-gap: 22px; margin-bottom: 8px; }
body.v-cinema #grid.has-stage .tile:not(.focus) .tag { font-size: 11px; }
body.v-cinema #grid.has-stage .tile:not(.focus) .sbadge, body.v-live #grid.has-stage .tile:not(.focus) .sbadge { font-size: 10px; white-space: nowrap; padding: 1px 5px; }
body.v-cinema #controls { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 8px 10px; border: 1px solid #2a2e37; border-radius: 22px; background: rgba(20,22,28,.94); z-index: 900; transition: opacity .4s ease; }
body.v-cinema.idle #controls { opacity: 0; pointer-events: none; }
body.v-cinema #shortcutHint { display: none; }
/* Roda: bolinhas grandes; se alguém compartilhar a tela, ela aparece em cima */
body.v-roda #grid.has-stage { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 6px 28px; }
body.v-roda #grid.has-stage .tile.focus { flex: 0 0 100%; height: calc(100dvh - 330px); min-height: 240px; }
body.v-roda #grid.multi-stage .tile.focus { flex: 1 1 calc(50% - 14px); max-width: calc(50% - 14px); min-width: 0; }   /* duas ou mais telas: lado a lado */
body.v-roda #grid.has-stage .tile:not(.focus) { --card-w: 180px; --card-h: 124px; --av: 46px; }
/* Ao vivo (celular): vídeo em cima, pessoas numa linha, chat sempre aberto embaixo */
body.v-live #callScreen { height: 100dvh; min-height: 0; }
body.v-live #topbar { padding: 8px 12px; flex-wrap: nowrap; }
body.v-live #topbar .txt, body.v-live #netBadge { display: none !important; }
body.v-live #grid { flex: none; max-height: 56dvh; overflow-y: auto; gap: 10px; padding: 10px; }
body.v-live #grid:not(.has-stage) .tile { --card-w: calc(50% - 7px); --card-h: 132px; --av: 52px; }
body.v-live #grid.has-stage { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; }
body.v-live #grid.has-stage .tile.focus { flex: 0 0 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 12px; }
body.v-live #grid.has-stage .tile:not(.focus) { --card-w: calc(33.333% - 7px); --card-h: 88px; --av: 34px; --av-gap: 20px; }
body.v-live #grid.has-stage .tile:not(.focus) .tag { font-size: 11px; }
body.v-live:not(.theater-open) #chatPanel { position: static; flex: 1; min-height: 120px; width: auto; height: auto; border: none; border-top: 1px solid #2a2e37; border-radius: 0; background: #0f1115; z-index: auto; }
body.v-live:not(.theater-open) #chatPanel .chead { display: none; }
body.v-live #chatBtn, body.v-live #shortcutHint { display: none; }
body.v-live #controls { padding: 8px; gap: 6px; }
body.v-live:not(.theater-open) #reactBar { left: auto; right: 8px; top: auto; bottom: 150px; transform: none; flex-direction: row; gap: 4px; }
body.v-live:not(.theater-open) #reactBar button { width: 34px; height: 34px; font-size: 18px; }
body.v-live #grid .tile.focus .screen-badge, body.v-live #grid .tile.focus .state-badges { display: none !important; }
body.v-live:not(.theater-open) #notices { display: none; }
/* reação aparece em cima de quem reagiu */
.tile .rbubble { position: absolute; top: -14px; left: 50%; font-size: 28px; line-height: 1; pointer-events: none; z-index: 4; animation: rbub 1.8s ease-out forwards; }
@keyframes rbub { 0% { transform: translate(-50%, 6px) scale(.4); opacity: 0; } 15% { transform: translate(-50%, -6px) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -22px) scale(1); opacity: 0; } }
/* música tocando: cartãozinho no canto (Cinema e Roda) */
#nowPlaying { position: fixed; left: 16px; bottom: 96px; z-index: 800; display: none; align-items: center; gap: 8px; max-width: min(300px, calc(100vw - 32px)); padding: 8px 12px; border-radius: 12px; border: 1px solid #2a2e37; background: rgba(20,22,28,.94); color: #c9ccd1; font-size: 12px; font-weight: 400; transition: opacity .4s ease; }
#nowPlaying .ic { color: #8fb0ff; }
#nowPlaying span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nowPlaying.show { display: inline-flex; }
body.v-cinema #nowPlaying { bottom: 18px; }
body.v-cinema.idle #nowPlaying { opacity: 0; pointer-events: none; }
body.v-live #nowPlaying, body.theater-open #nowPlaying { display: none; }
/* iPhone pela Tela de Início: a página vai até as bordas (viewport-fit=cover);
   só os controles se afastam do relógio e da barrinha de baixo */
@supports (padding: max(0px)) {
  #topbar { padding-top: max(14px, env(safe-area-inset-top)); padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  body.v-live #topbar { padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  #controls { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  body.v-live #controls { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  body.v-cinema #controls { padding-bottom: 8px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  #joinScreen { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  #settingsPanel header { padding-top: max(14px, env(safe-area-inset-top)); }
  .tile.theater .tile-actions { bottom: max(8px, env(safe-area-inset-bottom)); right: max(8px, env(safe-area-inset-right)); }
}
/* ================= redesign: cartões, barra com legendas e cabeçalho ================= */
/* nome em pílula no canto do cartão; reticências só quando não cabe */
.tile .tag { left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 4px 10px; border-radius: 999px; background: rgba(10,13,19,.72); font-size: 12px; }
.tile .tag .nm { flex: 0 1 auto; min-width: 2.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #f2f4f8; }
.tile .tag .st { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #8b93a3; white-space: nowrap; }   /* a situação encolhe antes do nome */
.tile .tag .st:empty { display: none; }
/* mini equalizador de quem fala (altura segue o nível de áudio já medido) */
.tile .tag .eq { display: none; flex: none; align-items: flex-end; gap: 2px; height: 12px; }
.tile .tag .eq i { width: 2px; border-radius: 1px; background: #3ddc97; transition: height .08s linear; }
.tile .tag .eq i:nth-child(1) { height: calc(3px + var(--lvl, 0) * 7px); }
.tile .tag .eq i:nth-child(2) { height: calc(4px + var(--lvl, 0) * 8px); }
.tile .tag .eq i:nth-child(3) { height: calc(3px + var(--lvl, 0) * 5px); }
.tile.speaking .tag .eq { display: inline-flex; }
/* microfone no canto: vermelho quando mutado, verde quando fala */
.tile .micst { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(10,13,19,.6); color: #c9ccd1; }
.tile .micst .ic { width: 13px; height: 13px; }
.tile.is-muted .micst { background: #e5484d; color: #fff; }
.tile.speaking .micst { color: #3ddc97; }
.tile.theater .micst { display: none; }
.tile .vol-control { right: 42px; }
.tile .volbar { display: none; }
.tile.speaking { border-color: #3ddc97 !important; box-shadow: 0 0 0 1px #3ddc97, 0 0 22px rgba(61,220,151,.28) !important; }
/* barra de controles: botões com legenda, em grupos, "Sair" separado */
#controls { align-self: center; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: calc(100% - 24px); margin: 0 auto 6px; padding: 8px 10px; border: 1px solid #222937; border-radius: 18px; background: #121722; }
.cgroup { display: flex; gap: 2px; }
.cdiv { width: 1px; height: 30px; background: #232a37; margin: 0 6px; }
#controls .ctrl-btn, #controls .ctrl-btn.active, #controls .ctrl-btn.off, #controls .ctrl-btn.leave { width: auto; min-width: 50px; height: auto; padding: 2px 4px; border: none; border-radius: 10px; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #e6e8eb; transform: none; }
#controls .ctrl-btn .cb-ic { position: relative; width: 36px; height: 34px; border-radius: 10px; border: 1px solid #262e3d; background: #1c2230; display: flex; align-items: center; justify-content: center; transition: background .15s ease, border-color .15s ease, transform .08s ease; }
#controls .ctrl-btn:hover .cb-ic { background: #242b3b; border-color: #313a4d; }
#controls .ctrl-btn:active .cb-ic { transform: scale(.94); }
#controls .ctrl-btn .ic { width: 18px; height: 18px; }
#controls .cb-lbl { font-size: 10.5px; font-weight: 500; color: #9aa3b2; white-space: nowrap; }
#controls .ctrl-btn.active .cb-ic { background: #5b8cff; border-color: #5b8cff; color: #fff; }
#controls .ctrl-btn.active .cb-lbl { color: #c9d6ff; }
#controls #micBtn.active .cb-ic { background: #1c2230; border-color: #262e3d; color: #e6e8eb; }
#controls #micBtn.active .cb-lbl { color: #9aa3b2; }
#controls .ctrl-btn.off .cb-ic { background: #e5484d; border-color: #e5484d; color: #fff; }
#controls .ctrl-btn.off .cb-lbl { color: #ff8a8d; }
#controls .ctrl-btn.on .cb-ic { color: #8fb0ff; border-color: #3d4a6b; }
#controls .ctrl-btn.leave { min-width: 62px; }
#controls .ctrl-btn.leave .cb-ic { width: 46px; background: #e5484d; border-color: #e5484d; color: #fff; }
#controls .ctrl-btn.leave:hover .cb-ic { background: #f05a5f; border-color: #f05a5f; }
#controls .ctrl-btn.leave .cb-lbl { color: #ff6b6f; }
#controls #chatBadge { top: -7px; right: -8px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; border: 2px solid #121722; background: #5b8cff; color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; }
body.v-cinema #controls { margin: 0; border-radius: 18px; background: rgba(18,23,34,.95); }
body.v-live #controls #chatBtn { display: none; }
#controls #swapScreenBtn:not(.show) { display: none; }   /* "Trocar" só aparece enquanto você compartilha */   /* no Ao vivo o chat já fica aberto */
body.v-live #grid.has-stage .tile:not(.focus) .tag .st { display: none; }
/* cabeçalho: chip da sala, pessoas + conexão, seletor de visual e "Copiar link" */
#topbar { background: #0f131b; border-bottom: 1px solid #1c2230; }
.roomInfo { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.roomChip { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 11px; border-radius: 10px; border: 1px solid #232a37; background: #151a24; font-size: 12px; color: #8b93a3; }
.roomChip b { font-size: 14px; color: #f2f4f8; }
.roomMeta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #9aa3b2; white-space: nowrap; }
.cdot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; flex: none; }
.cdot.warn { background: #f5b942; } .cdot.bad { background: #ff6b6b; }
#topbar #netBadge { padding: 0; border: none; border-radius: 0; background: none; color: #9aa3b2; font-size: 12px; font-weight: 400; }
#topbar #netBadge::before { content: '·'; margin: 0 6px 0 2px; }
#topbar #netBadge:hover { color: #c9ccd1; opacity: 1; }
#topbar #netBadge.warn { color: #f5b942; } #topbar #netBadge.bad { color: #ff6b6b; }
#visualBtn { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid #232a37; background: #151a24; font-weight: 600; }
#copyLinkBtn { height: 38px; padding: 0 14px; border-radius: 10px; background: #7c9bff; color: #0b1430; font-weight: 600; }
#copyLinkBtn:hover { background: #8fa9ff; opacity: 1; }
/* celular: cartões e barra quebram em linhas, sem rolagem para o lado */
@media (max-width: 520px) {
  #grid:not(.has-stage) .tile:not(.focus) { --card-w: calc(50% - 7px); --card-h: 140px; --av: 52px; }
  .cdiv { display: none; }
  #controls { gap: 2px; padding: 6px; max-width: calc(100% - 16px); border-radius: 16px; }
  #controls .ctrl-btn, #controls .ctrl-btn.active, #controls .ctrl-btn.off, #controls .ctrl-btn.leave { min-width: 44px; padding: 2px; }
  #controls .ctrl-btn.leave { min-width: 54px; }
  #controls .cb-lbl { font-size: 10px; }
  #topbar { gap: 8px; }
}
/* menu de visual (lista suspensa no topo) */
.vwrap { position: relative; }
#visualBtn .ic:last-child { width: 14px; height: 14px; color: #9aa0a6; }
.vmenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 1800; width: 292px; max-width: calc(100vw - 24px); padding: 6px; border-radius: 12px; border: 1px solid #2a2e37; background: #1a1d24; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.vmenu[hidden] { display: none; }
@media (max-width: 520px) { .vmenu { position: fixed; left: 12px; right: 12px; width: auto; max-width: none; } }
.vitem { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 9px; background: none; color: #eaeaea; text-align: left; font-weight: 400; }
.vitem:hover, .vitem:focus-visible { background: #22252d; opacity: 1; outline: none; }
.vitem > .ic { width: 20px; height: 20px; color: #9aa0a6; }
.vitem .vtx { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vitem b { font-size: 14px; font-weight: 600; }
.vitem small { font-size: 12px; color: #7b818a; }
.vitem .vcheck { visibility: hidden; color: #8fb0ff; width: 18px; height: 18px; }
.vitem.sel { background: rgba(91,140,255,.14); }
.vitem.sel > .ic:first-child, .vitem.sel b { color: #8fb0ff; }
.vitem.sel .vcheck { visibility: visible; }
.vsep { height: 1px; background: #2a2e37; margin: 6px 4px; }
.vauto { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px 8px; font-size: 13px; color: #c9ccd1; cursor: pointer; }
.vauto small { display: block; font-size: 11px; color: #7b818a; margin-top: 2px; }
.vauto input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px; background: #2a2e37; cursor: pointer; transition: background .15s ease; }
.vauto input::before { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #eaeaea; transition: transform .15s ease; }
.vauto input:checked { background: #5b8cff; }
.vauto input:checked::before { transform: translateX(16px); }
/* ================= chat, reações e tela cheia ================= */
.ctrl-btn { position: relative; }
#chatBadge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d64545; color: #fff; font-size: 11px; line-height: 18px; display: none; }
#chatPanel { position: fixed; right: 12px; bottom: 96px; width: min(340px, calc(100vw - 24px)); height: min(460px, calc(100dvh - 120px)); display: flex; flex-direction: column; background: rgba(20,22,28,.97); border: 1px solid #2a2e37; border-radius: 12px; z-index: 1760; font-size: 13px; }
#chatPanel.closed { display: none; }
#chatPanel .chead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #2a2e37; color: #9aa0a6; }
#chatPanel .chead button { background: none; color: #9aa0a6; padding: 2px 6px; font-size: 14px; }
#chatLog { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 7px; }
#chatLog:empty::before { content: 'Nenhuma mensagem ainda. Escreva abaixo; todo mundo da sala vê.'; color: #7b818a; font-size: 12px; margin: auto; text-align: center; }
.cmsg .cwho { color: #8fb0ff; font-weight: 600; }
.cmsg.me .cwho { color: #5fd38d; }
.cmsg .ctime { color: #7b818a; font-size: 10px; margin-left: 6px; }
.cmsg .ctext { color: #eaeaea; white-space: pre-wrap; overflow-wrap: anywhere; }
#chatForm { display: flex; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid #2a2e37; }
#chatInput { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 9px; border: 1px solid #2a2e37; background: #0f1115; color: #eaeaea; font-size: 13px; }
#chatForm button { background: #5b8cff; color: #fff; padding: 8px 12px; font-size: 13px; }
.cmsg.sys { color: #c9b8ff; font-size: 12px; text-align: center; padding: 2px 0; }
.cmsg.sys .ctime { margin-left: 4px; }
#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 1780; }
#fxLayer > * { pointer-events: auto; }
#chatPanel .chint { padding: 0 12px 10px; color: #7b818a; font-size: 11px; }
/* tela cheia: o chat fica translúcido por cima do vídeo */
body.theater-open #chatPanel { background: rgba(12,13,17,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); bottom: 74px; }
/* reações: botões quase transparentes, somem quando o mouse fica parado */
#reactBar { position: fixed; left: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 1600; opacity: .4; transition: opacity .4s; }
#reactBar:hover { opacity: 1; }
#reactBar button { width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.28); font-size: 22px; padding: 0; }
body.idle #reactBar { opacity: 0; pointer-events: none; }
body.react-off #reactBar { display: none; }
#reactLayer { position: fixed; inset: 0; pointer-events: none; z-index: 1650; overflow: hidden; }
#reactLayer .fly { position: absolute; bottom: 60px; display: flex; flex-direction: column; align-items: center; animation: reactFly 3.2s ease-out forwards; }
#reactLayer .fly span { font-size: 44px; line-height: 1; }
#reactLayer .fly small { font-size: 11px; color: #fff; background: rgba(0,0,0,.45); padding: 1px 6px; border-radius: 6px; margin-top: 2px; }
@keyframes reactFly { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 12% { transform: translate(0, -30px) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(var(--dx, 0), -62vh) scale(1); opacity: 0; } }
/* tela cheia limpa: sem bordas nem etiquetas; os botões somem junto com o cursor */
.tile.theater .volbar, .tile.theater .screen-badge, .tile.theater .state-badges { display: none !important; }
.tile.theater .tag, .tile.theater .vol-control, .tile.theater .tile-actions { transition: opacity .4s; }
body.idle .tile.theater .tag, body.idle .tile.theater .vol-control, body.idle .tile.theater .tile-actions { opacity: 0; pointer-events: none; }
body.theater-open.idle, body.theater-open.idle * { cursor: none; }
.tile:not(.theater) .act-chat { display: none; }
@media (max-width: 420px) { #controls { gap: 6px; } .ctrl-btn { width: 42px; height: 42px; border-radius: 13px; } .ctrl-btn .ic { width: 20px; height: 20px; } .ctrl-btn.leave { width: 50px; } #reactBar { left: 6px; } #reactBar button { width: 38px; height: 38px; font-size: 20px; } }
/* ================= estilo Cápsula (inspirado no Discord, com cara própria) ================= */
/* fundo grafite, cabeçalho só com uma etiqueta no meio */
#callScreen { background: #101216; }
#topbar { position: relative; justify-content: flex-end; min-height: 58px; background: transparent; border-bottom: none; }
#topbar .roomInfo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); gap: 8px; padding: 5px 14px; border-radius: 999px; background: #181b21; white-space: nowrap; }
#topbar .roomChip { padding: 0; border: none; background: none; gap: 6px; }
#topbar .roomChip b { font-size: 13px; }
#topbar .roomMeta { gap: 6px; }
#gamesBtn, #extrasBtn, #visualBtn, #copyLinkBtn { height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: #c8ccd4; font-weight: 500; }
#gamesBtn:hover, #extrasBtn:hover, #visualBtn:hover, #copyLinkBtn:hover { background: #181b21; opacity: 1; }
#extrasBtn.active { background: #181b21; color: #c9b8ff; }
#gamesBtn.active { background: #181b21; color: #3ddc97; }
#gamesBtn.loading .ic { animation: fxPulse .8s ease-in-out infinite; }
@keyframes fxPulse { 50% { opacity: .35; } }
#shortcutHint { display: none; }
/* cartões tingidos com a cor de cada pessoa; quem está mudo fica apagado em vez de ganhar selo vermelho */
#grid .tile:not(.focus) { border: none; border-radius: 20px; background: #171a21; background: color-mix(in srgb, var(--av-bg, #2a3558) 55%, #101216); transition: opacity .2s ease, box-shadow .15s ease; }
#grid .tile.is-muted:not(.focus):not(.speaking) { opacity: .6; }
#grid .tile.focus { border-radius: 20px; border-color: #1c2028; }
.tile.speaking { border-color: transparent !important; box-shadow: inset 0 0 0 1.5px #3ddc97, 0 0 20px rgba(61,220,151,.18) !important; }
#grid .tile.focus.speaking { box-shadow: 0 0 0 1.5px #3ddc97, 0 0 20px rgba(61,220,151,.18) !important; }
/* nome sem pílula, só o texto no canto; o mic riscado aparece ao lado do nome quando mudo */
#grid .tile:not(.focus) .tag { left: 12px; bottom: 10px; padding: 0; background: none; font-size: 12px; }
#grid .tile:not(.focus) .tag .nm { font-weight: 500; color: #dfe2e8; }
#grid .tile:not(.focus) .tag .st { color: #8b93a3; }
#grid .tile:not(.focus) .micst { display: none; }
#grid .tile.is-muted:not(.focus) .micst { display: flex; top: auto; right: auto; left: 8px; bottom: 8px; width: 18px; height: 18px; background: none; color: #9aa1ad; }
#grid .tile.is-muted:not(.focus) .tag { left: 28px; }
/* barra: uma cápsula só, com ícones redondos; legenda vira dica (continua para leitores de tela) */
#controls { gap: 2px; padding: 5px; border: none; border-radius: 999px; background: #181b21; }
#controls .cgroup { gap: 2px; }
#controls .cdiv { display: none; }
#controls .cdiv:last-of-type { display: block; height: 20px; margin: 0 6px; background: #2a2f38; }
#controls .ctrl-btn, #controls .ctrl-btn.active, #controls .ctrl-btn.off, #controls .ctrl-btn.leave { min-width: 0; padding: 0; gap: 0; }
#controls .cb-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#controls .ctrl-btn .cb-ic { width: 40px; height: 40px; border: none; border-radius: 50%; background: transparent; color: #c8ccd4; }
#controls .ctrl-btn:hover .cb-ic { background: #232833; border: none; }
#controls .ctrl-btn.active .cb-ic { background: rgba(124,155,255,.18); color: #9db4ff; }
#controls #micBtn.active .cb-ic { background: transparent; color: #c8ccd4; }
#controls #micBtn.active:hover .cb-ic { background: #232833; }
#controls .ctrl-btn.off .cb-ic { background: rgba(229,72,77,.16); color: #ff6b6f; }
#controls .ctrl-btn.on .cb-ic { color: #9db4ff; }
#controls .ctrl-btn.leave .cb-ic { width: 52px; border-radius: 999px; background: #e5484d; color: #fff; }
#controls .ctrl-btn.leave:hover .cb-ic { background: #f05a5f; }
#controls .ctrl-btn .ic { width: 19px; height: 19px; }
#controls #chatBadge { top: 2px; right: 1px; border-color: #181b21; }
body.v-cinema #controls { background: rgba(24,27,33,.95); }
@media (max-width: 700px) {
  #topbar { justify-content: space-between; }
  #topbar .roomInfo { position: static; transform: none; white-space: normal; border-radius: 14px; }
}
@media (max-width: 420px) {
  #controls { padding: 4px; }
  #controls .ctrl-btn .cb-ic { width: 36px; height: 36px; }
  #controls .ctrl-btn.leave .cb-ic { width: 46px; }
  #controls .cdiv:last-of-type { margin: 0 3px; }
  #topbar .roomMeta #netBadge { display: none !important; }
}
/* celular com Cinema ou Roda escolhidos à mão: telas uma embaixo da outra, pessoas em cartões pequenos embaixo */
@media (max-width: 700px) {
  body.v-cinema #grid.has-stage, body.v-roda #grid.has-stage { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 10px; padding: 10px; overflow-y: auto; }
  body.v-cinema #grid.has-stage .tile.focus, body.v-roda #grid.has-stage .tile.focus, body.v-roda #grid.multi-stage .tile.focus { flex: 0 0 100%; max-width: 100%; height: auto; min-height: 0; max-height: none; aspect-ratio: 16 / 9; align-self: auto; }
  body.v-cinema #grid.has-stage .tile:not(.focus), body.v-roda #grid.has-stage .tile:not(.focus) { --card-w: calc(33.333% - 7px); --card-h: 88px; --av: 34px; --av-gap: 20px; margin-bottom: 0; }
  body.v-cinema #grid.has-stage .tile:not(.focus) .tag .st, body.v-roda #grid.has-stage .tile:not(.focus) .tag .st { display: none; }
  #grid .tile.focus .screen-badge, #grid .tile.focus .state-badges { display: none !important; }
  body.v-cinema #grid.has-stage { padding-bottom: 84px; }   /* espaço para a cápsula flutuante */
}
/* cápsula flutuante do Cinema centralizada sem translate: assim ela usa a largura toda antes de quebrar linha */
body.v-cinema #controls { left: 0; right: 0; transform: none; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); }
/* ================= identidade CallZinha (balão com a bandeira das Bahamas) =================
   Paleta da marca só na tela de entrada; dentro da sala aparece só a logo no canto. */
:root { --cz-bg: #080A0B; --cz-surface: #12171A; --cz-surface-2: #182024; --cz-line: #222c30;
        --cz-text: #EEF3F4; --cz-muted: #8FA0A6; --cz-aqua: #00BDBD; --cz-aqua-hi: #22D3D3; --cz-gold: #F5C000; --cz-ink: #05080A; }
/* logo */
.brand-mark { flex: none; }
.wordmark { font-family: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-weight: 900; letter-spacing: -0.02em; color: var(--cz-aqua); }
.wordmark b { font-weight: 900; color: var(--cz-gold); }
.brandMini { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; font-size: 17px; }
.brandMini .brand-mark { width: 30px; height: 30px; }
.brandMini .wordmark { display: none; }   /* na sala, só o balão: mais minimalista */
/* tela de entrada com a paleta da marca */
#joinScreen { background: var(--cz-bg); color: var(--cz-text); }
#joinScreen, #joinScreen button, #joinScreen input { font-family: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#joinScreen h1.brand { display: flex; align-items: center; gap: 12px; font-size: 40px; margin-bottom: 6px; }
#joinScreen h1.brand .brand-mark { width: 64px; height: 64px; }
#joinScreen p.sub { color: var(--cz-muted); font-weight: 600; }
#joinScreen p.ver { margin-top: 14px; color: var(--cz-muted); font-size: 12px; opacity: .75; text-align: center; letter-spacing: .02em; }
#joinScreen .card { background: var(--cz-surface); border-color: var(--cz-line); border-radius: 20px; }
#joinScreen .card label { color: var(--cz-muted); font-weight: 700; }
#joinScreen .card input { background: var(--cz-bg); border-color: var(--cz-line); border-radius: 12px; color: var(--cz-text); }
#joinScreen .card input:focus { outline: 2px solid var(--cz-aqua); border-color: transparent; }
#joinScreen button { border-radius: 12px; font-weight: 800; }
#joinScreen .btn-primary { background: var(--cz-aqua); color: var(--cz-ink); }
#joinScreen .btn-primary:hover { background: var(--cz-aqua-hi); opacity: 1; }
#joinScreen .btn-ghost { background: var(--cz-surface-2); color: var(--cz-text); border: 1px solid var(--cz-line); }
#joinScreen #status { color: var(--cz-muted); }
@media (max-width: 700px) {
  .brandMini { position: static; transform: none; }
  #joinScreen h1.brand { font-size: 34px; }
  #joinScreen h1.brand .brand-mark { width: 54px; height: 54px; }
}
/* ================= avatares, controles do anfitrião, vídeo no palco ================= */
.tile .avatar.has-pic { overflow: hidden; padding: 0; background: #1b1f27 !important; }
.avatar.has-pic img, .avatar.has-pic svg, .avprev img, .avprev svg { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.avpick { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 14px; padding: 8px; background: transparent; border: 1px dashed #2a3338; color: #c9d4d7; font-size: 14px; }
.avpick:hover { border-color: #00BDBD; opacity: 1; }
.avprev { width: 48px; height: 48px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: #182024; color: #9fe7e7; font-weight: 800; font-size: 17px; overflow: hidden; }
.czmodal { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.65); }
.czmodal[hidden] { display: none; }
.czbox { width: min(560px, 100%); max-height: 90dvh; overflow: auto; padding: 14px; border-radius: 18px; border: 1px solid #2a2e37; background: #14161c; color: #eaeaea; }
.czhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.czhead button { background: none; color: #9aa0a6; padding: 4px; }
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.avopt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; background: #1b1f27; border: 1px solid transparent; color: #c9ccd1; font-size: 11px; font-weight: 600; }
.avopt svg { width: 56px; height: 56px; }
.avopt:hover { border-color: #3d4a6b; opacity: 1; }
.avopt.sel { border-color: #5b8cff; background: rgba(91,140,255,.12); }
.avfoot { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.avfoot > * { flex: 1; text-align: center; cursor: pointer; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
/* controles do anfitrião: aparecem ao passar o mouse no cartão (no celular, sempre) */
.tile .hostctl { position: absolute; top: 10px; left: 10px; z-index: 3; display: none; gap: 4px; }
body.host .tile:not(#tile-local):hover .hostctl, body.host .tile:not(#tile-local):focus-within .hostctl { display: flex; }
@media (hover: none) { body.host .tile:not(#tile-local) .hostctl { display: flex; } }
.tile .hostctl button { width: 26px; height: 26px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(10,13,19,.75); color: #e6e8eb; }
.tile .hostctl button:hover { background: #e5484d; opacity: 1; }
.tile .hostctl .ic { width: 13px; height: 13px; }
.tile.theater .hostctl { display: none !important; }
/* "Áudio" (compartilhar só o som) */
#controls #audioShareBtn.active .cb-ic { background: rgba(124,155,255,.18); color: #9db4ff; }
/* vídeo do YouTube grande no palco (o player continua no mesmo lugar do código: só muda de posição na tela) */
#musicStageClose { display: none; }
body.yt-stage #musicVideo { position: fixed; z-index: 700; left: 12px; right: 12px; top: 64px; height: min(58dvh, calc((100vw - 24px) * 9 / 16)); border-radius: 18px; overflow: hidden; visibility: visible; pointer-events: auto; background: #000; box-shadow: 0 0 0 1px #2a2e37; }
body.yt-stage #grid { margin-top: calc(min(58dvh, (100vw - 24px) * 9 / 16) + 8px); }
body.yt-stage #musicStageClose { display: flex; position: absolute; top: 10px; right: 10px; z-index: 3; width: 32px; height: 32px; padding: 0; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; }
body.yt-stage.idle #musicStageClose { opacity: 0; }
#musicStageBtn.on { color: #9db4ff; }
/* quem está falando: anel verde em volta da bolinha, que cresce com o volume, e borda mais grossa no cartão */
.tile .avatar { transition: box-shadow .08s linear; }
.tile.speaking .avatar { box-shadow: 0 0 0 3px #3ddc97, 0 0 0 calc(4px + var(--lvl, 0) * 9px) rgba(61,220,151,.28), 0 0 24px rgba(61,220,151,.35); }
.tile.speaking { box-shadow: inset 0 0 0 2.5px #3ddc97, 0 0 26px rgba(61,220,151,.28) !important; }
#grid .tile.focus.speaking { box-shadow: 0 0 0 2.5px #3ddc97, 0 0 26px rgba(61,220,151,.28) !important; }
.tile.speaking .tag .nm { color: #3ddc97 !important; }
/* "falando agora": aparece quando os cartões ficam pequenos (tela compartilhada, vídeo no palco, tela cheia) */
#speakers { position: fixed; top: 62px; left: 50%; transform: translateX(-50%) translateY(-6px); z-index: 1550; display: flex; align-items: center; gap: 8px;
  max-width: min(520px, calc(100vw - 32px)); padding: 6px 14px 6px 10px; border-radius: 999px; background: rgba(12,16,22,.88); border: 1px solid rgba(61,220,151,.45);
  color: #e9fff4; font-size: 13px; font-weight: 600; pointer-events: none; opacity: 0; transition: opacity .18s ease, transform .18s ease; white-space: nowrap; }
#speakers.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#speakers .nm { overflow: hidden; text-overflow: ellipsis; }
#speakers .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
#speakers .eq i { width: 3px; border-radius: 2px; background: #3ddc97; animation: spkEq .7s ease-in-out infinite; }
#speakers .eq i:nth-child(2) { animation-delay: -.25s; } #speakers .eq i:nth-child(3) { animation-delay: -.5s; }
@keyframes spkEq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.tile.theater #speakers { position: absolute; top: 14px !important; }
@media (prefers-reduced-motion: reduce) { #speakers .eq i { animation: none; height: 10px; } }

/* Voltar para a call depois que a página recarregou sozinha */
#joinScreen .card.rejoin { margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; border-color: var(--cz-aqua); text-align: center; }
#joinScreen .card.rejoin[hidden] { display: none; }
#joinScreen .card.rejoin p { margin: 0; color: var(--cz-text); font-weight: 700; }
#joinScreen .card.rejoin button { width: 100%; }

/* ================= volume de cada pessoa: voz e som da tela, de 0 a 200% ================= */
.tile .vol-control span.vol-ic { cursor: pointer; display: inline-flex; }
.tile .vol-control .vol-lbl { font-size: 11px; font-weight: 700; color: #aeb8cc; min-width: 26px; }
.tile .vol-control .vol-pct { font-size: 11px; font-weight: 600; min-width: 34px; text-align: right; color: #cfd6e4; font-variant-numeric: tabular-nums; }
.tile .vol-control input[type="range"] { width: 72px; }
.tile .vol-control.boosted .vol-pct { color: #ffb454; }
.tile .vol-control.silent .vol-ic { opacity: .5; }
/* o controle do som da tela fica logo abaixo do da voz */
.tile .vol-control.vol-screen { top: 46px; }
/* tela cheia: os controles ficam maiores e sempre à vista (no celular não existe "passar o mouse"); somem junto com os outros botões quando ninguém mexe */
#grid .tile.theater .vol-control { opacity: 1; padding: 8px 12px; gap: 10px; }
#grid .tile.theater .vol-control input[type="range"] { width: 150px; height: 22px; }
#grid .tile.theater .vol-control .vol-pct { font-size: 13px; min-width: 42px; }
#grid .tile.theater .vol-control .vol-lbl { font-size: 13px; min-width: 34px; }
#grid .tile.theater .vol-control.vol-screen { top: 64px; }
body.idle #grid .tile.theater .vol-control { opacity: 0; pointer-events: none; }
