/*
 * Professional Clicker Games Graphics System
 * GPU-accelerated, 60fps, AAA-quality visuals
 * Optimized for all devices with minimal server load
 */

/* ==========================================
   CSS Variables - Professional Color Palettes
   ========================================== */
:root {
    /* Cookie Clicker Theme */
    --cookie-bg-dark: #0d0a1a;
    --cookie-bg-light: #1a1432;
    --cookie-accent: #ffd700;
    --cookie-accent-rgb: 255, 215, 0;
    --cookie-warm: #ff8c00;
    --cookie-glow: rgba(255, 215, 0, 0.4);

    /* Capybara Theme */
    --capy-bg-dark: #0a1a0f;
    --capy-bg-light: #142a19;
    --capy-accent: #ff9500;
    --capy-accent-rgb: 255, 149, 0;
    --capy-nature: #4ade80;
    --capy-glow: rgba(255, 149, 0, 0.4);

    /* Chicken Theme */
    --chicken-bg-dark: #1a1206;
    --chicken-bg-light: #2d1f0e;
    --chicken-accent: #fbbf24;
    --chicken-accent-rgb: 251, 191, 36;
    --chicken-warm: #f97316;
    --chicken-glow: rgba(251, 191, 36, 0.4);

    /* Shared */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --success-green: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.4);
}

/* ==========================================
   GPU Acceleration & Performance
   ========================================== */
.gpu-layer {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.gpu-composite {
    transform: translate3d(0, 0, 0);
    perspective: 1000px;
}

/* ==========================================
   Professional Game Container
   ========================================== */
.pro-game-container {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
}

/* Cinematic Background with Depth */
.pro-game-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
}

.pro-game-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow, rgba(255, 215, 0, 0.15)) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, var(--secondary-glow, rgba(168, 85, 247, 0.1)) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 10% 70%, var(--tertiary-glow, rgba(34, 197, 94, 0.08)) 0%, transparent 50%);
    animation: bgPulse 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bgPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Noise texture overlay for depth */
.pro-game-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
}

/* ==========================================
   Premium Glass Panels
   ========================================== */
.pro-glass-panel {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.08) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.pro-glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
}

/* ==========================================
   3D Premium Click Element
   ========================================== */
.pro-click-element {
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pro-click-element::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, var(--element-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: -1;
}

.pro-click-element:hover {
    transform: scale(1.05) translateZ(20px);
}

.pro-click-element:hover::before {
    opacity: 1;
}

.pro-click-element:active {
    transform: scale(0.92) translateZ(0);
    transition-duration: 0.05s;
}

/* ==========================================
   Professional 3D Cookie
   ========================================== */
.pro-cookie {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    animation: cookieFloat 4s ease-in-out infinite;

    /* Complex multi-layer cookie texture */
    background:
        radial-gradient(ellipse 30% 20% at 25% 25%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 35% 35% at 70% 70%, rgba(0, 0, 0, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #c4956a 0%, #a67744 30%, #8b5a2b 60%, #654321 100%);

    /* Premium shadows with depth */
    box-shadow:
        0 0 0 8px rgba(139, 90, 43, 0.2),
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(255, 180, 100, 0.3),
        inset 0 -15px 35px rgba(0, 0, 0, 0.4),
        inset 0 15px 35px rgba(255, 255, 255, 0.15),
        inset 0 0 60px rgba(101, 67, 33, 0.5);

    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cookieFloat {

    0%,
    100% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg);
    }

    25% {
        transform: translateY(-8px) rotateX(2deg) rotateY(-2deg);
    }

    75% {
        transform: translateY(-4px) rotateX(-1deg) rotateY(1deg);
    }
}

.pro-cookie:hover {
    transform: scale(1.08) translateY(-10px);
    box-shadow:
        0 0 0 12px rgba(255, 215, 0, 0.3),
        0 35px 60px -12px rgba(0, 0, 0, 0.6),
        0 0 150px rgba(255, 215, 0, 0.4),
        inset 0 -15px 35px rgba(0, 0, 0, 0.4),
        inset 0 15px 35px rgba(255, 255, 255, 0.2),
        inset 0 0 60px rgba(101, 67, 33, 0.5);
}

.pro-cookie:active {
    transform: scale(0.92);
    transition-duration: 0.08s;
}

/* Chocolate chips with 3D effect */
.pro-chip {
    position: absolute;
    width: 28px;
    height: 22px;
    border-radius: 50%;
    background:
        radial-gradient(ellipse 40% 30% at 30% 30%, rgba(80, 60, 40, 1) 0%, transparent 60%),
        radial-gradient(circle, #3d2817 0%, #1a0f08 100%);
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.15),
        inset 0 -3px 6px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateZ(5px);
}

/* ==========================================
   Professional Capybara Character
   ========================================== */
.pro-capybara {
    position: relative;
    width: 220px;
    height: 200px;
    cursor: pointer;
    transform-style: preserve-3d;
    animation: capyIdle 3s ease-in-out infinite;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.4));
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes capyIdle {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-8px) rotate(1deg);
    }
}

