/* ===== 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: 18px 18px 10px 10px;
  padding: 14px 8px 12px;
  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: 30px;
  border-color: rgba(255,209,102,.45);
  background: linear-gradient(180deg, rgba(255,209,102,.09), var(--card) 62%);
}
.pod.second { border-color: rgba(205,211,232,.3); }
.pod.third { border-color: rgba(232,146,107,.3); }
.pod .medal {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 20px;
  margin: 0 auto 7px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 10px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pod.first .medal { background: var(--gold); border-color: transparent; color: #3A2500; }
.pod.second .medal { background: rgba(205,211,232,.16); border-color: rgba(205,211,232,.3); color: #DDE2F2; }
.pod.third .medal { background: rgba(232,146,107,.16); border-color: rgba(232,146,107,.3); color: #F0A37F; }

.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--stroke);
  border-bottom: 1px solid color-mix(in srgb, var(--stroke) 55%, transparent);
  border-radius: 0;
}
.lb-row:active { background: var(--hover-soft); }
.lb-row.me-row {
  background: rgba(var(--accent-rgb),.13);
  border: 1px solid rgba(var(--accent-rgb),.35);
  border-radius: 14px;
}
.lb-rank { width: 28px; text-align: center; font-weight: 800; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.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); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== PROFILE ===== */
.pf-page { position: relative; }

.pf-cover {
  position: relative;
  height: clamp(210px, 62vw, 248px);
  margin: -14px -16px 0;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--card-2), var(--surface-deep));
  isolation: isolate;
}
.pf-cover-art {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}
.pf-cover-scrim {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.04) 34%, transparent 52%),
    linear-gradient(0deg, rgba(0,0,0,.55), transparent 42%);
}
.pf-gear {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center;
  background: none; border: 0;
  color: #fff;
  filter: drop-shadow(0 2px 7px rgba(0,0,0,.65));
  transition: transform .15s ease, opacity .15s ease;
}
.pf-gear:active { transform: scale(.88); opacity: .82; }
.pf-gear svg { width: 21px; height: 21px; }
.pf-identity {
  position: relative; z-index: 2;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-top: -44px;
}
.pf-av-wrap {
  flex: 0 0 96px; width: 96px; height: 96px;
  padding: 0; border-radius: 50%;
  background: var(--card-2);
  box-shadow: none;
}
.pf-av,
.pf-av-wrap .avatar {
  width: 96px; height: 96px;
  display: block; border-radius: 50%;
  object-fit: cover;
  border: 0;
}
.pf-av-wrap .avatar {
  display: grid; place-items: center;
  background: var(--gradient);
  color: var(--on-accent);
  font-size: 32px; font-weight: 800;
  box-shadow: none;
}
.pf-edit {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 12px; font-weight: 800;
  transition: transform .14s ease, background .15s ease;
}
.pf-edit:active { transform: scale(.96); background: var(--hover-soft); }
.pf-edit svg { width: 14px; height: 14px; }

