:root {
  --bg: #0e1621;
  --side: #17212b;
  --side-hover: #202b36;
  --side-active: #2b5278;
  --header: #17212b;
  --border: #101921;
  --in: #182533;
  --out: #2b5278;
  --text: #f5f5f5;
  --muted: #7f91a4;
  --accent: #5ea5e8;
  --accent-2: #4c8fd1;
  --online: #4fbe79;
  --danger: #e5646b;
  --gold: #ffc53d;
  --input: #242f3d;
  --radius: 12px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: var(--text); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ffffff22; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 20px; text-align: center; margin: 12px 0 0; }
.link { color: var(--accent); padding: 6px 0; }
.link:hover { text-decoration: underline; }
.row-between { display: flex; justify-content: space-between; margin-top: 10px; }
.screen { height: 100%; }

/* ---------------- кнопки / поля ---------------- */
.btn {
  padding: 11px 18px; border-radius: 10px; font-weight: 600;
  background: var(--input); transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.primary { background: var(--accent-2); color: #fff; }
.btn.gold { background: linear-gradient(135deg, #ffb800, #ff8a00); color: #1b1300; }
.btn.danger { background: #5a2a2e; color: #ffb3b7; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); flex: none;
}
.icon-btn:hover { background: #ffffff10; color: var(--text); }

.field { display: block; position: relative; margin: 18px 0; text-align: left; }
.field span {
  position: absolute; top: -9px; left: 12px; padding: 0 6px; font-size: 12px;
  color: var(--accent); background: var(--side);
}
.field input, .field textarea {
  width: 100%; padding: 14px; border-radius: 10px; outline: none; resize: none;
  background: transparent; border: 1.5px solid #3a4756;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }

/* ---------------- вход ---------------- */
#login { display: grid; place-items: center; padding: 16px; }
.login-box {
  width: 100%; max-width: 380px; text-align: center; background: var(--side);
  padding: 36px 28px 24px; border-radius: 18px;
}
.login-box .logo img { width: 110px; height: 110px; filter: drop-shadow(0 8px 30px #6b6cff55); }
.login-box h1 { margin: 14px 0 6px; font-size: 26px; }
#numInput, #codeInput { font-size: 20px; letter-spacing: 1px; text-align: center; }
#codeInput { letter-spacing: 12px; }

/* ---------------- раскладка ---------------- */
#app { display: flex; }
#sidebar {
  width: 360px; flex: none; background: var(--side); display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative;
  background:
    radial-gradient(circle at 20% 20%, #1c2d4033 0, transparent 40%),
    radial-gradient(circle at 80% 70%, #2a1f4a33 0, transparent 45%),
    var(--bg);
}
.side-top { display: flex; gap: 8px; align-items: center; padding: 8px 12px; }
.search-wrap { flex: 1; position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 9px; width: 18px; height: 18px; color: var(--muted); }
#search {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 20px; border: 1.5px solid transparent;
  background: var(--input); outline: none;
}
#search:focus { border-color: var(--accent); background: transparent; }

/* ---------------- список чатов ---------------- */
#dialogList { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.section-title { color: var(--muted); font-size: 13px; padding: 10px 12px 4px; }
.dialog {
  display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.dialog:hover { background: var(--side-hover); }
.dialog.active { background: var(--side-active); }
.dialog .body { flex: 1; min-width: 0; }
.dialog .top, .dialog .bottom { display: flex; align-items: center; gap: 6px; }
.dialog .name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.dialog .time { color: var(--muted); font-size: 12px; flex: none; }
.dialog .preview { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog.active .preview, .dialog.active .time { color: #c9dcef; }
.dialog .preview .you { color: var(--text); }
.badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent-2);
  color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none;
}
.dialog.active .badge { background: #fff; color: var(--side-active); }
.empty-list { color: var(--muted); text-align: center; padding: 30px 20px; }

/* ---------------- аватары ---------------- */
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px; position: relative; user-select: none;
}
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 110px; height: 110px; font-size: 40px; }
.avatar.system { background: linear-gradient(135deg, #7b5cff, #2aa3ef) !important; }
.avatar.system img { width: 100%; height: 100%; }
.avatar .dot {
  position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--online); border: 2.5px solid var(--side);
}
.verified {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 10px; flex: none;
}

/* ---------------- чат ---------------- */
#emptyChat { flex: 1; display: grid; place-items: center; }
.empty-pill { background: #0000004d; padding: 6px 14px; border-radius: 16px; color: #dfe7ef; font-size: 14px; }
#chatView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#chatHeader {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-height: 56px;
  background: var(--header); border-bottom: 1px solid var(--border);
}
#backBtn { display: none; }
#chatPeer { flex: 1; display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
#chatPeer .title { font-weight: 600; display: flex; align-items: center; gap: 5px; }
#chatPeer .status { font-size: 13px; color: var(--muted); }
#chatPeer .status.online, #chatPeer .status.typing { color: var(--accent); }
.gift-btn { font-size: 20px; }

#messages { flex: 1; overflow-y: auto; padding: 12px max(12px, calc(50% - 380px)); display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; margin: 10px 0 6px; }
.day span { background: #0000004d; padding: 3px 11px; border-radius: 12px; font-size: 13px; color: #e8eef4; }
.msg {
  max-width: min(480px, 78%); padding: 6px 10px 6px 12px; border-radius: 14px; position: relative;
  word-wrap: break-word; animation: pop .16s ease-out;
}
.msg.in { background: var(--in); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--out); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .text { white-space: pre-wrap; }
.msg .meta {
  float: right; margin: 6px 0 -4px 10px; font-size: 12px; color: #ffffff80; display: flex; gap: 3px; align-items: center;
}
.msg.out .meta { color: #a8c8ec; }
.msg .ticks { font-size: 13px; letter-spacing: -4px; margin-right: 3px; }
.msg .ticks.read { color: #6fc3ff; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* звёзды */
.msg.stars { background: linear-gradient(145deg, #3b2a05, #6a4700); border: 1px solid #ffb80055; min-width: 200px; }
.stars-card { text-align: center; padding: 6px 4px 2px; }
.stars-card .big { font-size: 42px; line-height: 1.1; filter: drop-shadow(0 0 16px #ffc53d88); }
.stars-card .amount { font-size: 20px; font-weight: 800; color: var(--gold); }
.stars-card .sub { color: #ffe7ad; font-size: 13px; }
.stars-card .note { margin-top: 6px; white-space: pre-wrap; }

/* подарки (как в Telegram: анимированный стикер на градиентном фоне) */
.sticker { display: block; margin: 0 auto; width: 88px; height: 88px; object-fit: contain; pointer-events: none; user-select: none;
  filter: drop-shadow(0 6px 14px #00000040); }
.emoji-fallback { font-size: 64px; line-height: 88px; text-align: center; }
.msg.gift { border: 0; width: 240px; cursor: pointer; color: #fff; overflow: hidden; position: relative; }
.msg.gift::after, .gift-hero::after, .gift-item::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18; border-radius: inherit;
  background-image: radial-gradient(#fff 1.2px, transparent 1.6px); background-size: 22px 22px;
  mask-image: radial-gradient(circle at 50% 40%, transparent 30%, #000 80%);
}
.msg.gift:hover { filter: brightness(1.07); }
.msg.gift .meta { color: #ffffffb3; position: relative; z-index: 1; }
.gift-card { text-align: center; padding: 6px 4px 2px; position: relative; z-index: 1; }
.gift-card .sticker { width: 150px; height: 150px; }
.gift-card .emoji-fallback { font-size: 100px; line-height: 150px; }
.gift-card .gname { font-size: 17px; font-weight: 800; text-shadow: 0 1px 6px #0005; }
.gift-card .sub { color: #ffffffcc; font-size: 13px; }
.gift-card .note { margin-top: 6px; white-space: pre-wrap; }
.gift-card .action { margin-top: 8px; display: inline-block; padding: 5px 14px; border-radius: 14px; background: #ffffff30; font-size: 13px; font-weight: 600; backdrop-filter: blur(4px); }
@keyframes float { 50% { transform: translateY(-5px) rotate(-3deg); } }
.serial { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: #00000040; color: #fff; }
.serial.corner { position: absolute; top: 6px; left: 6px; z-index: 2; }

/* упоминания, каналы, юзернеймы */
.mention { color: #8cc8ff; text-decoration: none; font-weight: 500; }
.mention:hover { text-decoration: underline; }
.msg.out .mention { color: #bfe0ff; }
.msg.post { max-width: min(560px, 86%); }
.post-author { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.ch-ic { font-size: 13px; flex: none; }
.join-btn { width: 100%; padding: 6px; color: var(--accent); font-weight: 700; letter-spacing: .5px; font-size: 15px; }
.join-btn.muted { color: var(--muted); font-weight: 500; letter-spacing: 0; }
#readonlyBar:has(.join-btn) { padding: 8px 16px; }
.un-field { margin-bottom: 6px; }
.un-field i { position: absolute; left: 14px; top: 14px; font-style: normal; color: var(--muted); }
.un-field input { padding-left: 30px !important; }
.un-hint { margin: 0 0 16px 4px; min-height: 18px; text-align: left; }
.un-hint.good { color: var(--online); }
.un-hint.bad { color: var(--danger); }

/* Premium, лимитки в нике, комментарии */
.status-emoji { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.pname .status-emoji { width: 28px; height: 28px; }
.premium-badge { font-size: 13px; flex: none; filter: drop-shadow(0 0 4px #8e7cffaa); }
.prem-tag { position: absolute; top: 6px; left: 8px; z-index: 2; font-size: 14px; filter: drop-shadow(0 1px 3px #0008); }
.ep-cats button.prem { position: relative; }
.ep-cats button.prem::after { content: "💎"; position: absolute; right: -2px; bottom: -2px; font-size: 10px; }
.sticker-grid button.locked { opacity: .45; }
.prem-hero { text-align: center; margin-bottom: 14px; }
.prem-hero .big { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 22px #8e7cffcc); animation: float 3s ease-in-out infinite; }
.prem-hero h2 { margin: 8px 0 4px; background: linear-gradient(90deg, #b99bff, #6fd3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.perk { display: flex; gap: 14px; align-items: center; padding: 10px 6px; border-bottom: 1px solid #ffffff0a; text-align: left; }
.perk .ic { font-size: 24px; width: 32px; text-align: center; }
.comments-btn { display: block; width: calc(100% + 22px); margin: 8px -10px -6px -12px; padding: 8px 12px; text-align: left;
  border-top: 1px solid #ffffff14; color: var(--accent); font-size: 14px; font-weight: 600; border-radius: 0 0 14px 14px; clear: both; }
.comments-btn:hover { background: #ffffff08; }
.comments-modal h2 { margin-bottom: 8px; }
.c-post { background: var(--bg); border-radius: 10px; padding: 10px 12px; color: #d8e2ec; font-size: 14px; white-space: pre-wrap; margin-bottom: 10px; }
.comments { max-height: 46vh; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.c-body { background: var(--in); border-radius: 12px; padding: 6px 12px; min-width: 0; max-width: 100%; }
.c-head { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.c-text { white-space: pre-wrap; word-wrap: break-word; }
.c-empty { text-align: center; padding: 24px 0; }
.c-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.c-input textarea { flex: 1; padding: 11px 14px; border-radius: 20px; border: 0; background: var(--bg); resize: none; outline: none; }

/* плашка «включите уведомления» */
#pushBanner { display: flex; align-items: center; gap: 8px; margin: 0 10px 8px; padding: 10px 10px 10px 14px; border-radius: 12px;
  background: linear-gradient(135deg, #2b3f63, #3a2b63); font-size: 13px; }
#pushBanner span { flex: 1; }
#pushBanner .btn.small { padding: 7px 12px; font-size: 13px; }
#pushBanner .icon-btn { width: 30px; height: 30px; font-size: 13px; }

/* аккаунты в меню */
.accounts { border-bottom: 1px solid #ffffff10; padding: 4px 0; }
.account-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 18px; text-align: left; }
.account-row:hover { background: var(--side-hover); }
.account-row .avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.acc-text { min-width: 0; }
.acc-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-num { color: var(--muted); font-size: 12px; }
.acc-plus { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--accent); background: #5ea5e81a; flex: none; }
.account-row.add .acc-name { color: var(--accent); }
#cancelAdd { display: block; margin: 6px auto 0; }

/* звонки */
.call {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 60px 20px 40px; color: #fff; animation: fade .2s;
  background: radial-gradient(circle at 50% 30%, #2b4c7e 0%, #16243a 55%, #0b1320 100%);
}
.call.video { background: #000; }
.call > video:not(.local) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call > video.local {
  position: absolute; right: 16px; top: 16px; width: 26%; max-width: 220px; aspect-ratio: 3/4; object-fit: cover;
  border-radius: 14px; box-shadow: 0 6px 24px #000a; z-index: 2; transform: scaleX(-1);   /* фронталка — зеркально */
}
.call > video.local.back { transform: none; }
.call-ui { position: relative; z-index: 1; flex: 1; width: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; }
.call-info { position: relative; z-index: 1; text-align: center; margin-top: 4vh; text-shadow: 0 1px 8px #0008; }
.call-info .avatar { margin: 0 auto 18px; width: 128px; height: 128px; font-size: 46px; box-shadow: 0 0 0 10px #ffffff10, 0 0 0 22px #ffffff08; }
.call-name { font-size: 26px; font-weight: 700; display: flex; gap: 6px; align-items: center; justify-content: center; }
.call-status { margin-top: 6px; color: #cfe0f5; font-size: 16px; font-variant-numeric: tabular-nums; }
.call-key { margin-top: 12px; display: inline-block; padding: 5px 12px; border-radius: 14px; background: #ffffff1a; font-size: 18px; letter-spacing: 2px; }
.call-buttons { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; max-width: 460px; }
@media (max-width: 480px) {
  .call-buttons { gap: 12px 10px; }
  .cbtn { width: 64px !important; }
  .cbtn .ic { width: 54px !important; height: 54px !important; font-size: 22px !important; }
}
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 76px; color: #fff; }
.cbtn .ic {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 26px;
  background: #ffffff26; backdrop-filter: blur(6px); transition: transform .1s, filter .1s;
}
.cbtn:hover .ic { filter: brightness(1.15); transform: scale(1.05); }
.cbtn span { font-size: 12px; color: #dfe9f5; text-shadow: 0 1px 4px #0008; }
.cbtn.on .ic { background: #ffffffe6; }
.cbtn.decline .ic { background: #e5484d; }
.cbtn.accept .ic { background: #2fb35a; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } 50% { transform: rotate(0); } }
.call-msg { display: flex; align-items: center; gap: 8px; }
.call-msg .text { flex: 1; }
.call-again { font-size: 18px; padding: 0 2px; }

/* соединение и шифрование */
#connStatus { display: flex; align-items: center; gap: 8px; padding: 2px 18px 8px; color: var(--muted); font-size: 14px; }
.conn-login { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); margin: 0 0 8px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #ffffff22; border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.lock { font-size: 12px; margin-right: 2px; }
.e2e-note { align-self: center; max-width: 360px; text-align: center; margin: 10px 0; }
.e2e-note span { display: inline-block; background: #0000004d; padding: 8px 14px; border-radius: 12px; font-size: 13px; color: #e8eef4; }
.msg.locked .text { color: var(--muted); font-style: italic; }
.fp { font-size: 22px; letter-spacing: 4px; }

/* магазин звёзд */
.shop-hero { text-align: center; margin-bottom: 14px; }
.shop-hero .big { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 22px #ffc53d99); animation: float 3s ease-in-out infinite; }
.shop-hero h2 { margin: 8px 0 4px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pack { padding: 12px 6px; border-radius: 12px; background: var(--bg); border: 1.5px solid transparent; text-align: center; }
.pack:hover { border-color: #ffc53d66; }
.pack.on { border-color: var(--gold); background: #ffc53d14; }
.pack .blx { color: var(--gold); font-weight: 800; font-size: 16px; }
.pack .tg { color: var(--muted); font-size: 12px; margin-top: 2px; }
.shop-calc { text-align: center; margin: -6px 0 12px; min-height: 20px; }
.shop-calc b { color: var(--gold); }
.shop-calc .bad { color: var(--danger); }
button.stars-chip { cursor: pointer; }

/* группы */
.service-msg { align-self: center; margin: 6px 0; max-width: 80%; text-align: center; }
.service-msg span { display: inline-block; background: #0000004d; padding: 4px 12px; border-radius: 12px; font-size: 13px; color: #e8eef4; }
.members-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 6px; color: var(--muted); font-size: 14px; }
.members { text-align: left; max-height: 320px; overflow-y: auto; }
.members.pick { max-height: 300px; margin-top: 4px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.member:hover { background: #ffffff08; }
.member.sel { background: #2b527855; }
.member-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.member .mname { font-weight: 600; display: flex; align-items: center; gap: 5px; }
.role-tag { font-size: 12px; color: var(--accent); }
.danger-link { color: var(--danger); font-size: 13px; }
.check-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3a4756; display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.member.sel .check-dot { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* стикеры в чате — без «пузыря», как в Telegram */
.msg.sticker-msg { background: none !important; padding: 0; border: 0; }
.sticker-img { display: block; width: 180px; height: 180px; object-fit: contain; }
.msg.sticker-msg .meta { float: none; display: inline-flex; margin: 0; padding: 2px 8px; border-radius: 10px; background: #0000004d; color: #fff; }
.msg.sticker-msg.out { text-align: right; }

/* реакции */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; clear: both; }
.rx { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: #ffffff1a; font-size: 14px; }
.rx b { font-size: 12px; font-weight: 700; }
.rx.mine { background: var(--accent-2); color: #fff; }
.msg.out .rx { background: #ffffff26; }
.msg.out .rx.mine { background: #fff; color: var(--out); }
.rx-add {
  position: absolute; bottom: 2px; width: 26px; height: 26px; border-radius: 50%; background: var(--side);
  color: var(--muted); font-size: 16px; opacity: 0; transition: opacity .12s; box-shadow: 0 1px 4px #0006;
}
.msg.in .rx-add { right: -32px; }
.msg.out .rx-add { left: -32px; }
.msg:hover .rx-add { opacity: 1; }
.rx-bar {
  position: fixed; z-index: 50; display: flex; gap: 2px; padding: 5px 8px; border-radius: 22px;
  background: var(--side); box-shadow: 0 6px 24px #0008; animation: pop .15s ease-out;
}
.rx-bar button { font-size: 24px; width: 36px; height: 36px; border-radius: 50%; transition: transform .1s; }
.rx-bar button:hover { transform: scale(1.25); background: #ffffff10; }

/* панель эмодзи и стикеров */
#emojiPanel {
  position: absolute; bottom: 70px; left: max(12px, calc(50% - 380px)); width: 360px; max-width: calc(100% - 24px);
  height: 380px; background: var(--side); border-radius: 14px; box-shadow: 0 10px 40px #000a;
  display: flex; flex-direction: column; overflow: hidden; z-index: 20; animation: pop .15s ease-out;
}
.ep-tabs { display: flex; gap: 4px; padding: 8px 8px 4px; }
.ep-tabs button { flex: 1; padding: 7px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; }
.ep-tabs button.on { background: var(--side-active); color: #fff; }
.ep-cats { display: flex; gap: 2px; padding: 0 8px 6px; border-bottom: 1px solid #ffffff10; overflow-x: auto; flex: none; }
.ep-cats button { width: 36px; height: 36px; border-radius: 9px; font-size: 20px; flex: none; display: grid; place-items: center; }
.ep-cats button.on { background: #ffffff14; }
.ep-cats img { width: 28px; height: 28px; }
.ep-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px; align-content: start; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.emoji-grid button { font-size: 24px; height: 40px; border-radius: 8px; }
.emoji-grid button:hover { background: #ffffff12; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.sticker-grid .pack-title { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding: 2px 4px 4px; }
.sticker-grid button { aspect-ratio: 1; border-radius: 10px; padding: 4px; }
.sticker-grid button:hover { background: #ffffff10; }
.sticker-grid img { width: 100%; height: 100%; object-fit: contain; }
#composer #emojiBtn { width: 46px; height: 46px; }

/* ---------------- поле ввода ---------------- */
#composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px max(12px, calc(50% - 380px)) 12px;
}
#msgInput {
  flex: 1; max-height: 160px; padding: 12px 16px; border-radius: 22px; border: 0; outline: none;
  background: var(--side); resize: none; line-height: 1.35;
}
.send-btn {
  width: 46px; height: 46px; border-radius: 50%; background: var(--accent-2); color: #fff; display: grid; place-items: center; flex: none;
}
.send-btn svg { fill: #fff; stroke: none; }
#readonlyBar { text-align: center; padding: 16px; color: var(--muted); background: var(--side); }

/* ---------------- меню ---------------- */
#drawer { position: fixed; inset: 0; z-index: 30; }
.drawer-bg { position: absolute; inset: 0; background: #00000080; animation: fade .2s; }
.drawer-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: 290px; background: var(--side);
  animation: slide .22s ease-out; display: flex; flex-direction: column;
}
.drawer-head { padding: 20px 18px 14px; background: linear-gradient(135deg, #2b3f63, #3a2b63); }
.drawer-head .name { font-weight: 700; font-size: 16px; margin-top: 12px; display: flex; gap: 5px; align-items: center; }
.drawer-head .num { color: #c9d4e3; font-size: 14px; }
.stars-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 4px 11px;
  border-radius: 14px; background: #00000040; color: var(--gold); font-weight: 700;
}
.drawer-item { display: flex; align-items: center; gap: 18px; padding: 13px 20px; text-align: left; width: 100%; }
.drawer-item:hover { background: var(--side-hover); }
.drawer-item .ic { width: 22px; text-align: center; font-size: 18px; }
.drawer-foot { margin-top: auto; padding: 16px 20px; color: var(--muted); font-size: 13px; }
@keyframes slide { from { transform: translateX(-100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------------- модальные окна ---------------- */
.modal-wrap { position: fixed; inset: 0; z-index: 40; background: #00000099; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--side);
  border-radius: 16px; padding: 20px; position: relative; animation: pop .18s ease-out;
}
.modal.wide { max-width: 560px; }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal .close { position: absolute; right: 10px; top: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.profile { text-align: center; }
.profile .avatar { margin: 6px auto 12px; }
.profile .pname { font-size: 21px; font-weight: 700; display: flex; justify-content: center; gap: 6px; align-items: center; }
.info-rows { text-align: left; margin: 16px 0 8px; background: var(--bg); border-radius: 12px; }
.info-row { padding: 10px 14px; border-bottom: 1px solid #ffffff0a; }
.info-row:last-child { border-bottom: 0; }
.info-row .v { white-space: pre-wrap; }
.info-row .k { color: var(--muted); font-size: 13px; }
.info-row.copy { cursor: pointer; }
.info-row.copy:hover { background: #ffffff08; }
.profile-actions { display: flex; gap: 10px; }
.profile-actions .btn { flex: 1; }

.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.tabs button { flex: 1; padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--side-active); color: #fff; }
.balance-line { text-align: center; margin-bottom: 12px; color: var(--muted); }
.balance-line b { color: var(--gold); }

.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.gift-item {
  border-radius: 14px; padding: 16px 6px 12px; text-align: center; position: relative; overflow: hidden;
  transition: transform .12s, filter .12s; color: #fff;
}
.gift-item:hover { transform: translateY(-2px); filter: brightness(1.08); }
.gift-item > * { position: relative; z-index: 1; }
.gift-item .sticker { width: 84px; height: 84px; margin-bottom: 8px; }
.gift-item .gname { font-size: 13px; font-weight: 700; margin: -2px 0 2px; text-shadow: 0 1px 4px #0006; }
.gift-item .price {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px 12px; border-radius: 14px;
  background: #ffffff38; color: #fff; font-weight: 800; font-size: 13px; backdrop-filter: blur(4px);
}
.gift-item .from { font-size: 11px; color: #ffffffcc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gift-item .ribbon {
  position: absolute; top: 12px; right: -30px; width: 110px; transform: rotate(45deg); z-index: 2;
  background: linear-gradient(90deg, #ff5a8a, #ff8a3d); font-size: 10px; font-weight: 800; padding: 2px 0;
  box-shadow: 0 2px 6px #0004;
}
.gift-item.soldout { filter: grayscale(.8) brightness(.7); pointer-events: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { padding: 6px 12px; border-radius: 16px; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600; }
.chips button.on { background: var(--accent-2); color: #fff; }

.gift-hero { text-align: center; padding: 18px 12px 16px; border-radius: 16px; margin-bottom: 6px; position: relative; overflow: hidden; color: #fff; }
.gift-hero > * { position: relative; z-index: 1; }
.gift-hero .sticker { width: 170px; height: 170px; }
.gift-hero .emoji-fallback { font-size: 110px; line-height: 170px; }
.gift-hero .gname { font-size: 22px; font-weight: 800; margin-top: 4px; text-shadow: 0 1px 6px #0005; }
.gift-hero .sub { color: #ffffffd9; }

.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.presets button { padding: 10px 0; border-radius: 10px; background: var(--bg); color: var(--gold); font-weight: 700; border: 1.5px solid transparent; }
.presets button.on { border-color: var(--gold); }

/* ---------------- уведомление ---------------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(30px); z-index: 60;
  background: #000000d9; color: #fff; padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------------- телефон ---------------- */
@media (max-width: 760px) {
  #sidebar { width: 100%; border-right: 0; }
  #chat { display: none; }
  body.chat-open #sidebar { display: none; }
  body.chat-open #chat { display: flex; }
  #backBtn { display: grid; }
  .msg { max-width: 86%; }
}

/* ---- «Нет Telegram? Получите номер через почту!» */
.email-cta { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px;
  border: 1px solid rgba(91,108,255,.45); border-radius: 12px; background: rgba(91,108,255,.12);
  color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.email-cta:hover { background: rgba(91,108,255,.22); }
.email-cta .ic { font-size: 26px; line-height: 1; }
.email-cta b { font-size: 15px; }
