/* ============================================================
   Delino | دلینو - Styles (Local, RTL, Mobile First)
   No external CDN. Vazirmatn loaded locally; system fallback.
   ============================================================ */

/* ---- Local variable font (single Vazirmatn variable woff2) ---- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn[wght].woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg: #0f1117;
    --bg-soft: #171a23;
    --card: #1e222e;
    --card-2: #252a38;
    --text: #f3f4f8;
    --muted: #9aa0b0;
    --primary: #ff4d79;
    --primary-rgb: 255, 77, 121;
    --primary-2: #ff7aa0;
    --accent: #6c5ce7;
    /* Gold/green/red each exist in two grades: the plain var is for TEXT and
       icons sitting on theme surfaces (must stay readable in light mode too),
       the -bright var keeps the vivid shade used over photos / dark glass
       chips / gradient fills where a dark shade would vanish. */
    --gold: #ffd166;
    --gold-bright: #ffd166;
    --green: #2ecc71;
    --green-bright: #2ecc71;
    --red: #ff5b5b;
    --line: #2a2f3d;
    --tg-blue: #229ED9;
    --radius: 18px;
    --nav-h: 64px;
    /* Header (topbar / chat header) gradient end — solid-ish fade of the
       surface colour so scrolled content dims under the sticky header. */
    --header-fade: rgba(23, 26, 35, .85);
    /* Neutral overlays re-tinted per theme: white washes only read on dark
       surfaces, so light mode swaps them for faint dark washes. */
    --hover: rgba(255, 255, 255, .06);
    --glass: rgba(255, 255, 255, .05);
    --skel: rgba(255, 255, 255, .07);
    --chip-tint: rgba(15, 17, 23, .35);
    --av-ring: rgba(255, 255, 255, .85);
    --composer-bg: rgba(30, 34, 46, .96);
    --shadow-card: 0 18px 40px rgba(0, 0, 0, .35);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, .32);
    --shadow-btn: 0 6px 16px rgba(0, 0, 0, .25);
    /* Telegram safe-area top inset (selfie camera / clock / window controls).
       Updated at runtime from TG.contentSafeAreaInset; falls back to the CSS
       env() value so non-Telegram browsers still get a sane inset. */
    --tg-safe-top: env(safe-area-inset-top, 0px);
    /* Telegram safe-area bottom (Android gesture / 3-button navigation bar).
       Updated at runtime from TG.safeAreaInset like --tg-safe-top; the env()
       fallback keeps non-Telegram browsers honest. The chat composer sits on
       this so the input never glues itself to the system navigation bar. */
    --tg-safe-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    /* Verified badge (social-media style blue seal) drawn with a CSS mask so
       one SVG serves every size/spot without an extra font glyph. */
    --vbadge-svg: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z'/%3E%3C/svg%3E");
}

/* ---------- Light theme ----------
   Mirrors the user's Telegram light scheme (set on <html data-theme> from the
   launch payload / themeChanged — there is no manual switch). Surfaces follow
   Telegram's light hierarchy: soft gray page, white cards/headers. Brand hues
   are deepened where they act as text on light surfaces to keep AA contrast
   (muted #67707f ≈ 5:1, gold #a16207 ≈ 4.9:1, green #15803d ≈ 5:1,
   red #dc2626 ≈ 4.8:1, deep pink #d6336c ≈ 4.6:1 on white). */
html[data-theme="light"] {
    color-scheme: light;
    --bg: #eef0f5;
    --bg-soft: #ffffff;
    --card: #ffffff;
    --card-2: #f1f3f8;
    --text: #1c2130;
    --muted: #67707f;
    --primary: #ee3a66;
    --primary-rgb: 238, 58, 102;
    --primary-2: #d6336c;
    --accent: #6c5ce7;
    --gold: #a16207;
    --gold-bright: #ffd166;
    --green: #15803d;
    --green-bright: #2ecc71;
    --red: #dc2626;
    --line: #e3e6ee;
    --tg-blue: #0e7bb6;
    --header-fade: rgba(255, 255, 255, .88);
    --hover: rgba(28, 33, 48, .06);
    --glass: rgba(28, 33, 48, .05);
    --skel: rgba(28, 33, 48, .07);
    --chip-tint: rgba(28, 33, 48, .05);
    --av-ring: rgba(28, 33, 48, .10);
    --composer-bg: rgba(255, 255, 255, .96);
    --shadow-card: 0 12px 32px rgba(23, 32, 64, .12);
    --shadow-pop: 0 8px 24px rgba(23, 32, 64, .14);
    --shadow-btn: 0 4px 12px rgba(23, 32, 64, .10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: 'Vazirmatn', system-ui, 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    direction: rtl;
    overscroll-behavior: none;
}
a { color: var(--primary-2); text-decoration: none; }

/* ---------- Iconir icons (bundled, offline) ---------- */
.iconir { vertical-align: -0.15em; }
.bottom-nav button .ico { display: inline-flex; align-items: center; justify-content: center; }
.icon-btn .iconir { font-size: 18px; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
    font-family: inherit; width: 100%; background: var(--bg-soft);
    color: var(--text); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; font-size: 15px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }

/* ---------- Layout ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh;
    display: flex; flex-direction: column; background: var(--bg); }
#view { flex: 1; padding: 12px; padding-bottom: calc(var(--nav-h) + 62px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }

/* The home feed is a fixed viewport, not a document section. Keep the body
   from rubber-banding when a user drags over the cards, while other views
   remain normally scrollable. */
body.home-open { overflow: hidden; }
body.home-open #app {
    height: 100vh; height: 100dvh; min-height: 0; overflow: hidden;
}
/* overflow-y:auto (not hidden): the anonymous tab declares min-height:340px
   for very short screens — with `hidden` that content was silently clipped
   with no way to reach the bottom tiles. When everything fits, no scrollbar
   appears, so the fixed-viewport feed keeps behaving exactly as before. */
body.home-open #view,
body.home-open #view-home { min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    /* Push the header content below Telegram's top safe area (selfie camera,
       clock, native buttons) when running fullscreen. The 36px base (was 28px,
       +8 for extra clearance) keeps clear of Telegram's floating UI controls. */
    padding-top: calc(36px + var(--tg-safe-top));
    background: linear-gradient(180deg, var(--bg-soft), var(--header-fade));
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 18px; flex: 0 0 auto; white-space: nowrap; }
.topbar .brand span { color: var(--primary); }
/* Status strip: pills sit between the brand and the bell. It scrolls
   horizontally as a last-resort safety valve (scrollbar hidden) and the pills
   collapse to icon-only badges on narrow screens — so the header never
   stretches or breaks the layout, however many badges are active. */
.topbar .status-strip {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    flex: 1 1 auto; min-width: 0;
    overflow-x: auto; scrollbar-width: none;
}
.topbar .status-strip::-webkit-scrollbar { display: none; }
.pill {
    display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
    font-size: 12px; font-weight: 700; white-space: nowrap;
    padding: 5px 10px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    max-width: 130px; overflow: hidden; text-overflow: ellipsis;
}
.pill .iconir { font-size: 14px; flex: none; }
.pill b { font-weight: 800; }
.pill.gold { color: var(--gold); border-color: rgba(255, 209, 102, .4); }
.pill.boost { color: var(--primary-2); border-color: rgba(255, 77, 121, .4); }
/* Narrow layout: pills collapse to icon-only badges (premium = gold star,
   boost = rocket, verified = blue check, online = group + count) so all of
   them fit on one row together with the brand and the bell. #app is capped
   at 480px, so the breakpoint must cover every viewport up to 520px —
   including desktop Telegram windows where #app stays 480px wide. */
@media (max-width: 520px) {
    .topbar .pill { padding: 7px; }
    .topbar .pill-label { display: none; }
}
@media (max-width: 380px) {
    .topbar .brand { font-size: 16px; }
    .topbar .brand span { display: none; }
}
.icon-btn {
    position: relative; background: var(--card); border: 1px solid var(--line);
    color: var(--text); width: 40px; height: 40px; border-radius: 12px; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.badge {
    position: absolute; top: -4px; left: -4px; background: var(--red); color: #fff;
    font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
    animation: badgePop .35s cubic-bezier(.22, 1.4, .36, 1) both;
}
@keyframes badgePop {
    from { transform: scale(0); }
    60% { transform: scale(1.18); }
    to { transform: scale(1); }
}

/* Segmented control (e.g. payment method choice: two buttons, not a select) */
.seg { display: flex; gap: 8px; margin: 4px 0 6px; }
.seg-btn { flex: 1; padding: 11px 8px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--card); color: var(--text); font-size: 14px; cursor: pointer;
    transition: background .18s ease, transform .12s ease; }
.seg-btn:active { transform: scale(.97); }
.seg-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }


/* ---------- Bottom nav ---------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 480px; min-height: var(--nav-h);
    display: flex; background: var(--bg-soft); border-top: 1px solid var(--line);
    z-index: 30;
    /* Extra bottom clearance so the nav never sits under Android's gesture /
       3-button navigation bar (env() covers devices that report it). */
    padding-top: 6px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
}
.bottom-nav button {
    flex: 1; background: none; border: none; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 11px; position: relative;
    padding: 8px 4px; min-height: 48px; white-space: nowrap;
    transition: color .18s ease;
}
.bottom-nav button .ico { font-size: 20px; transition: transform .28s cubic-bezier(.34, 1.56, .64, 1); }
.bottom-nav button:active .ico { transform: scale(.86); }
.bottom-nav button.active { color: var(--primary); }
.bottom-nav button.active .ico { transform: translateY(-2px); }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; margin-bottom: 12px;
}
.card-2 { background: var(--card-2); }
.rounded { border-radius: var(--radius); overflow: hidden; }

/* ---------- Swipe card (minimal, Reels style, always fits the viewport) ---------- */
#feed {
    position: relative;
    width: 100%;
    /* JS sizes this to exactly fill the viewport between the header/tabs and
       the bottom nav (including #view's paddings). Keep the pre-JS placeholder
       small so first paint never pushes content. */
    min-height: 260px;
    overflow: hidden;
    overscroll-behavior: none;
    /* manipulation (not none): the card's photo carousel needs native
       horizontal panning inside the card; the removed drag-to-swipe no longer
       needs to block touch gestures here. */
    touch-action: manipulation;
    border-radius: 24px;
}
.swipe-card {
    position: absolute;
    inset: 0;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 24px; overflow: hidden;
    box-shadow: var(--shadow-card);
    will-change: transform, opacity;
    display: flex; flex-direction: column;
}
/* Behind card: sits below, slightly scaled down. It is a static backdrop —
   the incoming card animates to full size itself (see renderFeed rise-in). */
.swipe-card.behind {
    transform: scale(.95) translateY(6px);
    opacity: .6;
    pointer-events: none;
    z-index: 1;
}
/* Active card sits on top */
.swipe-card.active { z-index: 2; }
/* Rise-in of the incoming card: short, composited motion keeps the stack
   responsive after a like/dislike tap. */