.pf-info { padding-top: 13px; }
.pf-name {
  font-size: clamp(22px, 6.2vw, 28px);
  line-height: 1.12; font-weight: 800; letter-spacing: -.2px;
  overflow-wrap: anywhere;
}
.pf-bio {
  margin-top: 9px;
  font-size: 15px; line-height: 1.65;
  color: var(--text); opacity: .86;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.pf-bio[hidden] { display: none; }

.pf-figures {
  display: flex; align-items: center; gap: 9px;
  margin-top: 15px; padding: 11px 0;
  border-top: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
}
.pf-fig { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.pf-fig b {
  font-family: var(--font-display);
  font-size: 16px; line-height: 1; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pf-fig span {
  font-size: 9.5px; font-weight: 800; letter-spacing: .7px;
  text-transform: uppercase; color: var(--muted);
}
.pf-fig.gold b { color: var(--gold); }
.pf-fig-sep {
  flex: 0 0 3px; width: 3px; height: 3px;
  border-radius: 50%; background: var(--stroke-strong);
}
.pf-id-row {
  position: relative; z-index: 2;
  display: flex; padding-top: 7px;
}
.pf-id {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-family: inherit;
  font-size: 10px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pf-id > span:last-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-id svg { width: 11px; height: 11px; opacity: .8; }
.pf-id:active { opacity: .55; }

.pf-cover-art-host { position: absolute; inset: 0; }
.pf-cover-banner { object-position: 50% 50%; }

.pf-av-wrap { position: relative; }
.pf-av-btn {
  display: inline-flex;
  padding: 0;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}
.pf-av-btn:active { transform: scale(.98); }
.pf-av-cam {
  position: absolute; right: 1px; bottom: 1px;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--bg);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0,0,0,.32);
}
.pf-av-cam svg { width: 13px; height: 13px; }

.pf-social {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin-top: 13px;
}
.pf-social.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-social-stat {
  min-width: 0;
  padding: 9px 3px 10px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: background .15s ease;
}
button.pf-social-stat:active { background: var(--hover-soft); }
.pf-social-stat[disabled] { opacity: 1; }
.pf-social-stat b {
  font-family: var(--font-display);
  font-size: 17px; line-height: 1; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pf-social-stat span {
  font-size: 9px; font-weight: 800; letter-spacing: .7px;
  text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}

.pf-collection { margin-top: 24px; }
.pf-col-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 11px; padding: 0 2px;
}
.pf-col-head h2 { font-size: 18px; line-height: 1.1; font-weight: 800; }
.pf-col-head p {
  margin-top: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted);
}
.pf-col-all {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 10.5px; font-weight: 800; letter-spacing: .2px;
}
.pf-col-all svg { width: 12px; height: 12px; }
.pf-col-all:active { opacity: .6; }
.pf-show {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  padding: 2px 2px 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.pf-show::-webkit-scrollbar { display: none; }
.pf-show-card {
  flex: 0 0 106px; width: 106px;
  display: block; padding: 0;
  background: none; border: 0;
  color: var(--text);
  font-family: inherit; text-align: left;
  scroll-snap-align: start;
}
.pf-show-art {
  position: relative; display: block;
  width: 106px; height: 140px;
  border-radius: 15px; overflow: hidden;
  background: linear-gradient(160deg, var(--card-2), var(--surface-deep));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rc) 55%, transparent),
    0 12px 22px -16px rgba(0,0,0,.8);
}
.pf-show-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transition: transform .3s ease;
}
.pf-show-art::after {
  content: ''; position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 62%, rgba(0,0,0,.35));
}
.pf-show-card:active .pf-show-img,
.pf-show-art:active .pf-show-img { transform: scale(1.04); }
.pf-show-name {
  display: block; margin-top: 7px;
  font-size: 11px; font-weight: 800; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-show-card:active .pf-show-name { color: var(--accent); }

.pf-links {
  margin-top: 22px;
  border-top: 1px solid var(--stroke);
}
.pf-link {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 2px;
  background: none; border: 0; border-bottom: 1px solid var(--stroke);
  color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 700;
  text-align: left;
  transition: color .15s ease;
}
.pf-link:active { color: var(--accent); }
.pf-link-ic { flex: 0 0 20px; width: 20px; display: inline-flex; color: var(--muted); }
.pf-link-ic svg { width: 17px; height: 17px; }
.pf-link-label { flex: 1; min-width: 0; }
.pf-link-chev { flex: 0 0 auto; display: inline-flex; color: var(--muted); opacity: .55; }
.pf-link-chev svg { width: 15px; height: 15px; }

.pf-edit-count {
  margin-top: 5px;
  text-align: right;
  font-size: 10px; font-weight: 700; color: var(--muted);
}
.pf-edit-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet textarea { resize: none; min-height: 90px; line-height: 1.5; }

.pf-media {
  margin: 2px 0 18px;
  border: 1px solid var(--stroke);
  border-radius: 17px;
  overflow: hidden;
  background: var(--card-2);
}
.pf-media-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-top: 1px solid var(--border);
}
.pf-media-row:first-child { border-top: 0; }
.pf-media-thumb {
  flex: 0 0 58px; width: 58px; height: 38px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--stroke);
  display: grid; place-items: center;
}
.pf-media-thumb.round { width: 48px; height: 48px; flex-basis: 48px; border-radius: 50%; }
.pf-media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-media-ph { color: var(--muted); display: inline-flex; }
.pf-media-ph svg { width: 18px; height: 18px; }
.pf-media-body { flex: 1; min-width: 0; }
.pf-media-body b { display: block; font-size: 12.5px; font-weight: 800; }
.pf-media-status {
  display: block; margin-top: 2px;
  font-size: 10px; font-weight: 700; color: var(--muted);
}
.pf-media-actions { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pf-media-btn {
  padding: 3px 0;
  border: 0; background: transparent;
  color: var(--accent);
  font-family: inherit; font-size: 10.5px; font-weight: 800;
}
.pf-media-btn.danger { color: var(--danger); }
.pf-media-btn:disabled { opacity: .5; }
.pf-media-note {
  margin: 0; padding: 9px 12px 10px;
  font-size: 9.5px; line-height: 1.45; color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ===== PUBLIC USER PROFILE ===== */
.up-page .pf-cover { height: clamp(195px, 58vw, 232px); }
.up-back {
  position: absolute; top: 12px; left: 14px; z-index: 3;
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(12, 11, 17, .32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transition: transform .15s ease, background .15s ease;
}
.up-back:active { transform: scale(.92); background: rgba(12, 11, 17, .45); }
.up-back svg { width: 22px; height: 22px; }
.up-cover-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background:
    radial-gradient(80% 120% at 20% 0%, rgba(var(--accent-rgb), .28), transparent 62%),
    radial-gradient(80% 120% at 90% 100%, rgba(var(--accent-b-rgb), .2), transparent 60%),
    linear-gradient(155deg, var(--card-2), var(--surface-deep));
  color: var(--muted);
}
.up-cover-glyph {
  font-family: var(--font-display);
  font-size: 64px; line-height: 1;
  font-weight: 800;
  color: rgba(255,255,255,.3);
  text-shadow: 0 8px 30px rgba(0,0,0,.28);
}
.up-cover-word {
  font-size: 8px; font-weight: 800; letter-spacing: 2.6px;
  text-transform: uppercase; color: rgba(255,255,255,.44);
}
.up-avatar { display: inline-flex; }
.up-handle {
  margin-top: 7px;
  align-self: flex-start;
}
.up-rep-stat b { color: var(--gold); }
.up-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}
.up-action {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 13px;
  letter-spacing: .1px;
  box-shadow: none;
}
.up-action svg { width: 17px; height: 17px; }
.up-follow {
  background: var(--gradient);
  color: var(--on-accent);
  box-shadow: 0 9px 22px -15px rgba(var(--accent-b-rgb), .95);
}
.up-follow.is-following {
  background: var(--card-2);
  border-color: var(--stroke-strong);
  color: var(--text);
  box-shadow: none;
}
.up-rep-btn {
  background: var(--card);
  border-color: var(--gold-border);
  color: var(--gold);
}
.up-rep-btn.is-given {
  background: var(--card-2);
  border-color: var(--stroke);
  color: var(--muted);
}
.up-rep-btn.is-given[disabled] { opacity: 1; }
.up-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--stroke);
  text-align: center;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}

