/* BGF Chat & Profile — extra styles on top of cabinet-styles.css
 * --------------------------------------------------------------
 * Chat: 3-col shell with my-chats list / message thread / table info rail
 * Profile: hero + stats + collection + history + actions
 */

/* ════════════════════════════════════════════════════════════════════
 * CHAT PAGE
 * ════════════════════════════════════════════════════════════════════ */

.cab-shell.chat {
  grid-template-columns: 280px 1fr 280px;
  height: calc(100vh - 64px - 40px);
  height: calc(100dvh - 64px - 40px);
  padding: 20px;
}
@media (max-width: 1280px) {
  .cab-shell.chat { grid-template-columns: 280px 1fr; }
  .chat-rail { display: none; }
}

/* Drawer close buttons and mobile-only toggles live in markup but are desktop-hidden. */
.drawer-close { display: none; }
.chat-main .ib.mobile-only { display: none; }
.mobile-backdrop { display: none; }

/* threads list — left rail */
.chat-threads {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}
.chat-threads .head {
  padding: 14px 16px;
  border-bottom: 2px solid var(--ink);
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-threads .head h3 {
  margin: 0; font-family: var(--font-pixel); font-size: 10px; letter-spacing: 0.06em;
}
.chat-threads .head .count {
  font-family: var(--font-pixel); font-size: 9px; color: var(--ink-3);
}
.thread-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}
.thread {
  padding: 14px 16px;
  border-bottom: 2px solid var(--border-subtle);
  cursor: pointer;
  display: flex; gap: 12px;
  transition: background 90ms steps(2);
  position: relative;
}
.thread:hover { background: var(--bg-2); }
.thread.on { background: var(--accent-tint); border-left: 4px solid var(--accent); padding-left: 12px; }
.thread .cov {
  width: 36px; height: 36px;
  flex-shrink: 0;
  background: var(--accent);
  border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-pixel); font-size: 10px;
}
.thread .meta { flex: 1; min-width: 0; }
.thread .meta .top {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.thread .meta .name {
  font-family: var(--font-pixel); font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thread .meta .time {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
}
.thread .meta .preview {
  font-family: var(--font-body); font-size: 12px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 3px;
}
.thread .meta .preview.unread { color: var(--ink); font-weight: 600; }
.thread .unread-pip {
  position: absolute; top: 14px; right: 16px;
  background: var(--red-500); color: #fff;
  font-family: var(--font-pixel); font-size: 7px;
  padding: 3px 5px;
  min-width: 16px; text-align: center;
  border: 1.5px solid var(--ink);
}

/* main chat pane */
.chat-main {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
  min-height: 0;
}
.chat-main .top {
  padding: 14px 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--bg-2);
  display: flex; align-items: center; gap: 14px;
}
.chat-main .top .cov {
  width: 40px; height: 40px;
  background: var(--accent);
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-pixel); font-size: 11px;
  flex-shrink: 0;
}
.chat-main .top .who { flex: 1; min-width: 0; }
.chat-main .top h2 {
  margin: 0 0 2px;
  font-family: var(--font-pixel); font-size: 14px; letter-spacing: 0.02em;
  color: var(--ink);
}
.chat-main .top .sub {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-2);
  display: inline-flex; gap: 8px; align-items: center;
}
.chat-main .top .sub .dot {
  width: 8px; height: 8px; background: var(--green-500); border: 1.5px solid var(--ink);
  animation: pix-pulse 1.4s steps(2) infinite;
}
.chat-main .top-actions { display: inline-flex; gap: 8px; }
.chat-main .top-actions .ib {
  width: 36px; height: 36px;
  background: var(--surface);
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 90ms steps(2);
}
.chat-main .top-actions .ib:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }

/* pinned info bar */
.pinned {
  padding: 10px 16px;
  background: var(--yellow-300);
  border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-body); font-size: 13px; color: var(--ink);
}
.pinned i { color: var(--yellow-700); }
.pinned b {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.06em;
  color: var(--yellow-700);
}

