/**
 * QUIZTREFF SHOP PREVIEW MODAL v2
 * ================================
 * Echte UI-Komponenten, Before/After Toggle, große Bühne
 */

/* ========== Modal Base ========== */
.shop-preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.shop-preview-modal.active {
    display: flex;
}

.shop-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
}

.shop-preview-container {
    position: relative;
    width: 95%;
    max-width: 520px;
    max-height: 95vh;
    background: linear-gradient(180deg, #0f0a18 0%, #08040c 100%);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 80px rgba(124, 58, 237, 0.25),
        0 30px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========== Modal Header ========== */
.shop-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.2), transparent);
    border-bottom: 1px solid rgba(124, 58, 237, 0.25);
}

.shop-preview-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.shop-preview-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.shop-preview-rarity {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.shop-preview-rarity.common { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }
.shop-preview-rarity.uncommon { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.shop-preview-rarity.rare { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.shop-preview-rarity.epic { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.shop-preview-rarity.legendary {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(251, 191, 36, 0.2));
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}
.shop-preview-rarity.mythic {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(124, 58, 237, 0.25));
    color: #ec4899;
    text-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}

.shop-preview-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.15s;
}

.shop-preview-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ========== Modal Body ========== */
.shop-preview-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* ========== Before/After Toggle ========== */
.preview-toggle-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.preview-toggle {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

.preview-toggle.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(236, 72, 153, 0.3));
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

/* ========== Preview Stage ========== */
.shop-preview-stage {
    position: relative;
    height: 280px;
    background: linear-gradient(180deg, #0a0612 0%, #050308 100%);
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    overflow: hidden;
    margin-bottom: 12px;
}

/* Background Layer */
.preview-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.preview-bg-layer .cosmetic-canvas {
    border-radius: 16px;
}

/* UI Layer */
.preview-ui-layer {
    position: relative;
    z-index: 5;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ========== Player Tag Component ========== */
.preview-player-tag {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.player-tag-avatar-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.player-tag-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.avatar-letter {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Avatar Frame */
.player-tag-frame {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.player-tag-frame.active {
    opacity: 1;
}

/* Square avatar for cos-af-* frames */
.player-tag-avatar-wrap:has(.player-tag-frame.cos-af-simple-glow-violet.active) .player-tag-avatar,
.player-tag-avatar-wrap:has(.player-tag-frame.cos-af-arcade-tube.active) .player-tag-avatar,
.player-tag-avatar-wrap:has(.player-tag-frame.cos-af-hologram-hex.active) .player-tag-avatar,
.player-tag-avatar-wrap:has(.player-tag-frame.cos-af-crown-quizlord.active) .player-tag-avatar,
.player-tag-avatar-wrap:has(.player-tag-frame.cos-af-black-onyx.active) .player-tag-avatar {
    border-radius: 12px;
}

.player-tag-frame.cos-af-simple-glow-violet,
.player-tag-frame.cos-af-arcade-tube,
.player-tag-frame.cos-af-hologram-hex,
.player-tag-frame.cos-af-crown-quizlord,
.player-tag-frame.cos-af-black-onyx {
    border-radius: 16px;
}

/* Frame Styles - Square Frames (cos-af-*) */
.player-tag-frame.cos-af-simple-glow-violet.active {
    border: 3px solid rgba(124, 58, 237, 0.9);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.6), inset 0 0 15px rgba(124, 58, 237, 0.3);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, transparent 100%);
}

.player-tag-frame.cos-af-arcade-tube.active {
    border: 3px solid #00b4ff;
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.7), inset 0 0 15px rgba(0, 180, 255, 0.2);
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.1) 0%, transparent 100%);
    animation: arcadePulse 2s ease-in-out infinite;
}

@keyframes arcadePulse {
    0%, 100% {
        border-color: #00b4ff;
        box-shadow: 0 0 20px rgba(0, 180, 255, 0.7), inset 0 0 15px rgba(0, 180, 255, 0.2);
    }
    50% {
        border-color: #00ffff;
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.8), inset 0 0 20px rgba(0, 255, 255, 0.3);
    }
}

