:root {
  --bg-0: #1e1f22;      /* サーバー列 */
  --bg-1: #2b2d31;      /* サイドバー */
  --bg-2: #313338;      /* チャット */
  --bg-3: #383a40;      /* 入力欄 */
  --bg-hover: #3a3c42;
  --bg-active: #404249;
  --text: #dbdee1;
  --text-strong: #f2f3f5;
  --muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #da373c;
  --ok: #23a55a;
  --mention-bg: rgba(250, 168, 26, .1);
  --mention-bar: #f0b232;
  --border: #1f2023;
  --radius: 8px;
  --font: "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-2); color: var(--text); font: 15px/1.45 var(--font);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #00a8fc; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; color: var(--text-strong); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* ---------- ボタン / フォーム ---------- */
.btn {
  border: 0; border-radius: 4px; padding: 8px 16px; background: #4e5058; color: #fff;
  font-weight: 500; transition: background .15s;
}
.btn:hover { background: #6d6f78; }
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a12828; }
.btn.link { background: none; padding: 8px 4px; color: var(--text); }
.btn.link:hover { text-decoration: underline; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 4px;
  display: inline-grid; place-items: center; font-size: 18px; flex: none;
}
.icon-btn:hover { color: var(--text-strong); background: var(--bg-hover); }

label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #b5bac1; margin: 14px 0 0; }
label input, label textarea, label select, .field {
  display: block; width: 100%; margin-top: 8px; padding: 10px; border: 0; border-radius: 4px;
  background: var(--bg-0); color: var(--text); font-size: 15px; text-transform: none; letter-spacing: 0; font-weight: 400;
}
label input:focus, label textarea:focus, label select:focus, .field:focus { outline: 2px solid var(--accent); }
.error { color: #fa777c; font-size: 14px; min-height: 0; margin-top: 10px; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.hint:empty { display: none; }

/* ---------- 認証画面 ---------- */
.auth {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 10%, #3c45a5 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 90%, #2d7d6b 0%, transparent 55%), var(--bg-0);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--bg-2); border-radius: 12px; padding: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 26px; font-weight: 800; color: var(--text-strong); }
.auth-sub { text-align: center; color: var(--muted); margin: 6px 0 18px; }
.tabs { display: flex; background: var(--bg-0); border-radius: 6px; padding: 3px; gap: 3px; }
.tab { flex: 1; border: 0; background: none; padding: 8px; border-radius: 4px; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--bg-active); color: var(--text-strong); }
.auth-card .btn.block { margin-top: 20px; }

/* ---------- レイアウト ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.drawer-left { display: flex; flex: none; }
.guilds {
  width: 72px; background: var(--bg-0); padding: 12px 0; display: flex; flex-direction: column;
  align-items: center; gap: 8px; overflow-y: auto; scrollbar-width: none;
}
.guilds::-webkit-scrollbar { display: none; }
.guild-icon {
  position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; flex: none;
  background: var(--bg-2); color: var(--text-strong); font-weight: 600; font-size: 16px;
  display: grid; place-items: center; transition: border-radius .15s, background .15s;
}
.guild-icon:hover, .guild-icon.active { border-radius: 16px; background: var(--accent); }
.guild-icon.add { color: var(--ok); font-size: 24px; font-weight: 400; }
.guild-icon.add:hover { background: var(--ok); color: #fff; }
.guild-icon::before {
  content: ""; position: absolute; left: -16px; width: 8px; border-radius: 0 4px 4px 0; background: #fff;
  height: 0; transition: height .15s;
}
.guild-icon.unread::before { height: 8px; }
.guild-icon:hover::before { height: 20px; }
.guild-icon.active::before { height: 40px; }
.guild-sep { width: 32px; height: 2px; background: var(--bg-active); border-radius: 1px; flex: none; }

.sidebar { width: 240px; background: var(--bg-1); display: flex; flex-direction: column; min-height: 0; }
.guild-header {
  height: 48px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 4px; flex: none;
  border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-strong); box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.guild-header span { flex: 1; }
.channels { flex: 1; overflow-y: auto; padding: 12px 8px; }
.cat {
  display: flex; align-items: center; padding: 4px 4px 4px 8px; color: var(--muted);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
}
.cat span { flex: 1; }
.cat .icon-btn { width: 22px; height: 22px; font-size: 16px; }
.channel {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 1px 0; border-radius: 4px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.channel .hash { font-size: 20px; line-height: 1; opacity: .7; }
.channel .name { flex: 1; }
.channel:hover { background: var(--bg-hover); color: var(--text); }
.channel.active { background: var(--bg-active); color: var(--text-strong); }
.channel.unread { color: var(--text-strong); font-weight: 600; }
.channel .edit { visibility: hidden; width: 20px; height: 20px; font-size: 13px; }
.channel:hover .edit, .channel.active .edit { visibility: visible; }

/* ---------- ボイス ---------- */
.channel.voice.connected { color: var(--text-strong); }
.voice-users { padding: 0 0 4px 30px; }
.voice-user {
  display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 4px; color: var(--muted);
  font-size: 14px; cursor: pointer;
}
.voice-user:hover { background: var(--bg-hover); color: var(--text); }
.voice-user .name { flex: 1; }
.voice-user.speaking .avatar { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--ok); }
.voice-user.speaking .name { color: var(--text-strong); }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; transition: box-shadow .1s; }
.vstate { display: inline-grid; color: var(--muted); }
svg .slash { fill: var(--danger); }
#mute-btn.on, #deaf-btn.on { color: var(--danger); }
#mute-btn svg, #deaf-btn svg { overflow: visible; }
.voice-panel {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px;
  background: #232428; border-bottom: 1px solid var(--bg-1);
}
.vp-info { flex: 1; min-width: 0; }
.vp-status { font-weight: 700; font-size: 14px; }
.vp-status.ok { color: var(--ok); }
.vp-status.wait { color: #f0b232; }
.vp-status.bad { color: #fa777c; }
.icon-btn.hangup:hover { color: #fff; background: var(--danger); }
.range { flex: 1; accent-color: var(--accent); }
.sound-settings .row { align-items: center; margin-top: 8px; }
.sound-settings input[type=range] { display: inline-block; width: auto; margin: 0; padding: 0; background: none; }
label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; color: var(--text); }
label.check.disabled { opacity: .5; }
.input-settings .muted.small, .voice-settings label.check { margin-top: 10px; }
label.check input { display: inline-block; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.range-row { align-items: center; margin-top: 8px; }
.range-row input[type=range] { display: inline-block; width: auto; margin: 0; padding: 0; background: none; }
.range-val { min-width: 120px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.voice-settings .muted.small { margin: 6px 0 0; }
.vlimit {
  font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg-0); border-radius: 4px; padding: 1px 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 画面共有 ---------- */
.live-badge {
  flex: none; border: 0; border-radius: 4px; padding: 1px 6px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; line-height: 16px;
}
button.live-badge { cursor: pointer; }
button.live-badge:hover { filter: brightness(1.15); }
.icon-btn.vp-share.on, .icon-btn.vp-cam.on { color: #fff; background: var(--ok); }
#vp-open { cursor: pointer; border-radius: 4px; }
#vp-open:hover .muted { text-decoration: underline; }
.cam-badge { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); }
.cam-badge:hover { color: var(--text-strong); }

/* ---------- 通話画面 ---------- */
.call-view {
  position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; background: #111214;
}
.cv-grid {
  flex: 1; min-height: 0; overflow: auto; padding: 16px; display: grid; gap: 12px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
.cv-grid[data-count="1"] { grid-template-columns: minmax(0, 960px); justify-content: center; }
.cv-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-tile {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bg-1);
  display: grid; place-items: center; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .1s;
}
.call-tile.speaking { box-shadow: inset 0 0 0 3px var(--ok); }
.call-tile.speaking.has-video { box-shadow: 0 0 0 3px var(--ok); }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-tile video.mirror { transform: scaleX(-1); }
.tile-avatar { display: grid; place-items: center; }
.avatar.xl { width: 80px; height: 80px; font-size: 32px; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; font-weight: 600;
}
.tile-live { position: absolute; top: 8px; left: 8px; }
.tile-note { position: absolute; top: 8px; right: 8px; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .cv-grid[data-count="2"] { grid-template-columns: minmax(0, 1fr); }
  .cv-grid { padding: 8px; gap: 8px; }
}
.vp-viewers { color: var(--muted); font-weight: 400; }
.stream-view {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #000;
}
.sv-bar {
  flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 12px;
  background: rgba(30, 31, 34, .92); color: var(--text);
}
.sv-bar .spacer { flex: 1; }
.sv-info { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sv-vol { flex: none; width: 110px; }
.sv-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; cursor: pointer; }
.sv-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.sv-msg { position: absolute; color: var(--muted); font-size: 15px; pointer-events: none; text-align: center; padding: 16px; }
.sv-msg:empty { display: none; }
/* 小さく表示（他のチャンネルを見ながら視聴） */
.stream-view.mini {
  position: fixed; inset: auto 16px 84px auto; width: min(380px, calc(100vw - 32px)); aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); z-index: 40;
}
.stream-view.mini .sv-bar {
  position: absolute; inset: 0 0 auto 0; height: 38px; z-index: 1; opacity: 0; transition: opacity .15s;
}
.stream-view.mini:hover .sv-bar, .stream-view.mini:focus-within .sv-bar { opacity: 1; }
.stream-view.mini .sv-info, .stream-view.mini .sv-vol, .stream-view.mini #sv-full { display: none; }
.stream-view:fullscreen .sv-bar { position: absolute; inset: 0 0 auto 0; z-index: 1; opacity: 0; transition: opacity .2s; }
.stream-view:fullscreen:hover .sv-bar { opacity: 1; }
@media (max-width: 760px) {
  .sv-vol { width: 70px; }
  .stream-view.mini { bottom: 76px; }
}

.user-panel { height: 52px; flex: none; background: #232428; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.user-meta { flex: 1; min-width: 0; line-height: 1.2; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 14px; position: relative; background: var(--accent);
}
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar .dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--bg-1); background: #80848e;
}
.avatar .dot.on { background: var(--ok); }

/* ---------- チャット ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--bg-2); }
.chat-header {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.chat-header .hash { color: var(--muted); font-size: 22px; }
.divider-v { width: 1px; height: 24px; background: var(--bg-active); margin: 0 6px; flex: none; }
.topic { flex: 0 1 auto; font-size: 14px; }

.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; overflow-anchor: none; }
.msg-start { padding: 16px 16px 8px; }
.msg-start .big-hash {
  width: 68px; height: 68px; border-radius: 50%; background: var(--bg-active); display: grid; place-items: center;
  font-size: 40px; color: var(--text-strong);
}
.msg-start h2 { color: var(--text-strong); margin: 8px 0 4px; font-size: 28px; }
.msg-start p { margin: 0; color: var(--muted); }
.load-more { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }

.day-sep { display: flex; align-items: center; margin: 16px 16px 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--bg-active); }
.day-sep span { padding: 0 8px; }

.msg { position: relative; display: flex; gap: 16px; padding: 2px 48px 2px 16px; }
.msg.head { margin-top: 14px; padding-top: 4px; }
.msg:hover { background: rgba(2, 2, 2, .06); }
.msg.mentioned { background: var(--mention-bg); box-shadow: inset 2px 0 0 var(--mention-bar); }
.msg .gutter { width: 40px; flex: none; }
.msg .gutter .time { visibility: hidden; font-size: 11px; color: var(--muted); text-align: right; line-height: 22px; }
.msg:hover .gutter .time { visibility: visible; }
.msg .body { flex: 1; min-width: 0; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.msg .author { font-weight: 600; color: var(--text-strong); }
.msg .stamp { font-size: 12px; color: var(--muted); }
.msg .content { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.msg .content .edited { font-size: 11px; color: var(--muted); margin-left: 4px; }
.msg.pending .content { opacity: .55; }
.msg .content code {
  font-family: var(--mono); font-size: 13px; background: var(--bg-0); padding: 1px 4px; border-radius: 3px;
}
.msg .content pre {
  font-family: var(--mono); font-size: 13px; background: var(--bg-1); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 4px; margin: 4px 0; white-space: pre-wrap; max-width: 100%; overflow-x: auto;
}
.msg .content pre code { background: none; padding: 0; }
.msg .content blockquote { margin: 2px 0; padding-left: 10px; border-left: 4px solid #4e5058; }
.mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.spoiler.shown { background: rgba(255,255,255,.1); color: inherit; }

.attachment { margin-top: 4px; }
.attachment img, .attachment video {
  display: block; max-width: min(400px, 100%); max-height: 320px; border-radius: 6px; cursor: zoom-in; background: var(--bg-1);
}
.attachment audio { max-width: 100%; }
.file-card {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: 6px; max-width: 100%;
}
.file-card .icon { font-size: 26px; }

.msg-actions {
  position: absolute; right: 16px; top: -14px; display: none; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.msg:hover .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 30px; height: 30px; font-size: 15px; }
.msg-actions .icon-btn.danger:hover { color: var(--danger); }
.edit-box textarea {
  width: 100%; resize: none; border: 0; border-radius: 6px; background: var(--bg-3); padding: 10px; color: var(--text); min-height: 44px;
}
.edit-box .small a { cursor: pointer; }

.composer-wrap { flex: none; padding: 0 16px 20px; position: relative; }
.typing { height: 20px; font-size: 13px; color: var(--text); padding: 0 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.typing:empty::before { content: "\00a0"; }
.composer { display: flex; align-items: flex-end; background: var(--bg-3); border-radius: var(--radius); padding: 0 6px; }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none; padding: 11px 6px; max-height: 40vh; line-height: 1.4;
  min-height: 44px;
}
.composer .icon-btn { margin: 6px 0; }
.composer .attach { font-size: 22px; }
.attach-preview {
  display: flex; align-items: center; gap: 10px; background: var(--bg-3); border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 12px; border-bottom: 1px solid var(--bg-active);
}
.attach-preview + .composer { border-radius: 0 0 var(--radius) var(--radius); }
.attach-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.attach-preview .name { flex: 1; min-width: 0; }

.drop-overlay {
  position: absolute; inset: 12px; border: 3px dashed var(--accent); border-radius: 12px; background: rgba(30,31,34,.85);
  display: grid; place-items: center; font-size: 20px; font-weight: 600; color: var(--text-strong); pointer-events: none; z-index: 5;
}

.empty { position: absolute; inset: 48px 0 0; display: grid; place-items: center; background: var(--bg-2); z-index: 2; padding: 16px; }
.empty-card { text-align: center; max-width: 420px; }
.empty-card h2 { color: var(--text-strong); }
.empty-card .row { justify-content: center; margin-top: 16px; }

/* ---------- メンバー一覧 ---------- */
.members { width: 240px; flex: none; background: var(--bg-1); overflow-y: auto; padding: 16px 8px; }
.app.hide-members .members { display: none; }
.member-group { padding: 16px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.member-group:first-child { padding-top: 0; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; }
.member:hover { background: var(--bg-hover); }
.member.offline { opacity: .45; }
.member .name { flex: 1; min-width: 0; }
.member .crown { color: #f0b232; font-size: 13px; }
.member .kick { visibility: hidden; width: 22px; height: 22px; font-size: 13px; }
.member:hover .kick { visibility: visible; }
.member .avatar .dot { border-color: var(--bg-1); }

/* ---------- モーダル / トースト ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 50; padding: 16px;
  animation: fade .12s ease-out;
}
.modal {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); animation: pop .15s ease-out;
}
.modal header { padding: 20px 20px 0; }
.modal h3 { margin: 0; color: var(--text-strong); font-size: 20px; }
.modal .modal-body { padding: 4px 20px 20px; overflow-y: auto; }
.modal .modal-body > p { color: var(--muted); }
.modal footer { background: var(--bg-1); padding: 14px 20px; display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 8px 8px; }
.menu-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.menu-list button {
  text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 4px; color: var(--text);
}
.menu-list button:hover { background: var(--accent); color: #fff; }
.menu-list button.danger { color: #fa777c; }
.menu-list button.danger:hover { background: var(--danger); color: #fff; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row input { flex: 1; margin: 0; }
.invite-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--bg-active); font-size: 14px; }
.invite-item code { font-family: var(--mono); color: var(--text-strong); }
.invite-item span { flex: 1; }
.section-title { margin: 22px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: #b5bac1; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--bg-active); }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 60; display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111214; color: var(--text-strong);
  padding: 10px 16px; border-radius: 6px; z-index: 70; box-shadow: 0 4px 16px rgba(0,0,0,.4); max-width: calc(100% - 32px);
}
.toast.err { background: var(--danger); }
.conn-banner {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); background: #f0b232; color: #000;
  padding: 4px 14px; border-radius: 0 0 6px 6px; font-size: 13px; font-weight: 600; z-index: 40;
}
.backdrop { display: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.channels::-webkit-scrollbar, .members::-webkit-scrollbar { width: 8px; }
.channels::-webkit-scrollbar-thumb, .members::-webkit-scrollbar-thumb { border-width: 2px; }

.mobile-only { display: none; }

/* ---------- モバイル ---------- */
@media (max-width: 900px) {
  .members {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; transform: translateX(100%);
    transition: transform .2s; box-shadow: -4px 0 20px rgba(0,0,0,.4);
  }
  .app.show-members .members { transform: none; display: block; }
  .app.hide-members .members { display: block; }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  .drawer-left {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 20; transform: translateX(-100%);
    transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.4);
  }
  .app.show-left .drawer-left { transform: none; }
  .sidebar { width: min(260px, calc(100vw - 72px - 48px)); }
  .chat-header { padding-left: 4px; }
  .topic, .divider-v { display: none; }
  .msg { padding-right: 12px; gap: 12px; }
  .msg-actions { right: 8px; }
  .composer-wrap { padding: 0 8px calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .app.show-left .backdrop, .app.show-members .backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 15;
  }
}