/* ===== RELATIONSHIP LISTS ===== */
.ul-list { margin-top: 4px; }
.ul-loading { display: grid; place-items: center; padding: 34px; }
.ul-row {
  width: 100%;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 2px;
  border: 0; border-bottom: 1px solid var(--stroke);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
}
.ul-row:active { background: var(--hover-soft); }
.ul-av {
  flex: 0 0 42px; width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--gradient);
  display: grid; place-items: center;
}
.ul-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ul-initial { font-size: 15px; font-weight: 800; color: var(--on-accent); }
.ul-body { flex: 1; min-width: 0; display: block; }
.ul-body b {
  display: block;
  font-size: 13px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ul-body small {
  display: block; margin-top: 1px;
  font-size: 10px; font-weight: 600; color: var(--muted);
}
.ul-bio {
  display: block; margin-top: 2px;
  font-size: 10.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ul-side { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.ul-side small { font-size: 9px; font-weight: 800; color: var(--accent); }
.ul-chev { display: inline-flex; color: var(--muted); opacity: .55; }
.ul-chev svg { width: 14px; height: 14px; }
.pod, .lb-row { cursor: pointer; }

/* ===== SUBPAGE HEADER (settings/theme/transactions) ===== */
.subpage-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 18px;
}
.subpage-back {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--text);
  transition: transform .14s ease;
}
.subpage-back:active { transform: scale(.93); }
.subpage-back svg { width: 18px; height: 18px; }
.subpage-title {
  flex: 1; min-width: 0;
  font-size: 23px; font-weight: 800; text-align: left;
}
.subpage-spacer { flex: 0 0 38px; width: 38px; }
.subpage-bar .coin-pill { flex: 0 0 auto; }

/* ===== SETTINGS ===== */
.set-card {
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--stroke);
}
.set-row {
  width: 100%;
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px; font-weight: 700;
  text-align: left;
  transition: background .15s ease;
}
.set-row:first-child { border-top: 0; }
.set-row:active { background: var(--hover-soft); }
.set-ic {
  flex: 0 0 34px; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--card-2);
  color: var(--cyan);
}
.set-ic svg { width: 17px; height: 17px; }
.set-body { flex: 1; min-width: 0; }
.set-label { display: block; }
.set-sub {
  display: block; margin-top: 1px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
}
.set-chev { flex: 0 0 auto; display: inline-flex; color: var(--muted); opacity: .7; }
.set-chev svg { width: 15px; height: 15px; }

/* ===== THEME PICKER ===== */
.thm-lead {
  margin: -6px 2px 14px;
  font-size: 12.5px; line-height: 1.55; color: var(--muted);
}
.thm-list {
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--stroke);
}
.thm-row {
  width: 100%;
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  transition: background .15s ease;
}
.thm-row:first-child { border-top: 0; }
.thm-row:active { background: var(--hover-soft); }
.thm-row.active { background: var(--accent-soft); }
.thm-orb {
  flex: 0 0 38px; width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--tb, var(--gradient));
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.5),
    inset 0 -3px 6px rgba(0,0,0,.3),
    0 4px 10px -2px var(--tg, rgba(0,0,0,.4));
}
.thm-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; }
.thm-check {
  flex: 0 0 22px; width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--stroke-strong);
  color: transparent;
}
.thm-row.active .thm-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.thm-check svg { width: 13px; height: 13px; }
.thm-note {
  margin: 14px 2px 0;
  font-size: 11.5px; line-height: 1.6; color: var(--muted);
}

