* { box-sizing: border-box; }
:root {
  --bg: #313338;
  --rail: #1e1f22;
  --side: #2b2d31;
  --card: #232428;
  --hover: #35373c;
  --active: #404249;
  --text: #f2f3f5;
  --dim: #949ba4;
  --accent: #5865f2;
  --green: #23a55a;
  --danger: #da373c;
  --border: #1f2023;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
button { font: inherit; cursor: pointer; border: 0; }
input, select {
  font: inherit;
  background: #1e1f22;
  color: var(--text);
  border: 1px solid #111214;
  border-radius: 6px;
  padding: 9px 10px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.hidden { display: none !important; }
.dim { color: var(--dim); font-size: 12px; }
.primary { background: var(--accent); color: #fff; border-radius: 6px; padding: 9px 14px; font-weight: 600; }
.primary:hover { background: #4752c4; }
.ghost { background: transparent; color: var(--dim); border-radius: 6px; padding: 6px 8px; }
.ghost:hover { background: var(--hover); color: var(--text); }
.danger { background: var(--danger); color: #fff; border-radius: 6px; padding: 9px 14px; font-weight: 600; }
.danger:hover { background: #a1282c; }
.small { font-size: 12px; padding: 4px 7px; }

.auth { height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #3a3d8f33, transparent), var(--bg); }
.authCard { width: 340px; background: var(--side); border-radius: 12px; padding: 24px; box-shadow: 0 20px 60px #0008; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.brand img { width: 40px; height: 40px; }
.subtle { color: var(--dim); font-size: 12px; margin: 4px 0 18px 50px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; background: var(--card); color: var(--dim); padding: 8px; border-radius: 6px; }
.tab.active { background: var(--hover); color: var(--text); font-weight: 600; }
#authForm { display: flex; flex-direction: column; gap: 10px; }
.error { color: #ff6b6b; font-size: 12px; min-height: 16px; }

.app { height: 100vh; display: grid; grid-template-columns: 72px 240px 1fr 220px; overflow: hidden; }
.rail { background: var(--rail); padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; overflow-y: auto; }
.serverIcons { display: flex; flex-direction: column; gap: 8px; }
.serverIcon { width: 48px; height: 48px; border-radius: 50%; background: var(--side); color: var(--text); font-weight: 700; transition: .15s; }
.serverIcon:hover, .serverIcon.active { border-radius: 16px; background: var(--accent); }
.railActions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.railBtn { width: 48px; height: 48px; border-radius: 50%; background: var(--side); color: var(--green); font-size: 22px; font-weight: 700; }
.railBtn:hover { border-radius: 16px; background: var(--green); color: #fff; }

.sidebar { background: var(--side); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.serverHead { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); font-weight: 700; }
.serverHead span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channels { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.groupLabel { color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .03em; margin: 12px 6px 4px; }
.channel { display: block; width: 100%; text-align: left; background: transparent; color: var(--dim); padding: 7px 8px; border-radius: 5px; margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel:hover { background: var(--hover); color: var(--text); }
.channel.active { background: var(--active); color: var(--text); }
.channel.connected::after { content: " •"; color: var(--green); font-weight: 700; }
.addChannel { margin: 4px 8px 8px; align-self: flex-start; }
.userbar { height: 56px; flex: none; background: var(--card); display: flex; align-items: center; gap: 6px; padding: 0 8px; border-top: 1px solid var(--border); }
.ubMe { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; cursor: pointer; border-radius: 6px; padding: 3px; }
.ubMe:hover { background: var(--hover); }
.ubAvatarWrap { width: 32px; height: 32px; flex: none; position: relative; }
.ubInfo { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
#meName { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ubStatus { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ubBtns { display: flex; gap: 2px; flex: none; }
.ubBtn { width: 32px; height: 32px; padding: 0; border-radius: 6px; background: transparent; color: #c8c9cf; font-size: 17px; line-height: 1; }
.ubBtn:hover { background: var(--hover); color: #fff; }
.ubBtn.active { background: #4a2222; color: #ff8b8b; }
.ubBtn.danger { background: var(--danger); color: #fff; }
.userAvatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chanHead { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.textPane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px 16px 8px; }
.msg { display: flex; gap: 10px; padding: 8px 4px; border-radius: 6px; }
.msg:hover { background: #2e3035; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.msgBody { min-width: 0; }
.msgHead { display: flex; align-items: baseline; gap: 8px; }
.msgUser { font-weight: 700; color: #fff; }
.msgTime { color: var(--dim); font-size: 11px; }
.msgText { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; line-height: 1.35; }
.msgForm { display: flex; gap: 8px; padding: 12px 16px 16px; }
.msgForm input { flex: 1; min-width: 0; }
.msgForm button { flex: 0 0 auto; }

.voicePane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.voiceTop { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.voiceTitle { font-size: 18px; font-weight: 800; }
.voiceCtrls { display: flex; gap: 8px; flex-wrap: wrap; }
.voiceGrid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 16px; overflow-y: auto; align-content: start; }
.vtile { background: var(--card); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.vtileMedia { aspect-ratio: 16/9; background: #111214; display: flex; align-items: center; justify-content: center; position: relative; }
.vtileMedia video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vtileAvatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.vtileName { padding: 8px 10px; font-size: 13px; color: #fff; background: #0006; }

.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modalCard { width: 380px; background: var(--side); border-radius: 10px; padding: 20px; box-shadow: 0 20px 60px #000a; }
.modalCard h3 { margin: 0 0 14px; }
.modalCard form { display: flex; flex-direction: column; gap: 10px; }
.modalActions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111214; color: #fff; border: 1px solid #333; padding: 10px 14px; border-radius: 8px; box-shadow: 0 10px 30px #000a; z-index: 60; max-width: 80vw; }


.googleBtn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-radius: 6px; padding: 10px; font-weight: 700; text-decoration: none; margin-bottom: 12px; }
.googleBtn:hover { background: #eee; }
.gicon { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); color: transparent; font-size: 0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 11px; margin-bottom: 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #3a3c42; }

.mobileOnly { display: none; }
.backdrop { display: none; }

.app, .auth { height: 100vh; height: 100dvh; }

@media (max-width: 760px) {
  html, body { -webkit-tap-highlight-color: transparent; }
  :root { --rail-w: 54px; }
  .app { grid-template-columns: var(--rail-w) 1fr; overflow-x: hidden; }
  .authCard { width: min(92vw, 380px); padding: 20px; }
  .rail { padding: 8px 5px; gap: 6px; }
  .serverIcon { width: 44px; height: 44px; font-size: 14px; }
  .railBtn { width: 44px; height: 44px; font-size: 20px; }

  .sidebar {
    position: fixed; left: var(--rail-w); top: 0; bottom: 0; width: min(78vw, 288px);
    transform: translateX(calc(-100% - var(--rail-w))); transition: transform .2s ease; z-index: 40;
    box-shadow: 8px 0 30px #0008;
  }
  .sidebar.open { transform: none; }
  .backdrop {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; left: var(--rail-w);
    background: #000a; z-index: 35;
  }
  .backdrop.hidden { display: none; }

  .mobileOnly { display: inline-flex; align-items: center; justify-content: center; }
  .voiceTitle { display: none; }
  #btnCloseSidebar { font-size: 22px; line-height: 1; padding: 2px 8px; }
  .chanHead { height: 52px; padding: 0 8px; gap: 6px; font-size: 15px; }
  #chanMeta { display: none; }
  .chanHead #chanName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .groupLabel { margin: 10px 6px 4px; }
  .channel { padding: 10px 8px; font-size: 15px; }
  .channel.connected::after { margin-left: 4px; }

  .messages { padding: 10px 8px 6px; }
  .msg { gap: 8px; padding: 7px 2px; }
  .avatar { width: 32px; height: 32px; font-size: 11px; }
  .msgHead { flex-wrap: wrap; gap: 4px 8px; }
  .msgText { font-size: 14px; }
  .msgForm { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .msgForm input { font-size: 16px; padding: 11px 10px; }
  .msgForm button { padding: 11px 12px; }
  input, select { font-size: 16px; }

  .worker, .voiceTop { padding: 12px 10px; }
  .voiceTop { align-items: flex-start; }
  .voiceCtrls { width: 100%; gap: 6px; }
  .voiceCtrls button { flex: 1 1 auto; min-height: 40px; padding: 9px 10px; font-size: 13px; }
  .voiceGrid { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
  .vtileName { font-size: 12px; padding: 7px 8px; }

  .modalCard { width: min(92vw, 380px); padding: 16px; }
  .toast { left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); transform: none; max-width: none; text-align: center; }
  .userbar { height: 52px; padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 380px) {
  :root { --rail-w: 50px; }
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .rail { padding: 6px 3px; }
  .serverIcon, .railBtn { width: 42px; height: 42px; }
  .msgForm button { padding: 11px 9px; font-size: 13px; }
}

.helpList { margin: 8px 0 10px 18px; padding: 0; line-height: 1.5; }
.helpList li { margin: 4px 0; }

.serverIcon { position: relative; }
.railDot { position: absolute; top: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--rail); }
.railDot.mention { background: var(--danger); }
.channel { display: flex; align-items: center; gap: 4px; }
.chanUnread { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.chanUnread.mention { background: var(--danger); }
.typing { min-height: 18px; padding: 0 16px; color: var(--dim); font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.volRow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); background: #0006; }
.volRow input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.volVal { width: 36px; text-align: right; font-size: 11px; color: var(--dim); }
@media (max-width: 760px) {
  .typing { padding: 0 8px; }
  .volRow { padding: 6px 8px; }
}

.avatarImg, .vtileAvatar.avatarImg, .profileAvatar.avatarImg { object-fit: cover; }
.userAvatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; cursor: pointer; }
#meName { cursor: pointer; }
.profTop { display: flex; justify-content: center; margin-bottom: 12px; }
.profileAvatar { width: 88px; height: 88px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; overflow: hidden; }
.profLabel { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.vtile.speaking { border-color: var(--green); box-shadow: 0 0 0 2px rgba(35,165,90,.85); }
.vtile.speaking .vtileAvatar { box-shadow: 0 0 0 3px var(--green); }
.vtile.speaking .vtileName { color: #8dff57; }

.members { background: var(--side); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.membersHead { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.memberList { overflow-y: auto; padding: 8px; }
.member { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.member:hover { background: var(--hover); }
.memberAvatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.memberInfo { min-width: 0; flex: 1; }
.memberName { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memberUser { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onlineDot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
.onlineDot.on { background: var(--green); }
.ownerCrown { font-size: 11px; }
.membersToggle { display: none; }
.modalMembers { max-height: 55vh; background: transparent; padding: 0; }
.mpName { font-weight: 800; font-size: 18px; }
.mpBio { margin: 8px 0; color: #d0d0d6; white-space: pre-wrap; }
@media (min-width: 761px) and (max-width: 1100px) { .app { grid-template-columns: 72px 240px 1fr; } }
@media (max-width: 1100px) { .members { display: none; } .membersToggle { display: inline-flex; } }

.shareBanner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #1d2b3a; border-bottom: 1px solid var(--border); color: #cfe6ff; font-size: 13px; }
.shareBanner span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liveBadge { margin-left: 6px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .03em; border-radius: 4px; padding: 1px 5px; flex: none; }

.voiceStage { display: flex; flex-direction: column; gap: 10px; width: 100%; height: 100%; min-height: 0; }
.stageMain { position: relative; flex: 1; min-height: 240px; background: #000; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.stageMain video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.stageBar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: linear-gradient(#000c, transparent); flex-wrap: nowrap; }
.stageName { flex: 1; min-width: 80px; font-weight: 700; font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stageBtn { background: #000a; color: #fff; border: 1px solid #ffffff33; border-radius: 6px; padding: 4px 7px; font-size: 11px; flex: none; white-space: nowrap; }
.stageBtn:hover { background: var(--accent); }
.stageThumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex: none; }
.stageThumb { position: relative; width: 160px; flex: none; border-radius: 8px; overflow: hidden; background: #111; border: 2px solid transparent; cursor: pointer; }
.stageThumb.active { border-color: var(--accent); }
.stageThumb video { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.stageThumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; color: #fff; background: #0008; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stageThumb.speaking { box-shadow: 0 0 0 2px var(--green); }
.expandBtn { position: absolute; top: 6px; right: 6px; z-index: 2; background: #000a; color: #fff; border: 1px solid #ffffff40; border-radius: 8px; padding: 4px 7px; font-size: 14px; line-height: 1; }
.expandBtn:hover { background: var(--accent); }
.stageMain:fullscreen { border-radius: 0; }
@media (max-width: 760px) {
  .stageThumb { width: 110px; }
  .stageMain { min-height: 200px; }
  .stageBtn { padding: 6px 8px; }
}

.channel .chIcon { flex: none; }
.channel .chName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel.hasPeople .chIcon { color: var(--green); }
.channel.active .chIcon { color: var(--text); }
.chanUnread { margin-left: 6px; }
.voiceTime { flex: none; margin-left: 6px; color: var(--green); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#voiceElapsed { color: var(--green); font-variant-numeric: tabular-nums; }
.voiceOccupants { padding: 1px 0 4px; }
.occupant { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 30px; border-radius: 6px; color: var(--dim); font-size: 12px; cursor: pointer; }
.occupant:hover { background: var(--hover); color: var(--text); }
.occAvatar { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #fff; flex: none; overflow: hidden; }
.occName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occIcons { flex: none; font-size: 10px; }
@media (max-width: 760px) {
  .occupant { padding-left: 24px; }
}

.voiceChip { position: fixed; right: 16px; bottom: 16px; z-index: 45; display: none; align-items: center; gap: 8px; background: #111214ee; border: 1px solid #2c2c34; border-radius: 10px; padding: 8px 10px; box-shadow: 0 10px 30px #000a; font-size: 12px; color: #fff; max-width: min(92vw, 440px); }
.voiceChip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .voiceChip { left: 64px; right: 10px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
  .voiceChip:not(.hidden) { display: flex; }
}

.voiceBar { background: var(--card); border-top: 1px solid var(--border); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.vbText { color: #cfd2d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbActions { display: flex; gap: 6px; }

.roleBadge { display: inline-flex; align-items: center; gap: 4px; background: #1c1c22; border: 1px solid #2e2e36; border-radius: 999px; padding: 1px 7px; font-size: 10px; color: #d7d7df; }
.roleDot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.memberRoles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.adminShield { font-size: 10px; }
.chLock { flex: none; font-size: 10px; color: var(--dim); margin-left: 4px; }
.settingsTabs { display: flex; gap: 6px; margin-bottom: 12px; }
.settingsTabs button { background: var(--card); color: var(--dim); border-radius: 6px; padding: 6px 10px; font-size: 12px; }
.settingsTabs button.active { background: var(--hover); color: #fff; font-weight: 600; }
.settingsList { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.settingRow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #1a1a20; border: 1px solid #26262e; border-radius: 8px; padding: 8px; }
.settingName { display: flex; align-items: center; gap: 6px; min-width: 110px; font-weight: 600; font-size: 13px; }
.roleCheck { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #c7c7cf; background: #22222a; border-radius: 999px; padding: 2px 7px; }
.roleCheck input { accent-color: var(--accent); }
.roleChecks { display: flex; flex-wrap: wrap; gap: 6px; max-height: 130px; overflow: auto; }

.settingRow input[type=color] { width: 36px; height: 30px; padding: 2px; border-radius: 8px; flex: none; }

.noiseCheck { align-self: center; gap: 6px; }

.videoWait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: #0009; color: #ddd; font-size: 12px; text-align: center; }


.audioCard { width: min(94vw, 780px); max-height: 88vh; background: var(--side); border-radius: 12px; box-shadow: 0 24px 80px #000b; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.audioHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.audioHead h3 { margin: 0; }
.audioHead .ghost { font-size: 22px; line-height: 1; padding: 0 6px; }
.audioBody { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 18px 20px 22px; overflow-y: auto; }
.audioCol { min-width: 0; }
.audioCol h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.aset { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12px; color: #d7d7df; }
.aset select { width: 100%; background: #111214; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.arow { display: flex; align-items: center; gap: 10px; }
.arow input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.asetVal { width: 42px; text-align: right; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.micBtns { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.audioMeter { position: relative; height: 12px; background: #111214; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 6px 0; }
.audioMeterBar { height: 100%; width: 0; background: linear-gradient(90deg, #23a55a, #f0b232 75%, #ed4245); transition: width .06s linear; }
.audioMeterMark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; left: 75%; box-shadow: 0 0 4px #000; }
.audioHint { color: var(--dim); font-size: 11px; line-height: 1.4; margin: 6px 0 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #1a1a20; border: 1px solid #26262e; border-radius: 8px; padding: 10px; margin-bottom: 10px; font-size: 13px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
@media (max-width: 700px) {
  .audioBody { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .audioCard { max-height: 92vh; }
}

.micBtns .ghost { background: #22222a; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); }
.micBtns .ghost:hover { background: var(--hover); }
.micBtns .danger { border-radius: 6px; padding: 8px 10px; }

.volLabel { width: 32px; flex: none; font-size: 10px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .02em; }
.volMute { width: 26px; height: 22px; flex: none; padding: 0; border-radius: 5px; background: #22222a; border: 1px solid var(--border); color: var(--text); font-size: 12px; line-height: 1; }
.volMute:hover { background: var(--hover); }
.volMute.muted { background: #4a2222; border-color: #7d3030; color: #ff8b8b; }
.stageAudio { display: flex; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: none; }
.stageAudio .volRow { flex: 1 1 190px; border-top: 0; }

.videoTap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; background: #000d; color: #fff; border: 1px solid #ffffff55; border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px #000a; }
.videoTap:hover { background: var(--accent); }

#voiceGrid video.imgAdjust { filter: url(#clipadoGamma) brightness(var(--videoBrightness, 1)); }
.imagePanel { position: absolute; left: 10px; bottom: 10px; z-index: 6; width: min(340px, calc(100% - 20px)); background: #111214ee; border: 1px solid #ffffff30; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 10px 30px #000a; }
.imageRow { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #d7d7df; }
.imageRow > span:first-child { width: 44px; flex: none; font-weight: 600; }
.imageRow input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.imageVal { width: 40px; flex: none; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.imageReset { align-self: flex-end; font-size: 11px; padding: 4px 8px; }

.viewerBadge { position: absolute; top: 6px; left: 6px; z-index: 4; background: #000b; color: #fff; border: 1px solid #ffffff40; border-radius: 999px; padding: 3px 8px; font-size: 11px; line-height: 1.2; cursor: pointer; }
.viewerBadge:hover { background: var(--accent); }
.viewerBadge.stageBadge { position: static; margin-left: 6px; flex: none; }
.viewerPanel { position: absolute; top: 52px; right: 10px; z-index: 6; max-width: min(320px, calc(100% - 20px)); background: #111214ee; border: 1px solid #ffffff30; border-radius: 10px; padding: 10px 12px; font-size: 12px; color: #d7d7df; box-shadow: 0 10px 30px #000a; }
.viewerPanelTitle { font-weight: 700; margin-bottom: 4px; }
.viewerPanelNames { color: #c7c7cf; line-height: 1.4; overflow-wrap: anywhere; }
.viewerList { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.viewerRow { display: flex; align-items: center; gap: 8px; }
.viewerRowInfo { min-width: 0; }
.viewerRowName { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.platformIcons { display: inline-flex; align-items: center; gap: 2px; margin-left: 5px; vertical-align: middle; opacity: .9; }
.platformIcon { font-size: 11px; line-height: 1; }

.voiceGrid.stageMode { display: flex; flex-direction: column; align-content: stretch; }
.voiceGrid.stageMode .voiceStage { flex: 1 1 auto; width: 100%; height: auto; min-height: 0; }
.stageBar { flex-wrap: wrap; row-gap: 4px; }
.stageName { flex: 1 1 120px; }

.soundGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.soundBtn { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #1a1a20; border: 1px solid #2a2a32; border-radius: 8px; padding: 9px 5px; color: #fff; font-size: 11px; cursor: pointer; min-width: 0; }
.soundBtn:hover { background: var(--hover); border-color: var(--accent); }
.soundEmoji { font-size: 22px; line-height: 1; }
.soundName { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soundPanel { position: absolute; top: 52px; left: 10px; z-index: 7; width: min(320px, calc(100% - 20px)); max-height: calc(100% - 70px); overflow-y: auto; background: #111214ee; border: 1px solid #ffffff30; border-radius: 10px; padding: 10px; box-shadow: 0 10px 30px #000a; }
.soundPanel .soundGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.vtile.sound { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.9); }
.vtile.sound .vtileAvatar { box-shadow: 0 0 0 3px #3b82f6; }
.vtile.sound .vtileName { color: #8bb8ff; }
.stageThumb.sound { border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }
.stageMain.sound { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.9); }

.voiceChatPanel { position: fixed; right: 16px; bottom: 16px; width: min(92vw, 360px); height: min(70vh, 520px); background: var(--side); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px #000b; z-index: 55; }
.voiceChatHead { height: 44px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); font-weight: 700; }
.voiceChatHead span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voiceChatHead .ghost { font-size: 20px; line-height: 1; padding: 0 5px; }
.voiceChatMessages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.voiceChatMsg { display: flex; gap: 8px; align-items: flex-start; }
.voiceChatMsg .memberAvatar { width: 28px; height: 28px; font-size: 9px; }
.voiceChatBody { min-width: 0; flex: 1; }
.voiceChatMeta { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.voiceChatName { font-size: 12px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voiceChatTime { font-size: 10px; color: var(--dim); flex: none; }
.voiceChatText { font-size: 13px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; color: #dcdee4; }
.voiceChatEmpty { color: var(--dim); font-size: 12px; text-align: center; padding: 20px 8px; }
.voiceChatForm { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); flex: none; }
.voiceChatForm input { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .voiceChatPanel { left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); width: auto; height: min(65vh, 480px); }
}

.chanChatBtn { font-size: 15px; line-height: 1; padding: 3px 7px; border-radius: 6px; flex: none; }

.channel { cursor: pointer; border: 0; font: inherit; }
.chChatBtn { width: 22px; height: 22px; flex: none; padding: 0; border-radius: 5px; background: transparent; color: var(--dim); font-size: 13px; line-height: 1; }
.chChatBtn:hover { background: var(--hover); color: #fff; }

.qualityLabel { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); white-space: nowrap; }
.qualityLabel select { background: #111214; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 6px; font-size: 11px; }

.gridTools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--dim); flex: none; }
.gridTools select { background: #111214; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.gridToolsLabel { font-weight: 700; color: #cfd0d6; }
.gridHint { font-size: 11px; }
.voiceGrid.fillGrid { display: grid; grid-template-columns: repeat(var(--grid-cols, 2), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); grid-auto-flow: dense; gap: 12px; padding: 16px; align-content: stretch; align-items: stretch; overflow-y: auto; }
.voiceGrid.fillGrid .vtile { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.voiceGrid.fillGrid .vtileMedia { flex: 1; aspect-ratio: auto; min-height: 0; }
.voiceGrid.fillGrid .vtileAvatar { width: clamp(56px, 32%, 170px); height: auto; aspect-ratio: 1; font-size: clamp(14px, 2vw, 24px); }
.voiceGrid.fillGrid .vtileName { flex: none; }
.voiceGrid.fillGrid .vtile { position: relative; }
.tileResize { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; z-index: 6; cursor: nwse-resize; touch-action: none; opacity: .55; background: linear-gradient(135deg, transparent 44%, #ffffffb0 45% 55%, transparent 56%), linear-gradient(135deg, transparent 62%, #ffffff70 63% 73%, transparent 74%); }
.tileResize:hover { opacity: 1; }
@media (max-width: 760px) {
  .gridTools { padding: 6px 8px; }
  .gridHint { display: none; }
}

.gridToggle { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--dim); }
.gridToggle input { accent-color: var(--accent); }
.voiceGrid.fillGrid.coverVideos .vtileMedia video { object-fit: cover; }
.voiceGrid.volumesHidden .vtile .volRow { display: none; }

.homePane { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.homeHero h2 { margin: 0 0 4px; font-size: 24px; }
.homeHero p { margin: 0 0 14px; }
.homeHero input { width: min(100%, 520px); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: #111214; color: var(--text); font-size: 14px; }
.discoverHead { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.discoverHead h3 { margin: 0; font-size: 15px; }
.discoverList { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.discoverCard { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.discoverAvatar { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px; flex: none; }
.discoverInfo { flex: 1; min-width: 0; }
.discoverName { display: flex; align-items: center; gap: 6px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discoverPublic { font-size: 9px; font-weight: 800; background: #1f6f4a; color: #b9ffd7; border-radius: 4px; padding: 1px 5px; flex: none; }
.discoverDesc { font-size: 11px; color: var(--dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discoverMeta { font-size: 10px; color: var(--dim); margin-top: 3px; }
.discoverJoin { flex: none; }
.discoverEmpty { grid-column: 1/-1; padding: 24px; text-align: center; color: var(--dim); font-size: 13px; }
@media (max-width: 760px) {
  .homePane { padding: 16px; }
  .discoverList { grid-template-columns: 1fr; }
}

.confirmText { color: var(--text); font-size: 13px; line-height: 1.55; margin-bottom: 16px; word-break: break-word; }

.settingField { display: flex; flex-direction: column; gap: 5px; background: #1a1a20; border: 1px solid #26262e; border-radius: 8px; padding: 9px; font-size: 12px; color: var(--dim); }
.settingField input, .settingField select { width: 100%; background: #111214; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 13px; }
.settingHint { font-size: 11px; color: var(--dim); line-height: 1.4; }

/* UI polish */
button { transition: background .15s, color .15s, border-radius .15s, transform .1s; }
button:active { transform: translateY(1px); }
input, select {
  border-radius: 10px;
  background: linear-gradient(180deg, #202127, #191a1e);
  border: 1px solid #363842;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 #ffffff08;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover { border-color: #474a56; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #5865f233; }
input::placeholder { color: #737780; }
.modalCard { border-radius: 16px; border: 1px solid #3a3c46; padding: 22px; }
.modalCard h3 { letter-spacing: -.01em; }
.modalCard form { gap: 13px; }
.modalActions { margin-top: 10px; }

.settingsList { gap: 13px; }
.settingField {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: #9aa0aa;
}
.settingField input, .settingField select {
  width: 100%;
  padding: 11px 12px;
  font-size: 13px;
  letter-spacing: normal;
  font-weight: 400;
  text-transform: none;
}
.settingHint { font-size: 11px; letter-spacing: normal; font-weight: 400; text-transform: none; }

.serverIcon { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.serverIconImg { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.serverHeadIcon { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px; overflow: hidden; background: #111214; }
.serverHeadIconImg { width: 100%; height: 100%; object-fit: cover; display: block; }
.serverHead #serverName { flex: 1; }
.discoverAvatar.avatarImg { object-fit: cover; border-radius: 12px; }

.serverIconEditor {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2b2d3a, #1d1e24 62%);
  border: 1px solid #3a3c48;
  box-shadow: inset 0 1px 0 #ffffff0d;
}
.serverIconPick {
  position: relative;
  width: 74px;
  height: 74px;
  flex: none;
  border-radius: 21px;
  overflow: hidden;
  background: #111214;
  border: 1px solid #4a4d5a;
  padding: 0;
}
.serverIconPick:hover { border-color: var(--accent); border-radius: 18px; }
.serverIconPreview { display: block; width: 100%; height: 100%; }
.serverIconPreviewInner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  overflow: hidden;
}
.serverIconPreviewInner.avatarImg { object-fit: cover; border-radius: 0; }
.serverIconCam {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 8px;
  background: #111214d9;
  border: 1px solid #ffffff1a;
}
.serverIconMeta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.serverIconMeta strong { font-size: 13px; }
.serverIconMeta > span { color: var(--dim); font-size: 11px; line-height: 1.35; }
.serverIconActions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.serverIconActions .secondary { background: #323541; color: #e8e9ee; border-radius: 9px; padding: 6px 10px; font-size: 11px; }
.serverIconActions .secondary:hover { background: #3c4050; }
.serverIconActions .ghost { border-radius: 9px; font-size: 11px; }
@media (max-width: 480px) {
  .serverIconEditor { align-items: flex-start; }
  .serverIconPick { width: 64px; height: 64px; border-radius: 18px; }
}
.settingField input, .settingField select {
  border-radius: 10px;
  background: linear-gradient(180deg, #202127, #191a1e);
  border: 1px solid #363842;
  box-shadow: inset 0 1px 0 #ffffff08;
}
.serverHead #serverHeadIcon { flex: 0 0 auto; width: 28px; height: 28px; }

/* Settings controls */
.secondary {
  background: #2a2d36;
  color: #e8e9ee;
  border: 1px solid #3b3e49;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
}
.secondary:hover { background: #343844; border-color: #4a4e5c; }
.secondary.small { border-radius: 9px; padding: 7px 11px; font-size: 11px; }
.settingsTabs {
  width: max-content;
  max-width: 100%;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: #17181d;
  border: 1px solid #262831;
  overflow-x: auto;
}
.settingsTabs button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  color: #959aa5;
  white-space: nowrap;
}
.settingsTabs button:hover { background: #23252d; color: #e3e5eb; }
.settingsTabs button.active {
  background: #303442;
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff12;
}
.settingRow {
  background: linear-gradient(180deg, #1b1c21, #18191e);
  border: 1px solid #2b2d35;
  border-radius: 12px;
  padding: 9px 10px;
  gap: 9px;
}
.settingName { font-size: 12.5px; }
.settingRow > .secondary.small { margin-left: auto; }
.roleCheck {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #c2c5ce;
  background: #1c1d23;
  border: 1px solid #30323b;
  border-radius: 999px;
  padding: 4px 9px;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.roleCheck:hover { background: #24262e; border-color: #454957; }
.roleCheck:has(input:checked) {
  background: #252940;
  border-color: #4d59b8;
  color: #fff;
}
input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  min-width: 17px;
  padding: 0;
  margin: 0;
  border-radius: 5px;
  border: 1px solid #4b4e5a;
  background: #15161a;
  box-shadow: none;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  vertical-align: middle;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
input[type=checkbox]::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .12s;
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
input[type=checkbox]:focus-visible { box-shadow: 0 0 0 3px #5865f24d; }
.roleCheck input { accent-color: var(--accent); }
