/* Chat de la mesa (v2/chat.js): mismo papel, tinta y sombras que el resto del HUD */
.chat-fab { position: relative; }
.chat-fab.open { background: var(--sky-2); }
.chat-fab.floating {
  position: fixed;
  z-index: 40;
  right: max(12px, env(safe-area-inset-right));
  top: max(10px, env(safe-area-inset-top));
}
.chat-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 99px;
  animation: bubIn .3s var(--ease-pop) backwards;
}

.chat-panel {
  position: fixed;
  z-index: 45;
  right: max(10px, env(safe-area-inset-right));
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  width: min(340px, calc(100vw - 20px));
  max-height: min(58vh, 460px);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--ink);
  font-family: var(--f-ui);
  overflow: hidden;
  animation: bubIn .25s var(--ease-pop) backwards;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  background: var(--sun);
  border-bottom: 3px solid var(--ink);
}
.chat-panel.team .chat-head { background: var(--teal-2); }
.chat-title { font-family: var(--f-display); font-weight: 400; font-size: 16px; }
.chat-tabs { display: flex; gap: 4px; margin-left: auto; }
.chat-tab, .chat-x, .chat-send {
  font: inherit;
  font-weight: 900;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 99px;
  cursor: pointer;
}
.chat-tab { padding: 3px 10px; font-size: 12px; }
.chat-tab.on { color: #fff; background: var(--ink); }
.chat-x { width: 28px; height: 28px; font-size: 13px; flex: none; }
.chat-tabs.hidden + .chat-x { margin-left: auto; }

.chat-list {
  flex: 1;
  min-height: 90px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overscroll-behavior: contain;
}
.chat-empty { margin: auto; font-size: 12px; font-weight: 700; opacity: .55; }
.chat-msg {
  align-self: flex-start;
  max-width: 85%;
  padding: 5px 10px 6px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px 12px 12px 4px;
}
.chat-msg.mine { align-self: flex-end; background: var(--sky-2); border-radius: 12px 12px 4px 12px; }
.chat-msg.team { background: var(--teal-2); }
.chat-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.chat-tag {
  font-style: normal;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 0 5px;
  color: #fff;
  background: var(--ink);
  border-radius: 99px;
}
.chat-text { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; white-space: pre-wrap; }

.chat-hint { padding: 6px 12px; font-size: 12px; font-weight: 800; background: var(--lav); border-top: 2px solid var(--ink); }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 3px solid var(--ink); }
.chat-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  /* 16px: con menos, el iPhone hace zoom al tocar el campo */
  font: 700 16px var(--f-ui);
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 99px;
  outline: none;
}
.chat-input:focus { box-shadow: 0 0 0 3px var(--sky-2); }
.chat-input:disabled { opacity: .5; }
.chat-send { width: 42px; flex: none; font-size: 16px; background: var(--sun); }

/* globito de lo que llega con el panel cerrado */
.chat-peek {
  position: fixed;
  z-index: 44;
  right: max(10px, env(safe-area-inset-right));
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  max-width: min(300px, calc(100vw - 20px));
  padding: 6px 12px 7px;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 4px 0 var(--ink);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.chat-peek.team { background: var(--teal-2); }
.chat-peek.show { animation: bubIn .3s var(--ease-pop) backwards; }
