/* XERA — dark UI, blue accent */
:root {
  --bg: #0e0f12;
  --rail: #121317;
  --panel: #16171b;
  --card: #1d1f24;
  --card-2: #23252b;
  --hover: #22242a;
  --active: #262a33;
  --line: #24262c;
  --text: #f1f2f4;
  --text-2: #c9ccd2;
  --muted: #7d828c;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-soft: rgba(59, 130, 246, .14);
  --badge: #f0573a;
  --violet: #7c3aed;
  --gold: #f5b83d;
  --ok: #22c55e;
  --danger: #f05252;
  --bubble: #1f2126;
  --r: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: #8ab4ff; }
svg { width: 22px; height: 22px; fill: currentColor; flex-shrink: 0; }
.i { display: inline-flex; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.wordmark { font-weight: 800; letter-spacing: .2em; }
.screen { height: 100vh; height: 100dvh; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 14px; font-weight: 600; background: var(--card-2); text-decoration: none; color: var(--text); }
.btn:hover { background: #2b2e35; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.gold { background: linear-gradient(135deg, #f5b83d, #f08a3d); color: #1b1305; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.prem.locked::after { content: ""; position: absolute; right: 5px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.seg { display: flex; background: var(--card); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px; border-radius: 11px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--card-2); color: var(--text); }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; text-align: left; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.form label.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.field, .form input:not([type=checkbox]), .form textarea { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; width: 100%; }
.field:focus, .form input:focus { border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.error { color: var(--danger); font-size: 14px; }

/* ---------- auth ---------- */
#auth { display: grid; place-items: center; padding: 24px 16px; overflow: auto;
  background: radial-gradient(900px 500px at 50% -10%, #1b2a4a 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 390px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 28px; padding: 30px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.auth-logo { width: 84px; height: 84px; filter: drop-shadow(0 14px 30px rgba(0,0,0,.5)); }
.auth-card h1 { margin: 12px 0 4px; font-size: 28px; }
.auth-card > .muted { margin: 0 0 22px; }
.e2e-note { display: flex; gap: 8px; align-items: flex-start; text-align: left; margin: 20px 0 0; font-size: 12px; color: var(--muted); background: var(--accent-soft); padding: 10px 12px; border-radius: 12px; }
.e2e-note svg { width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }

/* ---------- app layout ---------- */
#app { display: flex; background: var(--bg); padding: 10px; gap: 10px; }
#rail { flex-shrink: 0; display: flex; justify-content: space-around; gap: 4px; margin: 0 12px 12px; padding: 6px; background: var(--card); border-radius: 18px; }
.rail-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px; border-radius: 13px; color: #6b7079; position: relative; font-size: 11px; font-weight: 600; }
.rail-btn .ic { display: grid; place-items: center; position: relative; }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { color: var(--text); background: var(--hover); }
.rail-btn.active { color: var(--accent); background: var(--accent-soft); }
.rail-btn .dot { position: absolute; top: -2px; right: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--badge); border: 2px solid var(--card); }
#sidebar { width: 360px; flex-shrink: 0; background: var(--panel); border-radius: 22px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); border-radius: 22px; position: relative; overflow: hidden; }
#chatView { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.details { width: 320px; flex-shrink: 0; background: var(--panel); border-radius: 22px; overflow-y: auto; padding: 18px; }

/* me card */
.me-card { margin: 14px 14px 6px; background: var(--card); border-radius: 20px; padding: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.me-card:hover { background: var(--card-2); }
.me-card .t { flex: 1; min-width: 0; }
.me-card b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card small { color: var(--muted); font-size: 12.5px; }
.plan-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--card-2); color: var(--muted); letter-spacing: .03em; }
.plan-pill.premium { background: linear-gradient(135deg, #f5b83d, #f08a3d); color: #1b1305; }

.search-row { display: flex; gap: 8px; align-items: center; margin: 8px 14px 6px; }
.search-row .search { flex: 1; margin: 0; }
.new-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--card); color: var(--text-2); }
.new-btn:hover { background: var(--accent); color: #fff; }
.search { margin: 0 14px 6px; position: relative; }
.search .s-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .s-ic svg { width: 17px; height: 17px; }
.search input { width: 100%; background: var(--card); border: 1px solid transparent; border-radius: 14px; padding: 11px 14px 11px 38px; outline: none; }
.search input:focus { border-color: #2f3a52; }
.list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.sec { display: flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; font-weight: 600; }
.sec svg { width: 14px; height: 14px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; cursor: pointer; width: 100%; text-align: left; position: relative; }
.item:hover { background: var(--hover); }
.item.active { background: var(--active); }
.item .meta { flex: 1; min-width: 0; }
.item .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item .name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.item .name svg { width: 14px; height: 14px; color: var(--muted); }
.item .time { font-size: 11.5px; color: var(--muted); flex-shrink: 0; display: inline-flex; align-items: center; gap: 2px; }
.item .time svg { width: 15px; height: 15px; }
.item .time .read { color: var(--accent); }
.item .preview { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .preview b { color: var(--text-2); font-weight: 500; }
.item .preview .typ { color: var(--accent); }
.item .badge { background: var(--badge); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; flex-shrink: 0; }
.list-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13.5px; }
.list-empty .btn { margin-top: 14px; }

/* avatars */
.av { position: relative; flex-shrink: 0; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: #fff; user-select: none; }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.av .ini { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; }
.av.online::after { content: ""; position: absolute; right: 0; bottom: 0; width: 24%; height: 24%; min-width: 9px; min-height: 9px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel); }
.stack-avs { display: flex; padding-left: 8px; }
.stack-avs .av { margin-left: -9px; border: 2px solid var(--panel); box-sizing: content-box; }
.stack-avs .more { margin-left: -9px; width: 30px; height: 30px; border-radius: 50%; background: var(--badge); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--panel); }

/* ---------- chat ---------- */
.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.chat-empty img { width: 84px; opacity: .8; }
.chat-empty h3 { color: var(--text); margin: 14px 0 4px; font-size: 19px; }
.code-badge { margin-top: 16px; display: inline-block; background: var(--card); padding: 9px 18px; border-radius: 14px; color: var(--text); }
.code-badge b { letter-spacing: .16em; color: var(--accent); }

.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 70px; }
.back { display: none; }
.chat-title { display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; flex: 1; }
.chat-title .t { min-width: 0; display: flex; flex-direction: column; }
.chat-title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { color: var(--muted); font-size: 12.5px; }
.chat-title small.on { color: var(--ok); }
.chat-title small.typ { color: var(--accent); }
.head-av { display: none; }
.head-actions { display: flex; gap: 2px; }

.messages { flex: 1; overflow-y: auto; padding: 18px 26px 10px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.day { align-self: center; color: var(--muted); font-size: 12px; margin: 16px 0 8px; font-weight: 500; }
.sys { align-self: center; color: var(--muted); font-size: 12.5px; background: var(--card); padding: 5px 12px; border-radius: 12px; margin: 6px 0; text-align: center; max-width: 80%; }
.grp { display: flex; gap: 12px; margin-top: 14px; align-items: flex-start; max-width: 100%; }
.grp.me { flex-direction: row-reverse; }
.grp .g-av { width: 38px; flex-shrink: 0; }
.grp .g-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: min(72%, 560px); }
.grp.me .g-body { align-items: flex-end; }
.g-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.g-head b { font-weight: 600; }
.g-head small { color: var(--muted); font-size: 11.5px; }
.grp.me .g-head { flex-direction: row-reverse; }
.bub { position: relative; display: flex; flex-direction: column; align-items: inherit; max-width: 100%; }
.msg { background: var(--bubble); padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; max-width: 100%; position: relative; font-size: 14px; }
.grp.me .msg { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.grp.me .msg a { color: #fff; }
.msg .txt { white-space: pre-wrap; }
.msg .st { display: inline-flex; vertical-align: -4px; margin-left: 6px; opacity: .75; }
.msg .st svg { width: 15px; height: 15px; }
.msg.err { color: var(--muted); font-style: italic; background: var(--card); }
.msg.media { padding: 0; background: none !important; overflow: hidden; border-radius: 16px; }
.msg.media .txt { background: var(--bubble); padding: 8px 12px; border-radius: 0 0 16px 16px; }
.grp.me .msg.media .txt { background: var(--accent-2); }
.ph { display: block; width: 300px; max-width: 100%; border-radius: 16px; background: #0b0c0e center/cover; position: relative; cursor: zoom-in; overflow: hidden; }
.msg.media .txt + .ph, .msg.media .ph:has(+ .txt) { border-radius: 16px 16px 0 0; }
.ph img, .ph video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .ov { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.25); color: #fff; }
.ph .ov .circ { width: 52px; height: 52px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; backdrop-filter: blur(6px); }
.ph .ov .circ svg { width: 26px; height: 26px; }
.ph .tag { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; padding: 2px 8px; border-radius: 8px; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.file { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-width: 220px; cursor: pointer; }
.file .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.grp.me .file .ic { background: rgba(255,255,255,.18); color: #fff; }
.file .fn { font-weight: 600; display: block; word-break: break-all; }
.file small { opacity: .7; font-size: 12px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.voice .pl { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.grp.me .voice .pl { background: #fff; color: var(--accent-2); }
.voice .pl svg { width: 20px; height: 20px; }
.wave { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1; }
.wave i { width: 3px; border-radius: 2px; background: currentColor; opacity: .35; min-height: 3px; }
.wave i.on { opacity: 1; }
.voice small { font-size: 11.5px; opacity: .75; min-width: 32px; }
.reacts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.reacts button { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; font-size: 12.5px; display: inline-flex; gap: 4px; align-items: center; }
.reacts button.mine { border-color: var(--accent); background: var(--accent-soft); }
.reacts button b { font-weight: 600; font-size: 11.5px; }
.bub .hov { position: absolute; top: -14px; right: -6px; display: none; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 2px; z-index: 3; }
.grp.me .bub .hov { right: auto; left: -6px; }
.bub:hover .hov { display: flex; }
.hov button { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.hov button:hover { background: var(--hover); color: var(--text); }
.hov svg { width: 17px; height: 17px; }
.pending .msg { opacity: .8; }
.progress { height: 4px; background: rgba(255,255,255,.18); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #fff; transition: width .15s; }

.typing-bar { padding: 0 26px 6px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.typing-bar b { color: var(--text-2); font-weight: 600; }
.dots span { animation: blink 1.2s infinite; } .dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.composer { display: flex; align-items: flex-end; gap: 4px; margin: 6px 16px 16px; padding: 6px 6px 6px 10px; background: var(--card); border-radius: 18px; border: 1px solid var(--line); }
.composer #composerAv { align-self: center; margin-right: 4px; display: flex; }
.composer textarea { flex: 1; resize: none; background: none; border: 0; outline: none; padding: 9px 6px; max-height: 160px; line-height: 1.4; min-width: 0; }
.send-btn { width: 40px; height: 40px; border-radius: 13px; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.send-btn:hover { background: var(--accent-2); }
.send-btn svg { width: 19px; height: 19px; }
.record-bar, .blocked-bar { display: flex; align-items: center; gap: 12px; margin: 6px 16px 16px; padding: 8px 8px 8px 16px; background: var(--card); border-radius: 18px; }
.blocked-bar { justify-content: center; color: var(--muted); padding: 14px; }
.record-bar .muted { flex: 1; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.emoji-panel { position: absolute; bottom: 74px; left: 16px; width: 330px; max-width: calc(100% - 32px); max-height: 280px; overflow-y: auto; background: var(--card-2); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; z-index: 6; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.emoji-panel button { font-size: 22px; height: 36px; border-radius: 9px; }
.emoji-panel button:hover { background: var(--hover); }
.drop-hint { position: absolute; inset: 80px 18px 84px; border: 2px dashed var(--accent); border-radius: 20px; display: grid; place-items: center; background: rgba(14,15,18,.88); font-size: 17px; color: var(--accent); z-index: 5; pointer-events: none; }

/* ---------- details panel ---------- */
.d-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.d-head svg { color: var(--accent); width: 20px; height: 20px; }
.d-head span { flex: 1; }
.d-top { text-align: center; margin: 8px 0 16px; }
.d-top .av { margin: 0 auto 10px; }
.d-top h3 { margin: 0; font-size: 18px; }
.d-top p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.stat { background: var(--card); border-radius: 16px; padding: 12px; text-align: center; }
.stat small { color: var(--muted); font-size: 12px; display: block; }
.stat b { font-size: 24px; display: inline-flex; align-items: center; gap: 6px; }
.stat b svg { width: 20px; height: 20px; }
.stat.f b svg { color: #a855f7; } .stat.k b svg { color: var(--gold); }
.d-sec { display: flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.d-sec b { color: var(--text); }
.d-sec svg { width: 15px; height: 15px; }
.d-sec .sp { flex: 1; }
.d-sec button { color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; }
.mem { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 12px; }
.mem .t { flex: 1; min-width: 0; }
.mem b { font-weight: 600; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem small { color: var(--muted); font-size: 12px; }
.mem .role { font-size: 11px; color: var(--accent); font-weight: 600; }
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.media-grid .cell { aspect-ratio: 1; border-radius: 12px; background: var(--card) center/cover; cursor: pointer; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.media-grid .cell img { width: 100%; height: 100%; object-fit: cover; }
.ftype { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.ftype .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.ftype .ic svg { width: 22px; height: 22px; }
.ftype .t { flex: 1; }
.ftype b { display: block; font-size: 14px; }
.ftype small { color: var(--muted); font-size: 12px; }
.ic.blue { background: rgba(59,130,246,.15); color: #60a5fa; } .ic.red { background: rgba(239,68,68,.15); color: #f87171; }
.ic.green { background: rgba(34,197,94,.15); color: #4ade80; } .ic.violet { background: rgba(168,85,247,.15); color: #c084fc; }
.d-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.d-actions .btn { justify-content: flex-start; }
.safety { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .04em; line-height: 1.8; text-align: center; background: var(--card); padding: 12px; border-radius: 14px; word-spacing: 6px; }

/* ---------- modal / menu / lightbox / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; padding: 22px; position: relative; }
.modal-card h2 { margin: 0 0 14px; font-size: 19px; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.profile-top { text-align: center; margin-bottom: 16px; }
.profile-top .av { margin: 0 auto 12px; }
.profile-top h3 { margin: 0; font-size: 20px; }
.profile-top .muted { margin: 4px 0 0; }
.id-box { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 16px; padding: 12px 16px; margin: 14px 0; }
.id-box .big { font-size: 26px; font-weight: 800; letter-spacing: .22em; }
.id-box small { display: block; color: var(--muted); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row-btns { display: flex; gap: 8px; } .row-btns .btn { flex: 1; }
.avatar-edit { position: relative; display: inline-block; cursor: pointer; }
.avatar-edit .cam { position: absolute; right: 0; bottom: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 3px solid var(--panel); }
.avatar-edit .cam svg { width: 15px; height: 15px; }
.code-input { text-align: center; font-size: 28px !important; letter-spacing: .4em; font-weight: 700; }
.pick { max-height: 300px; overflow-y: auto; margin: 10px -6px; }
.pick label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; cursor: pointer; }
.pick label:hover { background: var(--hover); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.prem-list { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.prem-list li { display: flex; gap: 12px; align-items: center; background: var(--card); padding: 12px; border-radius: 14px; }
.prem-list li .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.prem-head { text-align: center; }
.prem-head .crown { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 10px; background: linear-gradient(135deg, #f5b83d, #f08a3d); color: #1b1305; display: grid; place-items: center; }
.prem-head .crown svg { width: 34px; height: 34px; }

.menu { position: fixed; z-index: 55; background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 6px; min-width: 210px; box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: fade .1s; }
.menu .quick { display: flex; gap: 2px; padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .quick button { font-size: 22px; width: 36px; height: 36px; border-radius: 10px; }
.menu .quick button:hover { background: var(--hover); }
.menu > button, .menu > a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; color: var(--text); text-decoration: none; font-size: 14px; }
.menu > button:hover, .menu > a:hover { background: var(--hover); }
.menu svg { width: 18px; height: 18px; color: var(--muted); }
.menu .danger, .menu .danger svg { color: var(--danger); }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 60; display: grid; place-items: center; animation: fade .15s; }
.lightbox img, .lightbox video { max-width: 96vw; max-height: 88vh; object-fit: contain; }
.lightbox .lb-bar { position: absolute; top: 0; right: 0; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); display: flex; gap: 6px; }
.lightbox .icon-btn { color: #fff; background: rgba(255,255,255,.12); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #2b2e35; color: #fff; padding: 11px 18px; border-radius: 14px; z-index: 70; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; text-align: center; }
@keyframes fade { from { opacity: 0; } }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: #2a2d34; border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .details { position: fixed; right: 10px; top: 10px; bottom: 10px; z-index: 30; box-shadow: -20px 0 60px rgba(0,0,0,.5); border: 1px solid var(--line); }
}
@media (max-width: 860px) {
  #app { padding: 0; gap: 0; }
  #rail { margin: 0; border-radius: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .rail-btn .dot { border-color: var(--panel); }
  #sidebar { width: 100%; flex: 1; border-radius: 0; padding-top: env(safe-area-inset-top); }
  #chat { position: fixed; inset: 0; border-radius: 0; transform: translateX(100%); transition: transform .22s ease; z-index: 20; }
  body.chat-open #chat { transform: none; }
  .chat-head { padding: 10px 10px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 0; }
  .back { display: grid; }
  .head-av { display: flex; }
  .stack-avs { display: none; }
  .messages { padding: 10px 12px 6px; }
  .grp .g-body { max-width: 82%; }
  .grp .g-av { width: 32px; }
  .ph { width: 240px; }
  .composer { margin: 4px 8px; margin-bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer #composerAv { display: none; }
  .bub .hov { display: none !important; }
  .details { inset: 0; right: 0; top: 0; bottom: 0; border-radius: 0; z-index: 40; padding-top: max(18px, env(safe-area-inset-top)); }
  .modal { place-items: end center; padding: 0; }
  .modal-card { border-radius: 24px 24px 0 0; max-width: none; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

/* password meter, links, recovery phrase */
.link-btn { color: var(--accent); font-size: 13.5px; font-weight: 600; padding: 4px; align-self: center; }
.link-btn:hover { text-decoration: underline; }
.pw-meter { margin-top: 2px; }
.pw-meter .bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter .bars i { height: 4px; border-radius: 2px; background: var(--card-2); transition: background .2s; }
.pw-meter small { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.pw-meter[data-score="0"] .bars i:nth-child(-n+1), .pw-meter[data-score="1"] .bars i:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] .bars i:nth-child(-n+2) { background: var(--gold); }
.pw-meter[data-score="3"] .bars i:nth-child(-n+3) { background: #4ade80; }
.pw-meter[data-score="4"] .bars i { background: var(--ok); }
.phrase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0; counter-reset: w; }
.phrase-grid span { background: var(--card); border-radius: 10px; padding: 8px 8px 8px 30px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; position: relative; user-select: all; }
.phrase-grid span::before { counter-increment: w; content: counter(w); position: absolute; left: 9px; color: var(--muted); font-size: 11.5px; top: 10px; }
.warn-box { background: rgba(245,184,61,.1); border: 1px solid rgba(245,184,61,.3); color: #f6d38a; border-radius: 14px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.verify-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.verify-row b { width: 70px; flex-shrink: 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.switch-row { display: flex; align-items: center; gap: 12px; background: var(--card); padding: 12px 14px; border-radius: 14px; }
.switch-row .t { flex: 1; } .switch-row small { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
.toggle { width: 44px; height: 26px; border-radius: 13px; background: var(--card-2); position: relative; flex-shrink: 0; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on { background: var(--accent); } .toggle.on::after { transform: translateX(18px); }
