:root {
  --bg: #060a13;
  --panel: rgba(17, 24, 39, .72);
  --panel-solid: #111827;
  --raised: rgba(255, 255, 255, .06);
  --raised-2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .08);
  --text: #eef2f7;
  --muted: #8b98ab;
  --acc: #2ee6a6;
  --acc-2: #7c5cff;
  --acc-3: #38bdf8;
  --danger: #ff5d73;
  --gold: #ffd279;
  --grad: linear-gradient(135deg, #2ee6a6 0%, #38bdf8 50%, #7c5cff 100%);
  --mine: linear-gradient(135deg, #0ea37a 0%, #0f8aa6 100%);
  --spring: cubic-bezier(.2, .9, .3, 1.25);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(46, 230, 166, .35); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }

/* Aurora background: three soft blobs drifting forever */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .32;
  will-change: transform; }
.aurora span:nth-child(1) { background: #2ee6a6; top: -25vmax; left: -15vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { background: #7c5cff; bottom: -30vmax; right: -20vmax; animation: drift-b 32s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { background: #38bdf8; top: 30%; left: 35%; width: 40vmax; height: 40vmax; opacity: .18;
  animation: drift-c 22s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(18vmax, 14vmax) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-16vmax, -12vmax) scale(.9); } }
@keyframes drift-c { 0% { transform: translate(-10vmax, -6vmax) scale(.8); } 100% { transform: translate(12vmax, 10vmax) scale(1.2); } }

.join, .chat { position: relative; z-index: 1; }

/* Join */
.join { min-height: 100%; height: 100dvh; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.join-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 28px;
  padding: 36px 26px 28px; text-align: center; display: flex; flex-direction: column; gap: 14px;
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  animation: rise .8s var(--spring) both; }
.join-card > * { animation: rise .7s var(--ease) both; }
.join-card > :nth-child(2) { animation-delay: .08s; }
.join-card > :nth-child(3) { animation-delay: .14s; }
.join-card > :nth-child(4) { animation-delay: .2s; }
.join-card > :nth-child(5), .join-card > :nth-child(6) { animation-delay: .26s; }
.join-card > :nth-child(7) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.logo { width: 92px; height: 92px; margin: 0 auto 4px; border-radius: 30px; display: grid; place-items: center;
  font-size: 52px; position: relative; background: rgba(255,255,255,.05); }
.logo::before { content: ""; position: absolute; inset: -2px; border-radius: 32px; padding: 2px; background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin-hue 6s linear infinite; }
.logo::after { content: ""; position: absolute; inset: 0; border-radius: 30px; box-shadow: 0 0 0 0 rgba(46,230,166,.45);
  animation: ring 2.6s ease-out infinite; }
.logo span { display: block; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes ring { 70%, 100% { box-shadow: 0 0 0 22px rgba(46,230,166,0); } }
@keyframes spin-hue { to { filter: hue-rotate(360deg); } }
.join-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; background: var(--grad); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: rise .7s var(--ease) .08s both, sheen 6s linear infinite; }
@keyframes sheen { to { background-position: 200% 0; } }
.join-card p { color: var(--muted); font-size: 14px; }
.join-card input { padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,.05); color: var(--text); font: inherit; font-size: 16px; outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s; }
.join-card input:focus { border-color: rgba(46,230,166,.6); background: rgba(255,255,255,.08); box-shadow: 0 0 0 4px rgba(46,230,166,.15); }
.join-card p.join-error { color: var(--danger); animation: shake-x .4s; }
@keyframes shake-x { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.join-card button, .primary-btn { position: relative; overflow: hidden; padding: 15px; border: 0; border-radius: 14px;
  background: var(--grad); background-size: 160% 100%; color: #04130e; font-weight: 800; font-size: 16px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(46,230,166,.25); transition: transform .25s var(--spring), box-shadow .25s, background-position .6s; }
.join-card button::after, .primary-btn::after { content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transition: transform .7s var(--ease); }
.join-card button:hover, .primary-btn:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 14px 36px rgba(56,189,248,.3); }
.join-card button:hover::after, .primary-btn:hover::after { transform: translateX(120%); }
.join-card button:active, .primary-btn:active { transform: scale(.97); }
.join-card button:disabled, .primary-btn:disabled { opacity: .7; cursor: default; }
.primary-btn.loading { color: transparent; }
.primary-btn.loading::before { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px;
  border-radius: 50%; border: 2.5px solid #04130e; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.chat { height: 100%; height: 100dvh; display: flex; flex-direction: column; max-width: 960px; margin: 0 auto;
  background: rgba(6, 10, 19, .55); border-inline: 1px solid var(--line); animation: fade .5s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; position: relative; z-index: 2;
  background: var(--panel); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--raised-2); display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0; background-size: cover !important; background-position: center !important;
  transition: transform .3s var(--spring), box-shadow .3s; user-select: none; }
