:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --bg-3: #1a1a1a;
  --line: #262626;
  --red: #e8000d;
  --red-dark: #a3000a;
  --text: #f2f2f2;
  --muted: #8a8a8a;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  /* curvas de UI (entrar/sair e mover na tela) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  /* fundo de hover dos menus (era usado sem estar definido: hover sem cor) */
  --red-wash: rgba(232, 0, 13, 0.14);

  /* ESPACAMENTO: escala unica. Botao nunca encosta em borda de modal/painel
   * nem em texto — `npm run test:visual` mede (>= 8 px da borda, >= 6 px entre
   * vizinhos) e falha no grave. Use estes tokens em vez de numero solto. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --edge: 14px;            /* HUD ate a borda da janela */
  --hud-top-h: 56px;       /* fim da barra de cima: paineis e avisos nascem aqui */
  --acoes-h: 0px;          /* linha de pilulas da mesa/"Pressione F" (game.js mede):
                              os avisos do centro descem essa altura */
  --modal-pad-y: 24px;     /* respiro interno de TODO modal */
  --modal-pad-x: 28px;
  --modal-gap: 16px;       }
@media (max-width: 640px) {
  :root {
    --edge: 8px;
    --hud-top-h: 96px;     /* barra de cima em 2 linhas no celular */
    --modal-pad-y: 20px;
    --modal-pad-x: 18px;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ===================== LOBBY ===================== */
.lobby {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.lobby-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(232, 0, 13, 0.18), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, 0.025) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(255, 255, 255, 0.025) 31px 32px),
    var(--bg);
}

.lobby-card {
  position: relative;
  width: min(720px, 100%);
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  padding: 28px 32px 20px;
  max-height: 96vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 26px;
  height: 26px;
  background: var(--red);
  display: inline-block;
  box-shadow: 4px 4px 0 rgba(232, 0, 13, 0.25);
}
.brand-mark.sm { width: 14px; height: 14px; box-shadow: none; }

.brand h1 {
  font-family: var(--font-display);
  font-size: 44px;
  letter-spacing: 2px;
  line-height: 1;
}
.brand h1 em { font-style: normal; color: var(--red); }

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--muted);
  margin: 6px 0 22px 38px;
}

.lobby-body { display: flex; gap: 28px; }

.preview-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.preview-frame {
  width: 160px;
  height: 200px;
  background:
    repeating-linear-gradient(0deg, #20160f 0 31px, #281b12 31px 32px),
    #20160f;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}
#preview { image-rendering: pixelated; }

.form-col { flex: 1; min-width: 0; }

.field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 14px 0 6px;
  display: block;
}
.form-col .field-label:first-child { margin-top: 0; }

#name {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
#name:focus { border-color: var(--red); }
#name.locked { opacity: 0.6; cursor: not-allowed; }
.name-google { margin: 0 0 10px; }
.name-google .field-label { margin-top: 14px; }
.name-google #nameGoogleValue { font-size: 15px; color: var(--text); }
.name-lobby-hint { font-size: 11px; color: var(--muted); margin: 6px 0 10px; line-height: 1.4; }
.name-lobby-hint strong { color: var(--text); }
.name-lobby-hint.hidden { display: none; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; }

.swatch {
  width: 26px;
  height: 26px;
  border: 2px solid transparent;
  cursor: pointer;
  outline: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: #fff; outline-color: var(--red); }

.style-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
}

/* Listas de estilo em GRADE, nao em fluxo.
 *
 * Com flex-wrap cada botao tinha a largura do PROPRIO TEXTO: "Rabo" do lado de
 * "Saia+blusa" do lado de "Vestido longo". Dava um mosaico de tamanhos
 * diferentes que quebrava em linhas desalinhadas — passavel com 9 cabelos e 5
 * roupas, ilegivel com 15 e 11. A grade com colunas iguais resolve os dois de
 * uma vez: todo botao do mesmo tamanho e as linhas alinhadas.
 *
 * auto-fill decide o numero de colunas pela largura disponivel, entao a mesma
 * regra serve para a lista larga (cabelo, roupa) e para a estreita (barba,
 * oculos) sem contagem na mao. */
.swatch-row.styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 6px;
  align-items: stretch;
}
.swatch-row.styles .style-btn {
  padding: 7px 6px;
  text-align: center;
  /* nome comprido ENCURTA em vez de esticar a coluna e desalinhar a grade */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.style-btn.active { border-color: var(--red); color: var(--text); background: rgba(232, 0, 13, 0.1); }

.btn-primary {
  width: 100%;
  margin-top: 22px;
  padding: 14px;
  background: var(--red);
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #ff1622; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 7px 14px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.lobby-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

.lobby-footer {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* ===================== JOGO ===================== */
.game { position: fixed; inset: 0; }

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: #0a0a0a;
  cursor: grab;
}
#canvas.dragging { cursor: grabbing; }

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--edge);
  pointer-events: none;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid var(--line);
  padding: 7px 12px;
  backdrop-filter: blur(4px);
}

.hud-title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 2px;
}

.zone-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--red);
  border-left: 1px solid var(--line);
  padding-left: 10px;
  margin-left: 4px;
}

