* {
    box-sizing: border-box;
}

:root {
    --red: #ff3540;
    --pink: #ef46ae;
    --purple: #8b40ed;
    --blue: #1598e9;
    --text: #f6f8fb;
    --divider: rgba(255,255,255,.12);
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: transparent !important;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

body.preview {
    background:
        radial-gradient(circle at 22% 82%, rgba(210,170,85,.07), transparent 25%),
        linear-gradient(135deg, #28333e 0%, #131a21 46%, #0b0f13 100%) !important;
}

.stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

.case-widget {
    position: absolute;
    left: var(--widget-left);
    bottom: var(--widget-bottom);
    width: min(var(--widget-width), calc(100vw - 32px));
    aspect-ratio: var(--frame-ratio);
    isolation: isolate;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,.22));
}

/* Naujas pusiau permatomas fonas rėmelio viduje */
.panel-bg {
    position: absolute;
    z-index: 1;
    inset: 4.6% 1.4% 5.9% 2.4%;
    clip-path: polygon(
        2.8% 0,
        97.2% 0,
        100% 6.3%,
        100% 93.7%,
        97.2% 100%,
        2.8% 100%,
        0 93.7%,
        0 6.3%
    );
    background:
        linear-gradient(115deg, rgba(10, 16, 22, .58), rgba(6, 11, 16, .46)),
        radial-gradient(circle at 18% 30%, rgba(211, 169, 82, .08), transparent 30%);
    border: 1px solid rgba(255, 255, 255, .035);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .04),
        inset 0 0 34px rgba(255, 255, 255, .02);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.frame {
    position: absolute;
    z-index: 20;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    user-select: none;
}

.gold-side {
    position: absolute;
    z-index: 5;
    left: 6.4%;
    top: 9.5%;
    width: 35.1%;
    height: 79.5%;
}

.medal-wrap {
    position: absolute;
    left: 4%;
    right: 14%;
    top: 5%;
    height: 49%;
    display: grid;
    place-items: center;
}

.gold-medal {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,.20));
}

.gold-number {
    position: absolute;
    left: -3%;
    right: 10%;
    bottom: 1px;
    height: 45%;
    display: grid;
    place-items: center;
    color: var(--text);
    font-size: clamp(46px, 9.7vw, 82px);
    line-height: 1;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.05em;
    text-shadow:
        0 3px 10px rgba(0, 0, 0, .55),
        0 0 6px rgba(255, 255, 255, .08);
}

.gold-number::after {
    content: "";
    position: absolute;
    bottom: 2%;
    left: 27%;
    right: 27%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(217,176,86,.92), transparent);
    box-shadow: 0 0 7px rgba(217,176,86,.30);
}

.rarities {
    position: absolute;
    z-index: 5;
    left: 48.1%;
    top: 15.2%;
    width: 45.2%;
    height: 69.8%;
    display: grid;
    grid-template-rows: repeat(4, 1fr);
}

.rarity {
    --accent-color: #fff;
    display: grid;
    grid-template-columns: 12px minmax(110px, 1fr) 68px;
    align-items: center;
    gap: 18px;
    padding: 0 4.5% 0 1.4%;
    border-bottom: 1px solid var(--divider);
}

.rarity:last-child {
    border-bottom: 0;
}

.accent {
    width: 5px;
    height: 46%;
    justify-self: center;
    background: var(--accent-color);
    box-shadow: 0 0 7px color-mix(in srgb, var(--accent-color) 34%, transparent);
}

.label {
    color: var(--accent-color);
    font-size: clamp(18px, 3.75vw, 30px);
    line-height: 1;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.value {
    justify-self: end;
    color: var(--text);
    font-size: clamp(28px, 3.7vw, 44px);
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.04em;
    text-shadow:
        0 2px 8px rgba(0,0,0,.48),
        0 0 5px rgba(255,255,255,.05);
}

.rarity-red    { --accent-color: var(--red); }
.rarity-pink   { --accent-color: var(--pink); }
.rarity-purple { --accent-color: var(--purple); }
.rarity-blue   { --accent-color: var(--blue); }

.preview-label {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    background: rgba(8,11,14,.74);
    color: rgba(255,255,255,.68);
    font: 600 12px/1.3 "Segoe UI", sans-serif;
}

@media (max-width: 760px) {
    .case-widget {
        left: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }

    .gold-number {
        font-size: clamp(40px, 7vw, 68px);
    }

    .label {
        font-size: clamp(16px, 3vw, 24px);
    }

    .value {
        font-size: clamp(24px, 4vw, 36px);
    }
}

/* Trumpa animacija, kai AdminCP pakeičia skaičių. */
.counter-pop {
    animation: counterPop .28s cubic-bezier(.2,.85,.25,1.2);
}

@keyframes counterPop {
    0% { transform: scale(.86); filter: brightness(1.6); }
    60% { transform: scale(1.12); filter: brightness(1.25); }
    100% { transform: scale(1); filter: brightness(1); }
}
