/* Social surfaces use the existing Neon Commons palette and spacing scale. */
#chat-toggle {
  display: flex;
  align-items: center;
  gap: var(--s3);
  border-radius: var(--radius-md);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.chat-icon {
  color: var(--accent);
  font-size: var(--lg);
}
#online-count {
  color: var(--muted);
  font-weight: 400;
}
#chat-unread {
  display: grid;
  place-items: center;
  min-width: var(--s6);
  height: var(--s6);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  font: 700 var(--xs) var(--mono);
}
#chat-body {
  width: 344px;
  padding: var(--s4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.chat-heading,
.chat-meta,
.chat-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.chat-heading {
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--border);
}
.chat-heading .eyebrow {
  color: var(--accent);
  font-size: var(--xs);
  letter-spacing: 1px;
}
.chat-heading h2 {
  margin: var(--s1) 0 0;
  font-size: var(--lg);
  letter-spacing: -0.4px;
}
#chat-close {
  padding: 0;
  width: 44px;
  height: 44px;
  font-size: var(--xl);
  border: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
#chat-log {
  height: 208px;
  padding: var(--s3) 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.chat-message {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.chat-message canvas {
  width: 28px;
  height: 38px;
  image-rendering: pixelated;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.chat-message-meta {
  margin-bottom: var(--s1);
}
.chat-message strong {
  font-size: var(--sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-message.own strong {
  color: var(--accent);
}
.chat-message time {
  font: var(--xs) var(--mono);
  color: var(--muted);
  flex: none;
}
#chat-log .chat-message p {
  margin: 0;
  font-size: var(--sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#chat-empty {
  margin: 0;
  padding: var(--s6) var(--s3);
  text-align: center;
  font-size: var(--sm);
  line-height: 1.6;
}
#chat-empty span {
  color: var(--muted);
}
#chat-log:empty {
  display: none;
}
#chat-form {
  gap: var(--s2);
}
#chat-input {
  min-height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--base);
}
#chat-input::placeholder {
  color: var(--muted);
}
#chat-send {
  width: 44px;
  padding: 0;
  flex: none;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--xl);
}
#chat-send:disabled {
  cursor: wait;
  opacity: 0.55;
}
.chat-meta {
  align-items: flex-start;
  padding-top: var(--s2);
  color: var(--muted);
  font-size: var(--xs);
  line-height: 1.4;
}
#chat-count {
  white-space: nowrap;
  font-family: var(--mono);
}
#chat-error {
  margin: var(--s2) 0 0;
  color: var(--gold);
  font-size: var(--sm);
}
#reactions {
  position: fixed;
  z-index: 9;
  right: var(--s6);
  bottom: 84px;
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow);
}
#reactions .eyebrow {
  color: var(--muted);
  font-size: var(--xs);
  letter-spacing: 1px;
}
#reactions > div {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s2);
}
#reactions button {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--xl);
  border-radius: var(--radius-md);
  background: var(--surface);
}
#reactions button:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
#reactions button:active {
  transform: translateY(0);
}
body.in-lobby #reactions {
  display: none;
}
@media (max-width: 600px) {
  #chat-toggle {
    padding: var(--s2) var(--s3);
    gap: var(--s2);
  }
  #chat-toggle kbd {
    display: none;
  }
  body.chat-open #chat {
    right: var(--s3);
    left: var(--s3);
    bottom: max(var(--s3), env(safe-area-inset-bottom));
    z-index: 12;
  }
  body.chat-open #chat-toggle {
    display: none;
  }
  #chat-body {
    width: 100%;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    padding: var(--s3);
  }
  #chat-log {
    height: min(160px, 22dvh);
  }
  #chat-input {
    font-size: 16px;
  }
  body.chat-open #touch-controls,
  body.chat-open #action-dock,
  body.chat-open footer {
    visibility: hidden;
  }
  #reactions {
    right: var(--s3);
    bottom: 230px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #reactions button:hover {
    transform: none;
  }
}
