:root {
  --bg: #0b1020;
  --panel: #121a30;
  --panel-2: #1a2440;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #94a3b8;
  --c1: #06b6d4;
  --c2: #6366f1;
  --mine: linear-gradient(135deg, #06b6d4, #6366f1);
  --theirs: #1e2947;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.app { height: 100dvh; display: flex; overflow: hidden; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; }
.brand.big { font-size: 1.7rem; justify-content: center; }
.brand.big .brand-icon { width: 48px; height: 48px; border-radius: 14px; font-size: 1.3rem; }

/* Sign in */
.auth { flex: 1; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, rgba(6, 182, 212, .18), transparent 40%), radial-gradient(circle at 80% 90%, rgba(99, 102, 241, .2), transparent 45%); }
.auth-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.auth-sub { margin: 0; text-align: center; color: var(--muted); }
.auth-form { display: grid; gap: 10px; }
.auth-form input { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); outline: none; }
.auth-form input:focus { border-color: var(--c1); }
.btn-main { padding: 12px; border: 0; border-radius: 12px; background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; font-weight: 800; }
.btn-ghost { padding: 11px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-weight: 700; }
.btn-ghost:hover { background: var(--panel-2); }
.auth-foot { margin: 0; text-align: center; color: var(--muted); font-size: .9rem; }
.auth-foot a { color: var(--c1); }
.form-error { margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(239, 68, 68, .15); color: #fca5a5; font-size: .88rem; }
.lang-row { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.lang-row button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: .85rem; color: var(--muted); }
.lang-row button.on { color: #fff; border-color: var(--c1); }

/* Side: chats */
.side { width: 360px; flex: none; display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: var(--panel); min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; }
.side-actions { display: flex; align-items: center; gap: 6px; }
.lang-select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; font-size: .85rem; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 16px 10px; color: var(--muted); font-size: .9rem; }
.search { margin: 0 12px 8px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--panel-2); color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; outline: none; padding: 11px 0; color: var(--text); }
.list { flex: 1; overflow-y: auto; padding: 4px 6px 12px; min-height: 0; }
#peopleList { flex: none; max-height: 45%; border-bottom: 1px solid var(--line); }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 14px; background: transparent; text-align: start; }
.row:hover { background: var(--panel-2); }
.row.active { background: rgba(99, 102, 241, .18); }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name { font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-time { color: var(--muted); font-size: .76rem; flex: none; }
.row-last { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.row-last.unread { color: var(--text); font-weight: 700; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; font-size: .74rem; font-weight: 800; display: grid; place-items: center; flex: none; }
.avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--c1), var(--c2)); display: grid; place-items: center; font-weight: 900; color: #fff; overflow: hidden; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: .85rem; }
.avatar-wrap { position: relative; flex: none; }
.online-dot { position: absolute; inset-inline-end: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--panel); }
.verified { color: #38bdf8; font-size: .8rem; margin-inline-start: 4px; }
.hint { padding: 26px 16px; text-align: center; color: var(--muted); font-size: .92rem; }
.section-label { padding: 8px 12px 4px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

/* Thread */
.thread { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: radial-gradient(circle at 70% 0%, rgba(99, 102, 241, .08), transparent 50%), var(--bg); }
.empty-thread { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.empty-thread i { font-size: 3rem; background: linear-gradient(135deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.empty-thread h2 { color: var(--text); margin: 12px 0 4px; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); padding-top: max(10px, env(safe-area-inset-top)); }
.peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.peer-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-sub { color: var(--muted); font-size: .8rem; }
.back { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.day { align-self: center; margin: 10px 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: .76rem; }
.msg { max-width: min(75%, 520px); padding: 8px 12px 6px; border-radius: 18px; background: var(--theirs); align-self: flex-start; word-wrap: break-word; white-space: pre-wrap; animation: pop .18s ease-out; }
.msg.mine { align-self: flex-end; background: var(--mine); color: #fff; border-end-end-radius: 6px; }
.msg:not(.mine) { border-end-start-radius: 6px; }
.msg-meta { display: flex; justify-content: flex-end; gap: 4px; font-size: .7rem; opacity: .75; margin-top: 2px; }
.msg video.photo { display: block; max-width: 260px; max-height: 320px; border-radius: 12px; margin: -2px -6px 4px; background: #000; }
.msg .fwd { font-size: .75rem; font-style: italic; opacity: .78; margin-bottom: 4px; }
.msg .reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg .reacts span { font-size: .8rem; padding: 1px 7px; border-radius: 10px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); }
.msg .reacts span.mine { border-color: var(--c1); }
.msg .edited { font-style: italic; }
.msg audio { display: block; max-width: 240px; height: 36px; }
.msg.sending { opacity: .6; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.composer textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel-2); outline: none; }
.composer textarea:focus { border-color: var(--c2); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; flex: none; }
.send:disabled { opacity: .5; }
.mic.on { color: #ef4444; background: rgba(239, 68, 68, .15); }
.recording { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 44px; border-radius: 20px; background: rgba(239, 68, 68, .12); color: #fca5a5; font-weight: 700; }
.recording .dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; }
.recording .icon-btn { margin-inline-start: auto; width: 32px; height: 32px; }
@keyframes blink { 50% { opacity: .2; } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; z-index: 50; max-width: calc(100% - 32px); }

/* Phone: one pane at a time */
@media (max-width: 760px) {
  .side { width: 100%; border: 0; }
  .app.in-chat .side { display: none; }
  .app:not(.in-chat) .thread { display: none !important; }
  .back { display: grid; }
  .msg { max-width: 82%; }
}

/* v2: own accounts, tabs, profile, photos, read ticks */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 12px; padding: 4px; }
.tab { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 800; color: var(--muted); }
.tab.on { background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; }
.field-hint { margin: 0; color: var(--muted); font-size: .8rem; }
.me { border: 0; background: transparent; width: 100%; text-align: start; cursor: pointer; }
.me:hover { color: var(--text); }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.modal-card { position: relative; width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: grid; gap: 12px; }
.modal-card h3 { margin: 0; text-align: center; }
.modal-card input, .modal-card textarea { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); outline: none; resize: none; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.avatar-pick { display: grid; justify-items: center; gap: 8px; cursor: pointer; }
.avatar-pick-label { color: var(--c1); font-weight: 700; font-size: .9rem; }
.msg img.photo { display: block; max-width: 260px; max-height: 320px; border-radius: 12px; cursor: zoom-in; margin: -2px -6px 4px; }
.msg .fa-check-double.seen { color: #7dd3fc; }
.msg.mine .fa-check-double.seen { color: #bae6fd; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: grid; place-items: center; cursor: zoom-out; }
.viewer img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }

/* v3: attach menu, emoji, voice preview, cards for every kind of message */
.composer { position: relative; }
.attach-wrap { position: relative; flex: none; }
.attach-menu { position: absolute; bottom: 52px; inset-inline-start: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 76px); gap: 6px; padding: 12px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.attach-menu button { border: 0; background: transparent; display: grid; justify-items: center; gap: 6px; padding: 6px 0; border-radius: 12px; font-size: .78rem; color: var(--text); }
.attach-menu button:hover { background: var(--panel-2); }
.attach-menu .ai { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.1rem; }
.emoji-panel { position: absolute; bottom: 64px; inset-inline-start: 12px; inset-inline-end: 12px; max-width: 380px; max-height: 260px; overflow-y: auto; z-index: 20; display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; padding: 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.emoji-panel button { border: 0; background: transparent; font-size: 1.45rem; border-radius: 10px; padding: 4px 0; }
.emoji-panel button:hover { background: var(--panel-2); }
.recording.ready { background: var(--panel-2); color: var(--text); padding: 0 6px; }
.recording.ready audio { flex: 1; height: 36px; min-width: 0; }
.composer.recording-on #textInput, .composer.recording-on #emojiBtn, .composer.recording-on .attach-wrap { display: none; }
.card { display: grid; gap: 8px; min-width: 220px; }
.card-head { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.card-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex: none; }
.card-sub { font-size: .8rem; opacity: .8; font-weight: 500; }
.card a { color: inherit; }
.file-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.map-link { display: block; text-decoration: none; border-radius: 12px; overflow: hidden; }
.map-box { height: 120px; display: grid; place-items: center; background: linear-gradient(135deg, #14532d, #166534); font-size: 2.2rem; color: #fff; }
.choice { position: relative; overflow: hidden; display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: start; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: inherit; }
.choice .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: rgba(255, 255, 255, .16); z-index: 0; transition: width .3s; }
.choice span { position: relative; z-index: 1; }
.choice.on { border-color: #fff; font-weight: 800; }
.rsvp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rsvp .choice { justify-content: center; flex-direction: column; align-items: center; text-align: center; font-size: .8rem; }
.contact-btn { border: 0; border-radius: 10px; padding: 8px; background: rgba(255, 255, 255, .16); color: inherit; font-weight: 700; text-decoration: none; text-align: center; }
.poll-opts { display: grid; gap: 8px; }
.poll-opts input { width: 100%; }
.ct-results { display: grid; gap: 4px; max-height: 180px; overflow-y: auto; }
.ct-results .row.on { background: rgba(99, 102, 241, .25); }
@media (max-width: 760px) {
  .attach-menu { grid-template-columns: repeat(4, 68px); }
}

/* v4: message menu, replies, pins */
.msg { position: relative; }
.msg-menu-btn { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; font-size: .8rem; }
.msg:hover .msg-menu-btn, .msg-menu-btn:focus-visible { opacity: 1; }
@media (hover: none) { .msg-menu-btn { opacity: .75; } }
.msg-menu { position: fixed; z-index: 70; min-width: 190px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); display: grid; }
.msg-menu button { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; text-align: start; color: var(--text); }
.msg-menu button:hover { background: var(--panel-2); }
.msg-menu button i { width: 18px; color: var(--muted); }
.msg-menu button.danger, .msg-menu button.danger i { color: #f87171; }
.quote { display: block; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--c1); background: rgba(0, 0, 0, .2); color: inherit; border-radius: 8px; padding: 5px 8px; margin-bottom: 5px; font-size: .82rem; cursor: pointer; }
.msg.mine .quote { border-color: #fff; }
.quote b { display: block; font-size: .78rem; }
.quote span { display: block; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-top: 1px solid var(--line); color: var(--c1); }
.reply-text { flex: 1; min-width: 0; border-inline-start: 3px solid var(--c1); padding-inline-start: 8px; color: var(--text); font-size: .86rem; }
.reply-text b { display: block; color: var(--c1); }
.reply-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.pinned-bar { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px; color: var(--text); text-align: start; font-size: .86rem; }
.pinned-bar i { color: #fbbf24; }
.pinned-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-mark { color: #fbbf24; font-size: .7rem; }
.msg.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px #fbbf24; } 100% { box-shadow: none; } }

/* v5: glass bubbles */
.thread {
  background:
    radial-gradient(circle at 15% 20%, rgba(6, 182, 212, .22), transparent 38%),
    radial-gradient(circle at 85% 70%, rgba(99, 102, 241, .26), transparent 42%),
    radial-gradient(circle at 50% 110%, rgba(236, 72, 153, .14), transparent 40%),
    var(--bg);
}
.msg {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.msg.mine {
  background: linear-gradient(135deg, rgba(6, 182, 212, .38), rgba(99, 102, 241, .42));
  border-color: rgba(165, 180, 252, .35);
  color: #fff;
}
.msg .card-icon, .contact-btn, .choice { background: rgba(255, 255, 255, .1); }
.map-box { background: linear-gradient(135deg, rgba(34, 197, 94, .45), rgba(20, 83, 45, .6)); }
.msg audio { border-radius: 999px; }
.voice-len { font-size: .72rem; opacity: .8; margin-inline-start: 6px; }
.thread-head, .composer, .reply-bar, .pinned-bar {
  background: rgba(18, 26, 48, .72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.day { background: rgba(255, 255, 255, .08); backdrop-filter: blur(10px); }
.blocked-note { padding: 14px; text-align: center; color: var(--muted); background: rgba(18, 26, 48, .72); border-top: 1px solid var(--line); }
.blocked-note button { margin-top: 8px; border: 0; border-radius: 10px; padding: 8px 16px; background: var(--panel-2); color: var(--text); font-weight: 700; }
#chatMenu { min-width: 210px; }

/* v6: someone's profile */
.peer { cursor: pointer; border-radius: 12px; padding: 4px 6px; }
.peer:hover { background: rgba(255, 255, 255, .06); }
.peer-card { justify-items: center; text-align: center; padding-top: 28px; background: linear-gradient(180deg, rgba(6, 182, 212, .25), transparent 140px), var(--panel); }
.peer-card .avatar.xl { width: 112px; height: 112px; font-size: 2.4rem; box-shadow: 0 0 0 4px var(--panel), 0 0 0 7px rgba(99, 102, 241, .6); }
.peer-card .online-dot { width: 18px; height: 18px; border-width: 3px; }
.pc-name { font-size: 1.35rem; font-weight: 900; margin: 6px 0 0; }
.pc-user { color: var(--muted); margin: 0; }
.pc-status { font-size: .85rem; color: #4ade80; margin: 0; }
.pc-status.off { color: var(--muted); }
.pc-bio { margin: 4px 0; padding: 10px 14px; border-radius: 14px; background: var(--panel-2); width: 100%; white-space: pre-wrap; }
.pc-joined { color: var(--muted); font-size: .8rem; margin: 0; }
.pc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin-top: 6px; }
.pc-actions button { border: 0; border-radius: 14px; padding: 12px 6px; background: var(--panel-2); color: var(--text); display: grid; gap: 6px; justify-items: center; font-size: .8rem; font-weight: 700; }
.pc-actions button i { font-size: 1.15rem; color: var(--c1); }
.pc-actions button.danger i { color: #f87171; }

/* v7: stories */
.story-bar { display: flex; gap: 12px; overflow-x: auto; padding: 4px 14px 12px; scrollbar-width: none; flex: none; }
.story-bar::-webkit-scrollbar { display: none; }
.st-item { border: 0; background: transparent; display: grid; justify-items: center; gap: 5px; width: 66px; flex: none; color: var(--text); font-size: .74rem; }
.st-ring { position: relative; padding: 3px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6); }
.st-ring.seen { background: rgba(255, 255, 255, .2); }
.st-ring.none { background: transparent; border: 2px dashed rgba(255, 255, 255, .25); padding: 1px; }
.st-ring .avatar { width: 56px; height: 56px; border: 3px solid var(--panel); }
.st-plus { position: absolute; inset-inline-end: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; display: grid; place-items: center; font-size: .7rem; border: 2px solid var(--panel); }
.st-name { max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-view { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; align-items: center; justify-content: center; }
.sv-stage { width: min(100vw, calc(100dvh * 9 / 16)); height: 100dvh; display: grid; place-items: center; overflow: hidden; position: relative; }
.sv-stage img, .sv-stage video { width: 100%; height: 100%; object-fit: contain; }
.sv-text { width: 100%; height: 100%; display: grid; place-items: center; padding: 30px; text-align: center; font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 800; color: #fff; white-space: pre-wrap; word-break: break-word; }
.sv-caption { position: absolute; bottom: 90px; inset-inline: 0; padding: 10px 18px; text-align: center; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
.sv-bars { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(100vw, calc(100dvh * 9 / 16)); padding: 0 10px; display: flex; gap: 4px; z-index: 3; }
.sv-bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.sv-bar i { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 10px); left: 50%; transform: translateX(-50%); width: min(100vw, calc(100dvh * 9 / 16)); padding: 0 8px; display: flex; align-items: center; gap: 6px; z-index: 3; color: #fff; }
.sv-who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 800; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.sv-who small { font-weight: 500; opacity: .8; }
.sv-btn { color: #fff; }
.sv-tap { position: absolute; top: 90px; bottom: 90px; width: 35%; border: 0; background: transparent; z-index: 2; cursor: pointer; }
.sv-tap.prev { left: 0; }
.sv-tap.next { right: 0; }
.sv-reply { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(94vw, 480px); display: flex; gap: 8px; z-index: 3; }
.sv-reply input { flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .4); background: rgba(0, 0, 0, .35); color: #fff; outline: none; }
.sv-seen { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 3; border: 0; border-radius: 999px; padding: 8px 16px; background: rgba(0, 0, 0, .45); color: #fff; font-weight: 700; }
.sv-viewers { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100vw, 480px); max-height: 55vh; overflow-y: auto; z-index: 4; background: var(--panel); border-radius: 20px 20px 0 0; padding: 14px; }
.story-preview { position: relative; border-radius: 16px; overflow: hidden; min-height: 180px; display: grid; place-items: center; background: #6366f1; }
.story-preview textarea { width: 100%; min-height: 180px; border: 0; background: transparent; color: #fff; font-size: 1.25rem; font-weight: 800; text-align: center; padding: 20px; resize: none; outline: none; }
.story-preview textarea::placeholder { color: rgba(255, 255, 255, .7); }
.story-preview img, .story-preview video { width: 100%; max-height: 300px; object-fit: contain; background: #000; }
.story-preview.media textarea { min-height: 60px; font-size: 1rem; font-weight: 600; background: rgba(0, 0, 0, .55); position: absolute; bottom: 0; }
.story-colors { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.story-colors button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; }
.story-colors button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c1); }
.story-quote { display: block; width: 100%; border: 0; text-align: start; color: inherit; padding: 0; background: transparent; margin-bottom: 6px; }
.story-quote .sq-box { display: flex; gap: 8px; align-items: center; border-inline-start: 3px solid #f59e0b; background: rgba(0, 0, 0, .2); border-radius: 8px; padding: 5px 8px; font-size: .8rem; }
.story-quote img, .story-quote .sq-color { width: 34px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; }

/* v8: settings */
.settings { position: fixed; inset: 0; z-index: 75; background: var(--bg); overflow-y: auto; }
.set-wrap { max-width: 640px; margin: 0 auto; min-height: 100%; padding-bottom: 40px; }
.set-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(11, 16, 32, .85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.set-head h2 { margin: 0; font-size: 1.15rem; }
.set-body { padding: 14px; display: grid; gap: 14px; }
.set-me { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; background: linear-gradient(135deg, rgba(6, 182, 212, .2), rgba(99, 102, 241, .22)); border: 1px solid var(--line); cursor: pointer; text-align: start; color: var(--text); width: 100%; }
.set-me .avatar { width: 64px; height: 64px; font-size: 1.5rem; }
.set-group { border-radius: 18px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; background: transparent; color: var(--text); text-align: start; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
button.set-row:hover { background: var(--panel-2); }
.set-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; }
.set-text { flex: 1; min-width: 0; }
.set-text b { display: block; }
.set-text small { color: var(--muted); }
.set-row .fa-chevron-right, .set-row .fa-chevron-left { color: var(--muted); font-size: .8rem; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .18); transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: linear-gradient(135deg, var(--c1), var(--c2)); }
.switch input:checked + span::after { inset-inline-start: 23px; }
.set-label { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; margin: 4px 0 -6px; }
.set-card { padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); display: grid; gap: 10px; }
.set-card input, .set-card textarea, .set-card select { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); outline: none; resize: vertical; }
.plan { padding: 20px; border-radius: 20px; background: linear-gradient(135deg, #06b6d4, #6366f1 60%, #ec4899); color: #fff; display: grid; gap: 6px; }
.plan h3 { margin: 0; font-size: 1.4rem; }
.plan ul { margin: 6px 0 0; padding-inline-start: 18px; line-height: 1.8; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 8px; border-radius: 14px; background: var(--panel-2); text-align: center; }
.stat b { display: block; font-size: 1.2rem; }
.stat small { color: var(--muted); font-size: .75rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }
.wall { width: 64px; height: 90px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; }
.wall.on { border-color: var(--text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--panel-2); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.seg button.on { background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; }
.qr-card { justify-items: center; text-align: center; }
.qr-box { padding: 14px; background: #fff; border-radius: 18px; }
.qr-box img, .qr-box canvas { display: block; }
.scan-video { width: 100%; max-height: 50vh; border-radius: 16px; background: #000; }
details.faq { border-radius: 14px; background: var(--panel-2); padding: 12px 14px; }
details.faq summary { cursor: pointer; font-weight: 700; }
details.faq p { margin: 8px 0 0; color: var(--muted); }
.ev-row { cursor: pointer; }
.ev-date { width: 50px; flex: none; text-align: center; border-radius: 12px; background: var(--panel-2); padding: 6px 0; }
.ev-date b { display: block; font-size: 1.2rem; }
.ev-date small { color: var(--c1); font-weight: 800; font-size: .7rem; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.pick-row input { width: 20px; height: 20px; }
.list-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 8px; flex: none; scrollbar-width: none; }
.list-chips button { flex: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.list-chips button.on { background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; border-color: transparent; }

/* Styles chosen in Settings */
body.solid .msg { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--theirs); }
body.solid .msg.mine { background: linear-gradient(135deg, var(--c1), var(--c2)); }
body.text-s { font-size: 14px; }
body.text-l { font-size: 17px; }
body.light {
  --bg: #eef2ff; --panel: #ffffff; --panel-2: #eef1f8; --line: rgba(15, 23, 42, .1);
  --text: #0f172a; --muted: #64748b; --theirs: #ffffff; color-scheme: light;
}
body.light .msg { background: rgba(255, 255, 255, .75); border-color: rgba(15, 23, 42, .08); color: var(--text); }
body.light .msg.mine { color: #fff; }
body.light .thread-head, body.light .composer, body.light .reply-bar, body.light .pinned-bar, body.light .blocked-note, body.light .set-head { background: rgba(255, 255, 255, .8); }
body.light .msg .card-icon, body.light .contact-btn, body.light .choice { background: rgba(15, 23, 42, .06); }
body.light .msg.mine .card-icon, body.light .msg.mine .contact-btn, body.light .msg.mine .choice { background: rgba(255, 255, 255, .18); }
body.light .switch span { background: rgba(15, 23, 42, .15); }

/* Premium: blue tick, gift cards, subscription page */
.verified { color: #1d9bf0; font-size: .85em; margin-inline-start: 3px; }
.gift-card { display: flex; align-items: center; gap: 12px; min-width: 210px; padding: 12px 14px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #fbbf24, #f97316); box-shadow: 0 8px 20px rgba(249, 115, 22, .35); }
.gift-card > i { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, .25); }
.gift-card > span { display: grid; line-height: 1.2; }
.gift-card b { font-size: 1.6rem; font-weight: 900; }
.plan.on { background: linear-gradient(135deg, #1d9bf0, var(--c2)); }
.plan-points { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 4px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .18); }
.plan-points b { font-size: 1.4rem; }
.bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--c1), var(--c2)); }
.btn-main:disabled { opacity: .55; cursor: not-allowed; }

/* Get the Android app */
.app-dl { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 16px; border-radius: 16px; text-decoration: none; color: #fff; background: linear-gradient(120deg, #22c55e, #14b8a6); box-shadow: 0 10px 24px rgba(34, 197, 94, .3); }
.app-dl:hover { filter: brightness(1.06); }
.app-dl > i:first-child { font-size: 1.7rem; }
.app-dl span { display: grid; flex: 1; line-height: 1.25; text-align: start; }
.app-dl small { opacity: .9; font-size: .78rem; }
