/* ==========================================================================
   Tema "central de despacho" — inspirado no visual do jogo Dispatch
   (AdHoc Studio): traço de animação com contorno de tinta, cel-shading com
   sombra dura, cores chapadas e fortes, mapa da cidade em wireframe ao fundo.

   Carregado depois de styles.css e fora de @layer: vence as camadas de
   styles.css sem precisar de especificidade extra. Para voltar ao visual
   anterior basta remover o <link> deste arquivo em index.html.
   ========================================================================== */

/* --- Fontes (auto-hospedadas, subconjunto latino) ------------------------ */
@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url('/assets/fonts/orbitron-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/rajdhani-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/rajdhani-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/rajdhani-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens ---------------------------------------------------------------
   Turno da noite (escuro, padrão) e turno do dia (claro).                   */
:root {
  --ink: #06101f;              /* contorno e sombra dura */
  --navy: #0e1a2b;             /* fundo: o mapa do despacho */
  --panel: #172740;
  --panel-2: #1f3354;
  --signal: #ffc629;           /* chamados e ações principais */
  --signal-strong: #ffb300;
  --hero-red: #ff4f3f;         /* alerta, infiltrado, tempo crítico */
  --teal: #3fd1c1;             /* legítimo, confirmações */
  /* preenchimentos (recebem texto em tinta) x cores usadas como texto */
  --teal-fill: #3fd1c1;
  --red-fill: #ff4f3f;
  --red-text: #ff8a7e;
  --paper: #f4f7fb;
  --muted: #9fb2cc;
  --focus: #ffc629;

  --bg-base: var(--navy);
  --bg-panel: var(--panel);
  --bg-card: var(--panel);
  --bg-modal: var(--panel);
  --bg-input: #0b1626;
  --bg-input-focus: #0b1626;
  --bg-deep: #0b1626;
  --bg-deep-focus: #0b1626;
  --bg-overlay: rgba(4, 9, 18, 0.72);
  --text-main: var(--paper);
  --text-bright: var(--paper);
  --text-soft: var(--muted);
  --line: #2c4468;
  --primary: var(--signal);
  --accent: var(--signal);
  --ok: var(--teal);
  --alert: var(--hero-red);
  --neon-cyan: var(--teal);
  --neon-pink: var(--hero-red);
  --neon-green: var(--teal);
  --neon-red: var(--hero-red);
  --text-on-primary: var(--ink);
  --text-on-accent: var(--ink);
  --placeholder-color: #8fa3bf;
  --subtle-highlight: rgba(255, 255, 255, 0.03);
  --subtle-highlight-strong: rgba(255, 255, 255, 0.06);
  --shadow: none;
  --border-glow: none;
  --card-inset-shadow: none;
  --scanline-opacity: 0;
  --ambient-bg: none;
  --grid-line: transparent;
  /* usados por estilos inline gerados no app.js */
  --surface-2: var(--panel-2);
  --border: var(--ink);

  /* Tipografia da interface de despacho do Dispatch: Orbitron nos titulos e
     nomes, Rajdhani no texto (sem italico: nenhuma das duas tem) */
  --font-title: 'Orbitron', system-ui, sans-serif;
  --font-display: 'Rajdhani', system-ui, sans-serif;
  --font-body: 'Rajdhani', system-ui, sans-serif;

  --cel: 5px 5px 0 var(--ink);
  --cel-sm: 3px 3px 0 var(--ink);
  --stroke: 3px solid var(--ink);
  --map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'%3E%3Cg fill='none' stroke='%2378a0d2' stroke-opacity='.16' stroke-width='1.5'%3E%3Cpath d='M0 38h320M0 131h320M0 214h320M0 287h320M52 0v320M149 0v320M231 0v320M296 0v320'/%3E%3Cpath d='M0 320L320 0' stroke-width='3'/%3E%3Cpath d='M149 131c40 0 82 40 82 83' stroke-width='2.5'/%3E%3Crect x='66' y='52' width='68' height='64' rx='3'/%3E%3Crect x='163' y='228' width='54' height='46' rx='3'/%3E%3Crect x='245' y='145' width='38' height='56' rx='3'/%3E%3Ccircle cx='52' cy='214' r='14'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="light"] {
  --ink: #0e1a2b;
  --navy: #dce6f2;
  --panel: #ffffff;
  --panel-2: #eef3f9;
  --signal: #ffc629;
  --signal-strong: #f5b400;
  --hero-red: #c02a1c;
  --teal: #0f7a6e;
  --teal-fill: #3fd1c1;
  --red-fill: #ff7a6b;
  --red-text: #c02a1c;
  --paper: #0e1a2b;
  --muted: #4a5b73;
  --focus: #0e1a2b;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-deep: #ffffff;
  --bg-deep-focus: #ffffff;
  --bg-overlay: rgba(14, 26, 43, 0.45);
  --line: #a9bbd1;
  --text-on-accent: var(--ink);
  --placeholder-color: #56667e;
  --subtle-highlight: rgba(14, 26, 43, 0.03);
  --subtle-highlight-strong: rgba(14, 26, 43, 0.06);
  --map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'%3E%3Cg fill='none' stroke='%230e1a2b' stroke-opacity='.055' stroke-width='1.5'%3E%3Cpath d='M0 38h320M0 131h320M0 214h320M0 287h320M52 0v320M149 0v320M231 0v320M296 0v320'/%3E%3Cpath d='M0 320L320 0' stroke-width='3'/%3E%3Cpath d='M149 131c40 0 82 40 82 83' stroke-width='2.5'/%3E%3Crect x='66' y='52' width='68' height='64' rx='3'/%3E%3Crect x='163' y='228' width='54' height='46' rx='3'/%3E%3Crect x='245' y='145' width='38' height='56' rx='3'/%3E%3Ccircle cx='52' cy='214' r='14'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --ink: #0e1a2b;
    --navy: #dce6f2;
    --panel: #ffffff;
    --panel-2: #eef3f9;
    --signal-strong: #f5b400;
    --hero-red: #c02a1c;
    --teal: #0f7a6e;
    --teal-fill: #3fd1c1;
    --red-fill: #ff7a6b;
    --red-text: #c02a1c;
    --paper: #0e1a2b;
    --muted: #4a5b73;
    --focus: #0e1a2b;
    --bg-input: #ffffff;
    --bg-input-focus: #ffffff;
    --bg-deep: #ffffff;
    --bg-deep-focus: #ffffff;
    --bg-overlay: rgba(14, 26, 43, 0.45);
    --line: #a9bbd1;
    --placeholder-color: #56667e;
    --subtle-highlight: rgba(14, 26, 43, 0.03);
    --subtle-highlight-strong: rgba(14, 26, 43, 0.06);
    --map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'%3E%3Cg fill='none' stroke='%230e1a2b' stroke-opacity='.055' stroke-width='1.5'%3E%3Cpath d='M0 38h320M0 131h320M0 214h320M0 287h320M52 0v320M149 0v320M231 0v320M296 0v320'/%3E%3Cpath d='M0 320L320 0' stroke-width='3'/%3E%3Cpath d='M149 131c40 0 82 40 82 83' stroke-width='2.5'/%3E%3Crect x='66' y='52' width='68' height='64' rx='3'/%3E%3Crect x='163' y='228' width='54' height='46' rx='3'/%3E%3Crect x='245' y='145' width='38' height='56' rx='3'/%3E%3Ccircle cx='52' cy='214' r='14'/%3E%3C/g%3E%3C/svg%3E");
  }
}

