:root {
  --bg: #0d0b14;
  --bg-elev: #15121f;
  --surface: #1c1829;
  --surface-2: #252036;
  --surface-hover: #2c2640;
  --border: #2f2945;
  --text: #f3f0fa;
  --text-2: #b8b0cc;
  --muted: #8a82a0;
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-ink: #1a1030;
  --danger: #f87171;
  --success: #34d399;
  --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ink: 255, 255, 255; /* hovers and tracks: a see-through tint of the text colour */
  --bg-rgb: 13, 11, 20;
  --elev-rgb: 21, 18, 31;
  --warn: #fbbf24;
  --primary-hover: #fff;
  color-scheme: dark;
}

/* Light: picked with the switch (data-theme="light"), or the device's setting until someone picks. */
:root[data-theme="light"] {
  --bg: #f6f4fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #efebf8;
  --surface-hover: #e8e2f5;
  --border: #ded7ee;
  --text: #1a1430;
  --text-2: #4a4262;
  --muted: #6e6688;
  --accent: #7c3aed;
  --accent-2: #db2777;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 10px 40px rgba(40, 20, 90, 0.12);
  --ink: 40, 25, 80;
  --bg-rgb: 246, 244, 251;
  --elev-rgb: 255, 255, 255;
  --warn: #b45309;
  --primary-hover: #000;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f4fb;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-2: #efebf8;
    --surface-hover: #e8e2f5;
    --border: #ded7ee;
    --text: #1a1430;
    --text-2: #4a4262;
    --muted: #6e6688;
    --accent: #7c3aed;
    --accent-2: #db2777;
    --accent-ink: #ffffff;
    --danger: #dc2626;
    --success: #059669;
    --shadow: 0 10px 40px rgba(40, 20, 90, 0.12);
    --ink: 40, 25, 80;
    --bg-rgb: 246, 244, 251;
    --elev-rgb: 255, 255, 255;
    --warn: #b45309;
    --primary-hover: #000;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
img { display: block; }

.icon { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }

/* ---------------- Buttons & inputs ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 18px; font-weight: 600;
  background: var(--surface-2);
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--gradient); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.is-confirming { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-2);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(var(--ink), 0.08); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-btn--primary { width: 56px; height: 56px; background: var(--text); color: var(--bg); }
.icon-btn--primary svg { width: 26px; height: 26px; }
.icon-btn--primary:hover { background: var(--primary-hover); color: var(--bg); transform: scale(1.04); }
.icon-btn--primary:disabled { background: var(--text); transform: none; }
.icon-btn--sm { width: 36px; height: 36px; }
.icon-btn--sm svg { width: 18px; height: 18px; }
/* The light/dark switch: top right of the start screen (it scrolls with it) */
.join-screen { position: relative; }
.join-theme { position: absolute; top: 12px; right: 12px; z-index: 2; color: var(--text-2); }
.chat__form .icon-btn--primary { width: 42px; height: 42px; background: var(--gradient); color: var(--accent-ink); }
.chat__form .icon-btn--primary svg { width: 18px; height: 18px; }

.input {
  width: 100%;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- Brand ---------------- */

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand__logo {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--gradient); color: var(--accent-ink);
}
.brand__logo svg { width: 18px; height: 18px; }
.brand--large { font-size: 24px; justify-content: center; }
.brand--large .brand__logo { width: 44px; height: 44px; border-radius: 14px; }
.brand--large .brand__logo svg { width: 24px; height: 24px; }

/* ---------------- Join ---------------- */

.join-screen {
  height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 40px 16px 32px;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(167, 139, 250, 0.18), transparent 70%),
    radial-gradient(600px 400px at 80% 90%, rgba(244, 114, 182, 0.14), transparent 70%),
    var(--bg);
}
.join-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 32px 28px; box-shadow: var(--shadow);
}
.join-card__tagline { text-align: center; color: var(--text-2); margin: 12px 0 28px; }
.join-form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__label .field__icon { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }

/* Join a chat / Create a chat */
.join-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--border); }
.join-modes button { padding: 8px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.join-modes button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.45); }
.join-fields { display: grid; gap: 18px; }
.join-fields[hidden] { display: none; }
.visibility { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.visibility__opt { position: relative; cursor: pointer; }
.visibility__opt input { position: absolute; opacity: 0; pointer-events: none; }
.visibility__opt span { display: grid; gap: 3px; height: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); transition: border-color 0.15s, background 0.15s; }
.visibility__opt .icon { width: 18px; height: 18px; color: var(--text-2); margin-bottom: 2px; }
.visibility__opt strong { font-size: 14px; }
.visibility__opt small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.visibility__opt input:checked + span { border-color: var(--accent); background: rgba(167, 139, 250, 0.1); }
.visibility__opt input:checked + span .icon { color: var(--accent); }
.visibility__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3); }
.join-error { margin: -6px 0 0; color: var(--danger); font-size: 13.5px; }
.join-error:empty { display: none; }

/* The chat list under the join card */
.lobby { width: 100%; max-width: 420px; }
.lobby__head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; }
.lobby__head h2 { margin: 0; font-size: 15px; }
.lobby__count { color: var(--muted); font-weight: 500; }
.lobby__list { display: grid; gap: 6px; }
.lobby-room { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.lobby-room:hover { border-color: rgba(167, 139, 250, 0.5); background: var(--surface-hover); }
.lobby-room .chat-avatar { width: 40px; height: 40px; }
.lobby-room__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lobby-room__name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14.5px; }
.lobby-room__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-room__name .icon { flex: none; width: 14px; height: 14px; color: var(--muted); }
.lobby-room__meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.lobby-room__meta .live { display: inline-flex; align-items: center; gap: 5px; color: var(--success); }
.lobby-room__meta .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.lobby-room__meta .jam-tag { color: var(--accent); }
.lobby-room__song { overflow: hidden; text-overflow: ellipsis; }
.lobby-room__go { flex: none; font-size: 13px; font-weight: 700; color: var(--accent); }
.lobby__empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13.5px; border: 1px dashed var(--border); border-radius: 14px; }

/* Wide screens: the chat list is a side menu on the left, full height, like a chat app's
   conversation list; the join card sits in the middle of the rest. Phones keep it under the card. */
