:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #15181e;
  --panel-2: #1b1f27;
  --panel-3: #222731;
  --line: #2b313d;
  --text: #f2f4f8;
  --muted: #9da6b5;
  --faint: #6f7888;
  --accent: #7c8cff;
  --accent-strong: #6376ff;
  --green: #4dd4a0;
  --danger: #ff657a;
  --warning: #f1bd63;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.join-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 16%, rgba(124, 140, 255, .16), transparent 28%),
    radial-gradient(circle at 84% 82%, rgba(77, 212, 160, .08), transparent 25%),
    var(--bg);
}

.join-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(21, 24, 30, .94);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), #9b76ff);
  color: white;
  font-weight: 900;
  letter-spacing: -.05em;
  box-shadow: 0 8px 22px rgba(99, 118, 255, .25);
}
.brand-mark.large { width: 56px; height: 56px; border-radius: 18px; font-size: 24px; }
.eyebrow { margin: 20px 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.join-card h1 { margin: 0; font-size: clamp(32px, 6vw, 46px); letter-spacing: -.04em; }
.join-copy { margin: 10px 0 24px; color: var(--muted); line-height: 1.55; }
.join-card form { display: grid; gap: 16px; }
.join-card label { display: grid; gap: 8px; color: #c8cfda; font-size: 13px; font-weight: 700; }
.join-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0e1014;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}
.join-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 140, 255, .12); }
.room-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-note { margin-top: 18px; color: var(--faint); font-size: 12px; text-align: center; }
.inline-error { min-height: 18px; margin-top: 8px; color: var(--danger); font-size: 12px; }