.avatar.person { color: #07121d; font-weight: 800; font-size: 17px; }
.avatar.person.emoji { font-size: 22px; }
.avatar.has-photo { color: transparent; }
#chat-avatar { animation: pop .5s var(--spring); }
.title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.title strong { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.title span { font-size: 12.5px; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--acc); cursor: pointer; font-size: 13.5px; font-weight: 600;
  padding: 7px 10px; border-radius: 10px; transition: background .2s, transform .2s var(--spring); white-space: nowrap; }
.link-btn:hover { background: var(--raised); }
.link-btn:active { transform: scale(.94); }
.link-btn.danger { color: var(--danger); }
.me-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.me-btn::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: conic-gradient(from 0deg, #2ee6a6, #38bdf8, #7c5cff, #ff7eb6, #2ee6a6);
  animation: spin 5s linear infinite; }
.me-btn .avatar { position: relative; width: 36px; height: 36px; font-size: 15px; box-shadow: 0 0 0 2px var(--panel-solid); }
.me-btn .avatar.emoji { font-size: 19px; }
.me-btn:hover .avatar { transform: scale(1.08); }
.me-btn:active .avatar { transform: scale(.92); }
.notice { align-self: center; background: rgba(255, 210, 121, .1); border: 1px solid rgba(255, 210, 121, .2); color: var(--gold);
  font-size: 12.5px; padding: 6px 14px; border-radius: 999px; margin: 10px 0; text-align: center; animation: drop .45s var(--spring); }
.notice.system { background: var(--raised); border-color: var(--line); color: var(--muted); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px) scale(.9); } }

.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 5%; display: flex; flex-direction: column; gap: 3px;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); background-size: 24px 24px; }
.day { align-self: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; margin: 12px 0;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 1; }
.msg { max-width: min(75%, 540px); padding: 8px 12px 9px; border-radius: var(--radius); background: rgba(30, 41, 59, .82);
  border: 1px solid var(--line); align-self: flex-start; position: relative; word-wrap: break-word; white-space: pre-wrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); transform-origin: left bottom;
  transition: transform .25s var(--spring), box-shadow .25s; }
.msg.theirs { margin-left: 40px; }
.msg.mine { align-self: flex-end; background: var(--mine); border-color: rgba(255,255,255,.1); transform-origin: right bottom;
  box-shadow: 0 6px 18px rgba(14, 163, 122, .22); }
.msg.first { margin-top: 10px; }
.msg.first:not(.mine) { border-top-left-radius: 6px; }
.msg.first.mine { border-top-right-radius: 6px; }
.msg:hover { transform: translateY(-1px); }
.msg.new { animation: msg-in .5s var(--spring) backwards; }
.msg.new.mine { animation-name: msg-in-mine; }
@keyframes msg-in { from { opacity: 0; transform: translate(-14px, 12px) scale(.9); } }
@keyframes msg-in-mine { from { opacity: 0; transform: translate(14px, 12px) scale(.9); } }
.msg .msg-av { position: absolute; left: -40px; top: -1px; width: 32px; height: 32px; font-size: 13px;
  animation: pop .45s var(--spring) both; }
