/* SynerChat2 — Magviz-inspired dark console
   Font prefs via /font · /font-size · /font-height (CSS vars, per-browser) */
:root {
  --user-font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Defaults: 16px body + line-height 1.1 (full size in main chat) */
  --user-font-size: 16px;
  --user-line-height: 1.1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--user-font-family);
  font-size: var(--user-font-size);
  line-height: var(--user-line-height);
  background: #191919;
  color: #bec1c5;
  /* Clean default (no CRT glow). Themes re-add shadows only while active. */
  text-shadow: none;
  filter: none;
  /* Magviz does not force antialiased/grayscale — keep browser default so
     JetBrains Mono strokes match Magviz (forced antialiased looks thinner). */
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: auto;
}

a {
  color: #3fbdf7;
  text-decoration: none;
}
a:hover {
  color: #5cf99b;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100dvh;
  /* Explicit baseline so CRT filter/animation cannot linger after theme off */
  filter: none;
  animation: none;
  transform: none;
  text-shadow: none;
}

/* Header */
#panel_header {
  flex: 0 0 auto;
  border-bottom: 1px solid #2a2a2a;
  background: #141414;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
}

#sitetitle {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand-a {
  color: #6eb6ff; /* lighter blue — SYNER */
}
.brand-b {
  color: #1a3a6e; /* navy blue — CHAT */
}

.header-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
}

#clock {
  color: #888;
  font-variant-numeric: tabular-nums;
}

/* Layout — Magviz-style 3 columns; sides can be fully hidden + width-resized */
#layout {
  --col-left-w: 220px;
  --col-right-w: 260px;
  flex: 1;
  display: grid;
  grid-template-columns: var(--col-left-w) minmax(0, 1fr) var(--col-right-w);
  gap: 0;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}
#layout.is-resizing {
  transition: none;
  user-select: none;
  cursor: col-resize;
}
#layout.is-resizing * {
  cursor: col-resize !important;
}

/* Hide entire side columns (chat expands) */
#layout.col-left-off {
  grid-template-columns: minmax(0, 1fr) var(--col-right-w);
}
#layout.col-right-off {
  grid-template-columns: var(--col-left-w) minmax(0, 1fr);
}
#layout.col-left-off.col-right-off {
  grid-template-columns: minmax(0, 1fr);
}

#layout.col-left-off #col_left,
#layout.col-right-off #col_right {
  display: none;
}

#col_left,
#col_right {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-color: #2a2a2a;
  background: #151515;
}

#col_left {
  border-right: 1px solid #2a2a2a;
}
#col_right {
  border-left: 1px solid #2a2a2a;
}

/* Drag handles on the inner edges of each side panel */
.col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7px;
  z-index: 20;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.12s ease, opacity 0.12s ease;
  opacity: 0;
}
.col-resizer:hover::after,
#layout.is-resizing .col-resizer.is-active::after {
  background: #4a7cff;
  opacity: 0.85;
}
#resize_left {
  right: -3px;
}
#resize_right {
  left: -3px;
}

#col_main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* Chat title bar: ◀ Open/Close User Panel · title · Open/Close Logs Panel ▶ */
.chat-title-bar {
  gap: 8px;
}
.chat-title-bar .name {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.55;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.chat-title-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}
.panel-col-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #232323;
  border: none;
  color: #75757f;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
  max-width: 46vw;
}
.panel-col-btn .col-arrow {
  font-size: 0.8rem;
  line-height: 1;
  flex: 0 0 auto;
}
.panel-col-btn .col-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-col-btn:hover {
  background: #09cff9;
  color: #000;
}
.panel-col-btn.is-off {
  color: #1fc662;
  background: #1a2a1f;
}
.panel-col-btn.is-off:hover {
  background: #1fc662;
  color: #000;
}
#btn_layout.active {
  color: #1fc662;
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid #2a2a2a;
}

.panel.grow {
  flex: 1;
  border-bottom: none;
}

/* Title-only when collapsed — drop flex share so sibling content moves up */
.panel.collapsed {
  flex: 0 0 auto !important;
  min-height: 0;
  overflow: hidden;
}
.panel.collapsed .panel-body {
  display: none;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #1e1e1e;
  border-bottom: 1px solid #2a2a2a;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9aa0a6;
  flex: 0 0 auto;
  user-select: none;
}

.panel-title .name {
  color: #c8ccd0;
}

.panel-toggle {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.panel-toggle:hover {
  background: #1fc662;
  color: #000;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  /* Side panes slightly smaller (Magviz uses fontsize_85/90 on side panels) */
  font-size: 0.9rem;
}

/* Main chat + private logs: full user size (16px effective) like Magviz chat */
#chat_log.panel-body,
#private_logs.panel-body {
  font-size: 1rem;
  line-height: var(--user-line-height);
}

/* Side column sections share height when open; .panel.collapsed overrides to title-only */
#panel_users:not(.collapsed) {
  flex: 1 1 55%;
  min-height: 0;
}
#panel_recent:not(.collapsed) {
  flex: 1 1 45%;
  min-height: 0;
}
#panel_logs:not(.collapsed) {
  flex: 1 1 55%;
  min-height: 0;
}
#panel_channels:not(.collapsed) {
  flex: 1 1 45%;
  min-height: 0;
}
/* If the other section is collapsed, take all remaining height */
#col_left .panel:not(.collapsed):only-of-type,
#col_right .panel:not(.collapsed):only-of-type {
  flex: 1 1 auto;
}
/* When one of two is open, the open one should fill (both match :not(.collapsed) alone) */
#col_left:has(.panel.collapsed) .panel:not(.collapsed),
#col_right:has(.panel.collapsed) .panel:not(.collapsed) {
  flex: 1 1 auto;
  min-height: 0;
}

.chat-scroll {
  scroll-behavior: smooth;
  /* Let react bars sit slightly above a line without being clipped hard */
  overflow-x: hidden;
  overflow-y: auto;
  /* small top pad so the first line's bar has room */
  padding-top: 4px;
}

/* ---- Hover react / reply on chat lines ---- */
.msg.msg-reactable {
  position: relative;
  border-radius: 4px;
  margin: 0 -4px;
  padding: 2px 4px;
  transition: background 0.1s ease;
  /* Keep this line (and its bar) above neighbors while active */
  z-index: 1;
}
.msg.msg-reactable:hover,
.msg.msg-reactable.is-menu-open {
  background: #2a2a2a; /* slightly lighter grey than default chat */
  z-index: 40; /* bar sits above previous/next lines so focus doesn't jump */
}
.msg-react-bar {
  display: none;
  position: absolute;
  /* Fully above the message so media/links in the line stay clickable */
  top: auto;
  bottom: 100%;
  right: 6px;
  margin-bottom: 6px; /* clear the line + a little air */
  z-index: 41;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  pointer-events: auto;
}
/* Invisible bridge: mouse can move from line up into the bar without
   leaving the message (avoids gap → hover next/prev line). */
.msg-react-bar::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 100%;
  height: 12px;
}
.msg.msg-reactable:hover .msg-react-bar,
.msg.msg-reactable.is-menu-open .msg-react-bar {
  display: inline-flex;
}
.msg-react-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  min-width: 1.6em;
}
.msg-react-btn.has-img {
  min-width: 2.2em;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.msg-react-btn .msg-react-img,
.msg-reaction-chip .msg-react-img {
  display: block;
  height: 1.15em;
  width: auto;
  max-width: 2.4em;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.msg-react-btn:hover {
  background: #333;
  transform: scale(1.12);
}
.msg-react-btn.reply {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9aa0a6;
  border-left: 1px solid #3a3a3a;
  margin-left: 3px;
  padding-left: 8px;
  border-radius: 0 5px 5px 0;
}
.msg-react-btn.reply:hover {
  color: #1fc662;
  background: #2a2a2a;
}
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 4px 0;
  min-height: 0;
}
.msg-reactions:empty {
  display: none;
}
.msg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 999px;
  background: #252525;
  border: 1px solid #3a3a3a;
  color: #c8c8c8;
  cursor: default;
  user-select: none;
}
.msg-reaction-chip .rx-count {
  font-size: 0.72rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}
