:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Prevent scroll on touch */
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    transition: background-color 0.3s ease;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair; /* Changes when close */
    z-index: 1;
}

#animal-hitbox {
    position: absolute;
    width: 60px;
    height: 60px;
    /* Translate to center the hitbox on the x,y coordinate */
    transform: translate(-50%, -50%);
    border-radius: 50%;
    /* Uncomment below to debug position */
    /* background: red; opacity: 0.5; */
    pointer-events: none; /* Let the container handle clicks to avoid edge cases */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Allow clicks to pass through to game container */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#score-board {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    pointer-events: none; /* Let clicks pass through so cow is always clickable */
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 90%;
    width: 450px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    pointer-events: auto;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.modal.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

h1 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #4F46E5, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #475569;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

button:active {
    transform: translateY(1px);
}


.bounce {
    animation: bounce 1s infinite alternate cubic-bezier(0.5, 0.05, 1, 0.5);
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-15px);
    }
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Cursor classes based on distance */
body.found-it #game-container {
    cursor: pointer;
}

/* 手机端适配加强 */
@media (max-width: 480px) {
    .modal {
        padding: 25px 20px;
        width: 95%;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    p {
        font-size: 1rem;
    }
    
    #score-board {
        top: 15px;
        right: 15px;
        padding: 8px 15px;
    }
}
