/* ==================== Vebko Worldwide Agencies ==================== */

:root {
    --bg: #02050a;
    --panel: rgba(9, 16, 26, .74);
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --text: #e8f1ff;
    --muted: #8ea3b8;
    --brand: #27a99d;
    --accent: #ff7a00;
    --cyan: #00e5ff;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --sb-width: 340px;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    overflow: hidden;
    font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

.app {
    position: fixed;
    inset: 0;
}

#stage {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg);
    overflow: hidden;
}

    #stage canvas {
        display: block;
        width: 100% !important;
        height: 100% !important;
        touch-action: none;
    }

.ic, .vc-ic, .search-ic, .rot-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ====== دکمهٔ چرخش ====== */
.rot-btn {
    position: absolute;
    left: 18px;
    bottom: 18px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 122, 0, .5);
    background: rgba(255, 122, 0, .14);
    color: #ffd2ab;
    font: 600 12px/1 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

    .rot-btn svg {
        width: 16px;
        height: 16px;
        animation: spin 6s linear infinite;
    }

    .rot-btn:hover {
        background: rgba(255, 122, 0, .24);
    }

    .rot-btn.off {
        border-color: var(--line-strong);
        background: var(--panel);
        color: var(--muted);
    }

        .rot-btn.off svg {
            animation-play-state: paused;
        }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== Sidebar ====== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sb-width);
    height: 100vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: linear-gradient(180deg, rgba(10, 18, 30, .80), rgba(5, 10, 18, .88));
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(0, 0, 0, .35);
}

.sb-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, rgba(39, 169, 157, .95), rgba(14, 116, 128, .9));
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .12);
}

    .hdr h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 750;
        letter-spacing: .2px;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, .25), 0 0 12px rgba(255, 122, 0, .8);
}

.search {
    position: relative;
    margin: 14px 14px 10px;
}

.search-ic {
    position: absolute;
    left: 11px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

#q {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .05);
    color: var(--text);
    font: 500 14px/1.2 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

    #q::placeholder {
        color: var(--muted);
    }

    #q:focus {
        border-color: rgba(0, 229, 255, .7);
        background: rgba(255, 255, 255, .07);
        box-shadow: 0 0 0 3px rgba(0, 229, 255, .14);
    }

/* ====== فیلتر منطقه ====== */
.chips {
    display: flex;
    gap: 6px;
    padding: 0 14px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 0 0 auto;
}

.chip {
    flex: 0 0 auto;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    font: 600 12px/1 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

    .chip:hover {
        color: var(--text);
        background: rgba(255, 255, 255, .08);
    }

    .chip.on {
        color: #03151a;
        border-color: transparent;
        background: linear-gradient(135deg, #12c9dc, var(--brand));
    }

.countrySection {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 2px 0;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #74e6d9;
}

    .countrySection:first-child {
        margin-top: 0;
    }

    .countrySection::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--line);
    }

    .countrySection em {
        font-style: normal;
        color: var(--muted);
        font-weight: 700;
    }

