:root{
  --bg:#13151a; --panel:#1b1e26; --panel2:#22262f; --line:#2c313c;
  --text:#e8ebf0; --muted:#8b93a3; --accent:#5865f2; --green:#3ba55d;
  --danger:#ed4245; --gold:#f5a623;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0}
body{
  background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  font-size:14px;overflow:hidden;
}
.hidden{display:none!important}
button{font-family:inherit;cursor:pointer;border:none;outline:none}
input{font-family:inherit;outline:none}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-thumb{background:#3a3f4b;border-radius:4px}

/* ---------- 登录 ---------- */
.auth{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;
  background:radial-gradient(1000px 600px at 50% -10%,#2b3050,#13151a 70%)}
.auth-card{width:100%;max-width:380px;background:var(--panel);border:1px solid var(--line);
  border-radius:16px;padding:28px 24px;box-shadow:0 20px 60px rgba(0,0,0,.5)}
.auth-card .logo{font-size:40px;text-align:center;margin-bottom:8px}
.auth-card h1{font-size:20px;text-align:center;margin:0 0 6px}
.auth-card .sub{color:var(--muted);font-size:12.5px;text-align:center;margin:0 0 22px;line-height:1.6}
.auth-card label{display:block;font-size:12px;color:var(--muted);margin:14px 0 6px}
.auth-card input{width:100%;height:44px;background:var(--panel2);border:1px solid var(--line);
  border-radius:10px;color:var(--text);padding:0 14px;font-size:15px;letter-spacing:.5px}
.auth-card input:focus{border-color:var(--accent)}
.code-row{display:flex;gap:10px}
.code-row input{flex:1}
.code-row .ghost{white-space:nowrap;padding:0 14px;height:44px;border-radius:10px;background:var(--panel2);
  border:1px solid var(--line);color:var(--text);font-size:13px}
.code-row .ghost:disabled{opacity:.5}
.dev-code{margin-top:12px;padding:10px 12px;background:#2a3142;border:1px dashed #47507a;
  border-radius:8px;font-size:12.5px;color:#aab4ff;text-align:center}
.primary{width:100%;height:46px;margin-top:22px;border-radius:10px;background:var(--accent);
  color:#fff;font-size:15px;font-weight:600}
.primary:active{filter:brightness(.92)}
.err{color:var(--danger);font-size:12.5px;margin-top:12px;text-align:center;min-height:16px}

/* ---------- 主界面 ---------- */
.app{height:100%;display:flex}
.rail{width:72px;background:#0f1116;display:flex;flex-direction:column;align-items:center;
  padding:10px 0;gap:8px;flex-shrink:0}
.server-list{display:flex;flex-direction:column;gap:8px;overflow-y:auto;width:100%;align-items:center}
.srv{width:48px;height:48px;border-radius:14px;background:var(--panel2);display:flex;align-items:center;
  justify-content:center;font-size:18px;font-weight:700;color:var(--muted);border:2px solid transparent;
  flex-shrink:0;overflow:hidden}
.srv.active{border-color:var(--accent);color:#fff;background:var(--accent)}
.srv img{width:100%;height:100%;object-fit:cover}
.rail-actions{display:flex;flex-direction:column;gap:8px}
.rail-actions button{width:48px;height:44px;border-radius:12px;background:var(--panel2);
  color:var(--muted);font-size:18px}
.rail-actions button:hover{color:#fff}

.channels{width:240px;background:var(--panel);display:flex;flex-direction:column;flex-shrink:0;
  border-right:1px solid var(--line)}
.server-head{height:56px;display:flex;align-items:center;justify-content:space-between;
  padding:0 8px 0 16px;border-bottom:1px solid var(--line)}
.server-name{font-weight:600;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.icon-btn{background:transparent;color:var(--muted);font-size:16px;padding:6px 8px;border-radius:8px}
.icon-btn:hover{background:var(--panel2);color:#fff}
.channel-tree{flex:1;overflow-y:auto;padding:10px 8px}
.cat{margin-bottom:4px}
.cat-head{display:flex;align-items:center;gap:6px;padding:8px 8px 4px;font-size:11.5px;
  text-transform:uppercase;letter-spacing:.6px;color:var(--muted);font-weight:600}
.cat-head .add{opacity:0;transition:.15s;margin-left:auto;background:none;color:var(--muted);font-size:15px}
.cat-head:hover .add{opacity:1}
.chan{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:8px;color:#c2c8d4;
  font-size:13.5px;cursor:pointer;margin-bottom:1px}
.chan:hover{background:var(--panel2)}
.chan.active{background:#2b2f3d;color:#fff}
.chan .ico{width:16px;text-align:center;font-size:13px;opacity:.8}
.chan .limit{margin-left:auto;font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.chan.voice-active .limit{color:var(--green)}
.me-bar{height:62px;border-top:1px solid var(--line);display:flex;align-items:center;
  justify-content:space-between;padding:0 8px 0 12px;gap:8px}
.me{display:flex;align-items:center;gap:8px;min-width:0}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--panel2);display:flex;
  align-items:center;justify-content:center;font-size:14px;font-weight:700;color:#fff;overflow:hidden;flex-shrink:0}
.avatar img{width:100%;height:100%;object-fit:cover}
.me-name{font-size:13px;font-weight:600;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.me-role{font-size:11px;color:var(--muted)}
.me-actions{display:flex;gap:2px}

.content{flex:1;display:flex;flex-direction:column;min-width:0;position:relative}
.welcome{flex:1;display:flex;align-items:center;justify-content:center;padding:24px}
.welcome-inner{max-width:460px;text-align:center}
.welcome-inner h2{font-size:22px;margin:0 0 10px}
.welcome-inner p{color:var(--muted);line-height:1.7;margin:0 0 18px}
.welcome-inner .tips{text-align:left;color:var(--muted);font-size:13px;line-height:2;
  background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:14px 18px;list-style:none}
.content-head{height:56px;display:flex;align-items:center;gap:10px;padding:0 18px;
  border-bottom:1px solid var(--line);font-weight:600;font-size:15px;flex-shrink:0}
.badge{font-size:11.5px;font-weight:500;color:var(--muted);background:var(--panel2);padding:3px 9px;border-radius:20px}

/* 文字 */
.text-view{flex:1;display:flex;flex-direction:column;min-height:0}
.messages{flex:1;overflow-y:auto;padding:16px 18px;display:flex;flex-direction:column;gap:14px}
.msg{display:flex;gap:10px}
.msg .avatar{width:36px;height:36px;font-size:13px}
.msg-body{min-width:0}
.msg-top{display:flex;align-items:center;gap:8px;margin-bottom:3px}
.msg-top b{font-size:13.5px}
.msg-top time{font-size:11px;color:var(--muted)}
.msg-text{font-size:13.8px;line-height:1.6;color:#d5dae4;word-break:break-word}
.composer{display:flex;gap:10px;padding:12px 16px;border-top:1px solid var(--line);flex-shrink:0}
.composer input{flex:1;height:44px;background:var(--panel2);border:1px solid var(--line);
  border-radius:10px;color:var(--text);padding:0 14px;font-size:14px}
.composer button{height:44px;padding:0 20px;border-radius:10px;background:var(--accent);color:#fff;font-weight:600}

/* 语音 */
.voice-view{flex:1;display:flex;flex-direction:column;min-height:0}
.voice-body{flex:1;display:flex;flex-direction:column;padding:18px;min-height:0}
.voice-grid{flex:1;display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));
  gap:14px;align-content:start;overflow-y:auto}
.vp{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:16px 10px;
  display:flex;flex-direction:column;align-items:center;gap:9px;position:relative}
.vp .avatar{width:56px;height:56px;font-size:20px;border:2px solid transparent;transition:.15s}
.vp.speaking .avatar{border-color:var(--green);box-shadow:0 0 0 3px rgba(59,165,93,.25)}
.vp.muted .avatar{opacity:.5}
.vp .name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vp .tag{position:absolute;top:8px;right:8px;font-size:11px;color:var(--muted)}
.voice-actions{display:flex;gap:12px;justify-content:center;padding-top:16px;flex-shrink:0}
.voice-actions button{width:auto;height:44px;padding:0 22px;border-radius:10px;font-size:14px;font-weight:600;margin:0}
.voice-actions .primary{width:auto}
.voice-actions .ghost{background:var(--panel2);border:1px solid var(--line);color:var(--text)}
.voice-actions .danger{background:var(--danger);color:#fff}

/* 成员 */
.members{width:200px;background:var(--panel);border-left:1px solid var(--line);flex-shrink:0;
  display:flex;flex-direction:column}
.members-head{padding:16px 14px 10px;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.6px}
.member-list{flex:1;overflow-y:auto;padding:0 8px 16px}
.mrow{display:flex;align-items:center;gap:9px;padding:7px 8px;border-radius:8px}
.mrow .avatar{width:30px;height:30px;font-size:12px}
.mrow .nm{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mrow .rl{font-size:10.5px;font-weight:600}

/* 模态 */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;
  justify-content:center;padding:20px;z-index:100;backdrop-filter:blur(3px)}
.modal-card{width:100%;max-width:420px;background:var(--panel);border:1px solid var(--line);
  border-radius:14px;overflow:hidden;box-shadow:0 24px 70px rgba(0,0,0,.6)}
.modal-card header{display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;border-bottom:1px solid var(--line);font-weight:600}
.modal-body{padding:16px;max-height:60vh;overflow-y:auto}
.modal-body label{display:block;font-size:12px;color:var(--muted);margin:12px 0 6px}
.modal-body label:first-child{margin-top:0}
.modal-body input,.modal-body select{width:100%;height:42px;background:var(--panel2);
  border:1px solid var(--line);border-radius:9px;color:var(--text);padding:0 12px;font-size:14px}
.modal-body .row{display:flex;gap:10px}
.modal-body .hint{font-size:12px;color:var(--muted);margin-top:8px;line-height:1.6}
.modal-card footer{display:flex;justify-content:flex-end;gap:10px;padding:12px 16px;
  border-top:1px solid var(--line)}
.modal-card footer button{width:auto;height:40px;padding:0 20px;border-radius:9px;font-weight:600;margin:0}
.modal-card footer .ghost{background:var(--panel2);color:var(--text);border:1px solid var(--line)}

/* 手机适配 */
@media (max-width:900px){
  .members{display:none}
  .channels{width:200px}
}
@media (max-width:640px){
  .app{flex-direction:column}
  .rail{width:100%;height:auto;flex-direction:row;padding:8px 10px;overflow-x:auto}
  .server-list{flex-direction:row;width:auto}
  .rail-actions{flex-direction:row}
  .srv,.rail-actions button{width:42px;height:42px}
  .channels{width:100%;max-height:38vh;border-right:none;border-bottom:1px solid var(--line)}
  .me-bar{height:56px}
  .voice-actions{position:sticky;bottom:0}
}
