.social-row { display: flex; align-items: center; gap: 8px; }
.social-row > input, .social-row > span { min-width: 0; flex: 1; }
.quick-play { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule2); }
.quick-play.hidden { display: none; }
.quick-play .eyebrow { margin-right: 4px; }
.quick-play .fine { flex-basis: 100%; margin: 0; }
.create-private { margin-top: 12px; font-size: 14px; }
.create-private .fine { margin-left: 2px; }
.social-access { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--rule2); font-size: 14px; }
.social-access summary { cursor: pointer; font-weight: 500; }
.social-access label:not(.social-check) { display: block; margin: 10px 0 5px; }
.social-access input[type="password"], .social-panel input, .social-dialog input { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper); border-radius: 2px; }
.social-check { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
#room-clear-password { margin-top: 10px; }
.social-dialog { color: var(--ink); width: min(420px, calc(100vw - 28px)); border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); padding: 24px; }
.social-dialog::backdrop { background: #07150ebd; }
.social-dialog .social-row { margin-top: 16px; justify-content: flex-end; }
.social-dialog label { display: block; margin-bottom: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- room chat: header / action-rail buttons with an unread badge */
.room-head-actions { display: flex; gap: 8px; justify-content: flex-end; }
.chat-btn { position: relative; }
.chat-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--tvred); color: #fff; font: 700 12px/20px var(--f-body); letter-spacing: 0; text-align: center; box-shadow: 0 0 0 2px var(--paper); }
.actions .chat-badge { top: 2px; right: 2px; box-shadow: 0 0 0 2px var(--slab); }
.chat-btn.on { color: var(--ink); border-color: var(--ink2); }
.actions .chat-btn.on { color: var(--acc); }
.chat-toast { cursor: pointer; pointer-events: auto; }
.chat-toast .t-v { letter-spacing: .02em; font-family: var(--f-body); font-weight: 500; max-width: min(60vw, 420px); }

/* ---- the panel: anchored beside the action rail on wide screens */
.chat-scrim { position: fixed; inset: 0; z-index: 24; background: rgba(7, 21, 14, .42); }
@media (min-width: 561px) { .chat-scrim { display: none; } }
.social-panel { position: fixed; z-index: 25; display: flex; flex-direction: column;
  right: calc(16px + var(--sa-r)); bottom: calc(16px + var(--sa-b)); width: 360px; height: min(480px, calc(100dvh - 120px - var(--sa-t) - var(--sa-b)));
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 16px 48px rgba(0, 0, 0, .45); overflow: hidden; }
body.in-game .social-panel { right: auto; left: calc(var(--gut) + var(--sa-l) + 170px); bottom: calc(var(--gut) + var(--sa-b)); }
.social-panel.hidden { display: none; }
.social-panel header { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--rule2); }
.social-panel h2 { font-size: 20px; }
.chat-sub { flex: 1; color: var(--ink2); font-size: 13px; }
.chat-grab { display: none; }
.chat-x { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink2); }
.chat-x:hover { background: var(--paper2); color: var(--ink); }
.chat-x .ico { width: 20px; height: 20px; }
#chat-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; padding: 12px 16px 4px; font-size: 15px; line-height: 1.35; }
.chat-empty { color: var(--ink2); font-size: 14px; text-align: center; margin: 24px 8px; }
.chat-msg { margin-top: 12px; }
.chat-msg.grouped { margin-top: 3px; }
.chat-msg:first-child { margin-top: 0; }
.chat-who { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 13px; }
.chat-who b { font-weight: 600; }
.chat-watching { font-weight: 500; font-size: 11px; color: var(--ink2); text-transform: uppercase; letter-spacing: .08em; }
.chat-who time { color: var(--ink2); font-size: 12px; margin-left: auto; }
.chat-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.chat-msg p { display: inline-block; max-width: 100%; margin: 0; padding: 7px 11px; background: #fff8; border: 1px solid var(--rule2); border-radius: 4px 14px 14px 14px; }
.chat-msg.mine { text-align: right; }
.chat-msg.mine .chat-who { flex-direction: row-reverse; }
.chat-msg.mine .chat-who time { margin-left: 0; margin-right: auto; }
.chat-msg.mine p { background: var(--ink); color: var(--paper); border-color: var(--ink); border-radius: 14px 4px 14px 14px; text-align: left; }
#chat-form { flex: none; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rule2); background: var(--paper); }
#chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 22px; background: #fff; font-size: 16px; }
#chat-form input:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
#chat-form .btn { min-height: 44px; border-radius: 22px; }

/* ---- phones: a bottom sheet that rides above the on-screen keyboard */
@media (max-width: 560px) {
  .social-panel, body.in-game .social-panel {
    left: 0; right: 0; width: auto; bottom: var(--chat-kb, 0px); border-radius: 16px 16px 0 0; border-bottom: 0;
    height: min(62dvh, calc(var(--chat-vh, 100dvh) - 48px - var(--sa-t)));
    animation: chat-up .22s var(--ease) both; }
  .social-panel header { position: relative; padding-top: 16px; }
  .chat-grab { display: block; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--rule); }
  #chat-form { padding-bottom: calc(10px + var(--sa-b)); }
  body.chat-on #toasts { visibility: hidden; }
}
@media (max-width: 560px) { .room-head .chat-btn { padding-inline: 13px; } .room-head .chat-btn .lbl { display: none; } }
@keyframes chat-up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .social-panel { animation: none; } }

/* ---- host removal lives on the pairing row: tap ×, then "Remove?" to confirm */
.pr .kick-x { width: auto; min-width: 18px; gap: 4px; padding: 0 2px; display: inline-flex; align-items: center; }
.pr .kick-x.armed { background: var(--red); color: #fff; padding: 0 6px; }
.kick-lbl { font: 600 12px/1 var(--f-body); }
.kick-lbl:empty { display: none; }
@media (pointer: coarse) { .pr .bot-x { min-width: 36px; height: 36px; margin: -7px -6px -7px 0; } }