/* ====== Countries grid ====== */
.countries {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 8px;
    padding: 4px 14px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

.countryItem {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
    color: var(--text);
    font: 600 13px/1.2 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    text-align: left;
    cursor: pointer;
    animation: itemIn .45s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 22ms);
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

    .countryItem:hover, .countryItem.hover {
        background: rgba(255, 255, 255, .075);
        border-color: rgba(255, 255, 255, .2);
        transform: translateY(-1px);
    }

    .countryItem:focus-visible {
        outline: 2px solid var(--cyan);
        outline-offset: 2px;
    }

    .countryItem.active {
        border-color: var(--cyan);
        background: linear-gradient(180deg, rgba(0, 229, 255, .16), rgba(0, 229, 255, .05));
        box-shadow: 0 0 0 1px var(--cyan) inset, 0 0 16px rgba(0, 229, 255, .35);
    }

@keyframes itemIn {
    from { opacity: 0; transform: translateY(6px); }
}

.countryFlag {
    flex: 0 0 auto;
    width: 26px;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 2px 6px rgba(0, 0, 0, .35);
}

    .countryFlag img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.countryText {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.countryName, .countryVia {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.countryVia {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
}

.countryCount {
    flex: 0 0 auto;
    min-width: 18px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 122, 0, .18);
    color: #ffb37a;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.countryEmpty {
    grid-column: 1 / -1;
    padding: 18px 8px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

/* ====== Sidebar collapse toggle (فقط موبایل) ====== */
.sb-collapse-toggle {
    display: none;
}

.sb-toggle-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 32px;
}

.sb-toggle {
    background: none;
    border-radius: 999px;
    outline: 2px solid transparent;
    outline-offset: -2px;
    padding: 2px;
    overflow: hidden;
    display: inline-block;
    cursor: pointer;
}

.sb-toggle-icons {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-grid;
    place-content: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .35);
}

.sb-toggle-icon {
    grid-area: 1 / 1;
    fill: #fff;
    transition: opacity 220ms ease, transform 220ms ease;
}

.sb-toggle:hover .sb-toggle-icons {
    background: rgba(255, 255, 255, .2);
}

/* ====== Tooltip پین ====== */
.pin-tip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(8, 14, 24, .88);
    font: 600 12px/1.2 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

    .pin-tip.is-on {
        opacity: 1;
    }

    .pin-tip img {
        width: 20px;
        height: 14px;
        border-radius: 2px;
        object-fit: cover;
    }

    .pin-tip em {
        font-style: normal;
        font-weight: 600;
        font-size: 11px;
        color: #ffb37a;
    }

/* ====== آمار کلی ====== */
.stats {
    position: absolute;
    left: 24px;
    top: 22px;
    z-index: 40;
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 96px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(160deg, rgba(14, 26, 40, .7), rgba(6, 12, 22, .78));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}

    .stat:nth-child(2) { transition-delay: .1s; }
    .stat:nth-child(3) { transition-delay: .2s; }

.stats.is-in .stat {
    opacity: 1;
    transform: none;
}

.stats.is-in.is-aside .stat {
    opacity: 0;
    transform: translateY(-10px);
    transition-delay: 0s;
}

.stat-num {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff, #9fe9ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--muted);
}

/* ورود سایدبار و دکمهٔ چرخش در intro */
.sidebar {
    animation: sbIn .9s var(--ease) .5s both;
}

.rot-btn {
    animation: fadeUp .7s var(--ease) 1.8s both;
}

@keyframes sbIn {
    from { opacity: 0; transform: translateX(40px); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
}

/* ====== Loader ====== */
.loader {
    position: fixed;
    inset: 0 var(--sb-width) 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    font: 500 13px/1 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    letter-spacing: .4px;
    pointer-events: none;
    transition: opacity .6s ease, visibility .6s;
}

    .loader.is-done {
        opacity: 0;
        visibility: hidden;
    }

.loader-ring {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .1);
    border-top-color: var(--cyan);
    animation: spin 1s linear infinite;
}

/* ====== کارت نماینده ====== */
.vcard {
    position: absolute;
    left: 24px;
    top: 50%;
    z-index: 46;
    width: 340px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: linear-gradient(160deg, rgba(14, 26, 40, .84), rgba(6, 12, 22, .92));
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
    color: var(--text);
    opacity: 0;
    transform: translate(-14px, -50%) scale(.98);
    pointer-events: none;
    transition: opacity .35s ease, transform .5s var(--ease);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

    .vcard::before {
        content: "";
        position: absolute;
        left: 18px;
        right: 18px;
        top: 0;
        height: 2px;
        border-radius: 0 0 2px 2px;
        background: linear-gradient(90deg, transparent, var(--cyan), var(--brand), transparent);
    }

    .vcard.is-open {
        opacity: 1;
        transform: translate(0, -50%);
        pointer-events: auto;
    }

.vcard-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .vcard-close:hover {
        background: rgba(255, 255, 255, .12);
        color: #fff;
    }

    .vcard-close .vc-ic {
        width: 15px;
        height: 15px;
    }

.vcard-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 70px; /* جای دکمه‌های کپی لینک و بستن */
}

.vcard-flag {
    flex: 0 0 auto;
    width: 64px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 6px 18px rgba(0, 0, 0, .4);
}

    .vcard-flag img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.vcard-heading {
    min-width: 0;
}

.vcard-country {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .2px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vcard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

    .vcard-meta span {
        padding: 3px 8px;
        border-radius: 999px;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .6px;
        text-transform: uppercase;
    }

.vcard-region {
    background: rgba(39, 169, 157, .2);
    color: #74e6d9;
}

.vcard-count {
    background: rgba(255, 122, 0, .16);
    color: #ffb37a;
}

.vcard-tabs {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}

    .vcard-tabs[hidden] {
        display: none;
    }

    .vcard-tabs button {
        flex: 0 0 auto;
        max-width: 200px;
        padding: 7px 11px;
        border-radius: 10px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, .04);
        color: var(--muted);
        font: 600 12px/1.2 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
        transition: background .15s ease, color .15s ease, border-color .15s ease;
    }

        .vcard-tabs button:hover {
            color: var(--text);
        }

        .vcard-tabs button[aria-selected="true"] {
            color: #fff;
            border-color: rgba(0, 229, 255, .7);
            background: rgba(0, 229, 255, .12);
        }

.vcard-body {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-top: 16px;
}

.vc-item {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .5s var(--ease), transform .5s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms + 120ms);
}

