﻿:root {
    --bg: #0b0d12;
    --bg-2: #0e1117;
    --surface: #161a22;
    --surface-2: #1c212b;
    --hairline: #262c38;
    --gold: #cf9f3a;
    --gold-bright: #f2c869;
    --brass: #8a6a2f;
    --text: #f7f7f7;
    --muted: #bcc0c7;
    --muted-2: #b3b8c3;
    --up: #4caf78;
    --down: #d9605f;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    direction: rtl;
}

body {
    background: radial-gradient(1200px 600px at 85% -10%, rgba(207,159,58,.10), transparent 60%), radial-gradient(900px 500px at 10% 0%, rgba(76,175,120,.06), transparent 55%), var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

html {
    scroll-behavior: smooth;
}

a {
    color: var(--gold-bright);
}

/* ---------- Sticky top (header + nav + ticker) ---------- */
.site-top {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg-2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---------- Header ---------- */
header {
    position: relative;
    padding: 18px 20px 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--hairline);
    overflow: hidden;
}

    header::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: repeating-linear-gradient(115deg, rgba(207,159,58,.05) 0px, rgba(207,159,58,.05) 1px, transparent 1px, transparent 10px), repeating-linear-gradient(65deg, rgba(207,159,58,.04) 0px, rgba(207,159,58,.04) 1px, transparent 1px, transparent 10px);
        opacity: .5;
        pointer-events: none;
    }

.header-row {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(155deg, var(--gold-bright), var(--brass));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #151208;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(207,159,58,.25);
    flex-shrink: 0;
}

.brand h1 {
    font-size: 1.28rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -.2px;
}

.brand p {
    margin: 2px 0 0;
    font-size: .78rem;
    color: var(--muted);
    font-weight: 500;
}

.status-cluster {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    padding: 7px 13px;
    border-radius: 999px;
    font-size: .78rem;
    color: var(--muted);
}

/* ---------- Section nav ---------- */
.section-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 20px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav-btn {
    appearance: none;
    border: 1px solid var(--hairline);
    background: var(--surface);
    color: var(--muted);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.section-nav-btn:hover {
    color: var(--text);
    border-color: rgba(207, 159, 58, .45);
}

.section-nav-btn.is-active {
    color: #151208;
    background: linear-gradient(155deg, var(--gold-bright), var(--brass));
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(207, 159, 58, .28);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 3px rgba(76,175,120,.18);
}

    .dot.blink {
        animation: pulse 1.8s ease-in-out infinite;
    }

@keyframes pulse {
    0%,100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

.clock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--gold-bright);
    direction: ltr;
    unicode-bidi: isolate;
}

.jdate {
    font-size: .72rem;
    color: var(--muted-2);
    margin-top: 2px;
}

.clock-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ---------- Ticker ---------- */
.ticker-wrap {
    background: #0d1015;
    border-bottom: 1px solid var(--hairline);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    direction: ltr;
}

    .ticker-wrap::before, .ticker-wrap::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 60px;
        z-index: 2;
        pointer-events: none;
    }

    .ticker-wrap::before {
        right: 0;
        background: linear-gradient(to left, #0d1015, transparent);
    }

    .ticker-wrap::after {
        left: 0;
        background: linear-gradient(to right, #0d1015, transparent);
    }

.ticker-track {
    display: inline-flex;
    width: max-content;
    padding: 10px 0;
    animation: scroll-ticker var(--ticker-duration, 60s) linear infinite;
    will-change: transform;
}

.ticker-wrap:hover .ticker-track {
    animation-play-state: paused;
}

.ticker-group {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 34px;
    padding-inline-end: 34px;
}

@keyframes scroll-ticker {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(calc(-1 * var(--ticker-shift, 50%)));
    }
}

.tick-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .82rem;
    color: var(--muted);
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
}

.tick-name {
    font-weight: 700;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tick-quote {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .05);
}

.tick-quote-label {
    font-size: .62rem;
    font-weight: 800;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

    .tick-quote-label.buy {
        color: #8cecb0;
        background: rgba(76, 175, 120, .18);
    }

    .tick-quote-label.sell {
        color: #f5d078;
        background: rgba(207, 159, 58, .18);
    }

.tick-quote-val {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.tick-quote-buy {
    color: #9ae8b8;
}

.tick-quote-sell {
    color: var(--gold-bright);
}

.tick-quote-sep {
    width: 1px;
    height: 12px;
    background: rgba(207, 159, 58, .35);
    flex-shrink: 0;
}

    .tick-item .tchg {
        font-weight: 700;
        direction: ltr;
        display: inline-block;
    }

        .tick-item .tchg.up {
            color: var(--up);
        }

        .tick-item .tchg.down {
            color: var(--down);
        }

/* ---------- Layout ---------- */
main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 10px;
}

.section {
    margin-bottom: 34px;
    scroll-margin-top: var(--sticky-offset, 190px);
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--hairline);
}

    .section-head .eyebrow {
        font-size: .7rem;
        color: var(--brass);
        letter-spacing: .5px;
        font-weight: 700;
        background: rgba(207,159,58,.08);
        padding: 3px 9px;
        border-radius: 6px;
        border: 1px solid rgba(207,159,58,.2);
    }

    .section-head h2 {
        font-size: 1.05rem;
        margin: 0;
        font-weight: 800;
    }

    .section-head span.sub {
        font-size: .78rem;
        color: var(--muted-2);
        margin-inline-start: auto;
    }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.rate-card {
    background: linear-gradient(165deg, rgba(28, 33, 43, .95), rgba(22, 26, 34, .98));
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 16px 16px 14px;
    position: relative;
    transition: border-color .25s, transform .25s, box-shadow .25s;
    overflow: hidden;
}

    .rate-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 12%;
        right: 12%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(242, 200, 105, .75), transparent);
        pointer-events: none;
    }

    .rate-card:hover {
        border-color: rgba(207, 159, 58, .45);
        transform: translateY(-3px);
        box-shadow: 0 14px 32px rgba(0, 0, 0, .35), 0 0 0 1px rgba(207, 159, 58, .08);
    }

