:root {
    --bg-color: #fce4ec;
    /* Soft pink background */
    --text-color: #4a4a4a;
    --primary-color: #ff6b81;
    --primary-hover: #ff4757;
    --secondary-color: #7bed9f;
    --danger-color: #ff7f50;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(255, 107, 129, 0.15);

    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    /* Prevent text selection during gameplay */
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow: hidden;
    /* Important for game areas filling the screen */
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Background animated shapes */
.bg-shape {
    position: absolute;
    filter: blur(80px);
    z-index: -1;
    border-radius: 50%;
    animation: floatBg 20s infinite ease-in-out;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: rgba(255, 107, 129, 0.4);
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: rgba(123, 237, 159, 0.3);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape3 {
    width: 300px;
    height: 300px;
    background: rgba(112, 161, 255, 0.3);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes floatBg {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(50px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-30px, 30px) scale(0.9);
    }
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

/* Header & Stats */
header {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 30px;
    width: 100%;
    max-width: 800px;
}

h1 {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.stats {
    display: flex;
    gap: 30px;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.stat-box .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    font-weight: 600;
}

.stat-box .value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--primary-color);
}

.target-container {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.target-pet {
    font-size: 3rem;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    animation: bounceTarget 2s infinite ease-in-out;
}

@keyframes bounceTarget {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Main Game Area */
main {
    flex: 1;
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-area-wrapper {
    width: 100%;
    max-width: 1000px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#game-area {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: crosshair;
    /* Suggests clicking/targeting */
}

/* Pets */
.pet {
    position: absolute;
    font-size: 4rem;
    /* Base size, can vary by level */
    line-height: 1;
    cursor: pointer;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.15));
    transition: transform 0.1s;
    /* Smooth out tiny sub-pixel jitters */
    will-change: transform;
    /* Center origin for transformations */
    transform-origin: center center;
}

.pet:active {
    filter: brightness(0.8) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

.pet-inner {
    display: inline-block;
    animation: petWobble 3s infinite ease-in-out;
}

@keyframes petWobble {

    0%,
    100% {
        transform: rotate(-5deg) scale(1);
    }

    50% {
        transform: rotate(5deg) scale(1.05);
    }
}

/* Floating Scores & Feedback */
#floating-scores {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Don't block clicks */
    z-index: 10;
}

.float-score {
    position: absolute;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
}

.score-positive {
    color: #2ed573;
}

.score-negative {
    color: #ff4757;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translateY(-10px) scale(1.2);
    }

    100% {
        transform: translateY(-40px) scale(1);
        opacity: 0;
    }
}

.cross-mark {
    position: absolute;
    font-size: 3rem;
    color: #ff4757;
    font-weight: bold;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: popFade 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 5;
    transform: translate(-50%, -50%);
}

@keyframes popFade {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}


/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    padding: 40px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.modal h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.modal p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.rules {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: left;
}

.rules p {
    font-size: 1rem;
    margin-bottom: 8px;
}

.rules p:last-child {
    margin-bottom: 0;
}

.stats-recap {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 12px;
}

.stats-recap span {
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 1.5rem;
}

/* Theme overrides for specific modals */
.success-theme h2 {
    color: var(--secondary-color);
}

.success-theme .stats-recap span {
    color: var(--secondary-color);
}

.danger-theme h2 {
    color: var(--danger-color);
}

.danger-theme .stats-recap span {
    color: var(--danger-color);
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: var(--font-heading);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 129, 0.4);
    transition: all 0.2s ease;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 129, 0.6);
}

.primary-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(255, 107, 129, 0.4);
}

.pulse-glow {
    animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 107, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 129, 0);
    }
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 15px;
    }

    .stat-box .value {
        font-size: 1.4rem;
    }

    .target-pet {
        font-size: 2.5rem;
    }

    .pet {
        font-size: 3rem;
    }

    .modal-content {
        padding: 30px 20px;
    }
}