@media (min-width: 900px) {
  /* The page scrolls (not the card) if the form is taller than the window; the list stays put. */
  .join-screen {
    display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(100%, auto); grid-template-areas: "lobby main";
    gap: 0; padding: 0; overflow-x: hidden; overflow-y: auto;
  }
  .join-card { grid-area: main; align-self: center; justify-self: center; margin: 28px; padding: 28px 26px; }
  .join-card__tagline { margin: 10px 0 22px; }
  .join-form, .join-fields { gap: 15px; }
  .lobby {
    grid-area: lobby; align-self: start; position: sticky; top: 0; max-width: none; height: 100vh; height: 100dvh; overflow-y: auto; padding: 18px 10px 24px;
    background: rgba(var(--elev-rgb), 0.88); border-right: 1px solid var(--border);
  }
  /* A thin scrollbar that only shows while you point at the list, like Messenger's */
  .lobby { scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable; transition: scrollbar-color 0.2s; }
  .lobby:hover, .lobby:focus-within { scrollbar-color: rgba(var(--ink), 0.22) transparent; }
  .lobby::-webkit-scrollbar { width: 8px; }
  .lobby::-webkit-scrollbar-track { background: transparent; }
  .lobby::-webkit-scrollbar-thumb { border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; background-color: transparent; }
  .lobby:hover::-webkit-scrollbar-thumb, .lobby:focus-within::-webkit-scrollbar-thumb { background-color: rgba(var(--ink), 0.22); }
  .lobby::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--ink), 0.35); }
  .lobby__head { margin: 2px 10px 12px; }
  .lobby__head h2 { font-size: 18px; }
  .lobby__list { gap: 2px; }
  .lobby-room { border-color: transparent; background: transparent; padding: 10px; border-radius: 12px; }
  .lobby-room:hover { border-color: transparent; background: rgba(var(--ink), 0.05); }
  .lobby-room:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .lobby-room.is-picked { background: rgba(167, 139, 250, 0.12); }
  .lobby-room .chat-avatar { width: 44px; height: 44px; border-radius: 14px; }
  /* "Join" only shows on the row you point at, as in a chat list */
  .lobby-room__go { opacity: 0; transition: opacity 0.15s; }
  .lobby-room:hover .lobby-room__go, .lobby-room:focus-visible .lobby-room__go, .lobby-room.is-picked .lobby-room__go { opacity: 1; }
  .lobby__empty { margin: 0 8px; }
}