.msg-reaction-chip.is-mine {
  border-color: #3d6b4a;
  background: #1a2a1f;
}

/* Reply compose bar above input */
.reply-bar {
  margin: 0 0 6px;
}
.reply-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #1c1c1c;
  border: 1px solid #333;
  border-left: 3px solid #1fc662;
  border-radius: 4px;
  font-size: 0.82rem;
}
.reply-bar-label {
  flex: 0 0 auto;
  color: #1fc662;
  font-weight: 600;
}
.reply-bar-preview {
  flex: 1 1 auto;
  min-width: 0;
  color: #9aa0a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-bar-cancel {
  flex: 0 0 auto;
  appearance: none;
  border: none;
  background: transparent;
  color: #777;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.reply-bar-cancel:hover {
  background: #333;
  color: #fff;
}

/* Pending voice clip above the textarea (play / re-record / discard) */
.audio-attach-bar {
  margin: 0 0 6px;
}
.audio-attach-bar[hidden] {
  display: none !important;
}
.audio-attach-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #0f1a28;
  border: 1px solid #2a4a6e;
  border-left: 3px solid #3b9eff;
  border-radius: 4px;
  min-height: 32px;
}
.audio-attach-label {
  flex: 0 0 auto;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.9;
}
.audio-attach-player-host {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}
.audio-attach-player-host .chat-audio-wrap {
  margin: 0;
  max-width: 100%;
  width: 100%;
}
.audio-attach-player-host .chat-audio-player {
  min-width: 0;
  width: 100%;
  max-width: 360px;
}
.audio-attach-player-host .chat-audio-src {
  display: none; /* URL already staged in the input; keep the pill clean */
}
.audio-attach-btn {
  flex: 0 0 auto;
  color: #3b9eff;
}
.audio-attach-btn:hover {
  background: rgba(59, 158, 255, 0.2);
  color: #7ec8ff;
}

/* Chat input */
.chat-input-bar {
  flex: 0 0 auto;
  border-top: 1px solid #2a2a2a;
  background: #141414;
  padding: 6px 10px 10px;
  position: relative;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
/* Drag-and-drop media onto input / chat panel */
.chat-input-bar.is-dragover,
#panel_chat.is-dragover .chat-input-bar {
  background: #0f1a14;
  box-shadow: inset 0 0 0 2px #1fc662;
}
.chat-input-bar.is-dragover::after,
#panel_chat.is-dragover .chat-input-bar::after {
  content: "Drop image or video to attach";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 26, 20, 0.92);
  color: #1fc662;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 5;
  border-radius: 0;
}
#panel_chat.is-dragover #chat_log {
  outline: 2px dashed rgba(31, 198, 98, 0.45);
  outline-offset: -4px;
}

/*
 * Pre-login command bar: only the passkey control (🔑).
 * body.toolbar-prelogin is toggled from client.js via updatePasskeyButton().
 */
body.toolbar-prelogin .toolbar > :not(#btn_passkey) {
  display: none !important;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  min-height: 28px;
}


.icon-btn {
  background: transparent;
  border: none;
  color: #757575;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.95rem;
  line-height: 1;
}
.icon-btn:hover {
  background: #1fc662;
  color: #000;
}
.icon-btn.active {
  color: #1fc662;
}
.icon-btn.muted-sound {
  opacity: 0.45;
}
/* Mic recording indicator (toolbar) */
.icon-btn.mic-recording {
  color: #ff4d4d;
  background: rgba(255, 60, 60, 0.18);
  animation: mic-pulse 1s ease-in-out infinite;
}
.icon-btn.mic-recording:hover {
  background: rgba(255, 60, 60, 0.28);
  color: #ff6b6b;
}
@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 70, 70, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 70, 70, 0);
  }
}

/* Live recording popup */
.mic-record-modal {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}
.mic-record-modal[hidden] {
  display: none !important;
}
.mic-record-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.mic-record-panel {
  position: relative;
  pointer-events: auto;
  width: min(320px, 92vw);
  padding: 22px 20px 18px;
  border-radius: 12px;
  border: 1.5px solid #3b9eff;
  background: linear-gradient(180deg, #122033 0%, #0a121c 100%);
  box-shadow: 0 0 0 1px rgba(59, 158, 255, 0.15), 0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(59, 158, 255, 0.2);
  text-align: center;
}
.mic-record-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 60, 80, 0.12);
  border: 2px solid #ff4d5e;
  animation: mic-orb-pulse 1.2s ease-in-out infinite;
}
.mic-record-orb-core {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 80, 90, 0.6));
}
@keyframes mic-orb-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 70, 90, 0.45);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(255, 70, 90, 0);
    transform: scale(1.04);
  }
}
.mic-record-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #7ec8ff;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.mic-record-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.65rem;
  font-weight: 700;
  color: #ff6b7a;
  letter-spacing: 0.04em;
  margin: 4px 0 6px;
}
.mic-record-hint {
  font-size: 0.82rem;
  margin-bottom: 14px;
}
.mic-record-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mic-record-primary {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
/* Armed — waiting for Start */
.mic-record-primary.mic-record-start {
  background: #2a3544;
  color: #e8eef5;
  border: 1px solid #4a5a6e;
}
.mic-record-primary.mic-record-start:hover {
  background: #354456;
  border-color: #6a7a90;
}
/* Live — Stop & attach (blue) */
.mic-record-primary.mic-record-stop {
  background: #3b9eff;
  color: #041018;
  border: 1px solid #3b9eff;
}
.mic-record-primary.mic-record-stop:hover {
  background: #6eb6ff;
  border-color: #6eb6ff;
}
/* Only pulse the orb while actually recording */
.mic-record-modal.is-armed .mic-record-orb {
  animation: none;
  border-color: #3b9eff;
  background: rgba(59, 158, 255, 0.1);
}
.mic-record-modal.is-recording .mic-record-orb {
  animation: mic-orb-pulse 1.2s ease-in-out infinite;
  border-color: #ff4d5e;
  background: rgba(255, 60, 80, 0.12);
}
.mic-record-modal.is-recording .mic-record-timer {
  color: #ff6b7a;
}
.mic-record-modal.is-armed .mic-record-timer {
  color: #6a8098;
}
.mic-record-cancel {
  appearance: none;
  border: 1px solid #334;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  background: transparent;
  color: #9aa0a6;
}
.mic-record-cancel:hover {
  border-color: #555;
  color: #ddd;
  background: rgba(255, 255, 255, 0.04);
}

.toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #333;
  margin: 0 4px;
  vertical-align: middle;
}

