[hidden] { display: none !important; }
html, body { margin: 0; }
/* Layout: floating rounded sidebar card over a doodle wallpaper; centered chat column with floating header, pinned bar and input pill. Dark only, by design. */
:root {
  --page: #0b0b0b; --surface: #212121; --surface-2: #2c2c2c; --field: #181818; --hover: #2c2c2c;
  --text: #ffffff; --muted: #aaaaaa; --dim: #707579;
  --accent: #7b5cf0; --accent-hover: #8a6ef5; --out: #6D4CDB; --in: #212121;
  --wp: none;
  --f: "Roboto", -apple-system, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--page); color: var(--text); font-family: var(--f); font-size: 16px; overflow: hidden; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; height: 100%; background-color: var(--page);
  background-image: var(--wp), radial-gradient(ellipse at 75% 25%, rgba(110, 70, 190, .22), transparent 60%), radial-gradient(ellipse at 25% 95%, rgba(170, 60, 120, .16), transparent 55%);
  background-size: 460px 460px, auto, auto; }

/* ---------- avatars ---------- */
.av { width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: calc(var(--s) * .4); position: relative; user-select: none; }
.av svg { width: 55%; height: 55%; }
.av-emoji { font-size: calc(var(--s) * .55); line-height: 1; }
.av.ring { outline: 2px dashed #5ba7f0; outline-offset: 3px; }
.av-gap { width: 40px; flex: none; }

/* ---------- sidebar ---------- */
.side { width: 420px; flex: none; margin: 16px 0 16px 16px; background: var(--surface); border-radius: 24px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.side-top { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.round { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.round:hover { background: var(--hover); }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 7px 0 16px; border-radius: 27px; background: var(--field); color: var(--muted); }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 17px; outline: none; }
.search input::placeholder { color: var(--muted); }
.banner { margin: 4px 12px 8px; padding: 12px 44px 12px 20px; border-radius: 20px; background: var(--surface-2); position: relative; }
.banner b { display: block; font-weight: 500; font-size: 17px; }
.banner span { color: var(--muted); font-size: 15px; }
.banner .x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; }
.tabs { display: flex; gap: 4px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #2a2a2a; }
.tab { padding: 14px 14px 12px; font-size: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; position: relative; display: flex; align-items: center; gap: 6px; border-radius: 10px 10px 0 0; }
.tab:hover { background: var(--hover); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab .badge { height: 20px; min-width: 20px; font-size: 12px; }

.list { flex: 1; overflow-y: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 12px; text-align: left; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent); }
.r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.r-top, .r-bot { display: flex; align-items: center; gap: 4px; min-width: 0; }
.r-name { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-time { margin-left: auto; padding-left: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.r-prev { flex: 1; min-width: 0; color: var(--muted); font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-prev .who { color: var(--text); }
.mute { width: 15px; height: 15px; color: var(--dim); flex: none; }
.pin { width: 22px; height: 22px; color: var(--dim); flex: none; }
.badge { flex: none; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; font-size: 13.5px; font-weight: 500; background: var(--accent); color: #fff; }
.badge.m { background: var(--dim); }
.row.sel .r-prev, .row.sel .r-time, .row.sel .r-prev .who, .row.sel .mute, .row.sel .pin, .row.sel .tk { color: #fff; }
.row.sel .badge { background: #fff; color: var(--accent); }
.tk { width: 16px; height: 16px; color: var(--accent); flex: none; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }

.fab { position: absolute; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: transform .15s; }
.fab:hover { transform: scale(1.05); background: var(--accent-hover); }

.dropdown { position: absolute; top: 62px; left: 12px; z-index: 20; width: 300px; padding: 6px; border-radius: 14px; background: rgba(33,33,33,.96); backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.dd-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 15px; text-align: left; }
.dd-item:hover { background: rgba(255,255,255,.07); }
.dd-item small { display: block; color: var(--muted); font-size: 13px; }
.dd-sep { height: 1px; background: #333; margin: 6px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* forum mode: avatar strip + topics */
.side.forum { flex-direction: row; }
.strip { width: 80px; flex: none; overflow-y: auto; scrollbar-width: none; padding: 76px 0 12px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid #2a2a2a; }
.strip button { position: relative; display: grid; place-items: center; padding: 8px 0; margin: 0 6px; border-radius: 14px; }
.strip button:hover, .strip button.sel { background: var(--hover); }
.strip .badge { position: absolute; right: 2px; bottom: 4px; border: 2px solid var(--surface); }
.topics { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 8px 12px; }
.t-head .t-title { flex: 1; min-width: 0; }
.t-head b { display: block; font-weight: 500; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-head span { color: var(--muted); font-size: 14px; }
.t-ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-size: 24px; color: #5ba7f0; font-weight: 700; }

/* ---------- chat ---------- */
.main { flex: 1; min-width: 0; display: flex; justify-content: center; position: relative; }
.col { width: min(940px, 100%); height: 100%; position: relative; padding: 0 16px; }
.placeholder { height: 100%; display: grid; place-items: center; }
.placeholder span { background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 999px; font-size: 15px; }
.top { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.head { height: 64px; border-radius: 32px; background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 0 10px 0 12px; }
.head-info { flex: 1; min-width: 0; }
.head-info b { display: block; font-weight: 500; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-info span { display: block; color: var(--muted); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-info .typing { color: var(--accent); }
.back { display: grid; }
.pinbar { height: 56px; border-radius: 28px; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; cursor: pointer; }
.pinbar .pin-ico { color: var(--text); }
.pinbar .pin-txt { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 10px; }
.pinbar b { display: block; color: var(--accent); font-weight: 500; font-size: 15px; }
.pinbar span { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msgs { position: absolute; inset: 0; overflow-y: auto; padding: 96px 16px 96px; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
.col.has-pin .msgs { padding-top: 160px; }
.stack { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.day { align-self: center; margin: 8px 0; font-size: 14px; font-weight: 500; padding: 4px 12px; border-radius: 14px; background: rgba(0,0,0,.4); }
.msg { display: flex; align-items: flex-end; gap: 8px; }
.msg.out { justify-content: flex-end; }
.msg.last { margin-bottom: 6px; }
.bubble { position: relative; max-width: min(620px, 78%); padding: 6px 10px 7px 12px; border-radius: 16px; background: var(--in); font-size: 16px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .16s ease-out; }
.out .bubble { background: var(--out); }
.in.last .bubble { border-bottom-left-radius: 4px; }
.out.last .bubble { border-bottom-right-radius: 4px; }
.in.last .bubble::after, .out.last .bubble::after { content: ""; position: absolute; bottom: 0; width: 9px; height: 17px; background: inherit; }
.in.last .bubble::after { left: -8px; clip-path: path("M9 0V17H0C4 15 8 11 9 0Z"); }
.out.last .bubble::after { right: -8px; clip-path: path("M0 0V17H9C5 15 1 11 0 0Z"); }
.m-name { font-weight: 500; font-size: 15px; margin-bottom: 2px; white-space: nowrap; }
.quote { --c: #fff; display: block; margin: 3px 0 5px; padding: 4px 10px 5px; border-left: 3px solid var(--c); border-radius: 5px; background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.quote b { display: block; color: var(--c); font-weight: 500; }
.meta { position: absolute; right: 10px; bottom: 5px; display: flex; align-items: center; gap: 3px; font-size: 12.5px; color: rgba(255,255,255,.5); white-space: nowrap; }
.out .meta { color: rgba(255,255,255,.75); }
.out .meta .tk { color: #fff; }
.meta .rep { display: flex; align-items: center; gap: 2px; margin-right: 6px; }
.meta .rep svg { width: 14px; height: 14px; }
.spacer { display: inline-block; height: 1px; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; white-space: normal; }
.rc { height: 32px; padding: 0 8px 0 6px; border-radius: 16px; display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.08); color: var(--accent); font-weight: 500; font-size: 15px; }
.out .rc { background: rgba(255,255,255,.18); color: #fff; }
.rc .e { font-size: 21px; line-height: 1; }
.rc.mine { background: var(--accent); color: #fff; }
.out .rc.mine { background: #fff; color: var(--accent); }
.rc .avs { display: flex; }
.rc .avs .av { border: 2px solid var(--in); margin-left: -6px; }
.rc .avs .av:first-child { margin-left: 0; }
.msg.stk .bubble { background: none; padding: 0; }
.msg.stk .bubble::after { display: none; }
.msg.stk svg.sticker { width: 170px; height: 170px; animation: wobble 1.6s ease-in-out 2; }
.msg.stk .meta, .bubble.media .meta { background: rgba(0,0,0,.45); padding: 2px 7px; border-radius: 10px; color: #fff; bottom: 6px; right: 6px; }
.bubble.media { padding: 0; overflow: hidden; width: min(440px, 100%); }
.lp-img { height: 230px; display: flex; align-items: flex-end; justify-content: center; padding: 18px; font-weight: 700; font-size: 26px; letter-spacing: .08em; color: rgba(255,255,255,.55); text-transform: uppercase; }
.lp-txt { padding: 10px 14px 12px; background: rgba(0,0,0,.35); }
.lp-txt b { display: block; font-size: 22px; font-weight: 700; }
.lp-txt span { color: rgba(255,255,255,.75); font-size: 15px; }

.composer { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 3; display: flex; align-items: flex-end; gap: 8px; }
.inp { flex: 1; min-width: 0; background: var(--surface); border-radius: 28px; display: flex; flex-direction: column; }
.replybar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 0 16px; color: var(--accent); }
.replybar .rb-txt { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 10px; font-size: 14.5px; }
.replybar .rb-txt span { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inp-row { display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 8px; min-height: 56px; }
.inp-row .av { margin: 2px 6px 2px 0; }
.inp textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-size: 17px; line-height: 1.35; padding: 10px 4px; max-height: 180px; }
.inp textarea::placeholder { color: var(--muted); }
.mic { width: 56px; height: 56px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.mic:hover { background: var(--accent-hover); }
.mic .ico { width: 26px; height: 26px; }

.panel { position: absolute; right: 64px; bottom: 68px; width: 360px; max-width: calc(100% - 64px); height: 360px; z-index: 5; background: var(--surface); border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; overflow: hidden; }
.p-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #2a2a2a; }
.p-tab { padding: 6px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 14px; }
.p-tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.p-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); align-content: start; gap: 2px; padding: 8px; }
.p-grid.st { grid-template-columns: repeat(4, 1fr); }
.p-grid button { aspect-ratio: 1; border-radius: 10px; font-size: 26px; display: grid; place-items: center; }
.p-grid button:hover { background: var(--hover); }
.p-grid button svg { width: 100%; height: 100%; }

.ctx { position: fixed; z-index: 50; min-width: 220px; padding: 6px; border-radius: 14px; background: rgba(33,33,33,.96); backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0,0,0,.55); }
.ctx-re { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid #333; margin-bottom: 4px; }
.ctx-re button { width: 36px; height: 36px; border-radius: 50%; font-size: 22px; display: grid; place-items: center; transition: transform .1s; }
.ctx-re button:hover { transform: scale(1.2); background: rgba(255,255,255,.07); }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 60; background: rgba(0,0,0,.8); padding: 10px 16px; border-radius: 12px; font-size: 14.5px; max-width: calc(100% - 32px); }

/* voice, photo, file */
.voice, .file, .lp-txt { white-space: normal; }
.voice { display: flex; align-items: center; gap: 10px; padding: 3px 0 2px; min-width: 230px; }
.vplay { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.out .vplay { background: #fff; color: var(--accent); }
.vplay svg { width: 22px; height: 22px; }
.vbody { display: flex; flex-direction: column; gap: 3px; }
.bars { position: relative; height: 24px; --p: 0%; }
.wv { display: flex; align-items: flex-end; gap: 2px; height: 24px; width: max-content; }
.wv i { width: 3px; border-radius: 2px; flex: none; background: rgba(255,255,255,.4); }
.in .wv i { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.bars .fg { position: absolute; inset: 0 auto 0 0; width: var(--p); overflow: hidden; }
.bars .fg i { background: #fff; }
.in .bars .fg i { background: var(--accent); }
.vtime { font-size: 13px; color: rgba(255,255,255,.6); display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.vdot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.photo { display: block; width: 100%; height: auto; min-height: 120px; max-height: 440px; object-fit: cover; cursor: zoom-in; background: #000; }
.ph-grad { aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 64px; }
.cap { padding: 6px 10px 7px 12px; }
.bubble.media.capd .meta { background: none; padding: 0; bottom: 5px; right: 10px; color: rgba(255,255,255,.6); }
.file { display: flex; align-items: center; gap: 12px; padding: 4px 0 2px; min-width: 240px; }
.fico { width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.out .fico { background: #fff; color: var(--accent); }
.file b { display: block; font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file span span { font-size: 13.5px; color: rgba(255,255,255,.6); }
.dropdown.up { top: auto; bottom: 68px; left: 0; width: 240px; }
.recbar { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 8px 0 18px; }
.recdot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #e53935; animation: blink 1s infinite; }
.rectime { min-width: 58px; font-variant-numeric: tabular-nums; }
.recwave { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 30px; overflow: hidden; }
.recwave i { width: 3px; flex: none; border-radius: 2px; background: var(--accent); }
.recnote { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rec-cancel { color: var(--accent); font-weight: 500; padding: 8px 10px; border-radius: 8px; }
.rec-cancel:hover { background: var(--hover); }
@keyframes blink { 50% { opacity: .2 } }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.overlay.lightbox { background: rgba(0,0,0,.92); cursor: zoom-out; }
.lightbox img, .lightbox .ph-grad { max-width: min(90vw, 900px); max-height: 90vh; width: auto; border-radius: 6px; }
.lightbox .ph-grad { width: min(90vw, 800px); font-size: 120px; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.modal img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: #000; }
.modal-h { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 500; }
.field { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid #3a3a3a; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.field:focus { border-color: var(--accent); outline: none; }
.btn { height: 52px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 500; font-size: 16px; }
.btn:hover { background: var(--accent-hover); }

/* sign-in */
.auth { position: fixed; inset: 0; z-index: 45; overflow-y: auto; display: flex; padding: 32px 16px;
  background-color: var(--page); background-image: var(--wp), radial-gradient(ellipse at 50% 20%, rgba(110,70,190,.25), transparent 60%); background-size: 460px 460px, auto; }
.auth-card { width: min(400px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.auth-logo { width: 132px; height: 132px; border-radius: 30px; background: #6D4CDB; display: grid; place-items: center; box-shadow: 0 10px 40px rgba(109,76,219,.35); }
.auth h1 { font-size: 30px; font-weight: 500; margin: 6px 0 0; text-wrap: balance; }
.auth p { color: var(--muted); margin: 0; line-height: 1.45; }
.auth-back { align-self: flex-start; }
.prov { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.prov button { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: var(--surface); text-align: left; }
.prov button:hover { background: var(--surface-2); }
.prov small { display: block; color: var(--muted); font-size: 13.5px; }
.plogo { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.auth form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.flabel { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }
.err { color: #ff6b6b; font-size: 14px; min-height: 1.2em; }
.hint { width: 100%; background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--muted); line-height: 1.45; text-align: left; }
.hint b { color: var(--text); font-weight: 500; }
.steps { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; background: var(--surface); border-radius: 14px; padding: 16px; }
.step { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.step.done { color: var(--text); }
.s-ic { width: 20px; display: grid; place-items: center; color: var(--accent); font-weight: 700; flex: none; }
.spin { width: 16px; height: 16px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg) } }

@keyframes pop { from { transform: scale(.97); opacity: .5 } to { transform: none; opacity: 1 } }
@keyframes wobble { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-6deg) scale(1.04) } 60% { transform: rotate(5deg) } }
@media (prefers-reduced-motion: reduce) { .bubble, .msg.stk svg.sticker { animation: none } .fab, .ctx-re button { transition: none } }

/* ---------- phone ---------- */
@media (max-width: 900px) {
  .side { width: 100%; margin: 0; border-radius: 0; }
  .main { display: none; }
  .app.in-chat .side { display: none; }
  .app.in-chat .main { display: flex; }
  .back { display: grid; }
  .col { padding: 0; }
  .top { top: 8px; left: 8px; right: 8px; }
  .composer { left: 8px; right: 8px; bottom: 8px; }
  .msgs { padding: 84px 8px 84px; }
  .col.has-pin .msgs { padding-top: 148px; }
  .bubble { max-width: 86%; }
  .panel { right: 0; max-width: 100%; }
  .head-acts .search-btn { display: none; }
}

/* ---------- live app additions ---------- */
.av { overflow: hidden; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chip { flex: none; font-size: 11.5px; font-weight: 500; padding: 2px 7px; border-radius: 8px; background: rgba(109,76,219,.22); color: var(--accent); }
.row.sel .chip { background: rgba(255,255,255,.25); color: #fff; }
.sec { padding: 14px 12px 6px; font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.row .go { margin-left: auto; flex: none; color: var(--accent); font-size: 14px; font-weight: 500; }
.sys { align-self: center; max-width: 80%; text-align: center; font-size: 14px; padding: 4px 12px; border-radius: 14px; background: rgba(0,0,0,.45); margin: 4px 0; }
.failed { color: #ff6b6b; font-weight: 700; }
.reqbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 20px; background: var(--surface); }
.reqbar span { flex: 1 1 200px; color: var(--muted); font-size: 14.5px; }
.reqbar button { padding: 8px 14px; border-radius: 10px; font-weight: 500; background: var(--surface-2); }
.reqbar .ok { background: var(--accent); color: #fff; }
.composer { flex-direction: column; align-items: stretch; }
.composer .crow { display: flex; align-items: flex-end; gap: 8px; }
.msg.stk img.sticker { width: 170px; height: 170px; object-fit: contain; display: block; }
.file a { color: inherit; text-decoration: none; }
.me-card { display: flex; align-items: center; gap: 12px; padding: 8px 12px 10px; }
.me-card b { display: block; font-weight: 500; }
.me-card small { color: var(--muted); }
.qr { background: #fff; border-radius: 16px; padding: 10px; align-self: center; }
.qr svg, .qr img { width: 220px; height: 220px; display: block; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; min-width: 0; }
.install { width: 100%; text-align: left; background: rgba(109,76,219,.15); border: 1px solid rgba(109,76,219,.4); border-radius: 14px; padding: 12px 14px; font-size: 14.5px; line-height: 1.45; }
.install b { color: var(--text); }
.linkbtn { color: var(--accent); font-size: 14px; padding: 6px; }
.hint a { color: var(--accent); }
.avatar-edit { position: relative; align-self: center; cursor: pointer; }
.avatar-edit span.cam { position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; border: 3px solid var(--surface); }
.modal p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.offline { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 60; background: #5c2b2b; padding: 6px 14px; border-radius: 12px; font-size: 13.5px; }
@media (max-width: 900px) {
  .side-top { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .top { top: calc(8px + env(safe-area-inset-top, 0px)); }
  .composer { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .msgs { padding-top: calc(84px + env(safe-area-inset-top, 0px)); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .list { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .fab { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .auth { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
}

/* menu like the reference: wide items, submenu, version line */
.dropdown.tg { width: 280px; padding: 6px 0; }
.dropdown.tg .dd-item { padding: 10px 18px; border-radius: 0; gap: 18px; font-size: 15.5px; }
.dropdown.tg .dd-item .ico { color: var(--text); }
.dropdown.tg .dd-item .av { margin: -4px 0; }
.dropdown.sub { position: absolute; left: calc(100% - 8px); bottom: 0; top: auto; width: 270px; }
.dd-n { margin-left: auto; color: var(--muted); font-size: 14px; }
.dd-ver { padding: 10px 18px 6px; font-size: 12.5px; color: var(--muted); text-align: center; }
@media (max-width: 900px) { .dropdown.sub { left: 24px; bottom: -8px; } }

/* settings */
.settings { padding: 0 12px 24px; }
.set-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0 18px; text-align: center; }
.set-hero b { font-size: 22px; font-weight: 500; margin-top: 10px; }
.set-hero small { color: var(--muted); font-size: 15px; }
.set-card { background: var(--surface-2); border-radius: 18px; padding: 6px 0; margin-bottom: 14px; }
.set-row { display: flex; align-items: center; gap: 18px; width: 100%; padding: 10px 16px; text-align: left; }
.set-row:hover { background: rgba(255,255,255,.04); }
.set-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-t span { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-t small { color: var(--muted); font-size: 13.5px; }
.set-n { color: var(--muted); font-size: 15px; }
.tile { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; }
.tile svg { width: 20px; height: 20px; }
.dev { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid #333; }
.dev small { color: var(--muted); }
.side > .t-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }

.modal.scan video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: #000; }
.auth .linkbtn { margin-top: 4px; font-size: 15px; }

/* new chat: suggestions + own QR */
.sugg-wrap { position: relative; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 3; background: var(--surface-2); border-radius: 12px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.45); max-height: 300px; overflow-y: auto; }
.sugg-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.sugg-item:hover, .sugg-item.on { background: rgba(255,255,255,.07); }
.sugg-item span:not(.av):not(.chip) { flex: 1; min-width: 0; }
.sugg-item b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-item small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; border-top: 1px solid #333; padding-top: 14px; margin-top: 4px; text-align: center; }
.nc-qr .qr svg { width: 168px; height: 168px; }
.nc-qr .qr { min-width: 188px; min-height: 188px; display: grid; place-items: center; }
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; }

/* past letters from the mailbox */
.hist-btn { align-self: center; display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; padding: 9px 16px; border-radius: 18px; background: rgba(0,0,0,.5); color: var(--text); font-size: 14.5px; font-weight: 500; }
button.hist-btn:hover { background: rgba(0,0,0,.7); }
.hist-btn .ico { width: 18px; height: 18px; }
.msg.hist .bubble { opacity: .9; }
.hist-subj { font-weight: 500; margin-bottom: 2px; }
.hist-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; white-space: normal; }