/* message thread */
.thread-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
  /* light pixel-checker subtle texture */
  background-image:
    linear-gradient(to right, var(--bg-2) 1px, transparent 1px),
    linear-gradient(to bottom, var(--bg-2) 1px, transparent 1px);
  background-size: 16px 16px;
  background-attachment: local;
}
.thread-body::after { content: ""; }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0;
  text-align: center;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 2px; background: var(--ink); opacity: 0.45;
}
.divider span {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.08em; color: var(--ink-2);
  padding: 4px 8px;
  background: var(--surface);
  border: 2px solid var(--ink);
}

.divider.new-divider::before, .divider.new-divider::after {
  background: var(--red-500, #d83a3a); opacity: 1;
}
.divider.new-divider span {
  background: var(--red-500, #d83a3a);
  color: var(--surface, #fff);
  border-color: var(--ink);
}

.sys-msg {
  align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 2px solid var(--ink);
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.06em;
  color: var(--ink-2);
}
.sys-msg i { width: 12px; height: 12px; }
.sys-msg.you { background: var(--purple-100); color: var(--purple-700); border-color: var(--ink); }
.sys-msg.host { background: var(--yellow-300); color: var(--yellow-700); }
.sys-msg.leave { background: var(--red-100); color: var(--red-700); }

.msg-row {
  display: flex; gap: 8px; align-items: flex-end;
  max-width: 72%;
  animation: msgIn 240ms ease-out;
}
@keyframes msgIn {
  from { transform: translateY(8px); }
  to   { transform: translateY(0); }
}
.msg-row .av {
  width: 28px; height: 28px;
  border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-pixel); font-size: 9px;
  flex-shrink: 0;
  cursor: pointer;
}
.msg-row .av:hover { box-shadow: 2px 2px 0 var(--ink); transform: translate(-1px,-1px); }
.msg-row .bubble {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 8px 12px;
  font-family: var(--font-body); font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  position: relative;
}
.msg-row .bubble .who {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.06em;
  color: var(--ink-2); margin-bottom: 4px;
  cursor: pointer;
}
.msg-row .bubble .who:hover { color: var(--ink); }
.msg-row .bubble .who.host::after {
  content: "★"; color: var(--yellow-700); margin-left: 4px;
}
.msg-row .bubble .time {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
  margin-top: 4px;
}
.msg-row.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.me .bubble {
  background: var(--accent); color: #fff;
  border-color: var(--ink);
}
.msg-row.me .bubble .who { color: rgba(255,255,255,0.85); }
.msg-row.me .bubble .time { color: rgba(255,255,255,0.7); }

/* typing indicator */
.typing {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-2);
}
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i {
  width: 6px; height: 6px; background: var(--ink-2);
  animation: typeBlink 900ms steps(2) infinite;
}
.typing .dots i:nth-child(2) { animation-delay: 200ms; }
.typing .dots i:nth-child(3) { animation-delay: 400ms; }
@keyframes typeBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.2; }
}

/* composer */
.composer {
  padding: 14px;
  border-top: 2px solid var(--ink);
  background: var(--surface);
  display: flex; gap: 10px; align-items: flex-end;
}
.composer .pix-input {
  flex: 1; font-size: 15px;
  resize: none;
  line-height: 1.4;
  min-height: 44px;
  max-height: 240px;
  overflow-y: auto;
  font-family: var(--font-body);
}
.composer .ib {
  width: 44px; min-height: 44px;
  background: var(--accent); color: #fff;
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 90ms steps(2), box-shadow 90ms steps(2);
}
.composer .ib.send { width: auto; padding: 0 18px; font-family: var(--font-pixel); font-size: 11px; letter-spacing: 0.05em; gap: 8px; }
.composer .ib:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.composer .ib:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
.composer .ib.secondary { background: var(--surface); color: var(--ink-2); }