/* Magviz-style color bucket + swatches */
.color-bucket {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.color-bucket input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
  padding: 0;
}
.color-bucket-icon {
  pointer-events: none;
  font-size: 0.95rem;
}
.my-swatches {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  max-width: 180px;
  overflow-x: auto;
}
.my-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #555;
  cursor: pointer;
  flex: 0 0 auto;
}
.my-swatch:hover {
  border-color: #1fc662;
  transform: scale(1.15);
}
/* Delete mode: − armed, next swatch click removes it */
.icon-btn.swatch-del-armed,
.icon-btn#btn_swatch_del.active {
  color: #ff6b6b;
  background: rgba(255, 80, 80, 0.15);
}
.my-swatches.swatch-delete-mode .my-swatch {
  outline: 1px dashed rgba(255, 100, 100, 0.7);
  cursor: not-allowed;
}
.my-swatches.swatch-delete-mode .my-swatch:hover {
  border-color: #ff4444;
  transform: scale(1.2);
  box-shadow: 0 0 0 1px #ff4444;
}
.chat-color {
  /* Magviz inline color segments inherit font; color set inline */
}

/* Chat media embeds (uploaded / linked images & videos) */
.chat-img {
  display: block;
  max-width: min(360px, 100%);
  max-height: 280px;
  margin: 6px 0 2px;
  border-radius: 6px;
  border: 1px solid #333;
  object-fit: contain;
  background: #111;
  cursor: zoom-in;
}
.chat-img-link {
  display: inline-block;
  vertical-align: top;
  text-decoration: none;
}
/* Quick-react stickers — same visual weight as emoji / reaction chips */
.chat-img.chat-img-emoji {
  display: inline-block;
  height: 1.2em;
  width: auto;
  max-height: 1.35em;
  max-width: 2.6em;
  margin: 0 0.12em 0 0;
  padding: 0;
  vertical-align: -0.22em;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: default;
  object-fit: contain;
}
a.chat-img-emoji-link {
  display: inline;
  vertical-align: baseline;
  line-height: 1;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-decoration: none;
}
a.chat-img-emoji-link:hover {
  background: transparent;
  border: none;
  filter: brightness(1.08);
}
.chat-video-wrap {
  margin: 6px 0 2px;
  max-width: min(420px, 100%);
}
.chat-video {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #000;
}
.chat-video-src {
  display: block;
  font-size: 0.75rem;
  margin-top: 2px;
  word-break: break-all;
  opacity: 0.75;
}

/*
 * Inline voice / audio mini-player (blue theme, pill + waveform).
 * URL is on title attributes and .chat-audio-src (telnet shows the bare URL).
 */
