:root{--bg:#070708;--panel:#0d0d10;--panel2:#111116;--line:#23232a;--text:#f4f4f5;--muted:#8b8b95;--accent:#ff3f8e;--accent2:#9b5cff;--bubble:#17171d;--mine:#6e1641;--danger:#ff5577}*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 80% 10%,#241126 0,#09090b 35%,#050506 100%);color:var(--text);font:14px/1.4 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;height:100vh;overflow:hidden}button,input{font:inherit}.hidden{display:none!important}.shell{height:100vh;display:grid;grid-template-columns:76px 300px 1fr 270px;background:rgba(5,5,7,.78);backdrop-filter:blur(20px)}.rail{border-right:1px solid var(--line);padding:18px 12px;display:flex;flex-direction:column;gap:12px}.rail button,.iconbtn{border:0;background:transparent;color:#aaa;cursor:pointer}.rail button{width:52px;height:52px;border-radius:16px;font-size:20px}.rail button.active,.rail button:hover{background:#21101b;color:#ff5a9d;box-shadow:0 0 24px #ff3f8e18}.brand{height:70px;padding:18px 20px;font-weight:800;letter-spacing:.4px}.sidebar{border-right:1px solid var(--line);background:#0b0b0e}.search{margin:8px 16px 16px;background:#141419;border:1px solid #1f1f26;border-radius:14px;padding:11px 13px;color:#aaa}.conversation{margin:0 10px;padding:14px;border-radius:14px;background:linear-gradient(90deg,#1c1019,#121217);border:1px solid #2b1b27;cursor:pointer}.avatar{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,#26262d,#111);display:grid;place-items:center;color:#aaa}.row{display:flex;align-items:center;gap:12px}.status{width:9px;height:9px;background:#3cff87;border-radius:50%;display:inline-block;box-shadow:0 0 10px #3cff87}.muted{color:var(--muted)}.chat{min-width:0;display:flex;flex-direction:column}.chathead{height:78px;border-bottom:1px solid var(--line);padding:14px 20px;display:flex;justify-content:space-between;align-items:center;background:#0b0b0e}.headactions{display:flex;gap:8px}.iconbtn{width:42px;height:42px;border-radius:13px;background:#121217}.iconbtn:hover{background:#1b1b21;color:white}.messages{flex:1;overflow:auto;padding:28px clamp(16px,6vw,90px);display:flex;flex-direction:column;gap:9px;background:linear-gradient(180deg,#08080a,#09090c)}.day{align-self:center;color:#777;font-size:12px;background:#121217;border:1px solid #1d1d23;padding:6px 10px;border-radius:999px;margin:4px 0 12px}.bubble{max-width:min(70%,560px);padding:10px 13px;border-radius:17px;background:var(--bubble);border:1px solid #202027;position:relative;white-space:pre-wrap;word-break:break-word}.bubble.mine{align-self:flex-end;background:linear-gradient(135deg,#67153e,#45112e);border-color:#842052}.meta{font-size:10px;color:#999;margin-top:5px;text-align:right}.media{max-width:380px;border-radius:13px;display:block}.audio{display:flex;align-items:center;gap:10px;min-width:230px}.audio button{border:0;border-radius:50%;width:38px;height:38px;background:#ff3f8e;color:white;cursor:pointer}.wave{height:25px;flex:1;background:repeating-linear-gradient(90deg,#ff78ad 0 2px,transparent 2px 6px);opacity:.75;border-radius:4px}.composer{border-top:1px solid var(--line);padding:14px 18px;display:flex;gap:9px;background:#0a0a0d}.composer input{flex:1;border:1px solid #25252d;background:#131318;color:white;border-radius:16px;padding:12px 15px;outline:none}.send{border:0;width:46px;border-radius:15px;background:linear-gradient(135deg,#ff3f8e,#a94dff);color:white;cursor:pointer}.right{border-left:1px solid var(--line);background:#0a0a0d;padding:18px}.card{border:1px solid var(--line);background:#101014;border-radius:18px;padding:16px;margin-bottom:12px}.card h3{margin:0 0 10px}.kv{display:flex;justify-content:space-between;gap:12px;margin:8px 0;color:#aaa}.login{height:100vh;display:grid;place-items:center;padding:20px}.loginbox{width:min(420px,100%);background:#0d0d10;border:1px solid #24242b;border-radius:24px;padding:30px;box-shadow:0 30px 100px #000}.loginbox h1{margin-top:0}.loginbox input{width:100%;margin:7px 0;padding:13px;border-radius:13px;border:1px solid #27272e;background:#141419;color:white;outline:none}.primary{width:100%;border:0;padding:13px;border-radius:13px;background:linear-gradient(135deg,#ff3f8e,#9b5cff);color:white;font-weight:700;cursor:pointer;margin-top:10px}.drop{outline:2px dashed #ff3f8e;outline-offset:-8px}.context{position:fixed;background:#15151a;border:1px solid #303038;border-radius:12px;padding:6px;z-index:10;box-shadow:0 20px 50px #000}.context button{display:block;width:170px;text-align:left;background:transparent;border:0;color:white;padding:9px;border-radius:8px;cursor:pointer}.context button:hover{background:#25252c}@media(max-width:1050px){.shell{grid-template-columns:70px 250px 1fr}.right{display:none}}@media(max-width:720px){.shell{grid-template-columns:1fr}.rail,.sidebar{display:none}.messages{padding:20px 12px}.bubble{max-width:88%}}

/* MOBILE UI */
@media (max-width: 720px) {
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .shell {
    display: flex;
    width: 100%;
    height: 100dvh;
  }

  .chat {
    width: 100%;
    min-width: 0;
    height: 100dvh;
  }

  .chathead {
    height: 64px;
    min-height: 64px;
    padding: 10px 12px;
  }

  .chathead .avatar {
    width: 38px;
    height: 38px;
  }

  .headactions {
    gap: 4px;
  }

  .headactions .iconbtn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .messages {
    padding: 14px 10px 12px;
    gap: 7px;
    -webkit-overflow-scrolling: touch;
  }

  .bubble {
    max-width: 86%;
    padding: 9px 11px;
    border-radius: 15px;
    font-size: 14px;
  }

  .media {
    max-width: 100%;
    height: auto;
  }

  .composer {
    padding: 8px 9px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 6px;
    min-height: 60px;
  }

  .composer input {
    min-width: 0;
    height: 44px;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 16px;
  }

  .composer .iconbtn {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
  }

  .send {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .audio {
    min-width: 0;
    width: 100%;
  }

  .login {
    min-height: 100dvh;
    padding: 16px;
  }

  .loginbox {
    width: 100%;
    max-width: 400px;
    padding: 24px 20px;
    border-radius: 20px;
  }

  .loginbox input {
    font-size: 16px;
    height: 46px;
  }

  .primary {
    height: 46px;
  }
}

@media (max-width: 380px) {
  .chathead {
    padding-left: 9px;
    padding-right: 9px;
  }

  .headactions .iconbtn {
    width: 34px;
    height: 34px;
  }

  .messages {
    padding-left: 7px;
    padding-right: 7px;
  }

  .bubble {
    max-width: 90%;
  }

  .composer {
    gap: 4px;
  }

  .composer .iconbtn {
    flex-basis: 36px;
    width: 36px;
  }

  .send {
    flex-basis: 40px;
    width: 40px;
  }
}