.player-tag-frame.cos-af-hologram-hex.active {
    border: 3px solid rgba(236, 72, 153, 0.9);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.5), inset 0 0 15px rgba(236, 72, 153, 0.2);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(236, 72, 153, 0.1) 50%, rgba(34, 211, 238, 0.15) 100%);
    animation: holoFrame 3s linear infinite;
}

@keyframes holoFrame {
    0% {
        border-color: rgba(124, 58, 237, 0.9);
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.5), inset 0 0 15px rgba(124, 58, 237, 0.2);
    }
    33% {
        border-color: rgba(236, 72, 153, 0.9);
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.5), inset 0 0 15px rgba(236, 72, 153, 0.2);
    }
    66% {
        border-color: rgba(34, 211, 238, 0.9);
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.5), inset 0 0 15px rgba(34, 211, 238, 0.2);
    }
    100% {
        border-color: rgba(124, 58, 237, 0.9);
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.5), inset 0 0 15px rgba(124, 58, 237, 0.2);
    }
}

.player-tag-frame.cos-af-crown-quizlord.active {
    border: 3px solid rgba(251, 191, 36, 0.9);
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.6), inset 0 0 15px rgba(251, 191, 36, 0.2);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.player-tag-frame.cos-af-black-onyx.active {
    border: 3px solid rgba(80, 80, 100, 0.9);
    box-shadow: 0 0 15px rgba(60, 60, 80, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, rgba(40, 40, 60, 0.6) 0%, rgba(20, 20, 30, 0.8) 100%);
}

/* Avatar Aura */
.player-tag-aura {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.player-tag-aura.active {
    opacity: 1;
}

.player-tag-aura.cos-aa-violet-mist.active {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, transparent 70%);
}

.player-tag-aura.cos-aa-stars-orbit.active {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: starsOrbit 8s linear infinite;
}

@keyframes starsOrbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player-tag-aura.cos-aa-lightning-soft.active {
    background: radial-gradient(circle, rgba(0, 180, 255, 0.3) 0%, transparent 60%);
    animation: lightningPulse 2s ease-in-out infinite;
}

@keyframes lightningPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Player Info */
.player-tag-info {
    flex: 1;
    min-width: 0;
}

.player-tag-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.player-tag-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

/* Nameplate Styles */
.player-tag-name.cos-np-glass-bar {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 14px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.player-tag-name.cos-np-neon-underline {
    border-bottom: 2px solid rgba(124, 58, 237, 0.7);
    padding-bottom: 4px;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.player-tag-name.cos-np-galaxy-sheen {
    background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.25), transparent);
    padding: 4px 16px;
    animation: galaxySheen 3s ease-in-out infinite;
}

@keyframes galaxySheen {
    0%, 100% { background-position: -100% 0; }
    50% { background-position: 200% 0; }
}

/* Title Prefix */
.player-tag-title {
    display: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(124, 58, 237, 0.3);
    color: #a78bfa;
}

.player-tag-title.active {
    display: inline-block;
}

/* Badge */
.player-tag-badge {
    display: none;
    font-size: 20px;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.5));
}

.player-tag-badge.active {
    display: inline-block;
}

.player-tag-level {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* ========== Stat Cards ========== */
.preview-stat-cards {
    display: flex;
    gap: 8px;
}

.preview-stat-card {
    flex: 1;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card-icon {
    font-size: 20px;
    margin-bottom: 3px;
}

.stat-card-value {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.stat-card-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Stat Card Skins */
.preview-stat-card.cos-sc-ember-gold {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
    border-color: rgba(251, 191, 36, 0.3);
}

.preview-stat-card.cos-sc-ocean-neon {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.15), rgba(0, 100, 255, 0.1));
    border-color: rgba(0, 180, 255, 0.3);
}

.preview-stat-card.cos-sc-violet-royal {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.1));
    border-color: rgba(124, 58, 237, 0.4);
}

/* Trophy Card */
.preview-stat-card.trophy-card {
    position: relative;
}

.trophy-card-effect {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    border-radius: 11px;
    overflow: hidden;
}

.trophy-card-effect.active {
    opacity: 1;
}