/* --- Base ------------------------------------------------------------------ */
body {
  background-color: var(--bg-base);
  background-image: var(--map);
  background-size: 320px 320px;
  font-family: var(--font-body);
  font-weight: 450;
  line-height: 1.45;
}

.ambient,
.scanlines {
  display: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-main);
  text-shadow: none;
}

/* Rotulos em caixa normal (a caixa alta fica so nos titulos de cartela) */
.brand h1,
.badge,
.encryption-badge,
.scan-badge,
.timer-label,
.status-sub,
.sidebar-title,
.query-badge,
.vote-card-status,
.vote-card-answer-label,
.input-status-bar,
.cyber-label,
legend {
  text-transform: none;
  letter-spacing: 0.01em;
}

.cyber-label,
legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.view-description,
.brand-subtitle,
.status-sub,
.muted {
  font-family: var(--font-body);
  color: var(--text-soft);
  letter-spacing: 0;
  text-shadow: none;
  display: none;
}

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

/* --- Topo ------------------------------------------------------------------ */
.topbar {
  border-bottom: var(--stroke);
  padding-bottom: 0.75rem;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  transform: rotate(-4deg);
}

.brand h1 {
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: none;
}

/* --- Cartela de titulo (o elemento marcante): titulo sobre faixa amarela
       inclinada, como o letreiro de abertura de uma serie animada ---------- */
.view-header h2,
.game-status-display h2 {
  position: relative;
  z-index: 0;
  display: inline-block;
  margin: 0.35rem 0 0.9rem 0.35rem;
  padding: 0.15em 0.55em;
  color: var(--ink);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.05;
}

.view-header h2::before,
.game-status-display h2::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--signal);
  border: var(--stroke);
  border-radius: 6px;
  box-shadow: var(--cel);
  transform: skewX(-10deg);
}

.game-status-display h2 {
  font-size: clamp(1.05rem, 3vw, 1.5rem);
  margin-bottom: 0.4rem;
}

/* o "glitch" do tema anterior nao combina com traco de animacao */
.digital-clock::before,
.digital-clock::after {
  content: none;
  display: none;
}

/* --- Paineis: "cartao de chamado" com contorno de tinta e sombra dura ------ */
.cyber-card,
.cyber-box,
.modal-content,
.vote-question-card {
  background: var(--bg-card);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
  backdrop-filter: none;
}

.cyber-card::before,
.cyber-card::after,
.cyber-box::before,
.cyber-box::after {
  content: none;
}

.cyber-box {
  overflow: hidden;
}

/* --- Botoes: amarelo-sinal com contorno; "afundam" ao toque --------------- */
.btn,
.cyber-submit-btn,
.vote-btn {
  clip-path: none;
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms;
}

.btn:active:not(:disabled),
.cyber-submit-btn:active:not(:disabled),
.vote-btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn:disabled,
.cyber-submit-btn:disabled,
.vote-btn:disabled {
  opacity: 0.55;
  box-shadow: none;
  filter: none;
}

.btn.primary,
.cyber-submit-btn,
.vote-btn {
  background: var(--signal);
  color: var(--ink);
}

.btn.primary:hover,
.cyber-submit-btn:hover,
.vote-btn:hover {
  background: var(--signal-strong);
  color: var(--ink);
  box-shadow: var(--cel-sm);
}

.btn.secondary {
  background: var(--teal-fill);
  color: var(--ink);
  border: var(--stroke);
}

.btn.secondary:hover {
  background: var(--teal-fill);
  filter: brightness(1.08);
  color: var(--ink);
  box-shadow: var(--cel-sm);
}

.btn.ghost {
  background: var(--panel-2);
  color: var(--text-main);
  border: var(--stroke);
}

.btn.ghost:hover {
  background: var(--panel-2);
  color: var(--text-main);
  border-color: var(--ink);
  filter: brightness(1.1);
}

.btn.destructive {
  background: var(--red-fill);
  color: var(--ink);
  border: var(--stroke);
}

.btn.destructive:hover {
  background: var(--red-fill);
  color: var(--ink);
  filter: brightness(1.08);
}

/* --- Campos ----------------------------------------------------------------- */
input[type="text"],
input[type="search"],
textarea,
.phase-content textarea,
.lobby-edit-input {
  background: var(--bg-input);
  color: var(--text-main);
  border: var(--stroke);
  border-radius: 10px;
  font-family: var(--font-body);
  box-shadow: none;
}