.swipe-card.active:not(.dragging):not(.flying) {
    transition: transform .32s cubic-bezier(.22, 1.12, .36, 1), opacity .24s ease;
}
.swipe-card.active.incoming {
    transition: none;
    transform: scale(.96) translateY(10px);
    opacity: .42;
}
/* Flying: card glides out on an upward arc, fading near the end */
.swipe-card.flying {
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), opacity .24s ease;
    z-index: 3;
}

/* Photo fills the card's remaining height (card = full feed height).
   Solid placeholder bg avoids a white flash / layout shift before the image loads. */
.sc-photo { position: relative; width: 100%; flex: 1 1 auto; min-height: 150px; background: var(--card-2); }
.sc-photo .cover { width: 100%; height: 100%; object-fit: cover; background: var(--card-2); }
/* Image carousel inside the card: native horizontal scroll + snap. Up to 3
   public gallery photos can be swiped left/right without moving the card. */
.sc-track {
    position: absolute; inset: 0;
    display: flex; flex-direction: row; direction: ltr;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scrollbar-width: none;
}
.sc-track::-webkit-scrollbar { display: none; }
.sc-slide {
    position: relative; flex: 0 0 100%; width: 100%; height: 100%;
    scroll-snap-align: center; scroll-snap-stop: always;
}
.sc-slide .cover { width: 100%; height: 100%; object-fit: cover; background: var(--card-2); }
/* Dots (top-center, clear of the online dot and badges) */
.sc-dots {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 5px; z-index: 3;
    padding: 5px 8px; border-radius: 999px;
    background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px);
}
.sc-dot {
    width: 6px; height: 6px; padding: 0; border: none; border-radius: 999px;
    background: rgba(255, 255, 255, .45); transition: width .2s ease, background .2s ease;
}
.sc-dot.on { width: 16px; background: #fff; }
/* Desktop/arrow affordance over the carousel edges */
.sc-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 34px; height: 34px; border-radius: 999px; color: #fff;
    border: 1px solid rgba(255, 255, 255, .16); background: rgba(0, 0, 0, .32);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px); transition: transform .15s ease;
}
.sc-nav:active { transform: translateY(-50%) scale(.94); }
.sc-nav.prev { left: 10px; }
.sc-nav.next { right: 10px; }
.sc-nav .iconir { font-size: 18px; }
.sc-gradient {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to top, rgba(10, 12, 18, .92) 0%, rgba(10, 12, 18, .55) 28%, rgba(10, 12, 18, 0) 55%);
}

/* Badges (boost / premium) top-right — icon-only glass chips */
.sc-badges { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; z-index: 3; }
.sc-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; font-size: 15px;
    border-radius: 999px; backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, .4); color: #fff; border: 1px solid rgba(255, 255, 255, .15);
}
.sc-badge.gold { color: var(--gold-bright); }
.sc-badge.boost { color: var(--primary-2); }
.sc-badge.vrf, .pill.vrf { color: var(--tg-blue); }
/* Blue verified seal next to verified names (social-network style badge;
   colour comes from background-color, the SVG only shapes the alpha). */
.vbadge {
    display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
    background-color: #3897f0;
    -webkit-mask: var(--vbadge-svg) center / contain no-repeat;
    mask: var(--vbadge-svg) center / contain no-repeat;
}
/* Boosted profiles: purple "بوست" chip in name rows and a glowing card frame */
.boost-chip {
    display: inline-flex; align-items: center; gap: 3px; vertical-align: -4px;
    padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800;
    color: #b6adff; background: rgba(108,92,231,.18); border: 1px solid rgba(108,92,231,.45);
}
.boost-chip .iconir { font-size: 11px; }
.swipe-card.is-boosted {
    border-color: rgba(108,92,231,.55);
    box-shadow: 0 0 0 1px rgba(108,92,231,.35), 0 10px 40px rgba(108,92,231,.22);
}

/* Online dot top-left */
.sc-online-wrap { position: absolute; top: 12px; left: 12px; z-index: 3; }
.sc-online {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 999px;
    background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(6px);
}
.sc-online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 6px var(--green-bright); }
.sc-online.recent .dot { background: var(--gold); box-shadow: none; }

