/* ===== TRADES ===== */
.trade-card { background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; padding: 15px; }
.trade-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; margin-top: 12px; }
.trade-side { background: var(--card-2); border-radius: 14px; padding: 11px; }
.trade-side .side-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.trade-arrow { display: grid; place-items: center; color: var(--grad-b); }
.trade-arrow svg { width: 18px; height: 18px; }
.titem { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; font-weight: 700; }
.titem img { width: 30px; height: 38px; border-radius: 8px; object-fit: cover; }
.coin-offer {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--gold); font-weight: 800; font-size: 12.5px;
  padding: 4px 0;
}
.coin-offer::before { content:''; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #FFE7A8, #F5B93E 70%); }

.pill-tabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--stroke); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.pill-tab { flex: 1; text-align: center; padding: 9px 4px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--muted); transition: all .15s ease; }
.pill-tab.active { background: var(--gradient); color: var(--on-accent); }

.picked-items { display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.pick-slot { display: flex; align-items: center; gap: 8px; background: var(--card-2); border-radius: 11px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; }
.pick-slot img { width: 26px; height: 34px; border-radius: 7px; object-fit: cover; }
.pick-slot .rm { margin-left: auto; color: var(--danger); font-weight: 800; padding: 4px 7px; }

/* ===== CHAT ===== */
.conv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--stroke);
}
.conv-row:active { background: var(--hover-soft); }
.conv-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.conv-body { flex: 1; min-width: 0; }
.conv-name { font-weight: 800; font-size: 14.5px; }
.conv-last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.conv-time { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.conv-unread {
  min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--gradient);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center;
}

.chat-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 40px); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.msg-row { display: flex; gap: 8px; max-width: 84%; animation: msgIn .18s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px);} to {opacity:1;} }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  background: var(--card);
  border: 1px solid var(--stroke);
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-row.mine .msg-bubble {
  background: var(--gradient);
  border-color: transparent;
  color: var(--on-accent);
}
.msg-card {
  width: 190px;
  background: var(--card-2);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
}
.msg-card img { width: 100%; aspect-ratio: 3/3.4; object-fit: cover; }
.msg-card .mc-body { padding: 8px 10px 10px; }
.msg-card .mc-nm { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-time { font-size: 9.5px; opacity: .65; margin-top: 3px; }

.chat-composer {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 9px; align-items: center;
  padding: 10px 0 4px;
  background: linear-gradient(0deg, var(--bg) 72%, transparent);
}
.chat-composer input { border-radius: 999px; padding: 12px 18px; }
.send-btn {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(var(--accent-b-rgb),.4);
}
.send-btn svg { width: 20px; height: 20px; }
.attach-btn {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--stroke-strong);
  color: var(--cyan);
  display: grid; place-items: center;
}
.attach-btn svg { width: 21px; height: 21px; }

/* ===== NOTIFICATIONS ===== */
.notif-row {
  display: flex; gap: 12px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--stroke);
  align-items: flex-start;
  position: relative;
}
.notif-ic {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--card-2);
  border: 1px solid var(--stroke);
}
.notif-ic svg { width: 19px; height: 19px; }
.notif-row h4 { font-size: 14px; }
.notif-row p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 10.5px; color: var(--muted); margin-top: 5px; font-weight: 700; }
.unread-ind { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; background: var(--grad-b); box-shadow: 0 0 10px rgba(var(--accent-b-rgb),.7); }