input[type="text"]:focus,
input[type="search"]:focus,
textarea:focus {
  border-color: var(--ink);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* O CSS base remove a borda do campo com !important e a coloca no conteiner:
   o contorno e o foco ficam no conteiner */
.search-wrapper,
.cyber-input-wrapper {
  background: var(--bg-input);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: none;
}

.search-wrapper:focus-within,
.cyber-input-wrapper:focus-within {
  border-color: var(--ink);
  box-shadow: none;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.search-icon {
  padding-left: 0.75rem;
}

.scan-badge {
  display: none;
}

/* --- Seletor de tema e perfil ------------------------------------------------ */
.cyber-select-trigger,
.profile-chip {
  background: var(--panel);
  color: var(--text-main);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.cyber-select.open .cyber-select-trigger {
  box-shadow: var(--cel-sm);
  border-color: var(--ink);
}

.cyber-select-menu {
  background: var(--panel);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel);
}

.cyber-select-option {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.cyber-select-option.active,
.cyber-select-option:hover {
  background: var(--signal);
  color: var(--ink);
}

.profile-chip-edit {
  color: var(--text-soft);
}

/* --- Lista de salas e jogadores ---------------------------------------------- */
.room-item {
  display: block;
  width: 100%;
  background: var(--panel-2);
  color: inherit;
  border: var(--stroke);
  border-radius: 12px;
  box-shadow: var(--cel-sm);
  font: inherit;
  text-align: left;
}

.room-item .room-meta {
  display: block;
}

.room-item:active,
.room-item[aria-busy="true"] {
  background: var(--signal);
  color: var(--ink);
}

.room-item:active .room-meta,
.room-item:active strong,
.room-item[aria-busy="true"] .room-meta,
.room-item[aria-busy="true"] strong {
  color: var(--ink);
}

.room-item:hover {
  transform: none;
  border-color: var(--ink);
}

.room-item.selected {
  background: var(--signal);
  color: var(--ink);
  box-shadow: var(--cel);
}

.room-item.selected .room-meta,
.room-item.selected strong {
  color: var(--ink);
}

.room-item strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}

.player-item {
  background: var(--panel-2);
  border: 2px solid var(--ink);
  border-left-width: 6px;
  border-radius: 10px;
}

.player-item.ready {
  border-left-color: var(--teal);
}

.player-item.waiting {
  border-left-color: var(--line);
}

.player-item.dead {
  opacity: 0.6;
  border-left-color: var(--hero-red);
}

.player-item strong {
  font-weight: 700;
}

/* --- Selos / etiquetas --------------------------------------------------------- */
.badge {
  background: var(--panel);
  color: var(--text-main);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: none;
  text-shadow: none;
}

.badge.ready {
  background: var(--teal-fill);
  color: var(--ink);
}

.badge.waiting {
  background: var(--panel);
  color: var(--text-soft);
}

.badge.dead {
  background: transparent;
  color: var(--red-text);
  border-color: var(--red-text);
}

/* Papel: infiltrado em vermelho-herói, legitimo em turquesa */
.badge.small.waiting,
.phase-list-item .badge.waiting,
.round-result .badge.waiting {
  background: var(--red-fill);
  color: var(--ink);
}

/* --- Lobby --------------------------------------------------------------------- */
.lobby-name-row h3,
.lobby-name-row .lobby-edit-input {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-main);
}

.lobby-counts strong {
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 900;
}

.code-chip {
  background: var(--panel-2);
  color: var(--text-main);
  border: 2px dashed var(--ink);
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: none;
  text-shadow: none;
}

.chip-option span {
  background: var(--panel-2);
  color: var(--text-main);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  box-shadow: none;
}

.chip-option input[type="radio"]:checked + span {
  background: var(--signal);
  color: var(--ink);
  box-shadow: var(--cel-sm);
}

/* Foco por teclado: anel arredondado no proprio chip (no toque nao aparece) */
.chip-option input[type="radio"]:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg-base), 0 0 0 6px var(--signal);
}

.avatar-button,
.avatar-choice {
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 12px;
  box-shadow: var(--cel-sm);
}

.avatar-choice:hover,
.avatar-choice.selected {
  background: var(--signal);
  border-color: var(--ink);
}

.avatar-edit-icon {
  background: var(--signal);
  color: var(--ink);
  border: 2px solid var(--ink);
}

/* --- Partida: cabecalho e cronometro de chamado ------------------------------------ */
.game-topbar {
  border-bottom: var(--stroke);
}

.timer-label {
  color: var(--text-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
}

.digital-clock {
  display: inline-block;
  min-width: 4.6ch;
  padding: 0.05em 0.45em;
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-shadow: none;
  animation: none;
}

.digital-clock.is-warning {
  background: #ff9f1c;
  color: var(--ink);
  text-shadow: none;
}

.digital-clock.is-critical {
  background: var(--red-fill);
  color: var(--ink);
  text-shadow: none;
  animation: timer-pulse 1s ease-in-out infinite;
}

[data-theme="light"] .digital-clock.is-warning,
[data-theme="light"] .digital-clock.is-critical {
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .digital-clock.is-critical {
    animation: none;
  }
}

.sidebar-title {
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  border-bottom: var(--stroke);
}

.round-prompt {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-main);
  text-shadow: none;
}

/* --- Pergunta: chamado recebido ---------------------------------------------------- */
.cyber-query-box {
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.cyber-query-box::before,
.cyber-query-box::after {
  content: none;
}

.query-badge {
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: var(--cel-sm);
  text-shadow: none;
}

.query-tag {
  display: none;
}

.query-text,
.vote-question-text {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-main);
  text-shadow: none;
}

.query-footer {
  font-family: var(--font-body);
  color: var(--text-soft);
  letter-spacing: 0;
}

