:root {
    --bg-color: #fce4ec;
    --text-color: #2b2b2b;
    --accent-color: #ff4081;
    --pet-color: #00e5ff;
    --pet-border: #000;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Press Start 2P', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.05) 2px,
        rgba(0, 0, 0, 0.05) 4px
    );
}

.hud {
    background-color: #fff;
    border-bottom: 4px solid var(--text-color);
    padding: 15px 20px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 20px;
    margin: 0;
    text-transform: uppercase;
    color: var(--accent-color);
    text-shadow: 2px 2px 0px var(--text-color);
}

.attention-icon {
    font-size: 18px;
    background-color: red;
    color: white;
    padding: 5px 10px;
    border: 3px solid #000;
    animation: flash 1s infinite alternate;
}
.attention-icon.hidden { display: none; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    font-size: 12px;
    line-height: 1.5;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

button {
    font-family: inherit;
    background-color: var(--accent-color);
    color: #fff;
    border: 3px solid var(--text-color);
    border-radius: 0;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 10px;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-color);
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 var(--text-color);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.desktop-area {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Base Pet styling */
.pet {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}
.pet:active { cursor: grabbing; }

.body {
    background-color: var(--pet-color);
    border: 4px solid var(--pet-border);
    position: relative;
    box-shadow: inset -5px -5px 0 rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
}

.face {
    position: absolute;
    top: 30%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eye {
    width: 8px;
    height: 12px;
    background-color: var(--pet-border);
    position: absolute;
    border-radius: 2px;
    animation: blink 4s infinite;
}
.left-eye { left: 20%; }
.right-eye { right: 20%; }

.mouth {
    width: 16px;
    height: 8px;
    border: 4px solid var(--pet-border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    margin-top: 20px;
}

.legs {
    display: flex;
    justify-content: space-between;
    width: 60%;
    margin-top: -4px;
}

.leg {
    width: 12px;
    height: 20px;
    background-color: var(--pet-color);
    border: 4px solid var(--pet-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    transform-origin: top center;
}

/* Stages */
/* 1. Egg */
.pet.egg { width: 50px; height: 60px; }
.pet.egg .body { width: 100%; height: 100%; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background-color: #fff; animation: pulse 2s infinite alternate;}
.pet.egg .face, .pet.egg .legs { display: none; }

/* 2. Baby */
.pet.baby { width: 60px; height: 50px; }
.pet.baby .body { width: 100%; height: 100%; border-radius: 50%; background-color: #ff99cc; animation: idleBounce 1s infinite ease-in-out;}
.pet.baby .legs { display: none; }
.pet.baby .mouth { border: 4px solid var(--pet-border); border-radius: 50%; width: 6px; height: 6px; }

/* 3. Child */
.pet.child { width: 70px; height: 60px; }
.pet.child .body { width: 100%; height: 100%; border-radius: 30px; background-color: #ffff66; animation: idleBounce 1.5s infinite ease-in-out;}
.pet.child .mouth { width: 10px; border-radius: 0 0 10px 10px; }

/* 4. Teen */
.pet.teen { width: 60px; height: 80px; }
.pet.teen .body { width: 100%; height: 100%; border-radius: 40px 40px 10px 10px; background-color: #66ccff; animation: idleBounce 2s infinite ease-in-out;}

/* 5. Adult - Good (Mametchi vibe) */
.pet.adult-good { width: 80px; height: 75px; }
.pet.adult-good .body { width: 100%; height: 100%; border-radius: 40px; background-color: #ffcc00; animation: idleBounce 2s infinite ease-in-out;}

/* 6. Adult - Bad / Neglected */
.pet.adult-bad { width: 90px; height: 60px; }
.pet.adult-bad .body { width: 100%; height: 100%; border-radius: 10px; background-color: #999966; animation: idleBounce 3s infinite ease-in-out;}
.pet.adult-bad .mouth { transform: rotate(180deg); margin-top: 10px; } /* sad mouth */

/* 7. Dead */
.pet.dead { cursor: pointer; opacity: 0.8; }
.pet.dead .body { background-color: #ccc; animation: none; transform: rotate(90deg) translateX(20px); border-color: #999;}
.pet.dead .flower { display: block; position: absolute; font-size: 30px; top: -30px; }
.pet.dead .eye { height: 2px; top: 5px; animation: none;}
.pet.dead .mouth { border-radius: 0; border-top: 4px solid #000; width: 10px; }
.pet.dead .legs { display: none; }

/* Elements */
.skull-icon {
    position: absolute;
    top: -25px;
    right: -15px;
    font-size: 24px;
    animation: float 2s infinite alternate;
}
.skull-icon.hidden { display: none; }

.poop-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10%;
    pointer-events: none;
    z-index: 50;
}

.poop {
    position: absolute;
    width: 25px;
    height: 20px;
    background-color: #7b5e43;
    border: 3px solid #3c2a1c;
    border-radius: 20px 20px 5px 5px;
    bottom: 0;
}
.poop::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 5px;
    width: 10px;
    height: 10px;
    background-color: #7b5e43;
    border: 3px solid #3c2a1c;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
}

@keyframes float { 0% { transform: translateY(0); } 100% { transform: translateY(-5px); } }
@keyframes flash { 0% { background-color: red; } 100% { background-color: darkred; } }
@keyframes pulse { 0% { transform: scale(1); } 100% { transform: scale(1.05); } }
@keyframes idleBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes swing { 0%, 100% { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } }
@keyframes wigglebody { 0% { transform: rotate(-5deg); } 100% { transform: rotate(5deg); } }
@keyframes blink { 0%, 96%, 98% { height: 12px; top: 0; } 97% { height: 2px; top: 5px; } }

.pet.picked-up .leg { animation: swing 0.12s infinite ease-in-out; }
.pet.picked-up .body { animation: wigglebody 0.3s infinite alternate ease-in-out; }

/* Speech bubble */
.speech-bubble {
    position: absolute;
    top: -40px;
    background: #fff;
    border: 3px solid #000;
    color: #000;
    padding: 5px 10px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
    font-size: 10px;
    white-space: nowrap;
    z-index: 1000;
    transform: translateY(10px);
    transition: transform 0.2s, opacity 0.2s;
}