@media (max-width: 350px) {
  .pf-cover { height: 202px; }
  .pf-av-wrap { flex-basis: 86px; width: 86px; height: 86px; }
  .pf-av,
  .pf-av-wrap .avatar { width: 86px; height: 86px; }
  .pf-av-wrap .avatar { font-size: 28px; }
  .pf-name { font-size: 21px; }
  .pf-bio { font-size: 15px; line-height: 1.62; }
  .pf-fig b { font-size: 15px; }
  .pf-fig span { font-size: 9px; letter-spacing: .5px; }
  .pf-id { font-size: 9.5px; }
  .pf-show-card,
  .pf-show-art { flex-basis: 100px; width: 100px; }
  .pf-show-art { height: 132px; }
  .pf-social-stat b { font-size: 15px; }
  .pf-social-stat span { font-size: 8px; letter-spacing: .5px; }
  .pf-av-cam { width: 24px; height: 24px; }
  .pf-media-row { gap: 8px; padding: 10px; }
  .pf-media-thumb { flex-basis: 50px; width: 50px; height: 34px; }
  .pf-media-thumb.round { flex-basis: 44px; width: 44px; height: 44px; }
  .pf-media-body b { font-size: 11.5px; }
  .pf-media-btn { font-size: 9.5px; }
  .up-cover-glyph { font-size: 52px; }
  .up-actions { gap: 7px; }
  .up-action { padding: 11px 8px; font-size: 12px; }
  .subpage-title { font-size: 21px; }
}

/* Short phones: keep public-profile actions clear of the fixed tabbar. */
@media (max-width: 380px) and (max-height: 640px) {
  .up-page .pf-cover { height: 170px; }
  .up-page .up-cover-glyph { font-size: 48px; }
  .up-page .pf-info { padding-top: 9px; }
  .up-page .pf-social { margin-top: 10px; }
  .up-page .up-actions { margin-top: 10px; }
  .up-page .up-action { height: 42px; padding: 0 10px; font-size: 12px; }
}

/* ===== 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;
  color: #fff;
  box-shadow: var(--glow-purple), var(--shadow);
}
.gate-copy {
  max-width: 290px;
  font-size: 14px; line-height: 1.5;
}
.gate-actions {
  display: flex; flex-direction: column; gap: 9px;
  width: min(100%, 280px);
  margin-top: 2px;
}
.gate-actions .btn { width: 100%; }
.gate [hidden] { display: none !important; }
.gate-dev-form {
  width: min(100%, 280px);
  display: flex; flex-direction: column; gap: 7px;
  margin-top: 2px;
  text-align: left;
}
.gate-dev-label {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.gate-dev-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.gate-dev-input:focus {
  outline: 2px solid rgba(var(--accent-rgb), .45);
  outline-offset: 1px;
}
.gate-hint {
  max-width: 290px;
  font-size: 11.5px; line-height: 1.45;
}

/* ===== 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; }
}

/* ============================================================
   PROFILE — native-feeling edit studio
   ============================================================ */
.sheet.pf-edit-sheet-wrap {
  height: min(92dvh, 780px);
  max-height: 92dvh;
  padding-top: 10px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pf-edit-sheet-wrap .sheet-grip { margin-top: -2px; margin-bottom: 2px; }
.pf-edit-sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pf-edit-head {
  position: relative;
  flex: 0 0 auto;
  padding: 1px 44px 12px 1px;
  border-bottom: 1px solid var(--stroke);
}
.pf-edit-title {
  margin-top: 0;
  font-size: 23px; line-height: 1.08; letter-spacing: -.25px;
}
.pf-edit-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px; line-height: 1.45;
  max-width: 300px;
}
.pf-edit-close {
  position: absolute; top: 2px; right: 0;
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: transform .15s ease, color .15s ease, background .15s ease;
}
.pf-edit-close svg { width: 16px; height: 16px; }
.pf-edit-close:active { transform: scale(.9); color: var(--text); background: var(--hover-soft); }

.pf-edit-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 2px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.pf-edit-sec { display: flex; flex-direction: column; gap: 8px; }
.pf-edit-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 2px;
}
.pf-edit-sec-title {
  font-size: 10px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
}
.pf-edit-sec-hint {
  font-size: 9.5px; font-weight: 700; color: var(--muted); opacity: .78;
}