/* chat right rail */
.chat-rail {
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
/* The rail is a scroll container — its blocks must keep their natural height
 * instead of being shrunk to fit (flex children default to flex-shrink:1).
 * Without this, tall cards get squeezed and their content is clipped by
 * .table-card's overflow:hidden instead of the rail scrolling. */
.chat-rail > * { flex-shrink: 0; }
.chat-rail .panel-body { padding: 14px; }

.mini-table {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 12px;
}
.mini-table h4 {
  margin: 0 0 8px; font-family: var(--font-pixel); font-size: 13px;
  letter-spacing: 0.02em;
}
.mini-table .mt-meta {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-body); font-size: 13px; color: var(--ink-2);
}
.mini-table .mt-meta div { display: inline-flex; align-items: center; gap: 6px; }
.mini-table .mt-meta i { width: 14px; height: 14px; color: var(--ink-2); }
.mini-table .mt-meta b {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.04em; color: var(--ink);
}

/* ─── Table card — entry point to the table's internal page ─── */
.table-panel .panel-body {
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.table-card {
  display: block;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none; color: inherit;
  overflow: hidden;
  transition: transform 90ms steps(2), box-shadow 90ms steps(2);
}
.table-card:hover {
  transform: translate(-1px,-1px);
  box-shadow: 4px 4px 0 var(--ink);
}
.table-card:active {
  transform: translate(2px,2px);
  box-shadow: 0 0 0 var(--ink);
}

.tc-cover {
  position: relative;
  padding: 14px 12px 26px;
  border-bottom: 2px solid var(--ink);
  background:
    repeating-linear-gradient(135deg,
      rgba(255,255,255,0.10) 0 6px,
      transparent 6px 14px),
    var(--accent);
  color: #fff;
  min-height: 92px;
  display: flex; align-items: flex-end;
}
.tc-cover-id {
  position: absolute; top: 8px; left: 10px;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.85);
}
.tc-cover-status {
  position: absolute; top: 6px; right: 8px;
  background: var(--ink); color: #fff;
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.10em;
  padding: 3px 6px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1.5px solid #fff;
}
.tc-cover-status .tc-dot {
  width: 6px; height: 6px; background: #6BE08F; display: inline-block;
  animation: tc-pulse 1.6s ease-in-out infinite;
}
@keyframes tc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.tc-cover-mark {
  font-family: var(--font-pixel);
  font-size: 32px; line-height: 1;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink);
}
.tc-cover-tag {
  position: absolute; bottom: 7px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.78);
}

/* feature list — replaces meta dump, says WHAT'S on the page */
.tc-features { padding: 12px; }
.tc-feat-h {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.tc-feat-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-top: 1.5px dashed var(--border-subtle, #d8d4c1);
}
.tc-feat-row:first-of-type { border-top: 0; padding-top: 0; }
.tc-feat-row i,
.tc-feat-row > svg { width: 14px; height: 14px; color: var(--ink-2); justify-self: center; }
.tc-feat-row b {
  display: block;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.04em;
  color: var(--ink);
  font-weight: normal;
  margin-bottom: 2px;
}
.tc-feat-row span {
  display: block;
  font-family: var(--font-body); font-size: 11px; line-height: 1.35;
  color: var(--ink-3);
}

.tc-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 0.10em;
}
.tc-foot-arrow {
  font-family: var(--font-mono); font-size: 16px; line-height: 1;
}

/* Result-marking affordance — disabled until after the game */
.result-cta {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2, #f5f3eb);
  border: 1.5px dashed var(--ink);
}
.result-cta-icon {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  color: var(--accent);
}
.result-cta-icon i { width: 18px; height: 18px; }
.result-cta-text { min-width: 0; }
.result-cta-title {
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 3px;
}
.result-cta-sub {
  font-family: var(--font-body); font-size: 11px; line-height: 1.35;
  color: var(--ink-3, var(--ink-2));
}

