:root {
  color-scheme: dark;
  /* tons de ameixa, os mesmos das paredes do mapa */
  --bg: #1f1b29;
  --panel: #29243a;
  --card: #352f49;
  --line: #ffffff17;
  --text: #f1edf7;
  --muted: #a69ebb;
  --accent: #6c5ce7;
  --danger: #e05252;
  --ok: #4caf6a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* entrada */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #34306a, var(--bg) 70%); z-index: 50; padding: 16px; }
.card { background: var(--panel); border-radius: 16px; padding: 28px; width: min(380px, 100%); box-shadow: 0 20px 60px #0007; }
.card.login { width: min(680px, 100%); display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.preview-col { display: flex; flex-direction: column; align-items: center; gap: 8px; position: sticky; top: 0; align-self: start; }
.preview { width: 220px; height: 260px; border-radius: 14px; display: grid; place-items: center;
  background: repeating-linear-gradient(0deg, #c79a69 0 15px, #b4865a 15px 16px); box-shadow: inset 0 -30px 40px #0002; }
#preview { width: 220px; height: 210px; image-rendering: pixelated; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 5px 11px; cursor: pointer; font-size: 12px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.check { display: flex; gap: 8px; align-items: center; margin: -4px 0 18px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.overlay { overflow-y: auto; place-items: safe center; }
.card.login .fields-col { display: flex; flex-direction: column; justify-content: center; }
.card.login .secondary { margin: 0 0 12px; }
.secondary { padding: 11px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; font-weight: 600; }
.secondary:hover { filter: brightness(1.15); }

/* editor de avatar: categorias | opções e cores | prévia */
#avatar-dialog { border: 0; border-radius: 16px; padding: 0; width: min(920px, calc(100vw - 24px)); height: min(660px, calc(100vh - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; display: none; flex-direction: column; overflow: hidden; }
/* o tamanho é fixo: quem tem mais opções ou cores rola por dentro, o modal não cresce */
#avatar-dialog[open] { display: flex; }
#avatar-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
.ae-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ae-head h2 { margin: 0; font-size: 18px; }
.ae-body { display: grid; grid-template-columns: 200px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); gap: 16px; padding: 0 20px 0 0; min-height: 0; flex: 1; overflow: hidden; }
#ae-nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--line); background: #0000001a; overflow-y: auto; }
#ae-nav button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); cursor: pointer; font-size: 13px; text-align: left; }
#ae-nav button:hover { background: var(--card); }
#ae-nav button.on { background: var(--accent); color: #fff; }
#ae-nav canvas { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.ae-picker { display: flex; flex-direction: column; gap: 10px; padding: 20px 0; min-height: 0; }
#ae-grid { flex: 1; min-height: 0; overflow-y: auto; background: #00000026; border-radius: 12px; padding: 12px; }
#ae-grid h4 { margin: 4px 4px 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#ae-grid h4:not(:first-child) { margin-top: 14px; }
.ae-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.ae-options button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 10px; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ae-options button:hover { background: #ffffff0d; }
.ae-options button.on { border-color: var(--accent); background: #6c5ce726; }
.ae-options canvas { width: 78px; height: 78px; image-rendering: pixelated; }
.ae-hint { margin: 10px 4px 0; color: var(--muted); font-size: 12px; }
.ae-petname { display: flex; flex-direction: column; gap: 6px; margin: 14px 4px 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ae-petname input { font: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; max-width: 260px; }
.ae-petname input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.ae-petname small { font-size: 12px; letter-spacing: 0; text-transform: none; }
#ae-colors { flex: none; max-height: 168px; overflow-y: auto; background: #00000026; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ae-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ae-swatches > span { width: 100%; font-size: 12px; color: var(--muted); }
.ae-swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #00000040; cursor: pointer; padding: 0; }
.ae-swatches button.on { outline: 2px solid #fff; outline-offset: 2px; }
.ae-swatches .custom { position: relative; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid #00000040; background: conic-gradient(#e05252, #e0d03a, #4caf6a, #3aa6c9, #5266e0, #9b59d0, #e05252); display: grid; place-items: center; }
.ae-swatches .custom::after { content: "+"; color: #fff; font-weight: 800; font-size: 15px; line-height: 1; text-shadow: 0 1px 3px #000a; }
.ae-swatches .custom.on { outline: 2px solid #fff; outline-offset: 2px; }
.ae-swatches .custom.on::after { content: ""; }
.ae-swatches .custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ae-swatches button.none { background: linear-gradient(135deg, transparent 45%, var(--danger) 45% 55%, transparent 55%), var(--card); }
.ae-chips { display: flex; gap: 6px; }
.ae-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 4px 11px; cursor: pointer; font-size: 12px; color: var(--text); }
.ae-chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ae-stage { position: relative; margin: 20px 0; border-radius: 12px; overflow: hidden; align-self: start; width: 300px; height: 375px; }
#ae-stage { width: 300px; height: 375px; image-rendering: pixelated; display: block; }
.ae-tag { position: absolute; left: 50%; top: 168px; transform: translateX(-50%); background: #1f1b29e6; color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 8px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.ae-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.ae-float { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #1f1b29d9; color: #fff; cursor: pointer; display: grid; place-items: center; }
.ae-float:hover { background: #1f1b29; }
.ae-float svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ae-float.top { position: absolute; top: 10px; right: 10px; }
.ae-float-row { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.ae-float-row .grow { flex: 1; }
.ae-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.ae-foot button { width: auto; padding: 10px 18px; border: 0; border-radius: 8px; cursor: pointer; background: var(--card); color: var(--text); font: inherit; font-weight: 600; }
.ae-foot .primary { background: var(--accent); color: #fff; }
@media (max-width: 820px) {
  .ae-body { grid-template-columns: 1fr; grid-template-rows: none; padding: 0 14px; overflow-y: auto; }
  #ae-nav { flex-direction: row; overflow-x: auto; border-right: 0; background: none; padding: 10px 0 0; }
  #ae-nav button { flex: none; }
  .ae-stage { order: -1; justify-self: center; width: 200px; height: 250px; margin: 12px 0 0; }
  #ae-stage { width: 200px; height: 250px; }
  .ae-tag { top: 112px; }
  .ae-picker { padding: 0 0 12px; }
  #ae-grid { flex: none; overflow: visible; }
  #ae-colors { max-height: none; }
}
@media (max-width: 640px) {
  .card.login { grid-template-columns: 1fr; }
  .preview { width: 100%; height: 170px; }
  #preview { width: 141px; height: 134px; }
}
.card h1 { margin: 0; font-size: 24px; }
.card p { margin: 4px 0 18px; }
.field { display: block; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
.swatches { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: #fff; }
.swatches button.none { background: linear-gradient(135deg, transparent 45%, var(--danger) 45% 55%, transparent 55%), var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.primary { width: 100%; padding: 12px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
.primary:disabled { opacity: .6; cursor: default; }
.link { display: block; margin: 4px auto 0; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; }
#auth-status:not(:empty) { margin: 12px 0 0; }
#kicked .primary { margin-top: 4px; }

/* jogo */
/* --side: largura da faixa de ícones (56px) + barra lateral aberta (260px) */
body { --side: 0px; }
body.sidebar-open { --side: 316px; }
body.sidebar-collapsed { --side: 56px; }
/* --chat: espaço que o chat aberto ocupa à direita (300px + margem) */
body { --chat: 0px; }
body.chat-open { --chat: 312px; }
#game { position: fixed; inset: 0 0 0 var(--side); }
#game canvas { display: block; }

#zone { position: fixed; top: 12px; left: calc(var(--side) + 12px); background: #1f1b29cc; border: 1px solid var(--line); backdrop-filter: blur(4px); padding: 6px 12px; border-radius: 20px; font-size: 13px; pointer-events: none; }
#zone:empty { display: none; }
#zone.private::before { content: "🔒 "; }

/* vídeos de quem está perto */
#videos { position: fixed; top: 12px; left: calc(50% + var(--side) / 2); transform: translateX(-50%); display: flex; gap: 8px; max-width: calc(100vw - var(--side) - 260px); overflow-x: auto; z-index: 10; }
.tile { position: relative; width: 168px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--card); flex: none; cursor: pointer; border: 3px solid transparent; transition: border-color .15s; box-shadow: 0 4px 16px #0006; }
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; pointer-events: none; }
.tile audio { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.tile.conn-bad { outline: 2px dashed var(--danger); }
.tile.mirror video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; }
.tile .placeholder { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #fff; }
.tile.novideo video { visibility: hidden; }
.tile:not(.novideo) .placeholder { display: none; }
.tile .label { position: absolute; left: 6px; bottom: 6px; background: #000a; border-radius: 6px; padding: 2px 8px; font-size: 12px; display: flex; gap: 4px; align-items: center; max-width: calc(100% - 12px); }
.tile .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .muted-icon { width: 14px; height: 14px; color: var(--danger); display: none; flex: none; }
.tile.mic-off .muted-icon { display: block; }
.tile.spotlight { border-color: var(--accent); }

/* barra de rolagem da faixa de câmeras: fina, nas cores do tema, sem setinhas */
#videos { padding-bottom: 8px; }
#videos::-webkit-scrollbar { width: 8px; height: 8px; }
#videos::-webkit-scrollbar-track { background: transparent; }
#videos::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
#videos::-webkit-scrollbar-thumb { background: #ffffff30; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
#videos:hover::-webkit-scrollbar-thumb { background-color: #8f80e8cc; }
#videos::-webkit-scrollbar-thumb:active { background-color: var(--accent); }
@supports not selector(::-webkit-scrollbar) {
  #videos { scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; }
  #videos:hover { scrollbar-color: #8f80e8cc transparent; }
}

/* volume de cada pessoa: alto-falante no canto do quadro, aparece ao passar o mouse */
.tile .vol { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-direction: row-reverse; z-index: 2; pointer-events: none; }
.tile .vol > * { pointer-events: auto; }
.tile .vol-btn { width: 28px; height: 28px; flex: none; border: 0; border-radius: 8px; background: #000a; color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: 0; transition: opacity .15s, background .15s; backdrop-filter: blur(4px); }
.tile .vol svg { width: 16px; height: 16px; }
.tile .vol .cross { display: none; }
.tile:hover .vol-btn, .tile .vol.open .vol-btn, .tile.vol-changed .vol-btn { opacity: 1; }
.tile .vol-btn:hover, .tile .vol.open .vol-btn { background: var(--accent); }
.tile.vol-changed .vol-btn .wave2 { display: none; }
.tile.vol-zero .vol-btn :is(.wave1, .wave2) { display: none; }
.tile.vol-zero .vol-btn .cross { display: block; }
.tile.vol-zero .vol-btn { background: var(--danger); }
/* barra aberta: ocupa a largura do quadro, com fundo escuro legível sobre qualquer vídeo */
.tile .vol-pop { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 3px 4px; background: #14111ce6; border: 1px solid #ffffff1f; border-radius: 9px; box-shadow: 0 4px 14px #0008; backdrop-filter: blur(6px); animation: vol-in .14s ease-out; }
@keyframes vol-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.tile .vol-row { height: 22px; display: flex; align-items: center; gap: 6px; }
.tile .vol-all { display: flex; gap: 4px; }
.tile .vol-all button { flex: 1; min-width: 0; height: 22px; border: 0; border-radius: 6px; background: #ffffff14; color: #fff; font: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.tile .vol-all button:hover:not(:disabled) { background: var(--danger); }
.tile .vol-all button { display: flex; align-items: center; justify-content: center; gap: 4px; }
.tile .vol-all svg { width: 12px; height: 12px; flex: none; }
.tile .vol-all button:disabled { opacity: .35; cursor: default; }
.tile .vol-row button { width: 22px; height: 22px; flex: none; border: 0; border-radius: 6px; background: none; color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tile .vol-row button:hover { background: #ffffff1a; }
.tile .vol-row button svg { width: 14px; height: 14px; }
.tile .vol-row button.on { background: var(--danger); }
.tile .vol-mute.on :is(.wave1, .wave2) { display: none; }
.tile .vol-row button.on .cross { display: block; }
.tile .vol-pct { font-size: 10.5px; font-weight: 600; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
.tile .vol-pop input[type=range] { flex: 1; min-width: 30px; height: 16px; margin: 0; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
.tile .vol-pop input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--fill, 100%), #ffffff33 var(--fill, 100%)); }
.tile .vol-pop input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px #6c5ce766; }
.tile .vol-pop input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #ffffff33; }
.tile .vol-pop input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.tile .vol-pop input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px #6c5ce766; }
/* vídeo oculto só para mim: mostra a foto/inicial no lugar */
.tile.cam-hidden video { visibility: hidden; }
.tile.cam-hidden .placeholder { display: grid !important; }
body.mode-chat .tile .vol { display: none; }

/* clique num quadro ou entrar numa sala: câmeras abrem maiores, mapa desfocado atrás */
#videos-backdrop {
  position: fixed;
  inset: 0 0 0 var(--side);
  z-index: 9;
  background: radial-gradient(ellipse at 50% 45%, rgba(20, 21, 31, 0.55) 0%, rgba(20, 21, 31, 0.82) 55%, rgba(12, 13, 20, 0.96) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
body.cameras-open #videos-backdrop {
  opacity: 1;
  pointer-events: auto;
}
body.cameras-open #videos {
  top: 56px; bottom: 96px; left: calc(var(--side) + 24px); right: calc(var(--chat) + 24px);
  transform: none; max-width: none; max-height: none; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 12px;
  overflow: hidden; z-index: 12;
}
/* --tile-w: o maior tamanho em que todos os quadros cabem (calculado em ui.js) */
body.cameras-open .tile { width: var(--tile-w, 320px); flex: none; }
/* clicar numa câmera: ela abre em tela cheia; clicar de novo volta para a grade */
body.cameras-open .tile.spotlight {
  position: fixed; inset: 56px calc(var(--chat) + 24px) 96px calc(var(--side) + 24px);
  width: auto; aspect-ratio: auto; z-index: 40; box-shadow: 0 20px 60px #000a;
}
body.cameras-open .tile.spotlight video { object-fit: contain; background: #12131b; }
body.cameras-open .tile .avatar { width: 96px; height: 96px; font-size: 36px; }

/* barra inferior */
#toolbar { position: fixed; bottom: 16px; left: calc(50% + var(--side) / 2); transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: var(--panel); padding: 8px; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 10px 30px #0a050f88, inset 0 1px 0 #ffffff12; z-index: 20; }
#toolbar button { position: relative; height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: inset 0 -2px 0 #00000033; transition: transform .12s ease, filter .12s ease; }
#toolbar button:hover { filter: brightness(1.15); transform: translateY(-1px); }
#toolbar button:active { transform: translateY(1px); box-shadow: none; }
#toolbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#toolbar svg.slash { position: absolute; display: none; }
#toolbar button.off { background: var(--danger); }
#toolbar button.off svg.slash { display: block; }
#toolbar button.active { background: var(--accent); }
#toolbar #btn-focus svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#toolbar #btn-focus.focus { background: #3a8dde; color: #fff; box-shadow: 0 0 0 3px #3a8dde55; }
/* selo "Focus" no canto de cima, à esquerda, do quadro de quem está em Focus */
.tile .focus-badge { display: none; position: absolute; top: 6px; left: 6px; z-index: 3; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 10px; background: #3a8dde; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 2px 8px #0006; pointer-events: none; }
.tile .focus-badge svg { width: 13px; height: 13px; }
.tile.focus .focus-badge { display: inline-flex; }
.tile.focus { box-shadow: inset 0 0 0 2px #3a8dde; }
#toolbar button:disabled { opacity: .4; cursor: default; }
#toolbar .sep { width: 1px; height: 28px; background: var(--line); }
#unread { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }

/* painel lateral */
#panel { position: fixed; top: 12px; right: 12px; bottom: 84px; width: 300px; background: var(--panel); border-radius: 14px; display: flex; flex-direction: column; z-index: 30; box-shadow: 0 8px 30px #0008; overflow: hidden; }
#panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 14px 8px; }
#panel ul { list-style: none; margin: 0; padding: 0 8px; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#messages, #room-messages { flex: 1; overflow-y: auto; }
:is(#messages, #room-messages) li { padding: 4px 6px; line-height: 1.4; word-wrap: break-word; }
:is(#messages, #room-messages) b { margin-right: 6px; }
:is(#messages, #room-messages) time { color: var(--muted); font-size: 11px; margin-left: 4px; }
#chat-tabs { display: flex; gap: 4px; padding: 10px 10px 6px; }
#chat-tabs button { position: relative; flex: 1; min-width: 0; border: 0; border-radius: 8px; padding: 7px 10px; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-tabs button:hover { color: var(--text); }
#chat-tabs button.on { background: var(--card); color: var(--text); }
#chat-tabs #btn-panel-close { flex: none; width: 30px; padding: 0; }
#chat-tabs .tab-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
#chat-form { padding: 10px; }
#chat-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }

#https-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: #8b1e1e; color: #fff; padding: 10px 16px; text-align: center; font-size: 14px;
}
#https-banner a { color: #fff; font-weight: 700; }

#toasts { position: fixed; bottom: 84px; left: calc(var(--side) + 16px); display: flex; flex-direction: column; gap: 6px; z-index: 45; }
.toast { background: var(--panel); padding: 8px 14px; border-radius: 8px; box-shadow: 0 4px 16px #0008; animation: fade 4s forwards; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 700px) {
  body.chat-open { --chat: 0px; }
  #panel { left: 12px; width: auto; }
  #videos { max-width: calc(100vw - 24px); }
  .tile { width: 120px; }
}

/* ícone de tela no rótulo */
.tile .screen-icon { width: 14px; height: 14px; flex: none; display: none; }
.tile.screen .screen-icon { display: block; }
.tile.screen .muted-icon { display: none !important; }
.tile.screen video { background: #000; }

/* modo reunião: os vídeos ocupam a tela, o mapa fica escondido */
#meeting-bar { position: fixed; top: 0; left: var(--side); right: 0; height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; z-index: 15; }
#meeting-bar .room { font-weight: 600; font-size: 15px; }

body.meeting #game { visibility: hidden; }
body.meeting #panel { top: 60px; }

/* seletor mapa / grade (canto superior direito) */
#view-toggle { position: fixed; top: 10px; right: 12px; display: flex; gap: 2px; background: var(--panel); padding: 4px; border-radius: 10px; z-index: 35; box-shadow: 0 4px 16px #0006; }
#view-toggle button { width: 36px; height: 32px; border: 0; border-radius: 7px; background: none; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
#view-toggle button:hover { color: var(--text); }
#view-toggle button.on { background: var(--card); color: var(--text); }
#view-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#view-toggle:not([hidden]) ~ #panel { top: 56px; }
#view-toggle #btn-lock { width: auto; display: flex; align-items: center; gap: 6px; padding: 0 10px; margin-right: 4px; font: inherit; font-size: 12px; font-weight: 600; color: var(--text); background: var(--card); }
#view-toggle #btn-lock svg { width: 16px; height: 16px; stroke-width: 2; stroke-linecap: round; }
#view-toggle #btn-lock.locked { background: #f2b632; color: #2a1d00; }
#view-toggle #btn-leave { width: auto; padding: 0 12px; margin-right: 4px; font: inherit; font-size: 12px; font-weight: 600; color: #fff; background: var(--danger); }
body.meeting #zone { display: none; }
body.meeting #videos {
  top: 56px; bottom: 84px; left: calc(var(--side) + 16px); right: calc(var(--chat) + 16px); transform: none; max-width: none;
  display: grid; gap: 10px; overflow: hidden; align-content: stretch;
}
body.meeting .tile { width: auto; aspect-ratio: auto; min-height: 0; border-radius: 10px; box-shadow: none; }
/* na grade a imagem aparece inteira, sem cortar (e sem parecer zoom) */
body.meeting .tile video { object-fit: contain; background: #12131b; }
body.meeting .tile .avatar { width: 96px; height: 96px; font-size: 36px; }
body.meeting .tile .label { left: 10px; bottom: 10px; font-size: 13px; }
body.meeting .tile.spotlight { position: fixed; inset: 56px calc(var(--chat) + 16px) 84px calc(var(--side) + 16px); width: auto; z-index: 40; aspect-ratio: auto; }

/* reações */
.emote-wrap { position: relative; }
#emote-menu { position: absolute; bottom: 54px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; background: var(--panel); padding: 6px; border-radius: 12px; box-shadow: 0 8px 30px #0008; }
#emote-menu button { width: 40px; height: 40px; font-size: 20px; font-weight: 700; }
#emote-menu button[data-emote="heart"] { color: #ff4d6d; }
#emote-menu button[data-emote="star"] { color: #ffd23f; }
#emote-menu button[data-emote="exclaim"] { color: #ff8c42; }
#emote-menu button[data-emote="question"] { color: #5aa9ff; }
.gear-wrap { position: relative; }
#account-menu { position: fixed; min-width: 200px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; background: var(--panel); padding: 6px; border-radius: 12px; box-shadow: 0 8px 30px #0008; z-index: 40; }
#account-menu .who { display: flex; flex-direction: column; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
#account-menu button, #account-menu a { height: auto; border: 0; justify-content: flex-start; padding: 8px 10px; background: none; text-align: left; color: var(--text); text-decoration: none; border-radius: 8px; font-size: 13px; }
#account-menu button:hover, #account-menu a:hover { background: var(--card); filter: none; }

/* menu ao clicar em alguém */
#player-menu { position: fixed; z-index: 48; background: var(--panel); border-radius: 12px; padding: 8px; min-width: 190px; box-shadow: 0 10px 34px #000a; display: flex; flex-direction: column; gap: 4px; }
#player-menu .who { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; flex-wrap: wrap; }
#player-menu .who .dot { width: 10px; height: 10px; border-radius: 50%; }
#player-menu .who .muted { width: 100%; padding-left: 18px; }
#player-menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#player-menu button:hover { background: var(--card); }

/* convites (aceno) */
#requests { position: fixed; top: 64px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 47; }
.request { background: var(--panel); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 14px; width: 280px; box-shadow: 0 10px 34px #000a; animation: slide-in .25s ease-out; }
.request p { margin: 0 0 10px; }
.request .actions { display: flex; gap: 8px; }
.request button { flex: 1; border: 0; border-radius: 8px; padding: 8px; cursor: pointer; background: var(--card); }
.request button.primary { background: var(--accent); color: #fff; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* controles do mapa */
#map-controls { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); padding: 4px; border-radius: 10px; z-index: 20; box-shadow: 0 4px 16px #0006; }
#map-controls button { width: 36px; height: 34px; border: 0; border-radius: 7px; background: none; cursor: pointer; font-size: 20px; display: grid; place-items: center; }
#map-controls button:hover { background: var(--card); }
#map-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
body.meeting #map-controls { display: none; }

/* status: Ativo, Ocupado, Ausente */
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); display: inline-block; }
.status-dot.busy, body.st-busy #btn-status .status-dot { background: var(--danger); }
.status-dot.away, body.st-away #btn-status .status-dot { background: #8a90a6; }
.status-dot.lunch, body.st-lunch #btn-status .status-dot { background: #f08c2e; }
.status-wrap { position: relative; }
#toolbar #btn-status { width: 44px; padding: 0; background: none; box-shadow: none; }
#me-photo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; font-weight: 700; color: #fff; box-shadow: 0 0 0 2px #ffffff1a; }
#btn-status .status-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; box-shadow: 0 0 0 3px var(--panel); }

/* microfone e câmera com a setinha das opções grudada do lado */
.dev-wrap { position: relative; display: flex; }
#toolbar .dev-wrap > button:first-child { border-radius: 12px 0 0 12px; }
#toolbar .dev-wrap .caret { min-width: 22px; width: 22px; padding: 0; border-radius: 0 12px 12px 0; margin-left: 1px; }
#toolbar .dev-wrap .caret svg { width: 14px; height: 14px; stroke-width: 2.5; transition: transform .15s; }
#toolbar .dev-wrap .caret.open svg { transform: rotate(180deg); }
#toolbar .dev-wrap .caret:hover { transform: none; }
.dev-menu { position: absolute; bottom: 54px; left: 0; width: 300px; max-height: calc(100vh - 120px); overflow-y: auto; display: flex; flex-direction: column; background: var(--panel); padding: 6px; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 8px 30px #0008; z-index: 30; }
.dm-head { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); }
#toolbar .dev-menu .dm-item { height: auto; min-height: 36px; justify-content: flex-start; gap: 10px; padding: 7px 10px; background: none; box-shadow: none; border-radius: 8px; font-size: 13px; text-align: left; cursor: pointer; transform: none; }
#toolbar .dev-menu .dm-item:hover { background: var(--card); filter: none; }
.dm-item > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toolbar .dev-menu svg { width: 17px; height: 17px; flex: none; stroke-width: 1.8; }
#toolbar .dev-menu .dm-check { color: var(--accent); stroke-width: 2.5; visibility: hidden; }
#toolbar .dev-menu .dm-item[aria-checked="true"] .dm-check { visibility: visible; }
.dm-empty { display: flex; align-items: center; min-height: 36px; padding: 7px 10px 7px 37px; font-size: 13px; color: var(--muted); }
.dm-switch { display: flex; align-items: center; }
.dm-switch input { appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 10px; background: var(--card); position: relative; cursor: pointer; transition: background .15s; }
.dm-switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.dm-switch input:checked { background: var(--accent); }
.dm-switch input:checked::after { transform: translateX(16px); background: #fff; }
.dm-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dm-sep { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; width: auto; }
#status-menu { position: absolute; bottom: 54px; left: 0; min-width: 240px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); padding: 6px; border-radius: 12px; box-shadow: 0 8px 30px #0008; }
#toolbar #status-menu button { height: auto; justify-content: flex-start; gap: 10px; padding: 9px 10px; background: none; border-radius: 8px; font-size: 13px; }
#toolbar #status-menu button:hover, #toolbar #status-menu button.on { background: var(--card); filter: none; }
#status-menu .muted { margin-left: auto; }

/* Ocupado: degradê cinza por cima do mapa. Ausente: tela fechada. */
/* aviso para a empresa toda: fica por cima de tudo, até do Ocupado e do Ausente */
#announce { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: #0f0b18b3; backdrop-filter: blur(3px); }
.announce-card { width: min(720px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 20px 60px #000a; display: flex; flex-direction: column; gap: 10px; }
.announce-card header { display: flex; align-items: center; gap: 10px; min-width: 0; }
.announce-card header b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.announce-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.announce-card svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-an-min { border: 0; background: var(--card); border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.announce-stage { position: relative; aspect-ratio: 4 / 3; max-height: 60vh; background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.announce-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.announce-stage.mirror video { transform: scaleX(-1); }
.announce-stage.novideo video { display: none; }
.announce-stage:not(.novideo) .avatar { display: none; }
.announce-stage .avatar { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 44px; font-weight: 700; color: #fff; }
#an-status { margin: 0; text-align: center; color: var(--muted); }
/* contagem 3, 2, 1 antes do aviso entrar no ar */
#an-count { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; background: #0f0b1899; color: #fff; font-size: clamp(64px, 18vh, 160px); font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 6px 30px #000c; pointer-events: none; }
#an-count.tick { animation: count-beat 1s ease-out; }
#an-count.go { font-size: clamp(36px, 9vh, 72px); background: #e0525266; animation: count-go 1.5s ease-out forwards; }
@keyframes count-beat { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: .35; } }
@keyframes count-go { 0% { transform: scale(.8); opacity: 0; } 15% { transform: scale(1.05); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
#announce.small #an-count { font-size: 48px; }
#announce.small #an-count.go { font-size: 22px; }
#announce.live #an-status { color: var(--text); }
#announce.live .announce-badge { background: var(--danger); animation: announce-pulse 1.6s ease-in-out infinite; }
#btn-announce.active { background: var(--danger); }
@keyframes announce-pulse { 50% { filter: brightness(1.25); } }
/* diminuído: vira um quadro no canto e o escritório continua usável */
#announce.small { inset: auto 16px 84px auto; padding: 0; background: none; backdrop-filter: none; place-items: end; }
#announce.small .announce-card { width: min(300px, calc(100vw - 32px)); padding: 10px; gap: 8px; }
#announce.small .announce-stage .avatar { width: 64px; height: 64px; font-size: 24px; }
#announce.small #an-status { display: none; }
#btn-an-min .grow, #announce.small #btn-an-min .shrink { display: none; }
#announce.small #btn-an-min .grow { display: block; }
#status-overlay { position: fixed; inset: 0; z-index: 16; display: flex; justify-content: center; align-items: flex-start; padding: 72px 16px; pointer-events: none; }
body.st-busy #status-overlay { background: linear-gradient(180deg, #2a2d3ad9 0%, #4a4e5c99 45%, #6b6f7c66 100%); backdrop-filter: grayscale(1); }
body.st-away #status-overlay { z-index: 42; align-items: center; background: radial-gradient(circle at 50% 30%, #3a3d4c, var(--bg) 75%); pointer-events: auto; }
.status-card { pointer-events: auto; text-align: center; width: min(360px, 100%); }
.status-card h2 { margin: 0 0 6px; font-size: 20px; }
/* Almoçando: o mapa continua à vista (dá para se ver comendo), com um tom quente em cima */
body.st-lunch #status-overlay { background: linear-gradient(180deg, #3b2614d9 0%, #3b261466 30%, #3b261400 55%); }
body:is(.st-busy, .st-lunch) #toolbar button:is(#btn-mic, #btn-cam, #btn-screen) { opacity: .35; pointer-events: none; }

/* faixa de ícones: escritório ou chat */
#rail { position: fixed; top: 0; left: 0; bottom: 0; width: 56px; z-index: 26; background: #1a1622; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; }
#rail button { position: relative; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
#rail button:hover { background: var(--card); color: var(--text); }
#rail button.on { background: var(--card); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
#rail svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#rail .grow { flex: 1; }
body.sidebar-collapsed #btn-sidebar-toggle svg { transform: rotate(180deg); }
/* aberta, a seta vai para a frente: fica na borda direita da barra, ao lado do nome */
body.sidebar-open #btn-sidebar-toggle { position: fixed; top: 6px; left: calc(var(--side) - 48px); }
#rail-unread { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }

/* barra lateral: canais e mensagens diretas */
#sidebar { position: fixed; top: 0; left: 56px; bottom: 0; width: 260px; z-index: 25; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
body.sidebar-collapsed #sidebar { display: none; }
#sidebar header { display: flex; align-items: center; justify-content: space-between; padding: 14px 52px 10px 14px; }
#sidebar h2 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#people-search { margin: 0 10px 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
#sidebar-lists { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 10px; }
#sidebar-foot { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); flex: none; }
#sidebar-foot .grow { flex: 1; }
#btn-me { width: 44px; height: 48px; border: 0; border-radius: 10px; background: var(--card); cursor: pointer; padding: 2px; display: grid; place-items: center; }
#btn-me:hover { filter: brightness(1.08); }
#me-preview { width: 30px; height: 42px; image-rendering: pixelated; pointer-events: none; }
#sidebar-foot #btn-edit, #sidebar-foot #btn-account { width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
#sidebar-foot #btn-edit:hover, #sidebar-foot #btn-account:hover { background: var(--card); color: var(--text); }
#sidebar-foot #btn-edit.active { background: #6c5ce733; color: var(--text); }
#sidebar-foot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.group-row { display: flex; align-items: center; }
.group-head { flex: 1; text-align: left; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 8px 4px; cursor: default; }
#btn-new-channel { width: 24px; height: 24px; margin: 6px 4px 0 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
#btn-new-channel:hover { background: var(--card); color: var(--text); }
.group ul { list-style: none; margin: 0 0 6px; padding: 0; }
.group li.empty { color: var(--muted); font-size: 12px; padding: 2px 8px 8px; }
li.nav { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; color: #c9cde0; }
li.nav:hover { background: var(--card); }
li.nav.on { background: var(--card); color: var(--text); }
li.nav.unread .name { color: var(--text); font-weight: 700; }
li.nav .icon { width: 18px; text-align: center; color: var(--muted); flex: none; font-size: 13px; }
li.nav .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
li.person .who { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
li.nav .where { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
li.nav .badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; flex: none; }
li.person .avatar, .msg .avatar { position: relative; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
li.person .presence { position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--panel); background: var(--ok); }
li.person.busy .presence { background: var(--danger); }
li.person.focus .presence { background: #3a8dde; }
li.person.focus .where { color: #7fbaf2; }
li.person.away .presence { background: #8a90a6; }
li.person.lunch .presence { background: #f08c2e; }
li.person.offline .presence { background: var(--panel); box-shadow: inset 0 0 0 1.5px #8a90a6; }
li.person.offline { color: var(--muted); }
li.person.offline .avatar { opacity: .55; }
@media (max-width: 640px) {
  body.sidebar-open { --side: 56px; }
  #sidebar { width: min(260px, calc(100vw - 68px)); box-shadow: 8px 0 30px #0008; }
}

/* conversa aberta, no lugar do mapa */
#chat-view { position: fixed; top: 0; right: 0; bottom: 0; left: var(--side); z-index: 24; background: var(--bg); display: flex; flex-direction: column; }
#chat-view header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); flex: none; }
#chat-view .title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#chat-view .title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cv-icon { color: var(--muted); }
#cv-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cv-actions { display: flex; gap: 6px; flex: none; }
#cv-actions button { border: 0; border-radius: 8px; padding: 7px 12px; background: var(--card); color: var(--text); cursor: pointer; font-size: 13px; }
#cv-actions button:hover { filter: brightness(1.15); }
#cv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 12px; }
#cv-more { display: block; margin: 8px auto; border: 0; border-radius: 8px; padding: 6px 12px; background: var(--card); color: var(--muted); cursor: pointer; font-size: 12px; }
#cv-messages .day { display: flex; align-items: center; gap: 12px; margin: 14px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
#cv-messages .day::before, #cv-messages .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 36px 1fr; column-gap: 10px; padding: 6px 16px 2px; }
.msg:hover { background: #ffffff06; }
.msg.grouped { padding-top: 1px; }
.msg .avatar { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; grid-row: span 2; }
.msg .head { display: flex; align-items: baseline; gap: 8px; }
.msg .head time { color: var(--muted); font-size: 11px; }
.msg .body { grid-column: 2; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; min-width: 0; }
.msg .body a { color: #8fb4ff; }
.msg .body code { background: #0003; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font: 12.5px ui-monospace, Menlo, Consolas, monospace; }
.msg .body pre { background: #0003; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 4px 0; overflow-x: auto; font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
.msg.system { display: block; padding: 4px 16px 4px 62px; color: var(--muted); font-style: italic; font-size: 13px; }
/* responder e reagir */
.msg { position: relative; }
.msg :is(.quote, .reactions) { grid-column: 2; }
.msg.flash { animation: msg-flash 1.6s ease-out; }
@keyframes msg-flash { 0%, 30% { background: #6c5ce740; } 100% { background: transparent; } }
.msg .quote { display: flex; gap: 6px; align-items: baseline; min-width: 0; max-width: 100%; justify-self: start; margin: 2px 0 3px; padding: 3px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 4px 8px 8px 4px; background: #ffffff0a; color: var(--muted); font-size: 12.5px; text-align: left; cursor: pointer; }
.msg .quote:hover { background: #ffffff14; color: var(--text); }
.msg .quote b { color: var(--text); font-weight: 600; flex: none; }
.msg .quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg .reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.msg .reaction { border: 1px solid var(--line); background: #ffffff0a; border-radius: 12px; padding: 1px 8px; font-size: 13px; cursor: pointer; line-height: 20px; }
.msg .reaction:hover { border-color: #ffffff40; }
.msg .reaction.mine { background: #6c5ce733; border-color: var(--accent); }
.msg-actions { position: absolute; top: -14px; right: 16px; display: none; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 14px #0007; z-index: 2; }
.msg:hover .msg-actions, .msg-actions:has(.react-pick) { display: flex; }
.msg-actions > button { width: 28px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 15px; padding: 0; }
.msg-actions > button:hover { background: var(--card); color: var(--text); }
.msg-actions svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.react-pick { position: absolute; top: 34px; right: 0; display: flex; gap: 2px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px #0009; }
.react-pick button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 18px; padding: 0; }
.react-pick button:hover { background: var(--card); transform: scale(1.12); }
#cv-reply { display: flex; align-items: center; gap: 8px; margin: 0 16px; padding: 6px 8px 8px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #ffffff08; flex: none; }
#cv-reply:not([hidden]) + #cv-form { border-top-left-radius: 0; border-top-right-radius: 0; }
#cv-reply .quote-text { flex: 1; min-width: 0; display: flex; flex-direction: column; border-left: 3px solid var(--accent); padding-left: 8px; font-size: 12.5px; }
#cv-reply .quote-text b { font-weight: 600; }
#cv-reply .quote-text span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cv-reply button { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; flex: none; }
#cv-reply button:hover { background: var(--card); color: var(--text); }
/* chat em balões: os dos outros à esquerda, os meus à direita */
.msg:not(.system) :is(.body, .msg-img, .quote, .reactions) { justify-self: start; }
.msg:not(.system) .body { max-width: min(78%, 680px); padding: 6px 11px; background: var(--card); border-radius: 4px 14px 14px 14px; margin-top: 2px; }
.msg.grouped:not(.system) .body { border-radius: 14px; }
.msg.mine { grid-template-columns: 1fr; padding-left: 64px; }
.msg.mine > .avatar, .msg.mine .head b { display: none; }
.msg.mine :is(.head, .body, .msg-img, .quote, .reactions) { grid-column: 1; justify-self: end; }
.msg.mine .body { background: #5b4bd6; color: #fff; border-radius: 14px 4px 14px 14px; }
.msg.mine.grouped .body { border-radius: 14px; }
.msg.mine .body a { color: #dfe6ff; }
.msg.mine .msg-actions { right: auto; left: 16px; }
.msg.mine .react-pick { right: auto; left: 0; }
.msg.mine .quote { border-left: 0; border-right: 3px solid var(--accent); border-radius: 8px 4px 4px 8px; }
.msg.mentions-me .body { box-shadow: inset 3px 0 0 #f2b632; }

/* foto na mensagem e aberta grande */
.msg .msg-img { grid-column: 2; margin: 4px 0 2px; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; overflow: hidden; line-height: 0; }
.msg .msg-img img { display: block; width: auto; height: auto; max-width: min(320px, 100%); max-height: 320px; object-fit: cover; background: #0003; }
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: #0b0910e6; backdrop-filter: blur(4px); cursor: zoom-out; animation: fade-in .15s ease-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px #000c; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* menções */
.mention { padding: 0 3px; border-radius: 4px; background: #6c5ce733; color: #c8bfff; font-weight: 600; }
.mention.me { background: #f2b63240; color: #ffd77a; }
.msg.mine .mention { background: #ffffff2e; color: #fff; }
li.nav .badge.mention { background: #f2b632; color: #2a1d00; }
#cv-mention { list-style: none; margin: 0 16px 6px; padding: 4px; max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #0009; flex: none; }
#cv-mention li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
#cv-mention li.on, #cv-mention li:hover { background: var(--card); }
#cv-mention .avatar { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); flex: none; }
#cv-mention .avatar.has-photo { border-radius: 50%; }

/* foto pronta para enviar e o botão de clipe */
#cv-attach { display: flex; align-items: center; gap: 10px; margin: 0 16px 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff08; flex: none; }
#cv-attach img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
#cv-attach span { flex: 1; }
#cv-attach button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; flex: none; }
#cv-attach button:hover { background: var(--card); color: var(--text); }
#cv-clip { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
#cv-clip:hover { background: var(--card); color: var(--text); }
#cv-clip svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#cv-send:disabled { opacity: .5; cursor: progress; }
#cv-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 16px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); flex: none; }
#cv-form:focus-within { border-color: #ffffff30; }
#cv-input { flex: 1; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: inherit; line-height: 1.45; padding: 6px 4px; max-height: 200px; }
#cv-send { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
#cv-send svg { width: 18px; height: 18px; fill: currentColor; }
.cv-hint { margin: 4px 18px 10px; }

/* modo chat: o mapa some, câmeras e controles ficam no pé da barra lateral */
body.mode-chat #game { visibility: hidden; }
body.mode-chat :is(#zone, #map-controls, #view-toggle, #meeting-bar, #videos-backdrop, #panel, #status-overlay, #player-menu) { display: none !important; }
body.mode-chat #sidebar { padding-bottom: 56px; }
body.mode-chat #sidebar-foot { position: relative; z-index: 28; background: var(--panel); }
/* --chat-cams: altura das câmeras (ui.js); o espaço delas fica entre a lista e o rodapé */
body.mode-chat:not(.sidebar-collapsed) #sidebar-foot { margin-top: calc(var(--chat-cams, 0px) + 10px); }
body.mode-chat #videos {
  top: auto; bottom: 118px; left: 64px; width: 244px; transform: none; max-width: none; max-height: 34vh; padding-bottom: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; overflow-y: auto; z-index: 27;
}
body.mode-chat .tile { width: auto; border-radius: 8px; box-shadow: none; border-width: 2px; }
body.mode-chat .tile:only-child { grid-column: span 2; }
body.mode-chat .tile .avatar { width: 32px; height: 32px; font-size: 13px; }
body.mode-chat .tile .label { font-size: 10px; padding: 1px 6px; left: 4px; bottom: 4px; }
body.mode-chat #toolbar { left: 64px; bottom: 10px; transform: none; width: 244px; padding: 5px; gap: 4px; justify-content: space-between; z-index: 27; box-shadow: none; background: var(--card); }
body.mode-chat #toolbar button { height: 36px; min-width: 36px; padding: 0 8px; background: var(--panel); }
body.mode-chat #toolbar .dev-wrap .caret { min-width: 18px; width: 18px; }
body.mode-chat #me-photo { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
body.mode-chat #toolbar #btn-status { width: 36px; background: none; }
/* a barra divide a largura da lateral: cada botão encolhe o que for preciso
   (com o Focus e o aviso do administrador não cabiam todos) */
body.mode-chat #toolbar > button, body.mode-chat #toolbar .dev-wrap > button:first-child { flex: 1 1 0; min-width: 0; padding: 0; }
body.mode-chat #toolbar .dev-wrap { flex: 1.5 1 0; min-width: 0; }
body.mode-chat #toolbar .dev-wrap .caret { flex: none; min-width: 14px; width: 14px; }
body.mode-chat #toolbar .status-wrap { flex: none; }
body.mode-chat #toolbar svg { width: 18px; height: 18px; }
body.mode-chat #toolbar .dev-wrap .caret svg { width: 11px; height: 11px; }
body.mode-chat .dev-menu { bottom: 46px; }
body.mode-chat #toolbar :is(.emote-wrap, .sep, #btn-panel) { display: none; }
body.mode-chat #status-label { display: none; }
body.mode-chat:not(.sidebar-open) :is(#videos, #toolbar) { display: none; }

/* criar canal / adicionar pessoas */
#channel-dialog { border: 0; border-radius: 16px; padding: 24px; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#channel-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#channel-dialog h2 { margin: 0 0 16px; font-size: 18px; }
#cd-members { list-style: none; margin: 8px 0 0; padding: 4px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
#cd-members label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--text); }
#cd-members label:hover { background: var(--card); }
#cd-members input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
#cd-members .empty { color: var(--muted); padding: 6px 8px; }
#channel-dialog .error { color: #ff8a8a; margin: 0 0 12px; }
#channel-dialog .actions { display: flex; gap: 8px; justify-content: flex-end; }
#channel-dialog .actions button { width: auto; padding: 10px 16px; border: 0; border-radius: 8px; cursor: pointer; background: var(--card); }
#channel-dialog .actions .primary { background: var(--accent); }
#player-menu button:disabled { opacity: .4; cursor: default; background: none; }

/* editar o escritório em tempo real */
#edit-panel { position: fixed; top: 12px; right: 12px; bottom: 84px; width: 300px; z-index: 31; background: var(--panel); border-radius: 14px; box-shadow: 0 8px 30px #0008; display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; }
#view-toggle:not([hidden]) ~ #edit-panel { top: 56px; }
#edit-panel header { display: flex; align-items: center; justify-content: space-between; }
#edit-panel h2 { margin: 0; font-size: 15px; }
#edit-close { border: 0; border-radius: 8px; padding: 7px 12px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; font-size: 13px; }
#edit-hint { margin: 0; }
#edit-search { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
#edit-catalog .cat-sector summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 2px; }
#edit-catalog .cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 8px; }
#edit-catalog .cat-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--text); cursor: pointer; font-size: 10.5px; line-height: 1.2; text-align: center; }
#edit-catalog .cat-item:hover { border-color: #ffffff30; }
#edit-catalog .cat-item.on { border-color: var(--accent); background: #6c5ce733; }
#edit-catalog .cat-item canvas { width: 48px; height: 48px; image-rendering: pixelated; border-radius: 5px; }
body.map-edit #panel, body.mode-chat #edit-panel { display: none !important; }
body.mode-chat #sidebar-foot #btn-edit { display: none; }
@media (max-width: 700px) {
  #edit-panel { left: 12px; width: auto; top: auto; max-height: 50vh; }
}

/* barra em cima do objeto selecionado */
#edit-bar { position: fixed; z-index: 32; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 12px; background: #221d2ef2; border: 1px solid #ffffff1a; box-shadow: 0 10px 30px #000a; user-select: none; white-space: nowrap; }
#edit-bar button { display: inline-flex; align-items: center; gap: 4px; height: 34px; min-width: 34px; padding: 0 7px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; }
#edit-bar button:hover:not(:disabled) { background: #ffffff14; }
#edit-bar button:disabled { opacity: .35; cursor: default; }
#edit-bar button.danger:hover:not(:disabled) { background: #e0525233; color: #ff9b9b; }
#edit-bar svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#edit-bar button.drop svg { width: 13px; height: 13px; color: var(--muted); }
#edit-bar canvas { width: 28px; height: 28px; image-rendering: pixelated; }
#edit-bar .pic { display: inline-flex; padding: 0 4px; }
#edit-bar .swatch, .edit-menu .swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px #ffffff30; flex: none; }
#edit-bar .text { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
#edit-bar .sep { width: 1px; height: 22px; margin: 0 3px; background: #ffffff1f; }
#edit-bar .size { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); padding-left: 4px; }
#edit-bar .size b { min-width: 14px; text-align: center; color: var(--text); font-size: 12px; }
#edit-bar .size button { min-width: 26px; padding: 0; font-size: 16px; }
#edit-bar .held { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.edit-menu { position: absolute; top: calc(100% + 6px); min-width: 170px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 5px; border-radius: 10px; background: #1b1c24; border: 1px solid #ffffff1a; box-shadow: 0 10px 30px #000a; }
.edit-menu button { justify-content: flex-start; width: 100%; height: auto !important; padding: 6px 8px !important; gap: 8px !important; }
.edit-menu button.on { background: #6c5ce733 !important; }
.edit-menu .edit-pick { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; border-top: 1px solid #ffffff14; margin-top: 2px; }
.edit-menu .edit-pick:hover { background: #ffffff10; }
.edit-menu .edit-pick.on { background: #6c5ce733; }
.edit-menu .edit-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.edit-menu .swatch.rainbow:not([style*="background"]) { background: conic-gradient(#e05252, #e0d03a, #4caf6a, #3aa6c9, #5266e0, #9b59d0, #e05252); }
.edit-menu canvas { width: 32px !important; height: 32px !important; }
#edit-catalog .cat-item { touch-action: none; user-select: none; -webkit-user-drag: none; }
#edit-catalog .cat-item canvas { pointer-events: none; }

/* setores no modo de edição */
#edit-sector { border: 1px dashed #ffffff40; border-radius: 9px; padding: 9px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
#edit-sector:hover { border-color: #ffffff80; }
#edit-sector.on { border-style: solid; border-color: var(--accent); background: #6c5ce733; }
#edit-bar .sector-tag { padding: 0 6px 0 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#edit-bar .sector-name { width: 200px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid #ffffff26; background: #0f1016; color: var(--text); font: inherit; font-size: 13px; }
#edit-bar button.primary { background: var(--accent); color: #fff; font-weight: 600; padding: 0 12px; }
.edit-menu.sector-talk { width: 300px; gap: 8px; padding: 10px; white-space: normal; max-height: none; }
.sector-talk textarea { width: 100%; resize: vertical; min-height: 76px; padding: 8px 10px; border-radius: 8px; border: 1px solid #ffffff26; background: #0f1016; color: var(--text); font: inherit; font-size: 13px; }
.sector-talk .talk-row { display: flex; gap: 4px; }
.sector-talk .talk-row button { width: auto !important; padding: 0 10px !important; height: 32px !important; }
.sector-talk .talk-row .primary { margin-left: auto; }

/* recepcionista no modo de edição (só o administrador vê) */
#edit-reception { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 9px; background: #00000026; font-size: 13px; }
#edit-reception[hidden] { display: none; }
#edit-reception p { margin: 0; }
#edit-reception .er-actions { display: flex; flex-wrap: wrap; gap: 4px; }
#edit-reception button { border: 1px solid #ffffff26; border-radius: 8px; padding: 6px 10px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; }
#edit-reception button:hover { background: #ffffff14; }
#edit-reception button.danger:hover { background: #e0525233; color: #ff9b9b; }

/* lista de setores no painel de edição */
#edit-sectors { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 9px; background: #00000026; font-size: 13px; }
#edit-sectors > b { margin-bottom: 2px; }
#edit-sectors p { margin: 0; }
#edit-sectors .es-row { border-radius: 8px; }
#edit-sectors .es-row.on { background: #6c5ce726; box-shadow: inset 0 0 0 1px #6c5ce780; }
#edit-sectors .es-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
#edit-sectors .es-head:hover { background: #ffffff10; }
#edit-sectors .es-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#edit-sectors .es-body { display: flex; flex-direction: column; gap: 6px; padding: 2px 9px 10px; }
#edit-sectors input, #edit-sectors textarea { width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid #ffffff26; background: #0f1016; color: var(--text); font: inherit; font-size: 13px; resize: vertical; }
#edit-sectors .es-actions { display: flex; gap: 4px; }
#edit-sectors button:not(.es-head) { width: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border: 1px solid #ffffff26; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; }
#edit-sectors button:not(.es-head):hover:not(:disabled) { background: #ffffff14; }
#edit-sectors button:disabled { opacity: .35; cursor: default; }
#edit-sectors .es-actions .primary { margin-left: auto; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
#edit-sectors button.danger { align-self: flex-start; }
#edit-sectors button.danger:hover { background: #e0525233; color: #ff9b9b; }
#edit-sectors button.danger svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* conversa com o recepcionista: caixa de falas de joguinho, embaixo do mapa */
#talk-box { position: fixed; z-index: 40; left: calc(50% + var(--side) / 2); bottom: 84px; transform: translateX(-50%); width: min(620px, calc(100vw - var(--side) - 32px)); display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: #1b1726f5; border: 2px solid #ffffff2a; box-shadow: 0 0 0 4px #00000040, 0 14px 40px #000a; animation: talk-in .18s ease-out; }
#talk-box[hidden] { display: none; }
@keyframes talk-in { from { opacity: 0; transform: translate(-50%, 10px); } }
#talk-face { width: 72px; height: 72px; flex: none; image-rendering: pixelated; border-radius: 10px; background: #ece4d4; border: 2px solid #ffffff30; }
#talk-box .talk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
#talk-who { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #c9b8ff; }
#talk-text { margin: 0; min-height: 3em; font-size: 15px; line-height: 1.45; cursor: pointer; overflow-wrap: anywhere; }
#talk-box .talk-actions { display: flex; align-items: center; gap: 8px; }
#talk-step { margin-right: auto; }
#talk-box .talk-actions button { width: auto; margin: 0; border: 1px solid #ffffff26; border-radius: 9px; padding: 7px 12px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
#talk-box .talk-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#talk-close { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 4px; }
#talk-close:hover { color: var(--text); }
@media (max-width: 700px) { #talk-face { width: 52px; height: 52px; } #talk-text { font-size: 14px; } }

/* fotos de perfil: a imagem cobre o círculo; sem foto, inicial na cor */
.avatar.has-photo { color: transparent; }
li.person .avatar.has-photo, .msg .avatar.has-photo { border-radius: 50%; }

/* perfil */
#profile-dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#profile-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#profile-form { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; max-height: calc(100vh - 40px); overflow-y: auto; }
.profile-head { display: flex; align-items: center; justify-content: space-between; }
.profile-head h2 { margin: 0; font-size: 18px; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.profile-account { display: flex; gap: 20px; align-items: center; padding: 14px; border-radius: 12px; background: var(--card); }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.photo-circle { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; font-weight: 700; color: #fff; box-shadow: 0 0 0 3px #ffffff1a; }
.photo-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.photo-actions button:not(.link) { border: 0; border-radius: 8px; padding: 7px 12px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.profile-info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; min-width: 0; }
.profile-info dt { color: var(--muted); }
.profile-info dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-look { display: grid; grid-template-columns: 144px 1fr; gap: 18px; align-items: center; }
.profile-look .preview { width: 144px; height: 150px; }
.profile-look p { margin: 4px 0 12px; }
#pf-preview { width: 132px; height: 126px; image-rendering: pixelated; }
#pf-status:empty { display: none; }
#pf-status { margin: 0; }
#profile-form .actions { display: flex; gap: 8px; justify-content: flex-end; }
#profile-form .actions button { width: auto; padding: 10px 16px; border: 0; border-radius: 8px; cursor: pointer; background: var(--card); color: var(--text); font: inherit; }
#profile-form .actions .primary { background: var(--accent); color: #fff; }
/* ajustes de áudio */
#audio-dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#audio-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#audio-form { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px 22px; max-height: calc(100vh - 40px); overflow-y: auto; }
#audio-form .profile-head { margin-bottom: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; gap: 3px; }
.switch-row b { font-size: 14px; font-weight: 600; }
.switch-row small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.switch-row input { appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 10px; background: var(--card); position: relative; cursor: pointer; transition: background .15s; }
.switch-row input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(16px); background: #fff; }
.switch-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gate-box { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px; }
.gate-box.off { opacity: .45; pointer-events: none; }
.gate-meter { position: relative; height: 8px; border-radius: 4px; background: var(--card); overflow: hidden; }
#au-level { position: absolute; inset: 0 auto 0 0; width: 0; background: #4caf6a; transition: width 60ms linear; }
#au-level.below { background: #6b7086; }
#au-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; }
#au-gate-level { width: 100%; accent-color: var(--accent); margin: 0; }
.gate-box p { margin: 0; }

/* plano de fundo da câmera */
#bg-dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#bg-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#bg-form { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; max-height: calc(100vh - 40px); overflow-y: auto; }
#bg-form > p { margin: 4px 0 0; }
.device-row { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 12px; }
.device-row b { font-size: 14px; font-weight: 600; }
.device-row select { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.device-row select:disabled { opacity: .6; cursor: default; }
.bg-title.small-title { margin-top: 2px; font-size: 12px; }
#bg-section { margin: 6px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text); }
/* na proporção da câmera e sem cortar: largura limitada em vez de altura */
.bg-preview { position: relative; align-self: center; width: min(100%, 400px); aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--card); display: grid; place-items: center; }
.bg-preview video { width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
.bg-preview p { position: absolute; margin: 0; }
#bg-loading { inset: auto auto 10px 10px; padding: 5px 10px; border-radius: 8px; background: #000a; }
.bg-title { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.bg-option { position: relative; aspect-ratio: 4 / 3; border: 2px solid transparent; border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: var(--card) center / cover no-repeat; display: grid; place-items: center; font-size: 12px; color: var(--text); }
.bg-option:hover { border-color: var(--line); }
.bg-option.on { border-color: var(--accent); box-shadow: 0 0 0 2px #6c5ce755; }
.bg-option svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bg-option .label { position: absolute; inset: auto 0 0; padding: 3px 4px; background: #0008; font-size: 11px; text-align: center; }
.bg-option.text { display: flex; flex-direction: column; gap: 4px; }
.bg-cell { position: relative; display: grid; }
.bg-cell .remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0; background: #000b; color: #fff; font-size: 11px; cursor: pointer; opacity: 0; }
.bg-cell:hover .remove, .bg-cell .remove:focus-visible { opacity: 1; }

@media (max-width: 520px) {
  .profile-account, .profile-look { grid-template-columns: 1fr; flex-direction: column; }
}

/* reunidos agora: fotos empilhadas por sala, setor ou roda de conversa */
li.meeting { gap: 10px; padding: 6px 8px; }
li.meeting .stack { display: flex; flex: none; }
li.meeting .stack .avatar { width: 24px; height: 24px; border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }
li.meeting .stack .avatar + .avatar { margin-left: -8px; }
li.meeting .stack .avatar.more { background: var(--card); color: var(--muted); font-size: 9px; }
li.meeting .meet-text { display: flex; flex-direction: column; min-width: 0; }
li.meeting .meet-text .name { font-size: 13px; }
li.meeting .meet-text .who { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pescaria no laguinho */
.act-hint { position: fixed; bottom: 84px; left: calc(50% + var(--side) / 2); transform: translateX(-50%); z-index: 21; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 20px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px #0008; animation: fish-bob 1.6s ease-in-out infinite; }
.act-hint kbd, #fish-play kbd, #pong-foot kbd { font: 600 11px system-ui, sans-serif; padding: 1px 6px; border-radius: 5px; background: #ffffff2a; }
#fish-play kbd, #pong-foot kbd { background: var(--card); color: var(--text); }
@keyframes fish-bob { 50% { transform: translateX(-50%) translateY(-3px); } }
#fish-dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#fish-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#fish-box { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
#fish-box .profile-head { gap: 12px; }
.fish-tabs { display: flex; gap: 2px; margin-right: auto; padding: 3px; border-radius: 10px; background: var(--card); }
.fish-tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.fish-tabs button.on { background: var(--accent); color: #fff; }
#fish-count { opacity: .75; font-weight: 500; }
#fish-play { display: flex; flex-direction: column; gap: 8px; }
#fish-play p { margin: 0; }
#fish-canvas { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; image-rendering: pixelated; cursor: pointer; touch-action: none; user-select: none; }
#fish-bucket { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fish-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-align: center; }
.fish-card canvas { width: 96px; height: 60px; image-rendering: pixelated; }
.fish-card b { font-size: 13px; }
.fish-card .rar { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.fish-card small { color: var(--muted); font-size: 11px; }
.fish-card.unknown canvas { opacity: .5; }
.fish-card.unknown b { color: var(--muted); }

/* pingue-pongue */
#pong-dialog { border: 0; border-radius: 16px; padding: 0; width: min(720px, calc(100vw - 24px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #000a; }
#pong-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
#pong-box { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
#pong-canvas { width: 100%; aspect-ratio: 600 / 340; border-radius: 12px; cursor: none; touch-action: none; user-select: none; }
#pong-foot { display: flex; align-items: center; gap: 12px; }
#pong-foot p { margin: 0; flex: 1; }
#pong-rematch { flex: none; border: 0; border-radius: 8px; padding: 9px 16px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
#pong-rematch:disabled { opacity: .6; cursor: default; }

/* notas de atualização: canto de baixo, à esquerda */
#btn-notes { position: fixed; left: calc(var(--side) + 16px); bottom: 16px; z-index: 21; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px #0006; transition: color .15s, transform .15s; }
#btn-notes:hover { color: var(--text); transform: translateY(-1px); }
#btn-notes .spark { font-size: 14px; }
#btn-notes.new { color: #fff; background: linear-gradient(135deg, #6c5ce7, #9b59d0); border-color: transparent; animation: notes-pulse 2.4s ease-in-out infinite; }
#btn-notes.new .label::after { content: " da atualização"; }
@keyframes notes-pulse { 0%, 100% { box-shadow: 0 4px 16px #0006, 0 0 0 0 #8b7cf680; } 50% { box-shadow: 0 4px 16px #0006, 0 0 0 8px #8b7cf600; } }
#notes-panel { position: fixed; left: calc(var(--side) + 16px); bottom: 60px; z-index: 46; width: min(360px, calc(100vw - var(--side) - 32px)); max-height: min(70vh, 520px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 48px #000a; animation: slide-up .2s ease-out; }
@keyframes slide-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
#notes-panel header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--line); }
#notes-panel header button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
#notes-panel header button:hover { background: var(--card); color: var(--text); }
#notes-list { overflow-y: auto; padding: 4px 16px 12px; }
#notes-list h3 { margin: 12px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#notes-list ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; line-height: 1.4; font-size: 13px; }
#notes-list li::marker { color: var(--accent); }
body.mode-chat :is(#btn-notes, #notes-panel) { display: none !important; }
body.meeting #btn-notes:not(.new) { display: none; }
/* tela estreita: o cartão encolhe para não encostar na barra de baixo */
@media (max-width: 1200px) { #btn-notes.new .label::after { content: ""; } }
@media (max-width: 1000px) { #btn-notes .label { display: none; } #btn-notes { padding: 0 9px; } }
/* quadro estreito (faixa do topo): sem a porcentagem, a barra ganha espaço */
.tile { container-type: inline-size; }
@container (max-width: 200px) { .tile :is(.vol-pct, .vol-all .long) { display: none; } }

/* versão nova no servidor: cartão no meio da tela pedindo para recarregar */
#update { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: #0f0b18cc; backdrop-filter: blur(4px); animation: fade-in .2s ease-out; }
#update .card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#update h1 { font-size: 21px; }
#update p { margin: 0; }
#update .update-icon { font-size: 40px; line-height: 1; animation: update-pop .5s ease-out; }
#update .primary { width: 100%; margin-top: 6px; }
@keyframes update-pop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: none; opacity: 1; } }

/* ================================================================ celular
   Até 640 px: o mapa ocupa a tela toda. A faixa de ícones vira um botãozinho
   flutuante no canto, a barra lateral abre por cima do mapa, a barra de baixo
   ocupa a largura da tela e o resto (zoom, novidades, avisos) fica acima dela. */
@media (max-width: 640px) {
  body.sidebar-open, body.sidebar-collapsed { --side: 0px; }
  #rail { bottom: auto; width: 48px; padding: 6px 0; gap: 2px; border: 0; border-radius: 0 0 14px 0; background: #1a1622e6; backdrop-filter: blur(4px); }
  #rail button { width: 38px; height: 38px; }
  #sidebar { left: 48px; width: calc(100vw - 48px); box-shadow: 8px 0 30px #0008; }
  #zone { top: 10px; left: 58px; font-size: 12px; padding: 5px 10px; }
  #videos { top: 52px; max-width: calc(100vw - 16px); }

  #toolbar { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); transform: none; gap: 3px; padding: 5px; border-radius: 14px; justify-content: space-between; }
  #toolbar > button, #toolbar .dev-wrap > button:first-child { flex: 1 1 0; min-width: 0; height: 42px; padding: 0; }
  #toolbar .dev-wrap { flex: 1.4 1 0; min-width: 0; }
  #toolbar .dev-wrap .caret { flex: none; min-width: 15px; width: 15px; }
  #toolbar .dev-wrap .caret svg { width: 11px; height: 11px; }
  #toolbar .status-wrap { flex: none; }
  #toolbar #btn-status { width: 40px; }
  #me-photo { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
  #toolbar svg { width: 19px; height: 19px; }
  #toolbar .sep { display: none; }
  #toolbar .emote-wrap { flex: 1 1 0; min-width: 0; display: flex; }
  #toolbar .emote-wrap > button { flex: 1; min-width: 0; height: 42px; padding: 0; }
  body.no-screen-share #btn-screen { display: none; }
  #status-menu { min-width: min(260px, calc(100vw - 16px)); }
  #emote-menu { position: fixed; left: 50%; bottom: calc(66px + env(safe-area-inset-bottom)); }
  .dev-menu { max-width: calc(100vw - 16px); }

  #map-controls { right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  #map-controls button { width: 34px; height: 32px; }
  #btn-notes { left: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  #btn-notes .label { display: none; }
  #notes-panel { left: 8px; bottom: calc(116px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); }
  #toasts { left: 8px; right: 8px; bottom: calc(118px + env(safe-area-inset-bottom)); }
  .act-hint { left: 50%; bottom: calc(72px + env(safe-area-inset-bottom)); }
  #talk-box { left: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); transform: none; width: calc(100vw - 16px); padding: 12px; gap: 10px; animation: none; }
  #player-menu { max-width: calc(100vw - 16px); }
  #panel { top: 8px; left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); width: auto; }
  #edit-panel { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 46vh; }
  #edit-bar { max-width: calc(100vw - 16px); overflow-x: auto; }
  #game canvas { touch-action: none; }

  /* chat: a conversa ocupa a tela toda; a lista abre por cima (botão da faixa) */
  #chat-view header { padding: 0 10px 0 58px; }
  body.mode-chat #toolbar { left: 56px; width: calc(100vw - 64px); }
  body.mode-chat #videos { left: 56px; width: calc(100vw - 64px); }
}