.pf-edit-sheet .pf-media {
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-edit-sheet .pf-media-row {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card-2), var(--card) 72%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  contain: paint;
}
.pf-edit-sheet .pf-media-row:first-child { border-top: 1px solid var(--stroke); }
.pf-edit-sheet .pf-media-thumb {
  flex: 0 0 78px; width: 78px; height: 50px;
  border-radius: 11px;
  background: var(--card-2);
  border: 0;
}
.pf-edit-sheet .pf-media-thumb.round {
  flex: 0 0 54px; width: 54px; height: 54px;
  border-radius: 50%;
  box-shadow: none;
}
.pf-edit-sheet .pf-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pf-edit-sheet .pf-media-thumb.round img { border-radius: 50%; }
.pf-edit-sheet .pf-media-ph { color: var(--muted); opacity: .7; }
.pf-edit-sheet .pf-media-body { min-width: 0; }
.pf-edit-sheet .pf-media-body b { font-size: 12px; letter-spacing: .1px; }
.pf-edit-sheet .pf-media-status {
  display: inline-flex; align-items: center; gap: 5px;
  width: max-content; max-width: 100%;
  margin-top: 5px; padding: 3px 7px;
  border-radius: 999px;
  background: var(--hover-soft);
  color: var(--muted);
  font-size: 8.5px; line-height: 1.2; font-weight: 800;
  letter-spacing: .15px;
}
.pf-edit-sheet .pf-media-status::before {
  content: '';
  width: 5px; height: 5px; flex: 0 0 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.pf-edit-sheet .pf-media-status[data-state="custom"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.pf-edit-sheet .pf-media-status[data-state="telegram"] {
  background: rgba(var(--accent-rgb), .08);
  color: var(--muted);
}
.pf-edit-sheet .pf-media-actions {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-width: 62px;
}
.pf-edit-sheet .pf-media-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px; font-weight: 800; line-height: 1;
}
.pf-edit-sheet .pf-media-btn svg { width: 11px; height: 11px; }
.pf-edit-sheet .pf-media-btn:active { transform: scale(.96); }
.pf-edit-sheet .pf-media-btn.danger {
  background: transparent;
  color: var(--danger);
  padding: 4px 7px;
}
.pf-edit-sheet .pf-media-btn[hidden] { display: none; }
.pf-edit-sheet .pf-media-btn[disabled] { opacity: .5; }
.pf-edit-sheet .pf-media-note {
  margin: 0; padding: 6px 2px 0;
  border: 0;
  color: var(--muted);
  font-size: 9.5px; line-height: 1.45;
}

.pf-field { display: flex; flex-direction: column; gap: 7px; }
.pf-field + .pf-field { margin-top: 13px; }
.pf-field-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 0 2px;
}
.pf-field-label {
  color: var(--muted);
  font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
}
.pf-field-count {
  color: var(--muted);
  font-size: 9.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color .15s ease;
}
.pf-field-count.warn { color: var(--danger); }
.pf-input-shell {
  position: relative;
  display: flex; align-items: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--input-bg);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
  contain: paint;
}
.pf-input-shell:focus-within {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pf-input-ic {
  position: absolute; left: 13px; top: 50%;
  width: 16px; height: 16px;
  display: inline-flex;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.pf-input-ic svg { width: 16px; height: 16px; }
.pf-input-shell.area { align-items: flex-start; }
.pf-input-shell.area .pf-input-ic { top: 14px; transform: none; }
.pf-input-shell input,
.pf-input-shell textarea {
  width: 100%;
  border: 0;
  border-radius: 15px;
  background: transparent;
  box-shadow: none;
  padding: 13px 13px 13px 38px;
  color: var(--text);
  font-size: 14px; line-height: 1.45;
}
.pf-input-shell input { font-weight: 700; }
.pf-input-shell textarea {
  min-height: 94px;
  resize: none;
  font-weight: 600;
}
.pf-input-shell input:focus,
.pf-input-shell textarea:focus { border: 0; box-shadow: none; outline: none; }
.pf-edit-help {
  display: flex; align-items: center; gap: 5px;
  margin-top: 2px; padding: 0 2px;
  color: var(--muted);
  font-size: 9.5px; line-height: 1.4;
}
.pf-edit-help svg { width: 11px; height: 11px; }
.pf-edit-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  background: var(--card);
}
.pf-edit-actions .btn {
  width: 100%; height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 13.5px;
}
.pf-edit-actions .btn-ghost {
  background: var(--card-2);
  border-color: var(--stroke);
  color: var(--muted);
}
.pf-edit-actions .btn-primary {
  box-shadow: 0 9px 24px -12px rgba(var(--accent-b-rgb), .9);
}
.pf-edit-actions .btn-primary svg { width: 15px; height: 15px; }
.pf-edit-actions .btn.is-busy svg { opacity: .55; }

/* ============================================================
   PROFILE — card polish + cheaper paint
   ============================================================ */
.pf-cover { contain: paint; }
.pf-show-art { contain: paint; }
.pf-showcase-host:empty { display: none; }
.pf-show-skel {
  display: flex; gap: 10px;
  overflow: hidden;
  margin-top: 24px;
  padding: 2px 2px 4px;
}
.pf-show-skel .skeleton {
  flex: 0 0 106px; width: 106px; height: 140px;
  border-radius: 15px;
}

.pf-social {
  margin-top: 13px;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.pf-social-stat {
  padding: 9px 2px 10px;
  border-radius: 14px;
}
button.pf-social-stat { transition: background .15s ease, transform .15s ease; }
button.pf-social-stat:active { transform: scale(.97); }
.pf-social-stat b { font-size: 18px; }

.pf-links {
  margin-top: 16px;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-link {
  height: 54px;
  padding: 0 13px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: var(--card);
  transition: transform .14s ease, border-color .15s ease, background .15s ease;
}
.pf-link:last-child { border-bottom: 1px solid var(--stroke); }
.pf-link:active {
  transform: scale(.99);
  border-color: rgba(var(--accent-rgb), .3);
  background: var(--hover-soft);
}
.pf-link-ic {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.pf-link-ic svg { width: 16px; height: 16px; }
.pf-link-chev { opacity: .4; }

/* ============================================================
   RELATIONSHIP SHEET — peek / full / drag dismiss
   ============================================================ */
.ul-sheet-wrap {
  padding-top: 8px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.ul-sheet-wrap .sheet-grip { margin-top: -2px; margin-bottom: 0; }
.ul-sheet {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ul-sheet-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 7px 2px 12px;
  border-bottom: 1px solid var(--stroke);
}
.ul-sheet-head-copy { min-width: 0; }
.ul-sheet-title {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: 23px; line-height: 1.1; font-weight: 800;
  letter-spacing: -.2px;
}
.ul-sheet-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px; line-height: 1.4;
}
.ul-close {
  flex: 0 0 auto;
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: transform .15s ease, color .15s ease, background .15s ease;
}
.ul-close svg { width: 16px; height: 16px; }
.ul-close:active { transform: scale(.9); color: var(--text); background: var(--hover-soft); }
.ul-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 4px 4px 12px;
}
.ul-list .empty-state { padding: 34px 12px 26px; }
.ul-row {
  gap: 11px;
  padding: 9px 7px;
  border-bottom: 1px solid var(--stroke);
  border-radius: 14px;
  transition: background .14s ease, transform .14s ease;
  contain: paint;
}
.ul-row:last-child { border-bottom: 0; }
.ul-row:active { background: var(--hover-soft); transform: scale(.992); }
.ul-av {
  flex: 0 0 46px; width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(var(--accent-rgb), .18);
}
.ul-av img { border-radius: 50%; }
.ul-initial { font-size: 16px; }
.ul-body b { font-size: 13px; letter-spacing: .05px; }
.ul-body small { margin-top: 1px; font-size: 9.5px; }
.ul-bio { margin-top: 3px; font-size: 10px; }
.ul-side small {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 8.5px;
  line-height: 1;
}
.ul-chev { opacity: .38; }
.ul-skeleton {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 7px;
  border-bottom: 1px solid var(--stroke);
}
.ul-skeleton .skel-av {
  flex: 0 0 46px; width: 46px; height: 46px;
  border-radius: 50%;
}
.ul-skeleton .skel-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ul-skeleton .skel-line { height: 9px; border-radius: 999px; }
.ul-skeleton .skel-line.short { width: 44%; }

@media (max-width: 350px) {
  .sheet.pf-edit-sheet-wrap { padding-left: 16px; padding-right: 16px; }
  .pf-edit-sheet-wrap .sheet-grip { margin-left: -16px; margin-right: -16px; }
  .pf-edit-head { padding-right: 40px; }
  .pf-edit-title { font-size: 21px; }
  .pf-edit-sheet .pf-media-thumb { flex-basis: 64px; width: 64px; height: 46px; }
  .pf-edit-sheet .pf-media-thumb.round { flex-basis: 50px; width: 50px; height: 50px; }
  .pf-edit-sheet .pf-media-row { padding: 9px; gap: 9px; }
  .pf-edit-sheet .pf-media-btn { padding: 6px 8px; font-size: 9px; }
  .pf-edit-sheet .pf-media-actions { min-width: 58px; }
  .pf-edit-actions .btn { height: 44px; font-size: 13px; }
  .pf-social-stat b { font-size: 17px; }
  .ul-sheet-title { font-size: 21px; }
  .ul-list { margin-left: -2px; margin-right: -2px; padding-left: 2px; padding-right: 2px; }
}

/* Profile pages scroll a lot of imagery — keep the dock opaque and cheap. */
body.no-topbar .tabbar {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ============================================================
   TOPBAR — player search action + narrow-phone spacing
   ============================================================ */
.top-search-btn { width: 38px; height: 38px; border-radius: 13px; }
.top-search-btn svg { width: 18px; height: 18px; }

@media (max-width: 380px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .brand { min-width: 0; gap: 0; font-size: 15.5px; }
  .brand > div { min-width: 0; }
  .brand span {
    display: block; max-width: 118px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .brand small { display: none; }
  .top-actions { gap: 6px; }
  .coin-pill { gap: 5px; padding: 5px 9px 5px 7px; font-size: 12.5px; }
  .coin-pill .coin-ic { width: 16px; height: 16px; }
  .topbar .icon-btn,
  .topbar .top-search-btn { width: 35px; height: 35px; border-radius: 11px; }
  .topbar .icon-btn svg,
  .topbar .top-search-btn svg { width: 17px; height: 17px; }
}

@media (max-width: 340px) {
  .topbar { padding-left: 8px; padding-right: 8px; }
  .brand { font-size: 15px; }
  .brand span { max-width: 102px; }
  .coin-pill { padding-right: 8px; font-size: 12px; }
}

/* ============================================================
   PLAYER SEARCH — polished player directory sheet
   ============================================================ */
.sheet.us-sheet-wrap {
  height: min(78dvh, 700px);
  max-height: calc(100dvh - 28px);
  padding-top: 8px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.us-sheet-wrap .sheet-grip { margin-top: -2px; margin-bottom: 0; }
.us-sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.us-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 8px 2px 14px;
}
.us-head-copy { min-width: 0; }
.us-title {
  font-family: var(--font-display);
  font-size: 23px; line-height: 1.1; font-weight: 800;
  letter-spacing: -.2px;
}
.us-subtitle {
  margin-top: 4px;
  font-size: 11px; line-height: 1.4; color: var(--muted);
}
.us-search { flex: 0 0 auto; margin: 0 0 12px; }
.us-search input {
  height: 47px;
  padding: 0 42px 0 42px;
  border-radius: 15px;
  background: var(--card-2);
  border: 1px solid var(--stroke-strong);
  font-size: 15px; font-weight: 600;
}
.us-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.us-search input:focus-visible { outline: none; }
.us-search svg {
  left: 14px; width: 18px; height: 18px;
  transition: color .16s ease;
}
.us-search:focus-within svg { color: var(--accent); }
.us-search input::-webkit-search-cancel-button,
.us-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.us-clear {
  position: absolute; right: 9px; top: 50%; z-index: 2;
  transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--muted);
}
.us-clear[hidden] { display: none; }
.us-search .us-clear svg {
  position: static;
  width: 12px; height: 12px;
  transform: none;
  color: currentColor;
  pointer-events: none;
}
.us-search:focus-within .us-clear svg { color: currentColor; }
.us-clear:active { transform: translateY(-50%) scale(.9); color: var(--text); }

.us-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 2px 4px 10px;
}
.us-row {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 8px;
  border: 0; border-bottom: 1px solid var(--stroke);
  border-radius: 15px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  transition: background .14s ease, transform .14s ease;
  contain: paint;
}
.us-row:last-child { border-bottom: 0; }
.us-row:active { background: var(--hover-soft); transform: scale(.994); }
.us-av {
  flex: 0 0 48px; width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: var(--gradient);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800;
}
.us-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.us-av-bot,
.us-av-empty {
  background: linear-gradient(150deg, var(--card-2), var(--surface-deep));
  color: var(--muted);
}
.us-body { flex: 1; min-width: 0; display: block; }
.us-body b {
  display: block;
  font-size: 13.5px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.us-body small {
  display: block; margin-top: 2px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.us-sub {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.us-chev {
  flex: 0 0 28px; width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--muted);
  opacity: .7;
}
.us-chev svg { width: 14px; height: 14px; }
.us-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 42px 20px 34px;
  color: var(--muted);
}
.us-empty-ic {
  width: 64px; height: 64px;
  margin-bottom: 14px;
  border-radius: 22px;
  display: grid; place-items: center;
  background: var(--card-2);
  border: 1px solid var(--stroke);
  color: var(--accent);
}
.us-empty-ic svg { width: 27px; height: 27px; }
.us-empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.us-empty p { max-width: 285px; font-size: 12.5px; line-height: 1.55; }
.us-skel {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--stroke);
}
.us-skel-av { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; }
.us-skel-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.us-skel-line { height: 10px; border-radius: 999px; }
.us-skel-line.short { width: 44%; }

@media (max-width: 350px) {
  .us-title { font-size: 21px; }
  .us-head { padding-top: 4px; padding-bottom: 12px; }
  .us-row { gap: 10px; padding: 10px 6px; }
  .us-av { flex-basis: 44px; width: 44px; height: 44px; font-size: 16px; }
  .us-body b { font-size: 13px; }
  .us-skel { gap: 10px; padding: 10px 6px; }
  .us-skel-av { flex-basis: 44px; width: 44px; height: 44px; }
}

/* ============================================================
   PUBLIC PROFILE — bot players + public collection
   ============================================================ */
.pf-av-wrap .avatar.up-avatar-blank {
  background: linear-gradient(145deg, var(--card-2), var(--surface-deep));
  color: transparent;
}
.up-cover-blank .pf-cover-scrim {
  background: linear-gradient(180deg, rgba(0,0,0,.36), transparent 46%);
}
.up-collection-host { margin-top: 24px; }
.up-col-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding: 0 2px;
}
.up-col-head h2 {
  font-family: var(--font-display);
  font-size: 19px; line-height: 1.1; font-weight: 800;
  letter-spacing: -.1px;
}
.up-col-sub {
  margin-top: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted);
}
.up-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.up-col-card { border-radius: 16px; }
.up-col-card .char-info { padding: 9px 10px 11px; }
.up-col-card .char-name { font-size: 12.5px; }
.up-col-card .char-sub { font-size: 9.5px; gap: 4px; margin-top: 4px; }
.up-col-card .char-anime { max-width: 58%; }
.up-col-card .count-chip { top: 7px; right: 7px; padding: 2px 7px; font-size: 9.5px; }
.up-col-body .skel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.up-col-body .skel-card {
  overflow: hidden;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
}
.up-col-foot { display: flex; justify-content: center; margin-top: 14px; }
.up-col-more {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  font-size: 12px; font-weight: 800;
  box-shadow: var(--shadow-soft);
  transition: transform .14s ease, border-color .15s ease, opacity .15s ease;
}
.up-col-more[hidden] { display: none; }
.up-col-more svg { width: 14px; height: 14px; transform: rotate(90deg); }
.up-col-more:active { transform: scale(.97); border-color: rgba(var(--accent-rgb), .35); }
.up-col-more:disabled { opacity: .55; }
.up-col-empty,
.up-col-error {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 26px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--muted);
}
.up-col-empty-ic,
.up-col-error-ic {
  width: 46px; height: 46px;
  margin-bottom: 10px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: var(--card-2);
  color: var(--muted);
}
.up-col-empty-ic svg,
.up-col-error-ic svg { width: 21px; height: 21px; }
.up-col-empty p,
.up-col-error p { font-size: 12.5px; line-height: 1.5; }
.up-col-error .btn { margin-top: 12px; }