.msg .msg-av.emoji { font-size: 17px; }
.msg .who { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.msg .text { font-size: 14.5px; line-height: 1.4; }
.msg .time { float: right; font-size: 10.5px; color: rgba(238,242,247,.55); margin: 7px 0 -4px 12px; font-variant-numeric: tabular-nums; }
.msg.pending { opacity: .65; }
.msg.pending .time { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.empty { margin: auto; color: var(--muted); text-align: center; font-size: 14px; animation: rise .6s var(--ease); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; position: relative; z-index: 2;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 22px; padding: 12px 18px;
  background: rgba(255,255,255,.05); color: var(--text); font: inherit; font-size: 15px; max-height: 140px; outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s; }
.composer textarea:focus { border-color: rgba(46,230,166,.5); background: rgba(255,255,255,.07); box-shadow: 0 0 0 4px rgba(46,230,166,.12); }
.composer textarea::placeholder { color: var(--muted); }
.composer button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--grad); background-size: 160% 100%;
  color: #04130e; display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(46,230,166,.28); transition: transform .3s var(--spring), background-position .5s, box-shadow .3s; }
.composer button:hover { transform: scale(1.08) rotate(-8deg); background-position: 100% 0; }
.composer button:active { transform: scale(.9); }
.composer button:disabled { opacity: .5; cursor: default; }

/* View-once photos */
.composer .attach { background: var(--raised); color: var(--muted); position: relative; box-shadow: none; }
.composer .attach:hover { color: var(--text); background: var(--raised-2); transform: scale(1.06); }
.once-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 10px; font-weight: 700; line-height: 1; }
.attach .once-badge { position: absolute; right: 5px; bottom: 6px; background: var(--panel-solid); }
.once-badge.big { width: 22px; height: 22px; font-size: 12px; color: var(--acc); }

.msg .photo-once { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0;
  color: var(--acc-3); font: inherit; font-size: 14.5px; font-weight: 600; padding: 2px 0; cursor: pointer; }