.input-wrapper {
  background: var(--bg-input);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.input-wrapper:focus-within {
  background: var(--bg-input);
  box-shadow: var(--cel);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.input-wrapper.submitted {
  border-color: var(--ink);
  box-shadow: var(--cel-sm);
}

.input-wrapper.submitted .cyber-submit-btn {
  background: var(--teal-fill);
}

.input-icon,
.input-wrapper.submitted .input-icon {
  color: var(--text-soft);
}

.input-status-bar {
  font-family: var(--font-body);
  color: var(--text-soft);
}

/* --- Votacao ------------------------------------------------------------------------ */
.vote-question-card h3 {
  font-size: 1rem;
  color: var(--text-soft);
}

.vote-card {
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.vote-card:hover {
  transform: none;
}

.vote-card.targeted {
  background: var(--signal);
  color: var(--ink);
}

.vote-card.targeted .vote-card-name,
.vote-card.targeted .vote-card-answer-text,
.vote-card.targeted .vote-card-answer-label {
  color: var(--ink);
}

.vote-card-avatar {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: none;
}

.vote-card-name {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-main);
}

.vote-card-answer-box {
  background: var(--bg-input);
  color: var(--text-main);
  border: 2px solid var(--ink);
  border-left-width: 2px;
  border-radius: 10px;
}

.vote-card.targeted .vote-card-answer-box {
  background: #fff3c4;
}

.vote-card-answer-text {
  color: var(--text-main);
  text-shadow: none;
}

.targeted-overlay {
  background: var(--ink);
  color: var(--signal);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: none;
}

/* --- Resultado da rodada e fim de partida -------------------------------------------- */
.round-result {
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.round-result.is-infiltrator {
  border-color: var(--ink);
  background: var(--teal-fill);
  color: var(--ink);
}

.round-result.is-group {
  border-color: var(--ink);
  background: var(--red-fill);
  color: var(--ink);
}

.round-result.is-infiltrator .round-result-name,
.round-result.is-group .round-result-name {
  color: var(--ink);
}

.round-result-name {
  font-family: var(--font-display);
  font-weight: 900;
}

.victory-banner {
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 16px;
  box-shadow: var(--cel);
  color: var(--ink);
}

.victory-banner.group {
  background: var(--teal-fill);
}

.victory-banner.infiltrators {
  background: var(--red-fill);
}

.victory-banner.aborted {
  background: var(--panel-2);
  color: var(--text-main);
}

.victory-banner.player-won,
.victory-banner.player-lost {
  box-shadow: var(--cel);
  border-color: var(--ink);
}

.victory-banner h3,
.victory-banner.player-won h3,
.victory-banner.player-lost h3,
.victory-text h3 {
  color: var(--ink);
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: none;
}

.victory-banner p {
  color: var(--ink);
}

.victory-banner.aborted h3,
.victory-banner.aborted p {
  color: var(--text-main);
}

.results-grid h4 {
  color: var(--text-main);
  border-bottom: var(--stroke);
}

.phase-list-item,
.results-grid .phase-list-item {
  background: var(--panel-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

/* --- Chat do grupo: bolhas de mensagem ------------------------------------------------- */
.chat-header h3 {
  color: var(--text-main);
  font-size: 1.05rem;
}

.chat-messages {
  gap: 0.45rem;
}

.chat-message {
  max-width: 88%;
  align-self: flex-start;
  padding: 0.45rem 0.7rem;
  background: var(--panel-2);
  color: var(--text-main);
  border: 2px solid var(--ink);
  border-radius: 12px 12px 12px 4px;
  font-style: normal;
}

.chat-message .chat-meta {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.chat-message.self {
  align-self: flex-end;
  background: var(--signal);
  color: var(--ink);
  border-color: var(--ink);
  border-radius: 12px 12px 4px 12px;
}

.chat-message.self .chat-meta {
  color: var(--ink);
  opacity: 0.75;
}

.chat-message.system {
  align-self: center;
  max-width: 100%;
  background: transparent;
  border: none;
  color: var(--text-soft);
  text-align: center;
}

.chat-message.system .chat-meta {
  display: inline;
}

.chat-message.qa-log {
  align-self: stretch;
  max-width: 100%;
  font-style: normal;
  text-align: left;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-main);
}

.chat-message.qa-question {
  background: var(--signal);
  color: var(--ink);
  font-weight: 700;
}

.chat-message.qa-question .chat-meta {
  color: var(--ink);
}

.chat-message.qa-answer .chat-meta::before {
  content: none;
}

.chat-message.game-over {
  align-self: stretch;
  max-width: 100%;
  background: var(--red-fill);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 10px;
  font-style: normal;
  font-weight: 700;
}

.chat-message.game-over .chat-meta {
  color: var(--ink);
}

.chat-form input {
  border: var(--stroke);
  border-radius: 10px;
}

.chat-form button {
  background: var(--panel-2);
  color: var(--text-main);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
}

/* --- Toast e dialogos ----------------------------------------------------------------- */
.toast {
  background: var(--panel);
  color: var(--text-main);
  border: var(--stroke);
  border-radius: 12px;
  box-shadow: var(--cel);
  font-weight: 600;
}

dialog.modal::backdrop {
  background: var(--bg-overlay);
}

#profileDialog .actions {
  background: var(--bg-card);
}

.profile-hint {
  color: var(--text-soft);
}

.role-banner .badge {
  font-size: 1.1rem;
}

/* --- Telas pequenas ------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --cel: 4px 4px 0 var(--ink);
  }

  .view-header h2 {
    font-size: clamp(1.35rem, 7vw, 1.9rem);
  }
}

/* --- Ajustes de revisao --------------------------------------------------------------- */

/* logo sem o brilho herdado do tema anterior */
.brand-logo,
.brand-logo svg {
  filter: none;
  text-shadow: none;
}

/* Campos editaveis do anfitriao no lobby: ficam no meio do texto, entao usam
   so um sublinhado tracejado em vez do contorno pesado dos campos de formulario */
.lobby-edit-input,
.lobby-name-row .lobby-edit-input,
.lobby-meta-item .lobby-edit-input {
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--line);
  border-radius: 0;
  padding: 0.1rem 0.2rem;
}

.lobby-edit-input:focus {
  border-bottom-color: var(--ink);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.cyber-select--inline .cyber-select-trigger {
  min-height: 32px;
  padding: 0.1rem 0.4rem;
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--line);
  border-radius: 0;
  box-shadow: none;
}

/* Na partida todos estao "vivos": o selo fica neutro e so a eliminacao chama atencao */
.game-sidebar .badge.ready {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line);
}

/* O contorno e o foco ficam no conteiner do campo de resposta, nao no campo */
#responseInput,
#responseInput:focus {
  border: none;
  outline: none;
  background: transparent;
}

/* Cronometro legivel no celular: e a informacao mais importante da partida */
@media (max-width: 768px) {
  .digital-clock {
    font-size: 1.6rem;
  }
}

/* Sem prazo o cronometro sai do layout (invisivel ele ainda ocupava espaco) */
.game-timer-display.no-deadline {
  display: none;
}

/* Detalhes decorativos com contraste suficiente */
.cyber-select-arrow,
.lobby-meta-divider {
  color: var(--text-soft);
}

/* Tamanho minimo de leitura (12px) */
.cyber-select-arrow {
  font-size: 0.75rem;
}

.vote-card-answer-label {
  font-size: 0.8rem;
}

/* o selo do papel na lista vem com font-size inline (0.7em) do app.js */
.badge.small {
  font-size: 0.78rem !important;
}

/* ==========================================================================
   Avatares e icones desenhados (assets/sprite.svg)
   ========================================================================== */
:root {
  /* Contorno do retrato: anel claro no tema escuro (tinta nao apareceria no
     fundo escuro) e contorno de tinta no claro, como os cartoes. As imagens
     nao tem contorno proprio, entao o anel e o que separa o circulo do fundo. */
  --av-ring: 0 0 0 2px rgba(244, 247, 251, 0.9);
}

[data-theme="light"] {
  --av-ring: 0 0 0 2px var(--ink);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --av-ring: 0 0 0 2px var(--ink);
  }
}

.ic {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.14em;
}

.av {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: var(--av-ring);
}

.av-text {
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  box-shadow: none;
}

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 0;
}

.brand-logo svg {
  width: 30px;
  height: 30px;
}