/* ===== PUBLIC COLLECTION — in-profile character sheet ===== */
.sheet.up-char-sheet-wrap {
  height: min(90dvh, 780px);
  max-height: calc(100dvh - 22px);
  padding-top: 8px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.up-char-sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 1px 2px;
}
.up-char-top {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 2px 1px 12px;
}
.up-char-owner { min-width: 0; }
.up-char-kicker {
  display: block;
  font-size: 8.5px; font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--muted);
}
.up-char-owner-name {
  margin-top: 3px;
  font-size: 11.5px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.up-char-visual {
  flex: 0 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--card-2);
}
.up-char-visual .up-char-art {
  width: 100%;
  aspect-ratio: 3 / 3.5;
}
.up-char-body { padding: 14px 2px 0; }
.up-char-name {
  font-family: var(--font-display);
  font-size: 22px; line-height: 1.1; font-weight: 800;
  letter-spacing: -.15px;
  overflow-wrap: anywhere;
}
.up-char-anime {
  margin-top: 5px;
  font-size: 12.5px; line-height: 1.4; font-weight: 600;
  color: var(--muted);
}
.up-char-badges {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px;
}
.up-char-id {
  margin-left: auto;
  font-size: 10px; font-weight: 800; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.up-char-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.up-char-stat {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--stroke);
}
.up-char-stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 18px; line-height: 1.05; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.up-char-stat span {
  display: block; margin-top: 3px;
  font-size: 8px; font-weight: 800; letter-spacing: .7px;
  text-transform: uppercase; color: var(--muted);
}
.up-char-note {
  margin-top: 13px;
  font-size: 10.5px; line-height: 1.4; font-weight: 600;
  text-align: center; color: var(--muted);
}

/* ============================================================
   GLOBAL CHAT — avatar opens the player profile
   ============================================================ */
.gavatar-btn {
  flex: 0 0 34px; width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  background: var(--card-2);
  transition: transform .14s ease, opacity .14s ease;
}
.gavatar-btn .gavatar { width: 100%; height: 100%; }
.gavatar-btn:active { transform: scale(.9); opacity: .85; }
.gavatar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 350px) {
  .up-col-head h2 { font-size: 18px; }
  .up-col-grid,
  .up-col-body .skel-grid { gap: 8px; }
  .up-col-card .char-name { font-size: 12px; }
  .up-col-card .char-info { padding: 8px 9px 10px; }
  .up-col-card .char-sub { font-size: 9px; }
  .up-char-name { font-size: 20px; }
  .up-char-stat b { font-size: 16px; }
}