.trophy-card-effect.effect-holo {
    background: linear-gradient(135deg,
        rgba(124, 58, 237, 0.3) 0%,
        rgba(236, 72, 153, 0.4) 25%,
        rgba(34, 211, 238, 0.3) 50%,
        rgba(236, 72, 153, 0.4) 75%,
        rgba(124, 58, 237, 0.3) 100%
    );
    background-size: 400% 400%;
    animation: holoShimmer 3s ease-in-out infinite;
    mix-blend-mode: overlay;
}

.trophy-card-effect.effect-foil {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(251, 191, 36, 0.5) 45%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(251, 191, 36, 0.5) 55%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: foilShine 2s ease-in-out infinite;
}

.preview-stat-card.cos-tc-goldfoil {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
    border-color: rgba(251, 191, 36, 0.5);
}

.preview-stat-card.cos-tc-holo-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
    border-color: rgba(236, 72, 153, 0.4);
}

.preview-stat-card.cos-tc-noir-stamp {
    background: rgba(20, 10, 30, 0.8);
    border-color: rgba(124, 58, 237, 0.5);
}

/* ========== Overlay Layer ========== */
.preview-overlay-layer {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    border-radius: 16px;
}

.preview-overlay-layer.active {
    opacity: 1;
}

.preview-overlay-layer.cos-ov-vignette-soft {
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.5) 100%);
}

.preview-overlay-layer.cos-ov-filmgrain-ultra {
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.08;
}

.preview-overlay-layer.cos-ov-scanlines-arcade {
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
}

/* ========== Header Glow ========== */
.preview-header-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
}

.preview-header-glow.active {
    opacity: 1;
}

.preview-header-glow.cos-hdr-violet-crown {
    background: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.4), transparent 70%);
}

.preview-header-glow.cos-hdr-dual-tone {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(124, 58, 237, 0.35), transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(0, 180, 255, 0.35), transparent 50%);
}

.preview-header-glow.cos-hdr-rainbow-neon-soft {
    background: linear-gradient(90deg,
        rgba(255, 0, 128, 0.2),
        rgba(255, 165, 0, 0.2),
        rgba(255, 255, 0, 0.2),
        rgba(0, 255, 0, 0.2),
        rgba(0, 180, 255, 0.2),
        rgba(128, 0, 255, 0.2)
    );
    animation: rainbowShift 5s linear infinite;
}

@keyframes rainbowShift {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.preview-header-glow.cos-hdr-blackhole {
    background: radial-gradient(ellipse at 50% -20%, rgba(0, 0, 0, 0.8) 20%, rgba(124, 58, 237, 0.2) 40%, transparent 60%);
}

/* ========== Victory Animation Layer ========== */
.preview-victory-layer {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-victory-layer.active {
    opacity: 1;
}

.preview-victory-layer .victory-canvas {
    width: 100%;
    height: 100%;
}

/* Victory CSS Animations */
.preview-victory-layer.cos-va-starburst-soft {
    background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.6), transparent 50%);
    animation: starburstPulse 0.9s ease-out 2;
}

.preview-victory-layer.cos-va-holo-wave::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(124, 58, 237, 0.5),
        rgba(236, 72, 153, 0.6),
        rgba(34, 211, 238, 0.5),
        transparent
    );
    animation: waveSweep 1.5s ease-out;
}

/* ========== Item Info ========== */
.preview-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-item-icon {
    flex-shrink: 0;
}

.preview-item-icon img {
    filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.4));
}

.preview-item-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* ========== Modal Footer ========== */
.shop-preview-footer {
    display: flex;
    gap: 12px;
    padding: 18px 24px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(124, 58, 237, 0.15);
}

.shop-preview-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.shop-preview-btn:active {
    transform: scale(0.98);
}

.preview-btn-test {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.4);
    color: #a78bfa;
}

.preview-btn-test:hover {
    background: rgba(124, 58, 237, 0.35);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.preview-btn-action.buy {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1512;
    border-color: #fbbf24;
    font-weight: 700;
}

.preview-btn-action.buy:hover {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
    transform: translateY(-2px);
}

.preview-btn-action.owned {
    background: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.5);
    color: #4ade80;
}

.preview-btn-action.owned:hover {
    background: rgba(74, 222, 128, 0.35);
}

.preview-btn-action.equipped {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.2));
    border-color: rgba(251, 191, 36, 0.5);
    color: #fbbf24;
}

