/* chat.css - the chat tool (dashboard + overlay). Builds on /css/theme.css. */

/* ---------- dashboard layout ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-4);
  height: calc(100vh - 120px);
  min-height: 420px;
  margin-bottom: var(--space-4);
}
.chat-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; position: relative; }
.chat-toolbar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.chat-toolbar .title { font: 600 16px var(--font); margin-right: var(--space-2); }
/* settings areas (sidebar, overlay popup, dock popup): a denser version of the standard controls */
.chat-side { overflow-y: auto; padding: var(--space-3) var(--space-4); }
.settings-pane section { display: flex; flex-direction: column; gap: var(--space-2); }
.settings-pane section:not(.first) { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.settings-pane h3 { margin: 0 0 2px; font: 600 13px var(--font); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.settings-pane .stack { gap: var(--space-2); }
.settings-pane .field { gap: 4px; }
.settings-pane .field > span { font-size: 12px; }
.settings-pane .input, .settings-pane .select { padding: 6px 9px; font-size: 13px; }
.settings-pane .input-with-icon > .input { padding-left: 32px; }
.settings-pane .switch { font-size: 13px; gap: 8px; }
.settings-pane .btn { padding: 6px 12px; font-size: 13px; }
.settings-pane .segmented span { padding: 4px 8px; font-size: 12px; }
.side-toggle { display: none; }

.jump {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  box-shadow: var(--shadow);
}

.login-gate { text-align: center; padding: var(--space-6) var(--space-4); }
.login-gate p { color: var(--text-muted); margin: 0 0 var(--space-4); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface-2); color: var(--text); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover, .icon-btn.danger:focus-visible { background: rgba(255, 107, 107, .14); color: var(--danger); }
.icon-btn .eye-shut { display: none; }
.icon-btn[aria-pressed="true"] .eye-open { display: none; }
.icon-btn[aria-pressed="true"] .eye-shut { display: inline; }

/* popup (native <dialog>) */
.ds-dialog {
  width: min(440px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.ds-dialog::backdrop { background: rgba(0, 0, 0, .55); }

/* pin / poll / prediction icons (assets/chat/ui, from the original BetterChat). Used as masks so
   they take the surrounding text color (accent, hover, danger) instead of a fixed grey. */
.ui-icon {
  display: inline-block; width: 16px; height: 16px; flex-shrink: 0; background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.ui-pin { --icon: url(/assets/chat/ui/pin.png); }
.ui-poll { --icon: url(/assets/chat/ui/poll.png); }
.ui-prediction { --icon: url(/assets/chat/ui/prediction.png); }
.lb-icon .ui-icon, .msg-act .ui-icon { width: 14px; height: 14px; }

/* new pin / poll / prediction buttons */
.create-btns { display: inline-flex; gap: 2px; }
.create-btn { position: relative; width: 30px; height: 28px; }
.lc-plus {
  position: absolute; right: 2px; bottom: 1px; font: 700 10px/1 var(--font); color: var(--accent);
}
.lc-dialog { width: min(420px, calc(100% - 16px)); }
.lc-form { display: flex; flex-direction: column; gap: var(--space-3); }
.lc-form .dialog-head { margin-bottom: 0; }
.lc-form textarea.input { resize: vertical; min-height: 60px; font-family: var(--font); }
.lc-platforms { display: flex; flex-direction: column; gap: 6px; }
.lc-platform { display: flex; align-items: center; gap: 8px; font: 600 13px var(--font); cursor: pointer; }
.lc-platform img { width: 16px; height: 16px; object-fit: contain; }
.lc-platform.off { cursor: not-allowed; color: var(--text-muted); }
.lc-platform.off img { filter: grayscale(1); opacity: .5; }
.lc-why { font-weight: 400; font-size: 12px; color: var(--text-faint); }
.lc-items { display: flex; flex-direction: column; gap: 6px; }
.lc-item { display: flex; gap: 4px; align-items: center; }
.lc-item .input { flex: 1; }
.lc-error { margin: 0; color: var(--danger); font: 13px/1.4 var(--font); white-space: pre-line; }
.lc-foot { justify-content: flex-end; }

/* 📌 on hover (page + dock) */
.feed.clickable-names .msg { position: relative; }
.msg-actions { position: absolute; top: 1px; right: 4px; display: none; gap: 3px; }
.feed.clickable-names .msg:hover .msg-actions, .msg-actions:focus-within { display: flex; }
/* user card: Unban / Warn under the timeout buttons, and the warning's reason */
.uc-mod-more { display: flex; gap: 2px; margin-top: 6px; }
.uc-warn { display: flex; gap: 6px; margin-top: 8px; }
.uc-warn .input { flex: 1; min-width: 0; height: 30px; font-size: 13px; }
.msg-act {
  display: inline-flex; padding: 3px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface-2); color: var(--text-muted); cursor: pointer;
}
.msg-act:hover:not([aria-disabled="true"]) { color: var(--text); border-color: var(--accent); }
.msg-act[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* pinned / poll / prediction bar above the chat */
.live-banner { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); flex-shrink: 0; max-height: 45%; overflow-y: auto; }
.live-banner[hidden] { display: none; }
.lb-row { display: flex; align-items: stretch; gap: 10px; padding: 7px 10px; background: var(--surface); font: 13px/1.35 var(--font); }
/* platform pill: one colored segment per platform, as tall as the row */
.lb-pill { display: flex; flex-direction: column; gap: 2px; width: 4px; flex-shrink: 0; }
.lb-pill i { flex: 1; border-radius: 2px; min-height: 6px; }
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lb-line { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.lb-toggle { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.lb-icon { display: inline-flex; color: var(--accent); padding-top: 2px; flex-shrink: 0; }
/* ad breaks: amber while coming up, red while playing */
.lb-ad .lb-icon { color: #ffb020; }
.lb-ad.running .lb-icon, .lb-ad.running b { color: #ff5a5a; }
.lb-ad { align-items: center; flex-wrap: wrap; row-gap: 4px; }   /* the buttons go under the text in a narrow dock */
.lb-ad .lb-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.lb-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lb-text .emote { height: 1.5em; vertical-align: middle; margin: -0.2em 1px; }
.lb-chev { display: inline-flex; color: var(--text-muted); transition: transform .15s; padding-top: 2px; }
.lb-toggle[aria-expanded="false"] .lb-chev { transform: rotate(-90deg); }
.lb-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; }
.lb-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.lb-icon-btn { display: inline-flex; padding: 3px; border: 0; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer; }
.lb-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.lb-icon-btn.danger { color: var(--danger); }
.lb-btn {
  padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-sunken);
  color: var(--text); font: 600 11px var(--font); cursor: pointer;
}
.lb-btn:hover { border-color: var(--accent); }
.lb-btn.danger { color: var(--danger); }
.lb-btn.danger:hover, .lb-btn.confirm { border-color: var(--danger); color: var(--danger); background: rgba(255, 107, 107, .12); }
.lb-bars { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.lb-bar {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 22px; padding: 2px 8px;
  border-radius: 4px; background: var(--surface-sunken); overflow: hidden; font-size: 12px;
}
.lb-fill { position: absolute; inset: 0 auto 0 0; background: var(--bar, var(--accent)); opacity: .22; transition: width .4s; }
.lb-bar.win { box-shadow: inset 0 0 0 1px var(--bar, var(--ok)); }
.lb-bar.win .lb-bar-label::after { content: " ✓"; color: var(--ok); }
.lb-bar-label { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.lb-bar-num { position: relative; color: var(--text-muted); white-space: nowrap; }
.lb-win { position: relative; }
.lb-nav { display: flex; align-items: center; gap: 2px; color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.lb-nav button { display: inline-flex; padding: 3px; border: 0; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer; }
.lb-nav button:hover { background: var(--surface-2); color: var(--text); }
.lb-menu {
  position: fixed; z-index: 70; display: flex; flex-direction: column; min-width: 150px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.lb-menu button {
  padding: 6px 10px; border: 0; border-radius: 4px; background: none; color: var(--text);
  font: 600 13px var(--font); text-align: left; cursor: pointer;
}
.lb-menu button:hover, .lb-menu button:focus-visible { background: rgba(255, 255, 255, .08); outline: none; }
body.dock-page .live-banner { max-height: 40vh; }

/* @<watched channel> in a message */
.feed.hl-mentions .mention-me { color: #ff5a36; font-weight: 700; background: rgba(255, 90, 54, .16); border-radius: 3px; padding: 0 2px; }
/* links in messages (render.js linkOf): open in a new tab; on the overlay just shown */
/* a chatter's first message in the channel (Twitch's first-msg): only while the setting is on */
.msg .first-tag { display: none; }
.feed.hl-first .msg.first-chat { background: rgba(0, 200, 160, .14); box-shadow: inset 3px 0 0 #00c8a0; }
.feed.hl-first .msg.first-chat .first-tag { display: block; margin-bottom: 1px; font-size: .78em; font-weight: 700; color: #00c8a0; }
.msg .chat-link { color: #5fb8ff; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
a.chat-link:hover { color: #8fd0ff; }

/* events inline in the chat (follows, subs, ...) */
.msg.event { align-items: flex-start; border-left: 3px solid var(--accent); background: rgba(127, 127, 127, .1); margin: 2px 0; }
.msg.event[data-platform="twitch"] { border-left-color: var(--twitch); }
.msg.event[data-platform="kick"] { border-left-color: var(--kick); }
.msg.event[data-platform="youtube"] { border-left-color: var(--youtube); }
.msg.event[data-platform="joystick"] { border-left-color: var(--joystick); }
.msg.event[data-platform="fourthwall"] { border-left-color: #ffb547; }
.msg.event[data-platform="kofi"] { border-left-color: #29abe0; }
.msg.event[data-platform="streamlabs"] { border-left-color: #80f5d2; }
.msg.event[data-platform="patreon"] { border-left-color: #ff424d; }
.msg.event[data-platform="throne"] { border-left-color: #c9a6ff; }
.msg.event .ev-icon { flex-shrink: 0; width: 1.3em; text-align: center; }
/* "<name> was timed out for 10 minutes" (the chat view's Timeouts and bans setting) */
.msg.mod-notice { color: var(--feed-muted); font-size: .9em; font-style: italic; }
.msg.mod-notice .ev-icon { flex-shrink: 0; width: 1.3em; text-align: center; font-style: normal; }
.msg.mod-notice b { font-weight: 600; color: var(--feed-text); }
.msg.event .ev-msg { display: block; color: var(--feed-muted); font-style: italic; overflow-wrap: anywhere; }
.ev-test { font-size: .75em; padding: 0 4px; border-radius: 3px; background: var(--feed-alt); color: var(--feed-muted); text-transform: uppercase; letter-spacing: .04em; }
.feed.events-off .msg.event { display: none; }
.feed.hide-ev-follow .msg.event[data-type="follow"],
.feed.hide-ev-sub .msg.event[data-type="sub"],
.feed.hide-ev-resub .msg.event[data-type="resub"],
.feed.hide-ev-giftsub .msg.event[data-type="giftsub"],
.feed.hide-ev-cheer .msg.event[data-type="cheer"],
.feed.hide-ev-raid .msg.event[data-type="raid"],
.feed.hide-ev-redemption .msg.event[data-type="redemption"],
.feed.hide-ev-kicks .msg.event[data-type="kicks"],
.feed.hide-ev-hypetrain .msg.event[data-type="hypetrain"],
.feed.hide-ev-tip .msg.event[data-type="tip"],
.feed.hide-ev-order .msg.event[data-type="order"],
.feed.hide-ev-member .msg.event[data-type="member"],
.feed.hide-ev-giftorder .msg.event[data-type="giftorder"],
.feed.hide-ev-wishgift .msg.event[data-type="wishgift"],
.feed.hide-ev-contribution .msg.event[data-type="contribution"],
.feed.hide-ev-crowdfund .msg.event[data-type="crowdfund"] { display: none; }

/* bars around the chat take the chat background's colors (themes.css: --feed-bar / --feed-line) */
.chat-themed .chat-toolbar, .chat-themed .dock-header, .chat-themed .send-bar {
  background: var(--feed-bar); border-color: var(--feed-line); color: var(--feed-text);
}
.chat-themed .chat-toolbar .title { color: var(--feed-text); }
.chat-themed :is(.chat-toolbar, .dock-header) .icon-btn { color: var(--feed-muted); }
.chat-themed :is(.chat-toolbar, .dock-header) .icon-btn:hover,
.chat-themed :is(.chat-toolbar, .dock-header) .icon-btn:focus-visible { background: var(--feed-line); color: var(--feed-text); }
.chat-themed .send-bar .input { background: var(--feed-bg); border-color: var(--feed-line); color: var(--feed-text); }
.chat-themed .send-bar .input::placeholder { color: var(--feed-muted); }
.chat-themed .picker-btn { background: var(--feed-bg); border-color: var(--feed-line); color: var(--feed-muted); }
.chat-themed .live-banner { background: var(--feed-line); border-color: var(--feed-line); }
.chat-themed .lb-row { background: var(--feed-bar); color: var(--feed-text); }
.chat-themed .lb-meta, .chat-themed .lb-bar-num, .chat-themed .lb-nav { color: var(--feed-muted); }
.chat-themed .lb-bar { background: var(--feed-bg); }
.chat-themed :is(.lb-icon-btn, .lb-nav button) { color: var(--feed-muted); }
.chat-themed :is(.lb-icon-btn, .lb-nav button):hover { background: var(--feed-line); color: var(--feed-text); }
.chat-themed .lb-btn { background: var(--feed-bg); border-color: var(--feed-line); }
.chat-themed .lb-btn:not(.danger) { color: var(--feed-text); }

/* names open the user card */
.feed.clickable-names .msg .name, .feed.clickable-names .msg .pfp { cursor: pointer; }
.feed.clickable-names .msg .name:hover { text-decoration: underline; }

/* user card */
.user-card {
  position: fixed; z-index: 60; width: min(300px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
  padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow);
  font: 13px/1.4 var(--font);
}
.uc-head { display: flex; align-items: center; gap: 10px; }
.uc-pfp { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-sunken); }
.uc-who { flex: 1; min-width: 0; }
.uc-who b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-who span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 12px; }
.uc-who span img { width: 13px; height: 13px; object-fit: contain; }
.uc-close { align-self: flex-start; width: 26px; height: 26px; }
.uc-facts { display: grid; gap: 6px; margin: 12px 0; font-size: .8em; }
.uc-facts div { display: flex; justify-content: space-between; gap: 10px; }
.uc-facts dt { color: var(--text-muted); }
.uc-facts dd { margin: 0; text-align: right; }
.uc-mod { display: flex; gap: 4px; }
.uc-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 30px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-sunken);
  color: var(--text); font: 600 12px var(--font); cursor: pointer;
}
.uc-btn:hover:not(:disabled) { border-color: var(--warn); color: var(--warn); }
.uc-btn:disabled { opacity: .4; cursor: not-allowed; }
.uc-ban { color: var(--danger); flex: 0 0 auto; padding: 0 8px; }
.uc-ban:hover:not(:disabled), .uc-ban.confirm { border-color: var(--danger); color: var(--danger); }
.uc-ban.confirm { background: rgba(255, 107, 107, .14); }
.uc-note { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; }
.uc-history { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.uc-history summary { cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 12px; }
.uc-history summary:hover { color: var(--text); }
.uc-msgs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.uc-msgs p { margin: 0; }
.uc-msg { display: flex; gap: 8px; overflow-wrap: anywhere; }
.uc-msg time { color: var(--text-faint); font-size: 11px; flex-shrink: 0; padding-top: 2px; }
.uc-msg .emote { height: 1.6em; vertical-align: middle; margin: -0.2em 1px; }

/* a settings section that starts collapsed (channel point rewards) */
.pane-collapse > summary { display: flex; align-items: center; }
.pane-collapse > summary h3 { margin: 0; }

.pane-collapse > * + * { margin-top: var(--space-2); }

/* channel point rewards: name | Chat | Events */
.reward-list { display: flex; flex-direction: column; gap: 4px; }
.reward-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; align-items: center; gap: 4px; }
.reward-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; overflow: hidden; }
.reward-name img { width: 14px; height: 14px; object-fit: contain; flex-shrink: 0; }
.reward-name small { color: var(--text-faint); margin-left: auto; padding-left: 4px; flex-shrink: 0; }
.reward-row .switch { justify-content: center; }
.reward-all-row { padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.reward-all-row .reward-name { font-weight: 600; }
.reward-row.off .reward-name { opacity: .5; }
.reward-note { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; }
.reward-note img { width: 13px; height: 13px; object-fit: contain; }

/* hidden accounts: chip list + add box */
.hidden-accounts { display: flex; flex-direction: column; gap: var(--space-2); }
.hidden-accounts .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hidden-accounts > .link-btn { align-self: flex-start; font-size: 13px; }

/* overlay editor: live preview + its own settings */
.overlay-dialog { width: min(980px, calc(100% - 32px)); }
.ov-advanced { margin-top: var(--space-3); }
.ov-advanced summary { cursor: pointer; font: 600 13px var(--font); color: var(--text-muted); }
.ov-advanced[open] summary { margin-bottom: var(--space-2); }
.ov-css { width: 100%; resize: vertical; font: 12px/1.45 ui-monospace, Consolas, monospace; }
.ov-advanced code { font-size: 11px; }
.overlay-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.overlay-preview-col { display: flex; flex-direction: column; gap: var(--space-3); position: sticky; top: 0; }
.overlay-preview {
  resize: both; overflow: hidden; width: 100%; height: 420px; min-width: 160px; min-height: 120px; max-width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  /* checkerboard so transparency is visible */
  background: repeating-conic-gradient(#2a2f33 0 25%, #1f2326 0 50%) 0 0 / 20px 20px;
}
.overlay-preview iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
@media (max-width: 760px) {
  .overlay-editor { grid-template-columns: 1fr; }
  .overlay-preview-col { position: static; }
  .overlay-preview { height: 260px; }
}
.ds-dialog .stack { gap: var(--space-3); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.dialog-head h3 { margin: 0; }
.btn-close { display: inline-flex; padding: 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); cursor: pointer; }
.btn-close:hover, .btn-close:focus-visible { background: var(--surface-2); color: var(--text); }

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-panel  { height: 70vh; }
  .chat-side   { display: none; }
  .chat-side.open { display: block; }
  .side-toggle { display: inline-flex; }
}

/* ---------- message feed ---------- */
.feed {
  --chat-font-size: 14px;   /* colors: --feed-* from themes.css */
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 6px;
  background: var(--feed-bg); color: var(--feed-text);
  font: 500 var(--chat-font-size)/1.45 var(--font);   /* message text; names are 700 */
}
/* bottom up: a spacer above the messages keeps them snapped to the bottom until the feed
   fills; it shrinks to nothing once there is enough to scroll */
.feed { display: flex; flex-direction: column; }
.feed > * { flex-shrink: 0; }
.feed:not(.newest-first)::before { content: ""; flex: 1 1 auto; }
/* BetterChat's themes: chat/themes.css (shared with the Events feed) */
.feed.text-shadow { text-shadow: 0 0 2px #000, 0 1px 3px rgba(0, 0, 0, .9); }
.feed[data-theme="transparent"] {
  --feed-bg: transparent; --feed-alt: transparent; --feed-text: #ffffff; --feed-muted: #dddddd;
  text-shadow: 0 0 2px #000, 0 1px 3px rgba(0, 0, 0, .9);
}

.msg {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 3px 6px; border-radius: 4px;
  overflow-wrap: anywhere;
  transition: opacity .5s;
}
.feed.alt-bg .msg.odd { background: var(--feed-alt); }
.msg.gone { opacity: 0; }
/* Twitch chat GIFs (GIPHY): a small picture in the line */
.msg .chat-gif { display: inline-block; max-height: 6em; max-width: min(100%, 14em); vertical-align: middle; border-radius: 6px; margin: 2px 0; }
/* "Highlight my message" (Twitch channel points) */
.msg.highlighted { background: rgba(145, 70, 255, .22); box-shadow: inset 3px 0 0 #9146ff; }
.feed.alt-bg .msg.highlighted.odd { background: rgba(145, 70, 255, .22); }
/* replies: the message replied to, above; Dim / Hide in the settings */
.msg .reply-to { display: block; margin-bottom: 1px; font-size: .8em; font-weight: 400; color: var(--feed-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed.replies-dim .msg.is-reply { opacity: .45; }
.feed.replies-hide .msg.is-reply { display: none; }
.msg .platform { width: 1.1em; height: 1.1em; margin-top: .2em; flex-shrink: 0; object-fit: contain; }
.msg .pfp { width: 1.6em; height: 1.6em; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.msg .pfp-empty { background: var(--feed-alt); }
.msg[data-platform="twitch"] .pfp { box-shadow: 0 0 0 2px var(--twitch); }
.msg[data-platform="kick"] .pfp   { box-shadow: 0 0 0 2px var(--kick); }
.msg[data-platform="youtube"] .pfp { box-shadow: 0 0 0 2px var(--youtube); }
.msg[data-platform="joystick"] .pfp { box-shadow: 0 0 0 2px var(--joystick); }
.msg .body { flex: 1; min-width: 0; }
.msg .badges { display: inline-flex; gap: 3px; vertical-align: -0.2em; margin-right: 4px; }
.msg .badges img { width: 1.15em; height: 1.15em; }
.msg .name { font-weight: 700; }
.msg .sep  { color: var(--feed-muted); }
.msg.action .text { font-style: italic; }
.msg .emote { height: 1.9em; vertical-align: middle; margin: -0.3em 1px; }

.feed.hide-pfp .pfp, .feed.hide-platform .platform { display: none; }
.feed.hide-badge-sub   .badges img[data-group="sub"],
.feed.hide-badge-mod   .badges img[data-group="mod"],
.feed.hide-badge-vip   .badges img[data-group="vip"],
.feed.hide-badge-verified .badges img[data-group="verified"],
.feed.hide-badge-other .badges img[data-group="other"] { display: none; }

.feed-empty { color: var(--feed-muted); text-align: center; padding: var(--space-6) var(--space-4); font-size: 14px; }

/* ---------- overlay page ---------- */
/* fills whatever size the OBS browser source is; only the messages and the chosen background show */
html:has(body.overlay-page) { background: transparent; }
body.overlay-page { margin: 0; background: transparent; overflow: hidden; }
body.overlay-page .feed.alt-bg .msg.odd { background: rgba(127, 127, 127, .16); }
body.overlay-page .feed {
  position: fixed; inset: 0; padding: 8px;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
}
body.overlay-page .feed .msg { flex-shrink: 0; }
body.overlay-page .feed.newest-first { justify-content: flex-start; }

/* overlay looks (settings.overlay.style; Classic is the plain list above) */
/* Bubbles / Cards: the background colour goes on each message; name above the text */
body.overlay-page .feed.ov-bubbles, body.overlay-page .feed.ov-cards { background: transparent; }
.feed.ov-bubbles .msg, .feed.ov-cards .msg { margin: 0 0 .4em; padding: .45em .75em; background: var(--ov-msg-bg); }
.feed.ov-bubbles .msg { border-radius: 1.1em; }
.feed.ov-cards .msg { border-radius: 4px; border-left: 4px solid var(--accent); }
.feed.ov-cards .msg[data-platform="twitch"] { border-left-color: var(--twitch); }
.feed.ov-cards .msg[data-platform="kick"] { border-left-color: var(--kick); }
.feed.ov-cards .msg[data-platform="youtube"] { border-left-color: var(--youtube); }
.feed.ov-cards .msg[data-platform="joystick"] { border-left-color: var(--joystick); }
.feed.ov-bubbles .msg:not(.event) .sep, .feed.ov-cards .msg:not(.event) .sep { display: none; }
.feed.ov-bubbles .msg:not(.event) .text, .feed.ov-cards .msg:not(.event) .text { display: block; }
.feed.ov-bubbles .msg.odd, .feed.ov-cards .msg.odd { background: var(--ov-msg-bg); }   /* no row shading on top */
/* Compact: smaller, no pictures or platform icons, tight lines */
.feed.ov-compact { font-size: calc(var(--chat-font-size) * .85); line-height: 1.25; }
.feed.ov-compact .msg { padding: 1px 4px; gap: 4px; }
.feed.ov-compact .pfp, .feed.ov-compact .platform { display: none; }
/* Outline: no background, bold letters with a thick dark outline */
body.overlay-page .feed.ov-outline { background: transparent; }
.feed.ov-outline .msg { font-weight: 800; -webkit-text-stroke: .16em #000; paint-order: stroke fill; text-shadow: none; }
.feed.ov-outline .msg.odd { background: none; }

/* how new messages arrive (settings.overlay.animation; only new ones, not the history) */
.feed[data-anim="fade"] .msg.enter { animation: ov-fade .35s ease-out both; }
.feed[data-anim="slide"] .msg.enter { animation: ov-slide .35s cubic-bezier(.2, .8, .3, 1) both; }
.feed[data-anim="pop"] .msg.enter { animation: ov-pop .3s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes ov-fade { from { opacity: 0; } }
@keyframes ov-slide { from { opacity: 0; transform: translateX(-1.5em); } }
@keyframes ov-pop { from { opacity: 0; transform: scale(.85); } }
/* not turned off for prefers-reduced-motion: the streamer picked it, for their viewers (and the PC running OBS
   asking for less motion would silently drop it) */
/* ---------- OBS dock page: the feed fills the dock, same look as /chat ---------- */
body.dock-page { margin: 0; height: 100vh; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.dock-feed { position: relative; flex: 1; min-height: 0; display: flex; }
body.dock-page .send-bar { flex-wrap: nowrap; padding: 6px; gap: 6px; }
body.dock-page .send-bar .input { flex-basis: auto; order: 0; }
body.dock-page .send-bar .btn { margin-left: 0; }
/* dock header: create buttons (left), settings cog (right) */
.dock-header {
  display: flex; align-items: center; gap: 4px; padding: 3px 6px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dock-header .spacer { flex: 1; }
/* settings popup: fills the dock */
.dock-settings {
  position: fixed; inset: 0; z-index: 50; width: auto; height: auto; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--surface); color: var(--text);
  flex-direction: column;
}
.dock-settings[open] { display: flex; }
.dock-settings-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--border);
}
.dock-tabs { display: flex; gap: 2px; flex: 1; }
.dock-tabs button {
  padding: 6px 12px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-muted); font: 600 13px var(--font); cursor: pointer;
}
.dock-tabs button:hover { color: var(--text); }
.dock-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.dock-settings-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-3) var(--space-4) var(--space-5); }
.dock-settings-body[hidden] { display: none; }
body.dock-page .overlay-error { color: var(--text-muted); text-shadow: none; }
.overlay-error { position: fixed; left: 8px; bottom: 8px; color: #fff; font: 14px var(--font); text-shadow: 0 1px 3px #000; }

/* ---------- send bar ---------- */
.send-bar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 10px 12px; border-top: 1px solid var(--border);
}
.send-bar .input { flex: 1; min-width: 0; }
/* platform picker: a small square with the platforms' icons (2 x 2), opening a menu upwards */
.send-picker { position: relative; }
.picker-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-sunken); color: var(--text-muted); cursor: pointer;
}
.picker-btn:hover:not(:disabled), .picker-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
.picker-btn:disabled { opacity: .5; cursor: not-allowed; }
.picker-icons { display: grid; grid-template-columns: repeat(2, 13px); gap: 3px; place-content: center; }
.picker-icons:has(> :only-child) { grid-template-columns: 20px; }
.picker-icons > :last-child:nth-child(3) { grid-column: span 2; justify-self: center; }   /* three: two over one */
.picker-icons img { width: 13px; height: 13px; object-fit: contain; transition: filter .12s, opacity .12s; }
.picker-icons img:only-child { width: 20px; height: 20px; }
.picker-item img { width: 18px; height: 18px; object-fit: contain; transition: filter .12s, opacity .12s; }
img.off { filter: grayscale(1); opacity: .4; }

.picker-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20;
  min-width: 190px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.picker-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); font: 600 14px var(--font); text-align: left; cursor: pointer;
}
.picker-item:hover, .picker-item:focus-visible { background: rgba(255, 255, 255, .08); outline: none; }
.picker-item .pi-label { flex: 1; }
.picker-item .pi-check { display: inline-flex; width: 16px; color: var(--accent); }
.picker-item[aria-checked="false"] .pi-label { color: var(--text-muted); }
.picker-all { border-bottom: 1px solid var(--border); border-radius: 4px 4px 0 0; margin-bottom: 2px; }
.picker-item.needs-grant .pi-label { color: var(--text-muted); }
.picker-item .pi-action { font-size: 12px; color: var(--accent); }
@media (max-width: 600px) {
  .send-bar { flex-wrap: wrap; }
  .send-bar .input { flex-basis: 100%; order: -1; }
  .send-bar .btn { margin-left: auto; }
}

/* Channels in the settings: a capsule per platform (status dot, icon, #channel); click one to show or hide it */
.ch-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-pill { border: 1px solid transparent; cursor: default; }
.ch-pill.off { opacity: .5; }
.ch-pill.unlinked { opacity: .4; }
/* the same as small switches with the platform icons, in a top bar */
.ch-bar { display: flex; align-items: center; gap: 8px; margin-right: 2px; }
.ch-row { display: flex; align-items: center; gap: 3px; }
.ch-bar .switch { transform: scale(.7); transform-origin: right center; margin-left: -10px; }
.ch-bar .ch-row img { width: 14px; height: 14px; flex-shrink: 0; }
.ch-bar .ch-row:has(input:disabled) { opacity: .45; }
.chat-toolbar .ch-bar { gap: 12px; margin-left: 6px; }

/* the landing page's chats (chat/landing.js) */
.ldch-themes { display: flex; width: fit-content; margin: 0 auto 10px; }
.ldch-feed { height: 330px; overflow-y: auto; border-radius: 10px; }
.ldch-feed.ldch-short { height: 250px; }
.ldch-feed .msg-actions { display: none; }   /* pin / delete aren't part of the samples */
.ldch-send { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ldch-send .input { flex: 1; min-width: 0; }
.ldch-to { display: grid; grid-template-columns: repeat(2, 26px); gap: 3px; }
.ldch-to label { position: relative; cursor: pointer; }
.ldch-to input { position: absolute; opacity: 0; }
.ldch-to img { display: block; width: 26px; height: 26px; padding: 3px; border-radius: 6px; box-sizing: border-box; background: var(--surface-sunken); opacity: .35; transition: opacity .15s; }
.ldch-to input:checked + img { opacity: 1; box-shadow: inset 0 0 0 1px var(--border-strong); }
.ldch-to input:focus-visible + img { outline: 2px solid var(--accent); }
.ldch-tip { margin: 0 0 10px; font: 14px var(--font); color: var(--text-muted); }
.ldch-banner { margin-bottom: 8px; }
.ldch-stream { position: relative; height: 300px; border-radius: 10px; overflow: hidden;
  background: radial-gradient(400px 200px at 75% 30%, rgba(255, 170, 60, .35), transparent 70%), linear-gradient(160deg, #1d3b2a 0%, #0e1f2d 60%, #1b1230 100%); }
.ldch-stream .ldch-overlay { position: absolute; left: 12px; bottom: 12px; width: 320px; max-width: calc(100% - 24px); height: 260px; overflow: hidden; }
