body:not(.authed) .app{display:none}
body{-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
::selection{background:#7a5bd0;color:#fff}

/* Login gate */
.gate{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:24px;overflow:hidden;
  background:
    radial-gradient(900px 600px at 15% 0%,rgba(122,91,208,.28),transparent 60%),
    radial-gradient(800px 700px at 100% 100%,rgba(88,101,242,.18),transparent 55%),
    linear-gradient(180deg,#16151b 0%,#111016 100%)}
.gate[hidden]{display:none}
body.authed #gate{display:none}
.gate:before{content:"";position:absolute;inset:0;pointer-events:none;opacity:.35;
  background-image:linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px);
  background-size:56px 56px;
  mask-image:radial-gradient(600px 400px at 50% 40%,#000 0%,transparent 75%)}
.gate-glow{position:absolute;width:520px;height:520px;border-radius:50%;filter:blur(120px);
  background:radial-gradient(circle,rgba(140,110,230,.45),transparent 65%);pointer-events:none;
  animation:gate-float 9s ease-in-out infinite}
.gate-card{position:relative;display:grid;grid-template-columns:280px minmax(0,1fr);width:min(820px,100%);
  border:1px solid #34333f;border-radius:24px;overflow:hidden;
  background:linear-gradient(180deg,#232129 0%,#1b1a21 100%);
  box-shadow:0 40px 120px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,255,255,.05);
  animation:gate-in .5s cubic-bezier(.2,.8,.25,1)}
.gate-art{position:relative;min-height:340px;background:#191820;display:grid;place-items:center;padding:18px}
.gate-art:after{content:"";position:absolute;inset:0;box-shadow:inset -60px 0 80px -40px #1b1a21}
.gate-art img{width:100%;height:100%;object-fit:contain;display:block}
.gate-body{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;
  padding:46px 44px;text-align:left}
.gate-eyebrow{margin:0;font-size:11px;font-weight:800;letter-spacing:3px;color:#a68af5}
.gate-body h1{margin:10px 0 0;font-size:30px;letter-spacing:-.6px;color:#f3f1fa}
.gate-message{margin:14px 0 26px;color:#a9abb8;font-size:14px;line-height:1.6;max-width:38ch}
.gate-message.denied{color:#ff9b9b}
.gate-button{display:inline-flex;align-items:center;justify-content:center;gap:11px;width:100%;
  padding:14px 22px;border-radius:12px;background:linear-gradient(180deg,#6771f5,#5865f2);color:#fff;
  font-weight:700;font-size:15px;box-shadow:0 12px 30px rgba(88,101,242,.35),inset 0 1px 0 rgba(255,255,255,.18);
  transition:transform .16s ease,box-shadow .16s ease,filter .16s ease}
.gate-button:hover{transform:translateY(-2px);filter:brightness(1.06);box-shadow:0 18px 40px rgba(88,101,242,.45),inset 0 1px 0 rgba(255,255,255,.2)}
.gate-button:active{transform:translateY(0)}
.gate-button img{display:block}
.gate-note{margin:22px 0 0;font-size:11px;line-height:1.6;color:#757785}
@keyframes gate-in{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:none}}
@keyframes gate-float{0%,100%{transform:translate3d(-20px,-10px,0)}50%{transform:translate3d(30px,20px,0)}}

/* Brand image */
.brand-icon{width:32px;height:32px;flex-shrink:0;display:grid;place-items:center;overflow:hidden;border-radius:8px;background:#2c2a35}
.brand-icon img{width:100%;height:100%;object-fit:contain;display:block;border-radius:inherit}
.home-server{background:#2c233b}
.home-server img{width:44px;height:44px;max-width:100%;max-height:100%;object-fit:contain}
.brand-text{display:flex;flex-direction:column;min-width:0;line-height:1.2}
.brand-text strong,.brand-text small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-text strong{font-size:12px;font-weight:750;letter-spacing:1px}
.brand-text small{margin:2px 0 0;font-size:8px;font-weight:400;letter-spacing:.8px;color:#797484}

/* Account panel (bottom-left) */
.account{position:relative;margin-top:8px;padding-top:8px;border-top:1px solid #34343d}
.account-button{display:flex;align-items:center;gap:9px;width:100%;padding:8px 6px;border:0;border-radius:8px;
  background:none;text-align:left;transition:background .12s}
.account-button:hover,.account-button[aria-expanded="true"]{background:#2b2c34}
.account-avatar{width:32px;height:32px;flex-shrink:0;border-radius:50%;overflow:hidden;display:grid;
  place-items:center;background:#5865f2;box-shadow:0 0 0 1px rgba(255,255,255,.08)}
.account-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.account-text{min-width:0;flex:1}
.account-text strong{display:block;font-size:11px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-text small{display:block;margin-top:2px;font-size:9px;color:#9b9da9}
.account-chevron{flex-shrink:0;color:#8b8d99;font-size:10px;transition:transform .15s}
.account-button[aria-expanded="true"] .account-chevron{transform:rotate(180deg)}
.account-menu{position:absolute;left:0;right:0;bottom:calc(100% + 8px);z-index:30;padding:8px;
  border:1px solid #3a3b46;border-radius:10px;background:#1b1c22;
  box-shadow:0 18px 46px rgba(0,0,0,.65),inset 0 1px 0 rgba(255,255,255,.05);
  animation:account-in .14s ease}
.account-menu-head{display:flex;align-items:center;gap:8px;margin:0 0 6px;padding:5px 7px 10px;
  border-bottom:1px solid #33343d}
.account-menu-head img{width:22px;height:22px;border-radius:50%;object-fit:cover;flex-shrink:0}
.account-menu-head>span{min-width:0}
.account-menu-head span span{display:block;font-size:9px;color:#8f909c}
.account-menu-head strong{display:block;margin-top:2px;font-size:11px;color:#e7e5ee;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-logout{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:7px;background:none;
  font-size:12px;color:#e7c9c9;transition:background .12s,color .12s}
.account-logout:before{content:"⏻";font-size:13px;line-height:1}
.account-logout:hover{background:#3a2a2e;color:#ffe0e0}
@keyframes account-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}

@media (max-width:900px){
  .brand-text small{display:none}
}
@media (max-width:720px){
  .gate-card{grid-template-columns:1fr}
  .gate-art{min-height:190px;max-height:210px}
  .gate-art:after{box-shadow:inset 0 -60px 80px -40px #1b1a21}
  .gate-body{padding:32px 26px 34px}
  .gate-body h1{font-size:25px}
  .account-avatar{width:28px;height:28px}
  .account-button{padding:7px 4px;gap:7px}
  .account-text strong{font-size:10px}
  .account-text small{font-size:8px}
  .brand-icon{width:26px;height:26px}
  .brand-text strong{font-size:10px;letter-spacing:.6px}
}

@media (prefers-reduced-motion:reduce){
  .gate-card,.gate-glow,.account-menu{animation:none}
}

/* Workspace polish */
.sidebar{background:linear-gradient(180deg,#212229,#1d1e24)}
.server-rail{background:linear-gradient(180deg,#17181d,#141419)}
.topbar{background:linear-gradient(180deg,rgba(38,40,48,.96),rgba(38,40,48,.78));backdrop-filter:blur(10px)}
.channel{border-radius:8px;transition:background .12s,color .12s}
.channel:hover{background:#2f3039}
.channel.active{background:#33323d}
.message{padding:4px 10px;border-radius:10px;transition:background .12s}
.message:hover{background:rgba(255,255,255,.02)}
.composer textarea:focus{border-color:#6d5bd0;box-shadow:0 0 0 3px rgba(122,91,208,.15)}
#send{background:linear-gradient(180deg,#8f74e6,#7a5bd0);border-radius:9px;font-weight:600}
#send:hover:not(:disabled){filter:brightness(1.08)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#3a3b46;border-radius:10px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-track{background:transparent}
