/* MesaVTT — visual minimalista, escuro, acento vermelho (preto e vermelho, referência
   ao logo — pentagrama vermelho, cor amostrada direto do PNG: #d20f11) */
:root {
  --bg: #0d0d10;
  --panel: #16161b;
  --panel-2: #1e1e25;
  --line: #28282f;
  --text: #ececf1;
  --text-dim: #8b8b97;
  --accent: #c81e1e;
  --accent-hover: #e13a3a;
  /* o vermelho da identidade como cor de TEXTO em painel escuro só dá 3:1; este tom mais claro dá 4,8:1 no --panel-2 (auditoria
     de 2026-11-18). Borda, fundo e ícone grande continuam no --accent */
  --accent-text: #f05252;
  /* hover do botão cheio: o --accent-hover com texto branco dava 4,3:1; este passa de 4,5 */
  --accent-strong: #d92626;
  --accent-ink: #ffffff;
  /* "perigo" (excluir/remover) fica em laranja, não vermelho — senão coincidiria
     visualmente com o acento vermelho novo e confundiria botão primário com destrutivo */
  --danger: #f97316;
  --danger-dim: #fdba74;
  --font: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* BARRAS DE ROLAGEM do site inteiro (2026-11-13, pedido do usuário: "arrume todos os scrolls que estão padrão do navegador"): finas, escuras,
   sem trilho e sem setas. O Firefox usa scrollbar-width/color; Chrome, Edge e Safari usam ::-webkit-scrollbar. Regras próprias de um
   elemento (painel compacto sem barra, por exemplo) continuam valendo por serem mais específicas */
/* scrollbar-width/color só no Firefox: no Chrome eles têm prioridade sobre o ::-webkit-scrollbar e o Chrome do Windows desenha
   as setinhas em cima e embaixo (print do usuário); com só o ::-webkit-scrollbar a barra fica lisa, sem setas */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: #3a3a45 transparent; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #3a3a45; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #55555f; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

h1, h2, h3 { font-family: var(--font); font-weight: 600; }

/* ---------- Landing ---------- */
/* (o redesign estilo Alchemy com as artes de personagem foi tentado em 3 versões e
   revertido por inteiro a pedido — "volte ao normal antes de decidirmos colocar a arte,
   com o menu no meio"; as artes continuam em public/img, incluindo as versões
   otimizadas *_hero.webp, pra uma próxima tentativa) */
body.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg); /* liso: o brilho vermelho e a vinheta saíram a pedido do usuário (2026-11-25) */
}
.landing-card { width: min(420px, 92vw); padding: 32px 0; }
/* ---------- TELA INICIAL (logado, 2026-11-17; layout A2 aprovado em docs/prototipos/menu-principal-v2a2.html) ---------- */
.landing-card.home-wide { width: min(1100px, 94vw); }
.landing-card.home-wide.home-many { width: min(1560px, 94vw); } /* cinco ou seis mesas: usa a tela larga */
.home-wide .brand-wrap { margin-bottom: 26px; }
/* o nome do usuário e os amigos no canto de cima, sem a barra comprida */
body.home-logged .user-bar { position: fixed; top: 14px; right: 22px; z-index: 40; margin: 0; padding: 0; background: none; border: 0; gap: 8px; }
body.home-logged .user-menu-trigger { margin: 0; padding: 4px 2px; background: none; border: 0; border-radius: 8px; }
body.home-logged .user-menu-trigger:hover { background: none; color: var(--text); }
body.home-logged .user-menu-trigger .avatar-small { width: 26px; height: 26px; }
body.home-logged .user-menu-dropdown { left: auto; right: 0; }
body.home-logged #btn-open-friends { background: none; border: 0; }
body.home-logged #btn-open-friends:hover { color: var(--text); }
.home-sec-title { font-size: 13px; font-weight: 600; color: var(--text-dim); margin: 0; }
.home-sec-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.home-sec-acts { display: flex; align-items: center; gap: 18px; }
.home-sec-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.home-sec-link:hover { color: var(--text); }
.home-sec-link b { color: var(--text); font-weight: 600; }
/* convite de mesa pendente */
.home-invites { display: flex; flex-direction: column; gap: 8px; margin: 0 auto 22px; max-width: 760px; }
.home-invites[hidden] { display: none; }
.home-invite { display: flex; align-items: center; gap: 12px; background: var(--panel-2, #1e1e25); border: 1px solid rgba(200, 30, 30, 0.55); border-radius: 12px; padding: 12px 14px; }
.home-invite-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-dim); }
.home-invite-text b { color: var(--text); }
.home-invite .btn { width: auto; flex-shrink: 0; margin: 0; }
/* Continuar: até 4 mesas + o cartão "+ Nova mesa" */
.home-continue { margin-bottom: 22px; }
.home-continue-list { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 12px; }
.home-continue-list > .home-empty { grid-column: 1 / -1; }
@media (max-width: 1279px) { .home-continue-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } .home-continue-list > .hc-card:nth-child(n+5) { display: none; } }
.hc-card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color 0.15s; }
.hc-card:hover, .hc-card:focus-visible { border-color: #e70904; }
/* a tinta sobe por trás do nome (inkOnHover em index.html) */
.hc-body { position: relative; isolation: isolate; }
.hc-body .liquid-fill { inset: 0; width: 100%; height: 100%; border-radius: 0; }
.hc-card.inked .hc-body { background: #e70904; }
.hc-name, .hc-meta { transition: color 0.18s 0.12s; }
.hc-card.ink .hc-name, .hc-card.ink .hc-meta { color: #fff; }
.hc-thumb { position: relative; display: block; aspect-ratio: 16 / 10; background: #1a1a20; overflow: hidden; }
.hc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hc-thumb.has-live::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(13, 13, 16, 0.88), transparent 55%); pointer-events: none; }
/* mesa sem mapa: um desenho no lugar da letra no quadrado cinza */
.hc-noart { position: absolute; inset: 0; display: grid; place-items: center;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, 0.05) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(255, 255, 255, 0.05) 23px 24px), #1a1a20; }
.hc-noart svg { width: 44px; height: 44px; color: rgba(236, 236, 241, 0.35); }
/* quem está na mesa agora */
.hc-people { position: absolute; left: 8px; bottom: 8px; z-index: 1; display: flex; align-items: center; padding: 4px 7px 4px 4px; border-radius: 999px; background: rgba(13, 13, 16, 0.88); }
.hc-thumb.has-live .hc-people { bottom: 32px; }
.hc-face { position: relative; width: 26px; height: 26px; margin-left: -6px; }
.hc-face:first-child { margin-left: 0; }
.hc-face-pic { position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: #2a2a33; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px var(--c, #4a4a55), 0 0 0 3px rgba(13, 13, 16, 0.9); }
.hc-face-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hc-face .hc-crown { position: absolute; left: 50%; top: -7px; width: 13px; height: 10px; margin: 0; translate: -50% 0; stroke: #0d0d10; stroke-width: 1.5; paint-order: stroke; }
.hc-more { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--text); }
.hc-crown { flex-shrink: 0; width: 15px; height: 12px; margin-left: 6px; fill: #ffd60a; }
.hc-live { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-dot { width: 8px; height: 8px; border-radius: 50%; background: #55555f; flex-shrink: 0; }
.hc-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.hc-dot.warn { background: var(--accent-hover); }
.hc-body { display: block; padding: 10px 12px 12px; }
.hc-name { display: flex; align-items: center; font-weight: 600; font-size: 14px; min-width: 0; }
.hc-name-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-meta { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "Nova mesa": botão na linha do título, o campo abre embaixo dele */
.home-new { position: relative; }
.home-new-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.home-new-btn:hover { background: var(--accent-strong); }
.home-new-btn .ui-ico { width: 14px; height: 14px; }
.hc-new-form { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(300px, 86vw); display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.hc-new-form[hidden] { display: none; }
.hc-new-form input[type=text] { margin: 0; width: 100%; box-sizing: border-box; }
.hc-new-actions { display: flex; gap: 8px; }
.hc-new-actions .btn { flex: 1; width: auto; margin: 0; padding-left: 6px; padding-right: 6px; }
/* embaixo: entrar numa mesa | amigos online */
.home-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.home-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.home-box-title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.home-box-desc { font-size: 12px; color: var(--text-dim); margin: 0 0 10px; }
.home-lower.solo { grid-template-columns: 1fr; }
.home-lower.solo .home-join { display: flex; align-items: center; gap: 20px; }
.home-lower.solo .home-join .home-box-title { margin: 0; white-space: nowrap; }
.home-lower.solo .home-join .home-box-desc { display: none; }
.home-lower.solo .home-join-row { flex: 1; min-width: 0; }
.home-join-row { display: flex; gap: 8px; }
.home-join-row input { flex: 1; min-width: 0; margin: 0; }
.home-join-row .btn { width: auto; flex-shrink: 0; margin: 0; padding-left: 18px; padding-right: 18px; }
.home-friends { margin-top: 6px; }
.home-friend { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.home-friend:first-child { border-top: 0; }
.hf-av { position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: #2a2a33; flex-shrink: 0; cursor: pointer; }
.hf-av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hf-av .hc-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 2px solid var(--panel); box-shadow: none; z-index: 1; }
.hf-text { min-width: 0; flex: 1; }
.hf-name { font-weight: 600; font-size: 14px; }
.hf-where { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-friend .btn { width: auto; flex-shrink: 0; margin: 0; padding: 6px 12px; font-size: 13px; }
.home-friends-more { display: block; width: 100%; background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 13px; padding: 8px 0 0; cursor: pointer; }
.home-friends-more:hover { color: var(--text); }
.home-friends-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-dim); padding-top: 4px; }
.home-friends-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; flex-shrink: 0; }
.home-friends-link:hover { color: var(--accent-text); }
.home-empty { margin: 4px 0; font-size: 13px; color: var(--text-dim); }
/* entrada animada da tela inicial (ver playIntro em index.html): "backwards" só segura o começo durante o atraso; no fim a classe sai */
@keyframes homeIn { from { opacity: 0; transform: translateY(22px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes homeDrop { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes homeSeal { 0% { opacity: 0; transform: scale(0.8) rotate(-10deg); } 60% { opacity: 1; transform: scale(1.04) rotate(1.5deg); } 100% { opacity: 1; transform: none; } }
/* ---------- ENTRAR NA MESA (table-door.js): a tinta que sai do menu e o selo que enche ---------- */
#join-error-back[hidden] { display: none; } /* o .btn vencia o [hidden] e o botão aparecia sempre */
.join-progress { margin: 4px 0 0; min-height: 18px; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
html:not(.door) .join-progress { display: none; }
.door-ink { position: fixed; pointer-events: none; }
.door-ink.door-full { left: 0; top: 0; width: 100%; height: 100%; z-index: 100; } /* entrada na mesa: cobre a tela, por baixo da janela (texto por cima) */
.door-ink.door-over { z-index: 450; pointer-events: auto; }
body.room-entering > .door-ink.door-over { z-index: 100; pointer-events: none; } /* abrindo a mesa: já dá pra mexer no que aparece */
/* por classe, não pelo id: o app.js troca o id da janela quando a entrada é aceita e o estilo sumia, deixando a mesa aparecer por trás */
html.home-red::before { content: ''; position: fixed; inset: 0; z-index: 400; background: #a3090a; } /* o menu recebendo a tinta da mesa, antes do primeiro quadro */
.door-ink.door-pass { pointer-events: none !important; }
html.door .join-gate { animation: none !important; background: radial-gradient(circle 600px at 50% calc(50% - 40px), #1f0f12 0, #1b0e11 25%, #140e11 50%, #0f0d10 75%, #0d0d10 100%) #0d0d10; }
html.door.door-red .join-gate { background: #a3090a; }
html.door.door-live .join-gate { background: transparent; } /* quem pinta o fundo é o canvas da entrada (table-door.js) */
html.door .join-gate > .modal { animation: none !important; position: fixed; left: 50%; top: calc(50% - 6px + var(--door-r, 150px)); translate: -50% 0; width: min(420px, 90vw); padding: 0; background: none; border: 0; box-shadow: none; text-align: center; opacity: 0; transition: opacity 0.25s; }
html.door .join-gate.door-say > .modal { opacity: 1; }
html.door .join-gate h2 { margin: 0; font-size: 15px; }
html.door .join-gate .error { margin: 6px 0 0; }
html.door .join-gate #join-error-back { width: auto; padding-left: 20px; padding-right: 20px; }
.join-gate.door-err .join-progress { display: none; }

/* ---------- ABERTURA DO SITE (seal-intro.js): a tela vermelha que vira o selo ---------- */
html.intro-on:not(.intro-drawn)::before { content: ''; position: fixed; inset: 0; z-index: 400; background: #a3090a; animation: intro-red-in 0.2s ease-out backwards; } /* antes do primeiro quadro; sobe do escuro em vez de entrar de corte */
@keyframes intro-red-in { from { background: #0d0d10; } }
.seal-ink { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 400; cursor: pointer; }
.seal-goat, .seal-seal { position: fixed; left: 0; top: 0; z-index: 401; max-width: none; pointer-events: none; transform-origin: 0 0; will-change: transform; opacity: 0; }
html.intro-on :is(.brand-logo, .user-menu-trigger, #btn-open-friends, #home-invites > *, #home-continue-list > *, .home-lower .home-box, #auth-panels .auth-box, .home-sec-head) { transition: opacity 0.3s; }
html.intro-on :is(.user-menu-trigger, #btn-open-friends, #home-invites > *, #home-continue-list > *, .home-lower .home-box, #auth-panels .auth-box) { transition: none; } /* aparecem inteiros por baixo do líquido, que escorre */
html.intro-on :is(.brand-logo, .user-menu-trigger, #btn-open-friends, #home-invites > *, #home-continue-list > *, .home-lower .home-box, #auth-panels .auth-box, .home-sec-head):not(.intro-shown) { opacity: 0 !important; pointer-events: none; }
html.intro-skip :is(.seal-ink, .seal-goat, .seal-seal) { transition: opacity 0.24s; opacity: 0 !important; }
html.intro-skip :is(.brand-logo, .user-menu-trigger, #btn-open-friends, #home-invites > *, #home-continue-list > *, .home-lower .home-box, #auth-panels .auth-box, .home-sec-head) { transition: opacity 0.24s; }
.anim-in { animation: homeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0ms) backwards; }
.anim-drop { animation: homeDrop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0ms) backwards; }
.anim-seal { animation: homeSeal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0ms) backwards; }
.anim-wait { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .anim-in, .anim-drop, .anim-seal { animation: none; }
  .anim-wait { opacity: 1; }
}
@media (max-width: 860px) {
  .home-continue-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-lower { grid-template-columns: 1fr; }
  .home-lower.solo .home-join { flex-direction: column; align-items: stretch; gap: 10px; }
  .home-sec-head { flex-wrap: wrap; gap: 10px; }
  body.home-logged .user-bar { right: 12px; top: 10px; }
  .landing-card.home-wide { padding-top: 64px; } /* o nome fixo no canto não cobre o selo */
}

/* selo (já traz o nome escrito) como herói acima do menu, no fluxo normal. O h1 existe
   só pra acessibilidade/SEO — o nome visível é o do próprio selo */
.brand-wrap { display: flex; justify-content: center; margin: 0 0 24px; }
.brand-seal { margin: 0; line-height: 0; }
.brand-logo {
  width: min(260px, 62vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)); /* só a sombra de contato: o halo vermelho saiu com o gradiente do fundo (2026-11-25) */
  transition: transform 0.25s ease, filter 0.25s ease;
}
.brand-logo:hover {
  transform: scale(1.04) rotate(-2deg);
}
.brand {
  position: relative;
  z-index: 1;
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 28px;
  text-align: center;
  letter-spacing: -0.5px;
  /* halo escuro atrás das letras — sem isso o texto (branco/vermelho) se perde em cima
     do logo (também branco/vermelho) na tela inicial; camadas de raio crescente simulam
     um contorno suave em vez de uma sombra deslocada de um lado só */
  text-shadow:
    0 0 6px rgba(0, 0, 0, 0.95),
    0 0 14px rgba(0, 0, 0, 0.9),
    0 0 24px rgba(0, 0, 0, 0.75),
    0 2px 3px rgba(0, 0, 0, 0.9);
}
.brand span { color: var(--accent-text); }
/* margin:0 sobrescrevendo o `margin:0 0 28px` de `.brand` (esse é só pro título da tela
   inicial, sobre o logo — aqui, dentro da `.topbar` da mesa, ele inflava a barra inteira) */
.brand.small { font-size: 18px; text-align: left; text-decoration: none; color: var(--text); margin: 0; }
/* só o bode (goat_nav.png, versão 96px de goat.png) no lugar do texto na navbar da mesa */
.brand-small-seal { display: flex; align-items: center; line-height: 0; }
/* margem negativa: o bode (32px) ocupa só 24px de layout, então a .topbar continua com
   40px exatos (os painéis do mestre/jogadores em top:56px dependem dessa altura).
   A arte é preta com detalhes brancos — o halo vermelho evita que a silhueta suma no
   fundo escuro da barra */
.brand-small-seal img {
  height: 32px; width: auto; margin: -4px 0; display: block;
  filter: drop-shadow(0 0 5px rgba(200, 30, 30, 0.6));
  transition: transform 0.2s ease, filter 0.2s ease;
}
.brand-small-seal:hover img { transform: scale(1.1) rotate(-3deg); filter: drop-shadow(0 0 8px rgba(225, 58, 58, 0.9)); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }

/* ---------- Tela de login: formulário com as abas Entrar / Criar conta ---------- */
.auth-box { width: 100%; }
.auth-tabs { display: flex; gap: 22px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-tab { margin: 0; padding: 0 0 10px; background: none; border: 0; border-radius: 0; color: var(--text-dim); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: color 0.15s, box-shadow 0.15s; }
.auth-tab:hover { color: var(--text); }
.auth-tab[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.auth-pane[hidden] { display: none; }
.auth-pane .btn.primary { width: 100%; margin-top: 6px; }
.auth-pane #btn-forgot-password { display: block; margin: 14px auto 0; }

/* ---------- Cartões expansíveis (não usados mais na tela inicial; o acordeão do JS segue genérico) ---------- */
.action-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.action-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.action-card:hover { border-color: var(--accent); }
.action-card.expanded { border-color: var(--accent); }

.action-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: var(--font);
}
.action-card-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--accent-text);
  transition: background 0.15s;
}
.action-card-icon svg { width: 20px; height: 20px; }
.action-card.expanded .action-card-icon { background: var(--accent); color: var(--accent-ink); }
.action-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.action-card-title { font-size: 15px; font-weight: 600; }
.action-card-desc { font-size: 12px; color: var(--text-dim); }
.action-card-chevron {
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}
.action-card.expanded .action-card-chevron { transform: rotate(90deg); color: var(--accent-text); }

/* técnica grid-template-rows 0fr -> 1fr: anima até a altura de conteúdo sem precisar
   medir em JS (max-height exigiria um valor fixo grande o bastante e chutado) */
.action-card-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}
.action-card.expanded .action-card-collapse { grid-template-rows: 1fr; }
/* o item do grid (`.action-card-body`) não pode ter padding — padding nunca é
   comprimido por overflow:hidden nem por min-height:0, então a linha nunca fecharia
   até 0 de verdade (ficaria travada na altura do padding). O padding visual mora no
   wrapper INTERNO (`-inner`), que não é ele mesmo o item do grid */
.action-card-body { overflow: hidden; min-height: 0; }
.action-card-body-inner { padding: 0 18px 18px; }
.action-card-body-inner label:first-child { margin-top: 2px; }
.action-card-empty { color: var(--text-dim); font-size: 13px; margin: 0; }

/* max-height+scroll interno (mesmo padrão de .library-list/.door-sounds-modal .merge-list)
   — reportado com print: muitas pastas/mesas fazem o card inteiro crescer sem limite e
   empurrar o resto da tela inicial pra fora ("o conteudo sai da tela"). A lista agora
   pára de crescer a partir de 46vh e rola por dentro; o resto do card (breadcrumb,
   "+ Nova pasta", mensagem de vazio) continua sempre visível, fora da área que rola */
.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
/* virou COLUNA (nome numa linha, botões de ação na linha de baixo) — pedido explícito
   comparando com print: "o nome da mesa fica muito apertado ali... aumentar
   horizontalmente" foi descartado de propósito (alargar a página quebraria a coluna
   estreita centralizada que login/criar/etc já usam) a favor de dar mais respiro
   VERTICAL ao nome em vez de espremer ele contra 3 botões na mesma linha — mesma técnica
   já usada pro popup "Sons" quando o nome de som ficou espremido lá */
.room-list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.15s;
}
.room-list-item:hover { border-color: var(--accent); }
.room-list-link {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
/* linha de baixo: renomear/código/excluir (mesas próprias) — alinhados à direita, mesmo
   lugar visual de quando ainda dividiam a linha com o nome */
.room-list-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
/* pasta de organização na lista "Carregar mesa" (estilo biblioteca de tokens) — mesma
   linha (.room-list-rename-row) do modo "renomear" mesa, só que ícone+nome+excluir em
   vez de thumb+nome+salvar/cancelar */
.room-folder-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--panel);
  display: grid;
  place-items: center;
  color: var(--accent-text);
  flex-shrink: 0;
}
.room-folder-icon svg { width: 60%; height: 60%; }
/* select "mover pra pasta" — mesma pílula discreta do .room-list-copy ao lado, só que é
   um <select> (precisa de padding/tamanho de fonte próprios, a regra genérica de
   formulário do app deixaria ele grande/branco demais nesse contexto compacto) */
.room-folder-select {
  flex-shrink: 0;
  display: inline-block;
  width: auto;
  max-width: 130px;
  margin-top: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
}
.room-folder-select:hover { border-color: var(--accent); color: var(--text); }
/* modo "renomear": thumb+input+salvar+cancelar viram UMA linha só (não mais um <a> — ver
   comentário no JS), envolvidos nesse wrapper pra continuar sendo o único filho direto
   do item (que agora é coluna) e não espalhar cada botão numa linha própria */
.room-list-rename-row { display: flex; align-items: center; gap: 8px; }
.room-list-date { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
/* miniatura do mapa (tela inicial): retrato pequeno em paisagem, cortado pra caber —
   quando a mesa não tem mapa o <img> nem existe (onerror remove), o item fica como antes */
.room-list-thumb {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
/* flex:1 pro nome ocupar o meio (a miniatura entrou como primeiro filho do link — sem
   isso o space-between do link espalharia thumb/nome/data de um jeito estranho) */
.room-list-name-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.room-list-name-wrap > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.room-status-badge.closed { background: rgba(200, 30, 30, 0.15); color: var(--accent-text); }
/* selo POSITIVO (verde): "Mestre online" no histórico do jogador, "N online" nas mesas
   do mestre — mesma pílula dos selos de bloqueio, só a cor diz "pode entrar/tem gente" */
.room-status-badge.online { background: rgba(34, 197, 94, 0.15); color: #4ade80; }

/* ---------- CARREGAR MESA (2026-11-13, opção B): busca, abertas por último, pastas e grade ---------- */
.lm-top { display: flex; gap: 8px; margin-bottom: 10px; }
.lm-search { position: relative; flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; }
.lm-search svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-dim); pointer-events: none; }
.lm-search input[type="text"] { width: 100%; height: 36px; margin: 0; padding: 0 10px 0 34px; font-size: 13px; border-radius: 9px; }
.lm-btn { display: flex; align-items: center; gap: 6px; flex-shrink: 0; height: 36px; margin: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.lm-btn svg { width: 17px; height: 17px; color: var(--text-dim); }
.lm-btn:hover { border-color: #3a3a45; background: #25252d; }
.lm-crumb { margin: 0 0 8px; }
.lm-crumb[hidden] { display: none; }
.lm-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; padding-right: 4px; }
.lm-list > * { flex-shrink: 0; }
.lm-section { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.lm-section:first-child { margin-top: 0; }
.lm-recent, .lm-folders { display: flex; flex-direction: column; gap: 6px; }
.lm-folders { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.lm-row, .lm-folder { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); text-decoration: none; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.lm-row:hover, .lm-folder:hover, .lm-folder:focus-visible { border-color: var(--accent); background: #22222a; outline: none; }
.lm-row-thumb { position: relative; flex-shrink: 0; width: 56px; height: 38px; border-radius: 7px; overflow: hidden; background: #2a2a33; }
.lm-row-mid { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.lm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.lm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-dim); }
.lm-folder-icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 8px; background: rgba(200, 30, 30, 0.12); color: var(--accent-text); }
.lm-folder-icon svg { width: 20px; height: 20px; }
.lm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.lm-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); text-decoration: none; overflow: hidden; transition: border-color 0.12s, transform 0.12s; }
.lm-card:hover { border-color: var(--accent); }
.lm-card-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #2a2a33; overflow: hidden; }
/* mesa sem mapa: a primeira letra do nome no lugar da miniatura */
.lm-card-thumb::before, .lm-row-thumb::before { content: attr(data-letter); position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 600; color: #4a4a55; }
.lm-row-thumb::before { font-size: 16px; }
.lm-card-thumb img, .lm-row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lm-card-thumb .room-status-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(13, 13, 16, 0.85); }
.lm-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 7px 9px 9px; }
.lm-dots { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text-dim); cursor: pointer; }
.lm-dots svg { width: 16px; height: 16px; }
.lm-dots:hover { border-color: var(--line); background: #0d0d10; color: var(--text); }
.lm-card-thumb .lm-dots, .hc-thumb .lm-dots { position: absolute; z-index: 2; top: 6px; right: 6px; background: rgba(13, 13, 16, 0.8); color: var(--text); opacity: 0; transition: opacity 0.12s; }
.lm-card:hover .lm-card-thumb .lm-dots, .lm-card-thumb .lm-dots:focus-visible, .hc-card:hover .hc-thumb .lm-dots, .hc-thumb .lm-dots:focus-visible { opacity: 1; }
@media (hover: none) { .lm-card-thumb .lm-dots, .hc-thumb .lm-dots { opacity: 1; } }
.lm-rename { width: 100%; height: 26px; margin: 0; padding: 2px 6px; font-size: 13px; }
/* a janela grande do Carregar mesa */
.modal.load-modal { width: min(1100px, 94vw); height: min(860px, 88vh); display: flex; flex-direction: column; padding: 20px 22px 18px; }
.load-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.load-modal-head h2 { margin: 0; font-size: 20px; }
.load-modal-count { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.load-modal-head .modal-close-x { position: static; }
.load-modal .lm-top { margin-bottom: 12px; }
.load-modal .lm-search input[type="text"] { height: 40px; font-size: 14px; }
.load-modal .lm-btn { height: 40px; }
.load-modal .lm-list { flex: 1; min-height: 0; max-height: none; gap: 10px; padding-right: 6px; }
.load-modal .lm-section { margin-top: 8px; }
.load-modal .lm-section:first-child { margin-top: 0; }
.load-modal .lm-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.load-modal .lm-folders { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.load-modal .lm-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.load-modal .lm-card-info { padding: 9px 11px 11px; }
.load-modal .action-card-empty { margin: 24px 0; text-align: center; }
body.modal-open { overflow: hidden; }
.lm-menu { position: fixed; z-index: 200; min-width: 200px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 2px; }
.lm-menu[hidden] { display: none; }
.lm-menu-item { width: 100%; margin: 0; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.lm-menu-item:hover { background: var(--panel-2); }
.lm-menu-item.danger { color: var(--danger); }
.lm-menu-item.danger[data-armed] { background: rgba(249, 115, 22, 0.12); }
.lm-menu-move { display: flex; align-items: center; gap: 8px; margin: 2px 0; padding: 4px 10px; font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lm-menu-move select { flex: 1; min-width: 0; margin: 0; padding: 5px 6px; font-size: 12px; }

/* botão "copiar link" em cada mesa da lista "Carregar mesa" (tela inicial) — corta o
   passo de precisar ENTRAR na mesa só pra pegar o link de convite na navbar de lá */
.room-list-copy {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  padding: 3px 9px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.room-list-copy:hover { border-color: var(--accent); color: var(--text); }
.room-list-copy.copied { border-color: #4ade80; color: #4ade80; }

/* olhinho de mostrar/ocultar senha — o wrap segura o posicionamento absoluto do botão
   por cima do canto direito do input; o margin-top que o input teria (regra global de
   input) sobe pro wrap, senão o botão ficaria descentralizado em relação ao input */
/* botão de texto discreto (ex.: "Esqueci minha senha", "Voltar" nos painéis de auth) —
   sem fundo/borda, sublinhado, cor neutra que acende no acento ao passar o mouse */
.link-btn {
  display: block;
  width: auto;
  background: none;
  border: none;
  padding: 8px 0 0;
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-text); }

.password-wrap { position: relative; display: block; margin-top: 6px; }
.password-wrap input[type="password"], .password-wrap input[type="text"] { margin-top: 0; padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 100%; height: 100%; display: block; }

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-dim);
}
.user-bar strong { color: var(--text); }
.user-bar[hidden] { display: none; }
/* Menu do usuário — clicar no avatar/nome abre um dropdown com Perfil/Armazenamento/
   Sair; "amigos" fica de fora como .icon-btn próprio (badge de pendências sempre
   visível). Substituiu os 4 chips de texto lado a lado (.user-bar-actions, removida) */
.user-menu-wrap { position: relative; min-width: 0; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none;
  padding: 4px 8px; margin: -4px 0 -4px -8px;
  border-radius: 8px;
  font: inherit; color: inherit;
  cursor: pointer;
  min-width: 0;
}
.user-menu-trigger:hover { background: var(--panel-2); }
.user-menu-chevron { font-size: 9px; color: var(--text-dim); transition: transform 0.15s ease; }
.user-menu-trigger.open .user-menu-chevron { transform: rotate(180deg); }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 50;
}
/* display:flex acima é regra de autor e venceria o [hidden] padrão do navegador —
   mesma armadilha já documentada n vezes nesse arquivo */
.user-menu-dropdown[hidden] { display: none; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.user-menu-item:hover { background: var(--panel-2); }
.user-menu-item-danger { color: var(--danger); }
.user-menu-item-danger:hover { background: rgba(249, 115, 22, 0.08); }

/* ---------- Avatares / perfil ---------- */
.avatar-small { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-large {
  width: 150px; height: 150px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--panel-2); border: 1px solid var(--line);
}
.avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 52px; font-weight: 600;
}
/* `display: flex` acima é regra de autor e vence a regra padrão do navegador pra
   [hidden] (que é só do user-agent) — sem isso o placeholder nunca some de verdade
   e fica em cima da foto de verdade (mesmo z-order dos dois em profile-avatar-wrap) */
.avatar-placeholder[hidden] { display: none; }
/* pedido explícito: "aumente o popup do perfil para que seja mais visivel e maior
   tanto a foto de perfil como o banner" — 420→540px, banner/avatar escalados junto
   (ver .profile-banner/.avatar-large/.profile-avatar-wrap abaixo). Bug real achado ao
   vivo: essa regra fica ANTES de `.modal` (width:360px) no arquivo — com as duas com a
   MESMA especificidade (uma classe só), quem vence é ordem no arquivo, e `.modal` vinha
   DEPOIS, sobrescrevendo o width pretendido silenciosamente (o modal de perfil nunca
   teve o tamanho declarado aqui, nem antes desse bullet — só ninguém tinha medido em
   pixel real pra notar). `.modal.profile-modal` (as DUAS classes) tem especificidade
   maior de propósito, pra não depender de ordem nenhuma no arquivo daqui pra frente */
.modal.profile-modal { width: min(480px, 92vw); position: relative; padding: 0; max-height: calc(100vh - 32px); overflow-y: auto; } /* sem padding: a capa vai de ponta a ponta (2026-11-25) */
/* o × em cima da capa: fundo escuro redondo pra ler em qualquer imagem */
.profile-modal > .modal-close-x { top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(13, 13, 16, 0.6); color: #fff; }
.profile-modal > .modal-close-x:hover { background: rgba(13, 13, 16, 0.85); color: #fff; }
/* X sutil no canto (pedido explícito: "em vez de um botão fechar vamos colocar um
   sutil X no canto superior direito") — substituiu o botão "Fechar" de sempre no
   rodapé; mesmo id (#profile-close), só a aparência/posição mudou, o listener de
   clique não precisou de nenhum ajuste */
.modal-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  /* sem isso, o X fica atrás do banner do perfil — os dois são elementos
     posicionados sem z-index, então quem vence é ordem no DOM, e o banner vem
     DEPOIS do botão no markup (reportado com print: "o X de fechar está por
     baixo do banner"). Precisa ficar acima de qualquer conteúdo do modal (banner,
     avatar, etc.), não só do banner especificamente */
  z-index: 5;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.modal-close-x:hover { color: var(--text); background: var(--panel-2); }
/* banner estilo Discord no topo do perfil (imagem 3:1) — o avatar sobrepõe a borda de
   baixo via margin-top negativo no wrap (por isso o align-items: flex-end na row,
   senão o align center anularia o efeito do margin) */
.profile-banner {
  position: relative; /* âncora do overlay de hover (::after, inset:0) */
  height: 150px;
  background-color: var(--panel-2);
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
/* clicar no próprio banner/avatar troca a imagem (sem botões separados) — o overlay
   de hover com o texto é a única affordance de que dá pra clicar, então precisa existir */
.profile-banner::after {
  content: 'Trocar capa';
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 11px;
  background: rgba(13, 13, 16, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none; /* o clique é do banner em si */
}
.profile-banner:hover::after { opacity: 1; }
/* pedido explícito ("pode colocar embaixo da foto parecido com o twitter") — a linha
   agora só carrega o avatar; o nome vira um bloco SEPARADO logo abaixo (.profile-name-below),
   não mais um segundo item ao lado dele nesse flex row */
.profile-head { position: relative; display: flex; align-items: flex-start; gap: 14px; margin-top: -44px; padding: 0 20px; }
.profile-id { flex: 1; min-width: 0; padding-top: 54px; } /* o nome sempre começa abaixo da capa, com uma linha ou três */
.profile-avatar-wrap { position: relative; width: 96px; height: 96px; flex-shrink: 0; cursor: pointer; }
.profile-avatar-wrap .avatar-large { position: absolute; top: 0; left: 0; width: 96px; height: 96px; border: 4px solid var(--panel); }
.profile-avatar-wrap .avatar-placeholder { font-size: 34px; }
.profile-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: 4px; /* dentro da borda de 4px do avatar, pro círculo do overlay casar com o da foto */
  background: rgba(0, 0, 0, 0.5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l2-3h6l2 3h3v11H4z'/%3E%3Ccircle cx='12' cy='13' r='3.5'/%3E%3C/svg%3E") center / 24px no-repeat;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.profile-avatar-wrap:hover::after { opacity: 1; }
/* modo "ver perfil de outro amigo" (só leitura) — mesmas classes/tamanhos do modal de
   edição, só sem a affordance de clicar-pra-trocar (sem overlay, sem cursor de mão) */
.profile-banner.readonly, .profile-avatar-wrap.readonly { cursor: default; }
.profile-banner.readonly::after, .profile-avatar-wrap.readonly::after { content: none; }
/* nome do perfil (o PRÓPRIO ou o de um amigo visto via friends.js) EMBAIXO do avatar,
   estilo Twitter/X — margin-left casa com o margin-left:16px de .profile-avatar-wrap
   acima, pro texto alinhar com a borda esquerda da foto, não com a borda do modal.
   Seletor com DUAS classes de propósito (não só `.profile-name-below`) — `.modal h2`
   (classe+elemento, especificidade 1,1) venceria uma classe só (especificidade 1,0)
   MESMO vindo depois no arquivo; `.profile-modal .profile-name-below` (duas classes,
   2,0) bate `.modal h2` sem depender de ordem — mesma categoria de bug já documentada
   no bullet do resize do modal de perfil */
.profile-modal .profile-name-below { margin: 0; font-size: 22px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* horas jogadas (estilo Steam), logo abaixo do nome — os DOIS modais (editar o próprio
   e ver o de um amigo) têm essa linha, então o respiro de 18px que era do nome desceu
   pra cá (2px entre nome e horas, 18px depois — total igual ao de antes). Mesma razão
   do seletor com duas classes do .profile-name-below acima */
.profile-modal .profile-hours { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
/* onde o amigo está (o mesmo texto da lista de amigos) e a bolinha de online na foto */
.profile-where { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; color: var(--text-dim); }
.profile-where[hidden] { display: none; }
.profile-where::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #55555f; flex-shrink: 0; }
.profile-where.on { color: #4ade80; }
.profile-where.on::before { background: #22c55e; }
.profile-dot { position: absolute; right: 4px; bottom: 6px; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: #55555f; border: 4px solid var(--panel); }
.profile-dot.on { background: #22c55e; }
.profile-dot[hidden] { display: none; }
/* números do perfil: uma faixa só, sem caixas, com o nome curto numa linha (o nome inteiro no title) */
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 18px 20px 0; border: 1px solid var(--line); border-radius: 11px; background: #121217; }
.profile-stats[hidden] { display: none; }
.profile-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 11px 6px; text-align: center; }
.profile-stat + .profile-stat { border-left: 1px solid var(--line); }
@media (max-width: 480px) { .profile-stats { grid-template-columns: repeat(2, 1fr); } .profile-stat:nth-child(3) { border-left: 0; } .profile-stat:nth-child(n+3) { border-top: 1px solid var(--line); } }
.profile-stat-value { font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; }
.profile-stat-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* rodapé: "Trocar senha" à esquerda e "Sair da conta" à direita (no perfil de outra pessoa: Entrar, Convidar e Remover amigo) */
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 16px 20px 18px; border-top: 1px solid var(--line); }
.profile-actions[hidden] { display: none; }
.profile-actions .btn { width: auto; flex-shrink: 0; margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.profile-actions .btn svg { width: 15px; height: 15px; }
.profile-actions-gap { flex: 1; }
.profile-actions .profile-logout, .profile-actions .profile-danger { color: #f97316; }
.profile-modal > .error { margin: 12px 20px 0; }
#profile-password-group > summary { display: none; }
/* o <details> "Trocar senha" abre embaixo do rodapé */
#profile-password-group { margin: 0 20px 20px; }
#profile-password-group:not([open]) { margin-bottom: 0; }
.profile-modal h3 { font-size: 14px; margin: 0 0 12px; color: var(--text); }

.crop-modal { width: min(360px, 92vw); text-align: center; }
.crop-modal.crop-wide { width: min(560px, 94vw); } /* a foto do cartão da mesa, 16:10 */
.crop-viewport {
  width: 300px; height: 300px; max-width: 100%;
  margin: 0 auto 14px; overflow: hidden; border-radius: 8px;
  background: #000; position: relative; cursor: grab; touch-action: none;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img { position: absolute; top: 0; left: 0; user-select: none; pointer-events: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; justify-content: center; }
.crop-zoom-row input[type="range"] { flex: 1; max-width: 200px; }

label { display: block; margin-bottom: 12px; color: var(--text-dim); font-size: 13px; }
label.inline { display: flex; align-items: center; gap: 8px; }
/* slider dentro de um label.inline (texto + range lado a lado): sem isso o range fica na
   largura padrão do navegador (~150-170px), que somada ao texto do rótulo estoura painéis
   estreitos como o do mestre (~220px) — flex:1 deixa ele ocupar só o espaço que sobra
   depois do texto, min-width:0 é o que permite encolher abaixo da largura padrão (comportamento
   default de flex item é nunca encolher além do próprio conteúdo/tamanho intrínseco) */
label.inline input[type="range"] { flex: 1; min-width: 0; }

input[type="text"], input[type="number"], input[type="password"], input[type="email"], select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 11px 16px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--danger-dim); border-color: #4a331f; }
.btn.danger:hover { border-color: var(--danger); }
.btn.small-btn { padding: 7px 10px; font-size: 13px; }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--text-dim);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.error { color: #f2a3a3; font-size: 13px; }
/* erro do login/cadastro: dentro do cartão, colado no botão que a pessoa acabou de clicar */
.auth-error { margin: 10px 0 0; line-height: 1.4; }
.auth-error[hidden] { display: none; }
#auth-panels input[aria-invalid="true"] { border-color: #f2a3a3; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.success { color: var(--accent-text); font-size: 13px; }

/* ---------- Sala ---------- */
body.room { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  /* acima dos painéis laterais (mestre 20/21, jogadores 25/26): os menus de cena/andar
     moram DENTRO da topbar e ficam presos no z-index dela — com 10, abriam POR TRÁS do
     painel do mestre expandido. A topbar tem só 40px e os painéis começam em 56px, então
     subir não cobre nada */
  z-index: 27;
}
.room-info { display: flex; align-items: center; gap: 10px; }
/* navbar em três zonas: mesa à esquerda, cena e andar no centro, estado à direita */
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar-center { display: flex; align-items: center; gap: 8px; justify-content: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.topbar-tool { display: inline-flex; align-items: center; gap: 7px; max-width: 220px; color: var(--accent-text); border-color: var(--accent); }
.topbar-tool[hidden] { display: none; }
.topbar-tool-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
#topbar-tool-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-ping { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.topbar-ping svg { width: 15px; height: 15px; display: block; }
#room-name { font-size: 14px; font-weight: 600; }
/* mestre: clicar no título renomeia (ver app.js) — cursor de "clicável" só ligado pra
   ele (classe adicionada em setupGmTools, jogador nunca ganha essa affordance) */
#room-name.room-name-editable { cursor: pointer; }
#room-name.room-name-editable:hover { color: var(--accent-text); }
/* mesma armadilha do [hidden] de sempre nesse projeto: `input[type="text"]` (regra
   genérica de formulário, mais abaixo no arquivo) tem `display:block` com especificidade
   MAIOR que o `[hidden]` padrão do navegador (dois seletores — elemento+atributo — contra
   um só) — sem esse override explícito, o campo de renomear ficava sempre visível
   (vazio, "gigante") mesmo com o atributo `hidden` presente no HTML */
#room-name-input[hidden] { display: none; }

.chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

/* seletor de cena (só mestre): mesmo visual do de andar, sem display de autor pra o
   [hidden] padrão do navegador funcionar */
.scene-switcher { position: relative; margin-right: 8px; }
#scene-switcher-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 260px; }
.scene-switcher-name {
  color: var(--text); font-weight: 600; max-width: 170px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.floor-switcher { position: relative; display: flex; align-items: center; gap: 4px; }
/* botão do andar: ícone + cena (cinza, pequena) + andar (destaque) + contador "2/4" */
#floor-switcher-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 320px; }
.floor-switcher-ico { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-dim); }
.floor-switcher-scene {
  color: var(--text-dim); font-size: 11px; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.floor-switcher-scene::after { content: '›'; margin-left: 7px; opacity: .6; }
.floor-switcher-name {
  color: var(--text); font-weight: 600; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.floor-switcher-count { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
/* olhinho "andar oculto" ao lado do botão do andar (só mestre, só com o andar oculto) */
.floor-hidden-eye { flex-shrink: 0; }
/* setas ↑/↓ do seletor (mesmo efeito de ArrowUp/ArrowDown) */
.floor-step-btn {
  width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text-dim); cursor: pointer;
}
.floor-step-btn svg { width: 12px; height: 12px; }
.floor-step-btn:hover { border-color: var(--accent); color: var(--text); }
.floor-step-btn.is-disabled { opacity: .35; pointer-events: none; }
/* bolinhas de quem está em cada andar, no menu */
.floor-switcher-dots { display: inline-flex; align-items: center; gap: 3px; }
.floor-switcher-dots i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.floor-switcher-dots b { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.floor-switcher-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.floor-switcher-row:hover { background: var(--panel-2); }
/* olhinho menor dentro das linhas do menu, sem engordar a linha */
.floor-switcher-row .eye-toggle { width: 22px; height: 22px; padding: 3px; margin: -3px 0; }
.floor-switcher-row.current { color: var(--accent-text); font-weight: 600; }

/* ---------- Jogadores conectados (estilo TTS: coluna no canto superior direito) ---------- */
/* container FIXO externo: lista rolável em cima + rodapé estático embaixo (convidar
   amigos + código da mesa), sempre visível mesmo com a lista rolada — por isso o
   max-height/overflow moraram na LISTA (.players-panel-list), não aqui */
.players-panel {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  width: 236px;
  max-height: calc(100vh - 76px);
}
.players-panel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: hidden; /* o cartão que entra vem da direita: sem isto aparecia uma barra de rolagem */
  overflow-y: auto;
  padding: 6px 8px; /* folga pro pulso de cor em volta do cartão, devolvida na margem */
  margin: -6px -8px;
  min-height: 0; /* permite encolher dentro do flex column pai — senão nunca respeitaria o max-height do pai, empurrando o rodapé pra fora */
}
/* rodapé fixo abaixo do último jogador — "+" convida amigos (canto direito), código
   da mesa logo abaixo (pedido explícito) */
.players-panel-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 8px;
  flex-shrink: 0;
}
.players-panel-invite-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.players-panel-invite-btn:hover { border-color: var(--accent); color: var(--accent-text); }
/* cartão da pessoa: escuro com anel na cor (padrão) ou na cor inteira (.players-panel.solid) */
.player-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px 7px 9px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: opacity 0.3s, filter 0.3s, translate 0.25s, border-color 0.2s, color 0.2s 0.1s;
  isolation: isolate; /* o líquido da mão fica acima do fundo e abaixo do texto */
}
.player-card:hover { border-color: var(--c); }
.player-card-face { position: relative; flex-shrink: 0; width: 34px; height: 34px; }
.player-card-avatar-wrap { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: #2a2a33; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); transition: box-shadow 0.25s, filter 0.3s; }
.player-card-avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player-card-avatar-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #f5f5f7; }
/* baixando o mapa: o anel se completa em volta da foto */
.player-card-ring { position: absolute; left: -5px; top: -5px; width: 44px; height: 44px; transform: rotate(-90deg); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.player-card-ring circle { fill: none; stroke-width: 4; }
.player-card-ring .bg { stroke: #33333d; }
.player-card-ring .bar { stroke: var(--c); transition: stroke-dashoffset 0.3s; }
.player-card.loading .player-card-ring { opacity: 1; }
.player-card.loading .player-card-avatar-wrap { box-shadow: none; }
.player-card-dot { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; background: var(--panel); color: #f2c94c; display: flex; align-items: center; justify-content: center; }
.player-card-dot[hidden] { display: none; }
.player-card-dot svg { width: 11px; height: 11px; display: block; }
.player-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-card-ident { display: flex; align-items: center; gap: 6px; min-width: 0; }
.player-card-name { flex: 0 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card-crown { display: none; flex-shrink: 0; }
.player-card.gm .player-card-crown { display: flex; }
.player-card-crown svg { width: 15px; height: 15px; display: block; }
.player-card-line { font-size: 11px; color: var(--text-dim); transition: color 0.2s 0.1s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card-line[hidden] { display: none; }
.player-card-right { flex-shrink: 0; display: flex; align-items: center; gap: 7px; }
.player-card-status { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; opacity: 0.85; }
.player-card-status svg { width: 14px; height: 14px; display: block; }
.player-card-hand { position: relative; display: flex; align-items: center; gap: 3px; margin: 0; padding: 2px; background: none; border: none; color: var(--text-dim); cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s; }
.player-card-hand[hidden] { display: none; }
.player-card-hand:disabled { cursor: default; }
.player-card-hand svg { width: 17px; height: 17px; display: block; transform-origin: 50% 90%; }
.player-card-hand b { font-size: 12px; font-weight: 700; }
.player-card-hand b:empty { display: none; }
.player-card:hover .player-card-hand, .player-card-hand:focus-visible, .player-card.hand .player-card-hand { opacity: 1; }
.player-card-hand:hover:not(:disabled) { color: #f2c94c; }
.player-card.hand { translate: -5px 0; border-color: #f2c94c; }
.players-panel.compact .player-card.hand .player-card-hand { color: #f2c94c; }
/* mão levantada: dourado cheio (a animação de encher é do liquid-pour.js, ver fillHand); o texto escurece quando o líquido já passou dele */
.liquid-fill { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); border-radius: 10px; z-index: -1; pointer-events: none; }
.liquid-fill.over { inset: 0; width: 100%; height: 100%; border-radius: 50%; z-index: 1; opacity: 0.9; }
.players-panel:not(.compact) .player-card.hand-full { background: #f2c94c; }
.players-panel:not(.compact) .player-card.hand { color: #1a1505; transition-delay: 0s, 0s, 0s, 0s, 0.36s; }
.players-panel:not(.compact) .player-card.hand .player-card-line { transition-delay: 0.24s; }
.players-panel:not(.compact) .player-card.hand .player-card-line, .players-panel:not(.compact) .player-card.hand .player-card-hand { color: #4a3c0c; }
.players-panel:not(.compact) .player-card.hand .player-card-hand:hover:not(:disabled) { color: #000; }
.players-panel:not(.compact) .player-card.hand .player-card-crown svg { fill: #4a3c0c; }
.players-panel:not(.compact) .player-card.hand .player-card-status { padding: 3px 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.62); color: #fff; opacity: 1; }
.players-panel.solid:not(.compact) .player-card.hand .player-card-avatar-wrap { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); } /* a cor da pessoa não some debaixo do dourado */
/* apaga o que está dentro, não o fundo: cartão transparente some em cima do mapa */
.player-card.player-card-away > :not(.liquid-fill) { opacity: 0.55; }
.players-panel.solid:not(.compact) .player-card.player-card-away { background: color-mix(in srgb, var(--c) 45%, var(--panel)); color: var(--text); }
.player-card.shut .player-card-avatar-wrap { filter: grayscale(1) brightness(0.5); }
/* saiu da mesa: apagado por um instante, e então recolhe (renderPlayerCards) */
.player-card.leaving { opacity: 0.4; filter: grayscale(0.6); pointer-events: none; }
/* na cor inteira (Configurações) */
.players-panel.solid .player-card { background: var(--c); border-color: transparent; color: var(--k); }
.players-panel.solid .player-card:hover { border-color: color-mix(in srgb, var(--k) 45%, transparent); }
.players-panel.solid .player-card-avatar-wrap { box-shadow: none; background: rgba(0, 0, 0, 0.28); }
.players-panel.solid .player-card-line { color: inherit; opacity: 0.82; }
.players-panel.solid .player-card-status { padding: 3px 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: #fff; opacity: 1; }
.players-panel.solid .player-card.shut .player-card-avatar-wrap { filter: grayscale(1); background: rgba(0, 0, 0, 0.6); }
.players-panel.solid .player-card-hand { color: inherit; }
.players-panel.solid .player-card.hand { border-color: #f2c94c; }
.players-panel.solid .player-card-ring .bg { stroke: rgba(0, 0, 0, 0.35); }
.players-panel.solid .player-card-ring .bar { stroke: var(--k); }
.players-panel.solid .player-card-crown svg { fill: currentColor; }
/* quantas mãos levantadas (só o mestre): clicar abaixa todas */
.players-hands { display: inline-flex; align-items: center; gap: 4px; margin: 0 auto 0 10px; padding: 2px 8px; border: 1px solid #f2c94c; border-radius: 99px; background: rgba(242, 201, 76, 0.12); color: #f2c94c; font: 600 12px var(--font); cursor: pointer; }
.players-hands[hidden] { display: none; }
.players-hands svg { width: 14px; height: 14px; }
.players-hands:hover { background: rgba(242, 201, 76, 0.25); }
/* o dado que sai do cartão de quem rolou */
.card-die.waiting { visibility: hidden; animation: none; }
.liquid-die { position: fixed; z-index: 60; pointer-events: none; }
.liquid-die.under { z-index: 25; } /* o balão já apareceu por cima: o líquido só transborda em volta dele */
.card-die { position: fixed; z-index: 26; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 46px; padding: 6px 10px; border-radius: 10px; background: var(--c); color: var(--k); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); translate: 0 -50%; pointer-events: none; transform-origin: 100% 50%; }
.card-die b { font-size: 19px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card-die span { font-size: 10px; opacity: 0.8; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-die::after { content: ''; position: absolute; right: -4px; top: 50%; width: 10px; height: 10px; border-radius: 2px; background: inherit; translate: 0 -50%; rotate: 45deg; z-index: -1; }
.card-die.crit { box-shadow: 0 0 0 3px #ffd60a, 0 4px 20px rgba(255, 214, 10, 0.5); }
.card-die.fumble { filter: grayscale(0.75) brightness(0.8); }
@media (prefers-reduced-motion: no-preference) {
  .player-card.hand .player-card-hand svg { animation: handWave 1.1s ease-in-out infinite; }
  .card-die:not(.waiting) { animation: cardDie 3s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
  .card-die.poured:not(.waiting) { animation: cardDieOut 3s forwards; } /* nasceu de uma gota: não surge de novo */
  .card-die.poured b { animation: cardDieNum 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); }
}
@keyframes cardDieOut { 0%, 88% { scale: 1; opacity: 1; } 100% { scale: 0.92; opacity: 0; } }
@keyframes cardDieNum { from { scale: 0.3; opacity: 0; } }
@keyframes handWave { 0%, 100% { rotate: -12deg; } 50% { rotate: 14deg; } }
@keyframes cardDie { 0% { scale: 0.2; opacity: 0; rotate: -30deg; } 11% { scale: 1.14; opacity: 1; rotate: 0deg; } 17% { scale: 1; } 88% { scale: 1; opacity: 1; } 100% { scale: 0.92; opacity: 0; } }

/* ---------- Cortina (estilo TTS: "B" fecha a visão do próprio jogador) ---------- */
/* Não usa [hidden]/display (mesma armadilha do display:flex de autor vencendo o
   [hidden] do navegador, já documentada em outros overlays) — e também porque display
   não dá pra fazer transição suave. Fica sempre "display: flex" (não atrapalha o layout,
   position:fixed já tira do fluxo normal) e alterna opacity+visibility em vez disso: a
   visibility com delay só no fade-out é o que mantém a cortina bloqueando clique/scroll
   embaixo enquanto ainda visível, mas libera assim que o fade termina de sumir */
.blindfold-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.blindfold-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease;
}

/* ---------- Aviso de carregamento (mapa/tokens baixando) ---------- */
.loading-banner {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
/* `display: flex` acima é regra de autor e vence a regra padrão do navegador pra
   [hidden] (que é só do user-agent) — sem isso o banner nunca some de verdade */
.loading-banner[hidden] { display: none; }
.loading-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Zoom de token (segurar Alt sobre um token) ---------- */
/* usa uma classe pra mostrar (não o atributo hidden) — já tivemos problema em
   outro overlay onde `display` fixo no seletor base vencia o [hidden] do navegador */
.token-zoom-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.token-zoom-preview.visible { display: flex; }
.token-zoom-preview img {
  max-width: 70vw;
  max-height: 80vh;
  object-fit: contain;
  transition: transform 0.08s linear; /* scroll ajusta o zoom (ver tokenZoomWheel em app.js) */
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.6));
}

#canvas-wrap { flex: 1; position: relative; background: #000; }
#canvas-wrap canvas { display: block; }
/* véu da troca de andar (ver VÉU DA TROCA DE ANDAR no app.js): escurece rápido e clareia quando o andar novo está montado */
#floor-veil { position: absolute; inset: 0; z-index: 1; background: #000; opacity: 0; pointer-events: none; }
#floor-veil.on { opacity: 1; }

/* ---------- Preview do token armado pra spawnar (biblioteca), grudado no cursor ----------
   usa o atributo [hidden] de verdade (sem nenhuma regra de `display` aqui que possa
   vencer o padrão do navegador — mesma armadilha já documentada várias vezes nesse
   arquivo) — só `left`/`top` são ajustados via JS a cada movimento do mouse */
.library-spawn-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 45;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  opacity: 0.6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* nunca intercepta o clique que posiciona o token no mapa */
}
.library-spawn-preview-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}

/* ---------- Setas de ping fora da tela (Tab) ---------- */
.ping-arrows { position: fixed; inset: 0; z-index: 35; pointer-events: none; }
.ping-arrow {
  position: fixed;
  width: 22px;
  height: 30px;
  translate: -50% -50%;
  opacity: 0;
}
.ping-arrow-name { position: absolute; left: 50%; top: 50%; padding: 3px 10px; border-radius: 99px; font: 600 12px var(--font); white-space: nowrap; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.ping-arrow-name[hidden] { display: none; }
/* seta com haste (não só um triângulo solto) — mais fácil de ler a direção numa rotação
   qualquer; SVG (não CSS puro) porque precisa de uma forma "seta com corpo", não um
   triângulo simples. Aponta "pra cima" por padrão; app.js gira via transform */
.ping-arrow svg { width: 100%; height: 100%; display: block; }

/* ---------- Ferramentas do mestre ---------- */
/* o painel inteiro é o único container de scroll (não cada aba) — como só uma aba fica
   aberta por vez (ver setupGmTools()), o espaço já ocupado pelos cabeçalhos fechados das
   outras 11 varia conforme QUAL aba tá aberta; uma aba no fim da lista (ex: Andares) sobra
   com bem menos altura livre real do que uma no topo, então um max-height fixo por aba
   sempre erra a conta pra alguma delas e o conteúdo vaza pra fora da tela sem scrollbar */
.gm-tools {
  position: absolute;
  top: 56px;
  left: 12px;
  width: 220px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  z-index: 20;
  transition: transform 0.25s ease, width 0.25s ease, padding 0.25s ease;
}
/* empurra o painel inteiro pra fora da tela pela esquerda (translateX em % é relativo à
   própria largura do painel, não precisa bater um valor fixo em px) */
/* barra de rolagem temática (mesma do histórico de dados), em vez da branca padrão */
.gm-tools::-webkit-scrollbar { width: 7px; }
.gm-tools::-webkit-scrollbar-track { background: transparent; }
.gm-tools::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.gm-tools::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.gm-tools h3 { margin: 0; color: var(--accent-text); font-size: 15px; }
.gm-tools-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 4px; }
.gm-tools-head-actions { display: flex; align-items: center; gap: 2px; }
/* desfazer/refazer sem nada na pilha: apagados e sem hover (não usa o atributo
   `disabled` porque botão desabilitado engole os eventos de mouse da dica) */
.gm-tools-compact-btn.is-disabled { opacity: 0.35; cursor: default; }
.gm-tools-compact-btn.is-disabled:hover { color: var(--text-dim); border-color: transparent; }
.gm-tools-compact-btn {
  width: 24px; height: 24px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-dim); cursor: pointer;
}
.gm-tools-compact-btn svg { width: 14px; height: 14px; transition: transform 0.2s; }
.gm-tools-compact-btn:hover { color: var(--text); border-color: var(--line); }
.gm-tools-compact-btn.active { color: var(--accent-text); }
/* título de seção (Cenário / Visão e luz / Mesa / Conteúdo / Estrutura) */
.gm-section-title {
  margin: 12px 0 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  /* cinza, não vermelho: o vermelho fica reservado pro que está LIGADO/armado — antes o
     título da seção e o item ativo tinham a mesma cor e o olho não separava os dois */
  color: var(--text-dim);
  opacity: 0.55;
}
.gm-tools-head + .gm-section-title { margin-top: 6px; }
/* o título já separa a seção: o primeiro item logo abaixo dele não leva a linha de cima */
.gm-section-title + * { border-top: none !important; }
.tool-group { border-top: 1px solid var(--line); }
.tool-group:first-of-type { border-top: none; }
.tool-group summary {
  cursor: pointer;
  padding: 9px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-dim);
  list-style: none;
}
.tg-ico { width: 16px; height: 16px; flex-shrink: 0; }
.tg-label { flex: 1; min-width: 0; }
/* bolinha de estado no canto do ícone da aba (data-dot = accent/ok/warn) — o ícone fica
   à esquerda do <summary> no painel largo e centralizado no compacto */
.tool-group summary { position: relative; }
.tool-group summary[data-dot]::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--panel);
  box-sizing: content-box;
  background: var(--accent);
  pointer-events: none;
}
.tool-group summary[data-dot="ok"]::before { background: #4ade80; }
.tool-group summary[data-dot="warn"]::before { background: #f59e0b; }
.gm-tools-narrow .tool-group summary[data-dot]::before { top: 7px; left: calc(50% + 3px); }
/* tecla do atalho ao lado do nome (F2, Num 7...) — discreta, só pra descobrir */
.tg-key {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-dim);
}
.tool-group summary::-webkit-details-marker { display: none; }
/* chevron desenhado com borda (o '▸' de texto era minúsculo): aponta pra direita
   fechado e gira pra baixo quando a aba está aberta */
.tool-group summary::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.tool-group summary:hover::after,
.tool-group[open] > summary::after { opacity: 0.75; }
.tool-group[open] summary::after { transform: rotate(45deg); }
.tool-group summary:hover { color: var(--accent-text); }
/* aba aberta: texto claro e ícone no acento (o vermelho puro continua pra ferramenta armada) */
.tool-group[open] > summary { color: var(--text); }
.tool-group[open] > summary .tg-ico { color: var(--accent-text); }
.tool-group-body { padding: 0 0 10px; }
.tool-group-body .btn { margin-bottom: 8px; }
.file-btn { margin-bottom: 8px; }
/* opção única na barra (Sons, Biblioteca): mesmo visual do <summary> de um .tool-group
   (borda superior, texto uppercase pequeno, hover accent), mas sem accordion nem seta —
   clicar já dispara a ação direto, sem precisar expandir algo que só teria UM botão lá
   dentro (pedido explícito: "sons só tem uma opção, então nao precisa abrir uma opção
   com apenas um botão, clicar ali em sons ja pode abrir direito o painel de sons") */
.tool-group-flat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  border-top: 1px solid var(--line);
  background: none;
  padding: 9px 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-dim);
}
/* seta diagonal no lugar do chevron: avisa que esse item abre um popup, não uma lista */
.tool-group-flat::after { content: '↗'; font-size: 11px; opacity: 0; transition: opacity 0.15s; }
.tool-group-flat:hover::after { opacity: 0.6; }
.tool-group-flat:hover { color: var(--accent-text); }
/* mão livre não abre popup — sem a seta ↗ */
.tool-group-flat.hand-tool::after { content: none; }

/* ferramenta ARMADA (desenhar parede, ocultar névoa, colocar luz...): o item do painel
   fica aceso — vale também no modo compacto, onde só o ícone aparece */
.tool-group summary.tool-armed,
.tool-group-flat.tool-armed { color: var(--accent-text); }
.tool-armed .tg-ico {
  padding: 3px; box-sizing: content-box; margin: -3px;
  background: rgba(200, 30, 30, 0.22); border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(200, 30, 30, 0.55);
}

/* faixa com a dica da ferramenta ativa (fixa embaixo, no centro) */
.tool-hint {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 25;
  max-width: min(760px, 92vw);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
}
.tool-hint[hidden] { display: none; }
.tool-hint strong { color: var(--accent-text); white-space: nowrap; }
/* modo edição (painel aberto, sem ferramenta armada): mais discreta */
.tool-hint.editing { border-color: var(--line); color: var(--text-dim); }
.tool-hint.editing strong { color: var(--text-dim); }

/* dica instantânea dos ícones do painel do mestre */
.gm-tooltip {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.gm-tooltip[hidden] { display: none; }

/* botões de efeito de cena (seção Efeitos): nome à esquerda, tecla à direita */
.fx-btn { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.fx-btn .tg-key { background: transparent; }
.tool-group-body .fx-btn.active .tg-key { border-color: rgba(255, 255, 255, 0.5); color: #fff; }

/* modo compacto: só os ícones, painel de 56px. Abrir qualquer aba alarga o painel
   de volta (JS tira a classe enquanto houver aba aberta) */
.gm-tools.gm-tools-narrow { width: 56px; padding: 10px 8px; }
.gm-tools-narrow .gm-tools-head { justify-content: flex-start; padding-left: 8px; }
.gm-tools-narrow .gm-tools-head-actions { flex-direction: column; gap: 2px; }
.gm-tools-narrow .gm-tools-compact-btn { width: 22px; height: 20px; }
.gm-tools-narrow .gm-tools-head { margin-bottom: 6px; }
.gm-tools-narrow .gm-tools-head h3,
.gm-tools-narrow .tg-label,
.gm-tools-narrow .tg-key,
.gm-tools-narrow .tool-group-flat::after,
.gm-tools-narrow .tool-group summary::after { display: none; }
.gm-tools-narrow .tool-group summary,
.gm-tools-narrow .tool-group-flat { justify-content: flex-start; padding: 5px 0 5px 10px; }
.gm-tools-narrow .tg-ico { width: 18px; height: 18px; }
/* compacto sem barra de rolagem visível (sobrar um pouco de altura em janela baixa ainda rola com a
   roda do mouse, mas a barra no meio dos ícones só atrapalha) */
.gm-tools.gm-tools-narrow { scrollbar-width: none; }
.gm-tools.gm-tools-narrow::-webkit-scrollbar { display: none; }
/* sem os rótulos, o título da seção vira só uma linha divisória */
.gm-tools-narrow .gm-section-title {
  font-size: 0; height: 1px; margin: 3px 4px; padding: 0;
  background: var(--line); opacity: 1;
}
/* flyout: no modo compacto o conteúdo da aba aberta sai do painel e vira um painel solto
   ao lado dele. position:fixed escapa do overflow do #gm-tools; a posição vem do JS
   (placeFlyout em app.js) pelas variáveis --fly-left/top/max */
.gm-tools-narrow .tool-group[open] > .tool-group-body {
  position: fixed;
  left: var(--fly-left, 76px);
  top: var(--fly-top, 100px);
  max-height: var(--fly-max, 70vh);
  width: 240px;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 12px 14px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  z-index: 3;
 
 
}
.gm-tools-narrow .tool-group[open] > .tool-group-body::before {
  content: attr(data-title);
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}
/* alfinete (fixar) no canto do flyout — só existe no modo compacto */
.fly-pin { display: none; }
.gm-tools-narrow .tool-group[open] > .tool-group-body > .fly-pin {
  display: flex;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
}
.fly-pin svg { width: 14px; height: 14px; transform: rotate(35deg); }
.fly-pin:hover { color: var(--accent-text); }
.fly-pin.active { color: var(--accent-text); background: rgba(200, 30, 30, 0.18); border-color: rgba(200, 30, 30, 0.5); }
.fly-pin.active svg { transform: rotate(0); }
/* o ícone da aba que está aberta no flyout fica aceso */
.gm-tools-narrow .tool-group[open] > summary { color: var(--accent-text); }
.gm-tools.gm-tools-narrow .tool-group,
.gm-tools.gm-tools-narrow .tool-group-flat,
.gm-tools.gm-tools-narrow > .tool-group-focusable { border-top: none; }
.hint { font-size: 12px; color: var(--text-dim); margin: 4px 0 0; }

/* modo "foco" das abas focáveis — Camadas/Cenas/Andares, as três filhas diretas de
   #gm-tools fora do wrapper (nasceu só em Andares — "a aba andares quando clicada vai
   expandir empurrando todas as outras opções pra fora" — generalizado a pedido:
   "adicione esse mesma sistema de foco em camadas, e tambem em cenas"). Com qualquer
   uma aberta, TODO o resto do painel (título, outras abas, botões únicos, tudo dentro
   de #gm-tools-collapsible, MAIS as outras duas focáveis) encolhe suavemente, sobrando
   só a aba aberta ocupando o painel inteiro. Técnica grid-template-rows 0fr->1fr
   (mesma da tela inicial/cartões expansíveis) — animável, ao contrário de display:none
   (corte abrupto que causava o "flash" reportado). MESMA regra de sempre: o item do
   grid que encolhe (.gm-tools-collapsible) não pode ter padding próprio — padding nunca
   é comprimido por overflow:hidden/min-height:0 (documentado à exaustão nesse arquivo)
   — por isso o padding de #gm-tools continua no elemento de fora (.gm-tools) */
.gm-tools-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s ease;
}
.gm-tools.gm-tools-focus .gm-tools-collapsible { grid-template-rows: 0fr; }
.gm-tools-collapsible-inner {
  overflow: hidden;
  min-height: 0;
  transition: opacity 0.2s ease;
  /* folga lateral DENTRO da área cortada: o anel do ícone de ferramenta armada
     (.tool-armed .tg-ico, 3px pra fora do ícone) era cortado pelo overflow:hidden na
     borda esquerda; a margem negativa devolve o alinhamento original */
  padding: 0 4px;
  margin: 0 -4px;
}
.gm-tools.gm-tools-focus .gm-tools-collapsible-inner {
  opacity: 0;
  pointer-events: none;
}
/* as focáveis são `.tool-group` filhas DIRETAS de #gm-tools (as outras moram dentro de
   .gm-tools-collapsible-inner) — `.tool-group:first-of-type` bateria na primeira delas
   à toa e tiraria a linha separadora de cima; a regra por classe devolve a borda no
   estado normal. FECHADA, uma focável é só a linha do cabeçalho (~40px) — o max-height
   fixo dá um valor concreto de partida pra animar até 0 quando OUTRA focável entra em
   foco (encolhe suave junto com o wrapper, mesma duração); a ABERTA (a focada) fica
   livre (max-height none) — o conteúdo dela aparece na hora, comportamento aceito */
.gm-tools > .tool-group-focusable {
  border-top: 1px solid var(--line);
  max-height: 44px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}
.gm-tools > .tool-group-focusable[open] {
  max-height: none;
  overflow: visible;
}
.gm-tools.gm-tools-focus > .tool-group-focusable:not([open]) {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  border-top: none;
}
.gm-tools.gm-tools-focus > .tool-group-focusable[open] { border-top: none; }
/* trava o scroll do painel inteiro só durante a janela da transição de foco (ver
   comentário em app.js) — sem isso, a soma temporária "wrapper ainda encolhendo +
   lista de andares já revelada de uma vez" estoura o max-height por um instante e uma
   scrollbar pisca na tela antes de sumir de novo quando o wrapper termina de encolher */
.gm-tools.gm-tools-transitioning { overflow: hidden; }

/* mesmo foco pras demais abas (Mapa, Grid, Névoa, Paredes...): a aba aberta sobe pro topo e
   todo o resto some (cabeçalho, outras abas, títulos de seção, favoritos, Sons/Biblioteca e
   as abas de Estrutura). Aqui o conteúdo fica DENTRO do wrapper, então não dá pra encolher o
   wrapper inteiro como no foco de Camadas/Cenas/Andares: esconde cada irmão da aba aberta.
   Fechar a aba (clicar no cabeçalho dela de novo, F1 ou Esc) traz tudo de volta */
.gm-tools.gm-tools-focus-inner .gm-tools-collapsible-inner > :not(.tool-group[open]),
.gm-tools.gm-tools-focus-inner > :not(.gm-tools-collapsible) { display: none !important; }
.gm-tools.gm-tools-focus-inner .tool-group[open] { border-top: none; }

/* ---------- Camadas ---------- */
.layers-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.gm-tools-narrow #layers-group[open] > .tool-group-body.dw { width: 330px; }
#layers-group .tool-group-body.dw { gap: 10px; }
.ly-top { position: sticky; top: -12px; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; background: var(--panel); }
.ly-search { position: relative; }
.ly-search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.ly-search input[type="text"] { width: 100%; margin: 0; padding: 7px 10px 7px 32px; font-size: 13px; }
.ly-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ly-chips:empty { display: none; }
.ly-chip { margin: 0; padding: 4px 9px; border: 1px solid var(--line); border-radius: 99px; background: none; color: var(--text-dim); font: 500 12px var(--font); cursor: pointer; }
.ly-chip:hover { color: var(--text); }
.ly-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ly-list { display: flex; flex-direction: column; gap: 10px; }
.ly-level-head { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0; padding: 3px 4px; background: none; border: 1px solid transparent; border-radius: 7px; color: var(--text-dim); font: 600 12px var(--font); text-align: left; cursor: pointer; }
.ly-level-head:hover { color: var(--text); }
.ly-level-head svg { width: 14px; height: 14px; transition: transform 0.15s; }
.ly-level.closed .ly-level-head svg { transform: rotate(-90deg); }
.ly-level-head span { margin-left: auto; font-weight: 500; }
.ly-level.closed .ly-rows { display: none; }
.ly-level.empty .ly-level-head { opacity: 0.55; cursor: default; }
.ly-list.dragging .ly-level.empty .ly-level-head { opacity: 1; }
.ly-level.empty .ly-level-head svg { visibility: hidden; }
.ly-level-head em { font-style: normal; font-weight: 400; opacity: 0.8; }
/* pular direto pra um nível: com muitos tokens no 1, o -1 e o -2 ficavam lá no fim da rolagem */
.ly-jump { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); }
.ly-jump span { margin-right: 2px; }
.ly-jump button { flex: 1; min-width: 0; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); font: 600 12px var(--font); cursor: pointer; }
.ly-jump button:hover { border-color: var(--accent); }
.ly-jump button.none { background: none; color: var(--text-dim); opacity: 0.6; }
.ly-level-head.drop { border: 1px dashed var(--accent); color: var(--text); }
.ly-rows { display: flex; flex-direction: column; gap: 2px; }
.ly-row { display: flex; align-items: center; gap: 9px; position: relative; padding: 3px 4px 3px 6px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.ly-row:hover, .ly-row:focus-visible { background: var(--panel-2); outline: none; border-color: var(--line); }
.ly-row.sel { background: rgba(200, 30, 30, 0.16); border-color: var(--accent); }
.ly-row.dragging { opacity: 0.4; }
.ly-row.before { box-shadow: 0 -2px 0 var(--accent); }
.ly-row.after { box-shadow: 0 2px 0 var(--accent); }
.ly-row.child { padding-left: 24px; }
.ly-row.faded .ly-thumb, .ly-row.faded .ly-name { opacity: 0.5; }
.ly-thumb { flex-shrink: 0; width: 30px; height: 30px; border-radius: 7px; background: #0d0d10; overflow: hidden; }
.ly-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ly-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ly-count { flex-shrink: 0; padding: 2px 8px; border-radius: 99px; background: #2a2a33; color: var(--text-dim); font-size: 11px; font-weight: 600; }
.ly-exp { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 26px; height: 26px; margin: 0; padding: 0; background: none; border: none; color: var(--text-dim); cursor: pointer; }
.ly-exp svg { width: 14px; height: 14px; transform: rotate(-90deg); }
.ly-exp.open svg { transform: none; }
.ly-act { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 26px; height: 26px; margin: 0; padding: 0; background: none; border: none; border-radius: 6px; color: var(--text-dim); cursor: pointer; opacity: 0; }
.ly-act svg { width: 16px; height: 16px; }
.ly-row:hover .ly-act, .ly-row:focus-within .ly-act, .ly-act.on { opacity: 1; }
.ly-act.on { color: var(--accent-text); }
.ly-act:hover { color: var(--text); background: #2a2a33; }
.ly-act.ly-del:hover { color: var(--danger); }
.ly-row:not(:hover):not(:focus-within) .ly-act:not(.on) { display: none; }
.ly-empty { padding: 10px 4px; font-size: 12px; color: var(--text-dim); }
.ly-map { display: flex; align-items: center; gap: 9px; padding: 6px 4px 0 6px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-dim); }
.ly-map span { flex: 1; }
.ly-map button { margin: 0; padding: 4px 8px; background: none; border: none; color: var(--danger-dim); font: 500 12px var(--font); cursor: pointer; }
.ly-map button:hover { color: var(--danger); }
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: grab;
  font-size: 12px;
}
.layer-row.dragging { opacity: 0.4; }
.layer-row.drag-over { border-color: var(--accent); }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-remove {
  width: 20px; height: 20px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--danger-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.layer-remove:hover { border-color: var(--danger); color: var(--danger); }
.layer-remove.confirm { color: var(--danger); border-color: var(--danger); }
.layer-remove:disabled { opacity: 0.35; cursor: default; }

/* ---------- Andares ---------- */
.floor-name-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 3px 6px;
  font-size: 12px;
  background: transparent;
  border: 1px solid transparent;
}
.floor-name-input:hover, .floor-name-input:focus-visible { border-color: var(--line); background: var(--bg); }
.layer-row.current-scene { border-color: var(--accent); }

.floor-row-group { display: flex; flex-direction: column; gap: 4px; }
.floor-stack-toggle {
  width: 100%;
  margin: 0;
  padding: 4px 8px;
  font-size: 11px;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.floor-stack-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.floor-stack-toggle.active { border-style: solid; color: var(--accent-text); border-color: var(--accent); }
.floor-stack-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.floor-stack-select { width: 100%; margin: 0; padding: 4px 6px; font-size: 11px; }
.floor-stack-offsets { display: flex; gap: 8px; }
.floor-stack-offsets label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.floor-stack-offsets input { flex: 1; min-width: 0; margin: 0; padding: 3px 5px; font-size: 11px; }
/* lista de andares empilhados (pedido explícito: "+ que permite adicionar mais
   andares empilhados, ficando como as camadas dos tokens") — um cartão por entrada,
   já que cada uma tem nome/offsetX/offsetY/camada, controles demais pra caber numa
   linha só na largura estreita da barra lateral */
.floor-stack-list { display: flex; flex-direction: column; gap: 6px; }
.floor-stack-entry {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.floor-stack-entry-top { display: flex; align-items: center; gap: 6px; }
.floor-stack-entry-name { flex: 1; min-width: 0; font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-stack-entry-top .merge-row-remove { width: 20px; height: 20px; font-size: 13px; }
.floor-stack-layer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.floor-stack-layer select { margin: 0; padding: 3px 5px; font-size: 11px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 6, 8, 0.75);
  display: grid; place-items: center;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
/* sempre por CIMA de qualquer outro modal (join/color/etc, todos z-index:100 igual) —
   com z-index empatado, quem vence é a ordem no DOM, e não dá pra garantir que o aviso
   de conexão caída sempre vai vir DEPOIS de todo popup existente (e futuro) no HTML;
   um z-index bem mais alto resolve isso de vez, não importa o que mais esteja aberto */
#disconnect-overlay { z-index: 200; }
/* mestre caiu: fica abaixo do aviso de conexão perdida (200) e acima de qualquer painel */
#gm-away-overlay { z-index: 150; }
#gm-away-overlay[hidden] { display: none; }

/* aviso rápido genérico (substitui os alert() nativos espalhados — bloqueavam a tela
   inteira e destoavam do resto do app, que sempre usa mensagens inline). Fixo embaixo
   no centro, some sozinho depois de alguns segundos (ver showToast em app.js).
   z-index bem alto — precisa aparecer por cima de QUALQUER popup/painel aberto no
   momento, já que os erros que ele mostra vêm de ações feitas com algo aberto */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(420px, 90vw);
  background: var(--panel);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 300;
}
.toast[hidden] { display: none; }
.modal {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }

/* ---------- Amigos (public/js/friends.js, compartilhado entre index.html/room.html) ---------- */
.friends-modal { width: min(440px, 94vw); max-height: calc(100vh - 48px); min-height: min(460px, calc(100vh - 48px)); /* a janela não muda de altura ao trocar a lista pela busca */ position: relative; display: flex; flex-direction: column; overflow: visible; }
/* botão só-ícone: o de amigos no canto de cima do menu (com a bolinha de pendências) e os de fechar e limpar da janela de dados */
.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn.active { color: var(--accent-text); border-color: var(--accent); background: var(--panel); }
/* JANELA DE AMIGOS (2026-11-25, opção A de docs/prototipos/amigos.html) */
.fm-view { display: flex; flex-direction: column; min-height: 0; }
.fm-view[hidden] { display: none; }
.fm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-right: 34px; }
.fm-head h2 { flex: 1; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.fm-count { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.fm-add { width: auto; flex-shrink: 0; margin: 0; padding: 7px 14px; font-size: 13px; }
.fm-back { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; margin: 0; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer; }
.fm-back:hover { color: var(--text); }
.fm-back svg { width: 16px; height: 16px; }
.fm-find { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 9px; background: #121217; color: var(--text-dim); cursor: text; }
.fm-find:focus-within { border-color: #3a3a44; }
.fm-find svg { width: 15px; height: 15px; flex-shrink: 0; }
.fm-find input[type="text"] { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; outline: none; box-shadow: none; }
.fm-pending { border: 1px solid rgba(200, 30, 30, 0.55); background: rgba(200, 30, 30, 0.07); border-radius: 11px; padding: 10px 10px 6px; margin-bottom: 14px; }
.fm-pending[hidden] { display: none; }
.fm-pending-title { font-size: 12px; font-weight: 600; color: var(--accent-text); margin: 0 2px 4px; }
.fm-pending .fm-row:hover { background: rgba(255, 255, 255, 0.03); }
.fm-list { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; max-height: 52vh; }
.fm-group { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; margin: 10px 2px 4px; }
.fm-group:first-child { margin-top: 0; }
.fm-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; min-width: 0; }
.fm-row.click { cursor: pointer; }
.fm-row.click:hover, .fm-row.click:focus-visible { background: var(--panel-2); outline: none; }
.fm-av { position: relative; display: block; flex-shrink: 0; }
.fm-av .friend-row-avatar-wrap { display: block; width: 34px; height: 34px; border: 0; }
.fm-av .friend-row-avatar-placeholder { font-size: 13px; }
.fm-st { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #55555f; border: 2px solid var(--panel); }
.fm-st.on { background: #22c55e; }
.fm-row.click:hover .fm-st { border-color: var(--panel-2); }
.fm-row.off .friend-row-avatar-wrap { filter: grayscale(0.8) brightness(0.75); }
.fm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fm-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-row.off .fm-name { color: #b9b9c3; }
.fm-sub { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-sub.mine { color: #4ade80; }
.fm-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.fm-acts .btn.small-btn { width: auto; margin: 0; flex-shrink: 0; }
.fm-more { width: 30px; height: 30px; display: grid; place-items: center; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text-dim); cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.fm-more svg { width: 16px; height: 16px; }
.fm-row:hover .fm-more, .fm-row:focus-within .fm-more, .fm-more:focus-visible { opacity: 1; }
.fm-more:hover { color: var(--text); border-color: var(--line); background: var(--panel); }
@media (hover: none) { .fm-more { opacity: 1; } }
.fm-empty { margin: 6px 2px 2px; }
.fm-empty[hidden] { display: none; }
.fm-menu { position: absolute; z-index: 5; min-width: 180px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 2px; }
.fm-menu[hidden] { display: none; }
.fm-menu-item { width: 100%; margin: 0; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.fm-menu-item:hover { background: var(--panel-2); }
.fm-menu-item.danger { color: var(--danger); }
.fm-menu-item.danger[data-armed] { background: rgba(249, 115, 22, 0.12); }
#friends-copy-code { margin-top: 12px; width: auto; align-self: flex-start; }
#friends-copy-code[hidden] { display: none; }
.friend-row-avatar-wrap {
  position: relative; width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  overflow: hidden; background: var(--panel-2); border: 1px solid var(--line);
}
.friend-row-avatar {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.friend-row-avatar-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 11px; font-weight: 700;
}
/* botão "amigos" (navbar/topbar) precisa de position:relative pro badge de contagem
   (pedidos recebidos + convites pendentes) se posicionar em cima do canto */
#btn-open-friends { position: relative; }
.friend-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
}

/* ---------- Armazenamento (index.html) ---------- */
.modal.storage-modal {
  /* pedido explícito, com print mostrando "Backups" sozinho numa 2ª linha dos totais —
     "aumente o espaço horizontal... dando mais espaço pro resto também". 720px garante
     as 5 colunas de totais (minmax(120px,1fr) + gap:8px, 4 gaps) numa linha só mesmo no
     PIOR caso (632px mínimo pro grid + 48px de padding do .modal = 680px) com folga de
     sobra, e dá mais respiro pras linhas de mesa/lixeira também (nome mais longo antes
     de truncar, botão "testar" do áudio com mais espaço ao lado do nome)
  */
  width: min(720px, 95vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  position: relative; /* âncora do X no canto, mesmo padrão de .profile-modal/.friends-modal */
}
.storage-modal h3 { font-size: 14px; margin: 18px 0 10px; color: var(--text); }
.storage-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.storage-total-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.storage-total-item .label { display: block; font-size: 12px; color: var(--text-dim); }
.storage-total-item .value { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; }
.storage-total-item .count { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.storage-section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 4px; }
.storage-section-header h3 { margin: 0; }
/* mesmo padrão de #friends-list/.room-list — teto próprio + scroll interno, o resto do
   modal (totais, botões) fica sempre visível em vez de rolar junto */
/* overflow-x:hidden explícito — sem isso, definir só overflow-y:auto faz o navegador
   computar overflow-x como auto TAMBÉM (regra do CSS: só um dos dois eixos pode ficar
   "visible" quando o outro não é), o que mostrava uma barra de rolagem horizontal
   fantasma (print do usuário) mesmo o conteúdo nunca precisando rolar de lado */
.storage-list { display: flex; flex-direction: column; gap: 6px; max-height: 26vh; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.storage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
/* preview de cada item da lixeira (pedido explícito: "só por nome dos arquivo é dificil
   entender o que é cada coisa") — thumb pra imagem/gif (congelado no 1º frame, mesma
   técnica de buildLibraryThumbEl em app.js — evitar VÁRIOS gif animando ao mesmo tempo
   com o painel aberto), ícone genérico pra áudio (com botão "testar" ao lado, já que não
   dá pra "ver" um som) */
.storage-row-name-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.storage-row-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}
.storage-row-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.storage-row-icon svg { width: 18px; height: 18px; }
.storage-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* mesma armadilha do .btn{width:100%} dentro de flex já documentada várias vezes nesse
   projeto (ex.: popup "Sons") — sem o width:auto aqui, o botão "testar" reivindica ~100%
   da linha inteira (confirmado: 629px de 651px disponíveis), empurrando a linha inteira
   pra um scroll horizontal que não deveria existir */
.storage-row-play { width: auto; flex-shrink: 0; }
/* seção "Uploads ativos" (clicar no cartãozinho de totais abre) — lista com seleção pra
   mandar itens (mesmo em uso) pra lixeira, com aviso fixo de que param de funcionar */
.storage-total-clickable { cursor: pointer; }
.storage-total-clickable:hover,
.storage-total-clickable.active { border-color: var(--accent); }
/* declarada DEPOIS da regra base .hint no arquivo — mesma especificidade (1 classe),
   quem vence é ordem, e essa precisa vencer pra cor de aviso aparecer */
.storage-uploads-warning { color: var(--danger-dim); margin: 0 0 8px; }
.storage-row-check { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.storage-row-selectable { cursor: pointer; }
.storage-row-selectable.selected { border-color: var(--accent); }
.storage-row-name-col { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.storage-row-used { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* mesmo fix de .storage-row-play — .btn{width:100%} dentro do flex do cabeçalho
   espremeria o h3 (classe .btn.danger.small-btn não tem reset próprio) */
.storage-section-header .btn { width: auto; flex-shrink: 0; }
.storage-row-meta { flex-shrink: 0; font-size: 12px; color: var(--text-dim); text-align: right; }
/* backups: cada data é uma linha que abre a lista das mesas dela */
.storage-backups-list { max-height: 34vh; }
.storage-backup { display: flex; flex-direction: column; gap: 6px; }
.storage-backup-rooms { display: flex; flex-direction: column; gap: 6px; padding-left: 14px; }
.storage-backup-rooms[hidden] { display: none; }
.storage-backup-actions { display: flex; gap: 6px; flex-shrink: 0; }
.storage-backup-room .btn { width: auto; flex-shrink: 0; }
#btn-storage-empty-trash { margin-top: 12px; }
#storage-msg, #storage-error { margin-top: 10px; }

/* ---------- Menu de contexto ---------- */
.context-menu {
  position: fixed;
  width: 230px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  z-index: 50;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.menu-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--accent-text); }
.context-menu label { margin-bottom: 8px; font-size: 12px; }
.context-menu input[type="text"], .context-menu input[type="number"], .context-menu select { padding: 6px 8px; font-size: 13px; }
.context-menu .btn { margin-bottom: 8px; }
.context-menu .btn:last-child { margin-bottom: 0; }
/* mesma armadilha do `[hidden]` de sempre nesse projeto: `.btn` tem `display:inline-block`
   de autor, que vence o `[hidden]` padrão do navegador — sem esse override, os botões
   condicionais desse menu (Criar variação de arte, Ver/Resetar variações) SEMPRE
   apareciam, mesmo com `.hidden = true` setado corretamente pelo JS (bug real, achado
   testando: um token sem states nenhum mostrava "Ver variações de arte"/"Resetar states"
   igual um token com states) */
.context-menu .btn[hidden] { display: none; }

.merge-context-menu { width: auto; padding: 6px; }
.merge-context-menu .btn { width: auto; white-space: nowrap; }
/* janelinha do elevador (botão de chamada no mapa) */
/* passageiros de um veículo (clique no selo do carro) */
.riders-pop { width: 250px; display: flex; flex-direction: column; gap: 4px; padding: 10px; }
.riders-pop[hidden] { display: none; }
.riders-pop .menu-title { margin-bottom: 4px; }
.riders-pop.dragging { opacity: 0.55; }
.rider-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; user-select: none; }
.rider-row.can-drag { cursor: grab; touch-action: none; }
.rider-row.can-drag:hover { background: var(--panel-2); }
.rider-face { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; border-radius: 6px; pointer-events: none; }
span.rider-face { border-radius: 50%; }
.rider-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riders-pop .btn.small-btn { width: auto; flex-shrink: 0; margin: 0; }
.riders-pop .btn.rider-all { margin-top: 4px; }
.rider-ghost { position: fixed; z-index: 4000; transform: translate(-50%, -50%); object-fit: contain; pointer-events: none; opacity: 0.85; }
span.rider-ghost { border-radius: 50%; }
.elevator-pop { min-width: 220px; max-width: 300px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.elevator-pop[hidden] { display: none; }
.elevator-pop .menu-title { margin-bottom: 2px; }
.elevator-pop .btn { width: 100%; margin-bottom: 0; }
.elevator-pop .elev-floor { text-align: left; }
.elev-note { font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.elev-who { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.elev-where { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.elev-gm { margin-top: 2px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.elev-actions { display: flex; gap: 6px; margin-top: 4px; }
.elev-actions .btn { flex: 1; }
.elev-go { background: var(--accent); color: #fff; }
.elev-name { display: flex; flex-direction: column; gap: 4px; }
.elev-name input { width: 100%; }
/* ---------- Menu do jogo (três riscos na navbar) ---------- */
.menu-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 30px;
  height: 26px;
  padding: 5px 6px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-burger span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--text-dim);
  transition: background 0.15s ease;
}
.menu-burger:hover span { background: var(--accent); }
.game-menu-modal { width: min(380px, 92vw); }
.game-menu-modal .btn { margin-top: 10px; }
.game-menu-modal h2 { text-align: center; }
/* MENU DA MESA (2026-11-17): resumo no topo e itens no estilo dos cartões da tela inicial */
.gm-mh { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.gm-mh-thumb { position: relative; width: 64px; height: 44px; border-radius: 8px; background: #1a1a20; overflow: hidden; flex-shrink: 0; border: 1px solid rgba(255, 255, 255, 0.1); }
.gm-mh-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gm-mh-text { min-width: 0; flex: 1; }
.game-menu-modal h2.gm-mh-name { text-align: left; margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-mh-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; }
.gm-mh-sub b { color: var(--text); font-weight: 600; }
.gm-mh-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 5px; vertical-align: 1px; }
.gm-mh-dot.off { background: #55555f; }
.gm-mi { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; background: #1e1e25; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s; }
.gm-mi:hover { border-color: var(--accent); }
.gm-mi-ico { position: relative; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #16161b; color: var(--accent-text); flex-shrink: 0; }
.gm-mi-ico svg { width: 18px; height: 18px; }
.gm-mi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-mi-title { font-weight: 600; font-size: 14px; white-space: nowrap; }
.gm-mi-desc { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.gm-mi-ok { font-size: 12px; color: #4ade80; font-weight: 600; flex-shrink: 0; }
.gm-mi-ok[hidden] { display: none; }
.gm-mi-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-sizing: border-box; }
.gm-mi-badge[hidden] { display: none; }
.gm-mi.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.gm-mi.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.gm-mi.primary .gm-mi-ico { background: rgba(0, 0, 0, 0.18); color: #fff; }
.gm-mi.primary .gm-mi-desc { color: rgba(255, 255, 255, 0.8); }
.gm-mi.exit .gm-mi-ico, .gm-mi.exit .gm-mi-title { color: var(--danger); }
.gm-mi.exit:hover { border-color: var(--danger); }
.gm-mi-row { display: flex; gap: 8px; }
.gm-mi-row .gm-mi { flex: 1; min-width: 0; }
.gm-vol { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #16161b; border: 1px solid var(--line); cursor: default; }
.gm-vol svg { width: 18px; height: 18px; color: var(--text-dim); flex-shrink: 0; }
.gm-vol input { flex: 1; min-width: 0; accent-color: var(--accent); margin: 0; }
.gm-vol-value { font-size: 12px; color: var(--text-dim); width: 36px; text-align: right; flex-shrink: 0; }
.gm-mi-sep { height: 1px; background: var(--line); margin: 12px 0 4px; }
/* view interna trocada por [hidden] — sem regra de display de autor nas divs, então o
   [hidden] padrão do navegador funciona sozinho (sem a armadilha clássica documentada) */
/* cada linha (select OU slider) empilhada — rótulo em cima, controle embaixo na largura
   TOTAL — mesma estrutura pro select e pros sliders, pra ficarem alinhados entre si em
   vez de cada um ter uma largura diferente por causa do texto do rótulo (bug relatado:
   "as barras não são iguais e muito perto uma da outra") */
.settings-row { margin-bottom: 18px; }
.settings-row select { margin-top: 6px; }
.settings-slider-control { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.settings-slider-control input[type="range"] { flex: 1; min-width: 0; }
.settings-slider-value { flex-shrink: 0; font-size: 12px; color: var(--text-dim); width: 36px; text-align: right; }

/* ---------- Popup de criar states ---------- */
.merge-modal { width: min(420px, 92vw); }
/* popup "Importar token": três opções grandes, a última escolhida fica destacada */
.import-size-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  margin-top: 8px;
}
.import-size-option span { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.import-size-option.last-used { border-color: var(--accent); }
/* editor do token circular */
.modal.ct-box { width: min(720px, 94vw); max-height: calc(100vh - 32px); overflow-y: auto; }
.ct-body { display: flex; gap: 22px; align-items: flex-start; }
.ct-stage-col { flex: 0 0 340px; min-width: 0; }
.ct-canvas { display: block; width: 340px; height: 340px; border-radius: 10px; background: #0d0d10; cursor: grab; touch-action: none; }
.ct-canvas.dragging { cursor: grabbing; }
.ct-zoom-row { margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.ct-side { flex: 1; min-width: 0; }
.ct-label { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.ct-label:not(:first-child) { margin-top: 16px; }
.ct-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ct-style { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; }
.ct-style:hover { color: var(--text); border-color: #3a3a45; }
.ct-style[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }
.ct-style canvas { width: 52px; height: 52px; }
.ct-colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ct-swatch { width: 26px; height: 26px; margin: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); cursor: pointer; }
.ct-swatch[aria-pressed="true"] { border-color: var(--text); }
.ct-colors input[type="color"], .ct-bg-row input[type="color"] { width: 34px; height: 28px; margin: 0; padding: 2px; flex: none; }
.ct-bg-row { margin-top: 16px; font-size: 14px; }
.ct-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
#circle-token-modal { z-index: 120; } /* por cima da biblioteca, de onde ele também abre */
.ct-foot .btn[hidden] { display: none; }
.ct-name-row { display: block; margin-top: 12px; font-size: 13px; }
.ct-name-row input { margin-top: 4px; }
.ct-check-row { margin-top: 10px; font-size: 14px; }
.ct-check-row[hidden], .ct-thick-row[hidden] { display: none; }
.ct-thick-row { display: block; margin-top: 12px; font-size: 13px; }
.ct-thick-row span { display: flex; justify-content: space-between; color: var(--text-dim); }
.ct-thick-row b { color: var(--text); font-weight: 600; }
.ct-thick-row input { width: 100%; margin: 6px 0 0; }
.ct-colors.ct-off { opacity: 0.35; pointer-events: none; }
.ct-style-wrap { position: relative; display: flex; }
.ct-style-wrap .ct-style { flex: 1; min-width: 0; }
.ct-style span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-style-del { position: absolute; top: 3px; right: 3px; min-width: 20px; height: 20px; margin: 0; padding: 0 5px; border: 0; border-radius: 6px; background: rgba(13, 13, 16, 0.85); color: var(--text-dim); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.ct-style-wrap:hover .ct-style-del, .ct-style-del:focus-visible, .ct-style-del.armed { opacity: 1; }
.ct-style-del:hover { color: var(--text); }
.ct-style-del.armed { color: #fff; background: var(--danger); font-size: 11px; }
.ct-style-add { justify-content: center; border-style: dashed; }
.ct-add-plus { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--bg); color: var(--accent-text); font-size: 26px; line-height: 1; }
.library-icon-btn[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); background: rgba(200, 30, 30, 0.12); }
.ct-foot .btn { width: auto; margin: 0; }
.ct-spacer { flex: 1; }
@media (max-width: 640px) {
  .ct-body { flex-direction: column; }
  .ct-stage-col { flex-basis: auto; align-self: center; }
  .ct-foot { flex-wrap: wrap; }
}
/* SONS (2026-11-25): painel flutuante com abas por assunto; a altura segue a aba */
#door-sounds-title { flex: 1; margin: 0; padding: 14px 0 10px 20px; cursor: move; user-select: none; }
.modal.snd-box { width: min(600px, 94vw); padding: 0; overflow: hidden; }
.snd-head { display: flex; align-items: center; padding-right: 12px; }
.snd-tabs .lw-tab { padding: 9px 12px; white-space: nowrap; }
.snd-list { display: flex; flex-direction: column; gap: 18px; max-height: 62vh; overflow-y: auto; padding: 16px 20px 20px; }
.snd-sec-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; font-size: 13px; font-weight: 600; }
.snd-sec-title span { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.snd-rows { display: flex; flex-direction: column; gap: 6px; }
.snd-row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 5px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; }
.snd-lab { flex: 0 0 66px; font-size: 12px; color: var(--text-dim); }
.snd-btn { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 30px; height: 30px; padding: 0; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text-dim); cursor: pointer; }
.snd-btn svg { width: 17px; height: 17px; }
.snd-btn:hover { color: var(--text); border-color: var(--line); }
.snd-btn.on { color: var(--accent-text); background: rgba(200, 30, 30, 0.18); border-color: var(--accent); }
.snd-btn.snd-del:hover { color: var(--danger); border-color: var(--danger); }
.snd-btn:disabled { opacity: 0.35; cursor: default; border-color: transparent; }
.snd-row input[type="text"].snd-name { flex: 1 1 150px; min-width: 60px; margin: 0; padding: 5px 8px; font-size: 13px; font-weight: 500; background: transparent; border: 1px solid transparent; border-radius: 7px; text-overflow: ellipsis; }
.snd-row input[type="text"].snd-name:hover, .snd-row input[type="text"].snd-name:focus { border-color: var(--line); background: #0d0d10; }
.snd-row input[type="range"] { flex: 0 1 120px; min-width: 60px; }
.snd-val { flex: 0 0 38px; text-align: right; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.snd-add { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin: 0; padding: 0 12px; background: none; border: 1px dashed #3a3a45; border-radius: 9px; color: var(--text-dim); font: 500 13px var(--font); text-align: left; cursor: pointer; }
.snd-add svg { width: 16px; height: 16px; flex-shrink: 0; }
.snd-add:hover { color: var(--text); border-color: var(--accent); }
.snd-add:disabled { cursor: progress; }
.snd-add .snd-lab { color: inherit; }
.snd-extra { display: flex; align-items: center; gap: 8px; padding: 2px 8px 0; font-size: 12px; color: var(--text-dim); }
.snd-extra input[type="number"] { width: 66px; margin: 0; padding: 5px 8px; font-size: 13px; }
.snd-extra .btn { width: auto; flex-shrink: 0; margin: 0; }
.merge-list { margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.merge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
/* .btn herda width:100% da regra base e espremia o input ao lado */
.merge-row .btn.small-btn { width: auto; flex-shrink: 0; }
.merge-thumb {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
  flex-shrink: 0;
}
.merge-name { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merge-state-input {
  width: 48px;
  margin: 0;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  text-align: center;
}
.merge-row-remove {
  width: 26px; height: 26px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--danger-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.merge-row-remove:hover { border-color: var(--danger); color: var(--danger); }
/* aviso de duplicata por linha no salvar em lote da biblioteca — .merge-row é flex
   row (thumb+nome+remover); flex-wrap + flex-basis:100% no banner força ele pra uma
   "segunda linha" dentro da MESMA .merge-row, sem precisar de wrapper extra nem virar
   coluna (mesma técnica de .sound-row, mas só quando o conflito existe) */
.library-batch-row-conflict { flex-wrap: wrap; border-color: var(--accent); }
.library-batch-conflict {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--text-dim);
}
.library-batch-conflict[hidden] { display: none; }
.merge-actions { display: flex; gap: 10px; margin-top: 6px; }
.merge-actions .btn { width: auto; flex: 1; }

/* ---------- Biblioteca de tokens salvos ---------- */
/* painel FLUTUANTE, não modal — pedido explícito: "que o mestre possa usar a mesa ainda
   com a biblioteca aberta... deixar a biblioteca no canto da tela e spawnar os tokens
   quando precisar". Sem backdrop (não cobre a tela, não bloqueia clique no mapa por
   baixo) e sem `place-items:center` (posição é controlada só por `left`/`top`, ajustados
   ao arrastar pelo título). ARMADILHA: nunca declarar `inset` nessa regra — mesmo como
   `auto`, é shorthand de top/right/bottom/left e reseta os `top`/`left` acima dele na
   MESMA regra (bug real encontrado: painel sempre nascia grudado no canto 0,0) */
.library-panel {
  position: fixed;
  top: 90px;
  left: 260px;
  z-index: 30;
}
/* mesma armadilha do `[hidden]` de sempre nesse projeto: sem essa regra, o painel nunca
   some de verdade (regra de autor `position:fixed` não é display, mas sem um `display:none`
   explícito o elemento continua ocupando espaço/recebendo eventos mesmo com `hidden`) */
.library-panel[hidden] { display: none; }
#library-title { cursor: move; user-select: none; flex: 1; margin: 0; }
/* cabeçalho de painel: título (alça de arrastar) + X de fechar no canto direito */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-close-x { width: 30px; height: 30px; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text-dim); cursor: pointer; }
.panel-close-x svg { width: 16px; height: 16px; }
.panel-close-x:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.library-modal { width: min(640px, 92vw); }
/* modo lote (2+ tokens salvos de uma vez) precisa de mais espaço horizontal — a fila
   vira uma SEGUNDA COLUNA ao lado da navegação de pastas, não é só texto a mais */
.library-modal.library-modal-wide { width: min(920px, 96vw); }
/* linha (não coluna) só quando o modo lote está ativo — .library-batch-col cuida da
   própria visibilidade via [hidden], então esse wrapper pode ser sempre flex-row */
.library-body { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.library-browse-col { flex: 1; min-width: 0; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
/* mesma armadilha do `.btn { width:100% }` dentro de flex já corrigida no popup "Sons"
   (ver `.merge-row .btn.small-btn`): sem resetar, o botão "+ Nova pasta" vira um
   flex-basis gigante e espreme o caminho (breadcrumb) pra quase nada — era o bug do
   print ("o caminho em cima por exemplo é pouco espaço e não consigo ver") */
.library-toolbar .btn { width: auto; flex-shrink: 0; }
/* o caminho fica com TODO o espaço que sobra do botão e pode QUEBRAR de linha quando o
   aninhamento de pastas for fundo demais — nunca mais corta com "..." */
.library-breadcrumb { flex: 1; min-width: 0; font-size: 13px; color: var(--text-dim); overflow-wrap: anywhere; }
.library-breadcrumb span { cursor: pointer; }
.library-breadcrumb span:hover { color: var(--accent-text); }
.library-breadcrumb .sep { margin: 0 4px; cursor: default; }
.library-breadcrumb .sep:hover { color: var(--text-dim); }
/* busca por nome em TODAS as pastas de uma vez (digitou, a grade abaixo vira os
   resultados; apagou, volta pra navegação normal de pastas) */
.library-search { margin: 0 0 8px; padding: 8px 10px; font-size: 13px; }
/* grade de ícones grandes, igual "ícones grandes" do Explorador de Arquivos do Windows */
.library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
}

/* ---------- Cenas (aba focável na barra do mestre) ---------- */
/* linha em DUAS partes (miniatura+nome em cima, olho+× embaixo) — de volta na barra
   lateral estreita (era um painel flutuante de 420px; revertido a pedido: "voltando a
   parte de cenas pro conjunto do mestre"), tudo numa linha só espremeria o nome de
   volta pros ~70px que motivaram a saída na época */
.scene-row { flex-direction: column; align-items: stretch; gap: 6px; }
.scene-row-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scene-row-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
/* miniatura do mapa da cena — mesma proporção da miniatura das mesas na tela inicial */
.scene-thumb {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  pointer-events: none; /* clique na miniatura conta como clique na linha (trocar de cena) */
}
/* olhinho de "nome visível/oculto" — ícone no lugar do antigo botão de texto */
.eye-toggle {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
}
.eye-toggle svg { width: 100%; height: 100%; }
.eye-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.eye-toggle.active { color: var(--accent-text); border-color: var(--accent); }
.library-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}
.library-tile:hover { background: var(--panel-2); border-color: var(--line); }
.library-tile.drag-over { border-color: var(--accent); background: var(--panel-2); }
.library-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
}
.library-folder-icon {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--accent-text);
}
.library-folder-icon svg { width: 55%; height: 55%; }
.library-tile-name {
  width: 100%;
  margin: 0;
  padding: 2px 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  text-align: center;
}
.library-tile-name:hover, .library-tile-name:focus-visible { border-color: var(--line); background: var(--bg); }
.library-tile-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  background: var(--panel);
}
.library-tile:hover .library-tile-delete, .library-tile-delete.confirm { opacity: 1; }
/* selo de contagem num item de GRUPO ("salvar junto", 2+ tokens salvos com posição
   relativa preservada) — canto inferior-direito, o superior-direito já é o "×" de
   excluir (ver .library-tile-delete acima) */
.library-tile-group-badge {
  position: absolute;
  bottom: 22px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.library-empty-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-dim); padding: 4px; }
.library-save-row { display: flex; gap: 8px; margin-top: 10px; }
/* mesma armadilha do `[hidden]` de sempre nesse projeto: a regra de autor `display:flex`
   acima vence a regra padrão do navegador pra [hidden] — sem esse display:none explícito,
   o campo "Nome do token"/"Salvar aqui" aparecia SEMPRE, até em modo navegar (o JS já
   setava o atributo certo, só o CSS não obedecia) */
.library-save-row[hidden] { display: none; }
.library-save-row input { flex: 1; margin: 0; }
.library-save-row .btn { width: auto; flex-shrink: 0; }
.library-save-conflict { margin-top: 10px; }
.library-save-conflict p { margin: 0 0 10px; }
/* salvar VÁRIOS tokens de uma vez — coluna PRÓPRIA ao lado da navegação de pastas
   (pedido explícito: "se a pasta ja tiver tokens ela sai da tela, então faça a fila de
   tokens aparecer ao lado em vez de embaixo, expandindo o painel pro lado") — nunca
   estoura o painel pra fora da tela não importa quantos itens a pasta atual já tenha,
   já que tem seu próprio scroll independente do `.library-list`. Mesma armadilha do
   [hidden] de sempre (regra de autor `display:flex` venceria o `[hidden]` padrão) */
.library-batch-col {
  display: flex;
  flex-direction: column;
  width: 260px;
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  /* mesmo teto de altura do .library-list ao lado, pra ficarem visualmente equilibrados */
  max-height: 55vh;
}
.library-batch-col[hidden] { display: none; }
.library-batch-col .merge-list { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; margin: 0 0 10px; }
.library-batch-col .btn { width: 100%; flex-shrink: 0; }
/* thumb menor nessa coluna estreita — o padrão de 64px (herdado de .merge-thumb, usado
   nos popups mais largos de criar states) espremeria demais o nome ao lado */
.library-batch-col .merge-thumb { width: 40px; height: 40px; }

/* ---------- Mesa de documentos (livros, páginas de diário, cartas...) ---------- */
/* Tela cheia própria, separada do mapa principal — mesmo padrão de outros overlays
   deste projeto: nunca usa [hidden] (regra de autor "display" venceria a regra padrão
   do navegador), só alterna a classe .visible */
.documents-board-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--bg);
  flex-direction: column;
}
.documents-board-modal.visible { display: flex; }
.documents-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.documents-board-header h2 { margin: 0; }
.doc-tips { flex: 1; min-width: 0; margin-left: 14px; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.documents-board-header .btn[hidden] { display: none; }
.documents-board-header .panel-close-x { margin-left: 8px; }
.doc-empty { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 6px; max-width: 340px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--text-dim); pointer-events: none; }
.doc-empty b { font-size: 16px; font-weight: 600; color: var(--text); }
.doc-empty[hidden] { display: none; }
.modal.doc-modal { width: min(440px, 92vw); }
.doc-faces { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 10px; }
.doc-face { position: relative; display: flex; align-items: center; justify-content: center; height: 170px; margin: 0; border: 1px dashed #3a3a45; border-radius: 10px; background: #0d0d10; overflow: hidden; cursor: pointer; }
.doc-face:hover { border-color: var(--accent); }
.doc-face span { display: flex; flex-direction: column; gap: 3px; text-align: center; font-size: 12px; color: var(--text-dim); }
.doc-face b { font-size: 14px; font-weight: 600; color: var(--text); }
.doc-face img { width: 100%; height: 100%; object-fit: contain; }
.doc-face img[hidden] { display: none; }
.doc-face.has { border-style: solid; }
.doc-face.has span { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px; background: rgba(13, 13, 16, 0.8); }
.doc-face.has b { display: none; }
.documents-board-header .btn { width: auto; flex-shrink: 0; }
.document-board-canvas-wrap { flex: 1; position: relative; overflow: hidden; }
.document-reader-image-wrap.dragging { cursor: grabbing; }

/* ---------- Cor de mão (estilo TTS) ---------- */
/* 2026-11-25: prévia do cartão, anel da própria cor, escolha com "derramamento" (ver openColorModal/floodColor). As cores não mudam */
#color-modal-close[hidden] { display: none; } /* primeira entrada: escolher é obrigatório (o .btn vencia o [hidden] e o Fechar aparecia) */
.modal.color-modal { position: relative; width: min(380px, 92vw); text-align: center; overflow: hidden; }
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 20px;
}
.color-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: none;
  background: var(--c);
  cursor: pointer;
  padding: 0;
  transition: scale 0.18s, translate 0.18s, opacity 0.18s, box-shadow 0.18s;
}
/* o resto recua enquanto o mouse está numa cor, pra comparar tons vizinhos (violeta e roxo, por exemplo) */
.color-grid.hov .color-swatch:not(:hover):not(.selected) { opacity: 0.5; scale: 0.95; }
.color-grid.hov .color-swatch:hover, .color-swatch:focus-visible { scale: 1.07; translate: 0 -2px; outline: none; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.color-swatch.selected { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--c); }
.color-swatch.selected::after { content: ''; position: absolute; left: 50%; top: 45%; width: 22%; height: 42%; border: solid var(--ink); border-width: 0 4px 4px 0; border-radius: 1px; translate: -50% -50%; rotate: 45deg; }
/* pedido explícito: a cor NÃO fica mais escura quando já escolhida (confundia jogador,
   parecia só um tom mais escuro disponível) — o quadrado continua no brilho normal, quem
   já pegou aparece como uma foto/inicial por cima (.color-swatch-owner-avatar-wrap) */
.color-swatch.taken { cursor: not-allowed; }
.color-grid.busy .color-swatch { cursor: default; }
/* prévia: o próprio cartão de jogador, com a cor sob o mouse derramada a partir da foto */
.color-preview { position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 10px; background: var(--mine, #3a3a44); color: var(--ink, #f5f5f7); overflow: hidden; text-align: left; transition: color 0.2s; }
.color-preview b { position: relative; font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-preview em { position: relative; margin-left: auto; flex-shrink: 0; font-style: normal; font-size: 12px; opacity: 0.85; }
.color-pour { position: absolute; inset: 0; background: var(--pour, transparent); clip-path: circle(0 at 26px 50%); }
.color-preview.on .color-pour { clip-path: circle(130% at 26px 50%); }
.color-prev-face { position: relative; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: rgba(0, 0, 0, 0.3); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.color-prev-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.color-prev-face img[hidden] { display: none; }
.color-flood { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--c); color: var(--ink); clip-path: circle(0 at var(--x, 50%) var(--y, 50%)); pointer-events: none; font-size: 18px; }
.color-flood b { font-weight: 600; }
.color-flood .color-prev-face { width: 72px; height: 72px; font-size: 26px; box-shadow: 0 0 0 4px var(--ink); }
#color-modal.leaving { opacity: 0; transition: opacity 0.25s; }
/* a cor escorre pra lista (liquid-pour.js): o líquido é desenhado por cima, no lugar da janela, e o fundo clareia */
#color-modal.pouring { background: transparent; transition: background-color 0.6s; pointer-events: none; }
#color-modal.pouring .modal { visibility: hidden; }
.liquid-pour { position: fixed; z-index: 101; pointer-events: none; }
.liquid-face { position: fixed; z-index: 102; border-radius: 50%; overflow: hidden; background: #2a2a33; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; pointer-events: none; will-change: transform; }
.liquid-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.liquid-face img[hidden] { display: none; }
.player-card.awaiting-color .player-card-avatar-wrap { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #33333d; }
.player-card.awaiting-color .player-card-avatar-wrap > * { opacity: 0.25; }
.player-card.awaiting-color .player-card-ring .bar { stroke: #4a4a55; }
.players-panel.solid:not(.compact) .player-card.awaiting-color { background: var(--panel); color: var(--text); }
.players-panel.solid:not(.compact) .player-card.awaiting-color .player-card-avatar-wrap { box-shadow: none; }
@property --fill { syntax: '<length-percentage>'; inherits: false; initial-value: 0%; }
.players-panel.solid .player-card.color-landed { background: radial-gradient(circle at 26px 50%, var(--c) var(--fill), var(--panel) calc(var(--fill) + 1px)); animation: cardFill 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
/* a cor enchendo o cartão e o pulso juntos: um não pode apagar o outro */
.players-panel.solid .player-card.color-landed.color-pulse { animation: cardFill 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards, colorPulse 0.9s var(--pulse-delay, 0s) ease-out; }
@keyframes cardFill { from { --fill: 20px; color: var(--text); } 20% { color: var(--text); } 45% { color: var(--k); } to { --fill: 230px; color: var(--k); } }
@media (prefers-reduced-motion: no-preference) {
  .color-pour { transition: clip-path 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .color-grid.enter .color-swatch { animation: colorIn 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) backwards; animation-delay: calc(var(--i) * 18ms); }
  .color-swatch.selected::after { animation: colorCheck 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); }
  .color-swatch.no { animation: colorNo 0.32s; }
  .color-flood.go { animation: colorFlood 0.55s cubic-bezier(0.3, 0.7, 0.2, 1) forwards; }
  .color-flood.go .color-prev-face { animation: colorStamp 0.5s 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) backwards; }
  .color-flood.go b { animation: colorName 0.3s 0.35s ease-out backwards; }
  .player-card.color-pulse { animation: colorPulse 0.9s var(--pulse-delay, 0s) ease-out; }
}
@keyframes colorIn { from { scale: 0; rotate: -12deg; opacity: 0; } }
@keyframes colorCheck { from { scale: 0; } }
@keyframes colorNo { 20% { translate: -5px; } 40% { translate: 5px; } 60% { translate: -4px; } 80% { translate: 3px; } }
@keyframes colorFlood { to { clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); } }
@keyframes colorStamp { from { scale: 0.3; opacity: 0; } }
@keyframes colorName { from { translate: 0 8px; opacity: 0; } }
@keyframes colorPulse { 0% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 0 var(--pc); scale: 1; } 25% { scale: 1.035; } 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 7px transparent; scale: 1; } }
.color-swatch-owner-avatar-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35); /* fundo escuro atrás da foto/inicial — garante contraste em cima de qualquer cor da paleta, inclusive as claras (amarelo, branco) */
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.color-swatch-owner-avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.color-swatch-owner-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ---------- Névoa de guerra ---------- */
/* grid 2x2 em vez de 4 numa linha só (bug corrigido: 4 botões com `flex:1` numa fileira
   só, cada um com uns 39px de largura disponível dentro dos ~220px do painel, estouravam
   o container — "Pincel" cortado, "Laço" nem aparecia; texto de botão não encolhe abaixo
   do próprio min-content em flexbox por padrão) — 2 colunas dão o dobro do espaço por
   botão, cabendo confortavelmente mesmo o rótulo mais longo ("Retângulo") */
.fog-shape-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.fog-shape-toggle .btn { margin-bottom: 0; }
.tool-group-body .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Canto inferior direito: dados / documentos / ajuda ---------- */
/* pedido explícito: "as opções da navbar de dados e documentos... vão ficar no canto
   inferior direito junto com a ajuda, 3 circulos um acima do outro" — .shortcuts-toggle
   (só o "?", sozinho) virou .corner-toggle (compartilhado pelos 3), dentro de um
   container que empilha em coluna. z-index 20 é MENOR que o do painel de dados (30) e
   do quadro de documentos (45) de propósito — quando qualquer um dos dois abre, ele
   cobre esse canto naturalmente (mesmo comportamento que "?" já tinha contra o popup
   de atalhos), sem precisar mover os círculos pra outro lugar */
.corner-toggles {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
.corner-toggle {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.corner-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.corner-toggle svg { width: 17px; height: 17px; }

/* popup LARGO com os atalhos fluindo em colunas lado a lado (pedido explícito: "em vez
   de um scroll pode aumentar o tamanho horizontal... opções em mais colunas") — cada
   .shortcuts-list usa CSS multi-column com `columns: <largura-mínima>` (não um número
   fixo de colunas): o navegador encaixa quantas colunas de ~330px couberem na largura
   atual do popup (3 num desktop comum, 2/1 conforme a janela aperta), responsivo de
   graça. O max-height + scroll do miolo continuam SÓ como rede de segurança pra janela
   muito baixa — no tamanho normal de tela nada rola */
.shortcuts-modal {
  position: relative;
  width: min(1240px, 96vw);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}
.shortcuts-scroll { overflow-y: auto; min-height: 0; padding-right: 6px; }
/* barra de rolagem temática (a padrão branca do navegador destoava do popup escuro) */
.shortcuts-scroll::-webkit-scrollbar, .shortcuts-modal::-webkit-scrollbar { width: 7px; }
.shortcuts-scroll::-webkit-scrollbar-track, .shortcuts-modal::-webkit-scrollbar-track { background: transparent; }
.shortcuts-scroll::-webkit-scrollbar-thumb, .shortcuts-modal::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.shortcuts-scroll::-webkit-scrollbar-thumb:hover, .shortcuts-modal::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.shortcuts-section-title {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-text);
}
.sc-head { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; padding-right: 36px; }
.modal .sc-head h2 { margin: 0; }
.sc-search { flex: 1; max-width: 320px; }
.sc-tabs { padding: 0; margin-bottom: 14px; }
.sc-tabs[hidden] { display: none; }
.sc-cols { columns: 340px; column-gap: 32px; }
.sc-cols[hidden], .sc-group[hidden] { display: none; }
.sc-group { margin-bottom: 20px; break-inside: avoid; }
.sc-group h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.shortcuts-list { list-style: none; margin: 0; padding: 0; }
.shortcuts-list li[hidden] { display: none; }
.shortcuts-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-dim);
  /* um item nunca quebra no meio entre uma coluna e a próxima */
  break-inside: avoid;
}
/* sem a exceção de :first-child de antes — com multi-column, cada COLUNA começa com um
   item "do meio" da lista, então tirar a borda só do primeiro deixaria as colunas
   assimétricas; borda em todos = topo uniforme em toda coluna */
.shortcuts-list .keys { color: var(--text); flex-shrink: 0; }
.shortcuts-list kbd {
  display: inline-block;
  padding: 2px 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font);
  font-size: 12px;
}

@media (max-width: 700px) {
  .gm-tools { width: 180px; }
}

/* ---------- Painel de dados (rolagem, tecla R) ---------- */
.dice-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  /* alargado (era 280px) — pedido explícito: "aumente o espaço pra todos os dados
     caberem em uma linha" (7 botões, d4 a d100, numa fileira só) */
  width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  z-index: 30; /* mesmo nível do painel flutuante da Biblioteca */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
/* display:flex de autor vence o [hidden] padrão do navegador — mesma armadilha
   documentada n vezes nesse arquivo */
.dice-panel[hidden] { display: none; }
.dice-panel-header { display: flex; align-items: center; justify-content: space-between; }
.dice-panel-title { display: flex; align-items: center; gap: 7px; }
.dice-panel-header h3 { margin: 0; font-size: 14px; }
/* régua tracejada no lugar de uma borda reta simples — pedido explícito de fugir do
   básico ("como podemos deixar isso melhor e mais bonito"), pequeno toque "desenhado
   à mão" combinando com o resto da identidade visual escura/crua do app */
.dice-panel-divider { border-top: 1px dashed var(--line); margin: 2px 0 -2px; }
/* dado vira ÍCONE (contorno poligonal por face) + rótulo embaixo, não mais um pill de
   texto plano — cartão próprio (fundo panel-2, acende a cor de acento no hover) */
.dice-quick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dice-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 2px 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.dice-quick-btn:hover { border-color: var(--accent); }
.dice-quick-btn svg { display: block; width: 20px; height: 20px; }
.dice-quick-btn span { font-size: 11px; color: var(--text-dim); }
/* align-items:center — sem isso, o campo (~20px), o botão de limpar (30px fixo) e
   "Rolar" (~32px) ficam cada um alinhado ao TOPO da linha por padrão (align-items:stretch
   não estica quem já tem altura fixa, mas também não centraliza), dando a impressão de
   desalinhado (pedido explícito, com print) */
.dice-expr-row { display: flex; align-items: center; gap: 6px; }
/* margin-top:0 explícito (duas classes, vence por especificidade) — sem isso, a regra
   genérica `input[type="text"]` (elemento+atributo, MAIS específica que a classe
   .floor-name-input sozinha) grudava um margin-top:6px que nem o `margin:0` de
   .floor-name-input conseguia sobrescrever, empurrando o campo 6px pra baixo e
   quebrando o alinhamento vertical com os botões ao lado (mesma armadilha de
   especificidade já documentada várias vezes nesse projeto) */
.dice-expr-row .floor-name-input { flex: 1; min-width: 0; margin-top: 0; }
/* mesma armadilha do .btn{width:100%} dentro de flex de sempre */
.dice-expr-row .btn { width: auto; flex-shrink: 0; }
/* "rolagem oculta" (GM-only): label.inline define display:flex, que venceria o [hidden] */
#dice-hidden-row { font-size: 12px; color: var(--text-dim); }
#dice-hidden-row[hidden] { display: none; }
.dice-history { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; overflow-x: hidden; }
/* histórico vazio some de vez — senão a div de altura 0 ainda contribui um gap extra
   do flex entre o cabeçalho e os botões */
.dice-history:empty { display: none; }
/* barra de rolagem temática (pedido explícito, com print: "essa barra branca não
   combina") — o navegador nunca tinha uma barra estilizada nesse app inteiro, esse é o
   primeiro lugar; fina, trilho invisível (funde com o fundo do painel), acende
   --accent no hover, mesma linguagem do resto da UI escura */
.dice-history::-webkit-scrollbar { width: 7px; }
.dice-history::-webkit-scrollbar-track { background: transparent; }
.dice-history::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.dice-history::-webkit-scrollbar-thumb:hover { background: var(--accent); }
/* cada rolagem virou um "cartão" (fundo próprio + faixa colorida à esquerda na cor de
   mão de quem rolou) em vez de só texto separado por linha — pedido explícito: "achei
   muito simples... como podemos deixar isso melhor e mais bonito" */
.dice-entry {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  border-left: 3px solid var(--line); /* sobrescrita inline com a cor de mão, quando válida */
}
/* mesmo padrão de avatar já usado no painel de jogadores (.player-card-avatar-wrap) —
   placeholder com a inicial embaixo, <img> por cima que some sozinha via onerror */
.dice-entry-avatar-wrap {
  position: relative; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  overflow: hidden; background: rgba(0, 0, 0, 0.2); margin-top: 1px;
}
.dice-entry-avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dice-entry-avatar-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-dim);
}
.dice-entry-body { flex: 1; min-width: 0; }
.dice-entry-line { font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }
.dice-entry-name { font-weight: 600; color: var(--text); }
.dice-entry-total { font-weight: 700; font-size: 14px; color: var(--text); }
.dice-entry-detail { font-size: 11px; color: var(--text-dim); margin-top: 2px; overflow-wrap: anywhere; }
.dice-entry-hidden { font-style: italic; }
/* "natural 20"/"natural 1" num termo de d20 — clássico da mesa de RPG, barato de fazer
   e de bom retorno visual; #ffd60a é o MESMO dourado já usado na coroa do mestre
   (CROWN_SVG em app.js), reaproveitado aqui por consistência em vez de inventar um
   tom novo. Falha usa um vermelho dessaturado (derivado do --accent da marca, não uma
   cor importada de fora) */
.dice-entry-total.dice-crit { color: #ffd60a; }
.dice-entry-total.dice-fail { color: #a17272; }
.dice-crit-tag { font-size: 11px; color: #ffd60a; font-weight: 600; margin-left: 4px; }
.dice-fail-tag { font-size: 11px; color: #a17272; margin-left: 4px; }
/* total/tag ficam invisíveis enquanto os dados ainda estão girando, revelados com um
   pequeno "pop" assim que o último dado da rolagem para (ver revealDiceTotal em app.js) */
.dice-total-pending { opacity: 0; }
.dice-total-reveal { animation: dg-total-reveal 0.25s ease; }
@keyframes dg-total-reveal { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: scale(1); } }
/* ---------- Roleta de dados (pedido explícito, estilo Alchemy: "uma animação vai
   aparecer com os numeros girando como se fosse uma roleta até cair no número
   resultado") — cada dado individual da rolagem vira um círculo próprio que gira
   (número trocando rápido) e para no valor de verdade, em cascata (1º pra 2º pra 3º...
   como um caça-níquel) em vez de todos pararem juntos ---------- */
.dice-die-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; }
.dice-die-badge-wrap { position: relative; display: inline-flex; }
.dice-die-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel);
  border: 1.5px solid var(--accent);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
/* enquanto gira: contorno neutro (a cor de acento só "acende" quando o dado já parou,
   reforçando visualmente qual valor já é definitivo e qual ainda está sorteando) */
.dice-die-badge.spinning { border-color: var(--line); color: var(--text-dim); }
.dice-die-badge.settled { animation: dg-die-settle 0.22s ease; }
@keyframes dg-die-settle { from { transform: scale(1.3); } to { transform: scale(1); } }
/* rótulo "dN" no canto — só aparece quando a rolagem mistura faces diferentes
   (ex.: "1d4+1d6"), pra não confundir qual círculo é de qual dado */
.dice-die-badge-face {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 8px;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 2px;
  line-height: 1.3;
}
.dice-entry-modifier { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-left: 2px; }
/* badge de rolagens não vistas no chip da navbar (mesma pílula do botão de amigos) */
#btn-open-dice { position: relative; }

/* barra de rolagem temática da biblioteca (mesma linguagem do histórico de dados e do painel do mestre) */
.library-list::-webkit-scrollbar, .library-batch-col .merge-list::-webkit-scrollbar { width: 7px; }
.library-list::-webkit-scrollbar-track, .library-batch-col .merge-list::-webkit-scrollbar-track { background: transparent; }
.library-list::-webkit-scrollbar-thumb, .library-batch-col .merge-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.library-list::-webkit-scrollbar-thumb:hover, .library-batch-col .merge-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Modo stream (página /stream/<id> usada como fonte de navegador do OBS) ----------
   Só o canvas da mesa aparece: tudo o mais some, nada recebe clique e o cursor some. A
   câmera vem do mestre (ver app.js, 'Modo stream'). Os overlays de aviso (conexão perdida,
   carregando...) também ficam escondidos pra nunca aparecerem na live. */
body.stream-mode { background: #000; cursor: none; }
body.stream-mode > *:not(#canvas-wrap):not(#stream-error):not(#stream-standby):not(script) { display: none !important; }
body.stream-mode #canvas-wrap { pointer-events: none; }
.stream-standby {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d10;
}
.stream-standby[hidden] { display: none; }
.stream-standby img { width: min(260px, 40vmin); opacity: 0.9; }
.server-outdated {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, 92vw);
  padding: 8px 12px;
  border: 1px solid #4a331f;
  border-radius: 8px;
  background: var(--panel);
  color: var(--danger-dim);
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.server-outdated[hidden] { display: none; }
.server-outdated button {
  border: none;
  background: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
body.stream-mode .server-outdated { display: none !important; }
.stream-error {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 20px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.85);
}
.stream-error[hidden] { display: none; }
.stream-warn {
  margin: 8px 0;
  padding: 6px 8px;
  border: 1px solid #4a331f;
  border-radius: 6px;
  font-size: 12px;
  color: var(--danger-dim);
}
.stream-warn[hidden] { display: none; }

/* ---------- Mover a grade (analógico + setas, aba Grid) ---------- */
.grid-nudge-title { margin: 10px 0 6px; font-size: 12px; color: var(--text-dim); }
.grid-nudge-pad {
  display: grid;
  grid-template-columns: 22px 48px 22px;
  grid-template-rows: 22px 48px 22px;
  gap: 3px;
  justify-content: center;
  align-items: center;
  margin: 0 auto 6px;
}
.grid-arrow {
  position: relative;
  justify-self: center;
  align-self: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
}
.grid-arrow:hover { border-color: var(--accent); }
.grid-arrow:active { background: var(--accent); }
.grid-arrow::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  border: 5px solid transparent;
}
.grid-arrow-up { grid-column: 2; grid-row: 1; }
.grid-arrow-left { grid-column: 1; grid-row: 2; }
.grid-arrow-right { grid-column: 3; grid-row: 2; }
.grid-arrow-down { grid-column: 2; grid-row: 3; }
.grid-arrow-up::before { border-bottom-color: var(--text); border-top-width: 0; transform: translate(-50%, -60%); }
.grid-arrow-down::before { border-top-color: var(--text); border-bottom-width: 0; transform: translate(-50%, -40%); }
.grid-arrow-left::before { border-right-color: var(--text); border-left-width: 0; transform: translate(-60%, -50%); }
.grid-arrow-right::before { border-left-color: var(--text); border-right-width: 0; transform: translate(-40%, -50%); }
.grid-stick {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 50%, var(--panel) 0%, var(--panel-2) 100%);
  touch-action: none;
  cursor: grab;
}
.grid-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.grid-nudge-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--text-dim); }
.grid-nudge-footer .btn { width: auto; flex-shrink: 0; }
.grid-offset-field { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 12px; color: var(--text-dim); }
.grid-offset-field input[type="number"] { width: 54px; margin: 0; padding: 4px 6px; font-size: 12px; }

/* ---------- seções recolhíveis, favoritos e estrela (painel do mestre largo) ---------- */
.gm-tools:not(.gm-tools-narrow) .gm-section-title[data-collapsible] {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
}
.gm-tools:not(.gm-tools-narrow) .gm-section-title[data-collapsible]:hover { opacity: 0.9; }
.gm-section-title[data-collapsible]::before {
  content: ''; width: 5px; height: 5px; flex-shrink: 0;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.15s;
}
.gm-section-title[data-collapsible][aria-expanded="false"]::before { transform: rotate(-45deg); }
/* seção recolhida com algo ligado lá dentro: bolinha no título */
.gm-section-title[data-dot]::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px;
}
.gm-section-title[data-dot="ok"]::after { background: #4ade80; }
.gm-section-title[data-dot="warn"]::after { background: #f59e0b; }
.gm-tools-narrow .gm-section-title[data-collapsible]::before,
.gm-tools-narrow .gm-section-title[data-dot]::after { display: none; }
.gm-tools:not(.gm-tools-narrow) .gm-sec-hidden { display: none !important; }

.gm-favorites { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 6px; }
.gm-favorites[hidden], .gm-fav-title[hidden] { display: none; }
.gm-tools-narrow .gm-favorites, .gm-tools-narrow .gm-fav-title { display: none; }
.gm-fav-btn {
  position: relative; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text-dim); cursor: pointer;
}
.gm-fav-btn svg { width: 16px; height: 16px; }
.gm-fav-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.gm-fav-btn.active { color: var(--accent-text); border-color: var(--accent); }
.gm-fav-btn[data-dot]::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
.gm-fav-btn[data-dot="ok"]::after { background: #4ade80; }
.gm-fav-btn[data-dot="warn"]::after { background: #f59e0b; }

/* estrelinha de favorito: aparece no hover do item (e fica à mostra se já é favorito) */
.tg-star {
  /* item do flex do cabeçalho (entre o rótulo e o chevron/"Voltar"), não absoluto: assim nunca sobrepõe o botão Voltar do foco */
  flex-shrink: 0; margin-right: 4px;
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  opacity: 0; color: var(--text-dim); cursor: pointer; border-radius: 4px;
}
.tg-star svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.tool-group summary:hover .tg-star,
.tool-group-flat:hover .tg-star,
.tg-star.on { opacity: 1; }
.tg-star:hover { color: var(--accent-text); }
.tg-star.on { color: #ffd60a; }
.tg-star.on svg { fill: currentColor; }
.gm-tools-narrow .tg-star { display: none; }

/* ---------- painel de jogadores: cabeçalho e visão só de avatares ---------- */
.players-panel { transition: width 0.25s ease; }
.players-panel-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; padding: 2px 4px 2px 10px; border-radius: 8px; background: rgba(22, 22, 27, 0.82); }
.players-panel-title { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.players-panel.compact { width: 56px; }
.players-panel.compact .players-panel-title { display: none; }
.players-panel.compact .players-panel-head { justify-content: center; padding: 2px 0; }
.players-panel.compact .players-panel-list { align-items: center; padding: 6px 0 4px; overflow-x: visible; }
.players-panel.compact .player-card {
  width: 44px; height: 44px; padding: 0; border: none; background: none; box-shadow: none; border-radius: 50%; justify-content: center;
}
.players-panel.compact .player-card-text { display: none; }
.players-panel.compact .player-card-right { display: contents; }
.players-panel.compact .player-card .player-card-status { display: none; }
.players-panel.compact .player-card-avatar-wrap { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c), 0 2px 8px rgba(0, 0, 0, 0.6); }
.players-panel.compact .player-card.gm::after { content: ''; position: absolute; top: -3px; left: 50%; width: 16px; height: 13px; translate: -50% 0; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 16'%3E%3Cpath fill='%23ffd60a' d='M1 15h18l1.4-10.2-5.8 4.4L10 2 5.4 9.2-.4 4.8z'/%3E%3C/svg%3E"); }
.players-panel.compact .player-card-hand { position: absolute; left: -5px; top: -3px; padding: 2px; border-radius: 50%; background: var(--panel); }
.players-panel.compact .player-card:not(.hand) .player-card-hand { display: none; }
.players-panel.compact .player-card-hand svg { width: 14px; height: 14px; }
.players-panel.compact .player-card-hand b { font-size: 10px; }
.players-panel.compact .players-hands { margin: 0 0 4px; }
.players-panel.compact .players-panel-head { flex-direction: column; gap: 4px; }
.players-panel.compact .players-panel-footer { align-items: center; }

/* resumo do estado dentro de cada aba do painel do mestre */
.tab-state {
  font-size: 11px; line-height: 1.45; color: var(--text-dim);
  padding: 2px 0 8px; margin-bottom: 8px; border-bottom: 1px dashed var(--line);
}

/* aba em foco: o cabeçalho vira uma barra com o botão "Voltar" no lugar do chevron */
.gm-tools.gm-tools-focus-inner .tool-group[open] > summary,
.gm-tools.gm-tools-focus > .tool-group-focusable[open] > summary { color: var(--text); font-weight: 600; }
.gm-tools.gm-tools-focus-inner .tool-group[open] > summary::after,
.gm-tools.gm-tools-focus > .tool-group-focusable[open] > summary::after {
  content: '‹ Voltar';
  width: auto; height: auto; margin: 0;
  padding: 2px 9px;
  border: 1px solid var(--line); border-radius: 99px;
  font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--text-dim);
  transform: none; opacity: 1;
}
.gm-tools.gm-tools-focus-inner .tool-group[open] > summary:hover::after,
.gm-tools.gm-tools-focus > .tool-group-focusable[open] > summary:hover::after { border-color: var(--accent); color: var(--accent-text); }

/* favoritos: arrastar pra reordenar */
.gm-fav-btn.dragging { opacity: 0.4; }
.gm-fav-btn.drag-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- variações do mapa: lista na aba Mapa e seletor na navbar ---------- */
.map-variants { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.map-variants-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 8px; }
.map-variants-empty { font-size: 11px; line-height: 1.45; color: var(--text-dim); margin: 4px 0 8px; }
.map-variant-row {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.map-variant-row:hover { border-color: var(--text-dim); }
.map-variant-row.active { border-color: var(--accent); }
.map-variant-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--text-dim); flex-shrink: 0; }
.map-variant-row.active .map-variant-dot { background: var(--accent); border-color: var(--accent); }
.map-variant-row .floor-name-input { flex: 1; min-width: 0; margin-top: 0; }
.map-variant-remove {
  flex-shrink: 0; background: none; border: none; padding: 2px 4px; border-radius: 4px;
  color: var(--text-dim); font-size: 13px; line-height: 1; cursor: pointer;
}
.map-variant-remove:hover { color: var(--danger); }
.map-variant-remove.confirm { color: var(--danger); font-size: 11px; }
.variant-switcher { position: relative; }
#variant-switcher-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 220px; }

/* item da biblioteca que o mestre clicou pra substituir (modo salvar) */
.library-tile.library-tile-replace-target { border-color: var(--accent); background: var(--panel-2); }

/* ---------- Desenho livre no mapa ---------- */
.draw-float-body { position: fixed; left: 76px; top: 56px; z-index: 40; width: 320px; max-height: calc(100vh - 72px); overflow-y: auto; box-sizing: border-box; padding: 12px 14px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); }
/* título igual ao do flyout do painel do mestre */
.draw-float-body::before { content: "Lápis"; display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-text); }
.draw-float-body[hidden], #draw-controls-gm [hidden], #draw-controls-player [hidden] { display: none !important; }
.draw-float-body .btn { width: 100%; }
.draw-float-body .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.draw-float-body .fog-shape-toggle { margin-bottom: 0; }

/* ---------- Caixa de permissões ---------- */
.permissions-modal { width: min(460px, 94vw); max-height: 88vh; overflow-y: auto; }
.permissions-modal h2 { text-align: center; }
.permissions-modal .btn { margin-top: 10px; }
.modal.permissions-modal { position: relative; }
#access-mode-select[hidden] { display: none; }
.perm-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.perm-mode { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.perm-mode b { font-size: 13px; font-weight: 600; }
.perm-mode span { font-size: 12px; color: var(--text-dim); line-height: 1.3; }
.perm-mode:hover { border-color: #3a3a45; }
.perm-mode.on { border-color: var(--accent); background: rgba(200, 30, 30, 0.16); }
.perm-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.perm-foot span { flex: 1; }
.perm-foot .btn { width: auto; flex-shrink: 0; margin: 0; }
.perm-title { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); margin: 4px 0 8px; }
.perm-table { display: flex; flex-direction: column; border: 1px solid var(--border, #2a2a33); border-radius: 10px; overflow: hidden; }
.perm-row { display: grid; grid-template-columns: 1fr repeat(var(--perm-cols, 1), 84px); align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--border, #2a2a33); }
.perm-row:first-child { border-top: 0; }
.perm-head { font-size: 11px; color: var(--text-dim); background: rgba(255, 255, 255, 0.03); }
.perm-all { background: rgba(255, 255, 255, 0.04); font-weight: 600; }
.perm-who { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-who i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.perm-cell { display: flex; justify-content: center; }

/* ---------- Barra lateral do jogador ---------- */
/* usa as classes do painel do mestre (.gm-tools, .gm-tools-narrow, .tool-group-flat, .tg-ico...), então
   o visual vem de lá; aqui só o que é diferente */
.player-bar[hidden], .player-bar .tool-group-flat[hidden] { display: none !important; }
.player-bar .tool-group-flat::after { content: none; }
.player-bar .gm-tools-head + .tool-group-flat { border-top: none; }
/* lápis sem permissão: escurecido, sem hover e sem clique (mesma ideia do desfazer/refazer apagado) */
.player-bar .tool-group-flat.is-disabled { opacity: 0.3; cursor: not-allowed; }
.player-bar .tool-group-flat.is-disabled:hover { color: var(--text-dim); }
.player-bar .gm-tools-compact-btn.flip svg { transform: rotate(180deg); }
/* o painel do lápis abre ao lado da barra (compacta: 56px; expandida: 220px) */
body.player-bar-expanded .draw-float-body { left: 240px; }
.draw-shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.draw-shapes .btn { display: flex; align-items: center; justify-content: center; margin-bottom: 0; }
/* seletor de cor do desenho */
.draw-picker { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 6px; }
.draw-sv { position: relative; height: 120px; border-radius: 8px; cursor: crosshair; touch-action: none; border: 1px solid var(--line); }
.draw-sv-handle { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); pointer-events: none; }
.draw-hue { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; margin: 2px 0; border-radius: 6px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); outline: none; }
.draw-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, 0.55); cursor: pointer; }
.draw-hue::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, 0.55); cursor: pointer; }
.draw-hex-row { display: flex; align-items: center; gap: 8px; }
.draw-hex { flex: 1; min-width: 0; margin: 0; padding: 6px 8px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; text-align: center; letter-spacing: 0.04em; }
.draw-hex.invalid { border-color: var(--danger, #f97316); }
.draw-preview { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; border: 2px solid rgba(255, 255, 255, 0.35); box-sizing: border-box; }
.draw-mine-btn { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 0; }
.draw-mine-btn i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }

/* ---------- Biblioteca: visões, ordenação, tamanho, favoritos, seleção e redimensionar ---------- */
.library-modal { position: relative; }
.library-controls { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; flex-wrap: wrap; }
.library-chips { display: flex; gap: 4px; }
.library-chips button { padding: 4px 9px; font-size: 12px; font-family: var(--font); background: transparent; color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.library-chips button:hover { color: var(--text); border-color: var(--text-dim); }
.library-chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.library-sizes { margin-left: auto; }
.library-sizes button { padding: 4px 8px; min-width: 26px; }
.library-sort { width: auto; margin: 0; padding: 4px 6px; font-size: 12px; }
.library-sort:disabled { opacity: 0.45; }
#library-list[data-size="s"] { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
#library-list[data-size="l"] { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
#library-list[data-size="s"] .library-tile-name { font-size: 11px; }
.library-tile-star { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: var(--panel); color: var(--text-dim); font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; z-index: 1; }
.library-tile:hover .library-tile-star, .library-tile-star.on { opacity: 1; }
.library-tile-star.on { color: #ffd60a; }
.library-tile-star:hover { color: #ffd60a; }
.library-tile-selected { border-color: var(--accent); background: rgba(200, 30, 30, 0.16); }
.library-tile-selected:hover { background: rgba(200, 30, 30, 0.22); }
.library-selection-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 8px; background: rgba(200, 30, 30, 0.1); }
.library-selection-bar[hidden] { display: none; }
.library-selection-count { font-size: 12px; font-weight: 600; margin-right: auto; }
.library-selection-bar .btn { width: auto; margin: 0; flex-shrink: 0; }
.library-selection-bar select { width: auto; margin: 0; padding: 4px 6px; font-size: 12px; max-width: 150px; }
.library-selection-clear { width: 24px; height: 24px; padding: 0; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text-dim); font-size: 16px; line-height: 1; cursor: pointer; }
.library-selection-clear:hover { color: var(--text); border-color: var(--line); }
/* painel com tamanho escolhido: a grade ocupa o que sobra, em vez do teto de 55vh */
.library-modal.library-sized { display: flex; flex-direction: column; max-width: calc(100vw - 16px); }
.library-modal.library-sized .library-body { flex: 1; min-height: 0; align-items: stretch; }
.library-modal.library-sized .library-browse-col { display: flex; flex-direction: column; min-height: 0; }
.library-modal.library-sized .library-list { flex: 1; min-height: 0; max-height: none; }
/* com altura própria a grade é mais alta que as linhas: sem isso o grid ESTICA as linhas pra preencher e cada item vira uma coluna enorme */
.library-list { align-content: start; grid-auto-rows: max-content; }

/* ordem manual: marca de onde o item cai e o aviso de excluir pasta com conteúdo */
.library-tile.drop-before { box-shadow: inset 4px 0 0 var(--accent); background: var(--panel-2); }
.library-tile.drop-after { box-shadow: inset -4px 0 0 var(--accent); background: var(--panel-2); }
.library-folder-delete { margin: 0 0 8px; padding: 10px 12px; border: 1px solid #f97316; border-radius: 8px; background: rgba(249, 115, 22, 0.08); }
.library-folder-delete[hidden] { display: none; }
.library-folder-delete p { margin: 0 0 8px; }
.lfd-target-row { display: block; font-size: 12px; margin-bottom: 8px; }
.lfd-target-row select { margin-top: 4px; }
.library-folder-delete .merge-actions { flex-wrap: wrap; }
.library-folder-delete .merge-actions .btn { flex: 1 1 auto; }
/* selos nos itens, menu de contexto do item e soltar imagens */
.library-thumb-wrap { position: relative; width: 100%; }
.library-tile-badges { position: absolute; left: 4px; right: 4px; bottom: 4px; display: flex; flex-wrap: wrap; gap: 3px; pointer-events: auto; }
.library-tile-badges span { padding: 1px 5px; font-size: 9px; font-weight: 600; line-height: 14px; letter-spacing: 0.02em; color: #fff; background: rgba(0, 0, 0, 0.72); border-radius: 4px; }
#library-list[data-size="s"] .library-tile-badges { display: none; }
.library-item-menu { width: 210px; }
.library-item-menu .btn { width: 100%; white-space: normal; }
.library-drop-hint { position: absolute; inset: 8px; z-index: 5; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; border: 2px dashed var(--accent); border-radius: 12px; background: rgba(13, 13, 16, 0.88); color: var(--text); font-size: 14px; font-weight: 600; pointer-events: none; }
.library-drop-hint[hidden] { display: none; }
.library-toolbar #btn-library-add-images { margin-left: auto; }
/* o X de excluir fica acima da miniatura com selos (o wrapper relativo passou por cima dele) */
.library-tile-delete { z-index: 2; }
/* ---------- Biblioteca: acabamento visual ---------- */
/* barra de cima: botões só de ícone */
.library-toolbar { gap: 6px; }
.library-icon-btn { width: 30px; height: 30px; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--text-dim); cursor: pointer; }
.library-icon-btn svg { width: 16px; height: 16px; }
.library-icon-btn:hover { color: var(--text); border-color: var(--text-dim); background: var(--panel-2); }
.library-icon-btn[hidden] { display: none; }
.library-toolbar #btn-library-add-images { margin-left: 0; }
/* nome do item como texto (o campo só aparece ao renomear pelo lápis) */
.library-tile-namebox { position: relative; width: 100%; }
.library-tile-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 2px 4px; font-size: 12px; line-height: 1.3; text-align: center; word-break: break-word; color: var(--text); }
.library-tile-label[hidden], .library-tile-name[hidden], .library-tile-rename[hidden] { display: none; }
.library-tile-name:focus { border-color: var(--accent); background: var(--bg); }
.library-tile-rename { position: absolute; right: 0; top: 0; width: 20px; height: 20px; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: var(--panel-2); color: var(--text-dim); cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.library-tile-rename svg { width: 12px; height: 12px; }
.library-tile:hover .library-tile-rename { opacity: 1; }
.library-tile-rename:hover { color: var(--text); }
#library-list[data-size="s"] .library-tile-label { font-size: 11px; }
/* alças de redimensionar nos 4 cantos e 4 bordas (a do canto de baixo à direita mostra o desenho) */
.library-rz { position: absolute; z-index: 6; touch-action: none; }
.library-rz-n, .library-rz-s { left: 14px; right: 14px; height: 8px; }
.library-rz-e, .library-rz-w { top: 14px; bottom: 14px; width: 8px; }
.library-rz-n { top: -4px; cursor: ns-resize; }
.library-rz-s { bottom: -4px; cursor: ns-resize; }
.library-rz-e { right: -4px; cursor: ew-resize; }
.library-rz-w { left: -4px; cursor: ew-resize; }
.library-rz-ne, .library-rz-nw, .library-rz-se, .library-rz-sw { width: 18px; height: 18px; }
.library-rz-ne { top: -4px; right: -4px; cursor: nesw-resize; }
.library-rz-sw { bottom: -4px; left: -4px; cursor: nesw-resize; }
.library-rz-nw { top: -4px; left: -4px; cursor: nwse-resize; }
.library-rz-se { bottom: -4px; right: -4px; cursor: nwse-resize; }
.library-rz-se::after { content: ''; position: absolute; right: 6px; bottom: 6px; width: 14px; height: 14px; opacity: 0.85; background: linear-gradient(135deg, transparent 0 46%, var(--text-dim) 46% 54%, transparent 54% 64%, var(--text-dim) 64% 72%, transparent 72% 82%, var(--text-dim) 82% 90%, transparent 90%); pointer-events: none; }
.library-rz-se:hover::after { opacity: 1; }
/* alça de arrastar no título + rolagem nas cores do app */
.panel-drag { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: move; user-select: none; }
.panel-drag h2 { margin: 0; flex: 0 1 auto; }
.panel-grip { display: flex; flex-shrink: 0; color: var(--text-dim); opacity: 0.55; }
.panel-grip svg { width: 14px; height: 14px; }
.panel-drag:hover .panel-grip { opacity: 1; color: var(--text); }
.library-list::-webkit-scrollbar, .library-batch-col .merge-list::-webkit-scrollbar { width: 7px; }
.library-list::-webkit-scrollbar-track, .library-batch-col .merge-list::-webkit-scrollbar-track { background: transparent; }
.library-list::-webkit-scrollbar-thumb, .library-batch-col .merge-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.library-list::-webkit-scrollbar-thumb:hover, .library-batch-col .merge-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Texto no mapa e pins ---------- */
/* Lápis, Texto e Borracha: três botões na linha (a grade padrão do fog-shape-toggle tem duas colunas) */
.draw-modes { grid-template-columns: repeat(3, 1fr); }
.draw-text-opts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.draw-text-opts[hidden] { display: none; }
.draw-text-opts select { margin: 0; padding: 6px 8px; font-size: 13px; }
.draw-text-opts label { margin-bottom: 6px; }
/* caixa de digitação do texto: por cima do mapa, no ponto do clique, com a fonte e a cor do texto final */
.text-editor {
  position: fixed; z-index: 90; margin: 0; padding: 2px 4px;
  background: rgba(13, 13, 16, 0.5); border: 1px dashed rgba(255, 255, 255, 0.55); border-radius: 4px;
  outline: none; resize: none; overflow: hidden; white-space: pre; font-weight: 400;
}
/* caixas do pin (ver e editar) */
.modal.pin-modal { width: min(520px, 94vw); position: relative; max-height: 92vh; overflow-y: auto; }
.pin-modal h2 { margin: 0 0 12px; padding-right: 28px; }
.pin-top { display: flex; gap: 16px; margin-bottom: 12px; }
.pin-top-fields { flex: 1; min-width: 0; }
.pin-prev { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; width: 132px; min-height: 150px; border: 1px solid var(--line); border-radius: 10px; background: #0d0d10; overflow: hidden; }
.pin-prev svg { width: 84px; height: 104px; }
.pin-prev span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; max-width: 122px; margin: 2px 4px 8px; font: 700 13px/1.25 Cinzel, serif; color: #fff; text-align: center; overflow: hidden; overflow-wrap: anywhere; }
.pin-prev.dim svg, .pin-prev.dim span { opacity: 0.5; }
.pin-sec { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.pin-space { flex: 1; }
.pin-view-image { display: block; max-width: 100%; max-height: 52vh; margin: 0 auto 14px; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; background: var(--bg); }
.pin-view-image[hidden] { display: none; }
.pin-view-desc { margin: 0 0 16px; white-space: pre-wrap; line-height: 1.5; color: var(--text); font-size: 14px; }
.pin-view-desc[hidden] { display: none; }
.pin-modal textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--font); font-size: 14px; resize: vertical;
}
.pin-modal textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pin-image-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pin-image-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.pin-image-row img[hidden], .pin-image-row .btn[hidden] { display: none; }
.pin-image-row .btn { width: auto; flex-shrink: 0; margin-bottom: 0; }
.pin-field-title { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.pin-colors { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.pin-colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; cursor: pointer; }
.pin-colors button.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.pin-modal select { margin-bottom: 4px; }
.pin-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pin-actions .btn { width: auto; flex-shrink: 0; margin-bottom: 0; }
.pin-actions .btn[hidden] { display: none; }
/* lista de pins na aba do mestre */
.pins-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pins-row {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.pins-row:hover { border-color: var(--accent); }
.pins-row i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pins-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pin-edit-showimg-row[hidden] { display: none; }

/* ---------- Dia e noite ---------- */
.dc-readout { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.dc-readout b { font-size: 22px; font-weight: 600; letter-spacing: 0.5px; }
/* a hora do relógio é um campo: parece o mostrador de antes e ganha borda ao passar o mouse ou digitar */
.lw-body input.dc-time-input { width: 82px; margin: 0; padding: 2px 6px; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--text); font: 600 22px var(--font); letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.lw-body input.dc-time-input:hover { border-color: var(--line); }
.lw-body input.dc-time-input:focus { border-color: var(--accent); background: var(--panel); outline: none; }
/* campo numérico ao lado de um controle deslizante (attachNumField) */
.num-field { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.num-field input[type="number"] { width: 58px; margin: 0; padding: 5px 6px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.num-field input[type="number"]::-webkit-outer-spin-button, .num-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-field-unit { min-width: 16px; color: var(--text-dim); font-size: 12px; }
/* janela de Iluminação: aviso com botão (liga o relógio ou o andar dali mesmo), título de quadro com "Restaurar padrão", opção subordinada, lista de luzes */
.lw-notice { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--danger); border-radius: 10px; background: rgba(249, 115, 22, 0.08); color: var(--text); font-size: 13px; }
.lw-notice[hidden] { display: none; }
.lw-notice span { flex: 1; }
.lw-notice .btn { width: auto; flex-shrink: 0; margin-bottom: 0; }
.lw-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lw-reset { background: none; border: none; padding: 0; margin: 0; color: var(--text-dim); font: 500 11px var(--font); letter-spacing: 0; text-transform: none; cursor: pointer; }
.lw-reset:hover { color: var(--text); text-decoration: underline; }
.lw-reset.undo { color: var(--accent2); }
.lw-card label[hidden] { display: none; }
.lw-card label.lw-sub-opt { margin-left: 26px; }
.lw-row.lw-sub-opt .lw-lab { flex-basis: 164px; }
#lw-light-empty[hidden] { display: none; }
.lw-light-row .lw-light-name { flex-shrink: 0; font-weight: 600; }
.lw-light-row .lw-light-info { flex: 1; min-width: 0; color: var(--text-dim); font-size: 12px; }
.lw-light-row.off i { opacity: 0.35; }
.lw-light-row .btn { width: auto; flex-shrink: 0; margin: 0; padding: 3px 9px; font-size: 11px; }
/* menu da luz: dois blocos (Luz, Comportamento) com as linhas alinhadas como na janela */
.context-menu.lcm { width: 300px; padding: 12px 14px; }
.lcm-title { font-size: 11px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--accent-text); margin: 2px 0 10px; }
.lcm-title:not(:first-child) { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.lcm .lcm-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; color: var(--text-dim); }
.lcm .lcm-row > span:first-child { flex: 0 0 92px; }
.lcm .lcm-row input[type="range"] { flex: 1; min-width: 0; }
.lcm .lcm-row input[type="color"] { margin: 0; }
.lcm .lcm-row[hidden] { display: none; }
.lcm .lcm-temp { display: flex; gap: 4px; margin-left: auto; }
.lcm .lcm-temp .btn { width: auto; flex-shrink: 0; padding: 3px 8px; font-size: 11px; margin-bottom: 0; }
.lcm .lcm-temp .btn.active { border-color: var(--accent); color: var(--text); }
.lcm .dw-switch { margin-bottom: 11px; }
.lcm .dw-switch[hidden] { display: none; }
.lcm .tq-item { margin: 0 -8px; width: calc(100% + 16px); }
.dc-readout span { color: var(--text-dim); font-size: 12px; }
#daycycle-group input[type="range"] { width: 100%; }
.dc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.dc-chips button { width: auto; flex-shrink: 0; padding: 4px 8px; font-size: 11px; margin-bottom: 0; }
.dc-chips button.active { border-color: var(--accent2); }
.dc-sep { height: 1px; background: var(--line); margin: 10px 0; }
.dc-speed { margin-top: 10px; }
.dc-speed-title { color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.dc-speed-row { display: flex; gap: 6px; }
.dc-speed-row input[type="number"] { flex: 1; min-width: 0; margin-top: 0; }
.dc-speed-row select { width: auto; margin-top: 0; }
.dc-draw-row { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#dc-clock-box[hidden], #dc-floor-box[hidden] { display: none; }
.pins-row.dc-row-del { justify-content: space-between; }
.lw-card label.dc-show-rooms { margin: 2px 0 10px; }
.lw-pane .btn.dc-fill-btn { width: 100%; margin: 4px 0 10px; border-color: var(--accent); }
.lw-pane .btn.dc-fill-btn.active { background: var(--accent); color: #fff; }
.lw-card .hint.dc-or { margin: 0 0 6px; }
.dc-row-actions .num-field input[type="number"] { width: 62px; }
.dc-row-actions .num-field-unit { white-space: nowrap; }
.pins-row .dc-x { margin-left: auto; color: var(--text-dim); padding: 0 4px; }
.pins-row .dc-x:hover { color: var(--danger); }
.dc-title { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-dim); margin: 2px 0 8px; }
#dc-sun-point-box[hidden] { display: none; }
#dc-clouds-box[hidden] { display: none; }
.dc-angle-val { min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
#light-context-menu select { flex: 1; width: auto; margin-top: 0; padding: 6px 8px; font-size: 13px; }
#lcm-flicker-strength-row[hidden] { display: none; }
#dc-draw-stop[hidden] { display: none; }
#dc-target-note[hidden] { display: none; }
.dc-row-actions { display: flex; align-items: center; gap: 6px; }
.wx-room-row .wx-room-range { width: 200px; }
.wx-room-row .wx-room-val { width: 38px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.btn.small-btn.dc-addpart { width: auto; flex-shrink: 0; margin: 0; padding: 3px 9px; font-size: 11px; }
.btn.small-btn.dc-addpart.active { border-color: var(--accent2); color: var(--text); }
.dc-part-row { margin-left: 18px; opacity: 0.85; font-size: 12px; }
/* peixes da água (aba Água): uma linha por imagem de peixe */
#fish-card[hidden] { display: none; }
.pins-row.water-sel { border-color: var(--accent); background: var(--panel); }
.fish-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.fish-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.fish-row img { width: 26px; height: 40px; object-fit: contain; flex-shrink: 0; }
.fish-row .fish-fields { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.fish-row .fish-line { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.fish-row .fish-line span { width: 58px; flex-shrink: 0; }
.fish-row input[type="number"] { width: 56px; }
.fish-row input[type="range"] { flex: 1; min-width: 60px; }
.fish-row .fish-size-val { width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.fish-row input[type="color"] { width: 30px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; flex-shrink: 0; }
.fish-row input[type="color"].fish-color-off { opacity: 0.3; }
.fish-row .fish-nocolor { background: none; border: none; color: var(--text-dim); font: inherit; font-size: 11px; cursor: pointer; padding: 0 2px; }
.fish-row .fish-nocolor:hover { color: var(--text); }
.fish-row .fish-nocolor[hidden] { display: none; }
.fish-row .dc-x { align-self: flex-start; background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-dim); }
.fish-row .dc-x:hover { color: var(--danger); }
/* ---- janelas Iluminação e Ambiente: abrem grandes ao lado do painel (em qualquer modo, compacto ou não), com abas. position:fixed escapa do overflow do
   painel do mestre; a posição padrão vem do JS (placeLightWindow) por --lw-left/--lw-top, e dá pra arrastar pelo cabeçalho ---- */
:is(#light-group, #ambient-group)[open] > .tool-group-body.lw-body { /* com id pra vencer o flyout do modo compacto */
  position: fixed;
  left: var(--lw-left, 80px);
  top: var(--lw-top, 70px);
  width: min(640px, calc(100vw - 24px));
  height: auto; /* a altura da aba, até o limite da tela: sobra espaço embaixo pra faixa de dica da ferramenta */
  max-height: min(760px, calc(100vh - var(--lw-top, 70px) - 60px));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 30;
}
:is(#light-group, #ambient-group) > .tool-group-body.lw-body::before { display: none !important; }
:is(#light-group, #ambient-group) > .tool-group-body.lw-body > :is(.fly-pin, .tab-state) { display: none !important; }
.lw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); cursor: grab; user-select: none; flex-shrink: 0; }
.lw-head.dragging { cursor: grabbing; }
.lw-head-text { min-width: 0; }
.lw-title { font-size: 16px; font-weight: 600; color: var(--text); }
.lw-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lw-close { flex-shrink: 0; width: 32px; height: 32px; padding: 0; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text-dim); font-size: 22px; line-height: 1; cursor: pointer; }
.lw-close:hover { color: var(--text); border-color: var(--line); }
.lw-tabs { display: flex; gap: 2px; padding: 6px 14px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.lw-tab { margin: 0; padding: 9px 14px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); font: 600 13px var(--font); cursor: pointer; }
.lw-tab:hover { color: var(--text); }
.lw-tab.active { color: var(--text); border-bottom-color: var(--accent); }
/* vento e "mesmo clima": valem pras três abas do Ambiente, então ficam acima delas */
.lw-strip { display: flex; align-items: center; gap: 22px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.lw-strip .lw-strip-wind { flex: 1; min-width: 0; margin: 0; }
.lw-strip .lw-strip-wind .lw-lab { flex: none; }
.lw-strip .dw-check { flex-shrink: 0; margin: 0; }
.lw-panes { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 20px 20px; }
.lw-pane { display: none; }
.lw-pane.active { display: block; }
.lw-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 6px; margin-bottom: 14px; }
.lw-card[hidden] { display: none; }
.lw-card-title { font-size: 11px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px; }
.lw-card label.inline { margin-bottom: 12px; }
.lw-card .hint { margin: 0 0 12px; }
.lw-row .lw-lab { flex: 0 0 190px; }
.lw-row input[type="range"] { flex: 1; }
.lw-row input[type="number"] { flex: none; width: 90px; margin-top: 0; }
.lw-row input[type="color"] { margin-left: 0; }
.lw-btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.lw-btn-row .btn { margin-bottom: 0; }
.lw-pane .dc-draw-row { flex-direction: row; margin-bottom: 12px; }
#tree-sel-row[hidden], #tree-clear[hidden] { display: none; } /* [hidden] perde pra display de autor */
#tree-count { margin: 4px 0 10px; }
.lw-pane .dc-draw-row .btn { width: auto; flex: 1; margin-bottom: 0; }
.lw-pane .btn.small-btn { margin-bottom: 8px; }
.lw-pane #dc-hour { width: 100%; }
/* relógio: a barra tem as cores do dia e cada período fica embaixo da hora dele (--at = hora / 24; o polegar anda 18 px menos que a barra) */
.clock-range { --sky: linear-gradient(to right, #1a2142 0%, #1a2142 20%, #7b5a78 25%, #e8a071 28.5%, #cfd6dc 34%, #a9d2f2 42%, #b6dcf8 50%, #a9d2f2 62%, #e9c79a 70%, #e58a52 75.5%, #8c5477 80%, #3a335f 84%, #1a2142 90%, #1a2142 100%); -webkit-appearance: none; appearance: none; display: block; height: 22px; margin: 4px 0 0; padding: 0; background: transparent; cursor: pointer; touch-action: none; }
.clock-range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: var(--sky); }
.clock-range::-moz-range-track { height: 12px; border-radius: 6px; background: var(--sky); }
.clock-range::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: 18px; height: 18px; margin-top: -3px; border-radius: 50%; background: #ececf1; border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.clock-range::-moz-range-thumb { box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; background: #ececf1; border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.clock-marks { position: relative; height: 46px; margin: 0 0 12px; }
.clock-mark { position: absolute; top: 0; left: calc(9px + var(--at) * (100% - 18px)); transform: translateX(-50%); padding: 9px 2px 2px; border: 0; background: none; color: var(--text-dim); font: 12px/14px var(--font); white-space: nowrap; cursor: pointer; }
.clock-mark:nth-child(even) { padding-top: 28px; }
.clock-mark::before { content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 6px; background: #4a4a56; }
.clock-mark:nth-child(even)::before { height: 25px; }
.clock-mark:hover { color: var(--text); }
.clock-mark.active { color: var(--accent-text); font-weight: 600; }
.clock-mark.active::before { background: var(--accent-text); }
.lw-pane #dc-interiors-clear { margin-bottom: 8px; }


/* Diagnóstico (Configurações do jogo): copiar o relatório de travamento */
.settings-diag { border-top: 1px solid #2a2a33; margin-top: 12px; padding-top: 12px; }
.settings-diag-title { font-weight: 600; margin-bottom: 4px; }
.settings-diag-hint { color: #9a9aa6; font-size: 12px; margin: 0 0 8px; }
.settings-diag-row { display: flex; align-items: center; gap: 10px; }
.settings-diag-row .btn { width: auto; flex-shrink: 0; }
.settings-diag-count { color: #9a9aa6; font-size: 12px; }

/* PAINEL DO LÁPIS (desenho e área), nos dois lugares: aba do mestre e painel do jogador */
.gm-tools-narrow #draw-group[open] > .tool-group-body { width: 320px; }
.dw { display: flex; flex-direction: column; gap: 16px; }
.draw-float-body.dw { gap: 16px; padding: 14px 16px 12px; }
.dw svg { width: 18px; height: 18px; flex-shrink: 0; }
.dw-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: #0d0d10; border: 1px solid var(--line); border-radius: 10px; }
.dw-seg button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; margin: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.12s, color 0.12s; }
.dw-seg button:hover { color: var(--text); }
.dw-seg button.active { background: var(--accent); color: #fff; }
.dw-sec { display: flex; flex-direction: column; gap: 8px; }
.dw-sec[hidden] { display: none; }
.dw-label { display: flex; align-items: center; justify-content: space-between; min-height: 22px; font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-dim); }
.dw-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.dw-tools-4 { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
.dw-tools-2 { grid-template-columns: repeat(2, 1fr); }
.dw-tools-3 { grid-template-columns: repeat(3, 1fr); }
.dw-tools[hidden] { display: none; }
.dw-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 58px; margin: 0; padding: 4px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.dw-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-tile svg { width: 20px; height: 20px; color: var(--text-dim); }
.dw-tile:hover { background: #25252d; border-color: #3a3a45; }
.dw-tile.active { background: rgba(200, 30, 30, 0.16); border-color: var(--accent); }
.dw-tile.active svg { color: var(--accent-text); }
.dw-wide-btn { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: 36px; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.dw-wide-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-wide-btn svg { color: var(--text-dim); }
.dw-wide-btn:hover { background: #25252d; border-color: #3a3a45; }
.dw-wide-btn.active { background: rgba(200, 30, 30, 0.16); border-color: var(--accent); }
.dw-wide-btn.dw-danger { color: #f97316; }
.dw-wide-btn.dw-danger svg { color: #f97316; }
.dw-wide-btn.dw-danger:hover { border-color: #f97316; background: rgba(249, 115, 22, 0.1); }
.dw-wide-btn.dw-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dw-wide-btn.dw-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.dw-wide-btn[hidden] { display: none; }
.dw-check { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; color: var(--text); font-size: 13px; cursor: pointer; }
.dw-check[hidden] { display: none; }
.dw-check input { margin: 0; accent-color: var(--accent); }
.dw-row { display: flex; align-items: center; gap: 10px; }
.dw-row-lab { flex-shrink: 0; width: 64px; font-size: 13px; color: var(--text-dim); }
.dw-row select, .dw-row input[type="number"] { flex: 1; min-width: 0; margin: 0; padding: 7px 8px; font-size: 13px; }
.dw-row input[type="number"] { flex: 0 0 64px; }
.dw-val { flex-shrink: 0; min-width: 42px; text-align: right; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.dw-range { flex: 1; min-width: 0; }
.dw-range:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; border-radius: 4px; }
.dw-width { display: flex; align-items: center; gap: 10px; }
.dw-width-prev { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 28px; border-radius: 7px; background: #0d0d10; border: 1px solid var(--line); }
.dw-width-prev i { display: block; width: 22px; border-radius: 9px; }
.dw-mine { display: flex; align-items: center; gap: 6px; height: 22px; margin: 0; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; cursor: pointer; }
.dw-mine:hover { border-color: #3a3a45; }
.dw-mine[hidden] { display: none; }
.dw-mine i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
.dw-swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.dw-swatch { width: 100%; aspect-ratio: 1; margin: 0; padding: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.14); cursor: pointer; transition: transform 0.1s; }
.dw-swatch:hover { transform: scale(1.12); }
.dw-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.dw .draw-picker { margin: 0; }
.dw-actions { display: flex; gap: 6px; }
.dw-actions[hidden] { display: none; }
.dw-actions > * { flex: 1; }
.dw-hint { margin: -6px 0 0; line-height: 1.4; }
.dw-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #1a1a20; }
.dw-card[hidden] { display: none; }
.dw-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dw-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.dw-card-title svg { color: var(--text-dim); }
.dw-badge { padding: 2px 9px; border-radius: 999px; background: #2a2a33; color: var(--text-dim); font-size: 11px; font-weight: 600; }
.dw-badge.on { background: rgba(200, 30, 30, 0.18); color: #ff8a8a; }
.dw-card-info { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-dim); }
.dw-measure-form { display: flex; flex-direction: column; gap: 8px; }
.dw-measure-form[hidden] { display: none; }
.dw-measure-form .dw-row-lab { width: auto; }

/* AS OUTRAS ABAS do painel do mestre com a mesma cara do painel do lápis (2026-11-13, pedido do usuário). O flyout fica mais largo */
.gm-tools-narrow .tool-group[open] > .tool-group-body.dw { width: 300px; }
.gm-tools-narrow #draw-group[open] > .tool-group-body.dw { width: 320px; }
.tool-group-body.dw { gap: 14px; }
.dw > * { flex-shrink: 0; } /* com rolagem o flex encolhia os botões em vez de rolar */
.dw .tab-state { margin-bottom: -4px; }
.dw .hint { margin: 0; line-height: 1.45; }
.dw-big { height: 42px; font-weight: 600; }
label.dw-wide-btn { margin: 0; }
.dw-wide-btn.dw-new { border-style: dashed; color: var(--text-dim); }
.dw-wide-btn.dw-new:hover { color: var(--text); border-color: var(--accent); }
.dw-onoff.active { background: rgba(34, 197, 94, 0.14); border-color: #22c55e; color: #86efac; }
/* interruptor (no lugar da caixinha de marcar): o input continua lá, invisível, com o mesmo id e o mesmo evento change */
.dw-switch { position: relative; display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text); font-size: 13px; line-height: 1.3; cursor: pointer; }
.dw-switch[hidden] { display: none; }
.dw-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dw-switch i { position: relative; flex-shrink: 0; width: 32px; height: 18px; border-radius: 99px; background: #33333d; transition: background 0.15s; }
.dw-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #ececf1; transition: transform 0.15s; }
.dw-switch input:checked + i { background: var(--accent); }
.dw-switch input:checked + i::after { transform: translateX(14px); }
.dw-switch input:focus-visible + i { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.dw-switch:hover i { background: #3e3e49; }
.dw-switch:hover input:checked + i { background: var(--accent-hover); }
.dw-row[hidden] { display: none; }
.dw-row input[type=number] { flex: 1 1 auto; }
.dw-unit { flex-shrink: 0; font-size: 12px; color: var(--text-dim); }
.dw input[type=text] { margin: 0; font-size: 12px; }
/* lista de efeitos: ícone, nome e a tecla do atalho */
.dw-list { display: flex; flex-direction: column; gap: 6px; }
.dw-list-btn { justify-content: flex-start; height: 40px; }
.dw-kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: #121216; font: inherit; font-size: 11px; color: var(--text-dim); }
.dw-list-btn.active .dw-kbd { border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.dw-tile-big { height: 76px; font-size: 13px; }
.dw-tile-big svg { width: 24px; height: 24px; }
.dw .map-variants { margin: 0; padding: 0; border: 0; }
.dw .map-variants-list { margin: 0; }
.dw .grid-nudge-footer .dw-wide-btn { height: 30px; flex: 0 0 auto; }
.dw-seg button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw .grid-offset-field input[type="number"] { width: 74px; }
/* listas de camadas, cenas e andares: linhas mais limpas (o input[type=text] geral vencia o .floor-name-input e deixava o nome enorme) */
.dw .layers-list { gap: 8px; margin-top: 0; }
.dw .layer-row { gap: 4px; padding: 5px 6px 5px 4px; border-radius: 9px; }
.dw .layer-row:hover { border-color: #3a3a45; }
.dw .layer-row.current-scene { border-color: var(--accent); background: rgba(200, 30, 30, 0.08); }
.dw .layer-row input.floor-name-input { height: 30px; margin: 0; padding: 4px 8px; font-size: 13px; font-weight: 500; background: transparent; border: 1px solid transparent; border-radius: 6px; }
.dw .layer-row input.floor-name-input:hover, .dw .layer-row input.floor-name-input:focus { border-color: var(--line); background: #0d0d10; }
.dw .eye-toggle, .dw .layer-remove { width: 28px; height: 28px; border-radius: 7px; }
.dw .eye-toggle svg { width: 100%; height: 100%; }
.dw .floor-stack-toggle { border-radius: 7px; padding: 5px 8px; font-size: 11px; }
/* pin que leva a outra cena: a linha de liberar pros jogadores some (label.inline venceria o [hidden]) */
#pin-edit-travel-row[hidden], #pin-edit-floor-row[hidden], #pin-edit-scene-hint[hidden] { display: none; }
#pin-edit-scene-hint { margin: -4px 0 12px; }

/* copas de árvore (aba Árvores da janela de Iluminação) */
.crown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; max-height: 236px; overflow-y: auto; margin: 4px 0 10px; padding-right: 4px; }
.crown-grid[hidden] { display: none; }
.crown-cell { position: relative; aspect-ratio: 1; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; color: var(--text-dim); font: inherit; font-size: 11px; line-height: 1.15; }
.crown-cell:hover { border-color: var(--text-dim); }
.crown-cell.on { border-color: var(--accent2); background: rgba(200, 30, 30, 0.14); }
.crown-cell img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.crown-cell .crown-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 17px; text-align: center; border-radius: 5px; background: rgba(13, 13, 16, 0.85); color: var(--text-dim); font-size: 13px; opacity: 0; }
.crown-cell:hover .crown-x { opacity: 1; }
.crown-cell .crown-x:hover { color: var(--danger); }
.crown-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.crown-actions[hidden] { display: none; }
.crown-actions .btn.small-btn { width: auto; flex: 0 0 auto; margin: 0; }
.crown-actions .btn.small-btn[hidden], .lw-card label.inline[hidden] { display: none; }

/* ---------- botão direito no token: menu curto e painel (2026-11-25) ---------- */
.token-quick { position: fixed; z-index: 60; width: 236px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); max-height: calc(100vh - 16px); overflow-y: auto; }
.token-quick[hidden] { display: none; }
.tq-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; }
.tq-thumb { width: 38px; height: 38px; flex-shrink: 0; border-radius: 9px; background: var(--panel-2); overflow: hidden; display: block; }
.tq-thumb img, .tp-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tq-thumb img[hidden], .tp-thumb img[hidden] { display: none; }
.tq-head-text { min-width: 0; }
.tq-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-sub:empty { display: none; }
.tq-icons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tq-tog { height: 38px; padding: 0; display: flex; align-items: center; justify-content: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; color: var(--text-dim); cursor: pointer; }
.tq-tog svg, .tq-item svg, .tq-level svg { width: 18px; height: 18px; flex-shrink: 0; }
.tq-tog:hover { color: var(--text); border-color: #3a3a44; }
.tq-tog.on { background: rgba(200, 30, 30, 0.18); border-color: var(--accent); color: var(--accent-text); }
.tq-tog.some { border-color: var(--accent); border-style: dashed; color: var(--accent-text); }
.tq-sep { height: 1px; background: var(--line); margin: 8px 2px; }
.tq-item, .tq-level { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; margin: 0; background: none; border: none; border-radius: 8px; color: var(--text); font: 500 13px var(--font); text-align: left; }
.tq-item { cursor: pointer; }
.tq-item svg, .tq-level svg { color: var(--text-dim); }
.tq-item span, .tq-level span { flex: 1; min-width: 0; }
.tq-item kbd { font: 500 11px var(--font); color: var(--text-dim); background: none; border: none; padding: 0; box-shadow: none; }
.tq-item:hover, .tq-item:focus-visible { background: var(--panel-2); outline: none; }
.tq-item.tq-main { font-weight: 600; }
/* opção marcada (tipo da parede, som do gramofone): fundo no tom do acento e um tique no fim; tracejado = só em parte da seleção */
.tq-item.on { background: rgba(200, 30, 30, 0.16); }
.tq-item.on > svg:first-child, .tq-item.some > svg:first-child { color: var(--accent-text); }
.tq-item.some { outline: 1px dashed var(--accent); outline-offset: -1px; }
.tq-item .tq-check { width: 16px; height: 16px; color: var(--accent-text); }
.tq-item:disabled { opacity: 0.45; cursor: default; background: none; }
.tq-icon { display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.tq-icon svg { width: 20px; height: 20px; }
.token-quick .dw-switch { padding: 7px 8px; border-radius: 8px; font-weight: 500; }
.token-quick .dw-switch:hover { background: var(--panel-2); }
.token-quick .dw-switch span { flex: 1; min-width: 0; }
.tq-field { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 6px 8px; font-size: 12px; color: var(--text-dim); }
.tq-field input { margin: 0; }
.tq-field input[type="range"] { width: 100%; }
.tq-field .tq-field-row { display: flex; align-items: center; gap: 8px; }
.tq-field .tq-field-row input[type="number"] { width: 70px; flex-shrink: 0; padding: 7px 8px; }
.tq-field .tq-field-row .btn { width: auto; flex: 1; margin: 0; }
.tq-note { padding: 2px 8px 6px; font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.tq-dot { width: 9px; height: 9px; flex-shrink: 0; border-radius: 50%; }
.dw-tile .tq-dot { position: absolute; top: 6px; right: 6px; }
#wall-kinds .dw-tile { position: relative; }
#wall-kind-hint:empty { display: none; }
.tq-item.tq-danger, .tq-item.tq-danger svg { color: var(--danger-dim); }
.tq-step { width: 26px; height: 26px; padding: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font: 600 15px/1 var(--font); cursor: pointer; }
.tq-step:hover { border-color: #3a3a44; }
.tq-level b { min-width: 26px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.tq-states, .tp-states { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 2px; }
.tq-state { position: relative; width: 46px; height: 46px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tq-state:hover { border-color: #3a3a44; }
.tq-state.on { border-color: var(--accent); background: rgba(200, 30, 30, 0.18); }
.tq-state img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.tq-state i { position: absolute; right: 3px; bottom: 1px; font: 600 10px var(--font); color: var(--text); text-shadow: 0 0 3px #000, 0 0 3px #000; }
.token-panel { position: fixed; z-index: 28; width: 372px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); }
.token-panel[hidden] { display: none; }
.tp-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 10px 14px; cursor: grab; user-select: none; flex-shrink: 0; }
.tp-head.dragging { cursor: grabbing; }
.tp-thumb { width: 48px; height: 48px; flex-shrink: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); overflow: hidden; cursor: pointer; }
.tp-thumb:hover { border-color: var(--accent); }
.tp-thumb:disabled { cursor: default; border-color: var(--line); }
.tp-head-text { flex: 1; min-width: 0; }
.token-panel .tp-head input#tm-name { width: 100%; margin: 0; padding: 4px 8px; background: transparent; border: 1px solid transparent; border-radius: 7px; font: 600 15px var(--font); color: var(--text); }
.token-panel .tp-head input#tm-name[hidden] { display: none; }
.token-panel .tp-head input#tm-name:hover { border-color: var(--line); }
.token-panel .tp-head input#tm-name:focus { border-color: var(--accent); background: var(--panel-2); outline: none; }
.tp-group-title { font-size: 15px; font-weight: 600; padding: 4px 8px; }
.tp-group-title[hidden] { display: none; }
.tp-sub { font-size: 12px; color: var(--text-dim); padding: 1px 9px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tabs .lw-tab { position: relative; padding: 8px 10px; }
.tp-tabs .lw-tab[hidden] { display: none; }
.tp-tabs .lw-tab.has-dot::after { content: ''; position: absolute; top: 6px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-hover); }
.tp-panes { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 8px; }
.tp-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
label.inline.tp-row[hidden] { display: none; }
.tp-row .lw-lab { flex: 0 0 104px; color: var(--text-dim); font-size: 13px; }
.tp-row select { flex: 1; width: auto; margin: 0; padding: 7px 9px; font-size: 13px; }
.tp-row .num-field input { width: 62px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-chips button { padding: 4px 11px; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--text-dim); font: 500 12px var(--font); cursor: pointer; }
.tp-chips button:hover { color: var(--text); border-color: #3a3a44; }
.tp-chips button.on { background: rgba(200, 30, 30, 0.18); border-color: var(--accent); color: var(--accent-text); }
.tp-chips button.some { border-style: dashed; border-color: var(--accent); color: var(--accent-text); }
.tp-seg { display: flex; flex: 1; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.tp-seg button { flex: 1; padding: 6px 0; background: none; border: none; border-left: 1px solid var(--line); color: var(--text-dim); font: 600 12px var(--font); cursor: pointer; }
.tp-seg button:first-child { border-left: none; }
.tp-seg button:hover { color: var(--text); background: var(--panel-2); }
.tp-seg button.on { background: rgba(200, 30, 30, 0.22); color: var(--accent-text); }
.tp-sep { height: 1px; background: var(--line); margin: 4px 0 12px; }
.tp-label { font-size: 12px; color: var(--text-dim); margin: 10px 0 8px; }
.token-panel .dw-switch { margin: 0 0 11px; }
.token-panel .dw-switch input:indeterminate + i { background: rgba(200, 30, 30, 0.45); }
.token-panel .dw-switch input:indeterminate + i::after { transform: translateX(7px); }
.token-panel .hint { margin: 0 0 12px; }
.token-panel .hint[hidden], .tp-sub-box[hidden], #tp-states-box[hidden], #tm-hl-box[hidden] { display: none; }
.tp-btns { display: flex; gap: 8px; margin: 8px 0 12px; }
.tp-btns .btn, .tp-foot .btn { width: auto; flex: 0 0 auto; margin: 0; }
.tp-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line); flex-shrink: 0; }
.tp-foot .btn[hidden] { display: none; }
.tp-foot #tm-delete { margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  .token-quick:not([hidden]), .token-panel:not([hidden]) { animation: uiFadeIn 0.12s ease-out; }
}

/* ---------- ANIMAÇÕES DA INTERFACE (2026-11-17) ----------
   Só opacity e as propriedades separadas translate/scale (somam com o transform que painel e aviso já usam pra se posicionar e
   recolher, sem brigar com ele): o navegador só move e esmaece camadas já desenhadas, sem refazer layout, e nada roda por quadro em
   JavaScript. Nada de desfocar o fundo (backdrop-filter) por cima do mapa. Quem pediu ao sistema pra reduzir animações não vê nenhuma */
@keyframes uiFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiModalIn { from { opacity: 0; scale: 0.96; translate: 0 8px; } to { opacity: 1; scale: 1; translate: 0 0; } }
@keyframes uiItemIn { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes uiToastIn { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }
@keyframes uiToastOut { from { opacity: 1; } to { opacity: 0; translate: 0 8px; } }
@keyframes uiFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes uiModalOut { from { opacity: 1; scale: 1; } to { opacity: 0; scale: 1.03; } }
@keyframes uiEnterTop { from { opacity: 0; translate: 0 -100%; } to { opacity: 1; translate: 0 0; } }
@keyframes uiEnterLeft { from { opacity: 0; translate: -28px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes uiEnterRight { from { opacity: 0; translate: 28px 0; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: no-preference) {
  /* troca de andar: escurece em 0,1 s e clareia em 0,25 s */
  #floor-veil { transition: opacity 0.25s ease-out; }
  #floor-veil.on { transition-duration: 0.1s; }
  /* janelas: o fundo escurece e a janela aparece crescendo um pouco (a de "todas as mesas" da tela inicial tem animação própria) */
  .modal-backdrop:not([hidden]):not(#load-modal) { animation: uiFadeIn 0.18s ease-out; }
  .modal-backdrop:not([hidden]):not(#load-modal) > .modal { animation: uiModalIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
  /* menu do Esc: os itens em escadinha rápida */
  #game-menu-modal:not([hidden]) #game-menu-home-view > * { animation: uiItemIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) var(--gm-d, 0ms) backwards; }
  #game-menu-home-view > :nth-child(1) { --gm-d: 30ms; }
  #game-menu-home-view > :nth-child(2) { --gm-d: 60ms; }
  #game-menu-home-view > :nth-child(3) { --gm-d: 90ms; }
  #game-menu-home-view > :nth-child(4) { --gm-d: 120ms; }
  #game-menu-home-view > :nth-child(5) { --gm-d: 150ms; }
  #game-menu-home-view > :nth-child(6) { --gm-d: 180ms; }
  #game-menu-home-view > :nth-child(7) { --gm-d: 210ms; }
  #game-menu-home-view > :nth-child(8) { --gm-d: 240ms; }
  #game-menu-home-view > :nth-child(9) { --gm-d: 270ms; }
  /* aviso: entra deslizando, sai esmaecendo */
  .toast:not([hidden]) { animation: uiToastIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .toast.toast-out { animation: uiToastOut 0.2s ease-in forwards; }
  /* entrar na mesa: a janela de entrada esmaece e os painéis deslizam pro lugar (revealRoom em app.js) */
  .join-leaving { animation: uiFadeOut 0.4s ease forwards; pointer-events: none; }
  .join-leaving > .modal { animation: uiModalOut 0.4s ease forwards; }
  body.room-entering .topbar { animation: uiEnterTop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s backwards; }
  body.room-entering #gm-tools, body.room-entering #player-bar { animation: uiEnterLeft 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.18s backwards; }
  body.room-entering #players-panel { animation: uiEnterRight 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.24s backwards; }
  body.room-entering .corner-toggles { animation: uiItemIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.32s backwards; }
}

/* ---------- ACABAMENTO (auditoria de 2026-11-18) ----------
   Foco do teclado: anel na cor do app em todo controle (o :where não pesa na especificidade, então a regra própria de um
   controle continua valendo). Seleção de texto e cursor de digitação também na cor do app, no lugar do azul do navegador */
:where(button, a[href], summary, [role="button"], [tabindex]:not([tabindex="-1"]):not(canvas)):focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
::selection { background: rgba(200, 30, 30, 0.45); color: #fff; }
input, textarea, [contenteditable] { caret-color: var(--accent-text); }
/* ícones desenhados no lugar dos caracteres × ‹ + ? */
.ui-ico { width: 16px; height: 16px; flex-shrink: 0; display: block; }
.ui-ico-lg { width: 22px; height: 22px; }
.lw-close, #server-outdated-close { display: inline-flex; align-items: center; justify-content: center; }

/* CONTROLE DESLIZANTE (2026-11-25): desenhado com as cores da mesa em todas as telas. O padrão do navegador muda de um pro outro (no do usuário saía
   uma barra branca grossa). O trilho é a borda-imagem do polegar, esticada pros dois lados e cortada pelo overflow: assim a parte percorrida fica
   vermelha sem JavaScript. O seletor de matiz (.draw-hue) e o relógio (.clock-range) têm o próprio desenho */
input[type="range"]:where(:not(.draw-hue, .clock-range)) { -webkit-appearance: none; appearance: none; height: 20px; margin: 0; padding: 0; border: none; background: transparent; overflow: hidden; cursor: pointer; }
input[type="range"]:where(:not(.draw-hue, .clock-range))::-webkit-slider-runnable-track { height: 20px; background: transparent; }
input[type="range"]:where(:not(.draw-hue, .clock-range))::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: #ececf1; box-shadow: inset 0 0 0 3px var(--accent); border-image: linear-gradient(90deg, var(--accent) 50%, #3a3a45 0) 0 1 / calc(50% - 2px) 100vw / 0 calc(100vw + 2px); }
input[type="range"]:where(:not(.draw-hue, .clock-range))::-moz-range-track { height: 20px; background: transparent; }
input[type="range"]:where(:not(.draw-hue, .clock-range))::-moz-range-thumb { box-sizing: border-box; width: 16px; height: 16px; border: none; border-radius: 50%; background: #ececf1; box-shadow: inset 0 0 0 3px var(--accent); border-image: linear-gradient(90deg, var(--accent) 50%, #3a3a45 0) 0 1 / calc(50% - 2px) 100vw / 0 calc(100vw + 2px); }
input[type="range"]:disabled { opacity: 0.4; cursor: default; }
input[type="range"]:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; border-radius: 8px; }

/* CAIXA DE MARCAR (2026-11-25): vira a chave vermelha das abas em todas as telas, só com CSS. Ficam como caixa as de ESCOLHER ITENS de uma lista
   (quem vai no elevador, arquivos do Armazenamento), que não ligam nada */
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input)) { -webkit-appearance: none; appearance: none; position: relative; flex-shrink: 0; width: 32px; height: 18px; margin: 0; border: none; border-radius: 99px; background: #33333d; cursor: pointer; transition: background 0.15s; }
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input))::before { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #ececf1; transition: transform 0.15s; }
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input)):checked { background: var(--accent); }
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input)):checked::before { transform: translateX(14px); }
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input)):disabled { opacity: 0.4; cursor: default; }
input[type="checkbox"]:where(:not(.dw-switch input, .storage-row-check, .elev-who input)):focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.elev-who input { accent-color: var(--accent); }

/* × no canto das janelas (posto pelo app.js em quem tem data-x) */
.modal-backdrop[data-x] > .modal { position: relative; }
.modal-backdrop[data-x] > .modal h2 { padding-right: 30px; }
.modal-close-x svg { width: 16px; height: 16px; }

/* Cortina: uma linha por jogador · Teleporte: zonas e elevadores do andar */
.cur-list { display: flex; flex-direction: column; gap: 4px; }
.cur-list:empty { display: none; }
.cur-row.dw-switch { gap: 10px; padding: 5px 8px; border-radius: 8px; }
.cur-row.dw-switch:hover { background: var(--panel-2); }
.cur-row span.cur-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cur-face { position: relative; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: #2a2a33; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.cur-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cur-row i { order: 3; }
#tp-hint:empty { display: none; }
.tp-row .tp-name { flex-shrink: 0; font-weight: 600; }
.tp-row .tp-info { flex: 1; min-width: 0; color: var(--text-dim); font-size: 12px; }
.tp-row.warn .tp-info { color: #f97316; }
.tp-row .ly-act { opacity: 1; }

/* PROTEÇÃO DAS IMAGENS (guard.js): no Chrome e no Safari a imagem não sai arrastada (dentro de algo que o app arrasta, o arraste é do app), e no
   celular segurar o dedo na imagem não abre o menu de salvar */
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
canvas { -webkit-touch-callout: none; }

/* ---------- ANIMAÇÕES DE AVISO E DE ACABAMENTO (2026-11-25) ---------- */
/* 1 e 2: o selo nos avisos de conexão perdida e de mestre caído: o cinza por baixo e o vermelho por cima, cortado no nível do líquido */
.wait-modal { text-align: center; }
.wait-seal { position: relative; width: 92px; height: 92px; margin: 0 auto 14px; }
.wait-seal img { position: absolute; inset: 0; width: 100%; height: 100%; }
.wait-seal .ws-grey { filter: grayscale(1) brightness(0.72); }
.wait-seal .ws-red { clip-path: inset(0 0 0 0); }
#gm-away-overlay .ws-red { clip-path: inset(100% 0 0 0); } /* o mestre está fora: o selo fica cinza */
.ws-back .ws-red { transition: clip-path 0.55s cubic-bezier(0.3, 0.9, 0.3, 1); }
#friends-copy-code .copied-check, .lm-menu-item .copied-check { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; color: #4ade80; }
.gm-mi-ico.copied { color: #4ade80; }
.fm-pending .fm-row { position: relative; isolation: isolate; }
.fm-row.fm-new .fm-name, .fm-row.fm-new .fm-sub { color: #fff; }
.hc-thumb.hc-painting .liquid-fill { inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: 3; }
#auth-panels input.field-flash { border-color: #f97316; }
@media (prefers-reduced-motion: no-preference) {
  .ws-drain .ws-red { animation: ws-drain 9s cubic-bezier(0.2, 0.6, 0.4, 1) forwards; }
  @keyframes ws-drain { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(86% 0 0 0); } }
  .ws-grey-pulse .ws-grey { animation: ws-pulse 2.4s ease-in-out infinite; }
  @keyframes ws-pulse { 50% { scale: 1.04; filter: grayscale(1) brightness(0.9); } }
  /* 3: um pedido novo chegou: a bolinha do botão de amigos dá uma batida */
  .friend-badge.beat { animation: badge-beat 0.55s cubic-bezier(0.3, 1.6, 0.5, 1); }
  @keyframes badge-beat { 40% { scale: 1.5; } }
  /* 4: trocar a lista de amigos pela busca: desliza pro lado */
  .fm-view.fm-in-r { animation: fm-in-r 0.22s ease-out; }
  .fm-view.fm-in-l { animation: fm-in-l 0.22s ease-out; }
  @keyframes fm-in-r { from { translate: 26px 0; opacity: 0; } }
  @keyframes fm-in-l { from { translate: -26px 0; opacity: 0; } }
  /* 6: senha ou usuário errado: a caixa balança e o campo pisca */
  .auth-box.shake { animation: auth-shake 0.4s ease-out; }
  @keyframes auth-shake { 20% { translate: -8px 0; } 40% { translate: 7px 0; } 60% { translate: -4px 0; } 80% { translate: 2px 0; } }
  #auth-panels input.field-flash { animation: field-flash 1s ease-out; }
  @keyframes field-flash { 0%, 30% { border-color: #f97316; box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25); } }
  /* 7: copiado: o ✓ aparece com um pulinho */
  .copied-check, .gm-mi-ico.copied svg { animation: check-pop 0.32s cubic-bezier(0.3, 1.7, 0.5, 1); }
  @keyframes check-pop { from { scale: 0.3; opacity: 0; } }
  /* 8: alguém entrou numa mesa: a foto dele entra na pílula com um pulinho */
  .hc-face.hc-face-new { animation: face-in 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) backwards; }
  @keyframes face-in { from { scale: 0.2; opacity: 0; } }
  /* 9: abrir um perfil: a capa desce, a foto carimba no lugar e o resto sobe */
  .profile-modal .profile-banner { animation: pf-cap 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
  @keyframes pf-cap { from { translate: 0 -16px; opacity: 0; } }
  .profile-modal .profile-avatar-wrap { animation: pf-stamp 0.42s 0.12s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; }
  @keyframes pf-stamp { from { scale: 1.4; opacity: 0; } }
  .profile-modal :is(.profile-id, .profile-stats) { animation: pf-up 0.32s 0.2s ease-out backwards; }
  @keyframes pf-up { from { translate: 0 8px; opacity: 0; } }
  /* o rodapé é o último da janela, que rola: se ele deslizasse, passaria da borda e a barra de rolagem apareceria durante a animação */
  .profile-modal .profile-actions { animation: uiFadeIn 0.32s 0.2s ease-out backwards; }
}

/* PÉS E CABEÇA (2026-11-25): a linha no painel do token e a janela de marcar */
.tp-rig { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.tp-rig[hidden] { display: none; }
.tp-rig-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tp-rig-text .tp-label { margin: 0; }
.tp-rig-state { font-size: 12px; color: var(--text-dim); }
.tp-rig .btn.small-btn { width: auto; flex-shrink: 0; margin: 0; }
.modal.rig-modal { width: min(500px, 94vw); }
.rig-step { margin: -6px 0 10px; font-size: 14px; color: var(--text); font-weight: 500; }
.rig-stage { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.rig-stage canvas { display: block; width: 100%; aspect-ratio: 1; cursor: crosshair; touch-action: none; }
.rig-hint { margin: 10px 0 14px; }
.rig-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rig-actions .btn { width: auto; margin: 0; flex-shrink: 0; }
.rig-actions .rig-gap { flex: 1; }
.rig-actions .rig-danger { color: var(--danger); }
.rig-actions .btn[hidden] { display: none; }
.rig-actions .btn:disabled { opacity: 0.45; cursor: default; }

/* COR DA PINTURA (2026-11-26): as amostras no painel do token */
.tp-paint { align-items: flex-start; }
.tp-paint[hidden] { display: none; }
.tp-paint-swatches { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.tp-paint-sw { position: relative; width: 22px; height: 22px; margin: 0; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); cursor: pointer; flex-shrink: 0; }
.tp-paint-sw.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.tp-paint-sw.original { background: conic-gradient(#e70904 0 50%, #2a2c30 0); }
.tp-paint-sw.custom { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); overflow: hidden; }
.tp-paint-sw.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.rig-stage { position: relative; }
.rig-stage canvas.panning { cursor: grabbing; }
.rig-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.rig-zoom button { width: 30px; height: 30px; margin: 0; padding: 0; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(13, 13, 16, 0.72); color: var(--text); font: inherit; font-size: 17px; font-weight: 600; line-height: 1; cursor: pointer; }
.rig-zoom button:hover { background: rgba(13, 13, 16, 0.92); }
.rig-zoom button svg { width: 15px; height: 15px; }

/* ---------- QUADRO DE DOCUMENTOS (2026-11-26, public/js/doc-board.js; esboço em docs/prototipos/quadro-documentos.html) ---------- */
.db-tabs { display: flex; gap: 2px; padding: 3px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.db-tab { display: flex; align-items: center; gap: 7px; width: auto; margin: 0; padding: 6px 13px; border: 0; border-radius: 7px; background: none; color: var(--text-dim); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; }
.db-tab svg { width: 14px; height: 14px; }
.db-tab:hover { color: var(--text); }
.db-tab.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.db-count { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.doc-tips b { color: #b9b9c3; font-weight: 600; }
.db-style-btn { display: inline-flex; align-items: center; gap: 8px; }
.db-style-btn[hidden] { display: none; }
.db-style-sw { --s: 0.3; width: 16px; height: 16px; flex: none; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
@media (max-width: 1180px) { .doc-tips { visibility: hidden; } }

.document-board-canvas-wrap { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.documents-board-modal:not([data-tool="hand"]) .document-board-canvas-wrap { cursor: crosshair; }
/* fundos: a textura anda e cresce com o quadro (--s, --bx, --by vêm da câmera) */
.db-surface { position: absolute; inset: 0; background-position: var(--bx, 0) var(--by, 0); }
.tex-felt { background-color: #18151a; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .55 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url%28%23n%29'/%3E%3C/svg%3E"); background-size: calc(220px * var(--s, 1)); }
.tex-wood { background-color: #6a4a30; background-image: var(--wood, none); background-size: calc(1024px * var(--s, 1)); }
.tex-cork { background-color: #2b2119; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .62 0 0 0 0 .45 0 0 0 0 .28 0 0 0 .5 -.05'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url%28%23n%29'/%3E%3C/svg%3E"); background-size: calc(260px * var(--s, 1)); }
.tex-leather { background-color: #2a1b15; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .7 0 0 0 0 .55 0 0 0 0 .45 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url%28%23n%29'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .05 0 0 0 0 .03 0 0 0 0 .02 1.6 0 0 0 -.6'/%3E%3C/filter%3E%3Crect width='600' height='600' filter='url%28%23n%29'/%3E%3C/svg%3E"); background-size: calc(160px * var(--s, 1)), calc(600px * var(--s, 1)); }
.tex-metal { background-color: #1a1c1f; background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.16) 0 2px, rgba(0, 0, 0, 0.5) 2.5px 3.5px, transparent 4px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='200'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0015 .9' numOctaves='2' seed='13' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .62 0 0 0 0 .65 0 0 0 0 .7 .42 0 0 0 -.1'/%3E%3C/filter%3E%3Crect width='600' height='200' filter='url%28%23n%29'/%3E%3C/svg%3E"); background-size: calc(200px * var(--s, 1)) calc(200px * var(--s, 1)), calc(600px * var(--s, 1)) calc(200px * var(--s, 1)); }
.db-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.db-vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.5) 100%); }

.db-doc { position: absolute; transform-origin: 50% 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 18px rgba(0, 0, 0, 0.42); }
.db-doc.dragging { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 32px rgba(0, 0, 0, 0.55); }
.db-doc.hover { outline: 1px solid rgba(255, 255, 255, 0.3); outline-offset: 2px; }
.db-doc.is-hidden .db-img, .db-doc.is-hidden .db-paper-back, .db-doc.is-hidden .db-ink { opacity: 0.42; }
.db-art { position: absolute; inset: 0; }
.db-img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.db-paper-back { position: absolute; inset: 0; background: linear-gradient(#ddd6c6, #cfc6b3); }
.db-ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.db-ink path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.db-ink .pen { opacity: 0.95; }
.db-ink .hl { opacity: 0.5; mix-blend-mode: multiply; }
.db-badge { position: absolute; top: -9px; left: 6px; display: flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: #c9c9d2; font: 600 9px var(--font); white-space: nowrap; }
.db-badge svg { width: 10px; height: 10px; }
.db-note { position: absolute; inset: 0; overflow: hidden; padding: 14px 10px 16px; font: 700 15px/1.12 Caveat, cursive; white-space: pre-wrap; overflow-wrap: anywhere; }
.db-note::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 11px; background: rgba(0, 0, 0, 0.05); }
.db-note-by { position: absolute; right: 7px; bottom: 4px; font: 600 8px var(--font); opacity: 0.55; }
.db-doc.is-editing .db-note-text { visibility: hidden; }
.db-note-edit { position: absolute; left: 7px; right: 7px; top: 12px; bottom: 14px; z-index: 2; width: auto; height: auto; margin: 0; padding: 2px 3px; border: 0; border-radius: 3px; outline: 1px dashed rgba(0, 0, 0, 0.3); background: rgba(255, 255, 255, 0.3); font: 700 15px/1.12 Caveat, cursive; resize: none; caret-color: currentColor; }

/* barbante: sombra, fiapos, o fio e a torção, na cor do cordão que o mestre escolheu */
.db-strings { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.db-strings.below { z-index: 0; }
.db-strings.above { z-index: 100000; }
.db-strings path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.db-strings .sh { stroke: rgba(0, 0, 0, 0.42); stroke-width: 2.3; }
.db-strings .bs { stroke-width: 1.8; }
.db-strings .tw { stroke-width: 0.85; stroke-dasharray: 1 2.1; stroke-linecap: butt; }
.db-strings .fz { stroke-width: 2.8; stroke-dasharray: 0.35 4.4; }
[data-cord="red"] .bs { stroke: #8c1215; }
[data-cord="red"] .tw { stroke: #d8403c; }
[data-cord="red"] .fz { stroke: rgba(255, 190, 180, 0.22); }
[data-cord="twine"] .bs { stroke: #a2865a; stroke-width: 2.2; }
[data-cord="twine"] .tw { stroke: #e3cc98; stroke-dasharray: 1.4 1.9; }
[data-cord="twine"] .fz { stroke: rgba(255, 240, 205, 0.4); stroke-width: 3.4; stroke-dasharray: 0.4 3; }
[data-cord="black"] .bs { stroke: #161618; }
[data-cord="black"] .tw { stroke: #4b4b52; }
[data-cord="black"] .fz { stroke: rgba(255, 255, 255, 0.08); }
[data-cord="white"] .bs { stroke: #d8d4cb; stroke-width: 2; }
[data-cord="white"] .tw { stroke: #ffffff; }
[data-cord="white"] .fz { stroke: rgba(255, 255, 255, 0.35); stroke-width: 3.2; }
[data-cord="white"] .sh { stroke: rgba(0, 0, 0, 0.55); }
.db-strings .hit { stroke: transparent; stroke-width: 10; }
.documents-board-modal[data-tool="eraser"] .db-strings .hit { pointer-events: stroke; cursor: pointer; }
.db-strings .preview { stroke: #d8403c; stroke-width: 1.4; stroke-dasharray: 4 4; opacity: 0.85; }
.db-pins { position: absolute; left: 0; top: 0; z-index: 100001; }
.db-pin { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 34%), var(--c); box-shadow: 1px 3px 3px rgba(0, 0, 0, 0.5); pointer-events: none; }
.documents-board-modal[data-tool="string"] .db-pin, .documents-board-modal[data-tool="eraser"] .db-pin { pointer-events: auto; cursor: pointer; }
.db-pin.armed { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 1px 3px 3px rgba(0, 0, 0, 0.5); }
.db-ping { position: absolute; width: 0; height: 0; z-index: 100002; pointer-events: none; }
.db-ping i { position: absolute; left: -28px; top: -28px; width: 56px; height: 56px; border: 2px solid var(--c); border-radius: 50%; opacity: 0; }
.db-ping b { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
@keyframes db-ring { from { scale: 0.15; opacity: 1; } to { scale: 1; opacity: 0; } }
@keyframes db-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.db-ping i { animation: db-ring 1.3s ease-out forwards; }
.db-ping i:nth-child(2) { animation-delay: 0.2s; }
.db-ping b { animation: db-fade 1.6s forwards; }
.db-ping span { position: absolute; left: 10px; top: -24px; padding: 1px 6px; border-radius: 5px; background: var(--c); color: #fff; font: 700 9px var(--font); white-space: nowrap; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); animation: db-fade 1.6s forwards; }

/* ferramentas, à esquerda, como a barra do jogador */
.db-tools { position: absolute; left: 12px; top: 14px; z-index: 5; width: 52px; padding: 6px; display: flex; flex-direction: column; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: default; }
.db-tool { position: relative; width: 40px; height: 38px; margin: 0; padding: 0; border: 0; border-radius: 8px; background: none; color: #b9b9c3; display: grid; place-items: center; cursor: pointer; }
.db-tool svg { width: 19px; height: 19px; }
.db-tool:hover { background: var(--panel-2); color: var(--text); }
.db-tool.on { background: rgba(200, 30, 30, 0.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(200, 30, 30, 0.55); }
.db-tool.is-locked { opacity: 0.35; cursor: not-allowed; }
.db-tip { position: absolute; left: 50px; top: 50%; translate: 0 -50%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.db-tool:hover .db-tip { opacity: 1; }
.db-sep { height: 1px; margin: 4px 2px; background: var(--line); }
.db-mycolor { width: 40px; height: 32px; display: grid; place-items: center; }
.db-mycolor i { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px rgba(255, 255, 255, 0.18); }
.db-pick { position: absolute; left: 74px; z-index: 6; display: flex; align-items: center; gap: 7px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); color: var(--text-dim); font-size: 12px; cursor: default; }
.db-pick[hidden] { display: none; }
.db-pick span { margin-right: 3px; }
.db-pick button, .db-menu-colors button { width: 20px; height: 20px; margin: 0; padding: 0; flex: none; border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); cursor: pointer; }
.db-pick button.on, .db-menu-colors button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #ececf1; }
.db-menu-colors { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 8px 8px; }
.db-private { position: absolute; left: 80px; top: 14px; z-index: 4; display: none; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(22, 22, 27, 0.9); color: #c9c9d2; font-size: 12px; pointer-events: none; }
.db-private svg { width: 13px; height: 13px; color: var(--text-dim); }
.documents-board-modal.on-mine .db-private { display: flex; }
.doc-reader { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(6, 6, 8, 0.86); cursor: default; }
.doc-reader[hidden] { display: none; }
.doc-reader .panel-close-x { position: absolute; top: 12px; right: 14px; }
.doc-reader-stage { position: relative; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }

/* copiar pra minha mesa e personalizar o quadro */
.db-copy-modal { width: min(400px, 92vw); }
.db-copy-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 4px; padding: 11px 12px; border-radius: 10px; background: var(--panel-2); color: var(--text); cursor: pointer; }
.db-copy-opt[hidden] { display: none; }
.db-copy-opt small { display: block; margin-top: 2px; color: var(--text-dim); font-size: 12px; }
.db-style-modal { width: min(600px, 94vw); }
.db-style-h { margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.db-style-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.db-style-grid.four { grid-template-columns: repeat(4, 1fr); }
.db-style-tile { width: auto; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; }
.db-style-tile:hover { border-color: #3a3a45; }
.db-style-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.db-style-pv { --s: 0.45; position: relative; display: block; height: 58px; }
.db-style-pv svg.db-strings { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-style-name { display: block; padding: 6px 8px 7px; font-size: 12px; font-weight: 600; }
.db-style-name small { display: block; color: var(--text-dim); font-size: 11px; font-weight: 400; }
@media (max-width: 640px) { .db-style-grid { grid-template-columns: repeat(3, 1fr); } .db-style-grid.four { grid-template-columns: repeat(2, 1fr); } }