.countdown-card {
  background: var(--accent);
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 16px 14px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.countdown-card::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.10) 0 6px,
    transparent 6px 14px);
  pointer-events: none;
}
.countdown-card > * { position: relative; }
.countdown-card .lbl {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.1em;
  color: #fff;
  margin-bottom: 11px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.countdown-card .lbl::before {
  content: ''; width: 6px; height: 6px; flex-shrink: 0;
  background: var(--yellow-500); border: 1px solid rgba(0,0,0,0.45);
  animation: tc-pulse 1.6s ease-in-out infinite;
}
.countdown-card .digits {
  font-family: var(--font-pixel); font-size: 24px;
  letter-spacing: 0.04em;
  display: inline-flex; gap: 4px; align-items: stretch;
  justify-content: center;
  max-width: 100%;
}
.countdown-card .digits .seg {
  background: var(--ink); color: #fff;
  padding: 6px 7px 4px;
  border: 2px solid #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  min-width: 0; text-align: center;
  line-height: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.countdown-card .digits .seg .unit {
  font-family: var(--font-pixel); font-size: 7px;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}
.countdown-card .digits .colon { color: #fff; padding: 0 1px; align-self: center; }
.countdown-card .when {
  font-family: var(--font-mono); font-size: 14px; color: #fff;
  margin-top: 11px;
  display: inline-block;
  background: var(--purple-700);
  border: 2px solid #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  padding: 4px 11px;
}

.participant-list { display: flex; flex-direction: column; }
.participant-list .p-row {
  display: flex; gap: 11px; align-items: center;
  padding: 10px 2px;
  border-top: 1.5px dashed var(--border-subtle, #d8d4c1);
  cursor: pointer;
  text-decoration: none; color: inherit;
  transition: background 90ms steps(2);
}
.participant-list .p-row:hover { background: var(--bg-2); }
.participant-list .p-row:first-child { border-top: 0; }
.participant-list .p-row.is-you { cursor: default; }
.participant-list .p-row.is-you:hover { background: transparent; }
.participant-list .p-row .av {
  width: 34px; height: 34px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-pixel); font-size: 10px;
  flex-shrink: 0;
}
.participant-list .p-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.participant-list .p-row .meta .name {
  font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--ink);
  line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.participant-list .p-row .role-badge {
  align-self: flex-start;
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.06em; line-height: 1;
  padding: 3px 5px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.participant-list .p-row .role-badge.host { background: var(--yellow-500); }
.participant-list .p-row .role-badge.co-host { background: var(--accent); color: #fff; }
.participant-list .p-row .role-badge.you { background: var(--ink); color: #fff; }
.participant-list .p-row .role-badge.participant { background: var(--surface); color: var(--ink-3); }
.participant-list .p-row .p-go {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--ink-3);
  align-self: center;
  opacity: 0; transform: translateX(-3px);
  transition: opacity 90ms steps(2), transform 90ms steps(2);
}
.participant-list .p-row:hover .p-go { opacity: 1; transform: translateX(0); }

/* ─── MOBILE: off-canvas drawers for threads list + info rail ────── */
@media (max-width: 880px) {
  /* Top bar: trim brand wordmark, drop me-text. Scoped to chat via :has()
   * so other cabinet pages keep their existing mobile top bar. */
  .cabinet-root:has(.cab-shell.chat) .cab-top { gap: 12px; padding: 0 12px; }
  /* Brand logo height is not pinned here — cabinet-shell.css ties it to the
   * top-bar height so it fits the slimmer mobile bar automatically. */
  .cabinet-root:has(.cab-shell.chat) .cab-top .crumb { font-size: 9px; gap: 6px; overflow: hidden; min-width: 0; }
  .cabinet-root:has(.cab-shell.chat) .cab-top .crumb .crumb-mid { display: none; }
  .cabinet-root:has(.cab-shell.chat) .cab-top .me { padding: 4px; }
  .cabinet-root:has(.cab-shell.chat) .cab-top .me .me-text { display: none; }
  .cabinet-root:has(.cab-shell.chat) .cab-top .top-actions { gap: 6px; }

  /* Shell: single column, full-bleed chat. No padding so the chat reaches
   * the viewport edges; bottom-nav is hidden via cabinet-shell.css so we
   * can use the full height under the top bar. */
  .cabinet-root .cab-shell.chat {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    position: relative;
  }
  /* Sub-grid collapses to single column too (cab-main wraps threads + chat-main). */
  .cabinet-root .cab-shell.chat > .cab-main {
    grid-template-columns: 1fr;
  }
  /* Drop chat-main's border/shadow on mobile — it's full-bleed and visually
   * doesn't need a card frame. */
  .cab-shell.chat .chat-main {
    border: 0;
    box-shadow: none;
  }

  /* Threads drawer — slides from the LEFT */
  .chat-threads {
    position: fixed;
    top: 64px; bottom: 0; left: 0;
    width: min(88vw, 340px);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 6px 0 0 var(--ink);
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    border-right: 2px solid var(--ink);
    border-left: 0;
  }
  .pane-threads .chat-threads { transform: translateX(0); }
  /* Inner list owns the scroll; give it momentum + clear the device safe-area
   * so the last thread row isn't hidden behind the iOS home bar. */
  .chat-threads .thread-list {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Info rail — slides from the RIGHT */
  .chat-rail {
    display: flex;
    position: fixed;
    top: 64px; bottom: 0; right: 0;
    width: min(88vw, 340px);
    z-index: 60;
    transform: translateX(105%);
    transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
    background: var(--bg);
    /* Extra bottom padding so the last block's hard offset shadow and the
     * device safe-area (iOS home bar) clear the viewport edge — otherwise the
     * tail of a tall rail looks cut off. */
    padding: 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    border-left: 2px solid var(--ink);
    box-shadow: -6px 0 0 var(--ink);
  }
  .pane-rail .chat-rail { transform: translateX(0); }

  /* Backdrop — appears when any drawer is open */
  .mobile-backdrop {
    display: block;
    position: fixed;
    top: 64px; left: 0; right: 0; bottom: 0;
    background: rgba(26, 24, 32, 0.45);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .pane-threads .mobile-backdrop,
  .pane-rail    .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Drawer close (X) button — top-right inside each drawer head */
  .drawer-close {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--surface);
    border: 2px solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    cursor: pointer;
    padding: 0;
  }
  .drawer-close i,
  .drawer-close svg { width: 16px; height: 16px; }
  .drawer-close:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
  .rail-close {
    position: absolute;
    top: 16px; right: 16px;
    z-index: 2;
  }

  /* Toggle buttons in chat-main top bar */
  .chat-main .ib.mobile-only { display: inline-flex; }
  .chat-main .top-actions .ib.desk-only { display: none; }
  .chat-main .top { gap: 10px; padding: 10px 12px; }
  .chat-main .top .cov { width: 36px; height: 36px; font-size: 10px; }
  .chat-main .top h2 { font-size: 12px; }
  .chat-main .top .sub { font-size: 12px; }
  .chat-main .top .ib.mobile-only {
    width: 36px; height: 36px;
    background: var(--surface);
    border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }
  .chat-main .top .ib.mobile-only:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }

  /* Info button styles moved to cabinet-shell.css so they load AFTER
   * the skin overrides (bgf-bitup-soft-pages.css, bitup-skin.css) and
   * cannot be clobbered. */

  /* Pinned address row — wrap nicely on narrow screens */
  .pinned { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; font-size: 12px; }
  .pinned b { font-size: 8px; }

  /* Message bubbles: more breathing room on mobile */
  .msg-row { max-width: 86%; }
  .msg-row .bubble { padding: 7px 10px; font-size: 14px; }
  .thread-body { padding: 14px 10px; gap: 8px; }

  /* Composer: input on top (full width, multiline), action buttons below.
   * Pinned to the bottom of .chat-main via flex (thread-body has flex:1). */
  .composer {
    padding: 10px;
    gap: 6px;
    flex-wrap: wrap;
    align-items: stretch;
    flex-shrink: 0;
  }
  .composer .pix-input {
    flex: 1 1 100%;
    order: -1;
    font-size: 16px;
    min-height: 40px;
    max-height: 40vh;
    resize: none;
    line-height: 1.4;
    overflow-y: auto;
    padding: 9px 12px;
    font-family: var(--font-body);
  }
  .composer .ib { width: 40px; min-height: 40px; box-shadow: 2px 2px 0 var(--ink); }
  .composer .ib.send {
    width: auto; padding: 0 14px; margin-left: auto;
    font-size: 10px;
  }

  /* Drawer head accommodates close button */
  .chat-threads .head { position: relative; padding-right: 56px; }

  /* Inside-drawer rail: stack panels comfortably */
  .chat-rail .panel-head h3 { font-size: 11px; }
  .countdown-card .digits { font-size: 18px; }
}

/* Very narrow screens — go even tighter */
@media (max-width: 420px) {
  .cabinet-root:has(.cab-shell.chat) .cab-top .me { gap: 0; }
  .cabinet-root:has(.cab-shell.chat) .cab-top .crumb { display: none; }
  .chat-main .top h2 { font-size: 11px; }
  .chat-main .top .sub { font-size: 11px; }
  .msg-row { max-width: 92%; }
}

/* ════════════════════════════════════════════════════════════════════
 * PROFILE PAGE
 * ════════════════════════════════════════════════════════════════════ */

.cab-shell.profile {
  grid-template-columns: 1fr 320px;
  padding: 28px 20px;
}
@media (max-width: 1100px) { .cab-shell.profile { grid-template-columns: 1fr; } }

.profile-hero {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 28px;
  display: flex; gap: 28px;
  position: relative;
  overflow: hidden;
}
.profile-hero .av-big {
  width: 120px; height: 120px;
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-pixel); font-size: 36px;
  flex-shrink: 0;
}
.profile-hero .info { flex: 1; min-width: 0; }
.profile-hero .info .crumb-row {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.06em;
  color: var(--ink-3); margin-bottom: 10px;
}
.profile-hero .info h1 {
  margin: 0 0 6px;
  font-family: var(--font-pixel); font-size: 28px; letter-spacing: 0.02em;
  color: var(--ink);
}
.profile-hero .info .city {
  font-family: var(--font-mono); font-size: 16px; color: var(--ink-2);
  margin-bottom: 12px;
}
.profile-hero .info .bio {
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  line-height: 1.5;
  max-width: 560px;
  margin-bottom: 16px;
}
.profile-hero .info .tag-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.profile-hero .info .tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  background: var(--bg-2); border: 2px solid var(--ink);
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.06em;
  color: var(--ink);
}
.profile-hero .info .tag.host { background: var(--yellow-500); }
.profile-hero .info .tag.lvl { background: var(--purple-500); color: #fff; }
.profile-hero .actions {
  position: absolute; top: 24px; right: 24px;
  display: flex; gap: 8px;
}

.profile-sections { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }

.profile-tabs {
  display: flex; gap: 0;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  overflow-x: auto;
}
.profile-tabs button {
  background: var(--surface); border: 0; padding: 14px 20px;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 0.06em;
  color: var(--ink-2); cursor: pointer; flex-shrink: 0;
  border-right: 2px solid var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 90ms steps(2);
}
.profile-tabs button:last-child { border-right: 0; }
.profile-tabs button.on { background: var(--accent); color: #fff; }
.profile-tabs button:hover:not(.on) { background: var(--bg-2); color: var(--ink); }
.profile-tabs button .n {
  font-family: var(--font-pixel); font-size: 8px;
  background: rgba(0,0,0,0.18); padding: 2px 5px;
}
.profile-tabs button.on .n { background: rgba(255,255,255,0.22); }

/* stats */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
@media (max-width: 880px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-block {
  background: var(--surface);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-block .ic {
  width: 44px; height: 44px;
  background: var(--accent-tint);
  border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-block .ic i { color: var(--accent-deep); }
.stat-block.purple .ic { background: var(--purple-100); }
.stat-block.purple .ic i { color: var(--purple-700); }
.stat-block.red .ic { background: var(--red-100); }
.stat-block.red .ic i { color: var(--red-700); }
.stat-block.yellow .ic { background: var(--yellow-300); }
.stat-block.yellow .ic i { color: var(--yellow-700); }
.stat-block .v {
  font-family: var(--font-pixel); font-size: 24px;
  color: var(--ink); line-height: 1;
  display: block; margin-bottom: 6px;
}
.stat-block .l {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.06em;
  color: var(--ink-2);
}

/* game collection */
.collection-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.coll-tile {
  background: var(--surface);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
  transition: transform 90ms steps(2), box-shadow 90ms steps(2);
  cursor: pointer;
}
.coll-tile:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.coll-tile .cov {
  height: 60px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-pixel); font-size: 16px;
  border-bottom: 2px solid var(--ink);
}
.coll-tile .body { padding: 10px; }
.coll-tile .name {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.02em;
  color: var(--ink); line-height: 1.3;
  margin-bottom: 4px;
}
.coll-tile .meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* history */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-row {
  background: var(--surface);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  padding: 14px 16px;
  display: flex; gap: 16px; align-items: center;
}
.history-row .place {
  flex-shrink: 0;
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink);
  font-family: var(--font-pixel); font-size: 18px;
  color: var(--ink);
}
.history-row .place.gold   { background: var(--yellow-500); }
.history-row .place.silver { background: var(--bg-2); }
.history-row .place.bronze { background: #C58A4E; color: #fff; }
.history-row .place.dnf    { background: var(--ink-3); color: #fff; }
.history-row .info { flex: 1; }
.history-row .info .game {
  font-family: var(--font-pixel); font-size: 12px; letter-spacing: 0.02em; color: var(--ink);
  margin-bottom: 4px;
}
.history-row .info .meta {
  font-family: var(--font-body); font-size: 13px; color: var(--ink-2);
  display: inline-flex; gap: 14px; flex-wrap: wrap;
}
.history-row .info .meta i { width: 12px; height: 12px; }
.history-row .badge-col {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.history-row .winner {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 6px;
  background: var(--yellow-300);
  border: 2px solid var(--ink);
  font-family: var(--font-pixel); font-size: 7px; letter-spacing: 0.08em;
  color: var(--yellow-700);
}

/* right rail */
.profile-rail .panel-body { display: flex; flex-direction: column; gap: 10px; }
.rep-meter {
  display: flex; flex-direction: column; gap: 8px;
}
.rep-meter .row {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-body); font-size: 13px; color: var(--ink);
}
.rep-bar {
  height: 14px; background: var(--bg-2);
  border: 2px solid var(--ink);
  position: relative;
  overflow: hidden;
}
.rep-bar .fill {
  height: 100%;
  background-image: repeating-linear-gradient(45deg, var(--green-500) 0 6px, var(--green-300) 6px 12px);
}
.rep-bar.warn .fill { background-image: repeating-linear-gradient(45deg, var(--yellow-500) 0 6px, var(--yellow-300) 6px 12px); }
.rep-bar.bad  .fill { background-image: repeating-linear-gradient(45deg, var(--red-500) 0 6px, var(--red-300) 6px 12px); }
.rep-meter .total {
  font-family: var(--font-pixel); font-size: 9px; color: var(--ink-2);
  text-align: right; letter-spacing: 0.04em;
}

.upcoming-row {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 2px solid var(--ink);
  display: flex; gap: 10px; align-items: center;
}
.upcoming-row .game {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.02em; color: var(--ink); margin-bottom: 2px;
}
.upcoming-row .when {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-2);
}
.upcoming-row + .upcoming-row { margin-top: 8px; }

/* badge/trophy strip */
.badges {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.badge-card {
  width: 56px; height: 56px;
  background: var(--bg-2);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.badge-card.gold   { background: var(--yellow-500); }
.badge-card.purple { background: var(--purple-500); color: #fff; }
.badge-card.green  { background: var(--green-500); color: #fff; }
.badge-card .ic { font-size: 22px; }
.badge-card .lbl {
  position: absolute; bottom: -22px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-pixel); font-size: 6px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.badges { margin-bottom: 28px; }