.primary-button, .send-button {
  border: 0;
  border-radius: 12px;
  background: var(--accent-strong);
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.primary-button:hover, .send-button:hover { background: #7181ff; }
.primary-button:active, .send-button:active { transform: translateY(1px); }
.primary-button { padding: 12px 16px; }
.primary-button.wide { width: 100%; margin-top: 4px; }
.icon-button, .text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-button { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.icon-button:hover { background: var(--panel-3); color: var(--text); }
.icon-button.secondary { background: var(--panel-3); border: 1px solid var(--line); }
.text-button { font-size: 12px; }
.text-button:hover { color: var(--text); }
.mobile-only { display: none; }

.app-shell {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 66px 238px minmax(0, 1fr) 218px;
  background: var(--bg);
  overflow: hidden;
}

.server-rail {
  background: #0c0e11;
  border-right: 1px solid #171a20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}
.rail-divider { width: 30px; height: 1px; background: var(--line); margin: 2px 0; }
.rail-spacer { flex: 1; }
.server-pill {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}
.server-pill.active { background: rgba(124, 140, 255, .16); color: #b8c0ff; }
.server-pill.danger:hover { background: rgba(255, 101, 122, .14); color: var(--danger); }

.channel-panel {
  min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.room-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.room-header > div { min-width: 0; display: grid; gap: 2px; }
.room-header strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.muted-label, .nav-section-label { color: var(--faint); font-size: 10px; font-weight: 900; letter-spacing: .11em; }
.channel-nav { padding: 14px 10px; }
.nav-section-label { margin: 10px 8px 6px; }
.channel-item {
  width: 100%;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.channel-item.active { background: var(--panel-3); color: var(--text); }
.channel-item.active-subtle { color: #c4cad4; }
.plugin-panel { margin: 2px 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.plugin-heading { display: flex; justify-content: space-between; margin: 0 8px 10px; color: var(--faint); font-size: 10px; font-weight: 900; letter-spacing: .11em; }
.plugin-badge { color: var(--green); letter-spacing: .05em; }
.self-strip {
  margin-top: auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: #101319;
  border-top: 1px solid var(--line);
}
.self-meta { min-width: 0; flex: 1; display: grid; }
.self-meta strong, .self-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.self-meta strong { font-size: 13px; }
.self-meta span { color: var(--faint); font-size: 11px; }

.main-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: 64px minmax(220px, 42vh) minmax(0, 1fr); background: #11141a; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 20, 26, .96);
}
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-title > div { display: grid; gap: 2px; }
.topbar-title span:not(.voice-dot) { color: var(--faint); font-size: 11px; }
.voice-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(77, 212, 160, .10); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.count-pill, .status-chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; font-size: 11px; }
.count-pill { padding: 6px 10px; }

.voice-stage { min-height: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); overflow: auto; }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-content: start; }
.app-shell.has-video .main-stage { grid-template-rows: 64px minmax(320px, 58vh) minmax(0, 1fr); }
.voice-grid.video-layout { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; align-items: start; }
.voice-grid.video-layout[data-participant-count="1"] { grid-template-columns: minmax(0, min(960px, 100%)); justify-content: center; }
.voice-grid.video-layout .voice-card { aspect-ratio: 16 / 9; min-height: 0; height: auto; }
.voice-card {
  position: relative;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(155deg, #1c2028, #16191f);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}
.voice-card.speaking { border-color: rgba(77, 212, 160, .75); box-shadow: inset 0 0 0 1px rgba(77, 212, 160, .18); }
.participant-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #090b0e; opacity: 0; pointer-events: none; transition: opacity .14s ease; }
.voice-grid.video-layout .participant-video { object-fit: contain; background: #090b0e; }
.voice-card.video-active .participant-video { opacity: 1; }
.voice-card.video-active { cursor: zoom-in; }
.voice-card.video-active:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-card.video-active .avatar { opacity: 0; }
.voice-card.video-active .voice-name, .voice-card.video-active .voice-sub { position: relative; z-index: 2; align-self: flex-start; margin-left: 10px; padding: 2px 6px; border-radius: 7px; background: rgba(8,10,13,.72); backdrop-filter: blur(5px); }
.voice-card.video-active .voice-name { margin-top: auto; color: white; }
.voice-card.video-active .voice-sub { margin-bottom: 10px; color: #d4dae5; }
.voice-card.video-active .voice-volume { z-index: 3; left: auto; right: 10px; top: 10px; bottom: auto; width: min(190px, 44%); opacity: 0; background: rgba(8,10,13,.72); padding: 5px 7px; border-radius: 9px; backdrop-filter: blur(5px); }
.voice-card.video-active:hover .voice-volume, .voice-card.video-active:focus-within .voice-volume { opacity: 1; }
.voice-card .avatar { width: 54px; height: 54px; font-size: 18px; }
.voice-name { max-width: 86%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 800; }
.voice-sub { color: var(--faint); font-size: 10px; }
.voice-volume { position: absolute; left: 12px; right: 12px; bottom: 9px; display: flex; align-items: center; gap: 7px; opacity: 0; transition: opacity .12s ease; }
.voice-card:hover .voice-volume { opacity: 1; }
.voice-volume input { width: 100%; accent-color: var(--accent); }
.voice-volume span { color: var(--faint); font-size: 10px; }
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #303746, #242a34);
  border: 1px solid #3a4353;
  color: #e7ebf4;
  font-weight: 900;
}
.avatar.compact { width: 34px; height: 34px; font-size: 12px; flex: 0 0 auto; }
.avatar.self { background: linear-gradient(145deg, rgba(124,140,255,.32), rgba(99,118,255,.15)); border-color: rgba(124,140,255,.5); }

.chat-stage { min-height: 0; display: grid; grid-template-rows: 42px minmax(0, 1fr) auto auto auto; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid rgba(43,49,61,.7); }
.chat-header > div { display: flex; align-items: baseline; gap: 9px; }
.chat-header strong { font-size: 13px; }
.chat-header span { color: var(--faint); font-size: 10px; }
.message-list { min-height: 0; overflow-y: auto; padding: 12px 16px 18px; }
.message-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 7px 2px; }
.message-row:hover { background: rgba(255,255,255,.015); }
.message-body { min-width: 0; }
.message-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.message-meta strong { font-size: 12px; }
.message-meta time { color: var(--faint); font-size: 9px; }
.message-text { color: #d7dce5; font-size: 13px; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.system-message { color: var(--faint); font-size: 11px; padding: 5px 44px; }
.file-card {
  margin-top: 7px;
  max-width: 430px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  overflow: hidden;
}
.file-preview { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #0b0d10; }
.file-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; }
.file-info > div { min-width: 0; display: grid; }
.file-info strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info span { color: var(--faint); font-size: 9px; }
.file-download { color: #b9c2ff; font-size: 11px; text-decoration: none; }
.composer { margin: 0 14px 14px; min-height: 46px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: end; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 13px; padding: 5px; }
.attach-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); cursor: pointer; font-size: 18px; }
.attach-button:hover { background: var(--panel-3); color: var(--text); }
.composer textarea { resize: none; max-height: 120px; min-height: 36px; border: 0; outline: none; background: transparent; color: var(--text); padding: 8px 6px 7px; line-height: 1.35; }
.send-button { height: 36px; padding: 0 14px; font-size: 12px; }
.transfer-status { margin: 0 14px 8px; color: var(--muted); font-size: 10px; }

.member-panel { min-width: 0; background: var(--panel); border-left: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; }
.member-panel header { display: flex; justify-content: space-between; align-items: center; color: var(--faint); font-size: 10px; font-weight: 900; letter-spacing: .1em; padding: 5px 6px 10px; }
.member-row { display: flex; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 10px; }
.member-row:hover { background: var(--panel-2); }
.member-row > div:last-child { min-width: 0; display: grid; }
.member-row strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.member-row span { color: var(--faint); font-size: 9px; }
.privacy-card { margin-top: 16px; padding: 12px; border: 1px solid var(--line); background: #11141a; border-radius: 12px; display: grid; gap: 5px; }
.privacy-card strong { font-size: 11px; }
.privacy-card span { color: var(--faint); font-size: 10px; line-height: 1.45; }

.voice-controls {
  justify-self: end;
  display: flex; align-items: center; gap: 6px;
  margin: 0 14px 8px;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(14, 16, 20, .92);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}
.control-button { min-width: 76px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 8px 10px; cursor: pointer; display: flex; align-items: center; gap: 7px; font-size: 11px; }
.control-button:hover { background: var(--panel-3); color: var(--text); }
.control-button.active { background: rgba(255,101,122,.12); color: var(--danger); }
.control-button.video-on { background: rgba(77,212,160,.12); color: var(--green); }
.control-button:disabled { opacity: .45; cursor: default; }
.control-icon { font-size: 15px; }
.control-separator { width: 1px; height: 24px; background: var(--line); }
.status-chip { padding: 7px 9px; display: flex; align-items: center; gap: 6px; }
.status-light { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.status-light.warn { background: var(--warning); }
.status-light.bad { background: var(--danger); }

.video-focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 10, .88);
  backdrop-filter: blur(12px);
}
.video-focus-shell {
  width: min(1200px, 96vw);
  max-height: 94dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #090b0e;
  box-shadow: var(--shadow);
}
.video-focus-topbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; background: #11141a; border-bottom: 1px solid var(--line); }
.video-focus-topbar strong { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.video-focus-close { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--panel-3); color: var(--text); font-size: 22px; cursor: pointer; }
.video-focus-video { width: 100%; height: min(76dvh, calc(96vw * 9 / 16)); min-height: 240px; object-fit: contain; background: #050608; }
.video-focus-hint { padding: 8px 12px; color: var(--faint); background: #11141a; font-size: 10px; text-align: center; border-top: 1px solid var(--line); }

.music-widget { border: 1px solid var(--line); background: #11141a; border-radius: 12px; padding: 10px; }
.music-top { display: flex; align-items: center; gap: 8px; }
.music-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(124,140,255,.12); color: #b9c2ff; }
.music-title { min-width: 0; flex: 1; display: grid; }
.music-title strong { font-size: 11px; }
.music-title span { color: var(--faint); font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.music-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.music-actions button, .music-file-label { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; min-height: 30px; font-size: 10px; cursor: pointer; display: grid; place-items: center; }
.music-actions button:hover, .music-file-label:hover { color: var(--text); background: var(--panel-3); }
.music-range { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 6px; margin-top: 9px; color: var(--faint); font-size: 9px; }
.music-range input { width: 100%; accent-color: var(--accent); }
.music-hint { margin-top: 8px; color: var(--faint); font-size: 9px; line-height: 1.4; }


.member-backdrop { display: none; }

.settings-dialog {
  width: min(620px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}
.settings-dialog::backdrop { background: rgba(0,0,0,.68); }
.settings-dialog form { padding: 18px; max-height: min(88vh, 820px); overflow-y: auto; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.dialog-title > div { min-width: 0; display: grid; gap: 3px; }
.dialog-title > div span { color: var(--faint); font-size: 10px; }
.settings-note { min-height: 0; margin-bottom: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #11141a; font-size: 10px; line-height: 1.45; }
.settings-note:empty { display: none; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-field { min-width: 0; display: grid; gap: 6px; color: #c8cfda; font-size: 11px; font-weight: 700; }
.settings-field.full { grid-column: 1 / -1; }
.settings-field select { width: 100%; min-width: 0; border: 1px solid var(--line); background: #0e1014; color: var(--text); border-radius: 10px; padding: 10px; outline: none; }
.settings-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.toggle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.toggle-grid label { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 9px; border: 1px solid var(--line); background: #11141a; border-radius: 10px; color: var(--muted); font-size: 10px; }
.toggle-grid input { accent-color: var(--accent); }
.mic-test { margin-top: 14px; }
.mic-test > div:first-child { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.meter-track { height: 8px; overflow: hidden; border-radius: 999px; background: #0c0e12; border: 1px solid var(--line); }
.meter-fill { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--accent)); transition: width .08s linear; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.settings-status { min-height: 16px; color: var(--muted); font-size: 10px; }
.output-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.compact-action { min-width: 64px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.settings-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.settings-section-title strong { font-size: 11px; }
.settings-section-title span, .settings-subnote { color: var(--faint); font-size: 9px; line-height: 1.45; }
.route-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.route-button, .hotkey-key { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #11141a; color: var(--muted); cursor: pointer; font-size: 10px; }
.route-button:hover, .hotkey-key:hover { background: var(--panel-3); color: var(--text); }
.route-button.active { border-color: rgba(124,140,255,.62); background: rgba(124,140,255,.12); color: #cdd2ff; }
.hotkey-grid { display: grid; gap: 7px; }
.hotkey-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(120px, auto) 44px; align-items: center; gap: 7px; }
.hotkey-row > span { color: var(--muted); font-size: 10px; }
.hotkey-key { padding: 0 9px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.hotkey-key.recording { border-color: var(--warning); color: var(--warning); }
#hotkeyStatus, #routeHint { margin-top: 7px; min-height: 13px; }

.mobile-plugin-dock { display: none; }
.mobile-music-panel, .mobile-music-backdrop { display: none; }


.help-dialog { width: min(500px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); padding: 0; box-shadow: var(--shadow); }
.help-dialog::backdrop { background: rgba(0,0,0,.66); }
.help-dialog form { padding: 18px; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.help-dialog p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.help-dialog code { color: #c5ccff; }
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 9px 12px; border: 1px solid var(--line); background: #171b22; border-radius: 10px; box-shadow: var(--shadow); color: #e8ebf2; font-size: 11px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2a303a; border: 2px solid transparent; background-clip: padding-box; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 60px 220px minmax(0, 1fr); }
  .member-panel { position: fixed; right: 0; top: 64px; bottom: 0; width: 230px; z-index: 12; box-shadow: -18px 0 40px rgba(0,0,0,.24); }
  .member-panel.closed { display: none; }
}

@media (max-width: 760px) {
  .video-focus-overlay { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .video-focus-shell { width: 100%; max-height: 96dvh; border-radius: 14px; }
  .video-focus-video { height: min(72dvh, calc(100vw * 16 / 9)); min-height: 220px; }
  .video-focus-hint { display: none; }

  html, body { width: 100%; height: 100%; overflow: hidden; }
  .app-shell {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    grid-template-columns: 48px minmax(0, 1fr);
    overflow: hidden;
  }
  .channel-panel { display: none; }
  .server-rail {
    position: relative;
    top: auto;
    width: 48px;
    height: 100dvh;
    padding: 10px 0;
    gap: 8px;
  }
  .server-rail .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .server-pill { width: 36px; height: 36px; border-radius: 12px; }
  .rail-divider { width: 26px; }

  .main-stage {
    grid-column: 2;
    width: 100%;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    grid-template-rows: 56px minmax(145px, 27dvh) 46px minmax(0, 1fr);
  }
  .topbar { min-width: 0; padding: 0 10px 0 12px; }
  .topbar-title { min-width: 0; gap: 8px; }
  .topbar-title > div { min-width: 0; }
  .topbar-title strong,
  .topbar-title span:not(.voice-dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title span:not(.voice-dot) { max-width: 150px; }
  .topbar-actions { flex: 0 0 auto; gap: 5px; }
  .count-pill { padding: 5px 8px; }
  .mobile-only { display: grid; }
  .mobile-plugin-dock {
    display: block;
    min-width: 0;
    padding: 5px 8px 4px;
    border-bottom: 1px solid var(--line);
    background: #11141a;
  }
  .mobile-plugin-button {
    width: 100%; height: 36px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 7px;
    border: 1px solid var(--line); border-radius: 10px; background: #151921; color: var(--text); padding: 3px 8px; text-align: left; cursor: pointer;
  }
  .mobile-plugin-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(124,140,255,.12); color: #c2c9ff; }
  .mobile-plugin-copy { min-width: 0; display: grid; gap: 1px; }
  .mobile-plugin-copy strong { font-size: 10px; }
  .mobile-plugin-copy small { color: var(--faint); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-plugin-open { color: #c0c7ff; font-size: 9px; font-weight: 800; }

  .voice-stage { min-width: 0; padding: 8px; overflow: auto; }
  .voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .app-shell.has-video .main-stage { grid-template-rows: 56px minmax(230px, 44dvh) 46px minmax(0, 1fr); }
  .voice-grid.video-layout { grid-template-columns: 1fr; gap: 8px; }
  .voice-grid.video-layout .voice-card { width: 100%; aspect-ratio: 16 / 9; min-height: 0; }
  .voice-card { min-width: 0; min-height: 108px; border-radius: 12px; gap: 6px; }
  .voice-card.video-active { min-height: 0; }
  .voice-card.video-active .voice-name, .voice-card.video-active .voice-sub { margin-left: 6px; }
  .voice-card.video-active .voice-sub { margin-bottom: 5px; }
  .voice-card .avatar { width: 44px; height: 44px; font-size: 15px; }
  .voice-name { font-size: 11px; }
  .voice-sub { max-width: 90%; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .voice-volume { left: 8px; right: 8px; bottom: 7px; }
  .voice-card.video-active .voice-volume { left: auto; right: 7px; top: 7px; bottom: auto; width: min(150px, 48%); }

  .chat-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    grid-template-rows: 40px minmax(0, 1fr) auto auto auto;
  }
  .chat-header { min-width: 0; padding: 0 10px; }
  .chat-header span { display: none; }
  .chat-header .text-button { font-size: 10px; }
  .message-list { min-width: 0; min-height: 0; padding: 8px 10px 92px; overflow-y: auto; }
  .message-row { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
  .message-row .avatar { width: 30px; height: 30px; font-size: 10px; }
  .system-message { padding: 5px 38px; }
  .file-card { max-width: 100%; }
  .transfer-status { margin: 0 8px 6px; }
  .composer {
    margin: 0 8px calc(8px + env(safe-area-inset-bottom));
    min-width: 0;
    min-height: 44px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 4px;
    padding: 4px;
  }
  .attach-button { width: 34px; height: 34px; }
  .composer textarea { min-width: 0; min-height: 34px; padding: 7px 4px 6px; }
  .send-button { height: 34px; padding: 0 11px; }

  .mobile-music-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0,0,0,.46);
  }
  .mobile-music-backdrop.hidden { display: none; }
  .mobile-music-panel {
    display: block;
    position: fixed;
    left: 58px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 26;
    max-height: min(72dvh, 520px);
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(21,24,30,.98);
    box-shadow: var(--shadow);
    transform: translateY(0);
    opacity: 1;
    transition: transform .16s ease, opacity .16s ease, visibility .16s ease;
    visibility: visible;
  }
  .mobile-music-panel.closed { transform: translateY(18px); opacity: 0; visibility: hidden; pointer-events: none; }
  .mobile-music-panel > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .mobile-music-panel > header > div { display: grid; gap: 2px; }
  .mobile-music-panel > header span { color: var(--faint); font-size: 9px; font-weight: 900; letter-spacing: .1em; }
  .mobile-music-panel > header strong { font-size: 12px; }
  .mobile-music-panel .music-widget { background: #101319; }
  .mobile-music-panel .music-actions button, .mobile-music-panel .music-file-label { min-height: 38px; font-size: 11px; }

  .member-panel {
    display: block;
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: min(82vw, 290px);
    min-width: 0;
    z-index: 24;
    box-shadow: -18px 0 40px rgba(0,0,0,.42);
    transform: translateX(0);
    transition: transform .16s ease, visibility .16s ease;
    visibility: visible;
    pointer-events: auto;
  }
  .member-panel.closed {
    display: block;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
  }

  .voice-controls {
    justify-self: end;
    margin: 0 8px 6px;
    gap: 4px;
    padding: 5px;
    border-radius: 13px;
  }
  .control-button { min-width: 58px; padding: 7px 7px; gap: 5px; font-size: 9px; }
  .camera-switch { min-width: 36px; width: 36px; padding: 7px; }
  .camera-switch > span:last-child { display: none; }
  .control-button > span:last-child { display: inline; }
  .control-icon { font-size: 13px; }
  .control-separator, .status-chip { display: none; }

  .member-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 23;
    background: rgba(0,0,0,.42);
  }
  .member-backdrop.hidden { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .route-grid { grid-template-columns: 1fr; }
  .hotkey-row { grid-template-columns: 1fr minmax(118px, auto) 42px; }
  .settings-section-title { align-items: flex-start; flex-direction: column; gap: 2px; }
  .settings-dialog { width: calc(100% - 16px); }
  .settings-field.full { grid-column: 1; }
  .toggle-grid { grid-template-columns: 1fr; }
  .settings-dialog form { padding: 14px; }

  .toast { top: 10px; max-width: calc(100vw - 28px); text-align: center; }
}
