:root {
  --bg: #12151c;
  --panel: rgba(24, 28, 38, 0.94);
  --panel-solid: #181c26;
  --line: var(--tint-3);
  --text: #eef0f4;
  --muted: #9aa3b5;
  --accent: #5b8def;
  --accent-ink: #0d1422;
  --on: #3fbf7f;
  --danger: #e2574c;
  --radius: 12px;
  --bar-height: 64px;
  /* Largura do painel lateral: a escolhida pela pessoa (chat-width.js) ou 320 px. */
  --chat-width: var(--chat-width-user, 320px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#game {
  position: fixed;
  inset: 0 0 var(--bar-height) 0;
  width: 100%;
  height: calc(100% - var(--bar-height));
  display: block;
  cursor: pointer;
}

/* ---------- Barra inferior ---------- */

#bar {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--panel-solid);
  border-top: 1px solid var(--line);
}

.bar-info { display: flex; flex-direction: column; min-width: 0; }
.bar-info span { color: var(--muted); font-size: 12px; }
.bar-actions { display: flex; gap: 8px; }

.bar-actions button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tint-1);
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease;
}
/* Só com mouse: no toque o "hover" gruda no botão tocado e esconderia o verde de ligado. */
@media (hover: hover) {
  .bar-actions button:not([aria-pressed="true"]):hover { background: var(--tint-3); }
}
.bar-actions button[aria-pressed="true"] {
  background: var(--on);
  border-color: var(--on);
  color: #06210f;
  font-weight: 600;
}
.bar-actions button:disabled { opacity: 0.5; cursor: progress; }

/* ---------- Vídeos de quem está por perto ---------- */