/* ===== LEADERBOARD ===== */
.podium { display: flex; align-items: flex-end; gap: 8px; justify-content: center; margin: 18px 0 22px; }
.pod {
  flex: 1; max-width: 120px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px 16px 8px 8px;
  padding: 12px 8px;
  text-align: center;
}
.pod .p-av {
  width: 46px; height: 46px; margin: 0 auto 8px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; color: var(--muted);
  background: var(--card-2);
}
.pod.first .p-av { width: 58px; height: 58px; background: linear-gradient(135deg, var(--gold), #C98A1B); color: #3A2500; }
.pod.second .p-av { background: linear-gradient(135deg, #CDD3E8, #8f96b3); color: #22263a; }
.pod.third .p-av { background: linear-gradient(135deg, #E8926B, #B05C33); }
.pod .p-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .p-score { font-size: 11.5px; color: var(--gold); font-weight: 800; margin-top: 3px; }
.pod.first { padding-bottom: 26px; }
.pod .medal { font-size: 15px; }

.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 8px;
  border-radius: 14px;
}
.lb-row.me-row { background: rgba(var(--accent-rgb),.13); border: 1px solid rgba(var(--accent-rgb),.35); }
.lb-rank { width: 28px; text-align: center; font-weight: 800; color: var(--muted); font-size: 13.5px; }
.lb-av { width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--muted); overflow: hidden; }
.p-av img, .lb-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.lb-name { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { font-weight: 800; font-size: 13px; color: var(--gold); }

/* ===== PROFILE ===== */
.profile-head { display: flex; flex-direction: column; align-items: center; padding: 22px 0 6px; }
.profile-av {
  width: 92px; height: 92px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gradient);
  display: grid; place-items: center;
  font-size: 34px; font-weight: 800; color: var(--on-accent);
  border: 3px solid rgba(var(--accent-rgb),.5);
  box-shadow: 0 8px 30px rgba(var(--accent-rgb),.35);
}
.profile-head h1 { font-size: 20px; margin-top: 14px; }
.profile-head .uname { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.pid-chip {
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.ps-cell { background: var(--card); border: 1px solid var(--stroke); border-radius: 15px; padding: 13px 8px; text-align: center; }
.ps-cell b { display: block; font-size: 16.5px; font-weight: 800; }
.ps-cell span { font-size: 10px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.ps-cell.gold b { color: var(--gold); }
.ps-cell.cyan b { color: var(--cyan); }
.ps-cell.green b { color: var(--success); }

.menu-list { display: flex; flex-direction: column; gap: 9px; }
.menu-item {
  display: flex; align-items: center; gap: 13px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 15px;
  padding: 14px 15px;
  font-size: 14px; font-weight: 700;
  transition: transform .14s ease;
}
.menu-item:active { transform: scale(.98); }
.menu-item .mi-ic {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--card-2);
  display: grid; place-items: center;
  color: var(--cyan);
}
.menu-item .mi-ic svg { width: 18px; height: 18px; }
.menu-item .chev { margin-left: auto; color: var(--muted); }

.ach-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.ach-chip {
  font-size: 11.5px; font-weight: 700;
  background: rgba(255,209,102,.14);
  border: 1px solid rgba(255,209,102,.35);
  color: var(--gold);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ===== TRANSACTIONS ===== */
.tx-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--stroke);
}
.tx-ic {
  width: 38px; height: 38px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--card-2);
  border: 1px solid var(--stroke);
  font-weight: 800; font-size: 15px;
}
.tx-ic.in { color: var(--success); }
.tx-ic.out { color: var(--danger); }
.tx-body { flex: 1; min-width: 0; }
.tx-title { font-size: 13.5px; font-weight: 700; }
.tx-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tx-amt { font-weight: 800; font-size: 14px; }
.tx-amt.in { color: var(--success); }
.tx-amt.out { color: var(--danger); }

/* ===== GATE (not in telegram) ===== */
.gate {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 30px;
  gap: 14px;
}
.gate .g-logo {
  width: 76px; height: 76px;
  border-radius: 26px;
  background: var(--gradient);
  display: grid; place-items: center;
  font-size: 36px;
  box-shadow: var(--glow-purple), var(--shadow);
}

/* ===== Trade cards inside chat ===== */
.trade-chat-card {
  width: min(78vw, 300px);
  background: var(--card);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 16px;
  padding: 12px;
}
.msg-row.mine .trade-chat-card {
  background: linear-gradient(150deg, rgba(var(--accent-rgb),.14), rgba(var(--accent-b-rgb),.10));
  border-color: rgba(var(--accent-rgb), .4);
}
.trade-chat-card .tcc-side {
  background: var(--card-2);
  border-radius: 11px;
  padding: 8px 10px;
  margin-top: 8px;
}
.trade-chat-card .side-label {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 4px;
}

/* ===== Global community chat ===== */
.gmsg-row { display: flex; gap: 9px; margin-bottom: 10px; align-items: flex-end; }
.gmsg-row.mine { justify-content: flex-end; }
.gmsg-row.grouped { margin-bottom: 3px; }

.gavatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--gradient);
  color: var(--on-accent); font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.gavatar.spacer { visibility: hidden; }

.gmsg-col { max-width: 76%; min-width: 0; }
.gmsg-name {
  font-size: 11.5px; font-weight: 800;
  color: var(--cyan);
  margin: 0 4px 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gmsg-row.mine .gmsg-col { display: flex; flex-direction: column; align-items: flex-end; }

.gmsg-bubble {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 16px 16px 16px 5px;
  background: var(--card);
  border: 1px solid var(--stroke);
  font-size: 14px;
  line-height: 1.42;
  word-break: break-word;
  white-space: pre-wrap;
}
.gmsg-row.grouped .gmsg-bubble { border-radius: 5px 16px 16px 5px; }
.gmsg-row.mine .gmsg-bubble {
  background: var(--gradient);
  border-color: transparent;
  color: var(--on-accent);
  border-radius: 16px 16px 5px 16px;
}
.gmsg-row.mine.grouped .gmsg-bubble { border-radius: 5px 16px 5px 16px; }

/* ===== Sticker message (compact, Telegram-like) ===== */
.chat-sticker-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 150px;
  max-height: 150px;
  border-radius: 12px;
  background: var(--card);
}

/* ===== Sticker picker ===== */
.sticker-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 6px;
  overflow: hidden;
}
.pack-tabs {
  display: flex; gap: 4px; padding: 8px 8px 0;
  overflow-x: auto; scrollbar-width: none;
}
.pack-tabs::-webkit-scrollbar { display: none; }
.pack-tab {
  flex-shrink: 0; padding: 5px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  border: 1px solid var(--border); background: var(--surface-2);
}
.pack-tab.active { color: var(--accent); border-color: var(--accent); }
.sticker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px; padding: 8px; max-height: 200px; overflow-y: auto;
}
.sticker-cell { cursor: pointer; transition: transform .12s ease; }
.sticker-cell:hover { transform: scale(1.08); }
.sticker-cell img {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  border-radius: 8px;
}

/* ===== Reply bar ===== */
.reply-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--accent-soft);
  border-radius: 10px;
  padding: 8px 12px; margin-bottom: 6px;
}
.rm-btn { color: var(--muted); cursor: pointer; }
.rm-btn svg { width: 16px; height: 16px; }

