/* Reason 2 Stream — one screen, like Twitch: a slim broadcast bar, the player,
   and the chat rail. Page structure first, then the chat panel.

   Layouts
   - wide (≥ 900px): player | chat rail, both filling the height under the bar
   - phone portrait: bar, 16:9 player, chat fills the rest
   - phone landscape (short screens): player | narrow chat, bar hidden */

:root {
  color-scheme: dark;
  --orange: #f28c00;
  --orange-hot: #ff9d12;
  --orange-dark: #bd6500;
  --ink: #090a0c;
  --paper: #f7f4ee;
  --twitch: #9146ff;
  --kick: #53fc18;
  --bar: 56px;
  --rail: clamp(340px, 19vw, 440px);
  accent-color: var(--orange);
  scrollbar-color: var(--orange-dark) var(--ink);
  scrollbar-width: thin;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
html { background: var(--ink); }

body {
  display: flex;
  flex-direction: column;
  min-width: 20rem;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

img, iframe { display: block; max-width: 100%; }
iframe { border: 0; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
:where(a, button):focus-visible { outline: 0.2rem solid #fff; outline-offset: 0.25rem; }
h1, h2, h3, p { margin-top: 0; }

/* [hidden] must outrank author display rules or hidden elements still render */
[hidden] { display: none !important; }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  translate: 0 -200%;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { translate: 0; }

/* ---- broadcast bar ---------------------------------------------------------
   Station ident, on-air status, show title, viewers. The wordmark was drawn
   for an orange background (its "2" is black), so it keeps an orange plate,
   cut on an angle like a broadcast bug. */
.site-header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  background: #0e0e10;
  border-bottom: 2px solid var(--orange);
}
.header-inner { block-size: var(--bar); display: flex; align-items: center; gap: 16px; padding-inline-end: 16px; }
.brand {
  align-self: stretch;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-inline: 16px 28px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.brand img { block-size: 34px; inline-size: auto; }
.broadcast-status { flex: 1 1 auto; min-inline-size: 0; display: flex; align-items: center; gap: 14px; }
#stream-title {
  min-inline-size: 0;
  margin: 0;
  overflow: hidden;
  color: #efeff1;
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.live-badge > span:first-child {
  width: 0.65rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #8c8c8c;
  box-shadow: 0 0 0 0.25rem rgb(255 255 255 / 8%);
}
.live-badge.is-live > span:first-child { background: #ff3b30; box-shadow: 0 0 1rem #ff3b30; animation: live-pulse 1.8s ease-out infinite; }
.live-badge.is-offline > span:first-child { background: var(--orange); }
.viewer-count { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--paper); font-size: 0.85rem; font-weight: 800; white-space: nowrap; }
.viewer-count svg { color: #ff6b6b; }

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgb(255 59 48 / 50%); }
  70% { box-shadow: 0 0 0 0.6rem rgb(255 59 48 / 0%); }
  100% { box-shadow: 0 0 0 0 rgb(255 59 48 / 0%); }
}

/* ---- stage: player + chat ----------------------------------------------------- */
main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.live-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.stream-grid {
  flex: 1 1 auto;
  min-block-size: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail);
  grid-template-rows: minmax(0, 1fr);
}
.player-card, .chat-card { display: flex; flex-direction: column; min-inline-size: 0; min-block-size: 0; overflow: hidden; }
.player-card { background: #000; }
.player-frame { position: relative; flex: 1 1 auto; min-block-size: 0; inline-size: 100%; background: #000; }
.player-frame iframe { inline-size: 100%; block-size: 100%; }
.chat-card { border-inline-start: 1px solid #2f2f35; }

/* Phones and narrow windows: the player keeps its 16:9 box, chat takes the rest. */
@media (max-width: 899px) {
  .stream-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .player-frame { flex: 0 0 auto; aspect-ratio: 16 / 9; }
  .chat-card { border-inline-start: 0; border-block-start: 1px solid #2f2f35; }
}
@media (max-width: 599px) {
  :root { --bar: 48px; }
  .header-inner { gap: 10px; padding-inline-end: 12px; }
  .brand { padding-inline: 10px 22px; }
  .brand img { block-size: 26px; }
  .broadcast-status { gap: 10px; }
  #stream-title { font-size: 0.8rem; }
  .live-badge .wide-only, .viewer-count .wide-only { display: none; }
}
/* Phone on its side: video beside a narrow chat, and the bar gives its height to the video. */
@media (orientation: landscape) and (max-height: 520px) {
  .site-header { display: none; }
  .stream-grid { grid-template-columns: minmax(0, 1fr) clamp(260px, 36vw, 360px); grid-template-rows: minmax(0, 1fr); }
  .player-frame { flex: 1 1 auto; aspect-ratio: auto; }
  .chat-card { border-block-start: 0; border-inline-start: 1px solid #2f2f35; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---- chat panel v7 ---------------------------------------------------------
   Our own chat, replacing Owncast's embed. One feed from the bridge (site,
   Twitch and Kick), rendered like Twitch: platform tag, badges, name colour,
   emotes as images. This block is the only place chat is styled. */

.chat-card {
  --chat-bg: #18181b;
  --chat-raised: #1f1f23;
  --chat-field: #26262c;
  --chat-line: #2f2f35;
  --chat-edge: #3a3a41;
  --chat-text: #efeff1;
  --chat-muted: #adadb8;
  --chat-link: #bf94ff;
  position: relative;
  display: flex;
  flex-direction: column;
  min-block-size: 0;
  background: var(--chat-bg);
  color: var(--chat-text);
}

.chat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-block-size: 44px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--chat-line);
}
#chat-heading { flex: 0 0 auto; white-space: nowrap; margin: 0; font-size: .8rem; font-weight: 800; letter-spacing: .1em; line-height: 1.2; text-transform: uppercase; }
.chat-header-actions { display: flex; align-items: center; gap: 6px; min-inline-size: 0; }

.bridge-state {
  flex: 0 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  padding: 4px 8px;
  color: var(--chat-muted);
  border: 1px solid var(--chat-edge);
  border-radius: 999px;
  cursor: default;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.bridge-state.is-live { color: #fff; background: #18743a; border-color: #35a75c; }
.bridge-state.is-warn { color: #1a1204; background: #f0b429; border-color: #f7c948; }

/* "TW" is the one mark for Twitch everywhere in the panel: message tags, the
   sign-in button, the identity line and the header link all use it. */
.twitch-glyph {
  display: inline-grid;
  place-items: center;
  inline-size: 20px;
  block-size: 16px;
  border-radius: 4px;
  background: var(--twitch);
  color: #fff;
  font: 800 .56rem/1 system-ui, sans-serif;
  letter-spacing: .04em;
  vertical-align: 1px;
}
.twitch-glyph::before { content: "TW"; }

.header-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 6px;
  border-radius: 4px;
  color: var(--chat-muted);
  text-decoration: none;
}
.header-icon-link::after { content: "↗"; font-size: .75rem; line-height: 1; }
.header-icon-link:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.header-icon-link:focus-visible { outline: 2px solid var(--orange); outline-offset: 0; }

/* -- log -- */
.chat-panel { position: relative; flex: 1 1 auto; min-block-size: 0; display: flex; }
.chat-log {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-edge) transparent;
}
.chat-log:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }

.msg {
  position: relative;
  padding: 3px 12px;
  font-size: .845rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.msg:hover, .msg:focus-within { background: rgb(255 255 255 / 4%); }
.msg:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.msg-time {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-end: 34px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--chat-raised);
  color: var(--chat-muted);
  font-size: .68rem;
  opacity: 0;
  pointer-events: none;
}
.msg:hover .msg-time, .msg:focus .msg-time { opacity: 1; }

/* One reply button, moved onto whichever message is hovered or focused. */
.msg-reply-button {
  position: absolute;
  inset-block-start: 1px;
  inset-inline-end: 4px;
  display: none;
  place-items: center;
  inline-size: 26px;
  block-size: 24px;
  padding: 0;
  border: 1px solid var(--chat-edge);
  border-radius: 4px;
  background: var(--chat-raised);
  color: var(--chat-muted);
  cursor: pointer;
}
.msg:hover > .msg-reply-button, .msg:focus-within > .msg-reply-button { display: grid; }
.msg-reply-button:hover { color: #fff; border-color: var(--orange); }
@media (hover: none) {
  .msg:hover > .msg-reply-button, .msg:focus-within > .msg-reply-button { display: none; }
  .msg.is-selected { background: rgb(255 255 255 / 6%); }
  .msg.is-selected > .msg-reply-button { display: grid; inline-size: 36px; block-size: 32px; inset-block-start: 50%; translate: 0 -50%; }
}

.msg--pending { opacity: .55; }
.msg--failed { opacity: .8; }
.msg--failed .msg-body { text-decoration: line-through; text-decoration-color: rgb(255 154 154 / 60%); }
.msg-failed-note { color: #ff9a9a; font-size: .74rem; font-weight: 700; }
.notice-action { padding: 0; border: 0; background: none; color: #ffb347; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.msg-platform {
  display: inline-grid;
  place-items: center;
  min-inline-size: 20px;
  block-size: 16px;
  margin-inline-end: 4px;
  padding: 0 3px;
  border-radius: 4px;
  font: 800 .56rem/1 system-ui, sans-serif;
  letter-spacing: .04em;
  vertical-align: 1px;
}
.msg-platform--twitch { background: #9146ff; color: #fff; }
.msg-platform--kick { background: #53fc18; color: #0b0b0b; }
.msg-platform--owncast { background: var(--orange); color: #0e0e10; }
/* A Twitch message that was typed here: Twitch's tag with a station-orange corner. */
.msg-platform.is-via-site { position: relative; }
.msg-platform.is-via-site::after {
  position: absolute;
  inset-block-start: -2px;
  inset-inline-end: -2px;
  inline-size: 6px;
  block-size: 6px;
  border: 1px solid var(--chat-bg);
  border-radius: 50%;
  background: var(--orange);
  content: "";
}

/* inline-block: the page-wide img { display: block } reset would otherwise put each badge on its own line */
.msg-badge { display: inline-block; inline-size: 18px; block-size: 18px; margin-inline-end: 3px; border-radius: 3px; vertical-align: -4px; }
.msg-name { font-weight: 700; }
.msg-body a { color: var(--chat-link); text-underline-offset: 2px; }
.mention { padding: 0 2px; border-radius: 3px; background: rgb(255 255 255 / 9%); color: #fff; font-weight: 700; }

.emote-stack { display: inline-grid; margin: -5px 1px; vertical-align: middle; }
.emote-stack > * { grid-area: 1 / 1; }
.emote { display: block; block-size: 28px; inline-size: auto; max-inline-size: 112px; }
.emote--overlay { place-self: center; pointer-events: none; }

.msg-reply {
  overflow: hidden;
  color: var(--chat-muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg--highlight { background: rgb(145 70 255 / 20%); box-shadow: inset 3px 0 #9146ff; }
.msg--mentions-me { background: rgb(242 140 0 / 13%); box-shadow: inset 3px 0 var(--orange); }
.msg--notice { color: var(--chat-muted); font-size: .8rem; }
.msg--action { color: #f7c56b; }
.msg--error { color: #ff9a9a; }

.chat-more {
  position: absolute;
  inset-block-end: 10px;
  inset-inline-start: 50%;
  translate: -50% 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #0e0e10;
  box-shadow: 0 6px 18px rgb(0 0 0 / 45%);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 800;
}
.chat-more:hover { background: var(--orange-hot); }

.chat-feed-down {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 50%;
  translate: -50% 0;
  display: none;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: #3b2a12;
  color: #ffcf8a;
  font-size: .72rem;
  font-weight: 700;
}
.chat-card.is-feed-down .chat-feed-down { display: block; }

/* -- compose -- */
.chat-compose { flex: 0 0 auto; padding: 10px 10px 8px; border-top: 1px solid var(--chat-line); }
.chat-replying {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 5px 6px 5px 10px;
  border-inline-start: 3px solid var(--orange);
  border-radius: 4px;
  background: var(--chat-raised);
  color: var(--chat-muted);
  font-size: .74rem;
}
.chat-replying strong { color: var(--chat-text); }
.reply-label { flex: 1 1 auto; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-cancel {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--chat-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.reply-cancel:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.reply-cancel:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.compose-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--chat-field);
}
.compose-box:focus-within { border-color: var(--orange); background: #0e0e10; }
.chat-input {
  flex: 1 1 auto;
  min-inline-size: 0;
  min-block-size: 38px;
  max-block-size: 120px;
  field-sizing: content;
  padding: 9px 10px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--chat-text);
  font: inherit;
  font-size: .875rem;
  line-height: 1.4;
}
.chat-input::placeholder { color: var(--chat-muted); }
.chat-input:disabled { cursor: not-allowed; }

.emote-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  inline-size: 36px;
  block-size: 36px;
  margin: 1px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--chat-muted);
  cursor: pointer;
}
.emote-button:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.emote-button[aria-expanded="true"] { color: var(--orange); }
.emote-button:disabled { opacity: .45; cursor: not-allowed; }

.chat-suggest {
  position: absolute;
  inset-inline: 0;
  inset-block-end: calc(100% + 6px);
  z-index: 5;
  max-block-size: 260px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--chat-edge);
  border-radius: 6px;
  background: var(--chat-raised);
  box-shadow: 0 10px 30px rgb(0 0 0 / 50%);
}
.chat-suggest [role="option"] { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: .82rem; }
.chat-suggest [role="option"][aria-selected="true"] { background: var(--chat-edge); }
.suggest-emote { block-size: 28px; }
.suggest-source { margin-inline-start: auto; color: var(--chat-muted); font-size: .7rem; }

.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-block-size: 30px; margin-block-start: 8px; }
.chat-identity {
  min-inline-size: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--chat-muted);
  font-size: .75rem;
  line-height: 1.3;
}
.chat-identity strong { color: var(--chat-text); font-weight: 650; }
.identity-name { margin-inline-start: 2px; }
.text-button { padding: 0; border: 0; background: none; color: #ffb347; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.text-button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.name-form { display: flex; align-items: center; gap: 6px; }
.name-field { inline-size: 14ch; padding: 3px 6px; border: 1px solid var(--chat-edge); border-radius: 4px; background: var(--chat-field); color: #fff; font: inherit; }
.name-field:focus { outline: 2px solid var(--orange); outline-offset: 0; }

.twitch-signin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 5px;
  border-radius: 4px;
  background: var(--twitch);
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.twitch-signin .twitch-glyph { background: rgb(0 0 0 / 28%); }
.twitch-signin:hover { background: #772ce8; }
.twitch-signin:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.chat-send {
  flex: 0 0 auto;
  padding: 7px 16px;
  border: 0;
  border-radius: 4px;
  background: var(--orange);
  color: #0e0e10;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 800;
}
.chat-send:hover { background: var(--orange-hot); }
.chat-send:disabled { opacity: .45; cursor: not-allowed; }

/* -- studio (broadcaster only) -- */
.studio-button {
  display: grid;
  place-items: center;
  inline-size: 28px;
  block-size: 26px;
  padding: 0;
  border: 1px solid var(--orange);
  border-radius: 999px;
  background: none;
  color: var(--orange-hot);
  cursor: pointer;
}
.studio-button[aria-expanded="true"], .studio-button:hover { background: var(--orange); color: #0e0e10; }
.studio-panel {
  position: absolute;
  inset: 44px 0 auto;
  z-index: 30;
  max-block-size: calc(100% - 44px);
  overflow-y: auto;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--chat-edge);
  background: #121215;
  box-shadow: 0 18px 40px rgb(0 0 0 / 55%);
  font-size: .76rem;
}
.studio-head { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; }
.studio-head strong { font-size: .85rem; }
.studio-version { flex: 1 1 auto; color: var(--chat-muted); font-size: .66rem; }
.studio-ok { margin: 0 0 8px; color: #7ee2a8; }
.studio-warnings { margin: 0 0 10px; padding: 8px 10px 8px 24px; border-radius: 4px; background: #3b2a12; color: #ffcf8a; }
.studio-warnings li + li { margin-block-start: 4px; }
.studio-grid { display: grid; gap: 1px; margin-block-end: 10px; border-radius: 4px; overflow: hidden; background: var(--chat-line); }
.studio-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; background: var(--chat-bg); }
.studio-row span { color: var(--chat-muted); }
.studio-row strong { min-inline-size: 0; overflow-wrap: anywhere; text-align: end; font-weight: 650; }
.studio-row.is-good strong { color: #7ee2a8; }
.studio-row.is-bad strong { color: #ff9a9a; }
.studio-problems { margin: 0 0 10px; color: var(--chat-muted); }
.studio-problems summary { cursor: pointer; color: #ffcf8a; }
.studio-problems ul { margin: 6px 0 0; padding-inline-start: 18px; }
.studio-recheck { padding: 6px 12px; border: 1px solid var(--chat-edge); border-radius: 4px; background: var(--chat-raised); color: #fff; cursor: pointer; font: inherit; font-weight: 700; }
.studio-recheck:hover { border-color: var(--orange); }

/* -- emote picker -- */
.emote-picker {
  inline-size: min(360px, calc(100vw - 16px));
  block-size: min(420px, 70vh);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--chat-edge);
  border-radius: 8px;
  background: var(--chat-raised);
  color: var(--chat-text);
  box-shadow: 0 16px 48px rgb(0 0 0 / 60%);
}
.emote-picker:popover-open { display: flex; flex-direction: column; }
.emote-picker.is-fallback { position: fixed; z-index: 50; display: flex; flex-direction: column; }

@supports (anchor-name: --x) {
  .chat-compose { anchor-name: --r2s-compose; }
  .emote-picker {
    position-anchor: --r2s-compose;
    inset: auto;
    inset-inline-start: anchor(left);
    inset-inline-end: anchor(right);
    inset-block-end: anchor(top);
    inline-size: auto;
    margin: 0 0 6px;
  }
}

.picker-head { flex: 0 0 auto; padding: 8px; border-bottom: 1px solid var(--chat-line); }
.picker-search {
  inline-size: 100%;
  padding: 7px 9px;
  border: 1px solid var(--chat-edge);
  border-radius: 4px;
  background: var(--chat-field);
  color: #fff;
  font: inherit;
  font-size: .82rem;
}
.picker-search:focus { outline: 2px solid var(--orange); outline-offset: -1px; }

.picker-tabs { flex: 0 0 auto; display: flex; gap: 2px; padding: 4px 6px; overflow-x: auto; border-bottom: 1px solid var(--chat-line); scrollbar-width: none; }
.picker-tab {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--chat-muted);
  cursor: pointer;
  font: 700 .68rem/1 system-ui, sans-serif;
  letter-spacing: .03em;
}
.picker-tab:hover, .picker-tab.is-current { background: var(--chat-line); color: #fff; }
.picker-tab:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }

.picker-body { flex: 1 1 auto; min-block-size: 0; padding: 0 8px 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--chat-edge) transparent; }
.picker-section-title {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 2px 6px;
  background: var(--chat-raised);
  color: var(--chat-muted);
  font: 700 .66rem/1 system-ui, sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; }
.picker-emote {
  display: grid;
  place-items: center;
  block-size: 40px;
  padding: 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.picker-emote:hover { background: var(--chat-edge); }
.picker-emote:focus-visible { background: var(--chat-edge); outline: 2px solid var(--orange); outline-offset: -2px; }
.picker-emote .emote { block-size: 28px; max-inline-size: 36px; object-fit: contain; }
.picker-emote--emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 1.45rem; line-height: 1; }
.picker-loading { margin: 4px 2px; color: var(--chat-muted); font-size: .75rem; }

.picker-preview { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-block-size: 48px; padding: 6px 10px; border-top: 1px solid var(--chat-line); font-size: .78rem; }
.picker-preview:empty::before { content: "Pick an emote"; color: var(--chat-muted); }
.picker-preview-image { block-size: 36px; inline-size: auto; }
.picker-preview-emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 1.8rem; line-height: 1; }
.picker-preview-label { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .picker-body { scroll-behavior: auto; }
}