.rate-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.rate-label {
    font-weight: 700;
    font-size: .92rem;
}

.rate-unit {
    font-size: .68rem;
    color: var(--muted-2);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* ---------- Quote panel (buy / sell) ---------- */
.quote-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .07);
    background: rgba(0, 0, 0, .22);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.quote-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px 12px;
    min-width: 0;
}

.quote-side--buy {
    background: linear-gradient(160deg, rgba(76, 175, 120, .16), rgba(76, 175, 120, .04) 55%, transparent);
}

.quote-side--sell {
    background: linear-gradient(200deg, rgba(242, 200, 105, .18), rgba(207, 159, 58, .06) 55%, transparent);
}

.quote-split {
    width: 1px;
    align-self: stretch;
    margin: 10px 0;
    background: linear-gradient(180deg, transparent, rgba(207, 159, 58, .15) 15%, rgba(207, 159, 58, .55) 50%, rgba(207, 159, 58, .15) 85%, transparent);
    position: relative;
}

    .quote-split span {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(45deg);
        width: 7px;
        height: 7px;
        border: 1px solid rgba(242, 200, 105, .65);
        background: var(--surface);
        box-shadow: 0 0 10px rgba(242, 200, 105, .35);
    }

.quote-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .06em;
    padding: 4px 11px;
    border-radius: 999px;
    line-height: 1;
}

.quote-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    flex-shrink: 0;
}

.quote-badge--buy {
    color: #8cecb0;
    background: rgba(76, 175, 120, .14);
    border: 1px solid rgba(76, 175, 120, .28);
}

.quote-badge--sell {
    color: #f5d078;
    background: rgba(207, 159, 58, .14);
    border: 1px solid rgba(207, 159, 58, .32);
}

.quote-amount {
    direction: ltr;
    text-align: center;
    width: 100%;
    font-weight: 900;
    font-size: 1.18rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.15;
    color: #9ae8b8;
    transition: opacity .18s ease, color .18s ease, transform .18s ease;
    word-break: break-all;
}

.quote-amount--sell {
    color: var(--gold-bright);
    text-shadow: 0 0 24px rgba(242, 200, 105, .18);
}

.flip-number.flip {
    animation: flashvalue .5s ease;
}

@keyframes flashvalue {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    35% {
        opacity: .4;
        transform: scale(.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.rate-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.delta {
    font-size: .8rem;
    font-weight: 700;
    direction: ltr;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

    .delta.up {
        color: var(--up);
    }

    .delta.down {
        color: var(--down);
    }

.spark {
    width: 78px;
    height: 26px;
    flex-shrink: 0;
}

    .spark polyline {
        fill: none;
        stroke-width: 2;
    }

/* ---------- Settings ---------- */
.settings {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-top: 6px;
}

.settings-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 10px;
}

    .settings-top h3 {
        margin: 0;
        font-size: .92rem;
        font-weight: 700;
    }

    .settings-top .hint {
        font-size: .75rem;
        color: var(--muted-2);
    }

.chev {
    transition: transform .2s;
    color: var(--muted);
}

.settings.open .chev {
    transform: rotate(180deg);
}

.settings-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.settings.open .settings-body {
    max-height: 340px;
}

.settings-inner {
    padding-top: 14px;
    font-size: .85rem;
    color: var(--muted);
    line-height: 2;
}

.key-row {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

    .key-row input {
        flex: 1;
        min-width: 180px;
        background: var(--surface-2);
        border: 1px solid var(--hairline);
        color: var(--text);
        padding: 9px 12px;
        border-radius: 8px;
        font-family: inherit;
        font-size: .85rem;
    }

    .key-row button {
        background: linear-gradient(155deg, var(--gold-bright), var(--brass));
        border: none;
        color: #171207;
        font-weight: 800;
        padding: 9px 18px;
        border-radius: 8px;
        cursor: pointer;
        font-family: inherit;
        font-size: .85rem;
    }

        .key-row button:active {
            transform: scale(.97);
        }

.mode-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .74rem;
    color: var(--muted-2);
    background: var(--surface-2);
    padding: 4px 10px;
    border-radius: 999px;
    margin-top: 6px;
}

footer {
    text-align: center;
    padding: 26px 20px 40px;
    color: var(--muted-2);
    font-size: .76rem;
    line-height: 2;
}

    footer a {
        color: var(--brass);
    }

@media (max-width:560px) {
    .brand h1 {
        font-size: 1.08rem;
    }

    .clock {
        font-size: .95rem;
    }

    .flip-tile {
        font-size: 1rem;
        padding: 4px 3px;
    }

    .section-head span.sub {
        display: none;
    }

    header {
        padding: 14px 14px 10px;
    }

    .section-nav {
        padding: 8px 14px 10px;
        gap: 6px;
    }

    .section-nav-btn {
        font-size: .76rem;
        padding: 7px 12px;
    }

    main {
        padding: 20px 14px 6px;
    }

    .quote-amount {
        font-size: 1.02rem;
    }

    .tick-name {
        max-width: 88px;
    }
}
