:root{
  --head:#008069; --bg:#efeae2; --in:#ffffff; --out:#d9fdd3; --ink:#111b21; --muted:#667781;
  --btn:#027eb5; --tick:#53bdeb; --bar:#f0f2f5; --line:#e9edef;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%;margin:0}
body{font-family:-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;color:var(--ink);background:#d1d7db;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
svg{display:block}

/* ---------- CHAT ---------- */
#chat{height:100vh;height:100dvh;display:flex;justify-content:center}
.shell{width:100%;max-width:780px;height:100%;display:flex;flex-direction:column;background-color:var(--bg);position:relative;box-shadow:0 0 0 1px rgba(0,0,0,.04),0 6px 30px rgba(0,0,0,.08)}
.wall{position:absolute;inset:0;pointer-events:none;opacity:.07;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='18' cy='20' r='7'/%3E%3Cpath d='M70 12l8 8-8 8-8-8z'/%3E%3Cpath d='M100 60c6 0 10 4 10 10s-4 10-10 10'/%3E%3Cpath d='M20 70h18M29 61v18'/%3E%3Cpath d='M58 92c4-6 12-6 16 0'/%3E%3Ccircle cx='96' cy='102' r='3'/%3E%3Cpath d='M40 36l6 10h-12z'/%3E%3Cpath d='M86 30q6 -8 12 0t12 0'/%3E%3Cpath d='M8 104l10-6'/%3E%3C/g%3E%3C/svg%3E")}
.c-head{position:relative;z-index:2;background:var(--head);color:#fff;display:flex;align-items:center;gap:12px;padding:10px 14px;min-height:60px}
.ava{width:40px;height:40px;border-radius:50%;flex:none;overflow:hidden;background:#dfe5e7;display:grid;place-items:center;color:#fff;font-weight:600;font-size:16px}
.ava img{width:100%;height:100%;object-fit:cover}
.ava.ini{background:linear-gradient(135deg,#25a184,#0a6b55)}
.c-who{flex:1;min-width:0;line-height:1.2}
.c-name{font-weight:600;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.c-status{font-size:13px;opacity:.85;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ic-btn{background:none;border:0;color:inherit;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;opacity:.9;text-decoration:none}
.ic-btn:hover{background:rgba(255,255,255,.12);opacity:1}
.msgs{position:relative;z-index:1;flex:1;overflow-y:auto;padding:14px 6% 18px;display:flex;flex-direction:column;scroll-behavior:smooth}
@media (max-width:600px){.msgs{padding:10px 3.5% 14px}}
.pill{align-self:center;background:#fff;color:#54656f;font-size:12.5px;padding:5px 12px;border-radius:8px;margin:6px 0 10px;box-shadow:0 1px .5px rgba(11,20,26,.13);text-transform:uppercase;letter-spacing:.02em}
.notice{align-self:center;background:#ffeecd;color:#54656f;font-size:12.5px;padding:7px 12px;border-radius:8px;margin:0 0 12px;text-align:center;max-width:90%;box-shadow:0 1px .5px rgba(11,20,26,.13);line-height:1.4}
.row{display:flex;margin-top:2px}
.row.in{justify-content:flex-start}
.row.out{justify-content:flex-end}
.row.tail{margin-top:10px}
.bubble{position:relative;max-width:min(80%,480px);background:var(--in);border-radius:8px;padding:6px 8px 8px 9px;box-shadow:0 1px .5px rgba(11,20,26,.13);font-size:14.4px;line-height:19.5px;overflow-wrap:anywhere;animation:pop .18s ease-out}
.row.out .bubble{background:var(--out)}
.row.tail.in .bubble{border-top-left-radius:0}
.row.tail.out .bubble{border-top-right-radius:0}
.row.tail.in .bubble::before,.row.tail.out .bubble::before{content:"";position:absolute;top:0;width:8px;height:13px;background:inherit}
.row.tail.in .bubble::before{left:-8px;clip-path:polygon(0 0,100% 0,100% 100%)}
.row.tail.out .bubble::before{right:-8px;clip-path:polygon(0 0,100% 0,0 100%)}
@keyframes pop{from{opacity:0;transform:translateY(4px) scale(.98)}to{opacity:1;transform:none}}
.bubble a{color:#027eb5}
.meta{float:right;margin:6px 0 -6px 12px;font-size:11px;color:var(--muted);display:inline-flex;align-items:center;gap:3px;position:relative;top:3px;white-space:nowrap}
.tick{color:#8696a0;transition:color .3s}
.tick.read{color:var(--tick)}
.bubble.media{padding:3px 3px 6px}
.bubble.media .mwrap{border-radius:6px;overflow:hidden;background:#e9edef;min-width:200px;min-height:120px;display:grid;place-items:center}
.bubble.media img,.bubble.media video{display:block;max-width:100%;max-height:360px;width:auto;border-radius:6px}
.bubble.media .cap{padding:5px 6px 0}
.bubble.media .meta{margin-right:4px}
.mload{color:#8696a0;font-size:12px;padding:20px}
.typing .bubble{padding:11px 14px}
.dots{display:inline-flex;gap:4px}
.dots i{width:7px;height:7px;border-radius:50%;background:#8696a0;animation:blink 1.2s infinite}
.dots i:nth-child(2){animation-delay:.2s}.dots i:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.btnrow{margin-top:3px}
.btns{width:min(80%,360px);display:flex;flex-direction:column;gap:3px;animation:pop .2s ease-out}
.wbtn{background:#fff;border:0;border-radius:8px;padding:10px 12px;color:var(--btn);font-weight:500;font-size:14.4px;display:flex;align-items:center;justify-content:center;gap:7px;box-shadow:0 1px .5px rgba(11,20,26,.13);text-decoration:none;text-align:center;line-height:1.25;transition:background .15s}
.wbtn:hover{background:#f7f8fa}
.wbtn svg{flex:none}
.btns.used .wbtn:not(a){color:#a3adb3;cursor:default;background:#fafafa}
.btns.used .wbtn.chosen{color:var(--btn);background:#fff}
.voice{display:flex;align-items:center;gap:10px;width:270px;max-width:100%;padding:2px 2px 0}
.v-ava{position:relative;flex:none}
.v-ava .ava{width:44px;height:44px}
.v-mic{position:absolute;right:-5px;bottom:-3px;color:#4fb6ec;background:var(--in);border-radius:50%;padding:1px}
.row.out .v-mic{background:var(--out)}
.v-play{background:none;border:0;color:#8696a0;width:30px;height:34px;display:grid;place-items:center;flex:none;padding:0}
.v-body{flex:1;min-width:0}
.v-wave{display:flex;align-items:center;gap:2px;height:28px;cursor:pointer}
.v-wave i{flex:1;min-width:2px;background:#c5cbd0;border-radius:2px}
.v-wave i.on{background:#4fb6ec}
.v-time{font-size:11px;color:var(--muted);margin-top:1px;display:flex;justify-content:space-between}
.c-input{position:relative;z-index:2;background:var(--bar);display:flex;align-items:center;gap:8px;padding:8px 12px}
.c-input input{flex:1;min-width:0;border:0;outline:0;background:#fff;border-radius:10px;padding:11px 14px;font-size:15px}
.send{width:44px;height:44px;border:0;border-radius:50%;background:var(--head);color:#fff;display:grid;place-items:center;flex:none;transition:transform .1s}
.send:active{transform:scale(.94)}
.c-empty{align-self:center;margin:auto;color:#54656f;text-align:center;font-size:14px;max-width:320px;line-height:1.5}
.c-empty a{color:var(--head);font-weight:600}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(20px);background:#1f2a30;color:#fff;padding:11px 18px;border-radius:10px;font-size:14px;opacity:0;pointer-events:none;transition:.25s;z-index:50;max-width:90vw;text-align:center}
.toast.on{opacity:1;transform:translateX(-50%)}
.loading{margin:auto;color:#667781;font-size:14px;display:flex;align-items:center;gap:10px}
.spin{width:18px;height:18px;border:2px solid #cfd6da;border-top-color:var(--head);border-radius:50%;animation:sp 0.8s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