.vcard-body.is-in .vc-item {
    opacity: 1;
    transform: none;
}

.vc-company {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 750;
    line-height: 1.3;
    color: #fff;
}

.vc-logo {
    flex: 0 0 auto;
    height: 30px;
    max-width: 90px;
    padding: 3px 5px;
    border-radius: 7px;
    object-fit: contain;
    background: rgba(255, 255, 255, .92);
}

.vc-person {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.vc-ic {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.vc-contacts ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 9px;
}

.vc-contacts li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: #d3e4f7;
    word-break: break-word;
}

    .vc-contacts li .vc-ic {
        margin-top: 1px;
        color: #6fd8ff;
    }

.vc-contacts a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, .35);
    transition: color .15s ease, border-color .15s ease;
}

    .vc-contacts a:hover {
        color: var(--cyan);
        border-bottom-color: var(--cyan);
    }

.vc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 650;
    text-decoration: none;
    transition: background .15s ease, transform .15s ease, border-color .15s ease, filter .15s ease;
}

    .vc-btn .vc-ic {
        width: 15px;
        height: 15px;
    }

    .vc-btn:hover {
        background: rgba(255, 255, 255, .12);
        transform: translateY(-1px);
    }

    .vc-btn.primary {
        border-color: transparent;
        background: linear-gradient(135deg, #12c9dc, var(--brand));
        color: #03151a;
    }

        .vc-btn.primary:hover {
            filter: brightness(1.1);
        }

    .vc-btn.wa:hover {
        border-color: #25d366;
    }

.vc-devices {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
}

.vc-sec-title {
    margin-bottom: 4px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #74e6d9;
}

.vc-dev {
    display: grid;
    grid-template-columns: 62px 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 650;
}

.vc-dev-name {
    color: var(--muted);
}

.vc-dev-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

    .vc-dev-bar i {
        display: block;
        height: 100%;
        width: 0;
        border-radius: inherit;
        background: linear-gradient(90deg, var(--accent), #ffb347);
        box-shadow: 0 0 10px rgba(255, 122, 0, .6);
        transition: width 1.1s var(--ease) .45s;
    }

.vcard-body.is-in .vc-dev-bar i {
    width: var(--w);
}

.vc-dev-num {
    min-width: 30px;
    text-align: right;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.vcard-share {
    position: absolute;
    top: 12px;
    right: 48px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .vcard-share:hover {
        background: rgba(255, 255, 255, .12);
        color: var(--cyan);
    }

    .vcard-share .vc-ic {
        width: 15px;
        height: 15px;
    }

.vcard-grab {
    display: none;
}

/* پیام کوتاه */
.toast {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 80;
    max-width: min(90vw, 520px);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, .35);
    background: rgba(8, 14, 24, .92);
    color: var(--text);
    font: 600 13px/1.3 Inter, "Segoe UI", Roboto, system-ui, sans-serif;
    word-break: break-all;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    opacity: 0;
    transform: translate(-50%, 10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .35s var(--ease);
}

    .toast.is-on {
        opacity: 1;
        transform: translate(-50%, 0);
    }

/* کشوری که نماینده ندارد */
.np-pop {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 46;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 220px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(8, 14, 24, .9);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
    font-size: 12.5px;
    color: var(--muted);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

    .np-pop.is-on {
        opacity: 1;
        pointer-events: auto;
    }

    .np-pop strong {
        font-size: 15px;
        color: #fff;
    }

    .np-pop .vc-btn {
        margin-top: 4px;
    }

/* خط راهنما از کارت تا پین */
.vcard-leader {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 44;
    pointer-events: none;
    overflow: visible;
    opacity: 0;
    transition: opacity .35s ease .25s;
}

    .vcard-leader.is-open {
        opacity: 1;
    }

    .vcard-leader.is-hidden {
        opacity: 0;
        transition-delay: 0s;
    }

.vcard-leader-under {
    display: none; /* فقط تم روشن: زیرخط سفید تا روی هر رنگی دیده شود */
}

.vcard-leader-path {
    fill: none;
    stroke: rgba(0, 229, 255, .8);
    stroke-width: 1.5;
    stroke-dasharray: 5 5;
    animation: dashFlow 1.2s linear infinite;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, .7));
}

.vcard-leader-dot {
    fill: var(--cyan);
}

.vcard-leader-ring {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 1.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: ringPulse 1.6s ease-out infinite;
}

@keyframes dashFlow {
    to { stroke-dashoffset: -20; }
}

@keyframes ringPulse {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(3.5); opacity: 0; }
}

/* ==================== موبایل ==================== */
@media (max-width: 768px) {
    :root {
        --sb-width: 180px;
        --sb-collapsed-width: 90px;
    }

    .sidebar {
        transition: width 300ms ease-out;
        overflow-x: hidden;
    }

    .hdr {
        padding: 12px 10px;
        gap: 8px;
    }

        .hdr h3 {
            font-size: 13px;
        }

    .dot {
        display: none;
    }

    .search {
        margin: 10px 8px 8px;
    }

    #q {
        font-size: 13px;
        padding: 9px 10px 9px 32px;
    }

    .countries {
        grid-template-columns: minmax(0, 1fr);
        padding: 4px 8px 14px;
    }

    .countryItem {
        padding: 9px 8px;
        font-size: 12px;
    }

    /* سایدبار بسته: فقط پرچم‌ها */
    .sidebar:has(#sb-collapse-toggle:not(:checked)) {
        width: var(--sb-collapsed-width);
    }

        .sidebar:has(#sb-collapse-toggle:not(:checked)) .hdr h3,
        .sidebar:has(#sb-collapse-toggle:not(:checked)) .search,
        .sidebar:has(#sb-collapse-toggle:not(:checked)) .chips,
        .sidebar:has(#sb-collapse-toggle:not(:checked)) .countrySection,
        .sidebar:has(#sb-collapse-toggle:not(:checked)) .countryText,
        .sidebar:has(#sb-collapse-toggle:not(:checked)) .countryCount {
            display: none;
        }

        .sidebar:has(#sb-collapse-toggle:not(:checked)) .hdr {
            justify-content: center;
        }

        .sidebar:has(#sb-collapse-toggle:not(:checked)) .countryItem {
            justify-content: center;
        }

    .sidebar:has(#sb-collapse-toggle:checked) .sb-toggle-open,
    .sidebar:has(#sb-collapse-toggle:not(:checked)) .sb-toggle-close {
        opacity: 1;
        transform: scale(1);
    }

    .sidebar:has(#sb-collapse-toggle:checked) .sb-toggle-close,
    .sidebar:has(#sb-collapse-toggle:not(:checked)) .sb-toggle-open {
        opacity: 0;
        transform: scale(.8);
    }

    .loader {
        inset: 0;
    }

    .stats {
        left: 10px;
        top: 10px;
        flex-direction: column;
        gap: 6px;
    }

    .stat {
        min-width: 0;
        padding: 8px 10px;
        border-radius: 11px;
    }

    .stat-num {
        font-size: 18px;
    }

    .stat-label {
        font-size: 9px;
        letter-spacing: .5px;
    }

    .rot-btn {
        left: 12px;
        bottom: 12px;
        padding: 7px 12px 7px 9px;
    }

    /* کارت به شکل پنل پایین صفحه */
    .vcard {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        z-index: 60;
        width: auto;
        max-height: 62vh;
        border-radius: 20px 20px 0 0;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
        transform: translateY(105%);
    }

        .vcard.is-open {
            transform: translateY(0);
        }

    .vcard-leader {
        display: none;
    }

    .vcard-grab {
        display: block;
        width: 40px;
        height: 4px;
        margin: -4px auto 12px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .25);
    }

    .vcard-grab, .vcard-head {
        touch-action: none; /* کشیدن پنل به پایین برای بستن */
    }

    .vcard.is-dragging {
        transition: none;
    }

    .vcard-share {
        top: 22px;
    }

    .vcard-close {
        top: 22px;
    }

    .chips {
        padding: 0 8px 10px;
    }

    .chip {
        padding: 5px 9px;
        font-size: 11px;
    }

    .np-pop {
        width: 190px;
    }
}

@media (min-width: 769px) {
    .sb-toggle-container {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
    }
}

/* ==================== تم روشن ==================== */
/* بوم سه‌بعدی شفاف است و پس‌زمینه از همین‌جا می‌آید. تم تیره با ?theme=dark */
[data-theme="light"] {
    --panel: rgba(255, 255, 255, .86);
    --line: rgba(15, 35, 55, .09);
    --line-strong: rgba(15, 35, 55, .16);
    --text: #0f1f2e;
    --muted: #5b6f82;
    --cyan: #00a6c4;
    --brand-dark: #0d7f75;
    --orange-text: #c25b00;
    --surface: #ffffff;
    --surface-2: #f4f7fa;
    --shadow: 0 18px 46px rgba(20, 45, 70, .16);
}

/* پس‌زمینهٔ روشن فقط وقتی صحنهٔ سه‌بعدی روشن است (?scene=light)؛ پیش‌فرض: فضای تیره */
[data-scene="light"] {
    --bg: #eef3f8;
}

    [data-scene="light"] body,
    [data-scene="light"] #stage {
        background:
            radial-gradient(ellipse at 42% 46%, #ffffff 0%, #f1f6fa 38%, #dde7f0 78%, #d2dee9 100%);
    }

    [data-theme="light"] .rot-btn {
        background: rgba(255, 255, 255, .9);
        border-color: rgba(255, 122, 0, .45);
        color: var(--orange-text);
        box-shadow: 0 6px 18px rgba(20, 45, 70, .12);
    }

        [data-theme="light"] .rot-btn:hover {
            background: #fff4ea;
        }

        [data-theme="light"] .rot-btn.off {
            background: rgba(255, 255, 255, .85);
            border-color: var(--line-strong);
            color: var(--muted);
        }

    [data-theme="light"] .sidebar {
        background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(246, 249, 252, .92));
        border-left: 1px solid var(--line);
        box-shadow: -12px 0 40px rgba(20, 45, 70, .12);
    }

    [data-theme="light"] #q {
        background: var(--surface);
        border-color: var(--line-strong);
    }

        [data-theme="light"] #q:focus {
            background: var(--surface);
            border-color: var(--cyan);
            box-shadow: 0 0 0 3px rgba(0, 166, 196, .15);
        }

    [data-theme="light"] .chip {
        background: var(--surface);
        border-color: var(--line-strong);
    }

        [data-theme="light"] .chip:hover {
            background: var(--surface-2);
        }

        [data-theme="light"] .chip.on {
            color: #fff;
            background: linear-gradient(135deg, #12b8cc, var(--brand));
        }

    [data-theme="light"] .countrySection {
        color: var(--brand-dark);
    }

    [data-theme="light"] .countries,
    [data-theme="light"] .vcard {
        scrollbar-color: rgba(15, 35, 55, .22) transparent;
    }

    [data-theme="light"] .countryItem {
        background: var(--surface);
        border-color: var(--line);
        box-shadow: 0 1px 2px rgba(15, 35, 55, .05);
    }

        [data-theme="light"] .countryItem:hover,
        [data-theme="light"] .countryItem.hover {
            background: var(--surface-2);
            border-color: rgba(15, 35, 55, .2);
        }

        [data-theme="light"] .countryItem.active {
            border-color: var(--cyan);
            background: linear-gradient(180deg, rgba(0, 184, 212, .14), rgba(0, 184, 212, .05));
            box-shadow: 0 0 0 1px var(--cyan) inset, 0 4px 14px rgba(0, 166, 196, .22);
        }

    [data-theme="light"] .countryFlag {
        box-shadow: 0 0 0 1px rgba(15, 35, 55, .14), 0 1px 3px rgba(15, 35, 55, .15);
    }

    [data-theme="light"] .countryCount,
    [data-theme="light"] .vcard-count {
        background: rgba(255, 122, 0, .13);
        color: var(--orange-text);
    }

    [data-theme="light"] .pin-tip {
        background: rgba(255, 255, 255, .97);
        border-color: var(--line-strong);
        box-shadow: 0 8px 24px rgba(20, 45, 70, .18);
    }

        [data-theme="light"] .pin-tip em {
            color: var(--orange-text);
        }

    [data-theme="light"] .stat {
        background: rgba(255, 255, 255, .85);
        border-color: var(--line);
        box-shadow: 0 8px 22px rgba(20, 45, 70, .1);
    }

    [data-theme="light"] .stat-num {
        background: linear-gradient(180deg, #0f1f2e, #0b8fa3);
        -webkit-background-clip: text;
        background-clip: text;
    }

    [data-scene="light"] .loader-ring {
        border-color: rgba(15, 35, 55, .1);
        border-top-color: var(--cyan);
    }

    /* کارت نماینده */
    [data-theme="light"] .vcard {
        background: linear-gradient(160deg, rgba(255, 255, 255, .96), rgba(245, 249, 252, .96));
        border-color: var(--line);
        box-shadow: var(--shadow);
    }

    [data-theme="light"] .vcard-close,
    [data-theme="light"] .vcard-share {
        background: var(--surface-2);
        border-color: var(--line);
    }

        [data-theme="light"] .vcard-close:hover,
        [data-theme="light"] .vcard-share:hover {
            background: #e6edf3;
            color: var(--text);
        }

    [data-theme="light"] .vcard-flag {
        box-shadow: 0 0 0 1px rgba(15, 35, 55, .12), 0 6px 16px rgba(20, 45, 70, .18);
    }

    [data-theme="light"] .vcard-region {
        background: rgba(39, 169, 157, .14);
        color: var(--brand-dark);
    }

    [data-theme="light"] .vcard-tabs button {
        background: var(--surface-2);
        border-color: var(--line);
    }

        [data-theme="light"] .vcard-tabs button[aria-selected="true"] {
            color: var(--text);
            border-color: var(--cyan);
            background: rgba(0, 184, 212, .1);
        }

    [data-theme="light"] .vc-company {
        color: var(--text);
    }

    [data-theme="light"] .vc-logo {
        background: #fff;
        box-shadow: 0 0 0 1px var(--line);
    }

    [data-theme="light"] .vc-contacts li {
        color: #23384b;
    }

        [data-theme="light"] .vc-contacts li .vc-ic {
            color: var(--cyan);
        }

    [data-theme="light"] .vc-contacts a {
        border-bottom-color: rgba(15, 35, 55, .28);
    }

    [data-theme="light"] .vc-btn {
        background: var(--surface-2);
        border-color: var(--line-strong);
    }

        [data-theme="light"] .vc-btn:hover {
            background: #e7eef4;
        }

        [data-theme="light"] .vc-btn.primary {
            color: #fff;
            background: linear-gradient(135deg, #12b8cc, var(--brand));
        }

    [data-theme="light"] .vc-devices {
        background: var(--surface-2);
        border-color: var(--line);
    }

    [data-theme="light"] .vc-sec-title {
        color: var(--brand-dark);
    }

    [data-theme="light"] .vc-dev-bar {
        background: rgba(15, 35, 55, .08);
    }

        [data-theme="light"] .vc-dev-bar i {
            box-shadow: none;
        }

    [data-theme="light"] .vc-dev-num {
        color: var(--text);
    }

    [data-scene="light"] .vcard-leader-under {
        display: block;
        fill: none;
        stroke: #fff;
        stroke-width: 5;
        stroke-linejoin: round;
        opacity: .95;
    }

    [data-scene="light"] .vcard-leader-path {
        stroke: #0b4a63;
        stroke-width: 2;
        filter: none;
    }

    [data-scene="light"] .vcard-leader-dot {
        fill: #0b4a63;
        stroke: #fff;
        stroke-width: 2;
    }

    [data-scene="light"] .vcard-leader-ring {
        stroke: var(--cyan);
    }

    [data-theme="light"] .vcard-grab {
        background: rgba(15, 35, 55, .2);
    }

    [data-theme="light"] .toast,
    [data-theme="light"] .np-pop {
        background: rgba(255, 255, 255, .97);
        border-color: var(--line-strong);
        box-shadow: 0 12px 32px rgba(20, 45, 70, .18);
    }

        [data-theme="light"] .np-pop strong {
            color: var(--text);
        }

/* صحنهٔ تیره با منوهای روشن: چیزهایی که مستقیم روی کره/فضا هستند رنگ تم تیره را نگه دارند */
[data-scene="dark"] .loader {
    color: #8ea3b8;
}

[data-scene="dark"] .vcard-leader-dot {
    fill: #00e5ff;
}

[data-scene="dark"] .vcard-leader-ring {
    stroke: #00e5ff;
}