/* ---------------- App shell: chat first, jam on the side ---------------- */

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.chat-header {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-elev);
}
.chat-header__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px;
  background: var(--gradient); color: var(--accent-ink); font-weight: 800; font-size: 14px;
}
.chat-header__text { min-width: 0; display: grid; text-align: left; }
.chat-info-btn { padding: 4px 10px 4px 4px; margin-left: -4px; border: 0; border-radius: 14px; background: none; color: inherit; font: inherit; cursor: pointer; }
.chat-info-btn:hover { background: rgba(var(--ink), 0.05); }
.chat-info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-avatar--lg { width: 72px; height: 72px; border-radius: 22px; font-size: 26px; }
.chat-header__name { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header__meta { margin: 2px 0 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header__actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* Notifications menu */
.notify { position: relative; }
#notify-btn.is-off { color: var(--muted); }
#notify-btn[aria-expanded="true"] { color: var(--accent); background: rgba(167, 139, 250, 0.12); }
.notify-menu {
  position: absolute; top: calc(100% + 8px); right: -8px; z-index: 60; width: 290px; padding: 12px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  animation: toast-in 0.14s ease-out;
}
.notify-menu__title { margin: 2px 6px 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.notify-opt { display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; }
.notify-opt:hover { background: rgba(var(--ink), 0.05); }
.notify-opt input { margin: 3px 0 0; accent-color: var(--accent); }
.notify-opt span { display: grid; gap: 1px; }
.notify-opt strong { font-size: 14px; }
.notify-opt small { font-size: 12px; color: var(--muted); }
.notify-sound { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; padding: 11px 8px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.notify-sound input { margin: 3px 0 0; accent-color: var(--accent); }
.notify-sound span { display: grid; gap: 1px; }
.notify-sound strong { font-size: 14px; }
.notify-sound small { font-size: 12px; color: var(--muted); }
.notify-menu.is-off .notify-sound { opacity: 0.5; pointer-events: none; }
.notify-menu__status { margin: 8px 6px 2px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.notify-menu__status:empty { display: none; }
.notify-menu__status.is-warn { color: var(--warn); }
.notify-menu__status .btn { margin-top: 8px; }
.leave-chat { color: var(--text-2); }
.leave-chat:hover { color: var(--danger); }
.conn-status { color: var(--warn); }

.avatars { display: flex; }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: #140f20;
  border: 2px solid var(--bg-elev);
}
.avatars .avatar + .avatar { margin-left: -8px; }
.avatar--more { background: var(--surface-2); color: var(--text-2); }
.avatar.is-jamming { box-shadow: 0 0 0 2px var(--accent); }
.avatars--sm .avatar { width: 24px; height: 24px; font-size: 10px; }
.avatar--xs { width: 18px; height: 18px; font-size: 8px; border: 0; }

/* "Queued by" tag on songs: the person's avatar + name, or an Autoplay tag */
.queued-by { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queued-by--auto { color: var(--accent); }
.queued-by--auto .icon { width: 12px; height: 12px; }
.eyebrow__by { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }

/* Animated equalizer bars — "music is playing" */
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; flex: none; }
.eq i { width: 3px; height: 3px; background: currentColor; border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.is-paused .eq i, .player:not(.is-playing) .eq i { animation-play-state: paused; }

.jam-btn { gap: 8px; }
.jam-btn .eq { display: none; }
.jam-btn.is-live .eq { display: inline-flex; }
.jam-btn.is-live .jam-btn__icon { display: none; }
.jam-btn__labels { display: inline-grid; }
.jam-btn__labels > * { grid-area: 1 / 1; text-align: center; }
.jam-btn__labels > [aria-hidden] { visibility: hidden; }
/* Small phones: just the jam button's icon (the label stays for screen readers; the title says it) */
@media (max-width: 420px) {
  .jam-btn { width: 40px; height: 36px; padding: 0; justify-content: center; }
  .jam-btn__labels { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* In the jam: a quieter "Jamming" toggle with live bars */

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.layout.has-jam { grid-template-columns: minmax(0, 1fr) var(--jam-width, 400px); }

/* ---------------- Jam panel ---------------- */

.jam { position: relative; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--bg-elev); }
/* The panel's left edge: drag it to resize (app.js) */
.jam__resize { position: absolute; top: 0; bottom: 0; left: -5px; width: 10px; z-index: 5; cursor: col-resize; touch-action: none; }
.jam__resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background 0.15s; }
.jam__resize:hover::after, .jam__resize:focus-visible::after, .is-resizing .jam__resize::after { background: var(--accent); }
.jam__resize:focus-visible { outline: none; }
/* While resizing, the YouTube frame mustn't swallow the mouse, and text shouldn't get selected */
.is-resizing { cursor: col-resize; user-select: none; }
.is-resizing iframe { pointer-events: none; }
.jam__header {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border);
}
.jam__handle { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.jam__title { font-weight: 800; font-size: 15px; }
.jam__meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jam__header-actions { display: flex; align-items: center; gap: 8px; flex: none; }


/* ---------------- Player (inside the jam) ---------------- */

.player { position: relative; overflow: hidden; flex: none; border-bottom: 1px solid var(--border); }
.player__bg {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(50px) saturate(1.4); opacity: 0; transition: opacity 0.6s, background-image 0.6s;
}
.player__bg.is-visible { opacity: 0.4; }
.player__bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(var(--bg-rgb), 0.2), rgba(var(--bg-rgb), 0.75)); }
.player__inner { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 16px; align-items: start; }
.player__art-wrap.is-video { grid-column: 1 / -1; }
.player__art-wrap.is-video + .player__meta { grid-column: 1 / -1; }
.player__art {
  width: 96px; height: 96px; border-radius: 10px; object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); background: var(--surface-2);
}
.player__art--empty { display: grid; place-items: center; color: var(--muted); }
.player__art--empty svg { width: 36px; height: 36px; opacity: 0.6; }
/* YouTube requires the player to stay visible and at least 200×200 px. */
.player__video { width: min(100%, 720px); margin-inline: auto; aspect-ratio: 16 / 9; min-height: 200px; border-radius: 10px; overflow: hidden; background: #000; }
.player__video iframe { display: block; width: 100%; height: 100%; border: 0; }
.player__art-wrap.is-video .player__art { display: none; }

.player__meta { min-width: 0; }

/* Folded (the ⌃ button in the jam's header, or searching): the player becomes a slim "now playing"
   strip, so Up next, Search and Recommended get the room. The video is hidden meanwhile (see the
   rule below the minimized jam):
   floating in the corner if you keep it on screen, otherwise out of sight (it keeps playing).
   Tap the strip, or ⌄, to unfold it. */
.player-fold { color: var(--text-2); }
.player-fold svg { transform: rotate(180deg); transition: transform 0.2s; }
.jam.is-compact .player-fold svg { transform: none; }
.jam.is-compact .player { cursor: pointer; }
.jam.is-compact .player__inner { grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 16px; animation: toast-in 0.18s ease-out; }
.jam.is-compact .player__art-wrap, .jam.is-compact .player__art-wrap.is-video + .player__meta { grid-column: auto; }
.jam.is-compact .player__art, .jam.is-compact .player__art-wrap.is-video .player__art { display: block; width: 44px; height: 44px; border-radius: 8px; }
.jam.is-compact .player__art-wrap.is-video .player__art[hidden] { display: none; }
.jam.is-compact .player__art--empty svg { width: 20px; height: 20px; }
.jam.is-compact .player__title { margin: 2px 0 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jam.is-compact .player__artist { margin: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jam.is-compact :is(.player__album, .player__source, .progress, .times, .jam-option, .controls .volume) { display: none; }
/* Previous, play/pause and next stay on the strip, at its right (tapping anywhere else unfolds it) */
.jam.is-compact .player__meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.jam.is-compact .player__meta > * { grid-column: 1; }
.jam.is-compact .player__meta > .controls { grid-column: 2; grid-row: 1 / span 3; margin: 0; gap: 2px; }
.jam.is-compact .controls .icon-btn { width: 34px; height: 34px; }
.jam.is-compact .controls .icon-btn svg { width: 17px; height: 17px; }
.jam.is-compact .controls .icon-btn--primary { width: 38px; height: 38px; }
.jam.is-compact .controls .icon-btn--primary svg { width: 18px; height: 18px; }
.jam.is-compact #yt-slot {
  position: fixed; right: 16px; bottom: 84px; z-index: 30;
  width: 200px; height: 200px; min-height: 0; aspect-ratio: auto;
  border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.player__title {
  margin: 4px 0 2px; font-size: 18px; line-height: 1.25; letter-spacing: -0.01em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.player__artist { margin: 0; font-size: 14px; color: var(--text-2); }
.player__album { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.player__album:empty { display: none; }
.player__source { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.player__source:empty { display: none; }
.player__source a { color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.player__source a:hover { color: var(--text); text-decoration: underline; }
.player__source .icon { width: 12px; height: 12px; }
.player__source .link-btn { background: none; border: 0; padding: 0; margin-left: 6px; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.player__source .link-btn:hover { text-decoration: underline; }

/* "Wrong version?": the other videos this song could play */
.versions { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; }
.versions__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.versions__head strong { font-size: 13px; }
.versions__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 240px; overflow-y: auto; }
.version { display: grid; gap: 1px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.version:hover:not(:disabled) { background: var(--surface-hover); }
.version.is-current { background: var(--accent-tint, rgba(167, 139, 250, 0.14)); cursor: default; }
.version__title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version__meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versions__status { margin: 6px 2px; color: var(--muted); font-size: 12px; }
.versions__link { display: flex; gap: 6px; margin-top: 8px; }
.versions__link .input { flex: 1; padding: 7px 10px; font-size: 13px; }
.versions .btn--ghost { margin-top: 6px; width: 100%; justify-content: center; }
.versions__note { color: var(--muted); font-weight: 400; }
.jam.is-compact .versions { display: none; }

.progress { margin-top: 10px; padding: 8px 0; cursor: pointer; touch-action: none; }
.progress__track { position: relative; height: 4px; border-radius: 2px; background: rgba(var(--ink), 0.14); }
.progress__fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: var(--gradient); }
.progress__thumb {
  position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transform: scale(0); transition: transform 0.12s;
}
.progress:hover .progress__thumb, .progress.is-dragging .progress__thumb, .progress:focus-visible .progress__thumb { transform: scale(1); }
.progress.is-disabled { cursor: default; opacity: 0.5; }
.times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.controls .icon-btn { width: 40px; height: 40px; }
.controls .icon-btn svg { width: 20px; height: 20px; }
.controls .icon-btn--primary { width: 46px; height: 46px; }
.controls .icon-btn--primary svg { width: 22px; height: 22px; }
.volume { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.volume input { width: 80px; accent-color: var(--accent); }

.audio-unlock {
  position: absolute; inset: auto 16px 16px 16px; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 12px; border: 0;
  background: var(--gradient); color: var(--accent-ink); font-weight: 700;
  box-shadow: var(--shadow);
}

/* ---------------- Panel / tabs ---------------- */

/* Up next, Search, Recently played: always room for a few songs. The open player can be tall (a
   video is 16:9); when both don't fit, the whole jam scrolls (the list still scrolls on its own). */
.jam { overflow-y: auto; }
.panel { flex: 1 1 0; min-height: min(380px, 75vh); display: flex; flex-direction: column; }
/* The small floating video (collapsed player, "Keep a small video on screen") would cover the last
   songs: room to scroll them above it. */
.jam.is-compact:not(.hide-video):has(#yt-slot:not([hidden])) .tab-panel { padding-bottom: 224px; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active { background: var(--surface-2); color: var(--text); }
.badge { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; text-align: center; }

.tab-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; }
.panel__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 8px 8px; font-size: 13px; flex-wrap: wrap; }
.panel__actions { display: flex; gap: 6px; }

.empty { display: grid; justify-items: center; gap: 12px; padding: 32px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0; }

.search { position: relative; margin: 4px 4px 8px; }
.search__icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.search__input { padding-left: 42px; border-radius: 999px; }


.result-group + .result-group { margin-top: 12px; }
.result-group__head { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px 4px; }
.result-group__head h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.result-group__head span { font-size: 12px; color: var(--muted); }
.result-group__empty { padding: 4px 8px 8px; font-size: 13px; color: var(--muted); margin: 0; }

.src-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  background: rgba(52, 211, 153, 0.14); color: var(--success);
}

/* ---------------- Track rows ---------------- */

.track-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: relative; }
.track.is-leaving { pointer-events: none; z-index: 1; }
.track {
  display: grid; grid-template-columns: auto 48px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px; border-radius: 12px; transition: background 0.12s;
}
.track:hover { background: var(--surface-hover); }
.track--clickable { cursor: pointer; user-select: none; }
.track--clickable:active { background: var(--surface-2); }
.track--no-grip { grid-template-columns: 48px minmax(0, 1fr) auto; }
/* Up next: the number, swapped for a drag handle of the same size on hover (so the row doesn't move) */
.track__index { display: block; width: 22px; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track__grip { width: 22px; height: 22px; color: var(--muted); cursor: grab; display: none; place-items: center; }
.track__grip svg { width: 18px; height: 18px; }
.track:hover .track__index { display: none; }
.track:hover .track__grip { display: grid; }
/* Touch screens can't hover, so the handle is always there; it drags the row (app.js). */
@media (hover: none) {
  #queue-list .track__index { display: none; }
  #queue-list .track__grip { display: grid; touch-action: none; }
}
#queue-list.is-sorting .track:not(.is-lifted) { transition: transform 0.18s ease; }
.track.is-lifted { position: relative; z-index: 2; background: var(--surface-2); box-shadow: var(--shadow); }
.track__art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.track__info { min-width: 0; }
.track__title, .track__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track__title { font-weight: 600; }
.track__sub { font-size: 13px; color: var(--text-2); }
.track__by { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.track__by > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.track__art--empty { display: grid; place-items: center; color: var(--muted); }
.track__art--empty svg { width: 20px; height: 20px; }
.track__explicit { display: inline-block; margin-left: 6px; padding: 0 4px; border-radius: 3px; background: var(--muted); color: var(--bg); font-size: 10px; font-weight: 800; vertical-align: 2px; }
.track__actions { display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.12s; }
.track:hover .track__actions, .track:focus-within .track__actions { opacity: 1; }
.track__actions .icon-btn { width: 34px; height: 34px; }
.track__actions .icon-btn svg { width: 17px; height: 17px; }
.track__actions .icon-btn--danger:hover { color: var(--danger); }
.track .tag { font-size: 12px; font-weight: 600; color: var(--success); padding: 0 8px; white-space: nowrap; }
.track .tag:empty { display: none; }
.track.is-dragging { opacity: 0.4; }
.track.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.track.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

.skeleton { height: 64px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-hover) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Minimized jam: the panel collapses away. The video slot is kept in the corner (so a visible
   video is one rule away, see below), but hidden. `visibility` keeps it playing. */
.layout.has-jam.jam-minimized { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.jam.is-minimized {
  position: fixed; top: 0; left: 0; width: 0; height: 0; overflow: visible;
  visibility: hidden; border: 0; pointer-events: none;
}
.jam.is-minimized #yt-slot {
  visibility: visible; pointer-events: auto;
  position: fixed; right: 16px; bottom: 84px; z-index: 30;
  width: 200px; height: 200px; min-height: 0; aspect-ratio: auto;
  border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
/* Hide jam and the collapsed player hide the video too (the music keeps playing), unless "Keep a small
   video" is on; then it floats in the corner. YouTube's terms want a playing video visible, so before
   publishing, turn that option on by default. */
.jam.hide-video.is-minimized #yt-slot, .jam.hide-video.is-compact #yt-slot { visibility: hidden; pointer-events: none; }
.jam-option { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.jam-option input { accent-color: var(--accent); margin: 0; }
.jam-option__note { color: var(--muted); }

/* The jam bar: what's playing with its controls right beside it, then Hide/Show jam and Leave. */
/* The slim bar while the jam is hidden: what's playing, with its controls right beside it. Tap it to open the jam. */
.jam-mini { padding: 4px 6px 4px 14px; gap: 4px; cursor: pointer; }
.jam-mini:hover { border-color: rgba(167, 139, 250, 0.55); }
.jam-mini .jam-banner__text { flex: 0 1 auto; }
.jam-mini__controls { flex: none; display: flex; align-items: center; }
.jam-mini .jam-mini__play { color: var(--text); }
.jam-mini__actions { flex: none; display: flex; align-items: center; margin-left: auto; padding-left: 8px; }

.jam-option--autoplay { margin: 0 8px 8px; }
.jam-mini .jam-banner__text { margin-right: 4px; }
.jam-mini .icon-btn { color: var(--text-2); }

/* ---------------- Chat ---------------- */

.chat { min-height: 0; display: flex; flex-direction: column; }
.jam-banner {
  flex: none; display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.16), rgba(244, 114, 182, 0.12));
  border: 1px solid rgba(167, 139, 250, 0.3); color: var(--accent); font-size: 13px;
}
.jam-banner__text { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jam-banner__text strong { color: var(--text); font-weight: 700; }

.notify-ask {
  flex: none; display: flex; align-items: center; gap: 12px;
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid rgba(167, 139, 250, 0.35); box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
}
.notify-ask__icon { flex: none; width: 22px; height: 22px; color: var(--accent); }
.notify-ask__text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notify-ask__text strong { font-size: 14px; }
.notify-ask__text span { font-size: 12.5px; color: var(--muted); }
.notify-ask__actions { flex: none; display: flex; gap: 8px; }
@media (max-width: 560px) {
  .notify-ask { flex-wrap: wrap; margin: 10px 12px 0; }
  .notify-ask__text { flex-basis: calc(100% - 34px); }
  .notify-ask__actions { width: 100%; justify-content: flex-end; }
}

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.messages > * { width: 100%; max-width: 820px; margin-inline: auto; }
/* Messages as bubbles, Messenger style: others on the left with their avatar and name,
   yours on the right in the accent colour. */
.msg {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 2px 4px;
  position: relative; border-radius: 12px; transition: background 0.3s, transform 0.15s; touch-action: pan-y;
}
.msg + .msg:not(.msg--cont) { margin-top: 8px; }
.msg .avatar { width: 34px; height: 34px; border: 0; margin-top: 18px; }
.msg--cont .avatar { visibility: hidden; height: 0; }
.msg__body { min-width: 0; max-width: min(75%, 560px); display: flex; flex-direction: column; align-items: flex-start; }
.msg__head { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 2px; }
.msg__name { font-weight: 700; font-size: 13px; color: var(--c, var(--text-2)); }
/* Light mode: each person's colour, half darker, so even yellow and lime names read (contrast ≥ 5) */
:root[data-theme="light"] .msg__name { color: color-mix(in srgb, var(--c, #6e6688) 50%, #000); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .msg__name { color: color-mix(in srgb, var(--c, #6e6688) 50%, #000); }
}
.msg__time { font-size: 11px; color: var(--muted); }
.msg__text {
  margin: 0; padding: 8px 13px; border-radius: 18px; background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 15px; line-height: 1.35;
}

/* Yours: on the right, no avatar or name (hover a bubble for its time). */
.msg--me { flex-direction: row-reverse; }
.msg--me .avatar, .msg--me .msg__head { display: none; }
.msg--me .msg__body { align-items: flex-end; }
/* Read receipts: who has seen up to here */
/* A line of its own under the message, at the chat's right edge, whoever sent it */
.msg__seen { order: 10; flex-basis: 100%; display: flex; align-items: center; justify-content: flex-end; margin-top: -4px; padding-right: 2px; animation: toast-in 0.2s ease-out; }
.msg .msg__seen .avatar { display: grid; width: 18px; height: 18px; margin: 0 0 0 -5px; font-size: 8px; font-weight: 800; border: 1.5px solid var(--bg); visibility: visible; }
.msg .msg__seen .avatar:first-child { margin-left: 0; }
.msg__seen-more { margin-right: 4px; font-size: 11px; color: var(--muted); }
.msg--me .msg__text { background: #7c3aed; color: #fff; }

/* Replies */
.msg__reply-btn {
  flex: none; align-self: center; width: 30px; height: 30px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.msg__reply-btn svg { width: 15px; height: 15px; }
.msg__actions { flex: none; align-self: center; display: flex; gap: 4px; }
.msg[data-id]:hover .msg__reply-btn, .msg__reply-btn:focus-visible, .msg.is-reacting .msg__reply-btn { opacity: 1; pointer-events: auto; }
/* Phones: swipe a message to reply and hold it to react, so no buttons beside every message */
@media (hover: none) { .msg__actions { display: none; } }
.msg__quote {
  display: grid; gap: 1px; max-width: 100%; margin: 2px 0 -6px; padding: 6px 12px 12px;
  border: 0; border-left: 3px solid var(--quote-color, var(--accent)); border-radius: 14px;
  background: rgba(var(--ink), 0.05); color: var(--text-2); text-align: left; font-size: 13px; cursor: pointer;
}
.msg--me .msg__quote { border-left: 0; border-right: 3px solid var(--quote-color, var(--accent)); text-align: right; }
.msg__quote:hover { background: rgba(var(--ink), 0.08); }
.msg__quote-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); }
.msg--me .msg__quote-label { justify-content: flex-end; }
.msg__quote-label .icon { width: 11px; height: 11px; }
.msg__quote-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.is-flash { background: rgba(167, 139, 250, 0.18); }
.msg.is-swiping { transition: none; }

/* ---------------- Emoji (Slack style) ---------------- */

.emoji { display: inline-block; width: 1.35em; height: 1.35em; object-fit: contain; vertical-align: -0.3em; margin: 0 1px; }
.msg__text--jumbo { background: transparent !important; padding: 2px 4px; font-size: 34px; line-height: 1.15; }
.msg__text--jumbo .emoji { width: 44px; height: 44px; vertical-align: middle; }
.emoji-token { color: inherit; }

.chat { position: relative; }
.chat__emoji-btn { flex: none; align-self: center; color: var(--text-2); }
.chat__emoji-btn[aria-expanded="true"] { color: var(--accent); background: rgba(167, 139, 250, 0.12); }

.emoji-panel {
  position: absolute; left: max(16px, calc((100% - 852px) / 2 + 16px)); bottom: 72px; z-index: 20;
  width: min(380px, calc(100% - 32px)); max-height: min(460px, 70vh); overflow-y: auto;
  padding: 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  animation: toast-in 0.15s ease-out;
}
.emoji-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.emoji-panel__title { margin: 10px 2px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.emoji-panel__empty { margin: 0 2px; font-size: 13px; color: var(--muted); }
.emoji-panel__empty code { color: var(--text-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
/* Slack's category tabs, pinned under the search box while the list scrolls */
.emoji-cats { position: sticky; top: -12px; z-index: 2; display: flex; gap: 2px; margin: 0 -12px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.emoji-cats[hidden] { display: none; }
.emoji-cats__tab { flex: 1 0 auto; min-width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; font-size: 17px; line-height: 1; color: var(--text-2); cursor: pointer; opacity: 0.6; }
.emoji-cats__tab:hover { background: var(--surface-2); opacity: 1; }
.emoji-cats__tab.is-active { background: var(--surface-2); opacity: 1; box-shadow: inset 0 -2px 0 var(--accent); }
.emoji-tile {
  position: relative; display: grid; place-items: center; height: 40px; border: 0; border-radius: 10px;
  background: transparent; font-size: 22px; line-height: 1;
}
.emoji-tile:hover { background: var(--surface-2); }
.emoji-tile img { width: 28px; height: 28px; object-fit: contain; }
.emoji-tile__remove {
  position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  display: none; place-items: center; background: var(--danger); color: #fff; font-size: 12px; line-height: 1;
}
.emoji-cell { position: relative; display: grid; }
.emoji-cell:hover .emoji-tile__remove, .emoji-cell:focus-within .emoji-tile__remove { display: grid; }
@media (hover: none) { .emoji-tile__remove { display: grid; opacity: 0.8; } }

.emoji-add { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 10px; margin-bottom: 4px; border-radius: 12px; background: var(--bg-elev); }
.emoji-add__preview { grid-row: span 2; width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.emoji-add__field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.emoji-add__name { display: flex; align-items: center; gap: 2px; color: var(--muted); }
.emoji-add__name .input { padding: 7px 10px; }
.emoji-add__actions { display: flex; justify-content: flex-end; gap: 6px; }
.emoji-add__error { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--danger); }

.emoji-remove { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(248, 113, 113, 0.1); font-size: 13px; }
.emoji-remove span { flex: 1; min-width: 0; }
.emoji-remove__ok { background: var(--danger); color: #fff; }

.emoji-suggest {
  flex: none; width: 100%; max-width: 852px; margin: 0 auto; padding: 4px 16px 0;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.emoji-suggest__item {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px;
}
.emoji-suggest__item[aria-selected="true"], .emoji-suggest__item:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
.emoji-suggest__item img { width: 20px; height: 20px; object-fit: contain; }
.emoji-suggest__hint { color: var(--muted); font-size: 12px; }
.mention-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-size: 11px; font-weight: 800; }

/* Mentions: @here, @channel, @Name */
.mention { padding: 0 3px; border-radius: 4px; background: rgba(167, 139, 250, 0.18); color: var(--accent); font-weight: 600; }
.mention--me { background: rgba(251, 191, 36, 0.22); color: var(--warn); }
.msg--me .mention { background: rgba(255, 255, 255, 0.2); color: #fff; }
/* A message that mentions you */
.msg--mention { background: rgba(251, 191, 36, 0.07); }
.msg--mention .msg__text { box-shadow: inset 3px 0 0 #fbbf24; }
.emoji-suggest__glyph { font-size: 18px; line-height: 1; }

/* Reactions under a message */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg--me .reactions { justify-content: flex-end; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 15px; line-height: 1;
  transition: border-color 0.12s, background 0.12s;
}
.reaction:hover { border-color: var(--text-2); }
.reaction.is-mine { border-color: var(--accent); background: rgba(167, 139, 250, 0.16); color: var(--text); }
.reaction__count { font-size: 12px; font-weight: 700; }
.reaction__img { width: 18px; height: 18px; object-fit: contain; }
.reaction__text { font-size: 12px; }
.reaction--add { padding: 0 7px; opacity: 0; transition: opacity 0.12s; }
.reaction--add svg { width: 15px; height: 15px; }
.msg[data-id]:hover .reaction--add, .reaction--add:focus-visible, .msg.is-reacting .reaction--add { opacity: 1; }
@media (hover: none) { .reaction--add { opacity: 1; } }

/* The emoji panel as a reaction picker, next to its message */
.emoji-panel--react { bottom: auto; }
.emoji-panel--react #emoji-add-btn { display: none; }
.emoji-panel__search { margin-bottom: 4px; padding: 8px 12px; border-radius: 10px; }

.emoji-preview {
  position: sticky; bottom: -12px; display: flex; align-items: center; gap: 10px;
  margin: 10px -12px -12px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface);
}
.emoji-preview__icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; font-size: 30px; line-height: 1; }
.emoji-preview__icon img { width: 36px; height: 36px; object-fit: contain; }
.emoji-preview__text { min-width: 0; display: grid; font-size: 12px; color: var(--muted); }
.emoji-preview__text strong { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hover tooltips: an emoji's :name:, who reacted */
.tip {
  position: fixed; z-index: 100; max-width: 260px; padding: 6px 10px; border-radius: 8px; pointer-events: none;
  background: #000; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.35; text-align: center; white-space: pre-line;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.emoji-glyph { cursor: default; }

/* Files about to be sent: a preview each, a loader while uploading, ✕ to take it back */
.attach-tray { display: flex; flex-wrap: wrap; gap: 8px; max-height: 164px; overflow-y: auto; margin: 0 8px; padding: 10px 2px 8px; border-bottom: 1px solid var(--border); }
.attach { position: relative; flex: none; height: 64px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); animation: toast-in 0.15s ease-out; }
.attach--image { width: 64px; overflow: hidden; }
.attach.is-error { border-color: var(--danger); }
.attach__thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach__file { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 30px 0 12px; max-width: 240px; }
.attach__file .icon { width: 22px; height: 22px; flex: none; color: var(--accent); }
.attach__meta { display: grid; min-width: 0; }
.attach__name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach__size { font-size: 12px; color: var(--muted); }
.attach.is-error .attach__size { color: var(--danger); }
/* The loader: a ring that fills as the upload goes, over the preview */
.attach__loader {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  background: rgba(13, 11, 20, 0.55);
}
.attach__loader::before {
  content: ''; position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 12px, #000 13px); mask: radial-gradient(circle, transparent 12px, #000 13px);
}
.attach__loader span { position: relative; font-size: 9px; font-weight: 800; color: #fff; }
.attach--image .attach__loader span { display: none; }
/* On a file chip the ring sits where the file icon is, so the name stays readable */
.attach__file .attach__loader { position: relative; inset: auto; flex: none; width: 26px; height: 26px; background: none; }
.attach__file .attach__loader::before { width: 26px; height: 26px; -webkit-mask: radial-gradient(circle, transparent 9px, #000 10px); mask: radial-gradient(circle, transparent 9px, #000 10px); }
.attach__file .attach__loader span { display: none; }
.attach__loader.is-waiting::before { background: conic-gradient(var(--accent) 25%, rgba(255, 255, 255, 0.18) 0); animation: spin 0.8s linear infinite; }
/* A sent photo shimmers until it has loaded */
.msg__image.is-loading { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; }
.msg__image.is-loading img { opacity: 0; }
.msg__image img { transition: opacity 0.2s; }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.attach__failed { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(248, 113, 113, 0.45); color: #fff; font-weight: 800; font-size: 22px; }
.attach__remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(13, 11, 20, 0.75); color: #fff; cursor: pointer;
}
.attach__remove svg { width: 12px; height: 12px; }
.attach__remove:hover { background: var(--danger); }

/* Chat info: the whole screen, its content in a centred column */
body.has-chat-info { overflow: hidden; }
.chat-info { position: fixed; inset: 0; z-index: 150; display: flex; background: var(--bg-elev); animation: chat-info-in 0.18s ease-out; }
.chat-info__panel { width: 100%; height: 100%; display: flex; flex-direction: column; }
@keyframes chat-info-in { from { transform: translateY(12px); opacity: 0; } }
.chat-info__top { flex: none; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--border); }
.chat-info__scroll > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.chat-info__scroll > .chat-info__search, .chat-info__scroll > .chat-info__tabs { max-width: none; }
.chat-info__search > *, .chat-info__tabs > * { max-width: 720px; }
.chat-info__search { justify-content: center; }
.chat-info__search input { max-width: 720px; }
.chat-info__tabs { justify-content: center; }
.chat-info__tabs button { max-width: 180px; }
.chat-info__heading { font-weight: 700; font-size: 16px; }
.chat-info__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chat-info__hero { display: grid; justify-items: center; gap: 4px; padding: 24px 20px 16px; text-align: center; }
.chat-info__hero .chat-avatar { margin-bottom: 8px; }
.chat-info__name { margin: 0; font-size: 20px; }
.chat-info__name-row { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; max-width: 100%; }
.chat-info__name-row .chat-info__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-info__name-row .icon-btn { color: var(--muted); flex: none; }
.chat-info__rename { display: flex; align-items: center; gap: 6px; width: min(100%, 360px); }
.chat-info__rename .input { flex: 1; min-width: 0; padding-block: 8px; }
.chat-info__rename-error { margin: 0; color: var(--danger); font-size: 13px; }
.chat-info__meta { margin: 0; font-size: 13px; color: var(--muted); }
.chat-info__actions { display: flex; gap: 24px; margin-top: 14px; }
.chat-info__action { display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.chat-info__action-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--text); transition: background 0.15s; }
.chat-info__action-icon svg { width: 18px; height: 18px; }
.chat-info__action:hover .chat-info__action-icon { background: rgba(167, 139, 250, 0.2); color: var(--accent); }
.chat-info__section { padding: 4px 20px 14px; }
.chat-info__label { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.segmented button { padding: 7px 6px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button:disabled { cursor: default; opacity: 0.5; }
.segmented button:disabled:hover { color: var(--text-2); }
.segmented button:disabled[aria-checked="true"] { opacity: 1; color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.45); }
.chat-info__hint { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
#chat-info-me .btn { margin-top: 8px; }
.member-code { margin-top: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.member-code__value { display: block; font-size: 24px; letter-spacing: 0.18em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }
.member-code .chat-info__hint { margin-top: 4px; }
.segmented button .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
#privacy-change { margin-top: 10px; }
.privacy-form { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.privacy-form[hidden] { display: none; }
.privacy-form .chat-info__hint { margin: 0; }
.privacy-form__actions { display: flex; justify-content: flex-end; gap: 8px; }
#privacy-error { margin: 8px 2px 0; }
.chat-info__search { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 20px; background: var(--bg-elev); }
.chat-info__search .icon { position: absolute; left: max(34px, calc(50% - 346px)); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.chat-info__search input { flex: 1; padding: 10px 14px 10px 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.chat-info__search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2); }
.chat-info__tabs { position: sticky; top: 62px; z-index: 2; display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.chat-info__tabs[hidden] { display: none; }
.chat-info__tabs button { flex: 1; padding: 10px 4px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chat-info__tabs button:hover { color: var(--text-2); }
.chat-info__tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.chat-info__tabs .count { margin-left: 4px; font-weight: 500; color: var(--muted); }
.chat-info__body { padding: 12px 16px 32px; }
.chat-info__empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.chat-info__note { margin: 4px 8px 10px; font-size: 12.5px; color: var(--muted); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
@media (max-width: 560px) { .info-grid { grid-template-columns: repeat(3, 1fr); } }
.info-grid button { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.info-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.info-grid button:hover img { transform: scale(1.04); }
.info-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.info-row:hover { background: rgba(var(--ink), 0.05); }
.info-row__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--accent); }
.info-row__icon svg { width: 20px; height: 20px; }
.info-row__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.info-row__title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-row__sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-row__text { font-size: 13.5px; color: var(--text-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.info-row__text mark { background: rgba(251, 191, 36, 0.3); color: var(--text); border-radius: 3px; padding: 0 1px; }
.info-row .avatar { flex: none; width: 36px; height: 36px; font-size: 13px; border: 0; }
.info-row__jump { flex: none; }
.info-row__action { flex: none; margin-left: 4px; }
.info-row__badge { flex: none; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; color: var(--accent); background: rgba(167, 139, 250, 0.14); }
.info-row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.info-row.is-away { opacity: 0.6; }
.info-heading { margin: 14px 8px 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.info-heading:first-child { margin-top: 2px; }
/* Links in messages */
/* A link stays whole: it moves to the next line, and a too-long one ends in "…" (it shows short anyway) */
.msg__text a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg--me .msg__text a { color: #fff; }

/* Photo viewer */
body.has-lightbox { overflow: hidden; }
.lightbox { --text: #f3f0fa; --muted: #8a82a0; --accent: #a78bfa; color: var(--text); position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: rgba(8, 7, 12, 0.94); animation: lightbox-in 0.16s ease-out; }
@supports (backdrop-filter: blur(8px)) { .lightbox { background: rgba(8, 7, 12, 0.86); backdrop-filter: blur(8px); } }
@keyframes lightbox-in { from { opacity: 0; } }
.lightbox__bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 20px; }
.lightbox__info { flex: 1; min-width: 0; display: grid; }
.lightbox__name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__meta { font-size: 13px; color: var(--muted); }
.lightbox__btn { color: var(--text); text-decoration: none; }
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.1); }
.lightbox__stage { flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; padding: 0 72px 40px; cursor: zoom-out; }
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); cursor: zoom-in; transition: opacity 0.15s; user-select: none; }
.lightbox__img.is-loading { opacity: 0; }
.lightbox.is-zoomed .lightbox__stage { display: flex; overflow: auto; padding: 0; }
.lightbox.is-zoomed .lightbox__img { margin: auto; flex: none; max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
.lightbox:not(.can-zoom) .lightbox__img { cursor: default; }
.lightbox__spinner { grid-area: 1 / 1; width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.lightbox__img { grid-area: 1 / 1; }
.lightbox__nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: var(--text); }
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox__nav svg { width: 22px; height: 22px; }
.lightbox__nav--prev { left: 14px; }
.lightbox__nav--next { right: 14px; }
.lightbox__count { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .lightbox__stage { padding: 0 8px 40px; }
  .lightbox__nav { top: auto; bottom: 4px; margin-top: 0; width: 40px; height: 40px; }
}

/* Drag files onto the chat */
.drop-zone { position: absolute; inset: 8px; z-index: 25; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(var(--bg-rgb), 0.8); pointer-events: none; }
.drop-zone__box { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text); }
.drop-zone__box .icon { width: 24px; height: 24px; color: var(--accent); }

/* Files in a message */
.msg__files { display: grid; gap: 4px; margin-top: 4px; justify-items: start; min-width: 0; }
.msg--me .msg__files { justify-items: end; }
.msg__files-body { display: grid; gap: 6px; justify-items: inherit; }
/* Slack style: the file names, then ▾ to hide the photos and files (▸ once hidden) */
.msg__files-toggle { display: inline-flex; align-items: center; gap: 2px; max-width: min(320px, 70vw); padding: 1px 2px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 12.5px; }
.msg__files-toggle:hover { color: var(--text); }
.msg__files-names { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__files-caret { width: 16px; height: 16px; flex: none; transition: transform 0.15s; }
.msg__files.is-collapsed .msg__files-caret { transform: rotate(-90deg); }
.msg__files.is-collapsed .msg__files-body { display: none; }
.msg__images { display: flex; flex-wrap: wrap; gap: 4px; }
.msg--me .msg__images { justify-content: flex-end; }
.msg__image { display: block; border-radius: 14px; overflow: hidden; background: var(--surface-2); line-height: 0; }
.msg__image img { max-width: min(320px, 70vw); height: auto; object-fit: cover; }
.msg__images.is-grid .msg__image img { width: 150px; height: 150px; }
.msg__file { display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.msg__file:hover { border-color: var(--accent); }
.msg__file .icon { width: 22px; height: 22px; flex: none; color: var(--accent); }
.msg__file-meta { display: grid; min-width: 0; }
.msg__file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__file-size { font-size: 12px; color: var(--muted); }

.reply-bar {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 852px;
  margin: 0 auto; padding: 8px 16px 0; animation: toast-in 0.15s ease-out;
}
.reply-bar__icon { color: var(--accent); }
.reply-bar__body { flex: 1; min-width: 0; padding-left: 10px; border-left: 3px solid var(--accent); }
.reply-bar__label { font-size: 12px; color: var(--text-2); }
.reply-bar__snippet { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-stamp { display: flex; align-items: center; gap: 10px; padding: 14px 12px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.msg-stamp::before, .msg-stamp::after { content: ''; flex: 1; height: 1px; background: var(--border); } /* a line across, the time in the middle */
.msg--system { display: block; text-align: center; font-size: 12px; color: var(--muted); padding: 6px 12px; }
.msg--system span[title] { cursor: default; }
.msg--system span { display: inline-block; background: var(--surface); padding: 3px 10px; border-radius: 999px; }
.typing { flex: none; min-height: 20px; width: 100%; max-width: 852px; margin: 0 auto; padding: 0 20px; font-size: 12px; color: var(--muted); font-style: italic; }
.chat__form { flex: none; display: flex; gap: 8px; width: 100%; max-width: 852px; margin: 0 auto; padding: 4px 16px 16px; }
.chat__form { align-items: flex-end; }
.chat__form .chat__emoji-btn { align-self: flex-end; margin-bottom: 5px; }
/* The message box: previews of files you're sending sit inside it, above the text */
.composer {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2); }
.composer:has(.attach-tray:not([hidden])) { border-radius: 18px; }
.chat__form .composer .input { border: 0; outline: none; background: transparent; box-shadow: none; border-radius: 999px; padding: 11px 18px; }

/* ---------------- Toasts ---------------- */

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: toast-in 0.2s ease-out; text-align: center; }
.toast--error { border-color: rgba(248, 113, 113, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Responsive ---------------- */

/* Narrow screens: the jam becomes a compact player above the chat, expandable to full screen. */
@media (max-width: 900px) {
  /* Narrow screens: a shown jam opens full screen below the chat header (player, Up next,
     Search, Recommended). Hide jam folds it into the slim bar above the chat. */
  .layout.has-jam { grid-template-columns: minmax(0, 1fr); }
  .jam__resize { display: none; }
  /* --jam-top: just below the jam bar (set by app.js), so Hide jam and Leave stay in reach */
  .jam:not(.is-minimized) { position: fixed; inset: var(--jam-top, 60px) 0 0 0; z-index: 40; border-left: 0; }
  /* …and the chat behind it stays out of sight, even in the gap under the bar */
  .layout.has-jam:not(.jam-minimized) .chat { visibility: hidden; }
  .jam .player__inner { grid-template-columns: 120px minmax(0, 1fr); }
  .jam .player__art { width: 120px; height: 120px; }
}

@media (max-width: 560px) {
  .chat-header { padding: 0 12px; gap: 8px; }
  .chat-header__actions { gap: 4px; }
  .chat-header__actions .avatars { display: none; }
  /* Room for the chat's name: Light/Dark and Invite are in Chat info on phones */
  .chat-header .theme-toggle, #copy-link { display: none; }
  .chat-info-btn { padding-right: 6px; }
  /* The notifications menu: across the screen under the header, not off its edge */
  .notify-menu { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 80px); overflow-y: auto; }
  /* The open player: smaller cover, and a volume slider that fits */
  .jam .player__inner { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 14px 12px; }
  .jam .player__art { width: 76px; height: 76px; }
  .controls { gap: 2px; }
  .volume { min-width: 0; flex: 1; justify-content: flex-end; }
  .volume input { width: 100%; min-width: 48px; max-width: 80px; }
  /* The start screen: the ☀️ above the card, not on it */
  .join-screen { padding-top: 56px; }
  .messages { padding: 12px; }
  .chat__form { padding: 4px 12px 12px; }
  .jam-banner { margin: 10px 12px 0; }
  .jam-mini { padding-left: 12px; }
  .track__actions { opacity: 1; }
}
