/* ============================================================
   Chat Dock — global lobby chat overlay (jam edition)
   Mounted to document.body, fixed bottom-left, z-index 200.
   Visible on every screen because it's outside .menu-stage and
   the combat root.
   ============================================================ */

.chat-dock {
  position: fixed;
  left: 22px; bottom: 22px;
  z-index: 200;
  font-family: var(--font-body, 'Crimson Text', serif);
}

/* ── Bubble (always visible) ──────────────────────────────── */
.chat-bubble {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a1810, #0d0805 75%);
  border: 1.5px solid var(--gold, #c9a84c);
  box-shadow:
    0 8px 22px rgba(0,0,0,0.6),
    0 0 14px rgba(201,168,76,0.35),
    inset 0 1px 0 rgba(255,230,150,0.25);
  color: var(--gold-light, #e8c96d);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.chat-bubble:hover { transform: scale(1.06); }

.chat-bubble.is-pulsing {
  animation: chatBubblePulse 1.6s ease-in-out infinite;
}
@keyframes chatBubblePulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(0,0,0,0.6), 0 0 14px rgba(201,168,76,0.35), inset 0 1px 0 rgba(255,230,150,0.25); }
  50%      { box-shadow: 0 8px 22px rgba(0,0,0,0.6), 0 0 0 6px rgba(201,168,76,0.18), 0 0 22px rgba(201,168,76,0.6), inset 0 1px 0 rgba(255,230,150,0.25); }
}

.chat-bubble-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--team-b, #cc4444);
  color: #fff8ee;
  font-family: var(--font-mono, 'Courier New', monospace);
  font-weight: 700; font-size: 10.5px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid #1a0408;
  box-shadow: 0 2px 8px rgba(204,68,68,0.6);
}

/* ── Panel (morphs from the bubble's centre) ──────────────── */
.chat-panel {
  position: absolute;
  left: 0; bottom: 0;
  width: 340px; height: 440px;
  transform-origin: 26px 26px;        /* centre of the 52px bubble */
  transform: scale(0.05);
  opacity: 0;
  pointer-events: none;
  filter: blur(2px);
  background: linear-gradient(180deg, rgba(20,12,8,0.96), rgba(10,6,4,0.98));
  border: 1px solid var(--gold, #c9a84c);
  border-radius: 16px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.7),
    0 0 22px rgba(201,168,76,0.25),
    inset 0 1px 0 rgba(255,230,150,0.08);
  display: flex; flex-direction: column; overflow: hidden;
  backdrop-filter: blur(10px);
  transition:
    transform 280ms cubic-bezier(0.4, 0, 0.6, 1),
    opacity 180ms ease-in,
    filter 200ms ease;
}
.chat-dock.is-open .chat-panel {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
  filter: blur(0);
  transition:
    transform 360ms cubic-bezier(0.34, 1.32, 0.64, 1),
    opacity 220ms 60ms ease-out,
    filter 200ms ease;
}

/* ── Panel header ─────────────────────────────────────────── */
.chat-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gold-line, rgba(201,168,76,0.3));
  background: linear-gradient(180deg, rgba(40,28,18,0.7), rgba(20,12,8,0.7));
  flex-shrink: 0;
}
.chat-panel-header-left {
  display: flex; align-items: center; gap: 10px;
}
.chat-panel-header-left .chat-icon { color: var(--gold-light, #e8c96d); }
.chat-panel-header-labels {
  display: flex; flex-direction: column;
}
.chat-panel-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-weight: 700; font-size: 12px; letter-spacing: 2px;
  color: var(--text-bright, #f5ecd6);
  text-transform: uppercase;
}
.chat-panel-subtitle {
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: 9px; opacity: 0.55;
  color: var(--text-dim, #a89b80);
  margin-top: 1px;
}
.chat-panel-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--gold-line, rgba(201,168,76,0.3));
  color: var(--gold-light, #e8c96d);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .18s ease, border-color .18s ease;
}
.chat-panel-close:hover {
  background: rgba(232,201,109,0.12);
  border-color: var(--gold-light, #e8c96d);
}

/* ── Scroll list ──────────────────────────────────────────── */
.chat-panel-scroll {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  scrollbar-color: rgba(201,168,76,0.4) transparent;
  scrollbar-width: thin;
}
.chat-panel-scroll::-webkit-scrollbar      { width: 6px; }
.chat-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-panel-scroll::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.4); border-radius: 3px; }

/* ── Message row ──────────────────────────────────────────── */
.chat-msg {
  display: flex; flex-direction: row; gap: 8px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.chat-msg-mine { flex-direction: row-reverse; }
.chat-msg-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.chat-msg-dot-necro    { background: radial-gradient(circle at 35% 35%, #a060d0, #3a1f4a); }
.chat-msg-dot-beast    { background: radial-gradient(circle at 35% 35%, #a8c050, #2a3a14); }
.chat-msg-dot-machinas { background: radial-gradient(circle at 35% 35%, #9070ff, #2a1a4a); }
.chat-msg-dot-knight   { background: radial-gradient(circle at 35% 35%, #e8c96d, #4a3a14); }

.chat-msg-body {
  flex: 0 1 auto;
  max-width: 78%;
  min-width: 0;
}
.chat-msg-head {
  display: flex; gap: 6px; align-items: baseline;
  margin-bottom: 3px;
}
.chat-msg-mine .chat-msg-head { flex-direction: row-reverse; }
.chat-msg-who {
  font-family: var(--font-display, 'Cinzel', serif);
  font-weight: 700; font-size: 10.5px; letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.chat-msg-time {
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: 8.5px; opacity: 0.4;
  color: var(--text-dim, #a89b80);
}
.chat-msg-bubble {
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text, #e0d8c0);
  font-size: 12.5px;
  line-height: 1.45;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-msg-mine .chat-msg-bubble { text-align: right; }

/* ── Composer ─────────────────────────────────────────────── */
.chat-panel-composer {
  padding: 10px;
  border-top: 1px solid var(--gold-line, rgba(201,168,76,0.3));
  background: rgba(0,0,0,0.4);
  display: flex; gap: 8px; align-items: center;
  flex-shrink: 0;
}
.chat-panel-input {
  flex: 1;
  padding: 9px 12px;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--gold-line, rgba(201,168,76,0.3));
  border-radius: 999px;
  color: var(--text-bright, #f5ecd6);
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: 12px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.chat-panel-input:focus {
  border-color: var(--gold-light, #e8c96d);
  box-shadow: 0 0 0 2px rgba(232,201,109,0.18);
}
.chat-panel-input.is-throttled {
  animation: chatThrottleShake .32s ease-out;
  border-color: var(--team-b, #cc4444);
}
@keyframes chatThrottleShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-4px); }
  40%     { transform: translateX(4px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}
.chat-panel-send {
  padding: 8px 14px;
  font-size: 11px;
  font-family: var(--font-display, 'Cinzel', serif);
  font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-light, #e8c96d), var(--gold, #c9a84c) 55%, var(--gold-dark, #8a6d2a));
  color: #1a0f04;
  border: 1px solid #f0d27a;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(201,168,76,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: filter .12s ease, transform .12s ease;
}
.chat-panel-send:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.chat-panel-send:active { transform: translateY(0); }