.btn-content {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.search-icon {
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 1.25rem;
}

.cyber-select-arrow {
  display: inline-grid;
  place-items: center;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.cyber-select.open .cyber-select-arrow .ic {
  transform: rotate(180deg);
}

/* Home: avatar grande com botao de editar */
.avatar-button {
  width: 76px;
  height: 76px;
  padding: 4px;
  border-radius: 50%;
}

.avatar-button .avatar {
  width: 100%;
  height: 100%;
}

.avatar-edit-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.85rem;
}

/* Botao de perfil no topo */
.profile-chip-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: none;
}

.profile-chip-edit {
  font-size: 1rem;
}

/* Seletores de avatar */
.avatar-choice {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 50%;
}

.avatar-choice .av {
  width: 100%;
  height: 100%;
}

.avatar-choice.selected {
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--ink), var(--cel-sm);
}

/* ==========================================================================
   Listas de jogadores: avatar | codinome + nome + etiquetas | status
   ========================================================================== */
.player-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
}

.player-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.player-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.08rem;
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.player-real {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  background: var(--panel);
  color: var(--text-main);
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.35;
}

.tag-group {
  background: var(--teal-fill);
  color: var(--ink);
}

.tag-infiltrator {
  background: var(--red-fill);
  color: var(--ink);
}

.tag-out {
  background: transparent;
  color: var(--red-text);
  border-color: var(--red-text);
}

.status-badge {
  min-width: 5.5rem;
  justify-content: center;
  text-align: center;
}

/* Eliminado: o texto mantem o contraste; so o retrato e marcado */
.player-item.game-player.is-out {
  opacity: 1;
  border-left-color: var(--red-text);
}

.game-player.is-out .av {
  filter: grayscale(1) brightness(0.85);
}

.av-out-mark {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 20px;
  height: 20px;
  padding: 3px;
  background: var(--red-fill);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.game-sidebar .player-item {
  grid-template-columns: auto minmax(0, 1fr);
}

/* ==========================================================================
   Fim de partida: revelacao e historico em linhas alinhadas
   ========================================================================== */
.reveal-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reveal-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--panel-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
  text-align: left;
}

.reveal-row .avatar {
  width: 40px;
  height: 40px;
}

.role-badge {
  min-width: 6.5rem;
  justify-content: center;
  text-align: center;
}

