:root {
    --primary-color: #ff6f61;
    --secondary-color: #6b5b95;
    --accent-color: #88b04b;
    --text-color: #2c3e50;
    --background-color: #f5f5f5;
    --bear-color: #8B4513;
    --apple-color: #ff4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* Background animation */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.1) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0.1) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: backgroundScroll 10s linear infinite;
    z-index: -1;
}

@keyframes backgroundScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 2rem;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0 var(--secondary-color);
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.score-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.score-label {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.score-value {
    font-size: 2rem;
    color: var(--primary-color);
    background: var(--background-color);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.game-area {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    position: relative;
}

.clicker {
    width: 400px;
    height: 400px;
    cursor: pointer;
    transition: transform 0.1s ease;
    position: relative;
}

.bear-static,
.bear-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bear-gif {
    transition: transform 0.1s ease;
    animation: bearChew 1s infinite;
    animation-timing-function: steps(4);
}

@keyframes bearChew {
    0% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
    100% { transform: rotate(-2deg); }
}

.clicker:active .bear-gif {
    transform: scale(0.95);
}

.apple {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: var(--apple-color);
    border-radius: 50%;
    animation: float 2s ease-in-out infinite;
    opacity: 0;
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0); }
}

.leaderboard {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 10px;
    animation: slideUp 0.5s ease-in;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.leaderboard h2 {
    color: var(--secondary-color);
    font-size: 1.5rem;

    /* Leaderboard animations */
    .leaderboard-item.new-highscore {
        animation: highscorePulse 1s ease-in-out;
    }

    @keyframes highscorePulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.1); background: rgba(255,215,0,0.1); }
        100% { transform: scale(1); }
    }

    .leaderboard-item.rising {
        animation: riseUp 0.5s ease-out;
    }

    @keyframes riseUp {
        0% { transform: translateY(20px); opacity: 0; }
        100% { transform: translateY(0); opacity: 1; }
    }
    margin-bottom: 1rem;
    text-align: center;
}

#leaderboard {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.loading {
    text-align: center;
    color: var(--secondary-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Animation for score increase */
@keyframes scorePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.score-pop {
    animation: scorePop 0.2s ease;
}

/* Combo system styles */
.combo-container {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.combo-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.combo-value {
    font-size: 1.5rem;
    color: var(--primary-color);
    animation: comboPulse 0.5s infinite alternate;
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

/* Power-up states */
.power-up-active {
    animation: powerUpGlow 1s infinite alternate;
}

@keyframes powerUpGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.5); }
}

/* Apple throw animation */
@keyframes throwApple {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(200px, -200px) scale(0.5);
    }
}

.apple-throw {
    animation: throwApple 0.5s ease-out forwards;
}

/* Particle effects */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8), rgba(255,255,255,0));
    animation: particleFade 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes particleFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(2);
    }
}

/* Background animation */
@keyframes backgroundScroll {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% 0;
    }
}

/* Bear animations */
@keyframes bearChew {
    0% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
    100% { transform: rotate(-2deg); }
}

.bear-gif {
    animation: bearChew 0.5s infinite;
}

/* Power-up effects */
@keyframes glow {
    0% { box-shadow: 0 0 10px rgba(255,215,0,0.5); }
    50% { box-shadow: 0 0 20px rgba(255,215,0,0.8); }
    100% { box-shadow: 0 0 10px rgba(255,215,0,0.5); }
}

.power-up {
    animation: glow 1s infinite;
}