#stage {
  position: fixed;
  top: 12px;
  left: 12px;
  right: calc(var(--chat-width) + 24px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
body.chat-closed #stage { right: 12px; }

/* Quem está falando: contorno verde na miniatura. */
.tile.speaking { outline: 3px solid #3fbf7f; outline-offset: -3px; }

.tile {
  position: relative;
  width: 168px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  cursor: zoom-in;
}
.tile.screen { width: 300px; aspect-ratio: 16 / 9; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.screen video { object-fit: contain; }
.tile.mirrored video { transform: scaleX(-1); }
.tile.no-video video { opacity: 0; }

.tile-avatar {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 40px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}
.tile.no-video .tile-avatar { display: grid; }

.tile-label {
  color: #ffffff;
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.72);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-label .mic-off { color: var(--danger-ink); }
.tile-flip {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 12, 18, 0.62);
  font-size: 18px;
  cursor: pointer;
}

.tile.expanded {
  position: fixed;
  inset: 24px 24px calc(var(--bar-height) + 24px) 24px;
  width: auto;
  aspect-ratio: auto;
  z-index: 20;
  cursor: zoom-out;
}
.tile.expanded video { object-fit: contain; }

/* ---------- Chat ---------- */

#chat {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: calc(var(--bar-height) + 12px);
  width: var(--chat-width);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
body.chat-closed #chat { display: none; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.scope { display: flex; padding: 2px; border-radius: 999px; background: var(--tint-2); }
.scope button {
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.scope button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

#chat-log, #dm-log {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#chat-log { gap: 0; padding: 6px 10px 10px; }
#chat-log li { overflow-wrap: anywhere; }
#chat-log .system { margin: 6px 0; color: var(--muted); font-size: 12px; text-align: center; }

/* Mensagem: um bloco por pessoa (nome, destino e hora no topo), linhas seguidas sem repetir o nome. */
#chat-log .msg { padding: 2px 8px; border-radius: 8px; }
#chat-log .msg:not(.cont) { margin-top: 10px; }
#chat-log .msg:first-child { margin-top: 2px; }
#chat-log .msg:hover { background: var(--tint-1); }
.msg-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.msg-author { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
#chat-log .msg.self .msg-author { color: var(--accent); }
.msg-scope { flex: none; padding: 0 6px; border-radius: 999px; background: var(--tint-2); color: var(--muted); font-size: 10px; font-weight: 600; line-height: 16px; }
.msg-scope.scope-all { background: rgba(91, 141, 239, 0.16); color: var(--accent); }
.msg-scope.scope-room { background: rgba(63, 191, 127, 0.16); color: var(--success-ink); }
/* Início da conversa guardada da sala em que você acabou de entrar. */
.room-divider { margin: 14px 0 2px; padding: 6px 10px; border-radius: 8px; background: rgba(63, 191, 127, 0.1); color: var(--success-ink); font-size: 12px; font-weight: 700; }
.msg-time { flex: none; margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.msg-text { margin: 1px 0 0; line-height: 1.4; white-space: pre-wrap; }
.msg-text a, .dm-text a, .announcement-body a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
#chat-log .msg.mention { background: var(--mention-bg); box-shadow: inset 3px 0 0 var(--stamp-ink); }
.tone-0 { color: var(--tone-0); } .tone-1 { color: var(--tone-1); } .tone-2 { color: var(--tone-2); } .tone-3 { color: var(--tone-3); }
.tone-4 { color: var(--tone-4); } .tone-5 { color: var(--tone-5); } .tone-6 { color: var(--tone-6); } .tone-7 { color: var(--tone-7); }

/* Divisores: o dia (quando muda) e onde começam as mensagens que você ainda não tinha visto. */
.day-divider, .new-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.day-divider::before, .day-divider::after, .new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.new-divider { color: var(--danger); }
.new-divider::before, .new-divider::after { background: var(--danger); opacity: 0.6; }

/* "↓ 3 mensagens novas": quem rolou para cima (ou voltou de fora) desce direto para elas. */
#view-room { position: relative; }
.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.chat-jump[hidden] { display: none; }

#chat-form, #dm-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#chat-form input, #dm-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}
#chat-form button, #dm-form button {
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- Abas, lista de pessoas e conversas individuais ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.chat-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.chat-tablist { display: flex; gap: 2px; min-width: 0; }
.chat-tabs button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.chat-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-view .chat-header { font-weight: 500; font-size: 12px; color: var(--muted); }

.badge {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.status-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }

#people-list { flex: 1; margin: 0; padding: 6px; list-style: none; overflow-y: auto; }
.empty-note { margin: 0; padding: 16px 14px; color: var(--muted); }
.person {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.person:hover { background: var(--tint-2); }
.person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-detail { color: var(--muted); font-size: 12px; }

.dm-header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.dm-header button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: var(--tint-2); }
#dm-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dm-note { margin: 0; padding: 6px 12px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
#dm-log li { max-width: 85%; padding: 6px 10px; border-radius: 12px; display: flex; flex-direction: column; overflow-wrap: anywhere; }
#dm-log li.cont { margin-top: -5px; }
#dm-log .day-divider { max-width: none; padding: 0; border-radius: 0; }
.dm-text { margin: 0; white-space: pre-wrap; }
#dm-log .mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
#dm-log .theirs { align-self: flex-start; background: var(--tint-2); border-bottom-left-radius: 4px; }
.dm-time { align-self: flex-end; font-size: 10px; opacity: 0.7; }
#dm-input:disabled { opacity: 0.5; }

.status-field { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--muted); font-size: 12px; }
.status-field select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--text);
}


/* ---------- Entrada, avisos ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: safe center;
  overflow-y: auto;
  padding: 16px;
  background: rgba(10, 12, 18, 0.82);
}

.card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.card h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.card .lead { margin: 0 0 8px; color: var(--muted); }
.card label, .card .field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.card input[type="text"],
.card input[type="email"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}
.card .primary {
  margin-top: 10px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.card .hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card .error { margin: 0; color: var(--danger-ink); }

/* Montador de personagem: prévia grande à esquerda, escolhas em abas à direita. */
#join-form { width: min(620px, 100%); }
#avatar-picker { display: flex; gap: 20px; align-items: flex-start; }
.picker-stage { flex: none; width: 220px; display: flex; flex-direction: column; gap: 10px; }
.picker-tools { display: flex; gap: 8px; align-items: stretch; }
.picker-shuffle { flex: none; padding: 6px 10px; font-size: 13px; white-space: nowrap; }

.avatar-preview {
  width: 220px;
  height: 220px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 86%, rgba(255, 255, 255, 0.16), transparent 58%), linear-gradient(#2a3147, #1c2132);
  image-rendering: pixelated;
  cursor: pointer;
}
/* O boneco 3D é desenhado suave; só o desenho em pixels do 2D fica com os pixels marcados. */
#avatar-picker.is-3d canvas { image-rendering: auto; }

/* Escolha entre o mapa 2D e o 3D, logo abaixo da prévia. */
.mode-switch { flex: 1; display: flex; padding: 3px; gap: 3px; border-radius: 9px; background: var(--tint-2); }
.mode-option { flex: 1; padding: 5px 0; border: 0; border-radius: 7px; background: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.mode-option[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

.picker-choices { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
/* Abas: uma parte do personagem de cada vez. */
.picker-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.picker-tab {
  flex: 1;
  padding: 8px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.picker-tab:hover { background: var(--tint-2); }
.picker-tab[aria-selected="true"] { border-bottom-color: var(--accent); color: inherit; }
.picker-panel { display: flex; flex-direction: column; gap: 14px; min-height: 196px; }

.picker-row { display: flex; flex-direction: column; gap: 6px; }
.picker-heading { display: flex; align-items: baseline; gap: 8px; }
.picker-label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.picker-chosen { font-size: 13px; font-weight: 600; }

.swatches { display: flex; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--line);
}
.swatch[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* Todas as opções de uma parte, lado a lado, cada uma com a miniatura do personagem usando-a. */
.option-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.option {
  width: 48px;
  height: 48px;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #232938;
  box-shadow: 0 0 0 1px var(--line);
}
.option:hover { background: #2c3446; }
.option[aria-checked="true"] { border-color: var(--accent); box-shadow: none; }
.option-thumb { display: block; width: 100%; height: 100%; image-rendering: pixelated; border-radius: 6px; }

@media (max-width: 560px) {
  #avatar-picker { flex-direction: column; align-items: stretch; }
  .picker-stage { width: auto; align-items: center; }
  .picker-tools { align-self: stretch; }
  .picker-panel { min-height: 0; }
}

#game { image-rendering: pixelated; }

.card .link, .session .link {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}
.card a { color: var(--accent); }
.session { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--line); }
.card input[readonly] { opacity: 0.6; }

/* ---------- aviso de compartilhamento de tela ---------- */

#share-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(226, 87, 76, 0.45);
}
#share-banner button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #7a1f18;
  font-weight: 700;
}
.share-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: share-pulse 1.4s ease-in-out infinite; }
@keyframes share-pulse { 50% { opacity: 0.25; } }

/* Moldura vermelha em volta de tudo enquanto a tela está sendo compartilhada. */
body.sharing::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 17;
  border: 3px solid var(--danger);
  pointer-events: none;
}
body.sharing #stage { top: 60px; }
body.sharing #btn-screen[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- painel de conexão ---------- */

#netinfo {
  position: fixed;
  left: 12px;
  bottom: calc(var(--bar-height) + 12px);
  z-index: 12;
  max-width: min(440px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#netinfo:empty::before { content: "Medindo a conexão…"; color: var(--muted); }
.netinfo-row { display: flex; gap: 10px; }
.netinfo-label { flex: none; width: 92px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#reaction-menu {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bar-height) + 12px);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.reaction-emoji {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  transition: transform 120ms ease, background-color 120ms ease;
}
.reaction-emoji:hover { background: var(--tint-3); transform: scale(1.2) translateY(-2px); }
.reaction-emoji:active { transform: scale(0.92); }
.reaction-sound {
  margin-left: 4px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--tint-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.reaction-sound[aria-pressed="true"] { color: var(--text); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-height) + 16px);
  transform: translateX(-50%);
  z-index: 25;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--toast-error-bg);
  border: 1px solid rgba(226, 87, 76, 0.55);
  text-align: center;
}

/* Com o chat aberto, o mapa ocupa só a área livre para nada ficar escondido atrás dele. */
@media (min-width: 761px) {
  body:not(.chat-closed) #game { width: calc(100% - var(--chat-width) - 24px); }
}

@media (max-width: 760px) {
  :root { --chat-width: 0px; --bar-height: 108px; }
  #stage { right: 12px; }
  .tile { width: 112px; }
  .tile.screen { width: 200px; }
  #chat { left: 12px; width: auto; top: 30%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Marca: Meu Escritório Minha Vida ---------- */

.brand-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
  padding: 18px 18px 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
.brand-banner img { display: block; width: 100%; max-width: 340px; height: auto; margin-bottom: 14px; }
.brand-ribbon {
  position: relative;
  align-self: stretch;
  margin: 0 -18px;
  padding: 10px 10px 8px;
  border-radius: 0 0 14px 14px;
  background: #1d4fa8;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}
.brand-ribbon::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #1d6fd8 0 25%, #2f9e44 25% 50%, #f2b705 50% 75%, #ef5a1c 75%);
}
.brand-seal {
  position: absolute;
  top: -16px;
  right: -16px;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #ef5a1c;
  box-shadow: 0 0 0 3px #ffffff, 0 6px 14px rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(14deg);
  animation: seal-stamp 520ms cubic-bezier(0.2, 1.6, 0.4, 1) 250ms both;
}
.brand-seal::after { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(255, 255, 255, 0.7); border-radius: 50%; }
@keyframes seal-stamp {
  from { opacity: 0; transform: rotate(14deg) scale(2.2); }
  to { opacity: 1; transform: rotate(14deg) scale(1); }
}
.brand-banner--compact { padding: 12px 12px 0; }
.brand-banner--compact img { max-width: 240px; margin-bottom: 10px; }
.brand-banner--compact .brand-ribbon { margin: 0 -12px; font-size: 10px; }
.brand-banner--compact .brand-seal { width: 56px; height: 56px; font-size: 9px; }

.loading-card .lead { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card .button-link { display: block; text-align: center; text-decoration: none; }

.bar-brand { flex: none; }
.bar-brand img { display: block; height: 34px; width: auto; }

/* ---------- Cerimônia de entrega das chaves ---------- */

#ceremony { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow: hidden; pointer-events: none; }
.ceremony-card {
  position: relative;
  width: min(420px, 100%);
  padding: 28px 24px 20px;
  border-radius: 18px;
  background: #ffffff;
  color: #12151c;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: ceremony-pop 620ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.ceremony-card img { display: block; width: 100%; max-width: 300px; height: auto; margin: 6px auto 0; }
.ceremony-ribbon {
  position: absolute;
  top: -15px;
  left: 50%;
  padding: 6px 18px;
  border-radius: 6px;
  background: #ef5a1c;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-2deg);
  box-shadow: 0 6px 14px rgba(239, 90, 28, 0.4);
}
.ceremony-key { display: block; margin-top: 8px; font-size: 40px; line-height: 1; animation: key-turn 900ms ease-in-out 350ms both; }
.ceremony-title { margin: 8px 0 2px; font-size: 24px; font-weight: 900; letter-spacing: -0.01em; }
.ceremony-text { margin: 0; font-size: 15px; color: #2b303b; }
.ceremony-small { margin: 6px 0 0; font-size: 12px; color: #6b7180; }
#ceremony.leaving .ceremony-card { animation: ceremony-out 300ms ease-in forwards; }
.confetti {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall var(--fall, 2.4s) linear var(--delay, 0s) forwards;
}
@keyframes ceremony-pop { from { opacity: 0; transform: scale(0.6) translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes ceremony-out { to { opacity: 0; transform: scale(0.9) translateY(-16px); } }
@keyframes key-turn {
  0% { opacity: 0; transform: rotate(0) scale(0.4); }
  50% { opacity: 1; transform: rotate(-30deg) scale(1.25); }
  100% { transform: rotate(0) scale(1); }
}
@keyframes confetti-fall { to { transform: translate(var(--drift, 0), calc(100vh + 40px)) rotate(var(--spin, 720deg)); } }

/* ---------- Menu de reações e efeitos sonoros ---------- */

#reaction-menu { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; border-radius: 16px; width: min(372px, calc(100% - 32px)); }
/* Com muitos efeitos o menu passa da altura de telas baixas (celular deitado): rola por dentro em vez de sair por cima. */
#reaction-menu { max-height: calc(100dvh - var(--bar-height) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.menu-caption { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.reaction-row { display: flex; justify-content: space-between; gap: 4px; }
.effect-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.effect-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px 6px;
  border: 0;
  border-radius: 10px;
  background: var(--tint-1);
  font-size: 11px;
  transition: transform 120ms ease, background-color 120ms ease;
}
.effect-button:hover { background: var(--tint-3); transform: translateY(-2px); }
.effect-button:active { transform: scale(0.94); }
.effect-emoji { font-size: 22px; line-height: 1; }
#reaction-menu .reaction-sound { align-self: flex-end; margin: 2px 0 0; }

@media (max-width: 1100px) { .bar-brand img { height: 30px; } }
@media (max-width: 760px) { .bar-brand { display: none; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ---------- Câmera e áudio ---------- */

.card .secondary {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tint-1);
  font-weight: 600;
}
.card .secondary:hover { background: var(--tint-3); }
.card .secondary + .primary { margin-top: 6px; }

#settings-dialog {
  width: min(720px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
#settings-dialog::backdrop { background: rgba(10, 12, 18, 0.72); }
.settings { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.settings-header { display: flex; align-items: center; justify-content: space-between; }
.settings-header h2 { margin: 0; font-size: 18px; }
.settings-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--tint-2); }
.settings-status { margin: 0; padding: 8px 12px; border-radius: 8px; background: rgba(240, 198, 116, 0.12); color: var(--warning-ink); font-size: 13px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; }
.settings-preview { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: #0b0e14; }
.settings-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#preview-empty { color: var(--muted); font-size: 13px; }
.settings-fields, #speaker-field { display: flex; flex-direction: column; gap: 6px; }
.settings-fields label { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.settings-fields select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
}
.mic-meter { height: 8px; overflow: hidden; border-radius: 999px; background: var(--tint-2); }
#mic-level { display: block; width: 0%; height: 100%; background: var(--on); transition: width 60ms linear; }
.settings .hint { margin: 0; color: var(--muted); font-size: 12px; }
#speaker-test { align-self: flex-start; margin-top: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint-1); }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-footer .primary { padding: 9px 22px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
/* minmax(0, …): um aparelho de nome comprido não pode alargar a coluna além da tela. */
@media (max-width: 640px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }

/* Fundo da câmera: miniaturas escolhidas como botões de rádio (as setas andam entre elas). */
.settings-backgrounds { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; }
.settings-backgrounds[hidden] { display: none; }
.settings-backgrounds legend { padding: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.background-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.background-option { position: relative; display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.background-option input { position: absolute; opacity: 0; pointer-events: none; }
.background-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tint-1);
  color: var(--muted);
  font-size: 22px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.background-thumb canvas, .background-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.background-name { color: var(--muted); font-size: 11px; line-height: 1.2; text-align: center; }
.background-option:hover .background-thumb { border-color: var(--tint-3); transform: translateY(-1px); }
.background-option:has(input:checked) .background-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.background-option:has(input:checked) .background-name { color: var(--text); font-weight: 600; }
.background-option:has(input:focus-visible) .background-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
.background-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#background-upload { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint-1); font-size: 13px; }
#background-upload:hover { background: var(--tint-2); }
.background-fixed { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--tint-2); font-size: 13px; line-height: 1.4; }
.background-status { margin: 0; color: var(--muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .background-thumb { transition: none; } }

/* ---------- Barra inferior em telas menores ---------- */

.bar-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-icon { font-size: 16px; line-height: 1; }
.warning-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(240, 198, 116, 0.12); color: var(--warning-ink); font-size: 13px; }

/*
 * Sem espaço para os nomes: só os ícones (o nome continua disponível para leitores de tela).
 * No computador quem decide é o conteúdo da barra (bar-fit.js põe `bar-compact` no body quando
 * não cabe); no celular é sempre assim.
 */
body.bar-compact .bar-actions .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.bar-compact .bar-actions button { min-width: 44px; min-height: 40px; padding: 8px 10px; }
body.bar-compact .btn-icon { font-size: 18px; }
@media (max-width: 760px) {
  .bar-actions .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .btn-icon { font-size: 18px; }
}
/* Ainda apertado: some o que é acessório (o recado vira só o lápis; a contagem está na aba Pessoas). */
body.bar-tight .note-button { max-width: 44px; }
body.bar-tight .note-button .note-text, body.bar-tight .status-field > label, body.bar-tight #people-count, body.bar-tight #follow-text { display: none; }
body.bar-tight #bar { gap: 10px; }
/* Janela bem estreita: ficam só o lugar, os botões da sala, o status e os botões de ação. */
body.bar-minimal #bar .bar-brand, body.bar-minimal .note-button { display: none !important; }
body.bar-minimal .bar-actions { gap: 5px; }

/*
 * No computador a barra é uma fileira só e nada nela quebra de linha: os botões nunca encolhem,
 * e o nome do lugar e a contagem de pessoas encolhem com reticências quando falta espaço.
 */
@media (min-width: 761px) {
  #bar .bar-brand, #bar .status-field, #bar .bar-actions, #bar .room-action { flex: none; }
  #bar .bar-info { flex: 0 1 auto; overflow: hidden; }
  /* Se nem assim couberem, os botões da sala rolam de lado em vez de ficarem cortados. */
  #bar .room-buttons { flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  #bar .room-action, #bar .status-field, #bar .status-field label { white-space: nowrap; }
  #zone-label, #people-count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Celular: informações em cima, todos os botões numa fileira que ocupa a largura toda. */
@media (max-width: 760px) {
  #bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 8px;
    padding: 6px 8px 8px;
  }
  .bar-info { flex-direction: row; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
  .status-field { margin: 0; }
  .status-field > span { display: none; }
  .bar-actions { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .bar-actions button { min-width: 0; min-height: 44px; padding: 0; border-radius: 12px; }
  .bar-actions button[hidden] { display: none; }
}

/* Aviso quando o navegador bloqueia o som automático (comum no Safari e no iPhone). */
#audio-unlock {
  position: fixed;
  top: 64px;
  left: 50%;
  z-index: 19;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transform: translateX(-50%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.settings-volumes { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.settings-volumes label { color: var(--muted); font-size: 12px; font-weight: 600; }
.settings-volumes output { display: inline-block; min-width: 40px; margin-left: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.settings-volumes input[type="range"] { width: 100%; accent-color: var(--accent); }
.settings-volumes select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); }
@media (max-width: 640px) { .settings-volumes { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Microfone e câmera desligados: vermelho e ícone riscado ---------- */
.bar-actions .media-toggle[aria-pressed="false"] { background: rgba(226, 87, 76, 0.18); border-color: rgba(226, 87, 76, 0.65); color: var(--off-ink); }
.media-toggle .btn-icon { position: relative; }
.media-toggle[aria-pressed="false"] .btn-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -3px;
  right: -3px;
  height: 2px;
  border-radius: 2px;
  background: #ff5a4e;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  transform: rotate(-45deg);
}

/* ---------- Mapa: zoom, menu do botão direito, dica ao passar o mouse ---------- */
/* none: o navegador não rola nem amplia o mapa; arrastar move a câmera e a pinça vira o zoom do mapa (map-gestures.js). */
#game { touch-action: none; cursor: grab; }
#game.dragging { cursor: grabbing; }
/* Mapa em 3D (beta): a cena fica num canvas atrás do mapa, no mesmo lugar (o tamanho vem do script). */
#game-3d { position: fixed; display: block; }
body.map-3d #game { image-rendering: auto; }
#zoom-controls #zoom-3d { font-size: 12px; font-weight: 700; }
#zoom-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; vertical-align: middle; }
/* Sem o zoom de toque duplo do navegador no resto da tela (o iPhone ignora o user-scalable=no). */
html { touch-action: manipulation; }
#zoom-controls { position: fixed; top: 12px; left: 12px; z-index: 11; display: flex; flex-direction: column; gap: 4px; }
#zoom-controls button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 16px; }
#zoom-controls button:hover { background: var(--panel-solid); }
#map-tooltip, #map-menu { position: fixed; z-index: 26; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-solid); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); }
#map-tooltip { padding: 6px 10px; font-size: 12px; pointer-events: none; white-space: nowrap; }
#map-menu { display: flex; flex-direction: column; min-width: 200px; padding: 6px; }
#map-menu .menu-title { margin: 2px 8px 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
#map-menu button { padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; }
#map-menu button:hover, #map-menu button:focus-visible { background: var(--tint-2); }
.room-action {
  align-self: flex-start;
  margin: 2px 0;
  padding: 3px 10px;
  border: 1px solid #f2c230;
  border-radius: 999px;
  background: rgba(242, 194, 48, 0.12);
  color: var(--stamp-ink);
  font-size: 12px;
  font-weight: 700;
}
#people-list li { display: flex; align-items: center; gap: 4px; }
#people-list .person { flex: 1; min-width: 0; }
.person-action { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: var(--tint-1); font-size: 18px; }
.person-action:hover { background: var(--tint-3); }
/* Botão de ação dentro do aviso (ex.: "Ir até lá" quando alguém acena). */
.toast-action {
  margin-left: 10px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  white-space: nowrap;
}
.toast-action:hover { filter: brightness(1.1); }
#toast.info { background: var(--toast-info-bg); border-color: rgba(91, 141, 239, 0.6); }

/* ---------- Não perturbe ---------- */
#quiet-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 18;
  max-width: calc(100% - 120px);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--quiet-bg);
  border: 1px solid #f2c230;
  color: var(--quiet-ink);
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
}
body.sharing #quiet-banner { top: 60px; }

/* Nome do lugar e botão da sala na mesma linha; a contagem de pessoas embaixo. */
@media (min-width: 761px) {
  .bar-info { display: grid; grid-template-columns: minmax(0, auto) auto; align-items: center; justify-content: start; column-gap: 8px; }
  .bar-info #people-count { grid-column: 1 / -1; }
  .room-action { margin: 0; }
}

/* Campos nativos (e-mail, listas, preenchimento automático) no tema escuro, com texto legível. */
.card input:-webkit-autofill,
.card input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--field-solid) inset;
  transition: background-color 9999s ease-out;
}

/* ---------- Temas: escuro (padrão) e claro ---------- */
:root {
  color-scheme: dark;
  --tint-1: rgba(255, 255, 255, 0.05);
  --tint-2: rgba(255, 255, 255, 0.08);
  --tint-3: rgba(255, 255, 255, 0.13);
  --field: rgba(0, 0, 0, 0.28);
  --field-solid: #0f1219;
  --tooltip-bg: #0f1219;
  --tile-bg: #232938;
  --toast-error-bg: #2a1a1c;
  --toast-info-bg: #16263d;
  --danger-ink: #ffb4ad;
  --warning-ink: #f0c674;
  --success-ink: #7fd6a4;
  --quiet-bg: #3a2f12;
  --quiet-ink: #ffe08a;
  --off-ink: #ffc2bc;
  --stamp-ink: #f2c230;
  --series-1: #3987e5;
  --series-2: #d95926;
  --chart-grid: rgba(255, 255, 255, 0.09);
  /* Cores dos nomes no chat (message-format.js nameTone) e o fundo de uma menção a você. */
  --tone-0: #8ab8ff; --tone-1: #ffa384; --tone-2: #7fd6a4; --tone-3: #d4a8ff; --tone-4: #f2c95c; --tone-5: #6fd3dc; --tone-6: #ff94bd; --tone-7: #c5cd7e;
  --mention-bg: rgba(242, 194, 48, 0.12);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #e9edf3; --panel: rgba(255, 255, 255, 0.95); --panel-solid: #ffffff; --line: rgba(15, 23, 42, 0.13);
    --text: #1a1f2b; --muted: #5a6273; --accent: #2f6fe0; --accent-ink: #ffffff; --on: #1f9d5c; --danger: #d64036;
    --tint-1: rgba(15, 23, 42, 0.04); --tint-2: rgba(15, 23, 42, 0.07); --tint-3: rgba(15, 23, 42, 0.12);
    --field: #ffffff; --field-solid: #ffffff; --tooltip-bg: #ffffff; --tile-bg: #d9dfe8;
    --toast-error-bg: #fdecea; --toast-info-bg: #e7effd; --danger-ink: #b42318; --warning-ink: #8a5a00; --success-ink: #18794e;
    --quiet-bg: #fff4d6; --quiet-ink: #6b4b00; --off-ink: #b42318; --stamp-ink: #9a6700;
    --series-1: #2a78d6; --series-2: #eb6834; --chart-grid: rgba(15, 23, 42, 0.1);
    --tone-0: #2459b8; --tone-1: #b54a1c; --tone-2: #18794e; --tone-3: #7a3fc2; --tone-4: #8a5a00; --tone-5: #0b6f79; --tone-6: #b8336a; --tone-7: #5f6b14; --mention-bg: rgba(242, 194, 48, 0.2);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e9edf3; --panel: rgba(255, 255, 255, 0.95); --panel-solid: #ffffff; --line: rgba(15, 23, 42, 0.13);
  --text: #1a1f2b; --muted: #5a6273; --accent: #2f6fe0; --accent-ink: #ffffff; --on: #1f9d5c; --danger: #d64036;
  --tint-1: rgba(15, 23, 42, 0.04); --tint-2: rgba(15, 23, 42, 0.07); --tint-3: rgba(15, 23, 42, 0.12);
  --field: #ffffff; --field-solid: #ffffff; --tooltip-bg: #ffffff; --tile-bg: #d9dfe8;
  --toast-error-bg: #fdecea; --toast-info-bg: #e7effd; --danger-ink: #b42318; --warning-ink: #8a5a00; --success-ink: #18794e;
  --quiet-bg: #fff4d6; --quiet-ink: #6b4b00; --off-ink: #b42318; --stamp-ink: #9a6700;
  --series-1: #2a78d6; --series-2: #eb6834; --chart-grid: rgba(15, 23, 42, 0.1);
  --tone-0: #2459b8; --tone-1: #b54a1c; --tone-2: #18794e; --tone-3: #7a3fc2; --tone-4: #8a5a00; --tone-5: #0b6f79; --tone-6: #b8336a; --tone-7: #5f6b14; --mention-bg: rgba(242, 194, 48, 0.2);
}

/* Sombras mais leves no tema claro. */
:root[data-theme="light"] #map-menu, :root[data-theme="light"] #map-tooltip, :root[data-theme="light"] #settings-dialog { box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #map-menu, :root:not([data-theme="dark"]) #map-tooltip, :root:not([data-theme="dark"]) #settings-dialog { box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18); }
}

/* Logo com texto branco no tema escuro e com texto escuro no claro. */
.theme-light-only { display: none !important; }
:root[data-theme="light"] .theme-light-only { display: revert !important; }
:root[data-theme="light"] .theme-dark-only { display: none !important; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-light-only { display: revert !important; }
  :root:not([data-theme="dark"]) .theme-dark-only { display: none !important; }
}
@media (max-width: 760px) { #bar .bar-brand { display: none !important; } }

/* ---------- Direcional na tela (celular e tablet): segurar uma seta = segurar WASD ---------- */
#dpad, .hint-touch { display: none; }
@media (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
  #dpad {
    --dpad-cell: 50px;
    position: fixed;
    left: 16px;
    bottom: calc(var(--bar-height) + 16px);
    z-index: 11;
    display: grid;
    grid-template: repeat(3, var(--dpad-cell)) / repeat(3, var(--dpad-cell));
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  #dpad::after { content: ''; grid-area: 2 / 2; place-self: center; width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
  #dpad button { display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: 14px; background: transparent; color: var(--text); }
  #dpad button.active { background: var(--accent); color: var(--accent-ink); }
  #dpad svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
  .dpad-up { grid-area: 1 / 2; }
  .dpad-left { grid-area: 2 / 1; }
  .dpad-left svg { transform: rotate(-90deg); }
  .dpad-right { grid-area: 2 / 3; }
  .dpad-right svg { transform: rotate(90deg); }
  .dpad-down { grid-area: 3 / 2; }
  .dpad-down svg { transform: rotate(180deg); }
}
/* No celular o chat aberto cobre o mapa: o direcional sai junto. */
@media (pointer: coarse) and (max-width: 760px) {
  body:not(.chat-closed) #dpad { display: none; }
}

/* ---------- Presença: trancar sala, recado, seguir, aviso, pedidos e minimapa ---------- */
.room-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.lock-action { border-color: var(--danger); background: rgba(226, 87, 76, 0.12); }

.note-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 12px;
}
.note-button .note-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-button.has-note { border-style: solid; color: var(--text); background: var(--tint-1); }
.note-button:hover { background: var(--tint-2); }
@media (max-width: 760px) { .note-button { max-width: 44px; } .note-button .note-text { display: none; } }

.follow-action { border-color: var(--accent); background: rgba(91, 141, 239, 0.14); color: var(--text); }

#announcement {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 24;
  width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border: 2px solid #f2c230;
  border-radius: 14px;
  background: var(--panel-solid);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}
#announcement .announcement-title { display: block; margin-bottom: 4px; color: #f2c230; }
#announcement .announcement-text { margin: 0 0 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
#announcement .announcement-close { float: right; padding: 5px 16px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }

#prompts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bar-height) + 16px);
  z-index: 27;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100% - 32px));
}
.prompt {
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--panel-solid);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.prompt p { margin: 4px 0 10px; color: var(--muted); }
.prompt-actions { display: flex; justify-content: flex-end; gap: 6px; }
.prompt-actions button { padding: 6px 12px; border: 0; border-radius: 999px; background: var(--tint-2); font-weight: 600; }
.prompt-actions button.primary { background: var(--accent); color: var(--accent-ink); }

#minimap {
  position: fixed;
  left: 12px;
  bottom: calc(var(--bar-height) + 12px);
  z-index: 11;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
@media (pointer: coarse) { #minimap { top: 12px; bottom: auto; left: 56px; } }
#zoom-controls button[aria-pressed="true"] { border-color: var(--accent); }

#chat-log .announcement {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-left: 3px solid #f2c230;
  border-radius: 6px;
  background: var(--tint-1);
}
#chat-log .announcement-from { color: #f2c230; font-size: 12px; font-weight: 700; }
#chat-log .history { opacity: 0.75; }
#chat-log .history-time { margin-right: 6px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#chat-log .history-divider { padding: 4px 0; border-bottom: 1px dashed var(--line); text-align: center; }

.person-note { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.person-action { width: 32px; height: 32px; font-size: 16px; }

.settings-prefs { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.settings-prefs legend { padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.settings-prefs .check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.settings-prefs .check input { margin-top: 2px; accent-color: var(--accent); }
.settings-prefs .hint { margin: 0; color: var(--danger-ink); font-size: 12px; }

#note-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
#note-dialog::backdrop { background: rgba(10, 12, 18, 0.72); }

/* Atividades compartilhadas: botões que aparecem perto do móvel e a janela da atividade. */
#activity-bar { position: fixed; left: 50%; bottom: calc(var(--bar-height) + 14px); transform: translateX(-50%); z-index: 12; display: flex; gap: 8px; }
.activity-button { padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35); }
.activity-button:hover { filter: brightness(1.08); }
#activity-dialog { width: min(980px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-solid); color: inherit; }
/* Com um jogo aberto a janela ocupa a tela toda: a mesa cresce até onde a altura deixar.
   --game-fit-height é a altura que sobra para a tela do jogo, descontados título, placar e rodapé. */
#activity-dialog[data-kind] {
  width: calc(100% - 24px); max-width: none; height: calc(100% - 24px);
  /* --arena-space: o que a faixa da plateia ocupa (0 nos jogos sem ela). Entra na conta para o jogo caber sem rolagem. */
  --arena-space: 0px;
  --game-fit-height: max(200px, calc(100vh - 270px - var(--arena-space)));
}
#activity-dialog[data-kind]:has(.activity-arena) { --arena-space: calc(var(--arena-height) + 12px); }
#activity-dialog { --arena-height: clamp(110px, 24vh, 300px); }
#activity-dialog::backdrop { background: rgba(10, 12, 18, 0.72); }
.activity-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; }
.activity-header > div { flex: 1; min-width: 0; }
.activity-header h2 { margin: 0; font-size: 18px; }
.activity-header .hint { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
#activity-root { padding: 0 20px 20px; }
/* A roda do jogo: quem joga em volta da mesa, quem assiste no banco. */
.activity-arena { display: block; width: calc(100% - 40px); height: var(--arena-height); margin: 0 20px 12px; border-radius: 12px; }
/* Os jogos de cartas e de perguntas não esticam até as bordas numa tela grande: ficam no meio, legíveis. */
.activity-arena ~ #activity-root { width: 100%; max-width: 1280px; margin-inline: auto; }
/* Em tela bem grande o conteúdo desses jogos cresce junto, para não sobrar um quadro pequeno no meio. */
@media (min-width: 1800px) and (min-height: 1000px) {
  .activity-arena ~ #activity-root { zoom: 1.35; }
  /* Com o conteúdo ampliado, a altura que sobra para a tela do jogo é medida já na escala dele:
     70px de cabeçalho fora da ampliação, 200px de placar e rodapé dentro dela. */
  #activity-dialog[data-kind]:has(.activity-arena) { --game-fit-height: max(200px, calc((100vh - 70px - var(--arena-space)) / 1.35 - 200px)); }
}
/* No celular a roda fica baixa: o jogo precisa caber sem rolar. */
@media (max-width: 720px) { #activity-dialog { --arena-height: clamp(96px, 18vh, 150px); } }
.activity-chooser { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
/* Fliperamas: duas fileiras de quatro (em tela estreita, de duas em duas). */
.activity-chooser--arcade { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .activity-chooser--arcade { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.activity-option { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint-2); font-weight: 700; text-align: left; }
.activity-option:hover { background: var(--tint-3); }

/* Lista de atalhos do teclado (tecla ?). */
#shortcuts-dialog { width: min(440px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-solid); color: inherit; }
#shortcuts-dialog::backdrop { background: rgba(10, 12, 18, 0.72); }
.shortcuts { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.shortcut-list dt { white-space: nowrap; }
.shortcut-list dd { margin: 0; color: var(--muted); }
.shortcut-list kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--tint-2); font: inherit; font-weight: 600; text-align: center; }
.note-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.note-form h2 { margin: 0; font-size: 17px; }
.note-form .hint { margin: 0; color: var(--muted); font-size: 12px; }
#note-input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); }
.note-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.note-chip { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--tint-1); font-size: 12px; }
.note-chip:hover { background: var(--tint-3); }
.note-footer { display: flex; justify-content: flex-end; gap: 8px; }
.note-footer button { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--tint-2); font-weight: 600; }
.note-footer .primary { background: var(--accent); color: var(--accent-ink); }
.note-footer #note-clear { margin-right: auto; }
/* Celular: o painel aberto cobre o mapa (o minimapa sai junto) e a barra fica enxuta. */
@media (max-width: 760px) {
  body:not(.chat-closed) #minimap { display: none; }
  .status-field > label { display: none; }
  .follow-action #follow-text { display: none; }
}

/* ---------- Painel lateral: largura, aba Atividade e resumo da volta ---------- */

/* Alça na borda esquerda do painel: arrastar muda a largura (chat-width.js). */
.chat-resize {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -5px;
  z-index: 2;
  width: 10px;
  cursor: ew-resize;
  touch-action: none;
}
.chat-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 4px;
  height: 44px;
  border-radius: 999px;
  background: var(--tint-3);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}
#chat:hover .chat-resize::after, .chat-resize:focus-visible::after, #chat.resizing .chat-resize::after { opacity: 1; }
.chat-resize:hover::after, #chat.resizing .chat-resize::after, .chat-resize:focus-visible::after { background: var(--accent); }
.chat-resize:focus-visible { outline: none; }
#chat.resizing { user-select: none; }
.chat-widen {
  margin-left: auto;
  align-self: center;
  padding: 4px 8px !important;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
}
.chat-widen:hover, .chat-widen[aria-pressed="true"] { background: var(--tint-2); color: var(--text); }
@media (max-width: 760px) {
  .chat-resize, .chat-widen { display: none !important; }
}

/* Número de novidades no botão 💬 da barra, para quem está com o painel fechado. */
#btn-chat { position: relative; }
.bar-badge { position: absolute; top: -4px; right: -4px; box-shadow: 0 0 0 2px var(--panel-solid); }

/* Lista de pessoas: quem mandou mensagem que você não leu, com a prévia da última. */
.person.unread .person-name { color: var(--text); }
.person-preview { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.person.unread .person-preview { color: var(--text); font-weight: 600; }

/* Aba Atividade. */
.activity-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.activity-filters { display: flex; padding: 2px; border-radius: 999px; background: var(--tint-2); }
.activity-filters[hidden] { display: none; }
/* Sem o filtro (quem não é administrador), o "Limpar" fica sozinho à direita. */
.activity-header { justify-content: flex-end; }
.activity-header:has(.activity-filters:not([hidden])) { justify-content: space-between; }
.activity-filters button { padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.activity-filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.activity-clear { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; }
.activity-clear:hover:not(:disabled) { background: var(--tint-2); color: var(--text); }
.activity-clear:disabled { opacity: 0.45; cursor: default; }
.activity-list { flex: 1; margin: 0; padding: 6px 8px 10px; list-style: none; overflow-y: auto; }
.activity-item { position: relative; display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.activity-item + .activity-item { margin-top: 2px; }
.activity-item:hover { background: var(--tint-1); }
.activity-item.fresh { background: var(--tint-1); box-shadow: inset 3px 0 0 var(--accent); }
.activity-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--tint-2); font-size: 15px; }
.activity-item[data-kind="knock"] .activity-icon, .activity-item[data-kind="wave"] .activity-icon { background: rgba(91, 141, 239, 0.18); }
.activity-item[data-kind="announcement"] .activity-icon { background: rgba(242, 194, 48, 0.2); }
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-title { margin: 0; font-size: 13px; line-height: 1.35; }
.activity-detail { margin: 0; padding: 4px 8px; border-radius: 6px; background: var(--tint-2); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.activity-time { color: var(--muted); font-size: 11px; }
.activity-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.activity-action { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 12px; font-weight: 600; }
.activity-action:hover { background: var(--tint-2); }
.activity-divider { margin: 10px 4px 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* Cartão "Enquanto você estava fora" (na pilha de pedidos, no canto da tela). */
.away-summary { border-color: var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
/* Com o painel aberto, os cartões (resumo, batida na porta) ficam ao lado dele, sem cobrir o chat. */
@media (min-width: 761px) {
  body:not(.chat-closed) #prompts { right: calc(var(--chat-width) + 28px); }
}
.away-summary > strong { display: block; margin-bottom: 6px; }
.away-lines { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; line-height: 1.35; }
.away-lines li { display: flex; gap: 8px; }
.away-icon { flex: none; width: 18px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .chat-resize::after { transition: none; } }

/* ---------- Envio de arquivos (cartões no canto da tela) ---------- */

.file-card { display: flex; flex-direction: column; gap: 6px; border-color: var(--line); }
.file-card[data-state="asking"] { border-color: var(--accent); }
.file-card[data-state="done"] { border-color: var(--on); }
.file-card[data-state="failed"], .file-card[data-state="cancelled"] { border-color: var(--danger); }
.file-title { font-size: 14px; }
.file-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0; padding: 6px 8px; border-radius: 8px; background: var(--tint-2); font-size: 13px; }
.file-label { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-size { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--tint-2); }
.file-bar[hidden] { display: none; }
.file-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 200ms linear; }
.file-card[data-state="done"] .file-bar > span { background: var(--on); }
.file-status { margin: 0 !important; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-status[hidden] { display: none; }
.file-card .prompt-actions { margin-top: 2px; }

/* 📎 no topo da conversa e o destaque ao arrastar um arquivo para dentro dela. */
.dm-header .dm-file { margin-left: auto; flex: none; }
#view-dm.dropping { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius); }
#view-dm.dropping #dm-log::after { content: "Solte para enviar o arquivo"; align-self: center; margin: auto; color: var(--accent); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .file-bar > span { transition: none; } }

/* Chat em dois canais: cada um esconde as mensagens do outro. */
#chat-log[data-show="near"] > li[data-channel="all"],
#chat-log[data-show="all"] > li[data-channel="near"] { display: none; }
.scope button { display: inline-flex; align-items: center; gap: 5px; }
.scope-badge { min-width: 16px; padding: 0 5px; font-size: 10px; line-height: 16px; }
.chat-empty { text-align: center; font-size: 13px; }
.chat-empty[hidden] { display: none; }

/* ---------- gravação de chamada ---------- */

/* Faixa fixa no alto enquanto a chamada é gravada (para quem grava e para quem é gravado). */
#rec-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(226, 87, 76, 0.45);
}
#rec-banner button {
  flex: none;
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #7a1f18;
  font-weight: 700;
}
.rec-time { font-variant-numeric: tabular-nums; padding-right: 6px; }
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: share-pulse 1.4s ease-in-out infinite; }
body.recording-paused #rec-banner { background: #8a6a12; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
body.recording-paused #rec-banner button { color: #4a3806; }
body.recording-paused #rec-banner .rec-dot { animation: none; border-radius: 2px; }
/* Moldura em volta de tudo: vermelha gravando, âmbar em pausa. */
body.recording::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 17;
  border: 3px solid var(--danger);
  pointer-events: none;
}
body.recording-paused::after { border-color: #c9a227; }
body.recording #stage, body.recording #quiet-banner { top: 60px; }
/* Gravando e compartilhando a tela ao mesmo tempo: as duas faixas, uma embaixo da outra. */
body.recording.sharing #share-banner { top: 58px; }
body.recording.sharing #stage, body.recording.sharing #quiet-banner { top: 106px; }
#btn-record[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; opacity: 1; cursor: default; }

/* Pedido de aceite: no meio da tela, só sai aceitando ou recusando. */
#rec-consent {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 2px solid var(--danger);
  border-radius: 16px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
#rec-consent::backdrop { background: rgba(10, 12, 18, 0.72); }
.rec-consent { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.rec-consent h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.rec-consent p { margin: 0; line-height: 1.5; }
.rec-consent-badge { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; }
.rec-consent-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.rec-consent-actions button { padding: 10px 18px; border: 0; border-radius: 10px; font-weight: 700; }
.rec-consent-actions .secondary { background: var(--tint-2); color: var(--text); }
.rec-consent-actions .primary { background: var(--accent); color: var(--accent-ink); }

/* Quadro com a resposta de cada participante e cartão dos arquivos prontos. */
.rec-panel { border-color: var(--danger); }
.rec-people { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; padding: 0; list-style: none; }
.rec-person { display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 8px; background: var(--tint-1); font-size: 13px; }
.rec-person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rec-person-answer { flex: none; color: var(--muted); }
.rec-result { border-color: var(--accent); }
.rec-result .rec-note { font-size: 12px; }
.rec-downloads { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.rec-download { display: block; padding: 9px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center; text-decoration: none; }
.rec-download.done { background: var(--tint-2); color: var(--text); }
.rec-download.done::after { content: " ✓"; }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
@media (max-width: 720px) {
  #rec-banner { flex-wrap: wrap; justify-content: center; border-radius: 16px; }
}
/* Arquivos da gravação ainda por baixar: o cartão fica por cima do aviso de tela cheia ("conexão perdida"). */
body.recording-files #prompts { z-index: 31; }

/* ---------- apresentação: tela compartilhada grande, câmeras na lateral ---------- */

.tile-minimize { display: none; }
#stage.presenting {
  --side-width: 200px;
  --side-tile: 150px;
  bottom: calc(var(--bar-height) + 12px);
  z-index: 15;
  display: grid;
  grid-template-columns: var(--side-width);
  /* Uma linha por câmera: do tamanho normal quando cabem, menores quando são muitas. */
  grid-template-rows: repeat(var(--side-count, 1), minmax(0, var(--side-tile)));
  justify-content: end;
  align-content: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 12, 18, 0.94);
  pointer-events: auto;
}
#stage.presenting .tile { width: 100%; height: 100%; aspect-ratio: auto; cursor: default; box-shadow: none; }
#stage.presenting .tile.screen:not(.main) { cursor: zoom-in; }
/* A tela ocupa tudo o que sobra à esquerda da coluna de câmeras: nada fica por cima dela. */
#stage.presenting .tile.main {
  position: absolute;
  inset: 10px calc(var(--side-width) + 20px) 10px 10px;
  width: auto;
  height: auto;
  background: #000;
}
#stage.presenting.solo .tile.main { right: 10px; }
#stage.presenting .tile.main .tile-minimize {
  position: absolute;
  top: 8px;
  right: 8px;
  display: block;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#stage.presenting .tile.main .tile-minimize:hover { background: rgba(10, 12, 18, 0.92); }
@media (max-width: 760px) {
  #stage.presenting { --side-width: 96px; --side-tile: 72px; gap: 6px; padding: 6px; }
  #stage.presenting .tile.main { inset: 6px calc(var(--side-width) + 12px) 6px 6px; }
  #stage.presenting.solo .tile.main { right: 6px; }
}

/* ---------- empresa dona do escritório (nome e logo cadastrados no painel) ---------- */
.company-badge { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.company-logo { display: block; width: auto; height: 40px; max-width: 160px; object-fit: contain; }
.company-name { overflow: hidden; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.card [data-company] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint-1); }
#company-chip {
  position: fixed;
  top: 12px;
  left: 56px;
  z-index: 11;
  max-width: min(260px, calc(100vw - 140px));
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  pointer-events: none;
}
#company-chip .company-logo { height: 24px; max-width: 96px; }
#company-chip .company-name { font-size: 13px; }
#company-chip .company-badge { justify-content: flex-start; gap: 8px; }
.guest-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tint-1); font-size: 13px; }