/* Eliminado por inatividade (sem votos): marcacao discreta abaixo do nome */
.inactive-chip {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.reveal-row.role-infiltrator {
  border-left: 6px solid var(--red-fill);
}

.round-chip {
  padding: 0.2rem 0.5rem;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
}

.results-grid h4 {
  text-align: left;
  padding-bottom: 0.35rem;
  margin-bottom: 0.6rem;
}

.victory-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.victory-ic {
  width: 72px;
  height: 72px;
}

.victory-icon {
  flex: none;
  line-height: 0;
}

/* Votacao e resultado da rodada */
.vote-card-avatar {
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  background: transparent;
}

.round-result-avatar {
  width: 76px;
  height: 76px;
  line-height: 0;
}

@media (max-width: 480px) {
  .reveal-row {
    gap: 0.55rem;
    padding: 0.5rem 0.6rem;
  }

  .role-badge {
    min-width: 0;
    padding: 0.15rem 0.5rem;
  }

  .victory-ic {
    width: 52px;
    height: 52px;
  }

  /* topo em uma linha: o botao de perfil mostra so avatar e lapis */
  .profile-chip-name {
    display: none;
  }

  .profile-chip {
    padding: 0.25rem 0.5rem 0.25rem 0.3rem;
  }
}

/* Selo de papel "Infiltrado" nas linhas de revelacao/historico */
.reveal-row .badge.waiting,
.role-badge.waiting {
  background: var(--red-fill);
  color: var(--ink);
}

/* Pergunta/resposta no chat: o nome do autor fica acima do texto, como nas bolhas */
.chat-message.qa-log .chat-meta {
  display: block;
}

.round-result-subtitle {
  text-align: left;
}


/* ==========================================================================
   Tipografia: Orbitron (titulos, nomes, cronometro) + Rajdhani (texto e UI)
   ========================================================================== */
body {
  font-size: 1.0625rem;
  font-weight: 500;
}

h1, h2, h3, h4,
.brand h1,
.view-header h2,
.game-status-display h2,
.lobby-name-row h3,
.lobby-name-row .lobby-edit-input,
.victory-text h3,
.victory-banner h3,
.player-name,
.vote-card-name,
.round-result-name,
.digital-clock,
.lobby-counts strong {
  font-family: var(--font-title);
  font-style: normal;
}

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.brand h1 {
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.view-header h2 {
  font-size: clamp(1.25rem, 4.2vw, 2.05rem);
  font-weight: 900;
  letter-spacing: 0.05em;
}

.game-status-display h2 {
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
  letter-spacing: 0.06em;
}

.victory-banner h3,
.victory-text h3 {
  font-size: clamp(1.2rem, 4vw, 1.9rem);
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* nomes de jogador: como os nomes de heroi no despacho */
.player-name,
.vote-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.round-result-name {
  font-size: 1.05rem;
  font-weight: 800;
}

.digital-clock {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lobby-counts strong {
  font-weight: 800;
}

/* texto corrido e UI em Rajdhani */
.btn,
.cyber-submit-btn,
.vote-btn,
.chat-form button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.08em;
}

.badge,
.tag,
.round-chip,
.query-badge,
.code-chip,
.cyber-label,
legend,
.sidebar-title,
.timer-label {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag {
  font-size: 0.82rem;
}

.sidebar-title,
.chat-header h3,
.results-grid h4,
.vote-question-card h3,
.round-result-subtitle {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.query-text,
.vote-question-text,
.round-prompt {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.query-text {
  font-size: clamp(1.25rem, 3.2vw, 1.7rem);
  line-height: 1.25;
}

/* sobras monoespacadas do tema anterior */
.query-footer,
.input-status-bar,
.player-real,
.chat-message,
.profile-hint {
  font-family: var(--font-body);
}

.player-real {
  font-weight: 600;
}

.chat-message {
  font-size: 1rem;
}

.chat-message.system {
  font-weight: 600;
}

/* ==========================================================================
   Barra do app: painel solido (antes era transparente sobre o mapa)
   ========================================================================== */
.topbar {
  position: relative;
  /* acima do cabecalho fixo da partida (.game-topbar, z-index 30): o menu do
     seletor de tema abre por cima dele */
  z-index: 40;
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--panel);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

/* ==========================================================================
   Lobby: campo do topico e seletor de duracao com a mesma altura e linha base
   ========================================================================== */
.lobby-meta {
  align-items: center;
}

.lobby-meta-item,
.lobby-meta-item strong {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lobby-meta-item .lobby-edit-input,
.cyber-select--inline,
.cyber-select--inline .cyber-select-trigger {
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  margin: 0;
  vertical-align: middle;
}

.lobby-meta-item .lobby-edit-input,
.cyber-select--inline .cyber-select-trigger {
  display: inline-flex;
  align-items: center;
  padding: 0 0.35rem;
  border: none;
  border-bottom: 2px dashed var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.cyber-select--inline {
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Codigo da sala + convite
   ========================================================================== */
.lobby-name-row {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.room-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.75rem;
  cursor: pointer;
}

.share-chip {
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-style: solid;
  box-shadow: var(--cel-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.share-chip:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.invite-notice {
  margin: 1rem 0 0;
  padding: 0.65rem 0.85rem;
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 10px;
  font-weight: 700;
}

.invite-notice[hidden] {
  display: none;
}

.room-item-top .badge.ready {
  background: var(--teal-fill);
  color: var(--ink);
}

/* "Topico: valor" sem espaco antes dos dois-pontos */
.lobby-meta-item {
  gap: 0;
}

.lobby-meta-item strong {
  margin-left: 0.35rem;
}

/* ==========================================================================
   Cabecalho da partida (fase + cronometro): painel proprio, distinto da barra
   do app e do conteudo. Tom mais escuro que os paineis, com o mesmo contorno
   de tinta e sombra dura; continua fixo no topo ao rolar e ao digitar.
   ========================================================================== */
.game-topbar {
  top: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.game-status-display h2 {
  margin: 0 0 0.6rem 0.3rem;
}

@media (max-width: 768px) {
  .game-topbar {
    top: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
  }
}

/* Cabecalho da partida no celular: uma linha so (cartela + fase | cronometro).
   O rotulo "Tempo restante" fica so para leitores de tela. */
@media (max-width: 768px) {
  .game-topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
  }

  .game-status-display {
    min-width: 0;
  }

  .game-status-display h2 {
    margin: 0 0 0.2rem 0.25rem;
    font-size: 0.85rem;
  }

  .game-topbar .status-sub {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .game-timer-display {
    flex: none;
    margin-left: auto;
  }

  .game-timer-display .timer-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .digital-clock {
    font-size: 1.35rem;
  }
}

/* ==========================================================================
   Celular: cartoes na altura do conteudo e botoes dentro do cartao.
   O CSS base esticava o ultimo cartao ate o fim da tela e fixava a barra de
   botoes (sticky, com fundo proprio e margens negativas): no iPhone isso
   cortava o cartao e empurrava o botao "Entrar" para tras do teclado.
   ========================================================================== */
@media (max-width: 768px) {
  .view > .cyber-card:last-of-type,
  .view > form:last-of-type {
    flex: none;
  }

  .form-grid > .actions,
  .cyber-card > .actions:last-child,
  .view > .cyber-card:last-of-type > .actions:last-child,
  .view > form:last-of-type > .actions:last-child {
    position: static;
    z-index: auto;
    margin: 1rem 0 0;
    padding: 0;
    background: transparent;
    border-top: none;
    backdrop-filter: none;
  }
}

/* Barra do app em uma linha no celular (logo + nome | perfil + tema) */
@media (max-width: 480px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
  }

  .brand {
    min-width: 0;
    gap: 0.5rem;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex: none;
  }

  .brand-logo svg {
    width: 24px;
    height: 24px;
  }

  .brand h1 {
    font-size: 1rem;
    letter-spacing: 0.04em;
  }

  .brand-subtitle {
    display: none;
  }

  .topbar-controls {
    flex: none;
    gap: 0.4rem;
  }

  .topbar-controls .cyber-select-trigger {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Web app instalado: conteudo abaixo da barra de status/notch do iPhone
   (status bar "black-translucent" + viewport-fit=cover)
   ========================================================================== */
.app-shell {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Fim da pagina livre da barra flutuante do Safari (iOS 26) e do indicador de
   inicio: o ultimo botao ("Sair da sala") nao fica por baixo dela. */
@media (max-width: 768px) {
  .app-shell {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4rem);
  }
}

.game-topbar {
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
}

/* Faixa da barra de status (iPhone com viewport-fit=cover, app instalado):
   o conteudo rola por baixo dela em vez de se misturar com o relogio. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg-base);
  pointer-events: none;
}

/* Convite para instalar o app */
.install-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--panel-2);
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel-sm);
}

.install-banner[hidden] {
  display: none;
}

.install-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  background: var(--signal);
  border: var(--stroke);
  border-radius: 10px;
}

.install-logo svg {
  width: 28px;
  height: 28px;
}

.install-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.install-text strong {
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.install-text span {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.btn.install-btn {
  flex: none;
  min-height: 44px;
  padding: 0 0.9rem;
  font-size: 0.95rem;
}

.install-dismiss {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  background: transparent;
  color: var(--text-soft);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}

.install-banner {
  margin-top: 1rem;
}

/* digitando: o convite so ocuparia espaco acima do teclado */
body.keyboard-open .install-banner {
  display: none;
}

@media (max-width: 480px) {
  .install-banner {
    gap: 0.5rem;
    padding: 0.5rem 0.25rem 0.5rem 0.6rem;
  }

  .install-logo {
    width: 34px;
    height: 34px;
  }

  .install-logo svg {
    width: 24px;
    height: 24px;
  }

  .btn.install-btn {
    padding: 0 0.7rem;
  }
}

/* ==========================================================================
   iOS com teclado aberto
   - o Safari nao redimensiona o layout: a pagina precisa de espaco no fim para
     o campo e o botao subirem acima do teclado (e da capsula do endereco);
   - a area visivel e deslocada dentro do layout: o cabecalho da partida
     acompanha esse deslocamento (--vv-top) para o cronometro continuar a vista.
   ========================================================================== */
body.keyboard-open .app-shell {
  padding-bottom: calc(var(--kb-inset, 0px) + 96px);
}

body.keyboard-open .game-topbar {
  transform: translateY(var(--vv-top, 0px));
}

/* ==========================================================================
   Lobby no celular
   - o nome da sala ocupa a linha toda (os chips de codigo/convite o cortavam);
   - topico, duracao e host empilhados, sem separadores soltos;
   - os dois-pontos vem do CSS: o leitor de tela le "Topico: valor" junto.
   ========================================================================== */
.lobby-meta-item > span[data-i18n]::after {
  content: ":";
}

@media (max-width: 560px) {
  .lobby-name-row {
    flex-direction: column;
    align-items: stretch;
  }

  .lobby-name-row h3,
  .lobby-name-row .lobby-edit-input {
    width: 100%;
  }

  .lobby-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .lobby-meta-divider {
    display: none;
  }
}

/* Autodeclaracao: "Sim" e "Nao" lado a lado, com o mesmo peso visual */
.actions.role-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.actions.role-choices .btn {
  width: 100%;
  min-height: 56px;
  white-space: normal;
  line-height: 1.15;
}

/* Voto marcado: icone + texto no proprio botao (o carimbo cobria a resposta) */
.vote-btn .ic {
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.3rem;
  vertical-align: -0.2em;
}

/* Cartoes de voto compactos no celular: nome e botao na mesma linha, resposta
   abaixo. Cerca de metade da altura anterior: mais suspeitos por tela. */
@media (max-width: 560px) {
  .vote-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0.75rem;
  }

  .vote-card-header {
    grid-column: 1;
    grid-row: 1;
    padding-bottom: 0;
    border-bottom: none;
    gap: 0.6rem;
  }

  .vote-card-avatar {
    width: 40px;
    height: 40px;
  }

  .vote-card-actions {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .vote-btn {
    width: auto;
    min-height: 44px;
    padding: 0 0.9rem;
    white-space: nowrap;
  }

  .vote-card-answer-box {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 0.45rem 0.6rem;
  }

  .vote-card-answer-label {
    margin-bottom: 0.15rem;
  }

  .vote-card-answer-text {
    font-size: 1.05rem;
  }
}

/* Chat no celular: o formulario fica logo abaixo da lista (que ja rola sozinha).
   Fixo no rodape ele cobria as ultimas mensagens e caia sob a barra do Safari. */
@media (max-width: 768px) {
  .chat-form {
    position: static;
  }
}

/* Votacao no celular: pergunta, progresso e cartoes sem vaos grandes */
@media (max-width: 560px) {
  .vote-phase-container {
    gap: 0.75rem;
  }

  .vote-progress {
    margin: 0;
  }
}

/* ==========================================================================
   Seletor de tema so com icone (sol / lua / meio a meio): libera espaco para
   o nome do jogo na barra. O menu aberto mostra icone + nome.
   ========================================================================== */
.theme-select .cyber-select-trigger {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}

.theme-select .cyber-select-value {
  display: grid;
  place-items: center;
  line-height: 0;
}

.theme-select .cyber-select-value .ic {
  width: 22px;
  height: 22px;
}

.theme-select .cyber-select-menu {
  min-width: 10.5rem;
}

.theme-select .cyber-select-option {
  gap: 0.6rem;
  padding: 0 0.85rem;
}

.theme-select .cyber-select-option .ic {
  flex: none;
  width: 20px;
  height: 20px;
}

/* o nome do jogo tem prioridade na barra: nao e cortado */
.brand h1 {
  white-space: nowrap;
}

.topbar nav {
  flex: none;
}

/* Sem o destaque retangular de toque do navegador (Android/Samsung): cada
   controle ja tem resposta propria ao toque (afunda/muda de cor), e o
   retangulo nao acompanha os cantos arredondados dos chips e botoes. */
html {
  -webkit-tap-highlight-color: transparent;
}

.chip-option:active span {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ==========================================================================
   Avatares (imagens em assets/avatars) e grade de escolha "fechada"
   50 retratos = 5 x 10: 5 colunas no celular e 10 em telas maiores. As celulas
   esticam para ocupar a largura toda, entao toda linha fica completa.
   ========================================================================== */
img.av {
  object-fit: cover;
  background: var(--panel-2);
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-grid,
#profileDialog .avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.35rem, 1.6vw, 0.6rem);
  margin: 0.75rem 0 0;
}

.avatar-choice,
#profileDialog .avatar-choice {
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: 3px;
  font-size: 0;
}

@media (min-width: 640px) {
  .avatar-grid,
  #profileDialog .avatar-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  /* os dialogos ficam largos o bastante para 10 retratos de ~56px */
  dialog#avatarDialog,
  dialog#profileDialog {
    width: min(720px, calc(100vw - 3rem));
    max-width: none;
  }
}

/* ==========================================================================
   Avatar "falha de sinal" (jogadores vivos durante a partida)
   Silhueta generica em faixas deslocadas, separacao RGB neon, ruido e linhas
   de varredura. De tempos em tempos as faixas "pulam" (cada uma no seu tempo).
   ========================================================================== */
svg.av-glitch {
  overflow: hidden;
  background: #070a18;
  box-shadow: var(--av-ring), 0 0 10px -2px var(--gl-a, #00f0ff);
}

.av-glitch .gl-band {
  animation: gl-jitter 4.2s steps(1, end) infinite;
  animation-delay: var(--gl-delay, 0s);
}

@keyframes gl-jitter {
  0%, 86%, 100% { transform: translate(var(--gl-dx, 0px), 0); }
  88% { transform: translate(calc(var(--gl-dx, 0px) + 5px), 0); }
  90% { transform: translate(calc(var(--gl-dx, 0px) - 7px), 0); }
  92% { transform: translate(calc(var(--gl-dx, 0px) + 3px), 0); }
  94% { transform: translate(var(--gl-dx, 0px), 0); }
}

@media (prefers-reduced-motion: reduce) {
  .av-glitch .gl-band {
    animation: none;
  }
}

/* em listas longas (resultado, votos), a falha fica parada: menos movimento na tela */
.reveal-row svg.av-glitch .gl-band,
.round-result svg.av-glitch .gl-band {
  animation: none;
}

/* Folha de compartilhar propria (quando nao ha a nativa do sistema) */
.share-hint {
  margin: 0.25rem 0 0.75rem;
  color: var(--text-soft);
}

.share-link {
  width: 100%;
  font-size: 16px; /* evita zoom no iOS */
}

.share-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.9rem 0 0.25rem;
}

.btn.share-target {
  display: grid;
  place-items: center;
  min-height: 48px;
  background: var(--panel-2);
  color: var(--text-main);
  border: var(--stroke);
  box-shadow: var(--cel-sm);
  text-decoration: none;
}

.btn.share-target:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

#shareDialog .actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ==========================================================================
   Codinome de jogador vivo: falha de leitura
   O texto real continua solido e legivel (e o que o leitor de tela le). Duas
   copias coloridas (pseudo-elementos) so aparecem em falhas curtas, cortadas em
   faixas e deslocadas, com as cores neon do avatar do mesmo jogador.
   ========================================================================== */
.name-glitch {
  position: relative;
}

.name-glitch::before,
.name-glitch::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  inset: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: none;
  pointer-events: none;
  opacity: 0;
  animation: name-glitch 5.4s steps(1, end) infinite;
  animation-delay: var(--gl-delay, 0s);
}

.name-glitch::before {
  color: var(--gl-a);
  clip-path: inset(8% 0 58% 0);
}

.name-glitch::after {
  color: var(--gl-b);
  clip-path: inset(52% 0 12% 0);
  animation-name: name-glitch-alt;
}

@keyframes name-glitch {
  0%, 88%, 100% { opacity: 0; transform: none; }
  89% { opacity: 0.95; transform: translate(-3px, 0); clip-path: inset(8% 0 58% 0); }
  91% { opacity: 0.95; transform: translate(4px, 0); clip-path: inset(40% 0 30% 0); }
  93% { opacity: 0.9; transform: translate(-2px, 0); clip-path: inset(70% 0 5% 0); }
  95% { opacity: 0; transform: none; }
}

@keyframes name-glitch-alt {
  0%, 88%, 100% { opacity: 0; transform: none; }
  89% { opacity: 0.9; transform: translate(3px, 0); clip-path: inset(52% 0 12% 0); }
  91% { opacity: 0.95; transform: translate(-4px, 0); clip-path: inset(15% 0 60% 0); }
  93% { opacity: 0.9; transform: translate(2px, 0); clip-path: inset(30% 0 45% 0); }
  95% { opacity: 0; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .name-glitch::before,
  .name-glitch::after {
    animation: none;
    opacity: 0;
  }
}

.share-note {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.7rem;
  border-left: 4px solid var(--signal);
  background: var(--panel-2);
  color: var(--text-main);
  font-size: 0.9rem;
  border-radius: 6px;
}

.share-note[hidden] {
  display: none;
}

/* ==========================================================================
   Modo de jogo (criar sala) e modo "topico secreto"
   ========================================================================== */
.mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.mode-group legend {
  grid-column: 1 / -1;
}

.chip-option.mode-option span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  text-align: left;
  white-space: normal;
}

.chip-option.mode-option strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
}

.chip-option.mode-option small {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  opacity: 0.85;
}

@media (max-width: 420px) {
  .mode-group {
    grid-template-columns: 1fr;
  }
}

/* o campo de topico some no modo secreto (form-group e flex e ignoraria [hidden]) */
#topicGroup[hidden] {
  display: none;
}

/* Resultado da rodada: o topico e revelado a todos */
.secret-topic-reveal {
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.8rem;
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 10px;
  box-shadow: var(--cel-sm);
  font-weight: 700;
  text-align: center;
}

.secret-topic-reveal strong {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
}

/* Infiltrado no modo secreto: sem topico, a caixa vira uma "falha de sinal" */
.cyber-query-box.is-blind {
  background: #0b1024;
  color: #f4f8ff;
}

.cyber-query-box.is-blind .query-text,
.cyber-query-box.is-blind .query-footer {
  color: #f4f8ff;
}

/* Modo secreto: a instrucao abaixo do topico continua visivel no celular
   (no classico o rodape e decorativo e some em telas pequenas) */
.cyber-query-box .query-footer.is-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ==========================================================================
   Convite por QR code e NFC
   ========================================================================== */
.code-chip.icon-chip {
  justify-content: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: var(--panel-2);
  color: var(--text-main);
  border: var(--stroke);
  border-style: solid;
  box-shadow: var(--cel-sm);
}

.code-chip.icon-chip .ic {
  width: 22px;
  height: 22px;
}

.code-chip.icon-chip:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.code-chip.icon-chip[hidden] {
  display: none;
}

/* QR sempre escuro sobre branco (leitura confiavel nos dois temas) */
.qr-code {
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 0.5rem auto 0.75rem;
  padding: 0.5rem;
  background: #ffffff;
  border: var(--stroke);
  border-radius: 14px;
  box-shadow: var(--cel);
}

.qr-code:empty::after {
  content: "";
  width: 36px;
  height: 36px;
  border: 4px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: qr-spin 0.8s linear infinite;
}

@keyframes qr-spin {
  to { transform: rotate(360deg); }
}

.qr-code svg {
  width: 100%;
  height: 100%;
}

.qr-code svg path,
.qr-code svg rect[fill="black"] {
  fill: #06101f;
}

.qr-room {
  margin: 0 0 0.5rem;
  text-align: center;
  color: var(--text-soft);
}

.qr-room strong {
  display: block;
  font-family: var(--font-title);
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

/* NFC: pulso enquanto espera a etiqueta; verde ao gravar; vermelho no erro */
.nfc-pulse {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0.75rem auto;
  background: var(--signal);
  color: var(--ink);
  border: var(--stroke);
  border-radius: 50%;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent);
  animation: nfc-pulse 1.6s ease-out infinite;
}

.nfc-pulse .ic {
  width: 44px;
  height: 44px;
}

@keyframes nfc-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent); }
  100% { box-shadow: 0 0 0 22px transparent; }
}

#nfcDialog.is-done .nfc-pulse {
  background: var(--teal-fill);
  animation: none;
}

#nfcDialog.is-error .nfc-pulse {
  background: var(--red-fill);
  animation: none;
}

.nfc-status {
  text-align: center;
  font-weight: 700;
  color: var(--text-main);
}

@media (prefers-reduced-motion: reduce) {
  .nfc-pulse,
  .qr-code:empty::after {
    animation: none;
  }
}

/* ==========================================================================
   Partida pausada (jogador desconectado) e prazo do lobby
   ========================================================================== */
.pause-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: #0b1024;
  color: #f4f8ff;
  border: var(--stroke);
  border-left: 8px solid var(--signal);
  border-radius: 12px;
  box-shadow: var(--cel-sm);
  text-align: left;
}

.pause-banner[hidden] {
  display: none;
}

.pause-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--signal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pause-ic {
  width: 1.2em;
  height: 1.2em;
}

.pause-banner p {
  margin: 0.35rem 0 0;
  font-weight: 600;
}

.pause-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.pause-actions .btn {
  flex: 1 1 12rem;
  min-height: 44px;
}

.pause-banner .pause-actions .btn.ghost {
  background: transparent;
  color: #f4f8ff;
  border: 2px solid #f4f8ff;
  box-shadow: none;
}

.pause-note {
  opacity: 0.85;
}

.lobby-expiry {
  margin: 0.5rem 0 0.25rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.lobby-expiry[hidden] {
  display: none;
}

.lobby-expiry.is-urgent {
  color: var(--red-text);
}