/* ========== Effect Animations ========== */
@keyframes holoShimmer {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

@keyframes foilShine {
    0% { background-position: -100% 0; }
    100% { background-position: 200% 0; }
}

@keyframes waveSweep {
    0% { transform: translateX(-100%); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

@keyframes starburstPulse {
    0% { transform: scale(0.3); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ========== Profile Card Preview Mockup ========== */
.preview-profile-wrap {
    display: none;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.preview-profile-wrap.active {
    display: flex;
}

.preview-profile-card {
    position: relative;
    width: 220px;
    height: 160px;
    background: linear-gradient(180deg, #0a0612 0%, #050308 100%);
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, 0.3);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Background preview - use same ::before technique as real backgrounds */
.preview-profile-card[class*="cos-bg-"]::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: 14px;
}

.preview-profile-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.preview-profile-bg canvas {
    width: 100%;
    height: 100%;
    border-radius: 14px;
}

.preview-profile-content {
    position: relative;
    z-index: 5;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 16px;
}

.preview-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.preview-profile-avatar span {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.preview-profile-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.preview-profile-level {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 10px;
}

.preview-profile-stats {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.preview-profile-stat {
    text-align: center;
}

.preview-profile-stat-value {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.preview-profile-stat-label {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

/* Profile Card Overlay */
.preview-profile-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    border-radius: 14px;
}

.preview-profile-overlay.active {
    opacity: 1;
}

.preview-profile-overlay.cos-ov-vignette-soft {
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.6) 100%);
}

.preview-profile-overlay.cos-ov-filmgrain-ultra {
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.12;
}

.preview-profile-overlay.cos-ov-scanlines-arcade {
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0px, rgba(0, 0, 0, 0.2) 1px, transparent 1px, transparent 3px);
}

.preview-profile-overlay.cos-ov-raindrops-window {
    background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 1px, transparent 2px),
                radial-gradient(circle at 60% 20%, rgba(255,255,255,0.08) 1px, transparent 2px),
                radial-gradient(circle at 80% 60%, rgba(255,255,255,0.1) 1px, transparent 2px),
                radial-gradient(circle at 40% 70%, rgba(255,255,255,0.08) 1px, transparent 2px);
}

/* Profile Card Header Glow */
.preview-profile-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    border-radius: 14px 14px 0 0;
}

.preview-profile-glow.active {
    opacity: 1;
}

.preview-profile-glow.cos-hdr-violet-crown {
    background: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.5), transparent 70%);
}

.preview-profile-glow.cos-hdr-dual-tone {
    background: radial-gradient(ellipse at 20% 0%, rgba(124, 58, 237, 0.4), transparent 50%),
                radial-gradient(ellipse at 80% 0%, rgba(0, 180, 255, 0.4), transparent 50%);
}

.preview-profile-glow.cos-hdr-rainbow-neon-soft {
    background: linear-gradient(90deg,
        rgba(255, 0, 128, 0.3),
        rgba(255, 165, 0, 0.3),
        rgba(255, 255, 0, 0.3),
        rgba(0, 255, 0, 0.3),
        rgba(0, 180, 255, 0.3),
        rgba(128, 0, 255, 0.3)
    );
    animation: rainbowShift 5s linear infinite;
}

.preview-profile-glow.cos-hdr-blackhole {
    background: radial-gradient(ellipse at 50% -20%, rgba(0, 0, 0, 0.9) 20%, rgba(124, 58, 237, 0.3) 40%, transparent 60%);
}

/* ========== Tablet Preview Mockup ========== */
.preview-tablet-wrap {
    display: none;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.preview-tablet-wrap.active {
    display: flex;
}

.preview-tablet-device {
    position: relative;
    width: 200px;
    height: 140px;
    background: linear-gradient(145deg, #1a1a2e 0%, #0f0f1a 100%);
    border-radius: 12px;
    border: 3px solid #2d2d44;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.preview-tablet-device::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 4px;
    height: 30px;
    background: #2d2d44;
    border-radius: 2px;
}

.preview-tablet-device::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #2d2d44;
    border-radius: 50%;
}

.preview-tablet-screen {
    position: absolute;
    top: 24px;
    left: 12px;
    right: 16px;
    bottom: 12px;
    background: linear-gradient(180deg, #0a0612 0%, #050308 100%);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preview-tablet-screen-content {
    text-align: center;
}

.preview-tablet-q {
    font-size: 32px;
    font-weight: 800;
    color: #7c3aed;
    text-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

.preview-tablet-text {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.preview-tablet-buttons {
    display: flex;
    gap: 6px;
}

.preview-tablet-btn {
    width: 40px;
    height: 20px;
    background: rgba(124, 58, 237, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.5);
    border-radius: 4px;
}

/* Tablet Theme Styles */
.preview-tablet-device.theme-magenta {
    border-color: #ec4899;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.theme-magenta .preview-tablet-q {
    color: #ec4899;
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
}
.preview-tablet-device.theme-magenta .preview-tablet-btn {
    background: rgba(236, 72, 153, 0.3);
    border-color: rgba(236, 72, 153, 0.5);
}

.preview-tablet-device.theme-neon_blue {
    border-color: #00b4ff;
    box-shadow: 0 0 30px rgba(0, 180, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.theme-neon_blue .preview-tablet-q {
    color: #00b4ff;
    text-shadow: 0 0 20px rgba(0, 180, 255, 0.5);
}
.preview-tablet-device.theme-neon_blue .preview-tablet-btn {
    background: rgba(0, 180, 255, 0.3);
    border-color: rgba(0, 180, 255, 0.5);
}

.preview-tablet-device.theme-midnight {
    border-color: #3b4d6b;
    background: linear-gradient(145deg, #1a2233 0%, #0a0f18 100%);
}
.preview-tablet-device.theme-midnight .preview-tablet-q {
    color: #6b8ab8;
    text-shadow: 0 0 20px rgba(107, 138, 184, 0.4);
}

.preview-tablet-device.theme-gold {
    border-color: #fbbf24;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.theme-gold .preview-tablet-q {
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}
.preview-tablet-device.theme-gold .preview-tablet-btn {
    background: rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.5);
}

.preview-tablet-device.theme-glitch {
    animation: tabletGlitch 3s infinite;
}
@keyframes tabletGlitch {
    0%, 90%, 100% { transform: translate(0); filter: none; }
    92% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
    94% { transform: translate(2px, -1px); filter: hue-rotate(180deg); }
    96% { transform: translate(-1px, 2px); filter: hue-rotate(270deg); }
}

.preview-tablet-device.theme-royal_purple {
    border-color: #a855f7;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.theme-royal_purple .preview-tablet-q {
    color: #a855f7;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

/* Tablet Glow Styles */
.preview-tablet-device.glow-neon_pink {
    box-shadow: 0 0 40px rgba(255, 0, 200, 0.5), 0 0 80px rgba(255, 0, 200, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-neon_blue {
    box-shadow: 0 0 40px rgba(0, 180, 255, 0.5), 0 0 80px rgba(0, 180, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-neon_green {
    box-shadow: 0 0 40px rgba(0, 255, 100, 0.5), 0 0 80px rgba(0, 255, 100, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-gold {
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.5), 0 0 80px rgba(255, 215, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-purple {
    box-shadow: 0 0 40px rgba(160, 0, 255, 0.5), 0 0 80px rgba(160, 0, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-fire {
    box-shadow: 0 0 40px rgba(255, 100, 0, 0.5), 0 0 80px rgba(255, 100, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fireGlow 2s ease-in-out infinite;
}
@keyframes fireGlow {
    0%, 100% { box-shadow: 0 0 40px rgba(255, 100, 0, 0.5), 0 0 80px rgba(255, 100, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 50px rgba(255, 50, 0, 0.6), 0 0 100px rgba(255, 150, 0, 0.4), 0 10px 40px rgba(0, 0, 0, 0.5); }
}
.preview-tablet-device.glow-ice {
    box-shadow: 0 0 40px rgba(200, 240, 255, 0.5), 0 0 80px rgba(200, 240, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-tablet-device.glow-rainbow {
    animation: rainbowGlow 3s linear infinite;
}
@keyframes rainbowGlow {
    0% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.5), 0 0 80px rgba(255, 0, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    16% { box-shadow: 0 0 40px rgba(255, 165, 0, 0.5), 0 0 80px rgba(255, 165, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    33% { box-shadow: 0 0 40px rgba(255, 255, 0, 0.5), 0 0 80px rgba(255, 255, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(0, 255, 0, 0.5), 0 0 80px rgba(0, 255, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    66% { box-shadow: 0 0 40px rgba(0, 180, 255, 0.5), 0 0 80px rgba(0, 180, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    83% { box-shadow: 0 0 40px rgba(160, 0, 255, 0.5), 0 0 80px rgba(160, 0, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    100% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.5), 0 0 80px rgba(255, 0, 0, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
}
.preview-tablet-device.glow-plasma {
    animation: plasmaGlow 2s ease-in-out infinite;
}
@keyframes plasmaGlow {
    0%, 100% { box-shadow: 0 0 40px rgba(160, 0, 255, 0.5), 0 0 80px rgba(0, 180, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 50px rgba(0, 180, 255, 0.6), 0 0 100px rgba(160, 0, 255, 0.4), 0 10px 40px rgba(0, 0, 0, 0.5); }
}

/* ========== Responsive ========== */
@media (max-width: 520px) {
    .shop-preview-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .shop-preview-stage {
        height: 140px;
    }

    .preview-player-tag {
        padding: 8px 10px;
        gap: 8px;
    }

    .player-tag-avatar-wrap {
        width: 32px;
        height: 32px;
    }

    .preview-stat-cards {
        gap: 6px;
    }

    .preview-stat-card {
        padding: 6px;
    }

    .shop-preview-footer {
        flex-direction: column;
    }
}

/* ========== Preview Card Background Animations ========== */
/* These mirror the body background styles from cosmetics.css */

/* Stars Soft */
.preview-profile-card.cos-bg-stars-soft::before,
.preview-profile-card.cos-bg-starfield-soft::before {
    background:
        radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent);
    background-size: 200px 200px;
    animation: bg-stars-drift 60s linear infinite;
}

/* Stars Parallax */
.preview-profile-card.cos-bg-stars-parallax::before {
    background:
        radial-gradient(1px 1px at 25px 25px, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 75px 75px, rgba(0,180,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 125px 50px, rgba(255,0,200,0.6), transparent),
        radial-gradient(1px 1px at 50px 125px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 100px 100px, rgba(0,180,255,0.5), transparent),
        radial-gradient(1px 1px at 150px 150px, rgba(255,255,255,0.6), transparent);
    background-size: 150px 150px, 200px 200px, 250px 250px, 180px 180px, 220px 220px, 170px 170px;
    animation: bg-stars-parallax 40s linear infinite;
}

/* Nebula Pink */
.preview-profile-card.cos-bg-nebula-pink::before {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(255,0,128,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(124,58,237,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(236,72,153,0.2) 0%, transparent 60%);
    animation: bg-nebula-drift 30s ease-in-out infinite;
}

/* Nebula Blue */
.preview-profile-card.cos-bg-nebula-blue::before {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(0,180,255,0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(0,102,255,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0,255,255,0.15) 0%, transparent 50%);
    animation: bg-nebula-drift 35s ease-in-out infinite;
}

/* Aurora */
.preview-profile-card.cos-bg-aurora::before {
    background:
        linear-gradient(180deg, transparent 0%, rgba(0,255,136,0.15) 20%, transparent 40%),
        linear-gradient(180deg, transparent 30%, rgba(0,180,255,0.12) 50%, transparent 70%),
        linear-gradient(180deg, transparent 50%, rgba(124,58,237,0.1) 70%, transparent 90%);
    animation: bg-aurora-wave 20s ease-in-out infinite;
}

/* Synthgrid */
.preview-profile-card.cos-bg-synthgrid::before {
    background:
        linear-gradient(180deg, rgba(255,0,200,0.1) 0%, transparent 50%),
        repeating-linear-gradient(90deg, rgba(255,0,200,0.1) 0px, rgba(255,0,200,0.1) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(0deg, rgba(255,0,200,0.05) 0px, rgba(255,0,200,0.05) 1px, transparent 1px, transparent 40px);
    animation: bg-grid-scroll 20s linear infinite;
}

/* Scanlines */
.preview-profile-card.cos-bg-scanlines::before {
    background: repeating-linear-gradient(0deg, rgba(0,255,136,0.03) 0px, rgba(0,255,136,0.03) 1px, transparent 1px, transparent 3px);
    animation: bg-scanlines-flicker 0.1s steps(2) infinite;
}

/* Matrix */
.preview-profile-card.cos-bg-matrix::before {
    background:
        linear-gradient(180deg, rgba(0,255,120,0.1) 0%, transparent 60%),
        repeating-linear-gradient(90deg, rgba(0,255,120,0.08) 0px, rgba(0,255,120,0.08) 1px, transparent 1px, transparent 30px);
    animation: bg-matrix-rain 15s linear infinite;
}

/* Holo Sparkle */
.preview-profile-card.cos-bg-holo-sparkle::before {
    background:
        radial-gradient(2px 2px at 30px 30px, rgba(124,58,237,0.8), transparent),
        radial-gradient(2px 2px at 70px 80px, rgba(236,72,153,0.7), transparent),
        radial-gradient(2px 2px at 120px 40px, rgba(34,211,238,0.8), transparent),
        radial-gradient(2px 2px at 90px 120px, rgba(251,191,36,0.7), transparent);
    background-size: 150px 150px;
    animation: bg-sparkle-twinkle 3s ease-in-out infinite;
}

/* Royal Night */
.preview-profile-card.cos-bg-royal-night::before {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(30,27,75,0.8) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(49,46,129,0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(76,29,149,0.4) 0%, transparent 60%);
}

/* Noir Violet Fog */
.preview-profile-card.cos-bg-noir-violet-fog::before {
    background:
        radial-gradient(ellipse at 0% 50%, rgba(124,58,237,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 50%, rgba(76,29,149,0.2) 0%, transparent 50%);
    animation: bg-fog-drift 25s ease-in-out infinite;
}

/* Neon Grid Floor */
.preview-profile-card.cos-bg-neon-grid-floor::before {
    background:
        linear-gradient(180deg, transparent 40%, rgba(0,180,255,0.15) 100%),
        repeating-linear-gradient(90deg, rgba(0,180,255,0.1) 0px, rgba(0,180,255,0.1) 1px, transparent 1px, transparent 50px);
    animation: bg-grid-scroll 25s linear infinite;
}

/* Arcade Smoke */
.preview-profile-card.cos-bg-arcade-smoke::before {
    background:
        radial-gradient(ellipse at 20% 80%, rgba(0,180,255,0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, rgba(124,58,237,0.15) 0%, transparent 40%);
    animation: bg-smoke-rise 20s ease-in-out infinite;
}

/* Galaxy Band */
.preview-profile-card.cos-bg-galaxy-band::before {
    background:
        linear-gradient(45deg, transparent 30%, rgba(124,58,237,0.2) 45%, rgba(236,72,153,0.15) 55%, transparent 70%),
        radial-gradient(1px 1px at 50px 50px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 100px 80px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 150px 120px, rgba(255,255,255,0.7), transparent);
    background-size: 100% 100%, 200px 200px, 200px 200px, 200px 200px;
}

/* Black Ice */
.preview-profile-card.cos-bg-black-ice::before {
    background: linear-gradient(135deg, rgba(0,255,255,0.05) 0%, rgba(0,136,255,0.08) 50%, rgba(255,255,255,0.05) 100%);
}

/* Keyframe animations (reference from cosmetics.css) */
@keyframes bg-stars-drift {
    0% { background-position: 0 0; }
    100% { background-position: 200px 200px; }
}

@keyframes bg-stars-parallax {
    0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 150px 150px, 100px 200px, 250px 125px, 90px 180px, 220px 110px, 170px 170px; }
}

@keyframes bg-nebula-drift {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes bg-aurora-wave {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes bg-grid-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

@keyframes bg-scanlines-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

@keyframes bg-matrix-rain {
    0% { background-position: 0 0; }
    100% { background-position: 0 500px; }
}

@keyframes bg-sparkle-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bg-fog-drift {
    0%, 100% { background-position: 0% 50%, 100% 50%; }
    50% { background-position: 10% 50%, 90% 50%; }
}

@keyframes bg-smoke-rise {
    0%, 100% { background-position: 20% 80%, 80% 80%; }
    50% { background-position: 25% 70%, 75% 70%; }
}
