﻿:root {
    --up:#10b981;
    --down:#ef4444;
    --text:#1e293b;
}

.gold-wrapper {
    direction:rtl;
    font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    max-width:100%;
    margin:0 auto;
    padding:10px 14px;
    color:var(--text);
}

.gold-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    flex-direction:row-reverse;
    margin-bottom:24px;
    padding-bottom:8px;
    border-bottom:1px solid rgba(212,175,55,.2);
    min-height:64px;
    contain:layout paint;
}

.live-badge {
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    width:max-content;
    min-width:clamp(112px,16vw,175px);
    min-height:44px;
    padding:10px 22px;
    margin-inline-start:16px;
    margin-inline-end:24px;
    border-radius:999px;
    text-align:center;
    white-space:nowrap;
    font-size:clamp(13px,1.35vw,16px);
    font-weight:800;
    line-height:1;
    letter-spacing:-.01em;
    box-shadow:0 2px 8px rgba(0,0,0,.02);
    transform:translateZ(0);
    contain:layout paint;
    transition:background-color .25s ease,color .25s ease,border-color .25s ease,box-shadow .25s ease,transform .25s ease;
}

.badge-up {
    background:#ecfdf5;
    color:var(--up);
    border:1px solid rgba(16,185,129,.2);
    animation:pulse-green 2s infinite;
}

.badge-down {
    background:#fef2f2;
    color:var(--down);
    border:1px solid rgba(239,68,68,.2);
    animation:pulse-red 2s infinite;
}

.update-time {
    flex:1 1 auto;
    min-width:0;
    max-width:100%;
    font-size:15px;
    font-weight:600;
    color:#334155;
    line-height:1.4;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    transform:translateY(5px);
    contain:layout paint;
}

@keyframes pulse-green {
    0% { box-shadow:0 0 0 0 rgba(16,185,129,.4); }
    70% { box-shadow:0 0 0 10px rgba(16,185,129,0); }
    100% { box-shadow:0 0 0 0 rgba(16,185,129,0); }
}

@keyframes pulse-red {
    0% { box-shadow:0 0 0 0 rgba(239,68,68,.4); }
    70% { box-shadow:0 0 0 10px rgba(239,68,68,0); }
    100% { box-shadow:0 0 0 0 rgba(239,68,68,0); }
}

.gold-market-stack {
    display:grid;
    gap:18px;
    width:100%;
}

