/* Social: online counter, lobby chat (floating button + panel / bottom sheet), sponsor card. */

/* ---- online counter in the header ---- */
.online {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 12px; border-radius: 999px;
  font-size: var(--step--1); font-weight: 800; color: var(--mute); background: var(--card-2); box-shadow: 0 0 0 1px var(--line) inset;
  white-space: nowrap; cursor: default;
}
.online .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--win); box-shadow: 0 0 8px var(--win); animation: online-pulse 1.6s ease-in-out infinite; }
.online .num { color: var(--ink); }
@keyframes online-pulse { 50% { opacity: 0.45; } }

/* ---- chat ---- */
.chat { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: grid; justify-items: end; gap: 10px; }
.chat-fab {
  position: relative; width: 54px; height: 54px; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.45rem; line-height: 1;
  color: #fff; background: linear-gradient(140deg, var(--violet), #6b3fe0);
  box-shadow: 0 14px 30px -12px rgba(139, 92, 255, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab.is-open { background: var(--card-2); box-shadow: 0 0 0 1px var(--line-2) inset; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font: 800 11px/1 var(--font); color: #1d0a14; background: var(--lose);
  box-shadow: 0 0 0 2px var(--bg);
}
.chat-panel {
  width: 380px; max-width: calc(100vw - 36px); height: min(560px, calc(100vh - 120px));
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; border-radius: var(--r-lg); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow), 0 0 0 1px var(--line-2) inset, 0 30px 60px -20px rgba(0, 0, 0, 0.9);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 1rem; }
.chat-close {
  width: 34px; height: 34px; border: 0; border-radius: 999px; cursor: pointer; font-size: 1.2rem; line-height: 1;
  color: var(--mute); background: rgba(255, 255, 255, 0.06);
}
.chat-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.12); }
.chat-empty { padding: 14px 16px 0; }
.chat-empty[hidden] { display: none; }
.chat-list { margin: 0; padding: 10px 12px; list-style: none; display: grid; gap: 10px; align-content: start; overflow-y: auto; scrollbar-width: thin; }
.chat-m { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.chat-m .ava { width: 30px; height: 30px; }
.chat-body { min-width: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; }
.chat-name { font-weight: 800; font-size: var(--step--1); color: var(--violet-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-m.is-me .chat-name { color: var(--gold); }
.chat-time { font-size: 11px; color: var(--dim); }
.chat-text { margin: 2px 0 0; font-size: var(--step-0); line-height: 1.4; overflow-wrap: anywhere; }
.chat-del {
  width: 24px; height: 24px; border: 0; border-radius: 6px; cursor: pointer; color: var(--mute); background: transparent; font-size: 1rem; line-height: 1;
}
.chat-del:hover { color: var(--lose); background: rgba(255, 61, 110, 0.12); }
.chat-foot { padding: 10px 12px 0; border-top: 1px solid var(--line); }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.chat-input {
  min-width: 0; height: 42px; padding: 0 14px; border: 0; border-radius: var(--r-sm); font: inherit; color: var(--ink); background: var(--well);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.chat-input:focus { outline: 0; box-shadow: 0 0 0 1px var(--violet) inset; }
.chat-send { min-height: 42px; padding: 0 16px; }
.chat-cta { width: 100%; }
.chat-tg { display: grid; gap: 8px; }
.chat-muted { color: var(--lose); }
.chat-msg { min-height: 18px; margin: 0; padding: 6px 14px 10px; }

/* polish: the bottom game rail is gone (v5.1), so the button sits just above the home indicator */
@media (max-width: 900px) {
  .chat { bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .chat { right: 0; left: 0; bottom: 0; padding: 0 12px calc(18px + env(safe-area-inset-bottom)); pointer-events: none; }
  .chat > * { pointer-events: auto; }
  .chat-panel { width: 100%; max-width: none; height: min(70vh, 560px); border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .chat-panel:not([hidden]) ~ .chat-fab, .chat:has(.chat-panel:not([hidden])) .chat-fab { display: none; }
  .chat:has(.chat-panel:not([hidden])) { padding: 0; bottom: 0; }
}

/* ---- sponsor card ---- */
.sp-card {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-top: 14px; padding: 14px 18px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(139, 92, 255, 0.14), rgba(31, 224, 138, 0.08));
  box-shadow: var(--shadow), 0 0 0 1px rgba(139, 92, 255, 0.3) inset;
}
.sp-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.sp-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; flex: 1; }
.sp-name { font: 800 var(--step-1)/1.2 var(--display); color: var(--ink); text-decoration: none; }
a.sp-name:hover { color: var(--violet-2); text-decoration: underline; }
.sp-text { margin: 0; color: var(--mute); }
