/* ========== TABLE TALK CHAT PANEL ========== */
.table-talk-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 220px;
  bottom: 150px; /* don't cover the hand area */
  background: rgba(0, 0, 0, 0.85);
  border-left: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  z-index: var(--z-chat);
  transition: transform 0.3s ease;
  transform: translateX(100%);
}

.table-talk-panel.table-talk-visible {
  transform: translateX(0);
}

.table-talk-panel.table-talk-collapsed {
  transform: translateX(100%);
}

.table-talk-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.table-talk-title {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--gold);
  flex: 1;
}

.table-talk-collapsed-hint {
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-talk-toggle {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  white-space: nowrap;
  min-width: 44px;
  min-height: 44px;
}

.table-talk-toggle:hover {
  background: rgba(218, 165, 32, 0.2);
}

.table-talk-close {
  font-size: 0.8rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  opacity: 0.5;
  padding: 0 2px;
  min-width: 44px;
  min-height: 44px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-talk-close:hover {
  opacity: 1;
}

.table-talk-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.table-talk-msg {
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 1px 0;
  word-break: break-word;
}

.table-talk-msg-name {
  color: var(--gold);
  font-weight: bold;
  margin-right: 4px;
}

.table-talk-msg-name::after {
  content: ':';
  color: var(--text);
  opacity: 0.6;
}

.table-talk-msg-text {
  color: var(--text);
}

.table-talk-input-row {
  display: flex;
  padding: 4px 6px;
  gap: 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.table-talk-input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 0.75rem;
}

.table-talk-input::placeholder {
  color: #b8b8b8;
  opacity: 1;
}

.table-talk-send-btn {
  padding: 4px 8px;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--bg);
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  min-width: 44px;
  min-height: 44px;
}

.table-talk-send-btn:hover {
  background: #c4941d;
}

/* Adjust hand-area width when chat panel is visible.
   Scoped to the desktop right-rail layout (mirrors the mobile media query,
   so the full-width mobile chat keeps its own handling above). */
@media (min-width: 769px) and (pointer: fine), (min-width: 1025px) {
  body.chat-open #hand-slot > .hand-area {
    right: 220px;
  }
}

/* Floating chat toggle button — always visible when chat hidden, host only */
.chat-floater {
  position: fixed;
  bottom: 160px;
  right: 12px;
  z-index: var(--z-panel);
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--gold);
  background: rgba(0, 0, 0, 0.8);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-floater:hover {
  background: var(--gold);
  color: var(--bg);
}

/* ========== MOBILE RESPONSIVE (extracted per-component from the style.css mega-block) ========== */
@media (max-width: 768px), (min-width: 769px) and (max-width: 1024px) and (pointer: coarse) {
  /* Table Talk — full-width at bottom on mobile */
  .table-talk-panel {
    width: 100%;
    top: auto;
    bottom: 0;
    /* Keep the panel (and its send button) within the viewport on short screens. */
    max-height: 40vh;
    border-left: none;
    border-top: 2px solid var(--gold);
    transform: translateY(100%);
  }

  .table-talk-panel.table-talk-visible {
    transform: translateY(0);
  }

  .table-talk-panel.table-talk-collapsed {
    transform: translateY(calc(100% - 45px));
  }

  body.chat-open #hand-slot > .hand-area {
    right: 0;
    bottom: 40vh;
  }

  .table-talk-input {
    font-size: 0.85rem;
    padding: 6px 8px;
  }

  .table-talk-send-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
    min-height: 44px;
  }
}