.hud-right {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
}
/* separador visual entre grupos de botoes do topo */
.hud-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.hud-btn {
  position: relative;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid var(--line);
  color: var(--text);
  width: 33px;
  height: 33px;
  cursor: pointer;
  font-size: 14px;
}
.hud-btn:hover { border-color: var(--red); }
.online-pill {
  height: 33px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  font: 800 10px var(--font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.online-pill:hover { border-color: var(--red); }
.online-pill svg {
  width: 16px;
  height: 16px;
  color: #fff;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Pilulas da mesa/squad + "Pressione F": linha propria no TOPO DIREITO, logo
 * abaixo da barra de cima (pedido do dono, 07/10). Dentro da barra elas
 * cresciam por cima do titulo; no centro caiam no toast de zona e nos avisos. */
.hud-top-actions {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--space-2));
  right: var(--edge);
  max-width: calc(100vw - 2 * var(--edge));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  z-index: 6;
  pointer-events: none;
}
.hud-top-actions > * { pointer-events: auto; }
/* painel de pessoas/configuracoes abre no mesmo canto: as pilulas saem da frente */
body:has(#playersPanel:not(.hidden)) .hud-top-actions,
body:has(#settingsPanel:not(.hidden)) .hud-top-actions { visibility: hidden; }
.hud-top-actions:not(:has(> :not(.hidden):not(.desk-actions-inline))):not(:has(.desk-actions-inline > :not(.hidden))) { display: none; }
.desk-actions-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  align-items: center;
}
.desk-actions-inline:not(:has(> :not(.hidden))) { display: none; }
.desk-actions-inline .lock-pill {
  position: static;
  transform: none;
  height: 33px;
  padding: 0 var(--space-3);
  white-space: nowrap;
}
.hud-btn.has-badge::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid #0a0a0a;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 15px;
  text-align: center;
}

.zone-toast {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 2 * var(--edge));
  text-align: center;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 2px;
  animation: toast-in 0.25s ease;
  pointer-events: none;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.interact-prompt {
  /* mora no .hud-top-actions (topo direito, abaixo da barra), junto das
   * pilulas da mesa; no centro ele caia em cima do toast de zona */
  position: static;
  z-index: 8;
  max-width: calc(100vw - 2 * var(--edge));
  padding: 7px var(--space-3);
  border: 1px solid rgba(232,0,13,0.72);
  border-left: 3px solid var(--red);
  background: rgba(10,10,10,0.82);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
}
.interact-prompt.hidden { display: none; }

/* Aviso ao se mover estando "Em reunião" (#2) */
.busy-move-banner {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  width: max-content;
  max-width: min(440px, calc(100vw - 2 * var(--edge)));
  padding: var(--space-3) var(--space-4);
  background: rgba(10, 10, 10, 0.94);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  box-shadow: 0 10px 30px -12px #000;
  animation: toast-in 0.2s ease;
}
.busy-move-banner span {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 10px;
}
.busy-move-banner span strong { color: var(--red); }
.busy-move-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.busy-move-actions button {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
#busyMoveExit { border-color: var(--red); background: var(--red); color: #fff; }
#busyMoveExit:hover { background: var(--red-dark); }
#busyMoveKeep:hover { border-color: var(--red); color: var(--red); }
.busy-move-banner.hidden { display: none; }

/* Botao de acao dentro das Configuracoes (ex.: Reconectar microfone) */
.settings-action {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
}
.settings-action:hover { border-color: var(--red); color: var(--red); }

/* Mural de avisos: banner fixo (#3) */
.announce-banner {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + min(var(--acoes-h), var(--space-2))); /* respiro so com pilulas */
  left: 50%;
  transform: translateX(-50%);
  z-index: 13;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: max-content;
  max-width: min(680px, calc(100vw - 2 * var(--edge)));
  padding: 10px var(--space-4);
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 28px -12px #000;
  animation: toast-in 0.2s ease;
}
.announce-banner-icon { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.announce-banner-body { display: flex; flex-direction: column; min-width: 0; }
.announce-banner-text { font-family: var(--font-body); font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 460px; }
.announce-banner-meta { font-family: var(--font-mono); font-size: 10px; opacity: 0.85; }
.announce-banner-btn {
  flex: none; cursor: pointer; border: 1px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.12); color: #fff;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 2px;
}
.announce-banner-btn:hover { background: rgba(255,255,255,0.24); }
.announce-banner-btn.danger { border-color: #fff; background: rgba(0,0,0,0.28); }
.announce-banner-btn.danger:hover { background: rgba(0,0,0,0.5); }
.announce-banner-btn.hidden { display: none; }
.announce-banner-x { flex: none; cursor: pointer; background: transparent; border: none; color: #fff; font-size: 15px; opacity: 0.85; }
.announce-banner-x:hover { opacity: 1; }
.announce-banner.hidden { display: none; }

/* Cards do mural de avisos (dentro do modal) */
.announce-card { position: relative; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--red); background: var(--bg-2); margin-bottom: 8px; }
.announce-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.announce-card-head span { font-family: var(--font-display); font-size: 16px; letter-spacing: 1px; color: var(--text); }
.announce-card-head time { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.announce-card p { font-size: 13.5px; line-height: 1.45; color: var(--text); margin: 0; white-space: pre-wrap; word-break: break-word; }
.announce-del { margin-top: 8px; cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; padding: 4px 8px; }
.announce-del:hover { border-color: var(--red); color: var(--red); }

/* Linhas do painel de coordenadores (#3) */
.roles-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.roles-row span { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.roles-btn { cursor: pointer; flex: none; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; padding: 6px 10px; border: 1px solid var(--line); background: transparent; color: var(--text); }
.roles-btn.add { border-color: var(--red); background: var(--red); color: #fff; }
.roles-btn.add:hover { background: var(--red-dark); }
.roles-btn.remove:hover { border-color: var(--red); color: var(--red); }

/* Menu de contexto da pessoa (#9) */
.player-menu {
  position: fixed;
  z-index: 40;
  min-width: 176px;
  background: rgba(12, 12, 12, 0.97);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  box-shadow: 0 14px 34px -10px #000;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-menu-head {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--text);
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-menu-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 2px;
}
.player-menu-item:hover { background: var(--red-wash); color: var(--red); }
.player-menu.hidden { display: none; }
/* volume da pessoa no menu (modo batata) */
.player-menu-vol {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  padding: var(--space-2) 10px var(--space-1);
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.player-menu-vol input { flex: 1; min-width: 0; accent-color: var(--red); }

/* Menu de status (Em reunião / Em foco / No almoço) */
.busy-menu {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  background: rgba(12, 12, 12, 0.97);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  box-shadow: 0 14px 34px -10px #000;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.busy-menu-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 10px;
  cursor: pointer;
  border-radius: 2px;
}
.busy-menu-item:hover { background: var(--red-wash); color: var(--red); }
.busy-menu-item.active { background: var(--red); color: #fff; }
.busy-menu-item.off { color: #7dffa0; }
.busy-menu-item.off:hover { background: rgba(125, 255, 160, 0.12); color: #7dffa0; }
.busy-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.busy-menu.hidden { display: none; }

.players-panel {
  position: absolute;
  top: var(--hud-top-h);
  right: var(--edge);
  width: min(560px, calc(100vw - 2 * var(--edge)));
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(10, 10, 10, 0.88);
  border: 1px solid var(--line);
  border-top: 2px solid var(--red);
  padding: var(--space-3);
  backdrop-filter: blur(4px);
}
.players-panel h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 8px;
}
.players-panel ul { list-style: none; }
.players-panel li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.players-panel li .pcolor {
  width: 11px;
  height: 11px;
  outline: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.players-panel li .pname {
  flex: 1 1 auto;
  min-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.players-panel li .pzone {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  min-width: 72px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.players-panel li .user-volume {
  width: 92px;
  flex-shrink: 0;
  display: flex;
}
.players-panel li .user-volume input {
  width: 92px;
  accent-color: var(--red);
}

/* Chat */
.chat {
  position: absolute;
  left: 14px;
  bottom: 56px; /* acima do botao de abrir/fechar */
  width: min(360px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat, .chat * {
  user-select: text;
}
/* Chat recolhido: some inteiro; o botao #chatToggle abre/fecha */
.chat.collapsed { display: none; }
.chat-toggle {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 5;
}
.chat-toggle.open { border-color: var(--red); }
.chat-tabs, .chat-tabs *, .chat-input-row button {
  user-select: none;
}
.chat-tabs {
  display: flex;
  gap: 4px;
  align-self: flex-start;
  background: rgba(10,10,10,0.72);
  border: 1px solid var(--line);
  padding: 3px;
}
.chat-tab {
  height: 24px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 700 10px var(--font-mono);
  cursor: pointer;
}
.chat-tab.active {
  border-color: var(--red);
  color: #fff;
  background: rgba(232,0,13,0.22);
}

.chat-log {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  scrollbar-width: thin;
  mask-image: linear-gradient(to bottom, transparent, #000 14%);
}

.chat-msg {
  font-size: 13px;
  line-height: 1.35;
  background: rgba(10, 10, 10, 0.72);
  padding: 4px 9px;
  border-left: 2px solid var(--line);
  word-wrap: break-word;
  animation: msg-in 0.18s ease;
}
.chat-msg.me { border-left-color: var(--red); }
.chat-msg.local { border-left-color: #caa12f; }
.chat-msg.system { border-left-color: #555; color: var(--muted); font-style: italic; font-size: 12px; }
.chat-msg .ts { color: var(--muted); font-size: 11px; margin-right: 5px; }
.chat-msg .scope { color: #caa12f; font-size: 11px; margin-right: 5px; }
.chat-msg .author { color: var(--red); font-weight: 700; margin-right: 5px; }
.chat-gif {
  display: block;
  max-width: 150px;
  max-height: 120px;
  object-fit: contain;
  margin-top: 4px;
  border: 1px solid rgba(255,255,255,0.18);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-input-row { display: flex; gap: 6px; }

#chatInput {
  flex: 1;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
}
#chatInput:focus { border-color: var(--red); }

.chat-send {
  background: var(--red);
  border: none;
  color: #fff;
  width: 38px;
  cursor: pointer;
  font-size: 14px;
}

/* Emotes */
.emote-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.emote-btn {
  width: 40px;
  height: 40px;
  font-size: 19px;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.emote-btn:hover { transform: translateY(-3px); border-color: var(--red); }

/* Joystick touch */
.joystick {
  position: absolute;
  bottom: 90px;
  left: 26px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  touch-action: none;
}
.joy-knob {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(232, 0, 13, 0.55);
  border: 1px solid var(--red);
  left: 32px;
  top: 32px;
}

.overlay-msg {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 40;
}
.overlay-msg h2 { font-family: var(--font-display); font-size: 34px; letter-spacing: 3px; color: var(--red); }
.overlay-msg p { color: var(--muted); margin-top: 8px; }

/* Mobile */
@media (max-width: 640px) {
  .lobby-body { flex-direction: column; align-items: center; }
  .brand h1 { font-size: 34px; }
  .chat { width: calc(100vw - 28px); }
  .chat-log { max-height: 110px; }
  .emote-bar { bottom: 70px; right: 14px; left: auto; transform: none; flex-direction: column; }
}

/* Voz */
.hud-btn.voice { font-size: 15px; }
.hud-btn.voice.on {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(232, 0, 13, 0.5);
}

/* Compartilhamento de tela */
.hud-btn.screen.on,
.hud-btn.lock.on {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(232, 0, 13, 0.5);
}

.screens {
  position: absolute;
  top: var(--hud-top-h);
  left: var(--edge);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}
.screen-tile {
  position: relative;
  width: 220px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  background: #000;
  cursor: pointer;
}
.screen-tile video {
  display: block;
  width: 100%;
  background: #000;
}
.screen-tile .screen-label {
  position: absolute;
  left: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.8);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 7px;
}

.screen-full {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.screen-full-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}
.screen-full-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: #fff;
}
.screen-full video {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}

/* Configuracoes */
.settings-panel {
  position: absolute;
  top: var(--hud-top-h);
  right: var(--edge);
  width: min(280px, calc(100vw - 2 * var(--edge)));
  max-height: calc(100dvh - var(--hud-top-h) - var(--space-4));
  background: rgba(10, 10, 10, 0.88);
  border: 1px solid var(--line);
  border-top: 2px solid var(--red);
  padding: 12px;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(4px);
  z-index: 6;
}
.settings-panel::-webkit-scrollbar { width: 8px; }
.settings-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 0; }
.settings-panel::-webkit-scrollbar-track { background: rgba(0,0,0,.18); }
.settings-panel h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 10px;
}
.setting-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.setting-row.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.setting-row input[type='range'] { width: 100%; accent-color: var(--red); }
.setting-row input[type='checkbox'] { accent-color: var(--red); }

/* Login Google */
.google-row { margin-bottom: 14px; }
.google-status {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.google-status.ok { color: #4caf50; }

/* Microfone desligado: barra vermelha desenhada via CSS */
.hud-btn.voice { position: relative; }
.hud-btn.voice:not(.on)::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 15%;
  width: 2px;
  height: 70%;
  background: var(--red);
  transform: rotate(45deg);
  pointer-events: none;
}
.hud-btn.voice:not(.on) { opacity: 0.85; }

/* Botao de trancar sala (aparece dentro de salas trancaveis) */
.lock-pill {
  position: absolute;
  top: 112px; /* abaixo do toast de zona */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
  padding: 9px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  z-index: 7;
}
.lock-pill:hover { border-color: var(--red); }
.lock-pill.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.lock-pill.disabled { opacity: 0.5; }
.lock-pill.disabled:hover { border-color: var(--line); }

/* Lobby travado ate logar com Google */
.form-col.locked > *:not(.google-row) {
  opacity: 0.35;
  pointer-events: none;
}

.logout-link {
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.logout-link:hover { color: var(--text); }

/* Preview da propria tela compartilhada */
.screen-tile.self { border-left-color: #4caf50; }

/* Botoes do HUD com texto (tela, camera, em reuniao) */
.hud-text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid var(--line);
  color: var(--text);
  height: 33px;
  min-width: max-content;
  padding: 0 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  white-space: nowrap;
  line-height: 1;
}
.hud-text-btn:hover { border-color: var(--red); }
.hud-text-btn.on {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(232, 0, 13, 0.5);
}

/* Bolhas de webcam sobre os personagens */
.cams {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
}
.cam-bubble {
  position: absolute;
  left: 0;
  top: 0;
  width: 104px;
  height: 78px;
  border: 2px solid var(--red);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}
.cam-bubble.self { border-color: #4caf50; }
.cam-bubble video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
}
.cam-mini-btn {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(0,0,0,0.74);
  color: #fff;
  font: 900 11px/1 var(--font-mono);
  cursor: pointer;
}
.cam-mini-btn:hover, .cam-mini-btn.on { border-color: var(--red); background: var(--red); }
.cam-mini-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
.cam-gallery {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + min(var(--acoes-h), var(--space-2)));
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  gap: 8px;
  max-width: min(760px, calc(100vw - 28px));
  overflow-x: auto;
  padding: 6px;
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.cam-gallery.hidden { display: none; }
.cam-tile {
  position: relative;
  flex: 0 0 142px;
  height: 86px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255,255,255,0.20);
  border-top: 2px solid var(--red);
  cursor: pointer;
}
.cam-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font: 700 10px var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cam-meet {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: rgba(5,5,5,0.88);
  display: flex;
  flex-direction: column;
  padding: 18px;
}
.cam-meet.hidden { display: none; }
.cam-meet-bar {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font: 900 18px "Bebas Neue", sans-serif;
  letter-spacing: 1px;
}
.cam-meet-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  min-height: 0;
}
.cam-meet-grid .cam-tile {
  width: 100%;
  height: 100%;
  min-height: 160px;
}

@media (max-width: 900px) {
  .hud-right { flex-wrap: wrap; justify-content: flex-end; row-gap: var(--space-2); }
  .hud-text-btn { font-size: 9px; padding: 0 7px; }
  .cam-gallery { top: calc(var(--hud-top-h) + var(--acoes-h) + 36px); }
  .cam-meet-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .settings-panel {
    width: min(300px, calc(100vw - 2 * var(--edge)));
  }
}

/* Lobby em grade (2 colunas) para caber na tela */
.lobby-card { width: min(880px, 100%); }
/* CRIADOR DE PERSONAGEM no estilo Stardew Valley (out/2026): partes com setas e
 * "nome n/total" a esquerda, faixas de cor (que andam pela paleta) a direita.
 * Uma coluna no celular. Linha montada no game.js (montaCriador). */
.criador {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-5);
  align-items: start;
}
.form-col .criador .field-label { margin-top: var(--space-3); }
.parte-linha,
.cor-linha {
  display: grid;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);   }
.parte-linha { grid-template-columns: 72px 32px minmax(0, 1fr) 32px; }
.cor-linha { grid-template-columns: 72px minmax(0, 1fr) 24px; min-height: 32px; }
.parte-rotulo {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parte-seta {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}
.parte-seta:hover { border-color: var(--red); color: var(--red); }
.parte-seta:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.parte-seta svg { width: 12px; height: 12px; }
.parte-valor {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
}
.parte-valor b {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parte-valor small { font-family: var(--font-mono); font-size: 10px; color: var(--muted); flex-shrink: 0; }
.criador-acess { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.acess-chip {
  min-height: 32px;
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acess-chip.active { border-color: var(--red); color: var(--text); background: rgba(232, 0, 13, 0.1); }
/* faixa de cor: input range nativo, trilho pintado com a paleta (game.js faixaFundo) */
.cor-faixa {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  margin: 0;
  border: 1px solid var(--line);
  cursor: pointer;
}
.cor-faixa::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 24px;
  background: #fff;
  border: 2px solid var(--red);
  box-shadow: 0 0 0 1px #000;
}
.cor-faixa::-moz-range-thumb {
  width: 6px;
  height: 20px;
  background: #fff;
  border: 2px solid var(--red);
  border-radius: 0;
}
.cor-faixa:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.cor-amostra { width: 24px; height: 24px; border: 2px solid #fff; outline: 1px solid rgba(255, 255, 255, 0.12); }
.cor-amostra.natural { background: repeating-linear-gradient(45deg, #caa12f 0 4px, #b0b4ba 4px 8px) !important; }
.pv-giro { display: flex; gap: var(--space-2); }
@media (max-width: 720px) {
  .criador { grid-template-columns: 1fr; }
}

/* Modal central (estilo do sistema) */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: var(--space-4); }
/* TODO modal: mesmo respiro interno, mesma distancia ate os botoes e, se o
 * conteudo for maior que a janela, o CARTAO rola (antes o "Controles e
 * atalhos" passava da tela em 1366x768 e o ENTENDI sumia embaixo). */
.modal-card {
  background: rgba(18, 18, 18, 0.97);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  padding: var(--modal-pad-y) var(--modal-pad-x);
  width: min(360px, calc(100vw - 2 * var(--space-5)));
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}
.modal-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  margin-bottom: var(--space-2);
}
.modal-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.modal-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; margin-top: var(--modal-gap); }
.btn-primary.sm { padding: 10px 22px; width: auto; }
.desk-sandbox {
  position: relative;
  width: 288px;
  height: 96px;
  margin: 8px auto 16px;
  image-rendering: pixelated;
  background-color: #8a5a36;
  background-image: url("img/desk.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border: 2px solid rgba(0,0,0,.65);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.35);
  overflow: hidden;
  touch-action: none;
}
.desk-sandbox::after {
  content: "";
  position: absolute;
  left: 96px;
  top: 0;
  width: 96px;
  height: 96px;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.desk-sandbox-device,
.desk-sandbox-item {
  position: absolute;
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  background-size: contain;
  background-repeat: no-repeat;
}
.desk-sandbox-device {
  left: 114px;
  top: 12px;
  width: 60px;
  height: 60px;
  opacity: .92;
  cursor: grab;
  pointer-events: auto;
}
.desk-sandbox-item {
  cursor: grab;
  border: 1px dashed transparent;
}
.desk-sandbox-item:active {
  cursor: grabbing;
  border-color: rgba(255,255,255,.55);
}
/* latas de energetico: mesma escala das plantas (ajustado 16/07) */
.desk-sandbox-item[data-type^="energy"] { width: 48px; height: 48px; }
/* caneca e trofeu tem MUITA area transparente no PNG: sem uma escala propria
   a caneca sai minuscula e o trofeu gigante no mapa (3x = escala do sandbox) */
.desk-sandbox-item[data-type="caneca"] { width: 72px; height: 72px; }
.desk-sandbox-item[data-type="trofeu"] { width: 42px; height: 42px; }

/* Icones SVG nos botoes do HUD */
.hud-btn svg,
.hud-text-btn svg,
.lock-pill svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
}
.hud-text-btn { gap: 6px; }
.hud-btn { display: inline-flex; align-items: center; justify-content: center; }
/* Botao do HUD com rotulo escrito (ex.: SUPORTE) - largura automatica */
.hud-btn-text { width: auto; padding: 0 12px; gap: 7px; }
.hud-btn-text span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.hud-btn-text:hover { color: var(--red); }
.lock-pill { display: inline-flex; align-items: center; gap: 7px; }
#busyBtn svg circle { fill: var(--red); stroke: none; }
#busyBtn:not(.on) svg path { stroke: #fff; }
#busyBtn.on svg circle { fill: #fff; }
#busyBtn.on svg path { display: none; }

/* Botoes do modal: mesmo tamanho, mesma fonte, mesma altura. O padding
 * lateral existe para rotulo comprido (ENCERRAR PESQUISA, Responder depois)
 * nao encostar na borda do botao. */
.modal-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 132px;
  height: 44px;
  margin: 0;
  padding: 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  line-height: 1.15;
  cursor: pointer;
}
#calYes { min-width: 190px; }
.modal-actions .btn-primary:only-child,
.modal-actions .btn-ghost:only-child {
  width: 100%;
}
.modal-actions .btn-ghost { border: 1px solid var(--line); color: var(--text); }

/* Seletores de dispositivo nas configuracoes */
.setting-row select {
  width: 100%;
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  cursor: pointer;
}
.setting-row select:focus { outline: none; border-color: var(--red); }

/* Painel avancado de audio */
.setting-val { color: var(--muted); font-style: normal; float: right; font-size: 11px; }
.ptt-key-btn {
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
}
.ptt-key-btn:hover { border-color: var(--red); }
/* LIGADO MAS SEM SINAL: o sistema parou de entregar som. Nao pode parecer
   ligado-e-funcionando (vermelho solido) nem desligado — e um terceiro estado,
   e a piscada existe para ser vista de canto de olho enquanto a pessoa fala. */
.hud-btn.voice.on.sem-sinal {
  border-color: #caa12f;
  background: #caa12f;
  box-shadow: 0 0 12px rgba(202, 161, 47, 0.6);
  animation: voice-sem-sinal 1.4s ease-in-out infinite;
}
@keyframes voice-sem-sinal {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.hud-btn.voice.tx {
  box-shadow: 0 0 12px rgba(60, 200, 90, 0.7);
  border-color: #3cc85a;
}

/* Cutucada (poke) */
.poke-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}
.poke-flash.anim { animation: poke-pulse 1.5s ease-out; }
@keyframes poke-pulse {
  0%   { box-shadow: inset 0 0 0 rgba(232, 0, 13, 0); }
  12%  { box-shadow: inset 0 0 110px rgba(232, 0, 13, 0.65); }
  35%  { box-shadow: inset 0 0 40px rgba(232, 0, 13, 0.3); }
  55%  { box-shadow: inset 0 0 90px rgba(232, 0, 13, 0.5); }
  100% { box-shadow: inset 0 0 0 rgba(232, 0, 13, 0); }
}

/* Pop-up persistente de "te chamou": card no topo listando quem chamou */
.poke-notice {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + 60px); /* abaixo do toast de zona (que tem ~44 px) */
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  width: min(320px, calc(100vw - 24px));
  background: rgba(15, 15, 17, 0.96);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 14px 34px -12px #000;
  animation: toast-in 0.2s ease;
  overflow: hidden;
}
.poke-notice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  background: var(--red);
}
.poke-notice-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.poke-notice-title { flex: 1; font-family: var(--font-body); font-weight: 700; font-size: 14px; }
.poke-notice-x { flex: none; cursor: pointer; background: transparent; border: none; color: #fff; font-size: 15px; opacity: 0.85; padding: 0 2px; }
.poke-notice-x:hover { opacity: 1; }
.poke-notice-list { max-height: 208px; overflow-y: auto; padding: 4px 0; }
.poke-notice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.poke-notice-row:first-child { border-top: none; }
.poke-notice-name { font-family: var(--font-body); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poke-notice-time { flex: none; font-family: var(--font-mono); font-size: 11px; opacity: 0.6; }
.poke-notice.hidden { display: none; }

/* NPS: pesquisa 1-10 + comentario */
.nps-banner {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + 60px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 2 * var(--edge));
  z-index: 14;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px #000;
  animation: toast-in 0.2s ease;
}
.nps-banner:hover { filter: brightness(1.08); }

/* MODO LEVE: blur de fundo e sombra grande sao recomposicao cara em GPU/CPU
 * fraca; o fundo quase opaco mantem o texto legivel sem o blur. */
body.lite .hud-brand,
body.lite .players-panel,
body.lite .settings-panel { backdrop-filter: none; background: rgba(10, 10, 10, 0.96); }
body.lite .cam-bubble { box-shadow: none; }

.players-panel li.speaking .pname { color: #7dffa0; }
/* MODO BATATA: o escritorio nao e desenhado; vira uma lista de CANAIS
 * (salas, mesas, areas abertas) a esquerda, a gente do meu canal no centro e
 * o chat a direita (#batataApp, montado pelo game.js). Tudo que so faz
 * sentido no mapa some: minimapa, zoom, emotes, "Pressione F", pilulas de
 * mesa, joystick, barra de midia de baixo (as funcoes dela estao na barra do
 * usuario e no cabecalho do centro). Pensado para pesar pouco: sem
 * blur, sem sombra grande, sem animacao, sem transicao. */
.bt-app { display: none; }
body.batata #canvas,
body.batata #cams,
body.batata #playersPanel,
body.batata .hud-bottom,
body.batata .hud-top-actions,
body.batata #joystick,
body.batata #zoneLabel { display: none !important; }
body.batata .game { background: var(--bg); }
body.batata .hud-top {
  height: var(--hud-top-h);
  background: #0e0e0e;
  border-bottom: 2px solid var(--red);
}
body.batata .hud-brand { backdrop-filter: none; background: transparent; }
.bt-tag { display: none; }
body.batata .bt-tag {
  display: inline;
  font: 700 10px var(--font-mono);
  letter-spacing: 2px;
  color: var(--red);
  border-left: 1px solid var(--line);
  padding-left: var(--space-3);
  margin-left: var(--space-1);
  white-space: nowrap;
}
body.batata .bt-app {
  position: absolute;
  top: var(--hud-top-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "side main chat" "user main chat";
}
body.batata .bt-app.sem-chat { grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "side main" "user main"; }
/* cada coluna isola layout e pintura: mensagem nova no chat ou alguem
 * trocando de canal nao obriga a refazer as outras colunas */
body.batata .bt-side,
body.batata .bt-main,
body.batata .bt-chat { contain: strict; }
body.batata .bt-user { contain: content; } /* altura vem do conteudo (linha auto) */
body.batata .bt-app.sem-chat .bt-chat { display: none; }
.bt-i {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- lateral: canais ---- */
.bt-side {
  grid-area: side;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.bt-canais { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3); }
.bt-sec-t {
  font: 700 10px var(--font-mono);
  letter-spacing: 2px;
  color: var(--muted);
  padding: 0 var(--space-2) var(--space-2);
}
.bt-sec-l { display: flex; flex-direction: column; gap: 2px; }
.bt-chan, .bt-mem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
}
.bt-chan { min-height: 34px; padding: 6px var(--space-2); font-size: 14px; }
.bt-chan:hover { background: var(--bg-3); }
.bt-chan .nm { flex: 1; min-width: 0; color: #d6d6d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-chan .ct { flex: none; font: 11px var(--font-mono); color: #6b6b6b; }
.bt-chan-ico { display: inline-flex; color: var(--muted); }
.bt-canal.cur .bt-chan { background: rgba(232, 0, 13, 0.12); box-shadow: inset 3px 0 0 var(--red); cursor: default; }
.bt-canal.cur .bt-chan .nm { color: #fff; font-weight: 700; }
.bt-canal.cur .bt-chan-ico { color: var(--red); }
.bt-mems { display: flex; flex-direction: column; margin: var(--space-2) 0; }
.bt-mems:empty { display: none; }
.bt-mem { min-height: 30px; padding: 3px var(--space-2) 3px 30px; font-size: 13px; color: #bdbdbd; }
.bt-mem:hover { background: var(--bg-3); }
.bt-mem .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-mem.eu .nm { color: #fff; }
.bt-mem.ausente { opacity: 0.6; }
.bt-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bt-dot:not([class*="st-"]) { display: none; }
.bt-dot.st-reuniao { background: var(--pres-reuniao); }
.bt-dot.st-foco { background: var(--pres-foco); }
.bt-dot.st-almoco { background: var(--pres-almoco); }
.bt-dot.st-ausente { background: var(--pres-ausente); }

/* avatar: retrato 28 px desenhado uma vez (game.js btRetrato), ampliado sem suavizar */
.bt-av {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: #1f1f1f;
  image-rendering: pixelated;
  object-fit: cover;
}
.bt-av.fala, .bt-tile.fala .bt-av { box-shadow: 0 0 0 2px var(--pres-ativo); }

/* ---- barra do usuario (embaixo da lateral) ---- */
.bt-user {
  grid-area: user;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: #0f0f0f;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.bt-av-user { width: 40px; height: 40px; }
.bt-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
}
.bt-who:hover { background: var(--bg-3); }
.bt-who b { max-width: 100%; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-st-txt { max-width: 100%; font-size: 12px; color: var(--pres-ativo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-st-txt::before { content: '\25CF\00a0'; }
.bt-st-txt.st-reuniao { color: #ff5a5f; }
.bt-st-txt.st-foco { color: #b07ad0; }
.bt-st-txt.st-almoco { color: #f08a3c; }
.bt-st-txt.st-ausente { color: var(--pres-ausente); }
.bt-ib {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-grid;
  place-items: center;
  position: relative;
  background: #161616;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}
.bt-ib:hover { border-color: var(--red); }
.bt-ib .bt-i { grid-area: 1 / 1; }
.bt-ib .off-only { display: none; }
.bt-ib.off { color: var(--red); }
.bt-ib.off .off-only { display: block; }
.bt-ib.off .on-only { display: none; }

/* ---- centro: canal atual ---- */
.bt-main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}
.bt-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.bt-head-ico { width: 22px; height: 22px; color: var(--muted); }
.bt-head-txt { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.bt-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.bt-sub { color: var(--muted); font-size: 14px; }
.bt-head-acts { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.bt-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  background: #161616;
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.bt-btn:hover { border-color: var(--red); }
.bt-btn.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.bt-btn.disabled { opacity: 0.45; }
.bt-so-cel { display: none; }
body.batata .bt-head-acts #chatToggle { display: none; }

.bt-stage {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  grid-auto-rows: minmax(196px, auto);
  align-content: start;
  gap: var(--space-4);
  padding-right: var(--space-1);
}
.bt-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: #171717;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
}
.bt-tile:hover { border-color: #3a3a3a; }
.bt-tile.fala { border-color: var(--pres-ativo); }
.bt-tile.ausente, .bt-tile.longe { opacity: 0.55; }
.bt-tile .nm { max-width: 100%; font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.bt-av-tile { width: 104px; height: 104px; border-radius: 12px; }
.bt-tmic { position: absolute; top: var(--space-3); right: var(--space-3); display: inline-flex; color: var(--muted); }
.bt-tmic.off { color: var(--red); }
.bt-chip {
  min-height: 22px;
  padding: 2px var(--space-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.bt-chip:empty { visibility: hidden; }
.bt-chip.c-falando { color: #5fd27f; border-color: rgba(58, 166, 85, 0.5); }
.bt-chip.c-reuniao { color: #ff6b6b; border-color: rgba(232, 0, 13, 0.45); }
.bt-chip.c-foco { color: #c39bf5; border-color: rgba(122, 63, 160, 0.6); }
.bt-chip.c-almoco { color: #f0a05f; border-color: rgba(211, 84, 0, 0.5); }
.bt-chip.c-ausente { color: #e8c46a; border-color: rgba(202, 161, 47, 0.45); }

/* tela compartilhada (o #screens do voice.js, emprestado): bloco grande */
body.batata .bt-stage .screens {
  position: static;
  grid-column: span 2;
  grid-row: span 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: auto;
}
body.batata .bt-stage .screens:empty { display: none; }
body.batata .bt-stage .screen-tile {
  flex: 1;
  width: auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
body.batata .bt-stage .screen-tile video { flex: 1; min-height: 0; height: 100%; object-fit: contain; }
body.batata .bt-stage .screen-tile .screen-label {
  position: static;
  padding: var(--space-3) var(--space-4);
  background: #141414;
  border-top: 1px solid var(--line);
  font: 700 13px var(--font-body);
}
/* webcams: so aparecem se a pessoa desligar "Ocultar webcams" (padrao do modo e oculto) */
body.batata .bt-stage .cam-gallery {
  position: static;
  transform: none;
  grid-column: 1 / -1;
  max-width: none;
  box-shadow: none;
  z-index: auto;
}

/* ---- direita: chat (o .chat do HUD, emprestado) ---- */
.bt-chat {
  grid-area: chat;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
}
.bt-chat-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.bt-chat-head b { flex: 1; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.batata .bt-chat .chat,
body.batata .bt-chat .chat.collapsed {
  position: static;
  width: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-2);
  background: transparent;
  border: none;
}
body.batata .bt-chat .chat.hidden { display: none; }
body.batata .bt-chat .chat-log { flex: 1; max-height: none; mask-image: none; padding: 0; gap: var(--space-2); }
body.batata .bt-chat .chat-msg { background: transparent; padding: 2px var(--space-2); animation: none; }
body.batata .bt-chat .chat-msg.faded { opacity: 1; }

.bt-veu { display: none; }
/* aviso embaixo, sobre os cartoes: em cima ele cobria o nome do canal */
body.batata .zone-toast { top: auto; bottom: 96px; z-index: 8; }

@media (max-width: 1100px) {
  body.batata .bt-app { grid-template-columns: 260px minmax(0, 1fr) 280px; }
  body.batata .bt-app.sem-chat { grid-template-columns: 260px minmax(0, 1fr); }
  .bt-btn .lbl { display: none; }
  .bt-av-user { display: none; } /* lateral estreita: o nome e o status precisam do espaco */
  .bt-btn { width: 34px; padding: 0; justify-content: center; }
}

/* CELULAR: canais numa gaveta (botao no cabecalho), chat por cima pelo
 * botao de balao, barra do usuario fixa embaixo. Sem rolagem lateral. */
@media (max-width: 640px) {
  body.batata .bt-app,
  body.batata .bt-app.sem-chat {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "main" "user";
  }
  .bt-so-cel { display: inline-grid; }
  body.batata .bt-head-acts #chatToggle { display: inline-flex; position: relative; left: auto; bottom: auto; width: 34px; height: 34px; }
  .bt-main { padding: var(--space-3) var(--edge); gap: var(--space-3); }
  .bt-head h2 { font-size: 26px; }
  .bt-head-txt { flex-basis: 0; flex-grow: 1; }
  .bt-head-acts { width: 100%; justify-content: flex-end; }
  .bt-stage { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: minmax(168px, auto); gap: var(--space-3); }
  .bt-av-tile { width: 78px; height: 78px; }
  body.batata .bt-stage .screens { grid-column: 1 / -1; grid-row: auto; }
  .bt-user { border-right: none; padding: var(--space-2) var(--edge); }
  .bt-side, .bt-chat {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 6;
    display: none;
  }
  .bt-side { left: 0; width: min(300px, 86vw); box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5); }
  .bt-app.gaveta .bt-side { display: block; }
  .bt-chat { right: 0; left: 0; border-left: none; }
  .bt-app.chat-aberto .bt-chat { display: flex; }
  body.batata .bt-app.sem-chat .bt-chat { display: none; }
  .bt-app.gaveta .bt-veu {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(0, 0, 0, 0.55);
  }
  body.batata .bt-tag { display: none; }
}
.lite-suggest {
  position: absolute;
  top: calc(var(--hud-top-h) + var(--acoes-h) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: max-content;
  max-width: calc(100vw - 2 * var(--edge));
  background: rgba(10, 10, 10, 0.96);
  border: 1px solid var(--line);
  border-top: 2px solid var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  box-shadow: 0 12px 30px -12px #000;
  animation: toast-in 0.2s ease;
}
.lite-suggest button {
  flex: none;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.lite-suggest button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.lite-suggest.hidden { display: none; }
@media (max-width: 600px) { .lite-suggest { flex-wrap: wrap; } }
.nps-banner.hidden { display: none; }
.nps-scale { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 14px 0 6px; }
.nps-score {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
.nps-score:hover { border-color: var(--red); }
.nps-score.sel { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.nps-scale-legend { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-bottom: 12px; }
.nps-textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 10px;
  box-sizing: border-box;
}
.nps-textarea:focus { outline: none; border-color: var(--red); }

.players-panel li .poke-btn {
  margin-left: 8px;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.players-panel li .poke-btn:hover { border-color: var(--red); color: var(--text); }
.players-panel li .poke-btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Guia de controles */
.help-card { width: min(440px, calc(100vw - 2 * var(--space-5))); text-align: left; }
/* atalhos: mais largo para cada linha caber em 1 linha e o modal caber em 768 px de altura */
#helpModal .help-card { width: min(600px, calc(100vw - 2 * var(--space-5))); }
/* tela larga: atalhos em 2 colunas (16 linhas em 1 coluna passavam de 768 px) */
@media (min-width: 960px) {
  #helpModal .help-card { width: min(900px, calc(100vw - 2 * var(--space-5))); }
  #helpModal .help-grid { grid-template-columns: auto 1fr auto 1fr; column-gap: var(--space-4); }
}
.help-card h3 { text-align: center; }
.help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 14px 0;
  font-size: 13px;
  align-items: center;
}
.help-grid .key {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  background: #16161a;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--red);
  padding: 4px 8px;
  text-align: center;
  white-space: nowrap;
}
.help-tip {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  border-left: 3px solid var(--red);
  padding-left: 10px;
  margin-bottom: 16px;
}
.help-tip strong { color: var(--text); }
.patch-card { width: min(520px, calc(100vw - 40px)); }
.patch-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 18px;
  max-height: min(56vh, 430px);
  overflow-y: auto;
  padding-right: 4px;
}
.patch-list article {
  border-left: 3px solid var(--red);
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
}
.patch-list time {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
/* so o TITULO da novidade (filho direto do article) e bloco; negrito dentro do
 * texto fica na linha — antes cada destaque quebrava o paragrafo em pedacos */
.patch-list article > strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 4px;
}
.patch-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Suporte (bug/melhoria) */
#supportModal .modal-card { width: min(440px, calc(100vw - 40px)); text-align: left; }
#supportModal h3 { text-align: center; }
#supportModal p { color: var(--muted); font-size: 12.5px; }
#supportText {
  display: block;
  width: 100%;
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-text, 'DM Sans', sans-serif);
  font-size: 13px;
  padding: 8px 10px;
  resize: none;
  margin-top: 10px;
}
#supportText:focus { outline: none; border-color: var(--red); }

/* Listas de admin (presenca / chamados) */
.admin-list-hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.admin-list {
  max-height: min(52vh, 400px);
  overflow-y: auto;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding-right: 4px;
}
/* Modais de admin (presenca/chamados) mais largos e altos — muita info por linha */
#presenceModal .modal-card,
#supportListModal .modal-card {
  width: min(760px, calc(100vw - 32px));
}
#presenceModal .admin-list,
#supportListModal .admin-list {
  max-height: min(74vh, 680px);
}
.admin-list .admin-row {
  border-left: 3px solid var(--red);
  background: rgba(255,255,255,0.04);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}
.admin-list .admin-row strong { color: var(--text); display: block; font-size: 12.5px; }
.admin-list .admin-row .mono-line {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
  /* pre-wrap porque o texto de um chamado agora pode ser o relatorio do
     DIAGNOSTICO DE AUDIO, de ~50 linhas: sem isto o
 do textContent virava
     espaco e o relato aparecia como um blocao de uma linha. As linhas de uma
     linha so (presenca) nao mudam de aparencia. break-word para uma linha
     muito longa nao estourar o modal. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.admin-list .admin-h {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Registro de presenca (admin): abas, filtros, barras por estado.
   Cores dos estados SEM azul (regra da marca). */
:root {
  --pres-ativo: #3aa655;
  --pres-ausente: #caa12f;
  --pres-inativo: #5c5c5c;
  --pres-reuniao: #e8000d;
  --pres-foco: #7a3fa0;
  --pres-almoco: #d35400;
}
.pres-tabs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 4px 0 10px; }
.pres-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 700 11px var(--font-mono);
  letter-spacing: 1.5px;
  padding: 7px 14px;
  cursor: pointer;
}
.pres-tab.on { color: var(--text); border-color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.pres-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font: 11px var(--font-mono);
  color: var(--muted);
}
.pres-filtros label { display: inline-flex; align-items: center; gap: 6px; }
.pres-filtros select,
.pres-filtros input[type="date"] {
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font: 12px var(--font-mono);
  padding: 5px 6px;
  color-scheme: dark;
  max-width: 230px;
}
.pres-filtros select:focus,
.pres-filtros input:focus { outline: none; border-color: var(--red); }
.pres-filtros .pres-check input { accent-color: var(--red); }
.pres-btn { padding: 6px 12px; font-size: 11px; border: 1px solid var(--line); }
.pres-f.hidden { display: none; }
.pres-resumo { font: 11px var(--font-mono); color: var(--muted); }
.pres-legenda { display: flex; flex-wrap: wrap; gap: 10px; font: 10.5px var(--font-mono); color: var(--muted); }
.pres-legenda span { display: inline-flex; align-items: center; gap: 5px; }
.pres-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--pres-inativo); }
.pres-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 700 10px var(--font-mono);
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  color: var(--text);
  margin-left: 6px;
  vertical-align: middle;
}
.pres-ativo { background: var(--pres-ativo); }
.pres-ausente { background: var(--pres-ausente); }
.pres-inativo { background: var(--pres-inativo); }
.pres-reuniao { background: var(--pres-reuniao); }
.pres-foco { background: var(--pres-foco); }
.pres-almoco { background: var(--pres-almoco); }
.pres-offline { background: #2a2a2a; }
.pres-bar {
  display: flex;
  height: 8px;
  margin: 6px 0 4px;
  background: #1c1c1c;
  overflow: hidden;
}
.pres-bar > i { display: block; height: 100%; }
.pres-table-wrap { overflow-x: auto; }
.pres-table { width: 100%; border-collapse: collapse; font: 11px var(--font-mono); color: var(--text); }
.pres-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  padding: 5px 6px;
  white-space: nowrap;
}
.pres-table td { padding: 5px 6px; border-bottom: 1px solid #1d1d1d; white-space: nowrap; }
.pres-table tr.pres-total td { border-top: 1px solid var(--red); font-weight: 700; }
.pres-anon summary { cursor: pointer; font: 10px var(--font-mono); color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin: 6px 0; }
.pres-anon[open] summary { color: var(--text); }
.pres-anon > .admin-row { margin-bottom: 8px; }

/* Mencoes e links no chat */
.chat-msg a { color: #ff6b74; text-decoration: underline; word-break: break-all; }
.chat-msg a:hover { color: #fff; }
.chat-msg.mention-me {
  background: rgba(232, 0, 13, 0.16);
  border-left: 3px solid var(--red);
  padding-left: 6px;
}
.mention-list {
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  max-height: 150px;
  overflow-y: auto;
}
.mention-item {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
}
.mention-item:hover { background: rgba(232, 0, 13, 0.25); }

/* HUD central inferior: trancar sala / emotes / midia (item 8 do backlog) */
.hud-bottom {
  position: absolute;
  bottom: var(--edge);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  z-index: 6;
}
.hud-bottom .emote-bar {
  position: static;
  transform: none;
}
.hud-bottom .lock-pill {
  position: static;
  transform: none;
}
.hud-media {
  display: flex;
  gap: 8px;
  align-items: center;
}
@media (max-width: 900px) {
  .hud-bottom { bottom: 88px; } /* acima do joystick/chat no mobile */
  .hud-media { flex-wrap: wrap; justify-content: center; }
}

/* Chat auto-oculto: mensagens antigas esmaecem para limpar a tela */
.chat-msg { transition: opacity 0.8s ease; }
.chat-msg.faded { opacity: 0.18; }
.chat:hover .chat-msg.faded,
.chat.active .chat-msg.faded { opacity: 1; }

/* Soundboard */
.soundboard {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  padding: 8px;
}
.sb-btn {
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 7px 10px;
  cursor: pointer;
}
.sb-btn:hover { border-color: var(--red); }

/* Input do nome do squad (modal de claim do admin) */
#squadNameInput {
  display: block;
  width: 100%;
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-text, 'DM Sans', sans-serif);
  font-size: 13px;
  padding: 8px 10px;
}
#squadNameInput:focus { outline: none; border-color: var(--red); }

/* Mural de recados */
.notes-form { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.notes-form input,
.notes-form textarea {
  background: #16161a;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-text, 'DM Sans', sans-serif);
  font-size: 13px;
  padding: 8px 10px;
  resize: none;
}
.notes-form input:focus, .notes-form textarea:focus { outline: none; border-color: var(--red); }
/* DEIXAR RECADO / PUBLICAR AVISO: mesmo botao da barra do modal (antes era o
 * botao gigante do lobby, 22 px de margem a mais que o resto do formulario) */
.notes-form .btn-primary {
  margin-top: var(--space-1);
  height: 44px;
  padding: 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
}
.notes-h {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 10px 0 6px;
}
.notes-list { max-height: 140px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

/* #3/#6 modais de coordenadores e apelidos: mais largos e com lista alta */
#rolesModal .modal-card,
#nicksModal .modal-card { width: min(560px, calc(100vw - 40px)); }
/* trofeu do destaque: lista grande (o time todo pode aparecer aqui) */
#trophyModal .modal-card { width: min(720px, calc(100vw - 40px)); }
#rolesList, #nicksList { max-height: min(52vh, 380px); }
#trophyList { max-height: min(60vh, 460px); }
.roles-add { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.roles-input {
  flex: 1; min-width: 0; padding: 9px 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-family: var(--font-body); font-size: 13px; border-radius: 2px;
}
.roles-input:focus { border-color: var(--red); outline: none; }

/* #6 secao "Meu apelido" nas configuracoes */
#nickInput {
  width: 100%; padding: 9px 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-family: var(--font-body); font-size: 13px; border-radius: 2px;
}
#nickInput:focus { border-color: var(--red); outline: none; }
.note-item {
  position: relative;
  background: rgba(232, 0, 13, 0.08);
  border-left: 3px solid var(--red);
  padding: 10px 34px 10px var(--space-3);
  font-size: 13px;
}
.note-head { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.note-del {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.note-del:hover { color: var(--red); }
.notes-empty { color: var(--muted); font-size: 12px; }

.setting-hint { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }

/* Diagnostico de audio: bloco monoespacado que a pessoa copia e cola no
   grupo do time. Mesmos tokens do resto do painel (sem estilo novo). */
.diag-card { width: min(600px, calc(100vw - 28px)); }
.diag-out {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: min(46vh, 420px);
  min-height: 200px;
  resize: vertical;
  margin: 0 0 14px;
  padding: 8px 10px;
  background: #0f0f12;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}
.diag-out:focus { outline: none; border-color: var(--red); }

/* Saude da conexao de audio por pessoa (painel de online) */
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  margin-right: 2px;
}
.conn-dot.ok { background: #3f7d4a; }
.conn-dot.warn { background: #caa12f; }
.conn-dot.bad { background: #e8000d; }
.conn-dot.off { background: #4a4a4a; }

.pk-modal {
  width: min(640px, calc(100vw - 32px));
  max-height: 88vh;
  overflow-y: auto;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

#settingsPanel .cfg-card { width: min(880px, calc(100vw - 32px)); text-align: left; }
.cfg-card h3 { text-align: center; }
.cfg-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.cfg-tab {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px;
  font: 700 11px var(--font-mono); letter-spacing: 1.5px; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line); color: var(--muted); background: var(--bg-2); cursor: pointer;
}
.cfg-tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cfg-tab:hover { color: var(--text); }
.cfg-tab.on { color: #fff; border-color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.cfg-tab-admin { border-style: dashed; }
.cfg-salvo { text-align: center; font: 700 10px var(--font-mono); letter-spacing: 1px; color: #3fbf5a; margin: 0 0 var(--space-3); }
.cfg-pane { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); align-items: start; }
.cfg-grupo { background: #151515; border: 1px solid var(--line); border-radius: 6px; padding: var(--space-3) var(--space-4); }
.cfg-full { grid-column: 1 / -1; }
.cfg-grupo h4 { font: 700 11px var(--font-mono); letter-spacing: 2px; color: var(--red); margin: 0 0 var(--space-2); }
.cfg-grupo h4.cfg-sub { margin-top: var(--space-4); }
.cfg-grupo .setting-row:last-child { border-bottom: 0; }
.cfg-card .setting-row.check { flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: var(--space-3); }
.cfg-card .setting-row.check input[type='checkbox'] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 40px; height: 22px; border-radius: 11px; background: #333; cursor: pointer; transition: background 150ms ease;
}
.cfg-card .setting-row.check input[type='checkbox']::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #bbb; transition: left 150ms var(--ease-out), background 150ms ease;
}
.cfg-card .setting-row.check input[type='checkbox']:checked { background: var(--red); }
.cfg-card .setting-row.check input[type='checkbox']:checked::after { left: 21px; background: #fff; }
.cfg-card .setting-row.check input[type='checkbox']:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .cfg-card .setting-row.check input, .cfg-card .setting-row.check input::after { transition: none; } }
.cfg-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cfg-perf-row { position: relative; cursor: default; border-bottom: 0; }
.cfg-perf { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.cfg-perf-op {
  text-align: left; border: 1px solid var(--line); border-radius: 6px; padding: var(--space-3);
  background: transparent; color: var(--muted); font: 12px var(--font-body); line-height: 1.4; cursor: pointer;
}
.cfg-perf-op b { display: block; color: #fff; font-size: 13px; margin-bottom: var(--space-1); }
.cfg-perf-op:hover { border-color: #444; }
.cfg-perf-op.on { border-color: var(--red); background: rgba(232, 0, 13, 0.12); }
.cfg-adm { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-2) var(--space-3); }
.cfg-adm .setting-row { border-bottom: 0; }
.cfg-adm .setting-row.cfg-vazia { display: none; }
@media (max-width: 640px) {
  .cfg-tabs {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(-1 * var(--modal-pad-x)); padding: 0 var(--modal-pad-x) var(--space-1);
  }
  .cfg-tabs::-webkit-scrollbar { display: none; }
  .cfg-tab { flex: none; }
  .cfg-pane { grid-template-columns: 1fr; }
  .cfg-perf { grid-template-columns: 1fr; }
}


.pk-modal > .modal-actions {
  position: sticky;
  bottom: calc(-1 * var(--modal-pad-y));
  z-index: 2;
  margin: var(--modal-gap) calc(-1 * var(--modal-pad-x)) calc(-1 * var(--modal-pad-y));
  padding: var(--space-3) var(--modal-pad-x) var(--modal-pad-y);
  background: rgb(18, 18, 18);
  border-top: 1px solid var(--line);
}
@starting-style {
  .pk-modal { opacity: 0; transform: scale(0.96); }
}

/* costas BW 96x96: pes na plataforma */

@keyframes pkb-blink { 50% { opacity: 0; } }

@keyframes pkb-next { 50% { opacity: 0.25; } }

/* movimento reduzido: some o deslocamento/blink, fica a informacao (barras, texto, opacidade) */
@media (prefers-reduced-motion: reduce) {

  .pk-modal { transition: opacity 200ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  @starting-style { .pk-modal { transform: none; } }
}

/* efeitos dos golpes (efeitoGolpe): camada sobre o campo, particulas por tipo */

@keyframes pkb-shiny-voa {
  0% { opacity: 0; transform: rotate(var(--ang)) translateX(0) rotate(0deg) scale(0.4); }
  20% { opacity: 1; }
  70% { opacity: 1; transform: rotate(var(--ang)) translateX(calc(26px * var(--s))) rotate(180deg) scale(1.1); }
  100% { opacity: 0; transform: rotate(calc(var(--ang) + 40deg)) translateX(calc(32px * var(--s))) rotate(300deg) scale(0.5); }
}

/* desafio: regra do duelo (nivel 50) */

.interact-prompt { pointer-events: auto; cursor: pointer; }

/* ===================== CELULAR (<= 640 px) =====================
 * Medido em 390x844 pelo `npm run test:visual`. Antes: a barra de cima
 * quebrava em 3 linhas por cima do toast, as pilulas da mesa saiam da tela
 * pela esquerda, a barra de midia ocupava 3 linhas por cima do joystick e o
 * painel de configuracoes ficava embaixo dela. */
@media (max-width: 640px) {
  /* barra de cima: titulo + pessoas + sair na 1a linha; icones na 2a */
  .hud-top {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding: var(--space-2) var(--edge);
  }
  .hud-top::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
  .hud-right { display: contents; }
  .hud-brand {
    order: 0;
    margin-right: auto;
    min-width: 0;
    max-width: calc(100vw - 2 * var(--edge) - 164px); /* sobra para pessoas + sair na mesma linha */
    padding: 6px 10px;
  }
  .hud-title { font-size: 15px; white-space: nowrap; }
  .zone-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #togglePlayers { order: 1; }
  #exitBtn { order: 2; }
  .hud-right > :not(#togglePlayers):not(#exitBtn) { order: 3; }
  .hud-sep { display: none; }
  .hud-btn-text { width: 33px; padding: 0; }
  .hud-btn-text span { display: none; }

  /* centro inferior vira canto inferior DIREITO: o esquerdo e do chat e do
   * joystick. Midia sem rotulo (so icone, o title explica) cabe em 1 linha. */
  .hud-bottom {
    left: auto;
    right: var(--edge);
    bottom: var(--edge);
    transform: none;
    align-items: flex-end;
  }
  .hud-media { flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
  .hud-text-btn { width: 33px; padding: 0; }
  .hud-text-btn .lbl { display: none; }
  .hud-bottom > :not(.hud-media) { max-width: calc(100vw - 2 * var(--edge) - 128px); }
  .hud-bottom .emote-bar { order: -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .desk-actions-inline .lock-pill { white-space: normal; height: auto; min-height: 33px; padding: 6px var(--space-3); text-align: left; }
  .chat-toggle { left: var(--edge); bottom: var(--edge); }
  .joystick { left: var(--edge); bottom: calc(var(--edge) + 33px + var(--space-3)); }
  /* chat aberto cobre joystick/pilulas (z acima do HUD), nunca a barra de midia */
  .chat {
    left: var(--edge);
    bottom: calc(var(--edge) + 33px + var(--space-2));
    width: calc(100vw - 2 * var(--edge));
    z-index: 7;
    /* fundo proprio: sem ele as pilulas de contexto apareciam atraves das mensagens */
    padding: var(--space-2);
    background: rgba(10, 10, 10, 0.94);
    border: 1px solid var(--line);
    border-top: 2px solid var(--red);
  }
  /* paineis param antes da barra de midia */
  .settings-panel,
  .players-panel {
    max-height: calc(100dvh - var(--hud-top-h) - var(--edge) - 33px - var(--space-4));
    z-index: 7; }
  .players-panel li { flex-wrap: wrap; row-gap: 6px; }
  .players-panel li .pname { flex: 1 1 0; min-width: 40px; }
  .players-panel li .user-volume { order: 9; flex: 1 0 100%; width: auto; padding-left: 19px; }
  .players-panel li .user-volume input { width: 100%; }
  .announce-banner { flex-wrap: wrap; }
  .announce-banner-body { flex: 1 1 calc(100% - 40px); }
  .announce-banner-text { white-space: normal; }

}

@media (pointer: coarse) {
  .note-del, .poke-notice-x, .announce-banner-x { min-width: 32px; min-height: 32px; }
  .note-del { top: 2px; right: 2px; }
  .note-item { padding-right: 40px; }
  .players-panel li .poke-btn { width: 32px; height: 32px; }
  .chat-tab { height: 32px; }
  .ptt-key-btn, .pres-btn, .pres-tab, .roles-btn, .sb-btn, .announce-del,
  .announce-banner-btn, .lite-suggest button, .btn-ghost { min-height: 32px; }
  .setting-row select, .pres-filtros select, .pres-filtros input[type="date"], #supportKind { min-height: 34px; }
  .style-btn { min-height: 32px; }
  .swatch { width: 32px; height: 32px; }
  .mention-item { min-height: 36px; }
}
