/* Rooms Communities (communities.html). Dark like Rooms; a community's accent
   colour (--cm-accent, set from the server) drives buttons, unread marks and
   mentions. The SDK tokens load first; every name here has a fallback. */
:root {
    --cm-bg: var(--bg, #0b1120);
    --cm-rail: #070b16;
    --cm-side: #0e1628;
    --cm-panel: var(--surface-1, #111a2e);
    --cm-line: var(--border-strong, #1f2a44);
    --cm-ink: var(--text, #e6eaf2);
    --cm-dim: #94a3b8;
    --cm-accent: #14b8a6;
    --cm-on-accent: #04201c;
    --cm-danger: #f87171;
    --cm-r: 10px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cm-bg); color: var(--cm-ink); font: 15px/1.45 var(--font-sans, Manrope, system-ui, sans-serif); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--cm-accent); }
:focus-visible { outline: 2px solid var(--cm-accent); outline-offset: 2px; }
.cm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- buttons and forms ---- */
.cm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px;
    border: 1px solid var(--cm-line); background: var(--cm-panel); color: var(--cm-ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.cm-btn:hover { border-color: #334155; }
.cm-btn--primary { background: var(--cm-accent); border-color: var(--cm-accent); color: var(--cm-on-accent); }
.cm-btn--danger { color: var(--cm-danger); border-color: rgba(248, 113, 113, .4); background: transparent; }
.cm-btn--quiet { background: transparent; border-color: transparent; color: var(--cm-dim); }
.cm-btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.cm-link { background: none; border: 0; color: var(--cm-accent); cursor: pointer; font-weight: 700; min-height: 32px; padding: 0 4px; }
.cm-icon-btn { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--cm-dim); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cm-icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--cm-ink); }
.cm-icon-btn svg, .cm-rail__home svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cm-row--end { justify-content: flex-end; }
.cm-row--between { justify-content: space-between; }
.cm-grow { flex: 1; min-width: 0; }
.cm-form { display: flex; flex-direction: column; gap: 14px; }
.cm-form label:not(.cm-pill):not(.cm-check):not(.cm-swatch):not(.cm-file) { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.cm-form input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), .cm-form textarea, .cm-form select {
    min-height: 42px; border-radius: 8px; border: 1px solid var(--cm-line); background: var(--cm-bg); padding: 8px 12px; font-weight: 500; width: 100%; }
.cm-form textarea { resize: vertical; }
.cm-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cm-form legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.cm-form h3 { margin: 6px 0 0; font-size: 16px; }
.cm-err { margin: 0; color: var(--cm-danger); font-weight: 600; }
.cm-hint { margin: 0; color: var(--cm-dim); font-size: 13px; }
.cm-pill { display: inline-flex; cursor: pointer; }
.cm-pill input { position: absolute; opacity: 0; }
.cm-pill span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--cm-line); background: var(--cm-bg); font-weight: 700; font-size: 13px; }
.cm-pill input:checked + span { background: var(--cm-accent); border-color: var(--cm-accent); color: var(--cm-on-accent); }
.cm-pill input:focus-visible + span { outline: 2px solid var(--cm-accent); outline-offset: 2px; }
.cm-pill--sm span { min-height: 30px; padding: 0 8px; font-size: 12px; }
.cm-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.cm-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--cm-accent); flex: none; }
.cm-check small { display: block; color: var(--cm-dim); font-weight: 500; }
.cm-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.cm-swatch { position: relative; cursor: pointer; }
.cm-swatch input { position: absolute; opacity: 0; }
.cm-swatch span { display: block; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); }
.cm-swatch input:checked + span { box-shadow: 0 0 0 3px var(--cm-bg), 0 0 0 5px #fff; }
.cm-swatch input:focus-visible + span { outline: 2px solid var(--cm-accent); outline-offset: 4px; }
.cm-file { position: relative; overflow: hidden; }
.cm-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cm-emoji-in { width: 64px !important; text-align: center; }

/* ---- signed out ---- */
.cm-gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.cm-gate__card { max-width: 440px; background: var(--cm-panel); border: 1px solid var(--cm-line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.cm-gate__card h1 { margin: 0; }
.cm-gate__card p { margin: 0; color: var(--cm-dim); }

/* ---- the four columns ---- */
.cm-app { height: 100%; display: grid; grid-template-columns: 72px 260px minmax(0, 1fr) 240px; }
.cm-rail { background: var(--cm-rail); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; overflow-y: auto; }
.cm-rail__home { width: 48px; height: 48px; border-radius: 16px; background: #14213d; color: var(--cm-ink); display: flex; align-items: center; justify-content: center; }
.cm-rail__sep { width: 32px; height: 2px; background: var(--cm-line); border-radius: 2px; }
.cm-rail__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cm-rail__icon { --cm-icon: #334155; width: 48px; height: 48px; border: 0; background: var(--cm-icon); color: #fff; font-weight: 800; cursor: pointer; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.cm-rail__icon.is-active { box-shadow: 0 0 0 3px var(--cm-rail), 0 0 0 5px var(--cm-icon); }
.cm-shape--circle { border-radius: 50%; }
.cm-shape--squircle { border-radius: 16px; }
.cm-shape--square { border-radius: 8px; }
.cm-rail__add { width: 48px; height: 48px; border-radius: 24px; border: 1px dashed #334155; background: transparent; color: var(--cm-accent); font-size: 24px; cursor: pointer; }

.cm-side { background: var(--cm-side); display: flex; flex-direction: column; min-height: 0; }
.cm-banner { min-height: 104px; background: #134e4a; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 12px 8px 12px 16px; }
.cm-banner h2 { margin: 0; font-size: 17px; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.cm-banner p { margin: 0; font-size: 12px; color: #e2e8f0; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.cm-banner .cm-icon-btn { color: #fff; }
.cm-channels { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.cm-cat { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--cm-dim); text-transform: uppercase; padding: 12px 8px 4px; margin: 0; }
.cm-ch { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--cm-dim); cursor: pointer; text-align: left; }
.cm-ch:hover { background: rgba(255, 255, 255, .04); color: var(--cm-ink); }
.cm-ch.is-active { background: var(--cm-line); color: #fff; font-weight: 700; }
.cm-ch.is-unread { color: #fff; font-weight: 700; }
.cm-ch__icon { width: 18px; text-align: center; }
.cm-ch__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-ch__lock { font-size: 12px; }
.cm-ch__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cm-accent); }
.cm-me { background: #0a1222; padding: 8px; }
.cm-me__btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.cm-me__btn:hover { background: rgba(255, 255, 255, .05); }
.cm-me__text { min-width: 0; display: flex; flex-direction: column; }
.cm-me__text small { color: var(--cm-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cm-avatar { --s: 36px; position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: calc(var(--s) * .36); color: #fff; background: #334155; }
.cm-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cm-presence { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--cm-side); background: #64748b; }
.cm-presence--online { background: #22c55e; }
.cm-presence--idle { background: #f5a524; }
.cm-presence--dnd { background: #ef4444; }

.cm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cm-head { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--cm-line); }
.cm-head h1 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-head__hash { color: var(--cm-dim); font-size: 18px; }
.cm-head__topic { flex: 1; min-width: 0; color: var(--cm-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-live { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex: none; }
.cm-live[data-state="live"] { background: #22c55e; }
.cm-live[data-state="connecting"] { background: #f5a524; }
.cm-only-narrow { display: none; }

.cm-empty { margin: auto; max-width: 460px; padding: 24px 16px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.cm-empty h2 { margin: 0; }
.cm-empty p { margin: 0; color: var(--cm-dim); }

.cm-messages { flex: 1; overflow-y: auto; padding: 8px 16px; display: flex; flex-direction: column; }
.cm-older { align-self: center; margin: 8px 0; }
.cm-msglist { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cm-notice { color: var(--cm-dim); text-align: center; padding: 24px 8px; }
.cm-msg { position: relative; display: flex; gap: 12px; padding: 8px; border-radius: 8px; }
.cm-msg:hover, .cm-msg:focus-within { background: rgba(255, 255, 255, .03); }
.cm-msg__body { flex: 1; min-width: 0; }
.cm-msg__head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cm-msg__who { border: 0; background: none; padding: 0; font-weight: 800; cursor: pointer; color: var(--cm-ink); }
.cm-msg__time { font-size: 12px; color: var(--cm-dim); }
.cm-msg__text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-msg.is-deleted .cm-msg__text { color: var(--cm-dim); font-style: italic; }
.cm-msg__reply { font-size: 12px; color: var(--cm-dim); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-reacts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cm-reacts:empty { display: none; }
.cm-react { min-height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--cm-line); background: var(--cm-panel); cursor: pointer; font-size: 13px; }
.cm-react.is-mine { border-color: var(--cm-accent); background: color-mix(in srgb, var(--cm-accent) 18%, transparent); }
/* Actions float over the message's top right on hover or focus, taking no room otherwise. */
.cm-msg__actions { position: absolute; top: -14px; right: 8px; display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--cm-side); border: 1px solid var(--cm-line); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; z-index: 1; }
.cm-msg:hover .cm-msg__actions, .cm-msg:focus-within .cm-msg__actions { opacity: 1; pointer-events: auto; }
.cm-act { min-height: 30px; min-width: 32px; padding: 0 8px; border-radius: 6px; border: 0; background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--cm-dim); }
.cm-act:hover { color: var(--cm-ink); background: var(--cm-line); }

.cm-composer { padding: 0 16px 16px; }
.cm-composer__row { display: flex; gap: 8px; align-items: flex-end; background: var(--cm-panel); border: 1px solid var(--cm-line); border-radius: 12px; padding: 6px; }
.cm-composer textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; border: 0; background: transparent; padding: 9px 8px; outline: none; }
.cm-composer__note { margin: 6px 4px 0; color: var(--cm-danger); font-size: 13px; }
.cm-replying { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--cm-dim); padding: 0 6px 6px; }

.cm-members { background: var(--cm-side); overflow-y: auto; padding: 8px; }
.cm-member { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.cm-member:hover { background: rgba(255, 255, 255, .04); }
.cm-member__text { min-width: 0; display: flex; flex-direction: column; }
.cm-member__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-member__text small { color: var(--cm-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- emoji, pins, typing ---- */
.cm-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; }
.cm-react .cm-emoji, .cm-act .cm-emoji { width: 18px; height: 18px; vertical-align: -4px; }
.cm-picker { position: fixed; z-index: 30; width: min(320px, calc(100vw - 16px)); max-height: 320px; overflow-y: auto; padding: 10px; border-radius: 12px;
    background: var(--cm-side); border: 1px solid var(--cm-line); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.cm-picker__title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--cm-dim); margin: 4px 2px 6px; }
.cm-picker__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: 8px; }
.cm-picker__item { height: 40px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.cm-picker__item:hover, .cm-picker__item:focus-visible { background: var(--cm-line); }
.cm-picker__item .cm-emoji { width: 26px; height: 26px; }
.cm-msg__pin { font-size: 12px; color: var(--cm-accent); font-weight: 700; }
.cm-pins { margin: 12px 0; max-height: 60vh; overflow-y: auto; }
.cm-typing { margin: 4px 6px 0; min-height: 18px; font-size: 12px; color: var(--cm-dim); }
.cm-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cm-edit textarea { min-height: 64px; resize: vertical; border-radius: 8px; border: 1px solid var(--cm-accent); background: var(--cm-bg); padding: 8px 10px; }
.cm-emoji-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cm-emoji-item { display: flex; align-items: center; gap: 8px; background: var(--cm-panel); border-radius: 8px; padding: 8px; flex-wrap: wrap; }
.cm-emoji-item .cm-emoji { width: 32px; height: 32px; }
.cm-emoji-item code { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

/* ---- threads and polls ---- */
.cm-thread { position: fixed; top: 0; right: 0; bottom: 0; z-index: 12; width: min(400px, 100vw); background: var(--cm-side); border-left: 1px solid var(--cm-line);
    display: flex; flex-direction: column; box-shadow: -20px 0 40px rgba(0, 0, 0, .35); }
.cm-thread__head { display: flex; gap: 8px; align-items: center; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--cm-line); }
.cm-thread__head h2 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-thread__root { margin: 0; padding: 8px; border-bottom: 1px solid var(--cm-line); }
.cm-thread__list { flex: 1; overflow-y: auto; margin: 0; padding: 8px; justify-content: flex-start; }
.cm-thread__composer { padding: 8px 12px 12px; }
.cm-thread-link { display: inline-flex; gap: 4px; align-items: center; margin-top: 6px; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 0;
    background: var(--cm-panel); color: var(--cm-accent); cursor: pointer; font-size: 13px; }
.cm-thread-link span { color: var(--cm-dim); }
.cm-poll { margin-top: 8px; max-width: 460px; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--cm-panel); border: 1px solid var(--cm-line); }
.cm-poll__meta { font-size: 12px; color: var(--cm-dim); }
.cm-poll__opt { --pct: 0%; position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px;
    border: 1px solid var(--cm-line); cursor: pointer; text-align: left; font-weight: 600;
    background: linear-gradient(90deg, color-mix(in srgb, var(--cm-accent) 22%, transparent) var(--pct), var(--cm-bg) var(--pct)); }
.cm-poll__opt.is-mine { border-color: var(--cm-accent); }
.cm-poll__opt:disabled { cursor: default; }
.cm-poll__pct { font-weight: 800; }
.cm-poll-inputs { display: flex; flex-direction: column; gap: 6px; }

/* ---- forums and events ---- */
.cm-solved { font-size: 11px; font-weight: 800; color: #052e16; background: #4ade80; border-radius: 4px; padding: 1px 6px; }
.cm-msg__title { margin: 2px 0 0; font-size: 16px; }
.cm-forum-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0 12px; }
.cm-forum-search { flex: 1; min-width: 180px; }
.cm-forum-search input { width: 100%; min-height: 40px; border-radius: 8px; border: 1px solid var(--cm-line); background: var(--cm-panel); padding: 0 12px; }
.cm-forum-bar .cm-chips { flex-basis: 100%; }
.cm-tag { --tag: #94a3b8; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--cm-line);
    background: var(--cm-panel); font-size: 13px; font-weight: 700; cursor: pointer; }
.cm-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tag); }
.cm-tag[aria-pressed="true"] { border-color: var(--cm-accent); background: color-mix(in srgb, var(--cm-accent) 15%, transparent); }
.cm-tag--static { cursor: default; min-height: 24px; font-size: 11px; padding: 0 8px; }
.cm-msglist--forum { margin: 0; gap: 10px; }
.cm-post { list-style: none; }
.cm-post > button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px;
    border: 1px solid var(--cm-line); background: var(--cm-panel); cursor: pointer; }
.cm-post > button:hover { border-color: #334155; }
.cm-post__tags { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 1; }
.cm-post__title { grid-column: 1; font-weight: 800; font-size: 15px; }
.cm-post__snippet { grid-column: 1; color: var(--cm-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-post__side { grid-column: 2; grid-row: 1 / span 3; text-align: right; color: var(--cm-dim); font-size: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.cm-next { margin: 10px 10px 2px; padding: 10px 12px; border-radius: 12px; background: var(--cm-panel); border: 1px solid var(--cm-line); display: grid; gap: 4px; }
.cm-next small { font-size: 11px; font-weight: 800; letter-spacing: .05em; color: var(--cm-accent); }
.cm-next b { font-size: 14px; }
.cm-events-btn { margin: 6px 8px 0; }
.cm-count { margin-left: auto; font-size: 12px; color: var(--cm-dim); }
.cm-events { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.cm-events h2 { margin: 0; font-size: 20px; }
.cm-event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 720px; }
.cm-event { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px; border-radius: 14px; background: var(--cm-panel); border: 1px solid var(--cm-line); }
.cm-event__date { border-radius: 10px; background: var(--cm-bg); text-align: center; padding: 8px 0; align-self: start; border-top: 4px solid var(--event, var(--cm-accent)); }
.cm-event__date small { display: block; font-size: 11px; font-weight: 800; color: var(--cm-accent); }
.cm-event__date b { font-size: 22px; }
.cm-event h3 { margin: 0; font-size: 16px; }
.cm-event p { margin: 4px 0 0; color: var(--cm-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-event .cm-row { margin-top: 10px; }

/* ---- voice ---- */
.cm-vlist { list-style: none; margin: 0 0 4px; padding: 0 0 0 30px; }
.cm-vlist__who { display: flex; align-items: center; gap: 8px; min-height: 30px; color: var(--cm-dim); font-size: 13px; }
.cm-vlist__who .cm-avatar { box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.cm-vlist__who.is-speaking .cm-avatar { box-shadow: 0 0 0 2px #22c55e; }
.cm-vlist__icon { font-size: 12px; }
.cm-live-badge { font-size: 10px; font-weight: 800; color: #fff; background: #ef4444; border-radius: 4px; padding: 1px 5px; margin-right: 6px; }
.cm-ch__live { margin-right: 0; flex: none; }   /* on the channel itself while anyone there is live */
#nicknameForm .cm-grow { flex: 1 1 200px; }    /* name and join sound side by side, stacked on a phone */
#nicknameForm .cm-row { align-items: flex-end; }   /* Save sits level with the fields, not their labels */
.cm-voice { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow-y: auto; }
.cm-voice[hidden] { display: none; }
.cm-voice__grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; align-content: center; }
.cm-voice__grid > .cm-notice { grid-column: 1 / -1; text-align: center; }
.cm-vtile { position: relative; aspect-ratio: 16 / 10; border-radius: 14px; background: var(--cm-panel); border: 2px solid transparent;
    display: flex; align-items: center; justify-content: center; overflow: hidden; transition: border-color .15s; }
.cm-vtile.is-speaking { border-color: #22c55e; }
.cm-vtile__video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.cm-vtile__name { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); font-size: 13px; font-weight: 700; }
.cm-voice__note { text-align: center; min-height: 1.2em; margin: 0; }
.cm-voice__actions { display: flex; justify-content: center; }
.cm-voice__controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cm-voice__controls[hidden] { display: none; }
.cm-vbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 22px;
    border: 1px solid var(--cm-line); background: var(--cm-panel); color: var(--cm-ink); font: inherit; font-weight: 600; cursor: pointer; }
.cm-vbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-vbtn[aria-pressed="true"] { background: #f1f5f9; color: #0b1120; }
.cm-vbtn--leave { background: #dc2626; border-color: #dc2626; color: #fff; }
.cm-vbtn:disabled { opacity: .45; cursor: not-allowed; }
.cm-voicebar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--cm-line); background: #0a1222; }
.cm-voicebar[hidden] { display: none; }
.cm-voicebar .cm-vbtn { width: 40px; min-height: 40px; padding: 0; border-radius: 8px; }
.cm-voicebar__where { flex: 1; min-width: 0; display: grid; text-align: left; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 4px; min-height: 40px; }
.cm-voicebar__where b { color: #22c55e; font-size: 13px; }
.cm-voicebar__where small { color: var(--cm-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .cm-voice__controls .cm-vbtn span { display: none; } .cm-voice__controls .cm-vbtn { padding: 0 12px; } }

/* ---- stage ---- */
.cm-stage__topic { margin: 0; text-align: center; font-size: 18px; font-weight: 800; }
.cm-stage__topic[hidden], .cm-stage__audience[hidden] { display: none; }
.cm-stage__audience h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--cm-dim); }
.cm-stage__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 6px; }
.cm-stage__who { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 10px; background: var(--cm-panel); }
.cm-stage__hand { font-size: 18px; }
.cm-stage__invited { color: #fbbf24; }
.cm-vtile__act { position: absolute; top: 8px; right: 8px; }
.cm-vbtn--go { background: #16a34a; border-color: #16a34a; color: #fff; }
.cm-voice--stage .cm-voice__grid { flex: 0 0 auto; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); align-content: start; }
.cm-voice--stage .cm-vtile { aspect-ratio: auto; min-height: 150px; }
.cm-voice__actions { position: sticky; bottom: -16px; margin: auto -16px -16px; padding: 12px 16px 16px; background: var(--cm-bg); }

/* ---- soundboard ---- */
.cm-sounds-head { margin-top: 20px; }
.cm-sound-list { grid-template-columns: minmax(0, 1fr); }
.cm-sound-list .cm-emoji-item { display: flex; align-items: center; gap: 8px; }
.cm-sound-emoji-in { width: 72px; }
.cm-sound__emoji { font-size: 20px; width: 28px; text-align: center; }
.cm-sound-picker { width: min(340px, calc(100vw - 16px)); }
.cm-sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 10px; }
.cm-sound-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; padding: 6px; border: 1px solid var(--cm-line);
    border-radius: 10px; background: var(--cm-bg); color: var(--cm-ink); cursor: pointer; font: inherit; }
.cm-sound-btn:hover, .cm-sound-btn:focus-visible { border-color: var(--cm-accent); }
.cm-sound__name { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-sound-vol { display: grid; gap: 4px; font-size: 12px; color: var(--cm-dim); }
.cm-sound-vol input { width: 100%; min-height: 32px; }

/* ---- mentions, unread, notifications ---- */
.cm-mention { --mention: var(--cm-accent); display: inline; padding: 0 3px; border-radius: 4px; border: 0; font: inherit; font-weight: 700;
    color: var(--mention); background: color-mix(in srgb, var(--mention) 18%, transparent); cursor: default; }
button.cm-mention { cursor: pointer; }
.cm-mention.is-me { color: #fde68a; background: rgba(245, 165, 36, .25); }
.cm-msg.is-mentioning { background: rgba(245, 165, 36, .08); box-shadow: inset 3px 0 0 #f5a524; }
.cm-ch.is-muted { opacity: .55; }
.cm-ch__pings { font-size: 11px; font-weight: 800; color: #fff; background: #ef4444; border-radius: 10px; padding: 1px 7px; }
.cm-inbox-btn { position: relative; }
.cm-inbox-count { position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cm-suggest { width: min(300px, calc(100vw - 16px)); max-height: 260px; padding: 6px; }
.cm-suggest__item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.cm-suggest__item[aria-selected="true"], .cm-suggest__item:hover { background: var(--cm-line); }
.cm-suggest__item small { margin-left: auto; color: var(--cm-dim); }
.cm-inbox { max-height: 60vh; overflow-y: auto; margin: 12px 0; }
.cm-inbox > li > button { display: grid; gap: 4px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--cm-line); background: var(--cm-panel); cursor: pointer; }
.cm-inbox small { color: var(--cm-dim); }

/* ---- dialogs ---- */
.cm-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--cm-line); border-radius: 16px; background: var(--cm-side); color: var(--cm-ink); padding: 24px; }
.cm-dialog--wide { width: min(880px, calc(100vw - 32px)); }
.cm-dialog--card { width: min(360px, calc(100vw - 32px)); padding: 16px; }
.cm-dialog::backdrop { background: rgba(2, 6, 23, .7); }
.cm-dialog h2 { margin: 0; font-size: 20px; }
.cm-settings { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
.cm-tabs { display: flex; flex-direction: column; gap: 2px; }
.cm-tabs button { min-height: 38px; text-align: left; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--cm-dim); font-weight: 700; cursor: pointer; }
.cm-tabs button[aria-pressed="true"] { background: var(--cm-line); color: #fff; }
.cm-settings__body { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cm-settings__close { border-top: 1px solid var(--cm-line); padding-top: 12px; }
.cm-invite { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--cm-panel); border-radius: var(--cm-r); padding: 10px 12px; }
.cm-invite code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 15px; color: var(--cm-accent); }
.cm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-list__row { display: flex; gap: 8px; align-items: center; background: var(--cm-panel); border-radius: 8px; padding: 8px 10px; }
.cm-list__row--wrap { flex-wrap: wrap; }
.cm-roles { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
.cm-role { display: flex; gap: 10px; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.cm-role.is-active { background: var(--cm-line); }
.cm-role small { color: var(--cm-dim); }
.cm-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cm-perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.cm-profile { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }

/* ---- profile card ---- */
.cm-card__inner { --frame: var(--cm-accent); border: 4px solid var(--frame); border-radius: 16px; overflow: hidden; background: var(--cm-side); padding: 0 16px 16px; }
.cm-card__banner { height: 88px; margin: 0 -16px; background: color-mix(in srgb, var(--frame) 45%, #0b1120); }
.cm-card__inner > .cm-avatar { margin-top: -40px; border: 5px solid var(--cm-side); box-sizing: content-box; }
.cm-card__inner .cm-presence { border-color: var(--cm-side); }
.cm-card__name { margin: 8px 0 0; font-size: 20px; }
.cm-card__name small { font-size: 13px; color: var(--cm-dim); font-weight: 600; }
.cm-card__status { margin: 2px 0 0; color: #cbd5e1; }
.cm-card__inner h4 { margin: 14px 0 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--cm-dim); }
.cm-card__bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cm-chip { --dot: #94a3b8; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid #334155; border-radius: 999px; padding: 2px 8px; }
.cm-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }

/* ---- narrower screens ---- */
@media (max-width: 1100px) {
    .cm-app { grid-template-columns: 72px 240px minmax(0, 1fr); }
    .cm-members { display: none; }
}
@media (max-width: 760px) {
    .cm-app { grid-template-columns: minmax(0, 1fr); }
    .cm-rail, .cm-side { position: fixed; top: 0; bottom: 0; z-index: 10; transform: translateX(-110vw); transition: transform .2s; }
    .cm-rail { left: 0; width: 72px; }
    .cm-side { left: 72px; width: min(280px, calc(100vw - 88px)); }
    body.cm-side-open .cm-rail, body.cm-side-open .cm-side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
    .cm-only-narrow { display: inline-flex; }
    .cm-settings, .cm-roles, .cm-profile { grid-template-columns: minmax(0, 1fr); }
    .cm-tabs { flex-direction: row; flex-wrap: wrap; }
    .cm-perms { grid-template-columns: minmax(0, 1fr); }
    .cm-act { min-height: 36px; }
    .cm-react { min-height: 34px; }
    .cm-msg__who { min-height: 32px; }
    /* No hover on a phone: tapping a message (it takes focus) shows its actions. */
    .cm-msg__actions { position: static; display: none; opacity: 1; pointer-events: auto; box-shadow: none; background: transparent; border: 0; padding: 0; margin-top: 4px; flex-wrap: wrap; }
    .cm-msg:focus-within .cm-msg__actions { display: flex; }
}
@media (prefers-reduced-motion: reduce) { .cm-rail, .cm-side { transition: none; } }