/* ---------- Modo foco: botão ao lado do status e painel discreto no canto (música e pomodoro) ---------- */
.focus-button[aria-pressed="true"] { border-style: solid; border-color: var(--accent); color: var(--text); background: var(--tint-1); }
/* Mesmo na barra mínima o botão de foco fica (o do recado some). */
body.bar-minimal .note-button.focus-button { display: inline-flex !important; }
#focus-panel {
  position: fixed;
  top: 60px;
  right: calc(var(--chat-width) + 16px);
  z-index: 17;
  width: min(264px, calc(100% - 32px));
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}
body.sharing #focus-panel, body.recording #focus-panel { top: 108px; }
.focus-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.focus-header h2 { margin: 0; font-size: 14px; }
.focus-icon { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; }
.focus-icon:hover { background: var(--tint-2); color: var(--text); }
#focus-panel.collapsed .focus-icon { transform: rotate(-90deg); }
.focus-body { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.focus-pomodoro { padding: 8px 10px 10px; border-radius: 10px; background: var(--tint-1); text-align: center; }
.focus-phase { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
#focus-panel[data-phase="short"] .focus-phase, #focus-panel[data-phase="long"] .focus-phase { color: var(--success-ink); }
.focus-dots { letter-spacing: 2px; font-size: 10px; }
.focus-clock { margin: 2px 0 8px; font: 700 40px/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.focus-row { display: flex; gap: 6px; justify-content: center; }
.focus-row button, .focus-exit { padding: 7px 12px; border: 0; border-radius: 9px; font-weight: 700; font-size: 13px; }
#focus-panel .primary { background: var(--accent); color: var(--accent-ink); }
#focus-panel .secondary { background: var(--tint-2); color: var(--text); }
.focus-music { margin: 0; padding: 0; border: 0; }
.focus-music legend { padding: 0; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.focus-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; }
.focus-styles button { padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: none; font-size: 12px; white-space: nowrap; }
.focus-styles button:hover { background: var(--tint-2); }
.focus-styles button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.focus-volume { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.focus-volume input { flex: 1; min-width: 0; accent-color: var(--accent); }
.focus-exit { align-self: stretch; }
@media (max-width: 760px) {
  #focus-panel { top: auto; bottom: calc(var(--bar-height) + 12px); right: 12px; }
}
