:root {
  --bg: #FFFFFF;
  --soft: #FAF8FA;
  --soft-2: #F6F2F6;
  --line: #EEE9EE;
  --line-2: #E7E2E8;
  --text: #1F1A22;
  --muted: #67606B;
  --accent: #BE185D;
  --accent-soft: #FCE7F1;
  --accent-ink: #9D174D;
  /* Filled backgrounds behind white text (buttons, my bubbles, badges). */
  --accent-fill: #BE185D;
  --voice-fill: #15803D;
  --voice: #15803D;
  --voice-soft: #ECF8F0;
  --voice-ink: #166534;
  --mod: #4C3BB5;
  --mod-soft: #F4F2FD;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --warn-soft: #FFF7E6;
  --warn-ink: #8A4B00;
  --surface: #FFFFFF;
  --msg-size: 15px;
  color-scheme: light;
}

/* Dark theme: chosen in Settings, or following the device when set to "auto". */
:root[data-theme="dark"] {
  --bg: #141118;
  --surface: #1D1922;
  --soft: #19151D;
  --soft-2: #26212B;
  --line: #2F2935;
  --line-2: #3B3441;
  --text: #EEE9F1;
  --muted: #A69EAB;
  --accent: #E2468C;
  --accent-soft: #3B1C2B;
  --accent-ink: #F59AC2;
  --accent-fill: #D12F78;
  --voice-fill: #15803D;
  --voice: #1F9D57;
  --voice-soft: #16261D;
  --voice-ink: #74D6A0;
  --mod: #8C7DF2;
  --mod-soft: #241F3B;
  --danger: #F05A57;
  --danger-soft: #3A1B1B;
  --warn-soft: #33290F;
  --warn-ink: #F5C46B;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #141118;
    --surface: #1D1922;
    --soft: #19151D;
    --soft-2: #26212B;
    --line: #2F2935;
    --line-2: #3B3441;
    --text: #EEE9F1;
    --muted: #A69EAB;
    --accent: #E2468C;
    --accent-soft: #3B1C2B;
    --accent-ink: #F59AC2;
  --accent-fill: #D12F78;
  --voice-fill: #15803D;
    --voice: #1F9D57;
    --voice-soft: #16261D;
    --voice-ink: #74D6A0;
    --mod: #8C7DF2;
    --mod-soft: #241F3B;
    --danger: #F05A57;
    --danger-soft: #3A1B1B;
    --warn-soft: #33290F;
    --warn-ink: #F5C46B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 300 15px/1.55 'Kanit', system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 24px; }
b { font-weight: 500; }
input, select, textarea {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface);
  outline: none;
}
input, select { height: 44px; }
textarea { padding: 10px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.grow, .flex1 { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.row.wrap, .wrap { flex-wrap: wrap; }
.gap6 { gap: 6px; }
.gap12 { gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.danger-text { color: var(--danger); }
.green-text { color: var(--voice-ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--soft); color: var(--text); }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; font-weight: 500; }
.btn.green { background: var(--voice-fill); border-color: var(--voice-fill); color: #fff; font-weight: 500; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 500; }
.btn.mod { background: var(--mod); border-color: var(--mod); color: #fff; font-weight: 500; }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.text-green { border: 0; background: transparent; color: var(--voice-ink); font-weight: 500; }
.btn.big { height: 50px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn.small-btn { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.danger-text { color: var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0;
  background: var(--soft-2); color: var(--muted); display: grid; place-items: center;
}
.icon-btn.outline { background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--text); font-size: 20px; }
.chip {
  height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); font-size: 13px;
}
.chip.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.switch {
  width: 48px; height: 28px; flex: none; border: 0; border-radius: 14px; padding: 3px;
  background: #D9D3DB; display: flex; justify-content: flex-start;
}
.switch[aria-checked="true"] { background: var(--voice-fill); justify-content: flex-end; }
.switch.mod[aria-checked="true"] { background: var(--mod); }
.switch .knob { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent-fill); color: #fff; font-size: 11px; display: inline-grid; place-items: center;
}
.badge.green { background: var(--voice-fill); }
.tag { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11px; background: var(--soft-2); color: var(--muted); }
.tag.share { background: var(--mod-soft); color: var(--mod); }
.tag.act { background: var(--warn-soft); color: var(--warn-ink); }
.tag.mod { background: var(--mod-soft); color: var(--mod); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.danger-tag { background: var(--danger-soft); color: var(--danger); font-size: 13px; padding: 3px 12px; }
.role-tag { padding: 1px 10px; border-radius: 999px; background: var(--soft-2); color: var(--text); font-size: 12px; }
.role-tag.owner { background: var(--text); color: var(--bg); }
.role-tag.mod { background: var(--mod-soft); color: var(--mod); }

.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-weight: 500;
}

/* auth pages */
.center-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 16px; background: var(--soft); }
.card { background: var(--surface); border-radius: 24px; padding: 22px; box-shadow: 0 10px 40px rgba(31,26,34,.06); display: flex; flex-direction: column; gap: 14px; }
.card.soft { box-shadow: none; }
.stack-380, .stack-400, .stack-420, .stack-440 { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.stack-380 { max-width: 380px; }
.stack-400 { max-width: 400px; }
.stack-420 { max-width: 420px; }
.stack-440 { max-width: 440px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-tile { width: 44px; height: 44px; border-radius: 14px; background: var(--accent-fill); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.brand-tile.big { width: 64px; height: 64px; border-radius: 20px; font-size: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.paste-row { display: flex; gap: 8px; }
.paste-row input { flex: 1; min-width: 0; }
.invite-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.note { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.soft-box { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--soft); }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.clock { font-size: 40px; }
.steps { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.steps li.done { color: var(--voice-ink); }
.steps li.now { font-weight: 500; }
.steps li:not(.done):not(.now) { color: var(--muted); }

/* app layout */
.app { min-height: 100%; display: flex; flex-direction: column; }
.top {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { font-weight: 600; font-size: 20px; color: var(--text); text-decoration: none; margin-right: 6px; }
.loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; }
.chat-pill { background: var(--accent-soft); color: var(--accent-ink); }
.voice-pill { background: var(--voice-fill); color: #fff; padding-right: 4px; }
.pill-btn { height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(255,255,255,.2); color: #fff; font-size: 13px; }
.pill-btn.off { background: var(--surface); color: var(--danger); }
.lock-note { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--mod); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--soft-2); color: var(--text); text-decoration: none; }
.nav-btn.ghost { background: transparent; color: var(--muted); }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; }
.reconnect { position: absolute; left: 0; right: 0; top: 100%; z-index: 4; padding: 6px 16px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; text-align: center; }

.body { flex: 1; display: flex; flex-wrap: wrap; min-height: 0; }

/* chat */
.chat { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; height: calc(100vh - 61px); padding: 0 24px; }
.chat > * { width: 100%; max-width: 760px; align-self: center; }
.chat-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 0 4px; }
.chat-head h1 { font-size: 18px; }
.pin-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 14px; border-radius: 14px; background: var(--warn-soft); font-size: 14px; }
.pin-label { color: var(--warn-ink); font-weight: 500; white-space: nowrap; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 14px 0 8px; }
.empty-chat { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 3px 0; }
.msg.mine { align-items: flex-end; }
.author { border: 0; background: none; padding: 6px 6px 0; font-size: 12px; color: var(--muted); }
.author:hover { color: var(--text); text-decoration: underline; }
.reply-quote { max-width: 70%; font-size: 12px; color: var(--muted); padding: 3px 10px; border-radius: 10px; background: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-row { display: flex; align-items: center; gap: 6px; max-width: 80%; }
.msg.mine .msg-row { flex-direction: row-reverse; }
.bubble { padding: 9px 16px; border-radius: 20px 20px 20px 6px; background: var(--soft-2); white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: var(--accent-fill); color: #fff; border-radius: 20px 20px 6px 20px; }
.deleted { padding: 8px 14px; border-radius: 18px; border: 1px dashed var(--line-2); color: var(--muted); font-style: italic; font-size: 14px; }
.dots { width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: .5; }
.msg:hover .dots, .dots[aria-expanded="true"] { opacity: 1; background: var(--soft-2); }
.meta { font-size: 11px; color: var(--muted); padding: 0 6px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.react { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.react.mine { background: var(--accent-soft); border-color: #F2A7C8; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; background: var(--surface); box-shadow: 0 4px 16px rgba(31,26,34,.12), 0 0 0 1px var(--line); }
.tool { height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; }
.tool:hover { background: var(--soft); }
.tool.emoji { width: 40px; padding: 0; font-size: 18px; }
.tool.danger { color: var(--danger); }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.edit-form { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 16px; background: var(--soft-2); }
.edit-form input { min-width: 240px; height: 38px; }
.gif-card { position: relative; width: 220px; height: 160px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; font-weight: 600; border: 0; }
.gif-card.small { width: auto; height: 90px; font-size: 20px; border-radius: 14px; }
.gif-tag { position: absolute; top: 8px; left: 8px; padding: 0 7px; border-radius: 6px; background: rgba(255,255,255,.9); color: var(--text); font-size: 11px; font-weight: 600; }
.typing { height: 20px; font-size: 12px; color: var(--muted); }
.composer-wrap { padding-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.composer { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 4px 4px 20px; }
.composer input { flex: 1; min-width: 0; border: 0; height: 36px; padding: 0; }
.gif-btn { height: 40px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 13px; font-weight: 600; }
.gif-btn.on { background: var(--accent-soft); border-color: #F2A7C8; }
.send-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent-fill); color: #fff; font-size: 18px; }
.locked-composer { padding: 12px 18px; border-radius: 999px; background: var(--soft-2); color: var(--muted); font-size: 14px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 14px; background: var(--soft); font-size: 13px; color: var(--muted); }
.reply-bar b { color: var(--text); }
.gif-panel { padding: 14px; border-radius: 20px; background: var(--surface); box-shadow: 0 8px 28px rgba(31,26,34,.14), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 10px; }
.gif-panel .row input { flex: 1; }
.gif-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

/* voice rooms */
.rooms { flex: 1 1 360px; max-width: 100%; background: var(--soft); border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 12px; height: calc(100vh - 61px); overflow-y: auto; }
.rooms-head { display: flex; align-items: center; gap: 10px; }
.rooms-head h2 { font-size: 17px; }
.search { width: 100%; }
.room-list, .empty-rooms, .people, .cards, .member-list, .history { list-style: none; margin: 0; padding: 0; }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room { border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.room.open { background: var(--voice-soft); box-shadow: 0 0 0 1px color-mix(in srgb, var(--voice) 30%, var(--surface)); }
.room.here { background: var(--voice-soft); box-shadow: 0 0 0 2px var(--voice); }
.room-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 60px; border: 0; background: transparent; text-align: left; }
.room-icon { width: 36px; height: 36px; flex: none; border-radius: 12px; background: var(--voice-fill); display: grid; place-items: center; font-size: 15px; }
.room-text { display: flex; flex-direction: column; line-height: 1.3; }
.room-name { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.here-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--voice-fill); color: #fff; }
.stack { display: flex; align-items: center; }
.room-head .stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.room-head .stack .avatar:first-child { margin-left: 0; }
.more { height: 24px; margin-left: -8px; padding: 0 7px; border-radius: 12px; background: var(--surface); border: 2px solid var(--surface); color: var(--muted); font-size: 11px; font-weight: 500; display: grid; place-items: center; }
.room-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.people li.hit .person { background: var(--warn-soft); }
.person { width: 100%; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.person:hover { background: rgba(255,255,255,.7); }
.person-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; font-size: 14px; }
.empty-title { margin: 6px 4px 0; font-weight: 500; }
.empty-rooms { display: flex; flex-direction: column; gap: 4px; }
.empty-rooms li { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 14px; border-radius: 12px; border: 1px dashed var(--line-2); }

/* user menu + dialogs */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(31,26,34,.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.backdrop.clear { background: rgba(31,26,34,.12); justify-content: flex-end; align-items: flex-start; padding-top: 72px; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 26px; padding: 24px; box-shadow: 0 20px 60px rgba(31,26,34,.25); display: flex; flex-direction: column; gap: 14px; }
.modal-title { font-size: 20px; }
.user-menu { width: 360px; max-width: 100%; max-height: calc(100vh - 90px); overflow-y: auto; background: var(--surface); border-radius: 24px; padding: 16px; box-shadow: 0 16px 44px rgba(31,26,34,.18), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 12px; }
.um-head { display: flex; align-items: flex-start; gap: 12px; }
.um-name { font-size: 17px; }
.mod-section { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 18px; background: var(--mod-soft); }
.mod-section h3 { font-size: 12px; color: var(--mod); }
.mod-section select { height: 36px; }
.menu-item { display: flex; align-items: center; min-height: 40px; padding: 0; border: 0; background: transparent; text-align: left; font-size: 14px; }
.menu-item:hover { color: var(--mod); }
.timeout-row { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.link-box { display: flex; align-items: center; gap: 8px; }
.link-box code { flex: 1; padding: 8px 12px; border-radius: 10px; background: var(--soft); font-size: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: 0 8px 24px rgba(31,26,34,.25); }

/* admin */
.admin { width: 100%; max-width: 1000px; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.admin-head { display: flex; flex-direction: column; gap: 4px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); align-self: flex-start; }
.tab { height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 6px; }
.tab.on { background: var(--text); color: var(--bg); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.empty-note { padding: 24px 0; }
.member-list { display: flex; flex-direction: column; }
.member-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.member-row:hover { background: var(--soft); }
.history { padding: 6px 20px; }
.history li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.narrow { max-width: 520px; }

@media (max-width: 900px) {
  .chat, .rooms { height: auto; }
  .chat { min-height: 70vh; }
  .rooms { border-left: 0; border-top: 1px solid var(--line); }
  .messages { max-height: 60vh; }
  .backdrop.clear { justify-content: center; }
}
@media (max-width: 600px) {
  .top { padding: 10px 12px; }
  .chat { padding: 0 12px; }
  .gif-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .nav .ghost { display: none; }
}

/* voice */
input[type=range] { height: auto; padding: 0; border: 0; accent-color: var(--voice); width: 100%; }
input[type=range].purple { accent-color: var(--mod); }
.slider { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pct { font-size: 13px; font-weight: 500; }
.meter { height: 6px; border-radius: 3px; background: var(--soft-2); overflow: hidden; }
.meter.big { height: 14px; border-radius: 7px; }
.meter-fill { height: 100%; background: #22A06B; transition: width .1s linear; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--soft-2); }
.seg button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(31,26,34,.12); font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--voice); }
.blocked { display: flex; flex-direction: column; gap: 8px; }
.blocked b { color: var(--danger); }
.blocked ol { margin: 0; padding-left: 20px; }
.audio-panel { width: 340px; max-width: calc(100vw - 32px); background: var(--surface); border-radius: 22px; padding: 18px; box-shadow: 0 12px 36px rgba(31,26,34,.16), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 12px; }
.backdrop.clear.top-left { justify-content: flex-start; background: transparent; padding-left: 120px; }
.pill-btn { display: inline-flex; align-items: center; text-decoration: none; }
a.pill-btn { color: #fff; }
.pill-btn.on { background: var(--surface); color: var(--voice); }
.people li.speaking .avatar { box-shadow: 0 0 0 3px var(--voice); }
.me-section { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 18px; background: var(--soft); }
.me-section h3 { font-size: 12px; color: var(--muted); }

.stage { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.screen { border-radius: 22px; background: #2A2630; color: #fff; overflow: hidden; display: flex; flex-direction: column; }
.screen-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; }
.screen video { width: 100%; max-height: 62vh; background: #1C1820; display: block; }
.screen-vol { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 10px; border-radius: 10px; background: rgba(255,255,255,.12); }
.screen-vol input { width: 110px; accent-color: #C4B5FD; }
.btn.dark { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border: 0; border-radius: 20px; background: var(--soft); text-align: center; }
.tile.speaking { background: var(--voice-soft); }
.tile.speaking .avatar { box-shadow: 0 0 0 3px var(--voice), 0 0 0 7px rgba(21,128,61,.15); }
.tile > span { max-width: 100%; }
.controls-wrap { position: relative; align-self: center; }
.panel-pop { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); z-index: 5; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 8px; border-radius: 28px; background: var(--surface); box-shadow: 0 2px 10px rgba(31,26,34,.08), 0 0 0 1px var(--line); }
.ctl { min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--soft-2); font-size: 14px; }
.ctl.off { background: var(--danger-soft); color: var(--danger); }
.ctl.on { background: var(--voice-soft); color: var(--voice-ink); box-shadow: 0 0 0 1.5px var(--voice); }
.ctl.live { background: var(--voice-fill); color: #fff; }
.ctl.leave { background: var(--danger); color: #fff; font-weight: 500; }
.note.center { align-self: center; }
@media (max-width: 600px) {
  .backdrop.clear.top-left { padding-left: 16px; justify-content: center; }
  .panel-pop { position: fixed; left: 16px; right: 16px; bottom: 90px; transform: none; }
}

/* ---------- icons & shared controls ---------- */
svg { flex: none; }
button, a { -webkit-tap-highlight-color: transparent; }
.round-btn { position: relative; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--soft-2); color: var(--text); display: inline-grid; place-items: center; text-decoration: none; }
.round-btn:hover { color: var(--text); background: var(--soft-2); }
.round-btn.on, .round-btn.accent { background: var(--accent-fill); color: #fff; }
.round-btn.white { background: var(--surface); box-shadow: 0 0 0 1px var(--line); width: 44px; height: 44px; }
.round-btn.small { width: 32px; height: 32px; color: var(--muted); }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn.soft { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--soft-2); color: var(--text); }
.nav-btn.on { background: var(--accent-fill); color: #fff; }
.nav-btn.on .badge { background: var(--surface); color: var(--accent); }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent-fill); color: #fff; font-size: 12px; display: inline-grid; place-items: center; font-weight: 400; }
.badge.green { background: var(--voice-fill); }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-fill); border: 2px solid var(--surface); }
.round-btn.on .bell-dot { background: var(--surface); border-color: var(--accent); }
.back-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); background: var(--soft); }
.back { display: inline-flex; align-items: center; gap: 4px; }
.voice-pill { gap: 4px; padding: 0 4px 0 14px; }
.voice-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; margin-right: 4px; }
.voice-link:hover { color: #fff; text-decoration: underline; }
.pill-icon { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: grid; place-items: center; }
.pill-icon.off { background: var(--surface); color: var(--danger); }
.pill-icon.on { background: var(--surface); color: var(--voice); }
.avatar { position: relative; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 500; overflow: visible; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: #22A06B; }
.avatar .dot.away { background: #F59E0B; }
.avatar .dot.dnd { background: var(--danger); }
.dot-inline { width: 9px; height: 9px; border-radius: 50%; background: #22A06B; display: inline-block; margin-right: 6px; }
.dot-inline.away { background: #F59E0B; } .dot-inline.dnd { background: var(--danger); } .dot-inline.hidden { background: #B9B2BC; }
.chip-btn { height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--soft-2); font-size: 12px; color: var(--text); }
.link-btn { border: 0; background: none; padding: 0 8px; min-height: 36px; color: var(--accent); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.soft { background: var(--soft-2); border-color: transparent; color: var(--text); text-decoration: none; }
.btn.outline { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); }
.green-text { color: var(--voice-ink); }
.danger-text { color: var(--danger); }
.ink { color: var(--text); }
.col { display: flex; flex-direction: column; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.center-text { text-align: center; }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.pad6 { padding: 0 6px; }
.soft-bg { background: var(--soft); }
.segs { display: flex; flex-wrap: wrap; gap: 6px; }
.ptab { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--soft-2); font-size: 13px; }
.ptab.on { background: var(--text); color: var(--bg); }
.link-tile { width: 36px; height: 36px; flex: none; border-radius: 12px; background: var(--soft-2); color: var(--text); display: grid; place-items: center; }
.link-tile.accent { background: var(--accent-soft); color: var(--accent-ink); }
button.link-row { width: 100%; background: var(--surface); text-align: left; }
.reconnect { display: flex; align-items: center; justify-content: center; gap: 8px; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; height: 42px; padding: 0; color: var(--text); }
.room-icon { color: #fff; }
.chev { color: var(--muted); display: grid; transition: transform .15s; }
.chev.up { transform: rotate(180deg); }
.tag { display: inline-flex; align-items: center; gap: 3px; }
.empty-rooms li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.empty-rooms li .grow { color: var(--text); }

/* ---------- chat ---------- */
.chat { padding: 0 28px; }
.chat > .chat-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: 720px; }
.chat-head { display: block; font-size: 13px; }
.chat-head b { font-size: 15px; }
.conversation { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pin-bar { width: 100%; border: 0; text-align: left; color: var(--text); }
.pin-bar svg { color: var(--warn-ink); }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); padding: 10px 0 4px; }
.msg.flash .bubble, .msg.flash .msg-body { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px #FDE68A; } 100% { box-shadow: 0 0 0 0 transparent; } }
.msg.tagged { margin: 4px -12px; padding: 8px 12px; border-radius: 14px; background: var(--warn-soft); }
.msg.tagged .author { color: var(--warn-ink); }
.msg.tagged .bubble { background: var(--surface); }
.msg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.msg.mine .msg-body { align-items: flex-end; }
.mention { padding: 0 4px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 400; }
.msg.mine .mention { background: rgba(255,255,255,.22); color: #fff; }
.bubble a { color: inherit; text-decoration: underline; word-break: break-all; }
button.reply-quote { border: 0; text-align: left; cursor: pointer; }
.dots { display: grid; place-items: center; }
.tool { display: inline-flex; align-items: center; gap: 6px; }
.blocked-run { align-self: flex-start; display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 8px 14px; border-radius: 14px; border: 1px dashed var(--line-2); font-size: 13px; color: var(--muted); }
.att-images { display: grid; gap: 4px; width: 300px; max-width: 100%; }
.att-images.multi { grid-template-columns: 1fr 1fr; }
.att-image { display: block; border-radius: 18px; overflow: hidden; background: var(--soft-2); }
.att-image img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.att-images.multi .att-image img { height: 150px; }
.att-file { width: 300px; max-width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; }
.att-file:hover { color: var(--text); background: var(--soft); }
.att-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.file-tag { min-width: 40px; height: 40px; padding: 0 4px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--soft-2); color: var(--muted); }
.file-tag.red { background: var(--danger-soft); color: var(--danger); }
.file-tag.blue { background: color-mix(in srgb, #1D4ED8 15%, var(--surface)); color: #3B6FE0; }
.file-tag.green { background: var(--voice-soft); color: var(--voice-ink); }
.file-tag.violet { background: var(--mod-soft); color: var(--mod); }
.composer-box { position: relative; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line-2); border-radius: 26px; padding: 4px 4px 4px 4px; background: var(--surface); }
.composer-box:focus-within { border-color: var(--line-2); }
.composer-row { display: flex; align-items: center; gap: 6px; }
.composer-row input#msg { flex: 1; min-width: 0; border: 0; height: 40px; padding: 0 6px; background: transparent; }
.send-btn { display: grid; place-items: center; }
.composer-hint { font-size: 12px; color: var(--muted); padding: 0 12px; margin-top: -4px; }
.locked-composer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 0; }
.pending { position: relative; display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 40px 0 10px; border-radius: 14px; background: var(--soft-2); max-width: 260px; overflow: hidden; }
.pending.image { width: 64px; padding: 0; }
.pending.image img { width: 100%; height: 100%; object-fit: cover; }
.pending .file-tag { min-width: 36px; height: 36px; }
.pending.busy img { opacity: .6; }
.pending .remove { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pending .progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.8); }
.pending .progress span { display: block; height: 100%; border-radius: 2px; background: var(--accent-fill); }
.tag-pop { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 6; width: 300px; max-width: 100%; padding: 6px; border-radius: 18px; background: var(--surface); box-shadow: 0 8px 28px rgba(31,26,34,.14), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 2px; }
.tag-title { padding: 4px 10px; }
.tag-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.tag-opt[aria-selected="true"], .tag-opt:hover { background: var(--accent-soft); }
.at-circle { width: 30px; height: 30px; border-radius: 50%; background: var(--soft-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.drop-hint { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 24px; background: rgba(252,231,241,.85); color: var(--accent-ink); font-weight: 500; pointer-events: none; }
.icon-btn.soft:hover { background: var(--soft-2); }

/* ---------- notifications ---------- */
.notif-panel { position: absolute; top: 64px; right: 24px; width: 420px; max-width: calc(100% - 32px); max-height: calc(100vh - 90px); overflow-y: auto; background: var(--surface); border-radius: 24px; box-shadow: 0 16px 48px rgba(31,26,34,.18), 0 0 0 1px var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.notif-panel h2 { font-size: 18px; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.notif { width: 100%; display: flex; gap: 12px; padding: 10px; border: 0; border-radius: 16px; background: transparent; text-align: left; line-height: 1.4; }
.notif:hover { background: var(--soft); }
.notif.unread { background: var(--warn-soft); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-text .quote { color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-icon { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--soft-2); color: var(--muted); }
.notif-icon.green { background: var(--voice-soft); color: var(--voice-ink); }
.notif-icon.red { background: var(--danger-soft); color: var(--danger); }
.unread-dot { width: 10px; height: 10px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--accent-fill); }
.center-link { align-self: center; min-height: 32px; display: grid; place-items: center; }
.empty-note { padding: 16px 10px; }

/* ---------- private chats ---------- */
.dm-page { flex-wrap: nowrap; height: calc(100vh - 65px); }
.dm-list { flex: 0 0 300px; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--soft); overflow-y: auto; }
.dm-list-head { padding: 0 6px; }
.dm-list-head h1 { font-size: 20px; }
.dm-search { height: 42px; margin: 0 4px; background: var(--surface); }
.dm-rows { display: flex; flex-direction: column; gap: 2px; }
.dm-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; color: inherit; text-decoration: none; }
.dm-row:hover { color: inherit; background: var(--surface); }
.dm-row.on { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.dm-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.dm-row-text b.bold { font-weight: 600; }
.dm-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 24px; }
.dm-chat .conversation { width: 100%; max-width: 760px; align-self: center; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 14px 0; margin: 0 -24px; padding-left: 24px; padding-right: 24px; border-bottom: 1px solid var(--line); }
.dm-head-text { line-height: 1.3; min-width: 0; }
.dm-head-text h2 { font-size: 17px; }
.dm-note { margin-top: 10px; align-self: center; }
.dm-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.dm-profile { flex: 0 0 260px; border-left: 1px solid var(--line); padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; overflow-y: auto; }
.dm-profile h3 { font-size: 19px; }
.dm-profile .bio { margin: 0; color: var(--text); text-align: center; }
.facts { margin: 8px 0 0; width: 100%; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--soft); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.dm-actions { display: flex; gap: 8px; margin-top: auto; width: 100%; }
.dm-actions .btn { height: 44px; }
.show-mobile, .show-narrow { display: none !important; }

/* ---------- search ---------- */
.search-top { gap: 12px; }
.search-field { flex: 1 1 320px; max-width: 560px; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 14px; border-radius: 999px; border: 1.5px solid var(--accent); background: var(--surface); color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: 0; padding: 0; height: 40px; background: transparent; color: var(--text); }
.search-page { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter { height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 14px; color: var(--text); }
.filter.on { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
select.filter { padding-right: 30px; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.result { background: var(--surface); border-radius: 20px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.result-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.result-thumb { width: 64px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.result .file-tag { min-width: 0; height: auto; padding: 2px 8px; border-radius: 6px; }
mark { background: #FDE68A; color: inherit; border-radius: 4px; padding: 0 2px; }
.row.gap8 { gap: 8px; align-items: center; }

/* ---------- settings & profile ---------- */
.settings-page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 24px 48px; display: flex; flex-direction: column; gap: 16px; }
.settings-page h2 { font-size: 17px; }
.settings-page .card { box-shadow: none; }
.embedded-audio .audio-panel { position: static; width: 100%; box-shadow: none; padding: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.profile-grid > form { flex: 999 1 420px; }
.profile-grid > aside { flex: 1 1 240px; }
.um-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.um-actions .btn { flex: 1 1 auto; height: 40px; font-size: 14px; }

/* ---------- voice room page ---------- */
.stage-layout { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px; display: flex; flex-wrap: wrap; gap: 20px; }
.stage { flex: 999 1 560px; min-width: 0; max-width: none; margin: 0; border-radius: 28px; background: var(--voice-soft); padding: 28px; gap: 8px; }
.stage-head { align-items: center; gap: 8px; font-size: 13px; color: var(--voice-ink); font-weight: 500; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--voice-fill); }
.live-dot.off { background: #B9B2BC; }
.stage-title { font-size: 30px; }
.tiles { flex: 1; padding: 24px 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; align-content: center; }
.tile { background: transparent; padding: 6px; gap: 8px; }
.tile.speaking { background: transparent; }
.tile-ring { position: relative; padding: 5px; border-radius: 50%; border: 4px solid transparent; }
.tile.speaking .tile-ring { border-color: var(--voice); box-shadow: 0 0 0 6px rgba(21,128,61,.15); }
.tile.speaking .avatar { box-shadow: none; }
.tile-name { font-weight: 500; }
.tile-note { color: #3F5A48; margin-top: -6px; }
.tile.speaking .tile-note { color: var(--voice-ink); }
.mic-badge { position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); color: var(--danger); display: grid; place-items: center; }
.controls { gap: 12px; padding: 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(31,26,34,.06); align-items: center; }
.ctl { width: 56px; height: 56px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.ctl.wide { width: auto; padding: 0 18px; }
.ctl.leave { width: auto; height: 56px; padding: 0 24px; border-radius: 999px; display: flex; align-items: center; gap: 8px; }
.stage-chat { flex: 1 1 280px; max-width: 100%; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 28px; padding: 20px; height: calc(100vh - 110px); min-height: 420px; }
.stage-chat h2 { font-size: 15px; margin-bottom: 4px; }
.conversation.compact .composer-hint, .conversation.compact .pin-wrap { display: none; }
.conversation.compact .msg-row { max-width: 92%; }
.conversation.compact .att-images, .conversation.compact .att-file { width: 220px; }

/* ---------- phones ---------- */
.mobile-nav, .mobile-voice { display: none; }
@media (max-width: 760px) {
  .top { padding: 10px 12px; gap: 8px; }
  .top .loc, .hide-mobile { display: none !important; }
  .show-mobile { display: inline-grid !important; }
  .brand { font-size: 19px; }
  .body.home { flex-wrap: nowrap; }
  .body.home .rooms { display: none; }
  .body.home.show-rooms .chat { display: none; }
  .body.home.show-rooms .rooms { display: flex; flex: 1; border-left: 0; }
  .chat { padding: 0 14px; height: calc(100dvh - 61px - 64px); }
  .rooms { height: calc(100dvh - 61px - 64px); }
  .app:has(.mobile-voice) .chat, .app:has(.mobile-voice) .rooms { height: calc(100dvh - 61px - 64px - 60px); }
  .msg-row { max-width: 88%; }
  .composer-hint { display: none; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: sticky; bottom: 0; z-index: 8; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .mobile-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; color: var(--muted); text-decoration: none; font-size: 11px; }
  .mobile-nav a.on { color: var(--accent); font-weight: 500; }
  .mobile-nav .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
  .mobile-voice { display: flex; align-items: center; gap: 10px; margin: 0 10px 8px; padding: 6px 6px 6px 14px; border-radius: 16px; background: var(--voice-fill); color: #fff; position: sticky; bottom: 70px; z-index: 8; }
  .mv-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
  .mv-link:hover { color: #fff; }
  .mv-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
  .mv-text .small { opacity: .9; }
  .mv-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: grid; place-items: center; }
  .dm-page { height: calc(100dvh - 61px - 64px); }
  .dm-list { flex: 1; border-right: 0; }
  .dm-page.has-chat .dm-list { display: none; }
  .dm-page:not(.has-chat) .dm-chat, .dm-page:not(.has-chat) .dm-empty { display: none; }
  .dm-profile { display: none; }
  .dm-chat { padding: 0 12px; }
  .dm-head { margin: 0 -12px; padding: 10px 12px; }
  .show-narrow { display: inline-grid !important; }
  .notif-panel { top: 60px; right: 8px; left: 8px; width: auto; max-width: none; }
  .search-page, .settings-page { padding: 16px 14px 32px; }
  .result { flex-wrap: wrap; }
  .stage-layout { padding: 10px; }
  .stage { padding: 18px; }
  .stage-title { font-size: 24px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
  .tile .avatar { width: 72px !important; height: 72px !important; }
  .stage-chat { display: none; }
  .gif-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .dm-profile { display: none; }
  .show-narrow { display: inline-grid !important; }
}
.composer-row input#msg:focus, .composer-row input#msg:focus-visible, .search-field input:focus-visible, .search-box input:focus-visible { outline: none; border: 0; }
.composer-box:focus-within { border-color: var(--accent); }
.search-box:focus-within { box-shadow: 0 0 0 1.5px var(--accent); }
.segs .ptab { flex: none; display: inline-flex; align-items: center; min-width: 0; }
@media (max-width: 760px) {
  .app { height: 100dvh; min-height: 0; overflow: hidden; }
  .app > .body, .app > .dm-page { flex: 1; min-height: 0; height: auto; }
  .app > main, .app > .stage-layout, .app > .center-page { flex: 1; min-height: 0; overflow-y: auto; }
  .chat, .rooms, .app:has(.mobile-voice) .chat, .app:has(.mobile-voice) .rooms { height: auto; min-height: 0; }
  .body.home .chat, .body.home.show-rooms .rooms { flex: 1; }
  .mobile-nav, .mobile-voice { position: static; flex: none; }
  .mobile-voice { margin: 6px 10px; }
  .top .back-link { display: none; }
  .top { flex-wrap: nowrap; }
  .top .nav { flex-wrap: nowrap; }
}
@media (max-width: 760px) {
  .messages { max-height: none; }
  .chat { min-height: 0; }
}
.embedded-audio .audio-panel > .row-between:first-child { display: none; }
.audit-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--surface); }
.day-head { margin: 8px 4px 0; }
.notif-icon.mod { background: var(--mod-soft); color: var(--mod); }
.notif-icon.warn { background: var(--warn-soft); color: var(--warn-ink); }
.filters .ptab { flex: none; display: inline-flex; align-items: center; }
.members-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.members-layout > .card:first-child { flex: 999 1 480px; min-width: 0; }
.perms { flex: 1 1 300px; }
.perms h2 { font-size: 17px; }
.perms table { width: 100%; border-collapse: collapse; font-size: 14px; }
.perms th, .perms td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; font-weight: 400; }
.perms tbody th { text-align: left; }
.perms thead th { font-size: 12px; color: var(--muted); }
.member-row .round-btn.small { background: transparent; }
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.channel-bar { display: flex; align-items: center; gap: 8px; padding: 12px 0 2px; overflow-x: auto; scrollbar-width: none; }
.channel-bar::-webkit-scrollbar { display: none; }
.channel-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--soft-2); color: var(--text); text-decoration: none; white-space: nowrap; }
.channel-pill:hover { color: var(--text); background: var(--soft-2); }
.channel-pill.on { background: var(--accent-fill); color: #fff; }
.channel-pill.on .badge { background: var(--surface); color: var(--accent); }
.channel-pill .badge { min-width: 20px; height: 20px; font-size: 11px; }
.channel-bar .round-btn { flex: none; }
.chat-head { display: flex; align-items: center; gap: 6px; }
.chat-head .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.announce-banner { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.announce-banner a { color: inherit; text-decoration: none; min-width: 0; }
.bot-tag { display: inline-flex; align-items: center; margin-left: 6px; padding: 0 6px; height: 17px; border-radius: 5px; background: var(--mod); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: .3px; vertical-align: 1px; }
.grow-main { flex: 999 1 480px; min-width: 0; }
.bubble .para { display: block; }
.bubble strong { font-weight: 600; }
.inline-code { padding: 1px 6px; border-radius: 6px; background: rgba(31,26,34,.07); font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace; font-size: .88em; }
.msg.mine .inline-code { background: rgba(255,255,255,.2); }
.code-block { margin: 4px 0; padding: 10px 12px; border-radius: 12px; background: #2A2630; color: #F4F1F5; font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.bubble blockquote { margin: 2px 0; padding: 0 0 0 10px; border-left: 3px solid rgba(31,26,34,.25); }
.msg.mine .bubble blockquote { border-left-color: rgba(255,255,255,.6); }
.spoiler { border-radius: 4px; background: #3E3842; color: transparent; cursor: pointer; transition: background .15s; }
.spoiler * { visibility: hidden; }
.spoiler.open { background: rgba(31,26,34,.08); color: inherit; cursor: auto; }
.spoiler.open * { visibility: visible; }
.msg.mine .spoiler.open { background: rgba(255,255,255,.18); }
.link-card { width: 360px; max-width: 100%; display: flex; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); color: var(--text); text-decoration: none; }
.link-card:hover { color: var(--text); background: var(--soft); }
.lc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.lc-site { font-size: 12px; color: var(--muted); }
.lc-title { font-weight: 500; color: var(--accent-ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lc-desc { font-size: 13px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.lc-img { width: 80px; height: 80px; flex: none; border-radius: 10px; object-fit: cover; }
.yt-card { width: 400px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.yt-card iframe, .yt-thumb { width: 100%; height: 100%; border: 0; display: block; }
.yt-thumb { position: relative; padding: 0; background: #000; cursor: pointer; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; transform: translate(-50%, -50%); border-radius: 14px; background: #E52D27; }
.yt-play::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.conversation.compact .link-card, .conversation.compact .yt-card { width: 230px; }
.more-wrap { position: relative; }
.more-menu { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 6; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--surface); box-shadow: 0 8px 28px rgba(31,26,34,.14), 0 0 0 1px var(--line); display: flex; flex-direction: column; }
.more-menu button { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.more-menu button:hover { background: var(--soft); }
.poll-card, .event-card { width: 360px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.poll-head { display: flex; align-items: center; gap: 8px; }
.poll-head svg { color: var(--accent); }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); overflow: hidden; text-align: left; }
.poll-opt:hover:not(:disabled) { border-color: var(--line-2); }
.poll-opt.mine { border-color: var(--accent); }
.poll-opt:disabled { cursor: default; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .3s; }
.poll-text, .poll-count { position: relative; }
.poll-text { flex: 1; display: flex; align-items: center; gap: 6px; }
.poll-text svg { color: var(--accent); }
.poll-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.event-card { border-left: 4px solid var(--voice); }
.event-date { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--voice-ink); font-weight: 500; }
.event-when { margin-left: auto; font-weight: 400; color: var(--muted); }
.event-title { font-size: 16px; }
.event-desc { margin: 0; color: var(--text); white-space: pre-wrap; }
.event-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-foot .stack .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.event-foot .stack .avatar:first-child { margin-left: 0; }
.event-foot .stack { display: inline-flex; align-items: center; }
img.emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; }
.bubble.jumbo { background: transparent !important; padding: 0; font-size: 40px; line-height: 1.2; }
.bubble.jumbo img.emoji { width: 48px; height: 48px; vertical-align: middle; }
img.sticker { width: 160px; height: 160px; object-fit: contain; }
.react img.emoji { width: 18px; height: 18px; vertical-align: -4px; }
.picker { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 7; width: 340px; max-width: calc(100vw - 32px); max-height: 360px; overflow-y: auto; padding: 12px; border-radius: 20px; background: var(--surface); box-shadow: 0 8px 28px rgba(31,26,34,.14), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.toolbar .picker { bottom: auto; top: calc(100% + 6px); }
.picker input { height: 38px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.emoji-btn { aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; font-size: 22px; display: grid; place-items: center; padding: 0; }
.emoji-btn:hover { background: var(--soft-2); }
.emoji-btn img { width: 26px; height: 26px; object-fit: contain; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sticker-btn { aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--soft); padding: 6px; }
.sticker-btn img { width: 100%; height: 100%; object-fit: contain; }
.emoji-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.emoji-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: 14px; background: var(--soft); position: relative; }
.emoji-item img { width: 40px; height: 40px; object-fit: contain; }
.emoji-item img.sticker-thumb { width: 72px; height: 72px; }
.emoji-item .icon-btn { position: absolute; top: 4px; right: 4px; }
.picker { z-index: 21; }
.more-wrap > .backdrop.clear { background: transparent; }
.thread-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 0; padding: 4px 10px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.msg.mine .thread-link { align-self: flex-end; }
.thread-panel { position: fixed; top: 61px; right: 0; bottom: 0; z-index: 15; width: 420px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 0; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(31,26,34,.08); }
.thread-head { display: flex; align-items: center; gap: 8px; }
.thread-root { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--soft); }
.ellipsis-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 760px) { .thread-panel { top: 0; width: 100%; padding-top: 10px; } }
.mute-btn { width: 28px; height: 28px; background: transparent; color: var(--muted); margin-right: 2px; }
.mute-btn.on { color: var(--accent); background: var(--accent-soft); }
.muted-icon { display: inline-flex; margin-left: 6px; color: var(--muted); vertical-align: -1px; }
.lock-note.warn { display: inline-flex; align-items: center; gap: 3px; color: var(--warn-ink); }
.time-picker { display: flex; flex-direction: column; gap: 8px; }
.tp-amount { width: 90px; }
.help-page p { margin: 0; }
.help-compare .soft-box { display: flex; flex-direction: column; gap: 6px; }
.steps-help { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 12px; }
.step-n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent-fill); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 500; }
.code-ex { border-radius: 12px; overflow: hidden; background: #2A2630; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; color: #D9D3DB; }
.code-bar .btn.soft { background: rgba(255,255,255,.12); color: #fff; }
.code-ex .code-block { margin: 0; border-radius: 0; }
.fit { align-self: flex-start; }
.help-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.att-audio { width: 320px; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.att-audio-icon { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.att-audio audio { width: 100%; height: 36px; }
.att-video { width: 360px; max-width: 100%; max-height: 360px; border-radius: 16px; background: #000; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px; color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: rec 1s infinite; }
@keyframes rec { 50% { opacity: .3; } }
.composer-row.hidden { display: none; }
.link-btn.inline { padding: 0; min-height: 0; font-size: 12px; }
.sched-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--soft); }
.conversation.compact .att-audio, .conversation.compact .att-video { width: 230px; }

/* name tags */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--surface)); }
.tag-chip.sm { padding: 0 8px; font-size: 11px; }
.tag-chip.toggle { cursor: pointer; color: var(--muted); background: var(--surface); border-color: #E4E0E6; }
.tag-chip.toggle.on { color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-color: color-mix(in srgb, var(--c) 45%, var(--surface)); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--c); }
.tag-admin { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.tag-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tag-row:last-child { border-bottom: 0; }
.tag-row .icon-btn:disabled { opacity: .35; cursor: default; }

/* stage rooms */
.stage-tag { margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: middle;
  color: var(--mod, #4C3BB5); background: var(--mod-soft); }
.stage-tag.big { font-size: 13px; padding: 2px 10px; }
.stage-sub { font-size: 14px; font-weight: 600; color: var(--muted); margin: 4px 0 8px; text-align: center; }
.stage-empty { list-style: none; padding: 24px; }
.audience { width: 100%; max-width: 720px; margin: 8px auto 0; }
.aud-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.aud-list li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 12px; background: var(--soft-2); }
.aud-list li.hand { background: var(--warn-soft); }
.aud-person { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.tag.hand { color: #92400E; background: #FDE68A; }
.pill-lock { display: inline-flex; opacity: .7; }

/* right-click menus */
.ctx-backdrop { position: fixed; inset: 0; z-index: 60; }
.ctx-menu { position: fixed; width: 232px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(30, 20, 40, .16); display: flex; flex-direction: column; }
.ctx-title { font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 10px 6px; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 9px;
  font: inherit; font-size: 14px; color: inherit; text-align: left; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible, .ctx-emoji:hover, .ctx-emoji:focus-visible { background: var(--soft-2); outline: none; }
.ctx-item.danger { color: #B91C1C; }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { background: var(--danger-soft); }
.ctx-sep { height: 1px; background: var(--soft-2); margin: 4px 6px; }
.ctx-emojis { display: flex; justify-content: space-between; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctx-emoji { width: 34px; height: 34px; border: 0; background: none; border-radius: 50%; font-size: 19px; cursor: pointer; }
.saved-mark { display: inline-flex; align-items: center; gap: 2px; color: #A16207; }
.search-tabs { margin-bottom: 12px; }
.search-tabs .ptab { display: inline-flex; align-items: center; gap: 6px; }
.date-range input[type=date] { padding: 4px 8px; }

/* welcome screen */
.welcome-backdrop { z-index: 50; }
.modal.welcome { max-width: 560px; width: calc(100% - 32px); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.welcome-head { display: flex; align-items: center; gap: 12px; }
.welcome-head h1 { font-size: 22px; margin: 0; }
.welcome-wave { font-size: 32px; }
.welcome-text { white-space: pre-wrap; margin: 0; }
.welcome-sub { display: flex; align-items: center; gap: 6px; font-size: 15px; margin: 0 0 8px; }
.rules { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.rules li { padding-left: 4px; }
.agree { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--soft-2); cursor: pointer; }
.agree input { width: 18px; height: 18px; }
.sys-msg { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; margin: 6px auto;
  border-radius: 999px; background: var(--soft-2); width: fit-content; max-width: 100%; font-size: 14px; }

/* message text size (Settings → หน้าตา) */
.bubble, .att-caption { font-size: var(--msg-size); }

/* quick switcher, shortcuts, away summary */
.modal.switcher { max-width: 560px; gap: 10px; align-self: flex-start; margin-top: 12vh; }
.sw-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sw-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; cursor: pointer; min-width: 0; }
.sw-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.sw-item .muted { max-width: 45%; }
.sw-empty { padding: 12px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.keys dd { margin: 0; }
kbd { display: inline-block; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--soft); font: 500 13px 'Kanit', system-ui, sans-serif; white-space: nowrap; }
.away-box { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding: 12px 14px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); }
.away-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; }
.look-sample { align-self: flex-start; margin: 6px 0 0; }

/* pinned messages list */
.pin-wrap { position: relative; }
.pin-bar .chev { display: inline-flex; transition: transform .15s; }
.pin-bar .chev.up { transform: rotate(180deg); }
.pin-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 9; max-height: 60vh; overflow-y: auto; padding: 8px;
  border-radius: 18px; background: var(--surface); box-shadow: 0 12px 32px rgba(31,26,34,.16), 0 0 0 1px var(--line); }
.pin-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pin-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; }
.pin-item:hover { background: var(--soft-2); }
.pin-go { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; border: 0; background: none; padding: 0; text-align: left; color: inherit; cursor: pointer; }
.pin-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

/* layout options (Settings → จัดหน้าจอ) */
.chat-inner > .conversation { order: 50; }
.chat-head { display: flex; align-items: center; gap: 6px; }
.rooms { position: relative; }
.rooms-resizer { position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; cursor: col-resize; z-index: 3; touch-action: none; }
.rooms-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.rooms-resizer:hover::after, .rooms-resizer.active::after, .rooms-resizer:focus-visible::after { background: var(--accent-fill); }
.rooms-toggle { margin-left: auto; flex: none; }
.rooms-toggle[aria-pressed="false"] { color: var(--muted); }
.sec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sec-row { display: flex; align-items: center; gap: 6px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.sec-row:last-child { border-bottom: 0; }
.sec-row.off .grow { color: var(--muted); }
.channel-pill.drag-src { opacity: .4; }
@media (min-width: 901px) {
  .body.home .rooms { flex: 0 0 var(--rooms-w, 360px); max-width: 60vw; }
  .body.home.rooms-left .rooms { order: -1; border-left: 0; border-right: 1px solid var(--line); }
  .body.home.rooms-left .rooms-resizer { left: auto; right: -4px; }
  .body.home.rooms-hidden .rooms { display: none; }
}
@media (max-width: 900px) { .rooms-toggle { display: none; } }

/* message styles */
:root:not([data-msg="list"]) .msg.mine > .author.self-author { display: none; }
:root[data-msg="list"] .msg, :root[data-msg="list"] .msg.mine, :root[data-msg="list"] .msg.mine .msg-body { align-items: flex-start; }
:root[data-msg="list"] .msg.mine .msg-row { flex-direction: row; }
:root[data-msg="list"] .msg-row { max-width: 100%; }
:root[data-msg="list"] .bubble, :root[data-msg="list"] .msg.mine .bubble { background: none; color: var(--text); padding: 0 6px; border-radius: 0; }
:root[data-msg="list"] .msg.mine .mention { background: var(--accent-soft); color: var(--accent-ink); }
:root[data-msg="list"] .msg.mine .thread-link { align-self: flex-start; }
:root[data-msg="list"] .author { font-size: 14px; font-weight: 500; color: var(--text); padding-top: 8px; }
:root[data-msg="list"] .msg:hover { background: var(--soft); border-radius: 10px; }
:root[data-msg="compact"] .messages { gap: 0; }
:root[data-msg="compact"] .msg { padding: 1px 0; gap: 1px; }
:root[data-msg="compact"] .bubble { padding: 5px 12px; border-radius: 14px 14px 14px 4px; }
:root[data-msg="compact"] .msg.mine .bubble { border-radius: 14px 14px 4px 14px; }
:root[data-msg="compact"] .meta { display: none; }
:root[data-msg="compact"] .msg:hover .meta { display: block; }

/* text channels in the side panel, next to voice rooms */
.side-chans { display: none; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.side-chans h2 { font-size: 18px; }
.channel-list { display: flex; flex-direction: column; gap: 2px; }
.channel-list .channel-pill { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px; border-radius: 12px;
  background: none; border: 0; color: var(--text); text-decoration: none; font-size: 15px; }
.channel-list .channel-pill:hover { background: var(--soft-2); }
.channel-list .channel-pill.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.channel-list .channel-pill svg { flex: none; color: var(--muted); }
.channel-list .channel-pill.on svg { color: var(--accent-ink); }
.room-list li.empty-room { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 14px; border-radius: 12px; border: 1px dashed var(--line-2); }
.room-list .drag-src { opacity: .4; }
.room-list li[draggable="true"] { cursor: grab; }
@media (min-width: 901px) {
  .body.home.chans-side:not(.rooms-hidden) .side-chans { display: flex; }
  .body.home.chans-side:not(.rooms-hidden) .top-chans { display: none !important; }
}

/* drag to reorder: the moving item shows where it will land */
.sorting .drag-src { opacity: 1 !important; background: var(--accent-soft) !important; color: var(--accent-ink) !important;
  outline: 2px dashed var(--accent); outline-offset: -2px; box-shadow: none !important; }
.sorting .drag-src * { visibility: hidden; }
.sorting [data-flip]:not(.drag-src) { transition: background .15s; }
[data-flip] { will-change: transform; }

/* "new messages" line */
.unread-line { display: flex; align-items: center; gap: 10px; margin: 8px 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.unread-line::before, .unread-line::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.unread-line span { padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); }
.draft-mark { display: inline-flex; color: var(--muted); margin-left: 4px; }
.fw-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.fw-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; }
.fw-row:hover { background: var(--soft-2); }
/* Private chats: fit the window so the chat scrolls inside, not the page. */
@media (min-width: 761px) {
  .app > .dm-page { flex: none; height: calc(100vh - 61px); overflow: hidden; }
  .dm-page > * { min-height: 0; }
  .dm-page .dm-list, .dm-page aside { overflow-y: auto; }
}
.dm-actions { display: flex; flex-wrap: wrap; gap: 8px; } .dm-actions .btn { white-space: nowrap; padding: 0 14px; }
.topic-show { display: inline-flex; align-items: center; gap: 6px; margin: -4px 0 10px; padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--text); font-size: 14px; }
.topic-show:hover { background: var(--soft-2); }
.topic-show svg { color: var(--muted); }
.topic-edit { display: flex; gap: 6px; align-items: center; margin: -4px 0 10px; max-width: 520px; }
.topic-edit input { flex: 1; height: 36px; }

/* soundboard */
.soundboard { width: 340px; max-width: calc(100vw - 32px); background: var(--surface); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 12px 36px rgba(31,26,34,.16), 0 0 0 1px var(--line); }
.sb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sb-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); min-width: 0; }
.sb-btn:hover { background: var(--accent-soft); border-color: transparent; }
.sb-btn:active { transform: scale(.96); }
.sb-emoji { font-size: 22px; line-height: 1.1; }
.sound-note { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; white-space: nowrap; pointer-events: none; }

/* pictures, files and links of a chat */
.media-panel { padding-bottom: 12px; }
.media-body { flex: 1; overflow-y: auto; min-height: 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--soft-2); cursor: pointer; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile:hover { outline: 2px solid var(--accent); }
.media-play { position: absolute; inset: auto 6px 6px auto; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; }
.media-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.media-list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; min-width: 0; }
.media-list li:hover { background: var(--soft-2); }
.media-btn { flex: none; margin-left: auto; }
.media-btn + .rooms-toggle { margin-left: 0; }
.chat-head .chan-edit { flex: none; margin-left: auto; }
.chat-head .chan-edit ~ .media-btn { margin-left: 0; }

/* ---- polish pass ---- */
.only-mobile { display: none !important; }
@media (max-width: 760px) {
  .only-mobile { display: flex !important; }
  /* Phones: a wider text box. GIF moves into the + menu, and the mic hides while typing. */
  .composer-row.has-text .mic-btn { display: none; }
  .composer-row { gap: 2px; }
  .composer-row .icon-btn { width: 36px; height: 36px; }
  /* Admin tabs scroll sideways instead of wrapping into a lumpy oval. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; border-radius: 999px; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { flex: none; }
}
@media (min-width: 761px) {
  .tabs { border-radius: 22px; }
}
.gif-mini { display: inline-grid; place-items: center; width: 22px; height: 16px; border-radius: 4px; border: 1.5px solid currentColor; font-size: 8px; font-weight: 700; }
/* Pop-overs above the voice controls never run off the top of the window. */
.panel-pop { max-height: calc(100vh - 200px); overflow-y: auto; border-radius: 22px; }
/* Loading screen (index.html) */
.splash-logo { width: 56px; height: 56px; border-radius: 16px; background: #BE185D; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 24px;
  animation: splash-pulse 1.2s ease-in-out infinite; }
@keyframes splash-pulse { 50% { transform: scale(.92); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .splash-logo { animation: none; } }
/* Native file pickers look like the rest of the app. */
input[type=file] { height: auto; padding: 8px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--soft); font-size: 14px; color: var(--muted); cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font: inherit; font-weight: 500; cursor: pointer; }
input[type=file]:hover { border-color: var(--accent); }
/* Empty states read as a gentle card, not a stray line of grey text. */
.empty-note { text-align: center; padding: 36px 16px !important; border: 1.5px dashed var(--line-2); border-radius: 20px; background: var(--soft); }
/* Voice controls sit high on the page: open their panels downward on wide screens. */
@media (min-width: 761px) {
  .controls-wrap .panel-pop { bottom: auto; top: calc(100% + 10px); max-height: none; overflow: visible; }
}

/* "your event is starting" */
.event-pop-backdrop { z-index: 55; }
.modal.event-pop { max-width: 380px; text-align: center; align-items: center; gap: 10px; }
.modal.event-pop .col { width: 100%; }
.event-pop-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--voice-soft); color: var(--voice); animation: ev-pop 0.5s ease; }
.modal.event-pop h2 { font-size: 20px; }
@keyframes ev-pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .event-pop-icon { animation: none; } }

/* The chat uses all the room it has; only each message keeps a readable width. */
.chat > *, .chat > .chat-inner, .dm-chat .conversation { max-width: none; }
.msg-row { max-width: min(80%, 680px); }
.poll-card, .event-card { max-width: 100%; }
.dm-actions .btn { flex: 1 1 auto; padding: 0 10px; font-size: 14px; }

/* "you're in voice" dock at the bottom of the side panel */
.voice-dock { position: sticky; bottom: -18px; margin: auto -18px -18px; padding: 10px 12px 12px; background: var(--surface);
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.voice-dock-main { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--voice-soft); color: var(--text); text-decoration: none; min-width: 0; }
.voice-dock-main:hover { background: color-mix(in srgb, var(--voice) 18%, var(--surface)); color: var(--text); }
.voice-dock-main svg { transform: rotate(-90deg); color: var(--voice); flex: none; }
.voice-dock-state { color: var(--voice-ink); }
.voice-dock-btns { display: flex; gap: 6px; }
.dock-btn { flex: 1; height: 38px; border: 0; border-radius: 12px; background: var(--soft-2); color: var(--text); display: grid; place-items: center; }
.dock-btn:hover { background: var(--line); }
.dock-btn.off { background: var(--danger-soft); color: var(--danger); }
.dock-btn.leave { background: var(--danger); color: #fff; }
.dock-btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 760px) { .voice-dock { display: none; } }

/* Voice room page on wide screens: the room on the left, its chat on the right at full height. */
@media (min-width: 901px) {
  .app > .stage-layout { max-width: none; margin: 0; padding: 0; gap: 0; flex-wrap: nowrap; height: calc(100vh - 61px); overflow: hidden; }
  .stage-layout > .stage { margin: 20px; overflow-y: auto; }
  .stage-layout > .stage-chat { flex: 0 0 clamp(360px, 36vw, 560px); height: auto; min-height: 0; border: 0; border-left: 1px solid var(--line);
    border-radius: 0; padding: 14px 20px 0; background: var(--surface); }
}
.voice-dock-main > .col { flex: 1; }

/* one header on every page: sections, voice pill, account menu */
.sections { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--soft-2); }
.sec-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; }
.sec-tab:hover { color: var(--text); }
.sec-tab.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(31,26,34,.1); }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-fill); }
.account { position: relative; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 61; width: 260px; padding: 6px; border-radius: 16px; background: var(--surface);
  box-shadow: 0 12px 32px rgba(31,26,34,.16), 0 0 0 1px var(--line); display: flex; flex-direction: column; }
.account-menu .ctx-item { text-decoration: none; }
.account-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account .backdrop.clear { position: fixed; inset: 0; z-index: 60; background: transparent; }
.only-mobile-grid { display: none !important; }
@media (max-width: 760px) { .only-mobile-grid { display: inline-grid !important; } }
.search-page > .search-field { max-width: none; width: 100%; margin-bottom: 14px; background: var(--surface); }
.search-page > .search-field { flex: none; height: 48px; }

.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.alert-list li { gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: 0; }

/* admin overview */
.health { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.health-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.health-row:last-child { border-bottom: 0; }
.health-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.health-row.ok .health-icon { background: var(--voice-soft); color: var(--voice); }
.health-row.warn .health-icon { background: var(--warn-soft); color: var(--warn-ink); }
.health-row.bad .health-icon { background: var(--danger-soft); color: var(--danger); }
.health-tag { font-size: 12px; color: var(--muted); flex: none; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-tile { gap: 2px; padding: 18px; }
.stat-num { font-size: 30px; font-weight: 600; line-height: 1.2; }
.daybars-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.daybars { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.daybars figcaption { display: flex; flex-direction: column; }
.db-plot { height: 120px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--line-2); }
.db-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.db-bar { width: 100%; max-width: 14px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.db-bar.today { background: var(--accent-fill); }
.db-col:hover .db-bar, .db-col:focus-visible .db-bar { background: var(--accent-ink); }
.db-tip { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); padding: 2px 7px; border-radius: 6px; background: var(--text); color: var(--bg);
  font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .1s; }
.db-col:hover .db-tip, .db-col:focus-visible .db-tip { opacity: 1; }
.db-plot .db-col:hover .db-tip { bottom: auto; top: -22px; }
.db-axis { display: flex; gap: 4px; }
.db-axis span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stat-table th, .stat-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-table th { color: var(--muted); font-weight: 500; }
.top-chats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.top-chats li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tc-bar { width: 40%; height: 8px; border-radius: 4px; background: var(--soft-2); overflow: hidden; flex: none; }
.tc-bar span { display: block; height: 100%; border-radius: 4px; background: var(--accent-fill); }
.tc-n { width: 48px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.edit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.edit-list p { margin: 4px 0 0; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.edit-old { background: var(--soft-2); color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.edit-now { background: var(--voice-soft); }

.whatsnew { display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.whatsnew ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.whatsnew li { display: flex; gap: 8px; align-items: flex-start; }
.whatsnew li svg { color: var(--voice); flex: none; margin-top: 4px; }