.msg .photo-once .once-badge { width: 22px; height: 22px; font-size: 11px; }
.msg .photo-once:not(:disabled) .once-badge { animation: ring-blue 2s ease-out infinite; }
@keyframes ring-blue { 0% { box-shadow: 0 0 0 0 rgba(56,189,248,.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(56,189,248,0); } }
.msg .photo-once:disabled { color: var(--muted); cursor: default; }
.msg.mine .photo-once { color: #d1fae5; }

.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; animation: fade .3s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.viewer-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(17,24,39,.9); }
#viewer-from { flex: 1; font-weight: 700; }
.viewer-timer { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.viewer-stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; }
.viewer-stage canvas { max-width: 100%; max-height: 100%; pointer-events: none; visibility: hidden; }
.viewer.revealed .viewer-stage canvas { visibility: visible; }
.viewer-shield { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; text-align: center; color: var(--text); cursor: pointer;
  background: radial-gradient(circle, #1a2436 0%, #000 70%); }
.viewer-shield div { font-size: 48px; animation: bob 2.4s ease-in-out infinite; }
.viewer-shield small { color: var(--muted); }
.viewer.revealed .viewer-shield { background: transparent; }
.viewer.revealed .viewer-shield > * { display: none; }
@media print { body { display: none !important; } }

/* Moderation */
.link-btn.admin { color: var(--gold); }
.banned-bar { background: rgba(255, 93, 115, .12); border-top: 1px solid rgba(255, 93, 115, .25); color: var(--danger);
  text-align: center; font-size: 14px; padding: 12px; position: relative; z-index: 2; animation: drop .4s var(--spring); }
.chat.banned .composer { display: none; }
.msg.comic .text, .msg.comic .who { font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive; }
.msg .explode-btn { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-solid); font-size: 12px; cursor: pointer; opacity: 0;
  display: grid; place-items: center; transition: opacity .2s, transform .25s var(--spring); }
.msg:hover .explode-btn, .msg .explode-btn:focus-visible { opacity: .9; }
@media (hover: none) { .msg .explode-btn { opacity: .75; } }
.msg.mine .explode-btn { right: auto; left: -8px; }
.msg .explode-btn:hover { opacity: 1; transform: scale(1.2) rotate(12deg); }
.msg.exploding { animation: explode .7s ease-out forwards; pointer-events: none; }
.msg.exploding::after { content: "💥"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 48px; animation: boom .7s ease-out forwards; }
@keyframes explode {
  0% { transform: scale(1); filter: none; }
  25% { transform: scale(1.15) rotate(-3deg); background: #ff7a00; }
  100% { transform: scale(1.8) rotate(8deg); opacity: 0; filter: blur(6px); }
}
@keyframes boom { 0% { transform: scale(.2); } 40% { transform: scale(1.6); } 100% { transform: scale(2.4); opacity: 0; } }

/* Troll effects */
body.troll-shake .chat { animation: shake .12s linear infinite; }
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-6px, 3px) rotate(-1deg); }
  50% { transform: translate(5px, -4px) rotate(1deg); } 75% { transform: translate(-3px, -2px) rotate(-.5deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
body.troll-flip .chat { transform: rotate(180deg); transition: transform .6s; }
body.troll-rainbow .chat { animation: rainbow 1.2s linear infinite; }
@keyframes rainbow { from { filter: hue-rotate(0deg) saturate(3); } to { filter: hue-rotate(360deg) saturate(3); } }

.popup { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 24px; }
.popup-card { width: 100%; max-width: 340px; background: #f0f0f0; color: #111; border-radius: 10px; padding: 22px;
  text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.5); font-family: Tahoma, Verdana, sans-serif; }
.popup-icon { font-size: 40px; }
.popup-card p { margin: 10px 0 16px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.popup-card button { padding: 8px 28px; border: 1px solid #888; border-radius: 4px; background: #e1e1e1; cursor: pointer; }

/* Overlays: admin panel, drawers, profile editor */
.admin-panel, .modal { position: fixed; inset: 0; z-index: 40; background: rgba(3,6,12,.6); display: grid; place-items: center;
  padding: 16px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .3s var(--ease); }
.admin-card, .modal-card { width: 100%; max-width: 480px; max-height: 100%; overflow-y: auto; background: rgba(17,24,39,.92);
  border: 1px solid var(--line); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55); animation: zoom .5s var(--spring); }
@keyframes zoom { from { opacity: 0; transform: translateY(20px) scale(.94); } }
.admin-card header, .modal-card header { display: flex; justify-content: space-between; align-items: center; font-size: 17px; font-weight: 700; }
.admin-card header { color: var(--gold); }
.admin-hint { font-size: 13px; color: var(--muted); }
.admin-hint code { background: var(--raised); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.admin-block { background: var(--raised); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  display: flex; flex-direction: column; gap: 9px; animation: rise .5s var(--ease) both; }
.admin-card > :nth-child(3), .drawer-card > :nth-child(3) { animation-delay: .04s; }
.admin-card > :nth-child(4), .drawer-card > :nth-child(4) { animation-delay: .08s; }
.admin-card > :nth-child(5) { animation-delay: .12s; }
.admin-card > :nth-child(6) { animation-delay: .16s; }
.admin-block h3 { font-size: 14px; font-weight: 700; }
.admin-block .row { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-block input:not([type="checkbox"]) { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
.admin-block input:focus { border-color: rgba(46,230,166,.55); box-shadow: 0 0 0 3px rgba(46,230,166,.12); }
.admin-block button { padding: 10px 15px; border: 0; border-radius: 12px; background: var(--grad); background-size: 160% 100%; color: #04130e;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .25s var(--spring), background-position .5s; }
.admin-block button:hover { transform: translateY(-1px); background-position: 100% 0; }
.admin-block button:active { transform: scale(.95); }
.admin-block button.danger { background: var(--danger); color: #fff; }
.admin-block .check { font-size: 13px; color: #b6c2d2; display: flex; gap: 6px; align-items: center; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: rgba(255, 93, 115, .14); color: #ffb3bf; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px;
  display: flex; align-items: center; gap: 4px; animation: pop .35s var(--spring); }
.chips li button { background: none; color: inherit; padding: 0 4px; font-size: 14px; }
.chips .none { background: none; color: var(--muted); padding: 0; animation: none; }
.admin-status { font-size: 13px; color: var(--acc); min-height: 1em; }
.admin-status.error { color: var(--danger); animation: shake-x .4s; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Private chats and groups */
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none;
  color: #b6c2d2; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .2s, transform .25s var(--spring); }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.unread-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--acc);
  animation: ring 1.8s ease-out infinite; }
button.title { background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 0; cursor: default; }
button.title.clickable { cursor: pointer; }
.title strong, .title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat.in-conv .link-btn.admin, .chat.in-conv #clear-chat { display: none; }

.drawer { position: fixed; inset: 0; z-index: 30; background: rgba(3,6,12,.55); display: flex;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .3s var(--ease); }
.drawer-card { width: 100%; max-width: 400px; height: 100%; overflow-y: auto; background: rgba(17,24,39,.94);
  border-right: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 20px 0 60px rgba(0,0,0,.5); animation: slide-in .5s var(--spring); }
@keyframes slide-in { from { transform: translateX(-60px); opacity: 0; } }
.drawer-card header { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 800; }
.drawer-actions { display: flex; gap: 8px; }
.drawer-actions button { flex: 1; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised);
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .25s var(--ease); }
.drawer-actions button:hover, .drawer-actions button.active { border-color: rgba(46,230,166,.5); color: var(--acc);
  background: rgba(46,230,166,.08); transform: translateY(-1px); }
.chips.members li { background: rgba(46,230,166,.12); color: #b7f0cf; }

.chat-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-list li { animation: rise .45s var(--ease) both; }
.chat-list li:nth-child(2) { animation-delay: .03s; } .chat-list li:nth-child(3) { animation-delay: .06s; }
.chat-list li:nth-child(4) { animation-delay: .09s; } .chat-list li:nth-child(5) { animation-delay: .12s; }
.chat-list li:nth-child(6) { animation-delay: .15s; } .chat-list li:nth-child(n+7) { animation-delay: .18s; }
.chat-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0;
  border-radius: 14px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background .2s, transform .25s var(--spring); }
.chat-list button:hover { background: var(--raised); transform: translateX(3px); }
.chat-list button:hover .avatar { transform: scale(1.06); }
.chat-list li.current button { background: rgba(46,230,166,.1); box-shadow: inset 3px 0 0 var(--acc); }
.chat-list .avatar { width: 46px; height: 46px; }
.chat-list .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-list .info strong, .chat-list .info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .info strong { font-size: 15px; font-weight: 700; }
.chat-list .info span { font-size: 13px; color: var(--muted); }
.chat-list .badge { width: 11px; height: 11px; border-radius: 50%; background: var(--acc); animation: ring 1.8s ease-out infinite; }
.chat-list .empty-list { color: var(--muted); font-size: 13px; padding: 12px 8px; }

.member-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.member-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; animation: rise .4s var(--ease) both; }
.member-list .avatar { width: 32px; height: 32px; font-size: 13px; }
.member-list .avatar.emoji { font-size: 17px; }
.member-list small { color: var(--muted); }
.leave-btn { padding: 12px; border: 1px solid rgba(255,93,115,.25); border-radius: 14px; background: rgba(255,93,115,.1); color: var(--danger);
  font: inherit; font-weight: 700; cursor: pointer; transition: background .2s, transform .25s var(--spring); }
.leave-btn:hover { background: rgba(255,93,115,.18); }
.leave-btn:active { transform: scale(.97); }

/* Profile picture editor */
.profile-card { max-width: 420px; gap: 16px; }
.profile-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0 2px; }
.avatar.xl { width: 112px; height: 112px; font-size: 44px; position: relative; box-shadow: 0 0 0 4px rgba(17,24,39,1), 0 0 0 6px rgba(46,230,166,.5), 0 18px 40px rgba(0,0,0,.4); }
.avatar.xl.emoji { font-size: 56px; }
.avatar.pop { animation: pop-big .55s var(--spring); }
@keyframes pop-big { 0% { transform: scale(.7) rotate(-8deg); } 100% { transform: scale(1) rotate(0); } }
.profile-preview strong { font-size: 17px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.seg button { padding: 9px 6px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 13.5px; font-weight: 700;
  cursor: pointer; transition: all .3s var(--spring); }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--raised-2); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.pane, .pane-colors { display: flex; flex-direction: column; gap: 8px; animation: rise .4s var(--ease); }
.hint { font-size: 12.5px; color: var(--muted); }
.ghost-btn { padding: 13px; border-radius: 14px; border: 1.5px dashed rgba(255,255,255,.2); background: var(--raised); color: var(--text);
  font-size: 14.5px; font-weight: 700; cursor: pointer; transition: all .25s var(--ease); }
.ghost-btn:hover { border-color: var(--acc); color: var(--acc); background: rgba(46,230,166,.06); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border: 1px solid transparent; border-radius: 12px; background: var(--raised); font-size: 21px;
  cursor: pointer; display: grid; place-items: center; transition: transform .25s var(--spring), background .2s, border-color .2s; }
.emoji-grid button:hover { transform: scale(1.18) rotate(-6deg); background: var(--raised-2); }
.emoji-grid button.active { border-color: var(--acc); background: rgba(46,230,166,.14); transform: scale(1.08); }
.color-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.color-grid button { aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); cursor: pointer;
  transition: transform .25s var(--spring), box-shadow .25s; }
.color-grid button:hover { transform: scale(1.18); }
.color-grid button.active { transform: scale(1.12); box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--acc); }

@media (max-width: 560px) {
  .chat { border-inline: 0; }
  .chat-header { gap: 8px; padding: 8px 10px; }
  .chat-header .link-btn { padding: 6px; font-size: 12.5px; }
  .messages { padding: 14px 10px; }
  .msg { max-width: 82%; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .color-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body.troll-shake .chat { animation-duration: .4s !important; animation-iteration-count: infinite !important; }
}