.pro-capybara:hover {
    transform: scale(1.08) translateY(-10px);
    filter: drop-shadow(0 30px 40px rgba(255, 149, 0, 0.3));
}

.pro-capybara:active {
    transform: scale(0.92);
    transition-duration: 0.08s;
}

.pro-capy-body {
    position: absolute;
    width: 190px;
    height: 130px;
    top: 60px;
    left: 15px;
    border-radius: 55% 55% 45% 45%;
    background:
        radial-gradient(ellipse 60% 40% at 50% 20%, rgba(180, 130, 80, 0.3) 0%, transparent 50%),
        linear-gradient(180deg, #a8845a 0%, #8b6914 30%, #6b4423 70%, #4a2c17 100%);
    box-shadow:
        inset 0 -25px 50px rgba(0, 0, 0, 0.35),
        inset 0 25px 50px rgba(255, 255, 255, 0.1),
        0 15px 35px rgba(0, 0, 0, 0.3);
}

.pro-capy-head {
    position: absolute;
    width: 100px;
    height: 90px;
    top: 10px;
    left: 60px;
    border-radius: 50% 50% 45% 45%;
    background:
        radial-gradient(ellipse 50% 40% at 40% 30%, rgba(200, 160, 100, 0.4) 0%, transparent 50%),
        linear-gradient(180deg, #b8956a 0%, #a57d4a 50%, #8b6914 100%);
    box-shadow:
        inset 0 8px 20px rgba(255, 255, 255, 0.2),
        inset 0 -8px 20px rgba(0, 0, 0, 0.2);
}

.pro-capy-eye {
    position: absolute;
    width: 16px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #333 0%, #000 100%);
    box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.pro-capy-eye::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    top: 4px;
    left: 4px;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

.pro-capy-eye::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    top: 10px;
    left: 8px;
}

/* ==========================================
   Professional Chicken Character
   ========================================== */
.pro-chicken {
    position: relative;
    width: 180px;
    height: 200px;
    cursor: pointer;
    transform-style: preserve-3d;
    animation: chickenBob 2s ease-in-out infinite;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.4));
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chickenBob {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    30% {
        transform: translateY(-5px) rotate(-2deg);
    }

    60% {
        transform: translateY(-3px) rotate(2deg);
    }
}

.pro-chicken:hover {
    transform: scale(1.1) translateY(-10px);
    filter: drop-shadow(0 30px 40px rgba(251, 191, 36, 0.3));
}

.pro-chicken:active {
    transform: scale(0.9);
    transition-duration: 0.08s;
}

.pro-chicken-body {
    position: absolute;
    width: 140px;
    height: 120px;
    top: 70px;
    left: 20px;
    border-radius: 50% 50% 45% 45%;
    background:
        radial-gradient(ellipse 50% 40% at 40% 20%, rgba(255, 255, 255, 0.4) 0%, transparent 50%),
        linear-gradient(180deg, #fff 0%, #f5f5f5 30%, #e0e0e0 70%, #c9c9c9 100%);
    box-shadow:
        inset 0 -20px 40px rgba(0, 0, 0, 0.15),
        inset 0 20px 40px rgba(255, 255, 255, 0.3),
        0 15px 35px rgba(0, 0, 0, 0.25);
}

/* ==========================================
   Premium Stat Displays
   ========================================== */
.pro-stat-display {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg,
            var(--stat-color-1, #ffd700) 0%,
            var(--stat-color-2, #ff8c00) 50%,
            var(--stat-color-1, #ffd700) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
    filter: drop-shadow(0 0 20px var(--stat-glow, rgba(255, 215, 0, 0.5)));
    text-shadow: none;
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.pro-stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.pro-stat-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s;
}

.pro-stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* ==========================================
   Premium Upgrade/Building Cards
   ========================================== */
.pro-upgrade-card {
    position: relative;
    background: linear-gradient(135deg,
            rgba(var(--card-accent-rgb, 255, 215, 0), 0.08) 0%,
            rgba(var(--card-accent-rgb, 255, 215, 0), 0.02) 100%);
    border: 2px solid rgba(var(--card-accent-rgb, 255, 215, 0), 0.2);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.pro-upgrade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    transition: left 0.5s;
}

.pro-upgrade-card:hover {
    border-color: rgba(var(--card-accent-rgb), 0.5);
    background: rgba(var(--card-accent-rgb), 0.12);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 30px rgba(var(--card-accent-rgb), 0.15);
}

.pro-upgrade-card:hover::before {
    left: 100%;
}

.pro-upgrade-card.affordable {
    border-color: var(--success-green);
    box-shadow: 0 0 20px var(--success-glow);
}

.pro-upgrade-card.affordable::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--success-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

/* ==========================================
   Click Effects & Particles
   ========================================== */
.pro-float-number {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--float-color, #ffd700);
    text-shadow:
        0 0 10px var(--float-color, #ffd700),
        0 0 20px var(--float-color, #ffd700);
    pointer-events: none;
    animation: floatUp 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.3) rotate(5deg);
    }
}

/* Golden item effects */
.pro-golden-item {
    position: absolute;
    cursor: pointer;
    animation:
        goldenFloat 3s ease-in-out infinite,
        goldenPulse 1s ease-in-out infinite alternate;
    z-index: 50;
    filter:
        drop-shadow(0 0 20px #ffd700) drop-shadow(0 0 40px #ffd700) drop-shadow(0 0 60px rgba(255, 215, 0, 0.5));
}

@keyframes goldenFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg) scale(1);
    }

    50% {
        transform: translateY(-20px) rotate(5deg) scale(1.05);
    }
}

@keyframes goldenPulse {
    0% {
        filter: drop-shadow(0 0 20px #ffd700) drop-shadow(0 0 40px #ffd700);
    }

    100% {
        filter: drop-shadow(0 0 40px #fff) drop-shadow(0 0 80px #ffd700);
    }
}

/* ==========================================
   Premium Scrollbar
   ========================================== */
.pro-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.pro-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.pro-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
            var(--scrollbar-color-1, #ffd700) 0%,
            var(--scrollbar-color-2, #ff8c00) 100%);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--scrollbar-glow, rgba(255, 215, 0, 0.3));
}

/* ==========================================
   Responsive Optimizations
   ========================================== */
@media (max-width: 768px) {

    .pro-cookie,
    .pro-capybara,
    .pro-chicken {
        transform: scale(0.8);
    }

    .pro-stat-display {
        font-size: 2rem;
    }

    .pro-glass-panel {
        padding: 1rem;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {

    .pro-cookie,
    .pro-capybara,
    .pro-chicken {
        transform: scale(0.65);
    }
}

/* ==========================================
   Reduced Motion (Accessibility)
   ========================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}