.gold-market-frame {
    padding:14px;
    border-radius:28px;
    background:linear-gradient(180deg,#dbdbdb 0,#fff7e7 100%);
    border:1px solid rgba(226,232,240,.95);
    box-shadow:0 14px 34px rgba(15,23,42,.08);
    overflow:hidden;
}

.gold-market-frame.is-default {
    box-shadow:0 16px 38px rgba(15,23,42,.1);
}

.gold-market-heading {
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    margin:0 0 12px;
    padding:10px 18px;
    box-sizing:border-box;
    text-align:center;
    border:1px solid rgba(226,232,240,.95);
    border-radius:999px;
    background: linear-gradient(150deg, #ffffff, #fff1d4);
    box-shadow:0 8px 18px rgba(238, 226, 207, 0.267);
}

.gold-market-label {
    font-size:clamp(18px,2.2vw,24px);
    font-weight:900;
    color:#78350f;
    letter-spacing:-.01em;
    white-space:nowrap;
}

.gold-container {
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:12px;
    width:100%;
}

.gold-jewel-container {
    width:100%;
    margin:12px 0 0;
    padding:0;
    box-sizing:border-box;
}

.card,
.gold-jewel-card {
    width:100%;
    display:flex;
    flex-direction:column;
    justify-content:center;
    box-sizing:border-box;
    padding:12px;
    margin:0;
    min-width:0;
    border-radius:25px;
    text-align:center;
    transition:transform .25s ease,box-shadow .25s ease,border-color .25s ease,opacity .25s ease;
}

.card {
    background:rgba(255,255,255,.72);
    border:1px solid rgba(255, 190, 116, 0.38);
    box-shadow:0 8px 14px rgba(176,130,24,.1);
    transform:translateZ(0);
}

.gold-jewel-card {
    border:1px solid transparent;
}

.gold-jewel-card.is-default {
    border-color:rgba(255, 222, 171, 0.72);
    box-shadow:0 18px 34px -12px rgba(255, 242, 204, 0.3);
    transform:translateY(-2px);
    background:rgba(255,255,255,.72);
}

.card:hover,
.gold-jewel-card:hover {
    transform:translateY(-4px);
    box-shadow:0 20px 40px -10px rgba(212,175,55,.25);
    border-color:rgba(212,175,55,.8);
}

.card:focus-visible,
.gold-jewel-card:focus-visible,
.live-badge:focus-visible {
    outline:3px solid rgba(212,175,55,.25);
    outline-offset:3px;
}

.title {
    display:flex;
    align-items:baseline;
    justify-content:center;
    flex-wrap:wrap;
    gap:4px;
    margin:0 0 8px;
    font-size:18px;
    font-weight:900;
    line-height:1.2;
    letter-spacing:-.01em;
    color:#111827;
}

.gold-unit {
    font-size:.78em;
    font-weight:700;
    color:#404144;
    opacity:.72;
    margin-inline-start:4px;
}

.price {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    direction:ltr;
    font-size:clamp(26px,2vw,38px);
    font-weight:800;
    line-height:1.1;
    letter-spacing:-.5px;
    font-variant-numeric:tabular-nums;
    color:var(--text);
    text-shadow:0 1px 1px rgba(255,255,255,.5);
}

.price-digit {
    display:inline-block;
    transition:color .15s ease,transform .15s ease;
}

.price-digit.digit-up {
    color:var(--up)!important;
    transform:scale(1.08);
}

.price-digit.digit-down {
    color:var(--down)!important;
    transform:scale(1.08);
}

.change-wrapper {
    min-height:28px;
    margin-top:8px;
}

.change-indicator {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    direction:ltr;
    unicode-bidi:plaintext;
}

.change-indicator.positive {
    color:#16a34a;
}

.change-indicator.negative {
    color:#dc2626;
}

.change-indicator.neutral {
    color:#64748b;
}

.change-arrow {
    font-size:14px;
    line-height:1;
}

.change-percent {
    font-size:20px;
    font-weight:900;
}

.change-period {
    font-size:12px;
    font-weight:600;
    padding:3px 8px;
    border-radius:999px;
    line-height:1.2;
}

.gold-calc-wrapper {
    position:relative;
    overflow:hidden;
    background:#fff;
    border:1px solid rgba(240, 151, 34, 0.3);
    border-radius:16px;
    padding:32px;
    margin:30px auto;
    direction:rtl;
    box-shadow:0 10px 30px rgba(212,175,55,.1);
}

.calc-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:24px;
}

.calc-result-value {
    font-size:36px;
    font-weight:800;
    color:#78350f;
}

@media (prefers-reduced-motion:reduce) {
    *,
    *::before,
    *::after {
        animation:none!important;
        transition:none!important;
        scroll-behavior:auto!important;
    }
}

@media (max-width:900px) {
    .gold-wrapper {
        padding:0;
    }

    .gold-header {
        flex-direction:row-reverse;
        align-items:center;
        justify-content:space-between;
        gap:8px;
        margin-bottom:18px;
        padding-inline:8px;
    }

    .live-badge {
        align-self:center;
        position:static;
        width:max-content;
        min-width:96px;
        max-width:40%;
        margin-inline-start:12px;
        margin-inline-end:0;
        padding:6px 12px;
        font-size:12px;
        min-height:34px;
        box-shadow:0 4px 12px rgba(0,0,0,.04);
    }

    .update-time {
        flex:1 1 auto;
        min-width:0;
        width:auto;
        font-size:12px;
        line-height:1.3;
        transform:none;
        text-align:right;
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        margin-top:0;
    }

    .gold-market-stack {
        gap:16px;
    }

    .gold-market-frame {
        padding: 10px 5px 10px 5px;
        border-radius:22px;
    }

    .gold-market-heading {
        padding:8px 14px;
        margin-bottom:10px;
        border-radius:18px;
    }

    .gold-market-label {
        font-size:clamp(17px,4.8vw,21px);
    }

    .gold-container {
        display:flex;
        flex-wrap:nowrap;
        gap:10px;
        overflow-x:auto;
        overflow-y:hidden;
        padding:8px 6px 12px;
        scroll-snap-type:x mandatory;
        scroll-padding-inline:8px;
        -webkit-overflow-scrolling:touch;
        overscroll-behavior-x:contain;
        scrollbar-width:none;
        -ms-overflow-style:none;
    }

    .gold-container::-webkit-scrollbar {
        display:none;
    }

    .card {
        flex:0 0 clamp(140px,46vw,180px);
        min-width:0;
        scroll-snap-align:center;
    }

    .card[data-slug="g21"] {
        flex-basis:clamp(160px,52vw,210px);
        transform:scale(1);
        box-shadow:0 14px 28px rgba(176,130,24,.14);
    }

    .card:first-child,
    .card:last-child {
        transform:scale(.96);
        opacity:.96;
    }

    .title {
        font-size:clamp(14px,3.8vw,17px);
    }

    .price {
        font-size:clamp(20px,5vw,26px);
    }

    .gold-jewel-container {
        margin-top:12px;
    }

    .gold-jewel-card {
        width:100%;
        padding:14px 12px;
        border-radius:24px;
    }

    .gold-jewel-card .title {
        font-size:clamp(15px,4vw,17px);
    }

    .gold-jewel-card .price {
        font-size:clamp(23px,6vw,30px);
    }

    .gold-calc-wrapper {
        padding:18px;
        border-radius:14px;
    }

    .calc-grid {
        gap:16px;
    }

    .calc-result-value {
        font-size:30px;
    }
}