/* ===== Reply quote inside bubble ===== */
.reply-quote {
  background: rgba(var(--accent-rgb), .08);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12.5px;
}
.reply-quote-name { font-weight: 800; font-size: 11px; color: var(--accent); }
.reply-quote-text { color: var(--muted); margin-top: 2px; }

/* ===== Sticker message bubble ===== */
.sticker-bubble img {
  max-width: 180px; max-height: 180px;
  border-radius: 14px;
}

/* ===== Online indicator ===== */
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
}
.gc-online {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; color: var(--success);
}

/* ===== Reply action button on messages ===== */
.gmsg-reply-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: var(--text-muted); opacity: 0;
  transition: opacity .15s ease, background .15s ease;
  background: transparent; border: none; cursor: pointer;
  flex-shrink: 0; align-self: center;
}
.gmsg-row:hover .gmsg-reply-btn,
.gmsg-row:focus-within .gmsg-reply-btn { opacity: 1; }
.gmsg-reply-btn:hover { background: var(--hover-soft); }
.gmsg-reply-btn svg { width: 14px; height: 14px; }

/* ===== Global chat fixed layout: only the message list scrolls ===== */
.gc-fixed {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 32px);
  min-height: 0;
}
.gc-fixed .chat-composer { position: static; }
@media (hover: none) {
  .gmsg-reply-btn { opacity: .55; }
}