.chat-audio-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 1px 0;
  max-width: min(360px, 100%);
  vertical-align: middle;
  line-height: 1;
}
.chat-audio-player {
  --audio-blue: #3b9eff;
  --audio-blue-dim: #1a4a7a;
  --audio-blue-glow: rgba(59, 158, 255, 0.35);
  --audio-track: #0d1a28;
  --audio-h: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: min(220px, 68vw);
  max-width: 100%;
  height: var(--audio-h);
  /* No left padding — play circle is the full left cap of the pill */
  padding: 0 8px 0 0;
  border-radius: 999px;
  border: 1px solid var(--audio-blue);
  background: linear-gradient(180deg, #0f1c2c 0%, #0a1420 100%);
  box-shadow: 0 0 0 1px rgba(59, 158, 255, 0.1), 0 0 6px var(--audio-blue-glow);
  vertical-align: middle;
  user-select: none;
  cursor: default;
  box-sizing: border-box;
  overflow: hidden; /* clip play circle to the pill’s left radius */
}
/* Full-height circular play control — same diameter as the player */
.chat-audio-play {
  flex: 0 0 auto;
  width: var(--audio-h);
  height: var(--audio-h);
  margin: 0;
  border: none;
  border-radius: 50%;
  background: var(--audio-blue);
  color: #000;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}
.chat-audio-play::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-style: solid;
  border-width: 4px 0 4px 7px;
  border-color: transparent transparent transparent #000;
}
.chat-audio-player.is-playing .chat-audio-play {
  background: #5eb0ff;
}
.chat-audio-player.is-playing .chat-audio-play::before {
  margin-left: 0;
  width: 7px;
  height: 8px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  /* two-bar pause — black */
  background: linear-gradient(
    90deg,
    #000 0 2.5px,
    transparent 2.5px 4.5px,
    #000 4.5px 7px
  );
}
.chat-audio-play:hover {
  background: #6eb6ff;
  color: #000;
  filter: none;
}
.chat-audio-play:hover::before {
  border-color: transparent transparent transparent #000;
}
/* Classic multi-bar waveform (animates only while .is-playing) */
.chat-audio-wave {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 12px;
  min-width: 64px;
  overflow: hidden;
}
.chat-audio-wave .bar {
  flex: 1 1 0;
  min-width: 1.5px;
  max-width: 3px;
  height: 30%;
  border-radius: 1px;
  background: var(--audio-blue);
  opacity: 0.55;
  transform-origin: center center;
  will-change: auto;
}
.chat-audio-player.is-playing .chat-audio-wave .bar {
  opacity: 0.95;
  will-change: transform;
  animation: chat-audio-bar 0.9s ease-in-out infinite alternate;
}
.chat-audio-player.is-playing .chat-audio-wave .bar:nth-child(odd) {
  animation-duration: 0.7s;
}
.chat-audio-player.is-playing .chat-audio-wave .bar:nth-child(3n) {
  animation-duration: 1.1s;
}
.chat-audio-player.is-playing .chat-audio-wave .bar:nth-child(4n) {
  animation-duration: 0.85s;
}
@keyframes chat-audio-bar {
  from {
    transform: scaleY(0.45);
  }
  to {
    transform: scaleY(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-audio-player.is-playing .chat-audio-wave .bar {
    animation: none;
    opacity: 0.85;
  }
}
/* Chrome blocked autoplay until a gesture — soft pulse so the pill is obvious */
.chat-audio-player.autoplay-needs-gesture,
video.chat-video.autoplay-needs-gesture {
  box-shadow: 0 0 0 2px rgba(59, 158, 255, 0.55);
  animation: autoplay-nudge 1.2s ease-in-out infinite;
}
@keyframes autoplay-nudge {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(59, 158, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.7);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-audio-player.autoplay-needs-gesture,
  video.chat-video.autoplay-needs-gesture {
    animation: none;
  }
}
.chat-audio-time {
  flex: 0 0 auto;
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  color: var(--audio-blue);
  opacity: 0.9;
  min-width: 2.2em;
  text-align: right;
  letter-spacing: 0.02em;
  line-height: 1;
}
/*
 * URL under the player is hidden on web (pill + title tooltip are enough).
 * Link stays in the DOM for telnet extraction / open-in-new-tab if needed.
 */
.chat-audio-src {
  display: none !important;
}
/* Always show mini player even in /inline off compact mode */
body.media-compact .chat-audio-player {
  display: inline-flex;
}

/* Shared media/link icon tokens (compact + inline chrome) */
:root {
  --media-icon-blue: #2b6cb0;
  --media-icon-bg: #1a1d24;
  --media-icon-border: #2a3344;
}

/* Generic web links (non-image / non-video URLs) */
.chat-web-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
  vertical-align: middle;
  text-decoration: none;
  color: #6eb6ff;
  border-radius: 3px;
  border: 1px solid var(--media-icon-border);
  background: var(--media-icon-bg);
  padding: 1px 6px 1px 4px;
  font-size: 0.9rem;
  line-height: 1.3;
  max-width: min(420px, 100%);
}
/* Outline chain link (style A family — monoline, dark blue) */
.chat-web-link::before {
  content: "";
  flex: 0 0 auto;
  display: block;
  width: 0.95em;
  height: 0.95em;
  background-color: var(--media-icon-blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.chat-web-link .chat-web-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.chat-web-link:hover {
  border-color: var(--media-icon-blue);
  background: #222a38;
}

/*
 * Compact media (/inline off, default): hide previews, show monochrome icons.
 * Image / Video / Link = style A (outline) · Color: dark blue #2b6cb0
 */
body.media-compact .chat-img {
  display: none !important;
}
/* Keep custom react stickers visible (not collapsed to blue media icons) */
body.media-compact .chat-img.chat-img-emoji {
  display: inline-block !important;
}
body.media-compact .chat-video {
  display: none !important;
}
body.media-compact .chat-video-src {
  display: none !important;
}
body.media-compact .chat-img-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  margin: 0 2px;
  vertical-align: middle;
  border-radius: 3px;
  border: 1px solid var(--media-icon-border);
  background: var(--media-icon-bg);
  line-height: 1;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
body.media-compact .chat-img-link.chat-img-emoji-link {
  display: inline;
  width: auto;
  height: auto;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
}
body.media-compact .chat-img-link.chat-img-emoji-link::before {
  display: none !important;
  content: none !important;
}
/* A — outline picture frame / landscape */
body.media-compact .chat-img-link::before {
  content: "";
  display: block;
  width: 0.95em;
  height: 0.95em;
  background-color: var(--media-icon-blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='1.5'/%3E%3Ccircle cx='8.5' cy='9.5' r='1.25'/%3E%3Cpath d='M21 16l-5-5-4 4-2-2-5 5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='1.5'/%3E%3Ccircle cx='8.5' cy='9.5' r='1.25'/%3E%3Cpath d='M21 16l-5-5-4 4-2-2-5 5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  speak: never;
}
body.media-compact .chat-img-link:hover {
  border-color: var(--media-icon-blue);
  background: #222a38;
}
body.media-compact .chat-video-wrap {
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  max-width: none;
  vertical-align: middle;
  position: relative;
  cursor: pointer;
}
/* A — outline video camera */
body.media-compact .chat-video-wrap::before {
  content: "";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 3px;
  border: 1px solid var(--media-icon-border);
  background: var(--media-icon-bg);
  line-height: 1;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b6cb0' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='6.5' width='13' height='11' rx='1.5'/%3E%3Cpath d='M15.5 10.5l5.5-2.5v9l-5.5-2.5v-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.95em 0.95em;
}
body.media-compact .chat-video-wrap:hover::before {
  border-color: var(--media-icon-blue);
  background-color: #222a38;
}
body.media-compact .chat-video-wrap .chat-video-src {
  /* invisible hit-target over the icon */
  display: block !important;
  position: absolute;
  inset: 0;
  opacity: 0;
  overflow: hidden;
  text-indent: -9999px;
  width: 1.35em;
  height: 1.35em;
  margin: 0;
}
/* Web links: icon only when compact */
body.media-compact .chat-web-link {
  width: 1.35em;
  height: 1.35em;
  padding: 0;
  justify-content: center;
  gap: 0;
}
body.media-compact .chat-web-link .chat-web-label {
  display: none;
}
/* Compact: same outline chain as inline mode, icon-only chip */
body.media-compact .chat-web-link {
  border-color: var(--media-icon-border);
  background: var(--media-icon-bg);
  padding: 0;
}
body.media-compact .chat-web-link::before {
  width: 0.9em;
  height: 0.9em;
}

/*
 * Open Graph link preview cards (/inline on only).
 * Injected client-side after a.chat-web-link when /api/og finds title/image.
 */
.chat-og-card {
  display: none; /* default until media-inline */
  flex-direction: column;
  max-width: min(360px, 100%);
  margin: 6px 0 4px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--media-icon-border, #2a3344);
  background: #141820;
  text-decoration: none;
  color: inherit;
  vertical-align: top;
  box-sizing: border-box;
  /* Cancel message hang-indent (padding-left + text-indent: -3ch) so title/desc
     aren't shifted left and clipped by overflow:hidden */
  text-indent: 0;
}
body.media-inline .chat-og-card {
  display: flex;
}
body.media-compact .chat-og-card {
  display: none !important;
}
.chat-og-card:hover {
  border-color: var(--media-icon-blue, #2b6cb0);
  background: #1a2230;
}
.chat-og-img-wrap {
  display: block;
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  background: #0c0e12;
  border-bottom: 1px solid var(--media-icon-border, #2a3344);
}
.chat-og-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: 0;
  margin: 0;
}
.chat-og-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px 9px;
  min-width: 0;
}
.chat-og-site {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a8494;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-og-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e8eef8;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-og-desc {
  font-size: 0.78rem;
  color: #9aa3b2;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Emoji picker modal */
.emoji-modal {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 16px 72px;
  pointer-events: none;
}
.emoji-modal[hidden] {
  display: none !important;
}
.emoji-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.emoji-modal-panel {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  width: min(420px, 100%);
  max-height: min(50vh, 360px);
  display: flex;
  flex-direction: column;
  background: #16181c;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.emoji-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #2a2a32;
  flex: 0 0 auto;
}
.emoji-modal-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #60a5fa;
}
.emoji-modal-close {
  appearance: none;
  border: none;
  background: transparent;
  color: #9aa0a6;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1;
}
.emoji-modal-close:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}
.emoji-modal-search-row {
  flex: 0 0 auto;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #2a2a32;
}
.emoji-search {
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  border: 1px solid #3a3a44;
  background: #0e1014;
  color: #e8e8ec;
  font: inherit;
  font-size: 0.85rem;
  padding: 7px 10px;
  border-radius: 8px;
  outline: none;
}
.emoji-search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}
.emoji-search::placeholder {
  color: #6b7280;
}
.emoji-fav-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid #2a2a32;
  min-height: 2.4em;
}
.emoji-fav-label {
  color: #f0c040;
  font-size: 0.95rem;
  flex: 0 0 auto;
  user-select: none;
}
.emoji-favorites {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
}
.emoji-fav-empty {
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
}
.emoji-fav-slot {
  appearance: none;
  border: 1px solid #3a3a44;
  background: #1a1d24;
  font-size: 1.2rem;
  line-height: 1;
  width: 2em;
  height: 2em;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}
.emoji-fav-slot:hover {
  border-color: #3b82f6;
  background: #2a2a32;
  transform: scale(1.08);
}
.emoji-favorites.emoji-fav-delete-mode .emoji-fav-slot {
  outline: 1px dashed rgba(255, 100, 100, 0.7);
}
.emoji-favorites.emoji-fav-delete-mode .emoji-fav-slot:hover {
  border-color: #ff4444;
  box-shadow: 0 0 0 1px #ff4444;
}
.emoji-fav-btn {
  appearance: none;
  border: 1px solid #3a3a44;
  background: #1a1d24;
  color: #c8c8d0;
  font-size: 1rem;
  font-weight: 700;
  width: 1.85em;
  height: 1.85em;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1;
  padding: 0;
}
.emoji-fav-btn:hover {
  border-color: #3b82f6;
  color: #fff;
}
.emoji-fav-btn.active,
.emoji-fav-btn.emoji-fav-armed {
  color: #1fc662;
  background: rgba(31, 198, 98, 0.15);
  border-color: #1fc662;
}
.emoji-fav-btn#btn_emoji_fav_del.active,
.emoji-fav-btn#btn_emoji_fav_del.emoji-fav-armed {
  color: #ff6b6b;
  background: rgba(255, 80, 80, 0.15);
  border-color: #ff6b6b;
}
.emoji-modal-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.1em, 1fr));
  gap: 4px;
  align-content: start;
}
.emoji-modal-grid.emoji-add-mode .emoji-pick {
  outline: 1px dashed rgba(31, 198, 98, 0.5);
}
.emoji-pick {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1.2;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: pointer;
}
.emoji-pick:hover {
  background: #2a2a32;
  transform: scale(1.12);
}
.emoji-pick.is-fav {
  box-shadow: inset 0 0 0 1px rgba(240, 192, 64, 0.45);
}
.emoji-no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: #6b7280;
  font-size: 0.8rem;
  padding: 16px 8px;
}