/* Shared attributes and profile tags — single gold pill next to the city */
.sc-common-count {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 700; color: var(--gold-bright);
    background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 209, 102, .35);
    padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(4px);
}
.sc-common-count .iconir { font-size: 13px; }
.common-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.common-chip {
    display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(46, 204, 113, .16); border: 1px solid rgba(46, 204, 113, .4); color: #d6ffe6;
}
.common-chip.int { background: rgba(255, 77, 121, .16); border-color: rgba(255, 77, 121, .4); color: #ffd7e2; }
.common-chip .iconir { font-size: 13px; }
/* On the profile sheet the chips sit on the dark card background */
.common-card .common-chip { color: var(--text); }
.common-card .common-chip.int { color: var(--text); }


/* Info overlay — minimal: name/age + one meta row (city · common count).
   Fluid sizes adapt to any phone width via clamp(). */
.sc-info { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(12px, 3.5vw, 16px); color: #fff; z-index: 2; cursor: pointer; }
.sc-name { font-size: clamp(19px, 5.5vw, 23px); font-weight: 800; display: flex; align-items: baseline; gap: 8px; text-shadow: 0 1px 6px rgba(0,0,0,.5); min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-name .sc-age { font-size: clamp(15px, 4.2vw, 18px); font-weight: 600; opacity: .9; flex: none; }
.sc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sc-city { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; opacity: .92; text-shadow: 0 1px 4px rgba(0,0,0,.5); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-city .iconir { font-size: 14px; flex: none; }

/* Action buttons — like / dislike are the primary pair: colored, side by
   side, filling the full width between the two corners. Chat / gift are
   secondary glass squares at the edges (slightly rounded, not circles). */
.swipe-actions {
    display: flex; gap: 10px; align-items: stretch;
    /* Horizontal inset keeps the corner (chat/gift) buttons clear of the
       card borders — matches the info overlay padding above the row. */
    padding: 12px clamp(12px, 3.5vw, 16px) 6px; position: relative; z-index: 2;
}
.sc-act {
    border: none; border-radius: 14px; color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-btn); transition: transform .15s ease, box-shadow .15s ease;
}
.sc-act .iconir { font-size: 22px; }
.sc-act:active { transform: scale(.97); }
/* Secondary corner buttons (chat / gift) */
.sc-act.side {
    flex: 0 0 58px; height: 58px;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(8px); color: var(--text);
}
.sc-act.side.chat { color: var(--primary-2); }
.sc-act.side.gift { color: var(--gold); }
/* Primary pair (dislike / like) — share the full remaining width */
.sc-main { flex: 1 1 auto; display: flex; gap: 10px; min-width: 0; }
.sc-act.main { flex: 1 1 0; height: 58px; min-width: 0; flex-direction: column; gap: 1px; }
.sc-act.main small { font-size: 9px; line-height: 1; font-weight: 700; }
.sc-act.main.dislike { background: linear-gradient(145deg, #ff6b6b, #ff3d3d); }
.sc-act.main.like { background: linear-gradient(145deg, #3ee08a, #23c46e); }

/* Empty feed card — shown when there is nothing left to swipe */
.feed-empty {
    background: linear-gradient(180deg, var(--card), var(--bg-soft));
    display: flex; align-items: center; justify-content: center;
}
.fe-body { text-align: center; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fe-icon {
    width: 76px; height: 76px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
    color: var(--primary-2); background: rgba(255, 77, 121, .1); border: 1px solid rgba(255, 77, 121, .25);
}
.fe-title { font-size: 18px; font-weight: 800; }
.fe-sub { color: var(--muted); font-size: 13px; line-height: 1.9; max-width: 32ch; }
.fe-btn {
    margin-top: 6px; display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--card);
    color: var(--text); font-weight: 700; font-size: 14px; padding: 11px 24px;
    transition: transform .15s ease;
}
.fe-btn:active { transform: scale(.96); }
.fe-btn .iconir { font-size: 16px; }
/* End-of-feed quick chat actions: random/anon/girl/boy tiles + a wide "more"
   button that opens the anonymous-chat tab. */
.fe-actions {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px;
    width: 100%; max-width: 320px; margin-top: 8px;
}
.fe-act {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 12px 10px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--card); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
    transition: transform .15s ease;
}
.fe-act:active { transform: scale(.96); }
.fe-act .fe-act-ico { font-size: 16px; line-height: 1; }
.fe-act .iconir { font-size: 15px; }
.fe-act.wide {
    grid-column: 1 / -1;
    color: var(--primary-2); border-color: rgba(255,77,121,.35); background: rgba(255,77,121,.08);
}

/* Feed skeleton — placeholder card with pulsing blocks while the first batch
   of profiles loads. Opacity-only pulse: composited, no repaint per frame. */
.sk-card { background: var(--card); }
.sk-photo { position: relative; flex: 1 1 auto; background: var(--card-2); }
.sk-lines { position: absolute; right: clamp(12px, 3.5vw, 16px); left: clamp(12px, 3.5vw, 16px); bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.sk-line { position: relative; overflow: hidden; border-radius: 9px; background: var(--skel); }
.sk-line.w1 { height: 22px; width: 52%; }
.sk-line.w2 { height: 14px; width: 74%; }
.sk-box {
    position: relative; overflow: hidden; flex: 1 1 0; min-width: 0; height: 58px;
    border-radius: 14px; background: var(--skel); border: 1px solid var(--line);
}
.sk-box.side { flex: 0 0 58px; }
.sk-photo::after, .sk-line::after, .sk-box::after {
    content: ''; position: absolute; inset: 0; background: var(--skel);
    animation: skPulse 1.4s ease-in-out infinite;
}
@keyframes skPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* LIKE / NOPE stamp — pops centered over the feed while the card flies out */
.sc-stamp {
    position: absolute; top: 50%; left: 50%; z-index: 6;
    width: 112px; height: 112px; margin: -56px 0 0 -56px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 56px; color: #fff; pointer-events: none;
    animation: stampPop .65s cubic-bezier(.22, 1, .36, 1) forwards;
}
.stamp-like { background: rgba(46, 204, 113, .88); box-shadow: 0 0 44px rgba(46, 204, 113, .45); }
.stamp-nope { background: rgba(255, 91, 91, .88); box-shadow: 0 0 44px rgba(255, 91, 91, .45); }
@keyframes stampPop {
    0% { transform: scale(.4) rotate(-14deg); opacity: 0; }
    30% { transform: scale(1.12) rotate(-4deg); opacity: 1; }
    50% { transform: scale(1) rotate(-6deg); opacity: 1; }
    100% { transform: scale(1.22) rotate(-10deg); opacity: 0; }
}


/* ---------- Buttons ---------- */
.btn {
    display: block; width: 100%; text-align: center; padding: 13px;
    border-radius: 14px; border: none; font-weight: 700; font-size: 15px;
    background: var(--primary); color: #fff; margin-top: 12px;
    transition: transform .15s ease, opacity .2s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); filter: brightness(1.06); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.gold { background: var(--gold-bright); color: #1a1a1a; }
.btn.accent { background: var(--accent); }
.btn:disabled { opacity: .5; transform: none; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 10px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--card-2); }
/* Letter monogram fallback when no profile photo (Telegram-style) */
.avatar-fb {
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 18px; line-height: 1;
    user-select: none; -webkit-user-select: none; overflow: hidden;
}
span.chat-peer-avatar { font-size: 16px; }
/* Anonymous chats: identity icon on a fixed distinct background */
.avatar-fb.anon {
    background: linear-gradient(135deg, #5b6b8c, #38455c) !important;
    color: #fff;
}
.avatar-fb.anon .iconir { font-size: 24px; width: 1em; height: 1em; }
span.chat-peer-avatar.avatar-fb.anon .iconir { font-size: 20px; }
.avatar.sm { width: 38px; height: 38px; }
.avatar.lg { width: 96px; height: 96px; }

/* ---------- Chat ---------- */
.conv { display: flex; gap: 10px; align-items: center; padding: 12px;
    border-bottom: 1px solid var(--line); }
.conv .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { background: var(--primary); color: #fff; border-radius: 10px; font-size: 11px;
    padding: 1px 7px; min-width: 18px; text-align: center; }

/* ---- Chat list: pin indicator ---- */
.conv.pinned { background: rgba(var(--primary-rgb, 238, 58, 102), .06); }
.conv-pin { display: inline; margin-right: 4px; color: var(--primary); font-size: 12px; }
.conv-mute { display: inline; margin-right: 4px; color: var(--muted); font-size: 12px; opacity: .7; }
/* Feed mutual-match: same row, different stroke — the colored edge is the
   only change so matched chats stand out without shouting. */
.conv.matched { border-right: 3px solid var(--primary); background: rgba(255,77,121,.05); }
.conv-match-badge { display: inline-flex; margin-right: 5px; color: var(--primary); font-size: 11px; vertical-align: 1px; }

/* ---- Mutual-match celebration sheet ---- */
.match-sheet { position: relative; text-align: center; overflow: hidden; padding: 6px 0 2px; }
.match-glow {
    position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
    width: 340px; height: 340px; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(255,77,121,.28), rgba(255,209,102,.12) 45%, transparent 70%);
    animation: matchGlow 2.6s ease-in-out infinite;
}
@keyframes matchGlow {
    0%, 100% { opacity: .7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}
.match-hearts { position: absolute; inset: 0; pointer-events: none; }
.match-fh {
    position: absolute; bottom: 40px; color: var(--primary); font-size: 16px;
    opacity: 0; animation: matchFloat 3.4s ease-in infinite;
}
.match-fh:nth-child(2n) { color: var(--gold); font-size: 12px; }
.match-fh:nth-child(3n) { font-size: 20px; }
@keyframes matchFloat {
    0% { opacity: 0; transform: translateY(30px) scale(.6) rotate(-12deg); }
    18% { opacity: .9; }
    100% { opacity: 0; transform: translateY(-170px) scale(1.1) rotate(14deg); }
}
.match-avatars { position: relative; display: flex; justify-content: center; align-items: center; }
.match-av {
    display: inline-flex; width: 92px; height: 92px; border-radius: 50%;
    border: 3px solid var(--av-ring); overflow: hidden; background: var(--card-2);
    box-shadow: var(--shadow-card);
    animation: matchPop .5s cubic-bezier(.34, 1.56, .64, 1) both;
}
.match-av img { width: 100%; height: 100%; object-fit: cover; }
.match-av.peer {
    margin-right: -16px; transform: rotate(8deg);
    border-color: var(--primary);
    animation-delay: .18s;
}
.match-av:not(.peer) { transform: rotate(-8deg); }
@keyframes matchPop {
    from { opacity: 0; transform: scale(.3) rotate(-30deg); }
    to { opacity: 1; }
}
.match-av.peer { animation-name: matchPopPeer; }
@keyframes matchPopPeer {
    from { opacity: 0; transform: scale(.3) rotate(30deg); }
    to { opacity: 1; transform: scale(1) rotate(8deg); }
}
.match-score {
    position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
    /* auto margins center the fixed-width badge inside the sheet's column
       flex body (stretch would otherwise pin it to the inline-start edge) */
    margin: -26px auto 0; width: 64px; height: 64px; justify-content: center;
    border-radius: 50%; background: linear-gradient(145deg, var(--primary), var(--gold));
    color: #fff; box-shadow: 0 6px 20px rgba(255,77,121,.45);
    animation: scorePop .45s cubic-bezier(.34, 1.56, .64, 1) .4s both;
}
.match-score b { font-size: 15px; line-height: 1.1; }
.match-score small { font-size: 9px; opacity: .9; }
@keyframes scorePop {
    from { opacity: 0; transform: scale(.4); }
    to { opacity: 1; transform: scale(1); }
}
.match-title { margin: 10px 0 4px; font-size: 20px; }
.match-text { margin: 0; color: var(--muted); font-size: 14px; }
.match-chips { justify-content: center; margin-top: 10px; }

/* ---- Chat tabs (all / normal / anonymous) ---- */
.chat-tabs {
    display: flex; gap: 4px; padding: 4px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    margin: 0 0 12px;
}
.chat-tabs button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: none; border: none; color: var(--muted);
    font-size: 13px; font-weight: 700; padding: 10px 6px; border-radius: 10px;
    transition: background .18s, color .18s, transform .12s ease;
}
.chat-tabs button:active { transform: scale(.97); }
.chat-tabs button.on { background: var(--primary); color: #fff; }

/* ---- Chat search bar (find a chat by user or message text across ALL chats) ---- */
.chat-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 4px 12px; margin: 0 0 10px;
}
.chat-search .iconir-search { color: var(--muted); font-size: 15px; flex: none; }
.chat-search input {
    flex: 1 1 auto; min-width: 0; border: none; background: none; outline: none;
    color: var(--text); font-size: 13px; padding: 10px 0; font-family: inherit;
}
.chat-search input::placeholder { color: var(--muted); }
.chat-search-clear {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; border-radius: 50%;
    background: var(--line); color: var(--muted); font-size: 12px; cursor: pointer;
}
/* How many messages matched the search inside one conversation. */
.conv-search-count {
    display: inline-block; background: var(--line); color: var(--muted);
    border-radius: 10px; font-size: 10px; font-weight: 700;
    padding: 1px 6px; float: left;
}

/* ---- Anonymous badge in chat list ---- */
.conv-anon-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    background: var(--accent, #6e56cf); color: #fff; border-radius: 8px;
    padding: 1px 6px; margin-right: 4px; vertical-align: middle;
}

/* ---- Chat context menu (long-press / right-click) ---- */
.conv-menu { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
    border-radius: 16px 16px 0 0; padding: 12px 0 20px; z-index: 999;
    box-shadow: 0 -4px 20px rgba(0,0,0,.25);
    animation: convMenuUp .24s cubic-bezier(.22, 1, .36, 1); }
.modal.closing .conv-menu { animation: convMenuDown .18s ease forwards; }
@keyframes convMenuUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes convMenuDown { to { transform: translateY(100%); } }
.conv-menu-btn { display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 20px; border: none; background: none; color: var(--text);
    font-size: 15px; cursor: pointer; text-align: right; direction: rtl; }
.conv-menu-btn:active { background: var(--hover); }
.conv-menu-btn.danger { color: var(--red, #e74c3c); }

/* When a conversation is open the mini app's default header and bottom nav are
   hidden; the conversation takes over the whole viewport with its own header
   and a fixed input bar pinned to the bottom. */
body.chat-open .topbar,
body.chat-open .bottom-nav { display: none !important; }
body.chat-open #view { padding: 0; padding-bottom: 0; }

/* Conversation container fills the viewport: header (top) + scrollable messages
   + fixed composer (bottom). --tg-vh is the LIVE Telegram viewport height
   (updated from JS on viewportChanged): with the keyboard open it shrinks, so
   the composer rides above the keyboard instead of being covered by it.
   Browsers outside Telegram fall back to 100dvh. */
#conv-box { display: flex; flex-direction: column; }
body.chat-open #conv-box {
    position: fixed; inset: 0; z-index: 40; max-width: 480px; margin: 0 auto;
    height: var(--tg-vh, 100dvh);
    /* Telegram-style faint doodle wallpaper (transparent PNG, tiled) over the
       base colour — gives the conversation texture without hurting contrast.
       The PNG alpha already carries the subtlety; no extra opacity layer. */
    background-color: var(--bg);
    background-image: url('../images/chat-pattern.png');
    background-repeat: repeat;
    background-size: 400px 400px;
}
body.chat-open #conv-box.chat-entering { animation: conversationEnter .3s cubic-bezier(.22, 1, .36, 1); }
body.chat-open #conv-box.chat-exiting {
    animation: conversationExit .24s cubic-bezier(.4, 0, 1, 1) forwards;
    pointer-events: none;
}
@keyframes conversationEnter {
    from { opacity: .88; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes conversationExit {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(18px); }
}

/* Dedicated conversation header (replaces the default mini app header).
   Same 36px base clearance as .topbar — 26px let Telegram's floating window
   controls overlap the avatar row in fullscreen mode. */
.chat-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;     padding-top: calc(36px + var(--tg-safe-top));
    background: linear-gradient(180deg, var(--bg-soft), var(--header-fade));
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
    flex: 0 0 auto; z-index: 2;
}
.chat-back {
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    width: 38px; height: 38px; border-radius: 12px; font-size: 18px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
}
/* Direct gift sending inside the conversation (header button) */
.chat-gift {
    background: var(--card); border: 1px solid rgba(255,209,102,.4); color: var(--gold);
    width: 38px; height: 38px; border-radius: 12px; font-size: 17px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s ease;
}
.chat-gift:active { transform: scale(.92); }
.chat-peer-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--card-2); flex: 0 0 auto; }
.chat-peer-meta { flex: 1; min-width: 0; }
.chat-peer-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer-status { font-size: 12px; color: var(--muted); }
/* Typing indicator: three pulsing dots next to "در حال نوشتن..." */
.typing-ind { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.typing-ind i {
    width: 5px; height: 5px; border-radius: 50%; background: var(--primary);
    animation: typingPulse 1.1s infinite ease-in-out;
}
.typing-ind i:nth-child(2) { animation-delay: .18s; }
.typing-ind i:nth-child(3) { animation-delay: .36s; }
@keyframes typingPulse {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

/* Messages area: scrolls between header and composer.
   The FIRST bubble is pushed to the bottom (margin-top:auto) so short
   conversations start at the bottom of the screen like every messenger,
   instead of hugging the top with a large empty gap below. */
.chat-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.chat-box > .msg:first-child { margin-top: auto !important; }
.msg.pending { opacity: .55; }
body.chat-open .chat-box { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.msg { position: relative; max-width: 78%; padding: 9px 13px 9px; border-radius: 16px;
    font-size: 14px; word-break: break-word; }
.msg.me { margin-left: auto; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { margin-right: auto; background: var(--card-2); border-bottom-left-radius: 4px; }
/* Time + read receipts sit in a meta row BELOW the message body (not beside
   the text), pinned to the bubble's visual end (left side in RTL). */
.msg-meta { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 3px; line-height: 1; }
/* Grouped chat notification counter ("۳ پیام از این کاربر") */
.notif-cnt { display: inline-block; font-size: 10px; font-weight: 700; color: var(--primary-2);
    background: rgba(255,77,121,.12); border-radius: 999px; padding: 1px 8px; margin-right: 6px; vertical-align: middle; }
.msg-time { display: inline-block; font-size: 10px; opacity: .7; }
.msg-checks { display: inline-flex; align-items: center; font-size: 10px; opacity: .7; }
.msg-checks .iconir { width: 13px; height: 13px; display: inline-block; }
.msg-checks.seen { opacity: 1; color: #7dd3fc; }
/* Reaction chip INSIDE the bubble, directly under the message body/meta row.
   Tapping it re-opens the message menu so the emoji can be changed/removed. */
.msg-reaction { display: flex; justify-content: flex-start; margin-top: 5px; }
.msg.me .msg-reaction { justify-content: flex-end; }
.msg-reaction button {
    border: 1px solid var(--line); background: var(--card); color: var(--text);
    border-radius: 999px; padding: 1px 10px; font-size: 13px; line-height: 1.6;
    cursor: pointer; transition: transform .12s ease;
}
.msg-reaction button:active { transform: scale(.92); }
.msg.them .msg-reaction button { background: rgba(255,255,255,.08); }
.msg.me .msg-reaction button { background: rgba(255,255,255,.18); border-color: transparent; }

/* Message menu (sheet opened by tapping a bubble): a scrollable emoji bar on
   top for instant reactions, then reply / report. */
.msg-emoji-bar {
    display: flex; gap: 4px; overflow-x: auto; padding: 4px 2px 10px;
    scrollbar-width: none; border-bottom: 1px solid var(--line);
}
.msg-emoji-bar::-webkit-scrollbar { display: none; }
.msg-emoji {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid transparent; background: var(--card-2); color: var(--text);
    font-size: 21px; line-height: 1; display: flex; align-items: center;
    justify-content: center; cursor: pointer; transition: transform .12s ease;
}
.msg-emoji:active { transform: scale(.88); }
.msg-emoji.on { border-color: var(--primary); background: rgba(255,77,121,.14); }
.msg-menu-list { display: flex; flex-direction: column; margin-top: 8px; }
.msg-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 8px;
    border: none; background: none; color: var(--text); font-family: inherit;
    font-size: 15px; text-align: right; cursor: pointer; border-radius: 12px;
}
.msg-menu-item:active { background: var(--hover); }
.msg-menu-item.danger { color: var(--red); }
/* Bot-relayed media the Mini App cannot render: a card that deep-links into
   the Telegram chat where the media actually lives. */
.msg.has-media-link { padding: 8px; }
.msg-media-card { min-width: 175px; text-align: center; padding: 6px 4px 2px; }
.msg-media-card .mmc-ico { font-size: 32px; line-height: 1.2; }
.msg-media-card .mmc-caption { font-size: 13px; margin: 5px 2px; word-break: break-word; opacity: .9; }
.msg-media-card .mmc-btn {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
    border: 1px solid rgba(34,158,217,.5); color: #65c5ef; background: rgba(34,158,217,.12);
    border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 700;
    text-decoration: none;
}
.msg-media-card .mmc-btn:active { transform: scale(.97); }
/* Gift sent inside the conversation: a celebratory centered card */
.msg.gift-bubble {
    margin-left: auto; margin-right: auto; max-width: 72%; text-align: center;
    background: linear-gradient(150deg, rgba(255,209,102,.18), rgba(255,77,121,.12) 60%), var(--card);
    border: 1px solid rgba(255,209,102,.45);
    padding: 14px 18px 10px;
}
.msg-gift .gift-emoji { font-size: 46px; line-height: 1.15; filter: drop-shadow(0 4px 14px rgba(255,209,102,.35)); }
.msg-gift .gift-name { font-weight: 800; font-size: 14px; margin-top: 3px; }
.msg-gift .gift-from { font-size: 11px; opacity: .85; margin-top: 1px; }
.msg-media { border-radius: 12px; max-width: 220px; max-height: 260px; width: 100%;
    object-fit: cover; cursor: pointer; display: block; }
/* Media bubbles tighten their padding. The `.has-media` class comes from
   msgHtml() — `:has()` is the fallback for safety, since older Android
   WebViews inside Telegram don't implement it (padding stayed 9px 13px). */
.msg.has-media { padding: 4px 4px 6px; }
.msg:has(.msg-media) { padding: 4px 4px 6px; }
.msg-quote {
    border-right: 3px solid var(--primary); background: rgba(0,0,0,.06);
    border-radius: 8px; padding: 5px 9px; margin-bottom: 6px; cursor: pointer;
    max-width: 100%; overflow: hidden;
}
.msg.them .msg-quote { border-right-color: var(--primary); background: rgba(0,0,0,.05); }
.msg.me .msg-quote { border-right-color: rgba(255,255,255,.7); background: rgba(255,255,255,.18); }
.msg-quote-name { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 1px; }
.msg.me .msg-quote-name { color: rgba(255,255,255,.95); }
.msg-quote-text {
    font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
}
@keyframes flashHi { 0%,100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } 30% { box-shadow: 0 0 0 3px var(--primary); } }
.msg.flash { animation: flashHi .9s ease; }

/* Quote-reply bar above the composer */
.reply-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--bg-soft); border-top: 1px solid var(--line); flex: 0 0 auto;
}
.reply-bar-body { flex: 1 1 auto; min-width: 0; }
.reply-bar-name { font-size: 11px; font-weight: 700; color: var(--primary); }
.reply-bar-text {
    font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
}
.reply-bar-cancel {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: none;
    background: var(--card-2); color: var(--text); display: flex; align-items: center;
    justify-content: center; cursor: pointer;
}

/* Smooth entrance for newly sent / received messages */
.msg.enter { animation: msgIn .28s cubic-bezier(.22, 1, .36, 1); }
.msg.me.enter { transform-origin: bottom left; }
.msg.them.enter { transform-origin: bottom right; }
@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Quick-reply chips: short canned messages shown above the composer
   until the conversation has its first messages. */
.quick-chips {
    display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 0;
    background: var(--bg-soft); border-top: 1px solid var(--line);
    flex: 0 0 auto; scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chip {
    flex: 0 0 auto; border: 1px solid var(--line); background: var(--card-2);
    color: var(--text); border-radius: 999px; padding: 7px 13px; font-size: 13px;
    cursor: pointer; white-space: nowrap; font-family: inherit;
}
.quick-chip:active { transform: scale(.95); background: var(--primary); color: #fff; border-color: var(--primary); }

/* Fixed input bar pinned to the bottom of the conversation */
.composer {
    display: flex; gap: 8px; align-items: center;
    /* Bottom clearance = breathing room + the system navigation bar inset
       (Android gesture bar) so the box never sticks to the screen edge. */
    /* Extra breathing room below the box: on Android the system navigation
       bar (gesture pill or 3-button row) sits right under the WebView, so the
       input must never be glued to the bottom edge. */
    margin: 8px 12px calc(18px + var(--tg-safe-bottom));
    padding: 6px 8px;
    background: var(--composer-bg); border: 1px solid var(--line);
    border-radius: 999px; box-shadow: var(--shadow-pop);
    flex: 0 0 auto;
}
body.chat-open .composer { position: sticky; bottom: 0; z-index: 2; }
.composer input {
    border: none; border-radius: 999px; background: transparent;
    padding: 10px 6px; flex: 1 1 auto; min-width: 0;
}
.composer input:focus { border-color: transparent; }
.composer-media, .composer-send, .composer-mic {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: none;
    color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center;
    transition: transform .12s ease;
}
.composer-media { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.composer-send { background: var(--primary); }
.composer-mic { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.composer.voice-starting .composer-mic { opacity: .55; pointer-events: none; }
.composer-media:active, .composer-send:active, .composer-mic:active { transform: scale(.9); }
/* The paper-plane send icon points right by default; in the RTL chat composer
   the send button sits on the left, so mirror the icon to point left. */
.composer-send .iconir { transform: scaleX(-1); }

/* Telegram pattern: mic while the input is empty, send once there is text. */
.composer.has-text .composer-mic { display: none; }

/* Recording mode: the normal composer row is replaced by the rec indicator */
.composer-rec { display: none; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; }
.composer.recording .composer-media,
.composer.recording .composer input,
.composer.recording .composer-send,
.composer.recording .composer-mic { display: none; }
.composer.recording .composer-rec { display: flex; }
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: recPulse 1.1s ease infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rec-time { flex: none; font-weight: 700; font-size: 13px; min-width: 40px; }
.rec-hint { flex: 1 1 auto; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-trash, .rec-send {
    flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
    transition: transform .12s ease;
}
.rec-trash { background: var(--card-2); color: var(--red); }
.rec-send { background: var(--primary); color: #fff; border: none; }
.rec-send .iconir { transform: scaleX(-1); }
.rec-trash:active, .rec-send:active { transform: scale(.9); }

/* ---------- Media upload bubble (image / voice progress + retry) ---------- */
.msg-upload { display: flex; gap: 8px; align-items: center; max-width: 86%; }
.up-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; }
.up-voice { flex: none; width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.up-body { flex: 1 1 auto; min-width: 130px; }
.up-label { font-size: 11px; opacity: .9; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,.28); overflow: hidden; }
.up-fill { height: 100%; width: 0%; background: #fff; border-radius: 999px; transition: width .2s ease; }
.up-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; }
.up-pct { opacity: .85; }
.up-actions { display: flex; gap: 6px; }
.up-btn { border: none; background: rgba(255,255,255,.2); color: #fff; font-family: inherit;
    font-size: 11px; padding: 3px 9px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.up-btn .iconir { font-size: 11px; }
.up-btn:active { transform: scale(.95); }
/* Failed state: bubble flips to neutral card colors, bar turns red, retry shows */
.msg-upload.failed { background: var(--card-2); color: var(--text); }
.msg-upload.failed .up-bar { background: rgba(255,91,91,.25); }
.msg-upload.failed .up-fill { background: var(--red); }
.msg-upload.failed .up-btn { background: var(--primary); }

/* ---------- Voice message player ---------- */
.voice-msg { display: flex; align-items: center; gap: 8px; min-width: 168px; padding: 3px 0; }
.voice-play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.22); color: #fff; font-size: 14px;
    display: flex; align-items: center; justify-content: center; cursor: pointer; }
.voice-play:active { transform: scale(.92); }
.msg.them .voice-play { background: rgba(0,0,0,.07); color: var(--text); }
.voice-wave { flex: 1 1 auto; height: 4px; border-radius: 999px; background: rgba(255,255,255,.32); overflow: hidden; }
.msg.them .voice-wave { background: rgba(0,0,0,.1); }
.voice-fill { height: 100%; width: 0%; background: #fff; border-radius: 999px; transition: width .15s linear; }
.msg.them .voice-fill { background: var(--primary); }
.voice-dur { flex: none; font-size: 11px; opacity: .85; }

/* Full-size image viewer overlay (tap a chat image) */
.img-viewer { align-items: center; padding: 20px; }
.img-viewer img { max-width: 100%; max-height: 90vh; border-radius: 12px; object-fit: contain;
    animation: imgZoom .22s cubic-bezier(.22, 1, .36, 1); }
@keyframes imgZoom { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* Gallery (profile sheet + manager) */
.gal-item { position: relative; }
.gal-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column;
    gap: 2px; background: rgba(0,0,0,.45); color: #fff; border: none; border-radius: 12px; font-size: 13px; font-weight: 700;
    transition: transform .12s ease; }
.gal-lock:active { transform: scale(.94); }
.gal-lock.premium { background: rgba(120,90,0,.55); }
.gal-lock.paid { cursor: pointer; }
.gal-lock i { font-size: 22px; }

.gal-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.gal-row { display: flex; gap: 10px; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.gal-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.gal-ctrl { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.gal-price { width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); }
.gal-price:disabled { opacity: .5; }
.radio-group.small .radio span { font-size: 12px; padding: 3px 8px; }
.btn.tiny { padding: 4px 8px; font-size: 12px; width: auto; margin: 0; }
.btn.tiny.danger { color: var(--red); border-color: var(--red); }

/* ---------- Gifts ---------- */
.gift-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* Reaction picker (bottom sheet): one row of emoji per 6, tap to react */
.react-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.react-opt {
    aspect-ratio: 1; display: grid; place-items: center; font-size: 22px;
    background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
    transition: transform .12s ease, border-color .15s ease;
}
.react-opt:active { transform: scale(.9); }
.react-opt.on { border-color: var(--primary); background: rgba(255,77,121,.12); }
.gift-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 12px; text-align: center; transition: transform .12s ease; }
.gift-item:active { transform: scale(.95); }
.gift-item .emoji { font-size: 30px; }
.gift-item .gname { font-size: 13px; margin-top: 4px; }
.gift-item .gprice { font-size: 12px; color: var(--gold); margin-top: 2px; }

/* ---------- Forms / misc ---------- */
.section-title { font-size: 16px; font-weight: 700; margin: 14px 4px 8px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.tag { display: inline-block; background: var(--card-2); border: 1px solid var(--line);
    border-radius: 999px; padding: 4px 10px; font-size: 12px; margin: 3px; }
.profile-attribute-tags, .profile-relationship-tags { margin: 10px 0; }
.profile-attribute-tags .section-title, .profile-relationship-tags .section-title { margin-top: 8px; }

/* ---------- Radio group (gender etc.) ---------- */
.radio-group { display: flex; gap: 8px; margin: 6px 0 2px; }
.radio-group .radio {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 8px; cursor: pointer; color: var(--muted); font-size: 14px;
    transition: background .18s, border-color .18s, color .18s, transform .12s ease;
    margin: 0;
}
.radio-group .radio input { display: none; }
.radio-group .radio:active { transform: scale(.99); }
.radio-group .radio.on {
    background: rgba(255, 77, 121, .12);
    border-color: var(--primary);
    color: var(--text);
    font-weight: 700;
}
/* In-app new-message banner (top of screen, slides down) */
.msg-banner {
    position: fixed; top: calc(10px + var(--tg-safe-top, 0px)); left: 10px; right: 10px; z-index: 100;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 10px 14px; box-shadow: var(--shadow-pop);
    cursor: pointer; opacity: 0; transform: translateY(-16px);
    transition: opacity .25s ease, transform .25s ease;
    max-width: 420px; margin: 0 auto;
}
.msg-banner.on { opacity: 1; transform: translateY(0); }
.msg-banner .mb-row { display: flex; align-items: center; justify-content: space-between; }
.msg-banner .mb-name { font-weight: 700; font-size: 14px; }
.msg-banner .mb-close {
    background: none; border: none; color: var(--muted); font-size: 16px;
    cursor: pointer; padding: 0 2px; line-height: 1;
}
.msg-banner .mb-text {
    font-size: 13px; color: var(--muted); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}

.toast {
    position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%;
    transform: translateX(-50%) translateY(14px) scale(.96);
    background: var(--card-2); color: var(--text); border: 1px solid var(--line);
    padding: 10px 16px; border-radius: 12px; z-index: 90; opacity: 0;
    transition: opacity .28s cubic-bezier(.22, 1, .36, 1), transform .28s cubic-bezier(.22, 1, .36, 1);
    max-width: 90%; pointer-events: none; text-align: center; word-break: break-word;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
/* While a conversation is open the bottom nav is hidden — keep the toast visible */
body.chat-open .toast { bottom: calc(16px + var(--tg-safe-bottom)); }
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50;
    display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn .18s ease;
}
.modal .sheet { width: 100%; max-width: 480px; background: var(--bg-soft);
    border-top-left-radius: 22px; border-top-right-radius: 22px; padding: 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); max-height: 86vh; max-height: 86dvh; overflow: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    animation: sheetUp .24s cubic-bezier(.22, 1, .36, 1); }
.modal .sheet h3 { margin: 0 0 12px; }
/* Fullscreen profile view (instead of the half-page bottom sheet) */
.modal.full { align-items: stretch; }
.modal.full .sheet {
    position: relative; max-width: 480px; height: 100%; max-height: none; border-radius: 0;
    border-top: none; padding-top: calc(14px + var(--tg-safe-top, 0px));
    animation: sheetUp .26s cubic-bezier(.22, 1, .36, 1);
}
/* Other users' profiles open as a full-screen sheet. Keep the title/content
   comfortably below Telegram's top chrome and safe-area inset. */
.modal.full.profile-other .sheet {
    padding-top: calc(28px + var(--tg-safe-top, 0px));
}
/* In the browser fallback a close button floats top-left (inline-end in RTL);
   keep long titles from running underneath it. */
.modal.full .sheet > h3 { padding-inline-end: 46px; }
.sheet-close {
    position: absolute; top: calc(10px + var(--tg-safe-top, 0px)); left: 12px; z-index: 2;
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
    background: var(--card); color: var(--text); display: inline-flex; align-items: center;
    justify-content: center; cursor: pointer;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
/* Closing state (toggled from JS just before .remove()): the sheet slides
   back down while the backdrop fades, so dismissing a sheet no longer feels
   like the whole layer blinked out of existence. */
.modal.closing { animation: fadeOut .18s ease forwards; pointer-events: none; }
.modal.closing .sheet { animation: sheetDown .2s cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetDown { to { transform: translateY(26px); opacity: .4; } }
/* Lock background scroll while a sheet/menu is open (toggled from JS) */
body.modal-open { overflow: hidden; }
.skel { background: linear-gradient(90deg,var(--card),var(--card-2),var(--card));
    background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; height: 16px; }
@keyframes sk { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Register overlay */
#register { position: fixed; inset: 0; background: var(--bg); z-index: 80; overflow: auto; padding: 20px; padding-top: calc(20px + var(--tg-safe-top)); }
#register .hero { text-align: center; margin: 18px 0 10px; }
#register .hero h1 { font-size: 30px; margin: 0; }
#register .hero h1 span { color: var(--primary); }
.preview-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px;
    border: 3px solid var(--primary); background: var(--card-2); }

/* profile tag chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px;
    padding: 7px 12px; font-size: 13px; color: var(--muted); }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* city picker / interest chips were registration-only and removed (bot handles registration) */

/* ---------- Search: input + horizontal filter bar ---------- */
.search-head { margin-bottom: 8px; }
.search-input {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
    padding: 0 12px;
}
.search-input .iconir { color: var(--muted); font-size: 18px; }
.search-input input { border: none; background: transparent; padding: 12px 0; }
.search-input input:focus { border: none; }

/* Horizontal scrolling filter bar (chips) - keeps filters off the main page area */
.filter-bar {
    display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding: 4px 2px 10px;
    margin: 0 -12px 6px; padding-left: 12px; padding-right: 12px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    touch-action: pan-x; user-select: none; cursor: grab;
}
.filter-bar:active { cursor: grabbing; }
.filter-bar::-webkit-scrollbar { display: none; }
.fchip {
    flex: 0 0 auto; white-space: nowrap;
    background: var(--card); border: 1px solid var(--line); color: var(--muted);
    border-radius: 999px; padding: 8px 13px; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
    transition: transform .12s ease, background .18s ease, color .18s ease, border-color .18s ease;
}
.fchip:active { transform: scale(.95); }
.fchip .iconir { font-size: 15px; }
.fchip .tiny { font-size: 11px; opacity: .7; }
.fchip.on {
    background: rgba(255, 77, 121, .14); border-color: var(--primary); color: var(--text);
}
/* Premium-locked filter chips */
.fchip.locked { opacity: .65; }
.fchip.locked .iconir-lock { opacity: .9; }
.fchip.clear { color: var(--red); border-color: var(--red); }

/* Option list used inside filter sheets */
.opt-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.opt {
    width: 100%; text-align: right; background: var(--bg-soft); border: 1px solid var(--line);
    color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px;
    transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.opt:active { transform: scale(.98); }
.opt.on { background: rgba(255, 77, 121, .12); border-color: var(--primary); font-weight: 700; }

/* ---------- Referral box (profile) ---------- */
.ref-box { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ref-box input {
    direction: ltr; text-align: left; font-size: 13px; background: var(--bg-soft);
}
.ref-box .btn { flex: 0 0 auto; padding: 12px 14px; }
.ref-count {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px;
    color: var(--muted); font-size: 13px; font-weight: 600;
}
.ref-count span { color: var(--gold); font-size: 18px; font-weight: 700; }
.anon-link-card { margin-top: 12px; }
.anon-link-card .section-title { margin-top: 0; }
.anon-link-card .ref-box .btn { padding: 10px 13px; }

/* ---------- Other-user profile sheet (redesigned) ----------
   Cover header with blurred backdrop, overlapping avatar, match-score ring
   stats, structured sections and the gallery above the action buttons. */
.pu-head {
    position: relative; border-radius: 22px; overflow: hidden;
    background: var(--card); border: 1px solid var(--line); margin-bottom: 12px;
}
.pu-cover {
    height: 116px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    background-size: cover; background-position: center 22%;
    position: relative;
}
/* Photo covers get a soft blur + dark veil so any photo works as a backdrop. */
.pu-cover[style]::before {
    content: ''; position: absolute; inset: -18px;
    background: inherit; background-size: cover; background-position: center 22%;
    filter: blur(16px);
}
.pu-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,17,23,.30), rgba(15,17,23,.62));
}
.pu-info {
    position: relative; display: flex; gap: 12px; align-items: flex-end;
    padding: 0 14px 14px; margin-top: -32px;
}
.pu-avatar {
    flex: none; width: 84px; height: 84px; border-radius: 26px;
    object-fit: cover; background: var(--card-2);
    border: 3px solid var(--card); box-shadow: var(--shadow-btn);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 800; color: #fff;
}
.pu-id { min-width: 0; padding-bottom: 2px; }
/* Name/sub sit on the veiled cover photo in BOTH themes — force white so the
   light theme never puts dark text over an arbitrary photo. */
.pu-id h2 { margin: 0; font-size: 19px; line-height: 1.4; color: #fff; text-shadow: 0 1px 5px rgba(0,0,0,.45); }
.pu-sub { color: #fff; opacity: .95; font-size: 13.5px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pu-status { color: rgba(255,255,255,.78); font-size: 12px; margin-top: 1px; text-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* Stats row: match-score ring + shared count */
.pu-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pu-stat {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 18px; padding: 12px 14px;
}
.pu-ring {
    --deg: calc(var(--score, 0) * 3.6deg);
    flex: none; width: 56px; height: 56px; border-radius: 50%;
    background: conic-gradient(var(--primary) var(--deg), var(--card-2) 0);
    display: grid; place-items: center; position: relative;
}
.pu-ring::before {
    content: ''; position: absolute; inset: 5px; border-radius: 50%;
    background: var(--card);
}
.pu-ring b { position: relative; font-size: 14px; font-weight: 800; color: var(--primary-2); }
/* High matches light up gold */
.pu-score.hot .pu-ring { background: conic-gradient(var(--gold) var(--deg), var(--card-2) 0); }
.pu-score.hot .pu-ring b { color: var(--gold); }
.pu-ring-plain { background: var(--card-2); color: var(--primary-2); font-size: 22px; }
.pu-ring-plain::before { display: none; }
.pu-ring-plain .iconir { position: relative; }
.pu-stat-txt { min-width: 0; }
.pu-stat-txt b { display: block; font-size: 14px; line-height: 1.5; }
.pu-stat-txt small { display: block; color: var(--muted); font-size: 11.5px; }

.pu-shared { padding-top: 12px; }
.pu-sec-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 800; color: var(--muted);
    margin: 4px 2px 8px;
}
.pu-sec-title .iconir { color: var(--primary); }
.pu-bio {
    background: var(--card); border: 1px solid var(--line);
    border-right: 3px solid var(--primary);
    border-radius: 16px; padding: 12px 14px; margin-bottom: 12px;
}
.pu-bio p { margin: 2px 0 0; font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.pu-line-chips { margin-bottom: 12px; }

/* Action rows: primary chats first, then gift/report/block */
.pu-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pu-actions .btn { margin-top: 0; }
.pu-actions.trio { grid-template-columns: 1fr 1fr 1fr; }
.pu-actions.trio .btn { padding: 11px 4px; font-size: 13px; }
.pu-actions .btn small { display: block; font-size: 10px; font-weight: 600; opacity: .8; }

/* ---------- Profile dashboard ---------- */
.profile-page { display: grid; gap: 12px; }
.profile-hero {
    position: relative; overflow: hidden; margin: 0; padding: 18px;
    background: linear-gradient(145deg, rgba(255,77,121,.12), var(--card) 58%);
}
.profile-hero-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-avatar-button {
    position: relative; flex: 0 0 auto; width: 82px; height: 82px; padding: 0;
    border: 2px solid rgba(255,255,255,.22); border-radius: 50%; background: var(--card-2);
}
.profile-avatar-button .avatar { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-edit {
    position: absolute; left: -2px; bottom: -2px; display: grid; place-items: center;
    width: 27px; height: 27px; border: 2px solid var(--card); border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 12px;
}
.profile-hero-copy { flex: 1; min-width: 0; }
.profile-kicker { color: var(--primary-2); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.profile-name { margin: 2px 0 6px; overflow-wrap: anywhere; font-size: 20px; line-height: 1.35; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.profile-meta-chip, .profile-status-chip {
    display: inline-flex; align-items: center; gap: 5px; min-height: 24px;
    padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--chip-tint); color: var(--muted); font-size: 11px; line-height: 1.4;
}
.profile-status-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.profile-status-chip.verified { color: #65c5ef; border-color: rgba(34,158,217,.35); }
.profile-status-chip.premium { color: var(--gold); border-color: rgba(255,209,102,.3); }
.profile-hero-edit { margin-top: 15px; }
.profile-wallet-card {
    display: grid; grid-template-columns: 42px minmax(0,1fr) auto 14px; align-items: center; gap: 10px;
    width: 100%; min-height: 76px; padding: 12px; border: 1px solid rgba(255,209,102,.25);
    border-radius: var(--radius); background: linear-gradient(110deg, rgba(255,209,102,.1), var(--card) 70%);
    color: var(--text); text-align: right;
    transition: transform .15s ease;
}
.profile-wallet-card:active { transform: scale(.98); }
.profile-wallet-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgba(255,209,102,.15); color: var(--gold); font-size: 20px; }
.profile-wallet-copy { display: flex; flex-direction: column; min-width: 0; }
.profile-wallet-copy strong { font-size: 14px; }
.profile-wallet-copy small, .profile-wallet-amount small { color: var(--muted); font-size: 11px; }
.profile-wallet-amount { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.profile-wallet-value { color: var(--gold); font-size: 14px; font-weight: 800; white-space: nowrap; direction: rtl; }
.profile-wallet-arrow { color: var(--muted); font-size: 13px; }
.profile-tools-heading { margin: 2px 2px -4px; font-size: 14px; font-weight: 700; }
.profile-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.profile-tool-button {
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 60px; padding: 10px;
    border: 1px solid var(--line); border-radius: 15px; background: var(--card); color: var(--text); text-align: right;
    transition: transform .15s ease;
}
.profile-tool-button:active { transform: scale(.97); }
.profile-tool-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 12px; background: var(--card-2); color: var(--primary-2); font-size: 17px; }
.profile-tool-copy { display: flex; flex-direction: column; min-width: 0; font-size: 12px; font-weight: 700; line-height: 1.4; }
.profile-tool-copy small { color: var(--muted); font-size: 10px; font-weight: 500; }
.profile-upgrade-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.profile-upgrade-button {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 12px;
    border: 1px solid var(--line); border-radius: 15px; background: var(--card); color: var(--text); text-align: right;
    transition: transform .15s ease;
}
.profile-upgrade-button:active { transform: scale(.97); }
.profile-upgrade-button.premium { border-color: rgba(255,209,102,.28); }
.profile-upgrade-button.boost { border-color: rgba(108,92,231,.35); }
.profile-upgrade-button .upgrade-title { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.profile-upgrade-button.premium .upgrade-title { color: var(--gold); }
.profile-upgrade-button.boost .upgrade-title { color: #b6adff; }
.profile-upgrade-button small { color: var(--muted); font-size: 10px; }
/* Active boost: countdown banner in the boost sheet + highlighted tile */
.boost-active-banner {
    display: flex; align-items: center; gap: 8px;
    background: rgba(108,92,231,.14); border: 1px solid rgba(108,92,231,.4);
    color: #b6adff; border-radius: 12px; padding: 10px 12px; font-size: 13px;
    margin-bottom: 4px;
}
.boost-active-banner b { color: #fff; }
.boost-active-banner .iconir { font-size: 16px; flex: 0 0 auto; }
.profile-upgrade-button.boost.active {
    border-color: rgba(108,92,231,.55); background: rgba(108,92,231,.08);
}
/* Daily Delcoin reward card (moved out of the header into the profile page) */
.profile-daily-card {
    display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px;
    width: 100%; min-height: 68px; padding: 12px; margin: 0;
    border: 1px solid rgba(255,209,102,.3); border-radius: var(--radius);
    background: linear-gradient(110deg, rgba(255,209,102,.12), var(--card) 70%);
    color: var(--text); text-align: right; font: inherit;
    transition: transform .15s ease;
}
.profile-daily-card:active { transform: scale(.98); }
.profile-daily-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgba(255,209,102,.15); color: var(--gold); font-size: 20px; }
.profile-daily-copy { display: flex; flex-direction: column; min-width: 0; }
.profile-daily-copy strong { font-size: 14px; }
.profile-daily-copy small { color: var(--muted); font-size: 11px; }
.profile-daily-amount { color: var(--gold); font-size: 13px; font-weight: 800; white-space: nowrap; direction: rtl; }
.profile-daily-card.claimed { border-color: var(--line); background: var(--card); }
.profile-daily-card.claimed .profile-daily-icon { background: var(--card-2); color: var(--muted); }
.profile-daily-card.claimed .profile-daily-amount { color: var(--muted); font-weight: 600; }
/* Telegram connection status card (moved out of the header; bottom of profile) */
.profile-tg-card {
    display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px;
    width: 100%; min-height: 68px; padding: 12px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
    text-align: right;
}
.profile-tg-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; font-size: 20px; }
.profile-tg-copy { display: flex; flex-direction: column; min-width: 0; }
.profile-tg-copy strong { font-size: 14px; }
.profile-tg-copy small { color: var(--muted); font-size: 11px; line-height: 1.7; }
.profile-tg-dot { width: 12px; height: 12px; border-radius: 50%; }
.profile-tg-card.connected { border-color: rgba(46,204,113,.3); }
.profile-tg-card.connected .profile-tg-icon { background: rgba(46,204,113,.12); color: var(--green); }
.profile-tg-card.connected .profile-tg-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.profile-tg-card.disconnected .profile-tg-icon { background: rgba(255,77,121,.12); color: var(--red); }
.profile-tg-card.disconnected .profile-tg-dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
.profile-disclosure { margin: 0; padding: 0; overflow: hidden; }
.profile-disclosure > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    min-height: 54px; padding: 13px 15px; list-style: none; cursor: pointer; font-weight: 700;
}
.profile-disclosure > summary::-webkit-details-marker { display: none; }
.profile-disclosure-title { display: inline-flex; align-items: center; gap: 8px; }
.profile-disclosure-title .iconir { color: var(--primary-2); }
.profile-disclosure-chevron { color: var(--muted); transition: transform .18s ease; }
.profile-disclosure[open] .profile-disclosure-chevron { transform: rotate(-180deg); }
.profile-disclosure-body { padding: 0 15px 15px; border-top: 1px solid var(--line); }
.profile-info-block { margin-top: 13px; }
.profile-info-label { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-info-text { margin: 0; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.profile-disclosure .section-title { margin: 13px 0 6px; font-size: 13px; }
.profile-disclosure .tag { margin: 0; }
.profile-invite-count { min-width: 27px; height: 27px; display: grid; place-items: center; padding: 0 7px; border-radius: 999px; background: rgba(255,209,102,.13); color: var(--gold); font-size: 12px; }
.profile-invite .profile-disclosure-body > p { margin: 11px 0; }
.profile-invite .ref-box { margin: 0; }
.profile-invite .ref-box input { min-width: 0; }
.profile-anon-link { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.profile-anon-link .profile-info-label { display: flex; align-items: center; gap: 6px; }
.profile-anon-link .profile-info-label .iconir { color: var(--primary-2); }
.profile-share-button { margin-top: 9px; }
.profile-editor-stack { display: grid; gap: 10px; }
.profile-editor-section { padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.profile-editor-heading { display: flex; align-items: center; gap: 7px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 800; }
.profile-editor-heading .iconir, .profile-editor-subheading .iconir { color: var(--primary-2); }
.profile-editor-section label { margin-top: 9px; }
.profile-editor-subheading { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; font-weight: 700; }
.profile-editor-hint { margin: 2px 0 7px; }
.profile-info-text { white-space: pre-line; }

/* Short, composited entry motion when switching Mini App sections. */
.view.view-enter { animation: miniViewEnter .26s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes miniViewEnter {
    from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.995); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
/* Same motion for tab flips INSIDE a section (home cards/anon, match tabs):
   the freshly shown container rises in while the old one is hidden. */
.tab-enter { animation: miniViewEnter .24s cubic-bezier(.22, .9, .3, 1) both; }


/* ---------- Interest picker chips (profile editor) ---------- */
.chips { display: flex; flex-wrap: wrap; }
.tag.pick { cursor: pointer; opacity: .55; transition: opacity .15s, background .15s, color .15s; user-select: none; }
.tag.pick.on { opacity: 1; background: var(--accent); border-color: var(--accent); color: #fff; }
.profile-tag-selected { margin: 7px 0 10px; }
.tag-picker-list { display: grid; gap: 6px; max-height: 42vh; overflow: auto; overscroll-behavior: contain; }
.tag-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); color: var(--text); text-align: right; font: inherit; cursor: pointer; }
.tag-option.on { border-color: var(--accent); background: var(--card); }
.tag-option-copy { display: grid; gap: 2px; min-width: 0; }
.tag-option-copy strong { font-size: 13px; font-weight: 700; }
.tag-option-copy small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.tag-option-mark { flex: 0 0 25px; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); }
.tag-option.on .tag-option-mark { border-color: var(--accent); background: var(--accent); color: #17200d; }
.tag-picker-pagination { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.tag-picker-pagination .btn { flex: 1; margin: 0; }
.tag-picker-pagination .btn:disabled { opacity: .4; }
.profile-tag-block { margin-top: 13px; }

/* ---------- Home tabs (cards | anonymous chat) ---------- */
.home-tabs {
    display: flex; gap: 4px; padding: 4px; margin-bottom: 12px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.home-tabs button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: none; border: none; color: var(--muted);
    font-size: 13px; font-weight: 700; padding: 10px 6px; border-radius: 10px;
    transition: background .18s ease, color .18s ease, transform .12s ease;
}
.home-tabs button:active { transform: scale(.97); }
.home-tabs button.on { background: var(--primary); color: #fff; }

/* ---------- Anonymous chat tab: 2×4 tile grid, fits one screen ---------- */
/* #home-anon fills exactly the space between the chrome above (topbar + home
   tabs + view padding ≈ 151px) and the fixed bottom nav below (its clearance
   in #view padding-bottom ≈ 135px). Tiles then stretch into that space, so
   all 8 buttons are visible without scrolling. The vh line is the fallback
   for webviews without dvh support. */
#home-anon {
    height: calc(100vh - 286px);
    height: calc(100dvh - 286px - var(--tg-safe-top, 0px) - env(safe-area-inset-bottom, 0px));
    min-height: 340px; /* very short screens: scroll a little, never crush */
    display: flex; flex-direction: column;
}
.anon-hero { text-align: center; margin-bottom: 10px; }
.anon-hero h2 { margin: 0 0 4px; font-size: 16px; }
.anon-hero p { margin: 0; color: var(--muted); font-size: 12px; }
.anon-tiles {
    flex: 1; min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.anon-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 7px; padding: 8px 6px; border-radius: 22px;
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    font-family: inherit; font-weight: 700; font-size: 13.5px; line-height: 1.3;
    text-align: center; cursor: pointer;
    transition: transform .12s ease, filter .15s ease;
    -webkit-user-select: none; user-select: none;
}
.anon-tile:active { transform: scale(.95); filter: brightness(1.12); }
.anon-tile-label { display: flex; flex-direction: column; gap: 2px; }
.anon-tile-label small { font-size: 10px; font-weight: 600; opacity: .74; }
.anon-tile-ico {
    flex: none; width: 40px; height: 40px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px; font-style: normal; line-height: 1;
}
/* Color coding: the two headline modes get gradient fills, the filter tiles
   get tinted cards (girl=pink, boy=blue, same-city=teal, same-age=gold). */
.anon-tile.is-featured {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent; color: #fff;
    box-shadow: 0 6px 18px rgba(255, 77, 121, .25);
}
.anon-tile.is-anon {
    background: linear-gradient(135deg, #7d6bff, #5240d6);
    border-color: transparent; color: #fff;
    box-shadow: 0 6px 18px rgba(108, 92, 231, .25);
}
.anon-tile.is-featured .anon-tile-ico, .anon-tile.is-anon .anon-tile-ico { background: rgba(255, 255, 255, .18); }
.anon-tile.is-girl { background: rgba(255, 77, 121, .09); border-color: rgba(255, 77, 121, .32); }
.anon-tile.is-girl .anon-tile-ico { background: rgba(255, 77, 121, .16); }
.anon-tile.is-boy { background: rgba(77, 148, 255, .09); border-color: rgba(77, 148, 255, .32); }
.anon-tile.is-boy .anon-tile-ico { background: rgba(77, 148, 255, .16); }
.anon-tile.is-city { background: rgba(45, 212, 191, .09); border-color: rgba(45, 212, 191, .32); }
.anon-tile.is-city .anon-tile-ico { background: rgba(45, 212, 191, .16); }
.anon-tile.is-age { background: rgba(255, 209, 102, .09); border-color: rgba(255, 209, 102, .32); }
.anon-tile.is-age .anon-tile-ico { background: rgba(255, 209, 102, .16); }
/* Short viewports (small phones / Telegram with keyboard open): tighten the
   hero and icons so the grid still fits without scrolling. */
@media (max-height: 640px) {
    .anon-hero { margin-bottom: 8px; }
    .anon-hero p { display: none; }
    .anon-tiles { gap: 8px; }
    .anon-tile { gap: 5px; font-size: 12.5px; border-radius: 18px; }
    .anon-tile-ico { width: 32px; height: 32px; font-size: 17px; border-radius: 11px; }
}

/* Lobby (searching state): radar rings + criteria chip, centered vertically */
.anon-lobby {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 10px;
}
.anon-radar {
    position: relative; width: 120px; height: 120px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.anon-radar-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--primary); opacity: 0;
    animation: anonping 2.4s cubic-bezier(0, .55, .45, 1) infinite;
}
.anon-radar-ring.r2 { animation-delay: .8s; }
.anon-radar-ring.r3 { animation-delay: 1.6s; }
@keyframes anonping {
    0% { transform: scale(.32); opacity: .85; }
    100% { transform: scale(1.12); opacity: 0; }
}
.anon-radar-core {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; font-size: 26px;
    box-shadow: 0 8px 24px rgba(255, 77, 121, .35);
    animation: anoncore 2.4s ease-in-out infinite;
}
.anon-radar-core .iconir { font-size: 26px; }
@keyframes anoncore { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) {
    .anon-radar-ring { animation: none; opacity: .3; transform: scale(1); }
    .anon-radar-core { animation: none; }
}
.anon-lobby h3 { margin: 0 0 6px; font-size: 16px; }
.anon-lobby-crit {
    display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--text);
    background: var(--card); border: 1px solid var(--line);
    padding: 5px 14px; border-radius: 999px; margin-bottom: 8px;
}
.anon-lobby .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.anon-time {
    display: inline-block; font-size: 14px; font-weight: 700; color: var(--gold);
    background: rgba(255, 209, 102, .08); border: 1px solid rgba(255, 209, 102, .25);
    padding: 4px 14px; border-radius: 999px; margin-bottom: 16px;
}
.anon-lobby .btn { width: auto; margin-top: 0; padding-left: 26px; padding-right: 26px; }

/* Common-count badge on the swipe card (number only) */
.sc-common-count.num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px;
    background: rgba(255, 209, 102, .16); border: 1px solid rgba(255, 209, 102, .45);
    color: var(--gold-bright); font-size: 13px; font-weight: 800;
}

/* ---------- Wallet (کیف پول — redesigned) ----------
   One gradient hero card carries BOTH balances and the cash actions; free
   rewards live in a single compact card; coin packages are tiles; the two
   transaction histories share one list behind a pill tab. */
.wallet-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 22px; padding: 18px 16px 16px; margin-bottom: 12px;
    color: #fff;
}
/* soft glow blobs behind the balances */
.wallet-hero::before, .wallet-hero::after {
    content: ''; position: absolute; border-radius: 50%; pointer-events: none;
    background: rgba(255, 255, 255, .10);
}
.wallet-hero::before { width: 170px; height: 170px; top: -80px; left: -50px; }
.wallet-hero::after { width: 130px; height: 130px; bottom: -70px; right: -40px; background: rgba(255, 255, 255, .07); }
.wallet-balances {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    position: relative; z-index: 1;
}
.wallet-bal {
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 16px; padding: 10px 12px; text-align: center;
}
.wallet-bal small { display: block; font-size: 11px; font-weight: 600; opacity: .85; }
.wallet-bal b {
    display: block; font-size: 21px; font-weight: 800; margin-top: 2px;
    letter-spacing: .2px; line-height: 1.35; word-break: break-word;
}
.wallet-bal .wallet-unit { margin-top: 1px; opacity: .8; }
.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; position: relative; z-index: 1; }
.wallet-act {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 8px; border-radius: 14px; font-family: inherit;
    font-size: 14px; font-weight: 700; color: #fff;
    background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .34);
    transition: transform .12s ease, filter .15s ease;
}
.wallet-act:active { transform: scale(.96); filter: brightness(1.1); }
.wallet-act.primary { background: #fff; color: #b3294f; border-color: #fff; }

/* Free rewards: one compact card, one row per reward */
.wallet-rewards-head {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 14px; margin-bottom: 4px;
}
.wallet-rewards-head .iconir { color: var(--gold); }
.wallet-reward {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 2px; border-top: 1px solid var(--line);
}
.wallet-reward:first-of-type { border-top: none; }
.wallet-reward-ico {
    flex: none; width: 40px; height: 40px; border-radius: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 19px; background: var(--card-2); border: 1px solid var(--line);
}
.wallet-reward-txt { flex: 1; min-width: 0; }
.wallet-reward-txt b { display: block; font-size: 13.5px; }
.wallet-reward-txt small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.wallet-reward-btn {
    flex: none; margin: 0; padding: 9px 16px; width: auto; font-size: 13px; border-radius: 12px;
}
.wallet-reward-done {
    flex: none; display: inline-flex; align-items: center; gap: 5px;
    color: var(--green); font-size: 12.5px; font-weight: 700;
}

/* Coin packages: coin count big + toman price pill */
.wallet-pkg {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 13px 8px 11px; border-radius: 16px;
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    font-family: inherit; transition: transform .12s ease, border-color .15s ease;
}
.wallet-pkg:active { transform: scale(.95); border-color: var(--gold); }
.wallet-pkg b { font-size: 19px; font-weight: 800; color: var(--gold); }
.wallet-pkg small { color: var(--muted); font-size: 11px; font-weight: 600; }
.wallet-pkg .wallet-pkg-price {
    margin-top: 7px; padding: 3px 10px; border-radius: 999px;
    background: var(--card-2); font-size: 11.5px; font-weight: 700;
}

/* History: shared list behind a pill tab (reuses .home-tabs chrome) */
.wallet-tabs { margin: 2px 0 10px; }
.wallet-txn {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: 14px;
    background: var(--card); border: 1px solid var(--line); margin-bottom: 8px;
}
.wallet-txn-ico {
    flex: none; width: 36px; height: 36px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--card-2); color: var(--muted); font-size: 16px;
}
.wallet-txn-txt { flex: 1; min-width: 0; }
.wallet-txn-txt b { display: block; font-size: 13.5px; font-weight: 700; }
.wallet-txn-txt small { display: block; color: var(--muted); font-size: 11.5px; }
.wallet-txn-amt { flex: none; font-size: 14px; font-weight: 800; letter-spacing: .2px; }

/* ---------- Match (جفت و جور) ---------- */
.match-head { text-align: center; margin-bottom: 12px; }
.match-head h2 { margin: 0 0 4px; font-size: 17px; }
.match-head h2 .iconir { color: var(--primary); }
.match-head p { margin: 0; color: var(--muted); font-size: 13px; }
.match-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.match-row .avatar { width: 48px; height: 48px; flex: none; }
.match-row .btn.tiny { flex: none; margin: 0; }
.match-top-match {
    --match-rank-color: var(--gold);
    position: relative; overflow: hidden; padding-top: 40px;
    border-color: rgba(255,209,102,.38);
    background: linear-gradient(115deg, rgba(255,209,102,.09), var(--card) 62%);
    box-shadow: 0 5px 18px rgba(255,209,102,.08);
}
.match-rank-1 { --match-rank-color: var(--gold); }
.match-rank-2 { --match-rank-color: #c8d3e2; border-color: rgba(200,211,226,.38); background: linear-gradient(115deg, rgba(200,211,226,.09), var(--card) 62%); box-shadow: 0 5px 18px rgba(200,211,226,.07); }
.match-rank-3 { --match-rank-color: #e4a071; border-color: rgba(228,160,113,.38); background: linear-gradient(115deg, rgba(228,160,113,.09), var(--card) 62%); box-shadow: 0 5px 18px rgba(228,160,113,.07); }
.match-top-match .avatar { border: 2px solid var(--match-rank-color); }
.match-rank-badge {
    position: absolute; top: 8px; right: 14px; display: inline-flex; align-items: center; gap: 5px;
    color: var(--match-rank-color); font-size: 11px; font-weight: 800;
}
.match-rank-badge .iconir { font-size: 13px; }
.match-top-match .match-score {
    background: radial-gradient(closest-side, var(--card) 73%, transparent 74% 100%),
        conic-gradient(var(--match-rank-color) calc(var(--score, 0) * 1%), var(--line) 0);
}
.match-top-match .match-score b { color: var(--match-rank-color); }
.mr-main { flex: 1; min-width: 0; }
.mr-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-name .iconir-star-solid { color: var(--gold); }
.mr-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mr-chips .common-chip { font-size: 10.5px; padding: 2px 8px; }
.mr-chips .common-chip .iconir { font-size: 10px; }
/* Score ring: conic fill tracks the percentage via the inline --score var */
.match-score {
    flex: none; width: 54px; height: 54px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    background:
        radial-gradient(closest-side, var(--card) 73%, transparent 74% 100%),
        conic-gradient(var(--primary) calc(var(--score, 0) * 1%), var(--line) 0);
}
.match-score b { font-size: 12.5px; line-height: 1.1; color: var(--primary-2); }
.match-score span { font-size: 8.5px; color: var(--muted); line-height: 1; }
.match-group-title {
    margin: 14px 0 8px; color: var(--muted); font-size: 13px;
    display: flex; align-items: center; gap: 6px;
}
.match-empty { text-align: center; color: var(--muted); padding: 24px 14px; }
.match-empty-ico { font-size: 30px; margin-bottom: 6px; }
.match-empty-message { max-width: 320px; margin: 0 auto; }
.match-empty-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.match-empty-actions .btn { width: auto; min-width: 132px; margin: 0; padding: 9px 12px; font-size: 12px; }
.match-empty-actions .match-retry:not(.ghost) { background: var(--primary); color: #fff; }
.match-more { margin: 2px 0 14px; }

/* ---------- Antispam suspension sheet ---------- */
.susp-until {
    display: inline-block; margin: 10px auto 4px; padding: 7px 16px;
    background: rgba(255, 91, 91, .08); border: 1px solid rgba(255, 91, 91, .3);
    border-radius: 999px; color: var(--red); font-size: 13px; font-weight: 700;
}

/* ---------- Performance & a11y ---------- */
/* Long lists (chats / search / wallet) skip offscreen rendering work */
.conv, .card, .gift-item {
    content-visibility: auto;
    contain-intrinsic-size: auto 72px;
}
/* Never let images blow up layout while loading */
img { height: auto; }
.avatar, .chat-peer-avatar, .gal-thumb, .msg-media { flex: none; }
/* Visible keyboard focus (a11y) without hurting tap UX */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
/* Respect users who prefer less motion: kill decorative animation */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .swipe-card.behind, .swipe-card.active:not(.dragging):not(.flying), .swipe-card.flying { transition: none; }
}

/* ---------- Light-theme component tweaks ----------
   Everything else flips automatically through the CSS variables; these rules
   only retouch components whose accent literals were tuned for dark surfaces
   (pale lavender/pink/blue/green text) so they stay readable on white. */
html[data-theme="light"] .msg.them { background: #ffffff; }
/* Shared-tags chips: deep green / deep pink on the pale tinted chip bg */
html[data-theme="light"] .common-chip { color: #0d7a40; }
html[data-theme="light"] .common-chip.int { color: #c0295c; }
/* Boost chips/banners: pale lavender -> deep violet on white surfaces */
html[data-theme="light"] .boost-chip { color: #6553d6; }
html[data-theme="light"] .boost-active-banner { color: #6553d6; }
html[data-theme="light"] .boost-active-banner b { color: var(--text); }
html[data-theme="light"] .profile-upgrade-button.boost .upgrade-title { color: #6553d6; }
/* Telegram-blue accents: lighter sky blues -> readable blue on white */
html[data-theme="light"] .profile-status-chip.verified { color: var(--tg-blue); border-color: rgba(14, 123, 182, .35); }
html[data-theme="light"] .msg-media-card .mmc-btn {
    border-color: rgba(14, 123, 182, .45); color: var(--tg-blue); background: rgba(14, 123, 182, .08);
}
/* Match podium: silver/bronze rank tints darkened for white cards */
html[data-theme="light"] .match-rank-2 {
    --match-rank-color: #6b7686; border-color: rgba(107, 118, 134, .38);
    background: linear-gradient(115deg, rgba(107, 118, 134, .08), var(--card) 62%);
    box-shadow: 0 5px 18px rgba(107, 118, 134, .07);
}
html[data-theme="light"] .match-rank-3 {
    --match-rank-color: #b06a3c; border-color: rgba(176, 106, 60, .38);
    background: linear-gradient(115deg, rgba(176, 106, 60, .08), var(--card) 62%);
    box-shadow: 0 5px 18px rgba(176, 106, 60, .07);
}
/* Avatar edit ring: white ring invisible on a white hero */
html[data-theme="light"] .profile-avatar-button { border-color: rgba(28, 33, 48, .12); }

/* ---------- Compatibility tests (public + private) ----------
   Overview rows, question-by-question taking flow, result ring, public-test
   leaderboard and the private-test builder form. */
.tests-sec-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 800; color: var(--muted);
    margin: 14px 0 8px;
}
.tests-sec-title:first-child { margin-top: 2px; }
.tests-sec-title .iconir { font-size: 14px; }
.test-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.test-row + .test-row { margin-top: 8px; }
.test-row-icon {
    flex: none; width: 40px; height: 40px; border-radius: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--card-2); color: var(--primary-2); font-size: 18px;
}
.pu-test-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pu-test-info b { font-size: 14px; }
.pu-test-done { color: var(--green); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pu-test-done .iconir { font-size: 12px; }
.test-row-actions { display: inline-flex; gap: 6px; flex: none; }

/* Taking flow: progress bar, question and full-width option buttons */
.test-progress {
    height: 6px; border-radius: 6px; background: var(--card-2);
    overflow: hidden; margin: 4px 0 6px;
}
.test-progress-bar { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .25s ease; }
.test-progress-label { margin-bottom: 8px; }
.test-question { margin: 2px 0 14px; font-size: 17px; line-height: 1.7; }
.test-options { display: flex; flex-direction: column; gap: 10px; }
.test-option { width: 100%; text-align: right; }

/* Result ring (private match % / public average match %) */
.test-result { text-align: center; padding: 10px 0 4px; }
.test-result-ring {
    --deg: calc(var(--score, 0) * 3.6deg);
    width: 108px; height: 108px; margin: 0 auto 10px; border-radius: 50%;
    background: conic-gradient(var(--primary) var(--deg), var(--card-2) 0);
    display: grid; place-items: center; position: relative;
}
.test-result-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.test-result-ring b { position: relative; font-size: 22px; font-weight: 800; color: var(--primary-2); }
.test-result-ring.hot { background: conic-gradient(var(--gold) var(--deg), var(--card-2) 0); }
.test-result-ring.hot b { color: var(--gold); }
.test-result-title { font-weight: 800; font-size: 15px; margin: 4px 0 2px; }

/* Public-test leaderboard */
.lb-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lb-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-soft); border: 1px solid var(--line);
    border-radius: 14px; padding: 10px 12px; font-size: 13.5px;
}
.lb-row.me { border-color: var(--primary); background: rgba(255, 77, 121, .10); }
.lb-row .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.lb-rank {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--card-2); font-size: 12px; font-weight: 800; color: var(--muted);
}
.lb-row.me .lb-rank { background: var(--primary); color: #fff; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }

/* "تست مچ" card on the other-user profile sheet */
.pu-testmatch { padding-top: 12px; margin-bottom: 12px; }
.pu-testmatch-score { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 8px; }
.pu-testmatch-score b { font-size: 26px; font-weight: 800; color: var(--primary-2); }
.pu-testmatch-label { margin: 6px 0 4px; }
.pu-testmatch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
    padding: 8px 12px; margin-bottom: 6px; font-size: 13px;
}
.pu-testmatch-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pu-testmatch-row b { color: var(--primary-2); }

/* Private tests card on the other-user profile sheet */
.pu-tests { padding-top: 12px; margin-bottom: 12px; }
.pu-test-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pu-test-row:last-child { margin-bottom: 2px; }
.pu-test-row .pu-test-info { flex: 1; }

/* Private-test builder form */
.ct-question {
    background: var(--bg-soft); border: 1px solid var(--line);
    border-radius: 14px; padding: 12px; margin-bottom: 12px;
}
.ct-opt-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ct-opt-grid .ct-opt { background: var(--card); border: 1px solid var(--line); }

/* "از چی بدت میاد" chips: red-tinted so they read apart from interests */
.tag.dislike { background: rgba(255, 91, 91, .12); border: 1px solid rgba(255, 91, 91, .35); color: var(--red); }
html[data-theme="light"] .tag.dislike { color: #b32828; }