/* ── /beer — photorealistic dirndl waitress + sliding stein (web) ──── */
.beer-fx {
  position: fixed;
  inset: 0;
  z-index: 290;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: hidden;
  /* No backdrop fill — transparent cutout floats over chat */
  background: transparent;
}
.beer-fx[hidden] {
  display: none !important;
}
.beer-fx-stage {
  position: relative;
  width: 100%;
  height: min(420px, 58vh);
  margin-bottom: 2vh;
}
.beer-bargirl {
  position: absolute;
  left: -280px;
  bottom: 0;
  width: min(260px, 42vw);
  height: min(390px, 54vh);
  transform-origin: 50% 70%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.beer-bargirl-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  /* Transparent PNG cutout — no background */
  background: transparent;
}
.beer-fx.beer-fx-play .beer-bargirl {
  animation: beer-girl-in 4.2s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
@keyframes beer-girl-in {
  0% {
    left: -300px;
    opacity: 0;
    transform: scale(0.96) rotate(-2deg);
  }
  14% {
    opacity: 1;
  }
  24% {
    left: 4%;
    transform: scale(1) rotate(0deg);
  }
  /* Subtle whole-body bounce while offering the beer */
  30% {
    transform: scale(1.02, 0.98) translateY(2px);
  }
  36% {
    transform: scale(0.99, 1.01) translateY(0);
  }
  42% {
    transform: scale(1.015, 0.99) translateY(1px);
  }
  48%,
  72% {
    left: 4%;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    left: -320px;
    opacity: 0;
    transform: scale(0.97) rotate(-1deg);
  }
}
/* Soft jiggle mask over upper torso (photo stays intact underneath) */
.beer-bounce-mask {
  position: absolute;
  left: 18%;
  top: 28%;
  width: 64%;
  height: 22%;
  border-radius: 50%;
  pointer-events: none;
  background: transparent;
  box-shadow: inset 0 0 0 0 transparent;
  transform-origin: 50% 20%;
  z-index: 2;
}
.beer-fx.beer-fx-play .beer-bounce-mask {
  animation: beer-bust-jiggle 0.38s ease-in-out 0.55s 8 alternate;
}
/* Optical bounce: slight scale + drop-shadow pulse over the bust area */
.beer-fx.beer-fx-play .beer-bargirl-img {
  animation: beer-photo-bounce 0.4s ease-in-out 0.5s 8 alternate;
  transform-origin: 50% 32%;
}
@keyframes beer-photo-bounce {
  from {
    transform: scale(1, 1);
  }
  to {
    transform: scale(1.02, 0.985) translateY(2px);
  }
}
@keyframes beer-bust-jiggle {
  from {
    transform: scale(1, 1) translateY(0);
  }
  to {
    transform: scale(1.04, 0.94) translateY(3px);
  }
}
/* Flying stein slides out from her hand toward chat */
.beer-glass-fly {
  position: absolute;
  left: 62%;
  top: 48%;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1;
  z-index: 5;
  filter: drop-shadow(2px 6px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
}
.beer-fx.beer-fx-play .beer-glass-fly {
  animation: beer-stein-slide 4.2s ease-in-out forwards;
}
@keyframes beer-stein-slide {
  0%,
  18% {
    opacity: 0;
    transform: translate(0, 0) rotate(-12deg) scale(0.7);
  }
  26% {
    opacity: 1;
    transform: translate(8px, -4px) rotate(-4deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(min(42vw, 280px), -12px) rotate(8deg) scale(1.15);
  }
  55% {
    opacity: 1;
    transform: translate(min(48vw, 320px), -8px) rotate(0deg) scale(1.05);
  }
  72% {
    opacity: 1;
    transform: translate(min(48vw, 320px), -8px) rotate(0deg) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(min(55vw, 380px), 20px) rotate(12deg) scale(0.85);
  }
}
.beer-fx-caption {
  position: absolute;
  left: calc(4% + min(260px, 42vw) + 16px);
  bottom: 18%;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 700;
  color: #f5d76e;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  opacity: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.beer-fx.beer-fx-play .beer-fx-caption {
  animation: beer-caption 4.2s ease-in-out forwards;
}
@keyframes beer-caption {
  0%,
  28% {
    opacity: 0;
    transform: translateY(10px);
  }
  38%,
  68% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
  }
}
.beer-emoji {
  font-size: 1.15em;
  letter-spacing: 0.05em;
}

/* ── /trump — cutout + sliding cash stack (web) ────────────────────── */
.trump-fx {
  position: fixed;
  inset: 0;
  z-index: 290;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: hidden;
  background: transparent;
}
.trump-fx[hidden] {
  display: none !important;
}
.trump-fx-stage {
  position: relative;
  width: 100%;
  height: min(400px, 55vh);
  margin-bottom: 2vh;
}
.trump-figure {
  position: absolute;
  left: -320px;
  bottom: 0;
  width: min(300px, 48vw);
  height: min(300px, 48vh);
  transform-origin: 50% 80%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.trump-figure-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  background: transparent;
}
.trump-fx.trump-fx-play .trump-figure {
  animation: trump-slide-in 4.2s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
@keyframes trump-slide-in {
  0% {
    left: -340px;
    opacity: 0;
    transform: scale(0.94) rotate(-1deg);
  }
  14% {
    opacity: 1;
  }
  24% {
    left: 3%;
    transform: scale(1) rotate(0deg);
  }
  32% {
    transform: scale(1.03, 0.98) translateY(2px);
  }
  40% {
    transform: scale(0.99, 1.01) translateY(0);
  }
  48%,
  72% {
    left: 3%;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    left: -360px;
    opacity: 0;
    transform: scale(0.96) rotate(-1deg);
  }
}
/* Cash stack flies out from his hand / chest toward chat */
.trump-money-fly {
  position: absolute;
  left: 58%;
  top: 42%;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.15em;
  z-index: 5;
  filter: drop-shadow(2px 6px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
  white-space: nowrap;
}
.trump-fx.trump-fx-play .trump-money-fly {
  animation: trump-cash-slide 4.2s ease-in-out forwards;
}
@keyframes trump-cash-slide {
  0%,
  18% {
    opacity: 0;
    transform: translate(0, 0) rotate(-10deg) scale(0.6);
  }
  26% {
    opacity: 1;
    transform: translate(10px, -6px) rotate(-4deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(min(40vw, 260px), -16px) rotate(6deg) scale(1.2);
  }
  55% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  72% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(min(54vw, 360px), 24px) rotate(14deg) scale(0.8);
  }
}
.trump-fx-caption {
  position: absolute;
  left: calc(3% + min(300px, 48vw) + 12px);
  bottom: 22%;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #b91c1c, #1d4ed8);
  -webkit-background-clip: text;
  background-clip: text;
  /* Fallback solid when clip unsupported */
  text-shadow:
    0 0 1px #b91c1c,
    0 2px 10px rgba(0, 0, 0, 0.8),
    0 0 18px rgba(185, 28, 28, 0.55);
  opacity: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: system-ui, "Segoe UI", Impact, sans-serif;
}
.trump-fx.trump-fx-play .trump-fx-caption {
  animation: trump-caption 4.2s ease-in-out forwards;
}
@keyframes trump-caption {
  0%,
  26% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  36%,
  68% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
  }
}
.trump-emoji {
  font-size: 1.15em;
  letter-spacing: 0.05em;
}

/* ── /taco — taco stand slide-in + flying tacos (web) ──────────────── */
.taco-fx {
  position: fixed;
  inset: 0;
  z-index: 290;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: hidden;
  background: transparent;
}
.taco-fx[hidden] {
  display: none !important;
}
.taco-fx-stage {
  position: relative;
  width: 100%;
  height: min(420px, 58vh);
  margin-bottom: 2vh;
}
.taco-figure {
  position: absolute;
  left: -360px;
  bottom: 0;
  width: min(320px, 52vw);
  height: min(340px, 50vh);
  transform-origin: 50% 80%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.taco-figure-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 10px;
  background: transparent;
}
.taco-fx.taco-fx-play .taco-figure {
  animation: taco-slide-in 4.2s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
@keyframes taco-slide-in {
  0% {
    left: -380px;
    opacity: 0;
    transform: scale(0.94) rotate(-1deg);
  }
  14% {
    opacity: 1;
  }
  24% {
    left: 3%;
    transform: scale(1) rotate(0deg);
  }
  32% {
    transform: scale(1.02, 0.98) translateY(2px);
  }
  40% {
    transform: scale(0.99, 1.01) translateY(0);
  }
  48%,
  72% {
    left: 3%;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    left: -400px;
    opacity: 0;
    transform: scale(0.96) rotate(-1deg);
  }
}
.taco-fly {
  position: absolute;
  left: 55%;
  top: 38%;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.05em;
  z-index: 5;
  filter: drop-shadow(2px 6px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
  white-space: nowrap;
}
.taco-fx.taco-fx-play .taco-fly {
  animation: taco-fly-slide 4.2s ease-in-out forwards;
}
@keyframes taco-fly-slide {
  0%,
  18% {
    opacity: 0;
    transform: translate(0, 0) rotate(-12deg) scale(0.6);
  }
  26% {
    opacity: 1;
    transform: translate(10px, -6px) rotate(-4deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(min(40vw, 260px), -16px) rotate(8deg) scale(1.2);
  }
  55% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  72% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(min(54vw, 360px), 24px) rotate(12deg) scale(0.8);
  }
}
.taco-fx-caption {
  position: absolute;
  left: calc(3% + min(320px, 52vw) + 12px);
  bottom: 20%;
  font-size: clamp(1.3rem, 3.2vw, 1.8rem);
  font-weight: 800;
  color: #fbbf24;
  text-shadow:
    0 0 1px #b91c1c,
    0 2px 10px rgba(0, 0, 0, 0.8);
  opacity: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: system-ui, "Segoe UI", Impact, sans-serif;
}
.taco-fx.taco-fx-play .taco-fx-caption {
  animation: taco-caption 4.2s ease-in-out forwards;
}
@keyframes taco-caption {
  0%,
  26% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  36%,
  68% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
  }
}
.taco-emoji {
  font-size: 1.15em;
  letter-spacing: 0.05em;
}

/* ── /george — cutout slide-in + computer/ship fly (web) ────────────── */
.george-fx {
  position: fixed;
  inset: 0;
  z-index: 290;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: hidden;
  background: transparent;
}
.george-fx[hidden] {
  display: none !important;
}
.george-fx-stage {
  position: relative;
  width: 100%;
  height: min(400px, 55vh);
  margin-bottom: 2vh;
}
.george-figure {
  position: absolute;
  left: -320px;
  bottom: 0;
  width: min(300px, 48vw);
  height: min(320px, 48vh);
  transform-origin: 50% 80%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.george-figure-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  background: transparent;
}
.george-fx.george-fx-play .george-figure {
  animation: george-slide-in 4.2s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
@keyframes george-slide-in {
  0% {
    left: -340px;
    opacity: 0;
    transform: scale(0.94) rotate(-1deg);
  }
  14% {
    opacity: 1;
  }
  24% {
    left: 3%;
    transform: scale(1) rotate(0deg);
  }
  32% {
    transform: scale(1.03, 0.98) translateY(2px);
  }
  40% {
    transform: scale(0.99, 1.01) translateY(0);
  }
  48%,
  72% {
    left: 3%;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    left: -360px;
    opacity: 0;
    transform: scale(0.96) rotate(-1deg);
  }
}
.george-fly {
  position: absolute;
  left: 58%;
  top: 40%;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.06em;
  z-index: 5;
  filter: drop-shadow(2px 6px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
  white-space: nowrap;
}
.george-fx.george-fx-play .george-fly {
  animation: george-fly-slide 4.2s ease-in-out forwards;
}
@keyframes george-fly-slide {
  0%,
  18% {
    opacity: 0;
    transform: translate(0, 0) rotate(-10deg) scale(0.6);
  }
  26% {
    opacity: 1;
    transform: translate(10px, -6px) rotate(-4deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(min(40vw, 260px), -16px) rotate(8deg) scale(1.2);
  }
  55% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  72% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(min(54vw, 360px), 24px) rotate(12deg) scale(0.8);
  }
}
.george-fx-caption {
  position: absolute;
  left: calc(3% + min(300px, 48vw) + 12px);
  bottom: 22%;
  font-size: clamp(1.3rem, 3.2vw, 1.8rem);
  font-weight: 800;
  color: #fbbf24;
  text-shadow:
    0 0 1px #1d4ed8,
    0 2px 10px rgba(0, 0, 0, 0.8);
  opacity: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: system-ui, "Segoe UI", Impact, sans-serif;
}
.george-fx.george-fx-play .george-fx-caption {
  animation: george-caption 4.2s ease-in-out forwards;
}
@keyframes george-caption {
  0%,
  26% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  36%,
  68% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
  }
}
.george-emoji {
  font-size: 1.15em;
  letter-spacing: 0.05em;
}

/* ── /que — DJ cutout slide-in + headphones/beer fly (web) ─────────── */
.que-fx {
  position: fixed;
  inset: 0;
  z-index: 290;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: hidden;
  background: transparent;
}
.que-fx[hidden] {
  display: none !important;
}
.que-fx-stage {
  position: relative;
  width: 100%;
  height: min(440px, 60vh);
  margin-bottom: 2vh;
}
.que-figure {
  position: absolute;
  left: -380px;
  bottom: 0;
  width: min(360px, 56vw);
  height: min(380px, 54vh);
  transform-origin: 50% 80%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.que-figure-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  background: transparent;
}
.que-fx.que-fx-play .que-figure {
  animation: que-slide-in 4.2s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
@keyframes que-slide-in {
  0% {
    left: -400px;
    opacity: 0;
    transform: scale(0.94) rotate(-1deg);
  }
  14% {
    opacity: 1;
  }
  24% {
    left: 3%;
    transform: scale(1) rotate(0deg);
  }
  32% {
    transform: scale(1.02, 0.98) translateY(2px);
  }
  40% {
    transform: scale(0.99, 1.01) translateY(0);
  }
  48%,
  72% {
    left: 3%;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    left: -420px;
    opacity: 0;
    transform: scale(0.96) rotate(-1deg);
  }
}
.que-fly {
  position: absolute;
  left: 58%;
  top: 36%;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.06em;
  z-index: 5;
  filter: drop-shadow(2px 6px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
  white-space: nowrap;
}
.que-fx.que-fx-play .que-fly {
  animation: que-fly-slide 4.2s ease-in-out forwards;
}
@keyframes que-fly-slide {
  0%,
  18% {
    opacity: 0;
    transform: translate(0, 0) rotate(-10deg) scale(0.6);
  }
  26% {
    opacity: 1;
    transform: translate(10px, -6px) rotate(-4deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(min(40vw, 260px), -16px) rotate(8deg) scale(1.2);
  }
  55% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  72% {
    opacity: 1;
    transform: translate(min(46vw, 300px), -10px) rotate(0deg) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(min(54vw, 360px), 24px) rotate(12deg) scale(0.8);
  }
}
.que-fx-caption {
  position: absolute;
  left: calc(3% + min(360px, 56vw) + 12px);
  bottom: 22%;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  font-weight: 800;
  color: #fbbf24;
  text-shadow:
    0 0 1px #7c3aed,
    0 2px 10px rgba(0, 0, 0, 0.8);
  opacity: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: system-ui, "Segoe UI", Impact, sans-serif;
}
.que-fx.que-fx-play .que-fx-caption {
  animation: que-caption 4.2s ease-in-out forwards;
}
@keyframes que-caption {
  0%,
  26% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  36%,
  68% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
  }
}
.que-emoji {
  font-size: 1.15em;
  letter-spacing: 0.05em;
}

/* Board-wide /popup broadcast modal */
.broadcast-popup {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.broadcast-popup[hidden] {
  display: none !important;
}
.broadcast-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.broadcast-popup-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #14161a;
  /* Blue surround bar */
  border: 3px solid #3b82f6;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.35),
    0 0 28px rgba(59, 130, 246, 0.25),
    0 16px 48px rgba(0, 0, 0, 0.55);
  border-radius: 10px;
  padding: 22px 24px 20px;
}
.broadcast-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  appearance: none;
  border: none;
  background: transparent;
  color: #9aa0a6;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.broadcast-popup-close:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}
.broadcast-popup-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #60a5fa;
  margin: 0 28px 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.45);
}
.broadcast-popup-body {
  color: #e8eaed;
  font-size: 1.05rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 0;
}
.broadcast-popup-meta {
  margin-top: 14px;
  font-size: 0.78rem;
  color: #888;
}

/* Upload modal */
.upload-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.upload-modal[hidden] {
  display: none !important;
}
.upload-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.upload-modal-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #1a1b1e;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  padding: 14px 16px 16px;
}
.upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.upload-modal-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.upload-dropzone {
  display: block;
  border: 2px dashed #444;
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: #121316;
  transition: border-color 0.12s ease, background 0.12s ease;
  outline: none;
}
.upload-dropzone:hover,
.upload-dropzone:focus,
.upload-dropzone:focus-within {
  border-color: #4a7cff;
  background: #151820;
}
.upload-dropzone.is-dragover {
  border-color: #1fc662;
  background: #0f1a14;
}
/* Safari-safe: keep the file input in the layout tree (not [hidden]/display:none) */
.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.upload-dropzone-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.upload-dropzone-main {
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-dropzone-sub {
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.upload-dropzone-types {
  font-size: 0.75rem;
}
.upload-status {
  margin-top: 10px;
  font-size: 0.85rem;
  min-height: 1.2em;
}
.upload-status.is-error {
  color: #ff6b7a;
}
.upload-status.is-ok {
  color: #1fc662;
}
.upload-status.is-busy {
  color: #6eb6ff;
}

#chat_msg {
  width: 100%;
  resize: none;
  border: 1px solid #303134;
  border-radius: 6px;
  background: #202124;
  color: #e8eaed;
  font-family: inherit;
  font-size: 1rem; /* match Magviz: full body size, not 0.95rem */
  line-height: var(--user-line-height);
  padding: 8px 10px;
  outline: none;
}
#chat_msg:focus {
  border-color: #1fc662;
}
#chat_msg:disabled {
  opacity: 0.6;
}

/* Messages */
.msg {
  position: relative;
  display: block;
  overflow-wrap: break-word;
  word-break: break-word;
  margin: 2px 0;
  padding: 1px 0;
}

/*
 * Anti-spoof wrap indent (public / action / private / mention + link variants):
 * first line flush left (handle at column 0); wrapped and soft-break lines are
 * indented so they cannot impersonate a new #line[Tchan:handle) speaker tag.
 */
.msg.public,
.msg.action,
.msg.private,
.msg.private-out,
.msg.mention {
  padding-left: 3ch;
  text-indent: -3ch;
}
.msg .msg-react-bar,
.msg .msg-reactions,
.msg .chat-img,
.msg .chat-video-wrap,
.msg .chat-img-link,
.msg .chat-web-link,
.msg .chat-og-card,
.msg .chat-code {
  /* UI / embeds / code: don't inherit hanging indent */
  text-indent: 0;
}

.msg.system {
  color: #8ab4f8;
  font-size: 1rem; /* same effective size as public chat */
}
.msg.system.error {
  color: #ff6b6b;
}
/* /M body: hang first line with handle chrome; wraps + soft-breaks stay indented */
.msg.system.m-slot .m-slot-body {
  display: block;
  /* 1ch left pad so no body line starts at column 0 (anti line-spoof) */
  padding-left: 1ch;
  /* hanging: first line of body already has a leading space in HTML;
     CSS pad reinforces wraps that don't go through <br> */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.msg.private,
.msg.private-out,
.msg.private.link {
  background: rgba(255, 0, 0, 0.06);
  border-radius: 3px;
  /* keep hang indent: left = base pad + 3ch, cancel first-line with text-indent */
  padding: 2px 4px 2px calc(4px + 3ch);
  text-indent: -3ch;
}
.msg.action {
  color: #c9a0ff;
}
.msg.mention {
  background: rgba(9, 207, 249, 0.08);
  border-radius: 3px;
  padding: 2px 4px 2px calc(4px + 3ch);
  text-indent: -3ch;
}

/*
 * /code paste blocks — Magviz-style raw snippets.
 * Distinct background so HTML / markup is clearly not "live" chat formatting.
 * Handle hang indent still applies from .msg.public.
 */
.msg.msg-code .chat-code {
  display: block;
  margin: 4px 0 2px 0;
  padding: 8px 10px;
  background: #152032;
  border: 1px solid #2a4a6e;
  border-left: 3px solid #4a9fe0;
  border-radius: 4px;
  color: #d7e6f7;
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono",
    Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-x: auto;
  max-height: 28em;
  overflow-y: auto;
  text-indent: 0;
  tab-size: 2;
}
.msg.msg-code .chat-code code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
  color: inherit;
  white-space: inherit;
}

/* Magviz-style red P on inbound private (local + link) */
.p-badge {
  color: #ff0000 !important;
  font-weight: 700;
  margin-right: 3px;
  font-size: 0.95em;
}
.p-badge.out {
  color: #ff8a80 !important;
}
/* /pg — sysop group page (private-style, purple badge) */
.msg.private-pg .pg-badge,
span.pg-badge {
  color: #c77dff !important;
  font-weight: 700 !important;
  margin-right: 3px;
  font-size: 0.95em;
  -webkit-text-fill-color: #c77dff; /* beat aggressive theme filters */
}
.msg.private-pg {
  background: rgba(156, 80, 220, 0.1);
  border-radius: 3px;
}

/* /ps — page system (everyone local, yellow badge) */
.msg.private-ps .ps-badge,
span.ps-badge {
  color: #f0d060 !important;
  font-weight: 700 !important;
  margin-right: 3px;
  font-size: 0.95em;
  -webkit-text-fill-color: #f0d060;
}
.msg.private-ps {
  background: rgba(240, 200, 60, 0.1);
  border-radius: 3px;
}

/* /pv — page verified/registered members (blue badge) */
.msg.private-pv .pv-badge,
span.pv-badge {
  color: #4da3ff !important;
  font-weight: 700 !important;
  margin-right: 3px;
  font-size: 0.95em;
  -webkit-text-fill-color: #4da3ff;
}
.msg.private-pv {
  background: rgba(60, 130, 230, 0.1);
  border-radius: 3px;
}

/* #line[Tchan: chrome is muted grey; only handle name + msg body are colored */
.handle-tag {
  font-weight: 600;
  margin-right: 2px;
}
.handle-chrome {
  color: #75757f;
  font-weight: 500;
}
.handle-chrome b {
  color: #75757f;
  font-weight: 700;
}
.handle-name {
  font-weight: 600;
}
.handle-name .chat-color {
  font-weight: 600;
}

.mention-tag {
  font-weight: 700;
  white-space: nowrap;
}
.mention-tag .handle-chrome {
  color: #75757f;
  font-weight: 600;
}
.mention-tag .handle-name {
  font-weight: 600;
}
.mention-tag .handle-name .chat-color {
  font-weight: 600;
}

.sys-icon {
  color: #1fc662;
  font-style: normal;
  margin-right: 2px;
}

/* Login / Logout presence prompts (→ Login #5[T1:Handle] #232) */
.msg.system.presence {
  opacity: 0.95;
}
.presence-arrow {
  color: #75757f;
  font-weight: 700;
  margin-right: 2px;
  user-select: none;
}
.presence-verb {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.presence-login {
  color: #1fc662;
}
.presence-logout {
  color: #ff4d6a;
}
.presence-killed {
  color: #ff2a2a;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.presence-by {
  color: #75757f;
  font-weight: 600;
}
.presence-mbr {
  color: #9a9aa3;
  font-weight: 600;
  margin-left: 2px;
}
/* T = telnet / SyncTerm seat (login, logout, /S, users panel) */
.presence-via,
.via-telnet {
  display: inline-block;
  color: #09cff9;
  font-weight: 800;
  font-size: 0.85em;
  margin-left: 3px;
  padding: 0 4px;
  border: 1px solid #09cff9;
  border-radius: 3px;
  line-height: 1.2;
  vertical-align: middle;
  letter-spacing: 0.04em;
  user-select: none;
}
.msg.system.presence-kill {
  opacity: 1;
}

.cmd {
  color: #09cff9;
  font-weight: 600;
}

.muted {
  color: #757575;
}
.color_highlight {
  color: #09cff9;
}

.banner {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

/* Telnet-style login splash — banner is SVG (same on Safari + Chrome) */
.msg.connect {
  margin: 4px 0 10px;
  padding: 8px 0 4px;
  border-bottom: 1px solid #2a2a2a;
  font-size: 16px;
  line-height: 1.3;
  color: #bec1c5;
  font-family: var(--user-font-family);
}
/* Web: pre-rendered SVG (synerchat-banner.svg). Telnet: synerchat-banner-telnet.ans — see public/assets/README.md */
img.connect-banner {
  display: block;
  margin: 0 0 12px;
  padding: 0;
  border: none;
  /* Scale to chat width; keep pixel aspect of the SVG viewBox */
  width: min(100%, 656px);
  height: auto;
  max-width: 100%;
  image-rendering: auto;
  /* Safari: avoid dark-mode SVG inversion weirdness */
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
/* Legacy pre.banner class (if any) */
pre.connect-banner {
  display: none;
}
.connect-hints {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: var(--user-line-height);
  font-family: var(--user-font-family);
  color: #bec1c5;
  white-space: normal;
}
.connect-hint {
  color: #bec1c5;
}
.connect-bullet-mark {
  color: #09cff9;
  margin-right: 2px;
}

/* Multi-step /register dialogue */
.reg-wizard {
  border-left: 3px solid #09cff9;
  padding-left: 10px;
  margin: 6px 0;
}
.reg-wizard-title {
  color: #09cff9;
  font-weight: 700;
  margin-bottom: 4px;
}
.reg-wizard-body {
  color: #bec1c5;
}

.placeholder {
  padding: 4px 0 10px;
}

/* User / channel rows */
.user-row,
.channel-row,
.recent-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 2px;
  border-radius: 3px;
  cursor: default;
}
.user-row:hover,
.channel-row:hover {
  background: #000;
}
.channel-row {
  cursor: pointer;
}
.channel-row .ch-id {
  color: #09cff9;
  font-weight: 600;
  min-width: 2.2em;
}
.channel-row .ch-count {
  color: #666;
  font-size: 0.8rem;
  margin-left: auto;
}
/* Connected + idle sit together on the right (on Xm · idle Ys) */
.user-row .user-times {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  flex-shrink: 0;
}
.user-row .connected {
  color: #4a7a5a;
  font-size: 0.75rem;
}
.user-row .connected::before {
  content: "on ";
  color: #555;
  font-weight: 400;
}
.user-row .idle {
  color: #555;
  font-size: 0.75rem;
}
.recent-row {
  color: #888;
  font-size: 0.85rem;
}
.recent-row .handle-name {
  font-weight: 600;
}
.recent-row .handle-name .chat-color {
  font-weight: 600;
}
.recent-row .idle {
  color: #555;
  font-size: 0.75rem;
  margin-left: auto;
}

.mbr-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1fc662;
  background: rgba(31, 198, 98, 0.12);
  border: 1px solid rgba(31, 198, 98, 0.35);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 2px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.access-sysop {
  color: #feca57;
  font-size: 0.8rem;
  margin-left: 2px;
}

.user-row.link-row .handle-tag {
  color: #3cff7f !important;
}
/* STATION badge — same shape as member #, blue on dark */
.station-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6eb6ff;
  background: rgba(20, 28, 40, 0.95);
  border: 1px solid rgba(110, 182, 255, 0.55);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 2px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.station-badge:hover {
  border-color: #6eb6ff;
  background: rgba(30, 42, 60, 0.98);
}
/* Station header ([T1=) — group label */
.user-row.link-row {
  margin-top: 5px;
  border-top: 1px solid #2a2a2a;
  padding-top: 5px;
}
.user-row.link-row:first-child {
  margin-top: 0;
  border-top: none;
}
/* Nested remotes ([T1:) under their station path (e.g. 9964#3 under 9964) */
.user-row.user-row-nested,
.user-row.remote-row.user-row-nested {
  border-left: 2px solid #2e4a3a;
  margin-left: 2px;
}
.user-row.remote-row .handle-tag {
  opacity: 0.95;
}

/* Help table */
/* Extra blank line between Guest / Member / Sysop /? sections */
.help-section-gap {
  display: block;
  height: 0.9em;
  pointer-events: none;
}
.help-block {
  max-width: 520px;
}
.help-title {
  color: #09cff9;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.cmd-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.88rem;
}
.cmd-table td {
  padding: 3px 8px 3px 0;
  vertical-align: top;
}
.cmd-table td.cmd {
  white-space: nowrap;
  width: 7em;
}

/* Scrollbars */
.panel-body::-webkit-scrollbar {
  width: 8px;
}
.panel-body::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}
.panel-body::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/*
 * Narrow viewports — side panels are unavailable (chat only).
 * No stacking: columns stay hidden until the window is wide enough.
 */
@media (max-width: 900px) {
  #layout,
  #layout.col-left-off,
  #layout.col-right-off,
  #layout.col-left-off.col-right-off {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 1fr;
  }
  #col_left,
  #col_right {
    display: none !important;
  }
  .col-resizer {
    display: none;
  }
  /* Panel open/close controls are meaningless without side columns */
  .panel-col-btn,
  #btn_layout {
    display: none !important;
  }
}
