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

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px 15px;
    color: #333;
}

h1 {
    text-align: center;
    margin: 20px 0 40px;
    font-size: 2.8rem;
    color: #4a4a8c;
    text-shadow: 2px 2px 6px rgba(74, 74, 140, 0.15);
    letter-spacing: -1px;
}

.create-pet {
    max-width: 520px;
    margin: 0 auto 50px;
    padding: 28px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.create-pet input[type="text"],
.create-pet select {
    padding: 14px 18px;
    font-size: 1.05rem;
    border: 2px solid #e0e0ff;
    border-radius: 12px;
    min-width: 180px;
    outline: none;
    transition: all 0.2s;
}

.create-pet input[type="text"]:focus,
.create-pet select:focus {
    border-color: #7b68ee;
    box-shadow: 0 0 0 4px rgba(123, 104, 238, 0.15);
}

.create-pet button {
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

#createPetBtn {
    background: #7b68ee;
    color: white;
}

#createPetBtn:hover {
    background: #6651d9;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 104, 238, 0.3);
}

#randomNameBtn {
    background: #64c4a3;
    color: white;
}

#randomNameBtn:hover {
    background: #52b08f;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(100, 196, 163, 0.3);
}

#petsContainer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
}

.pet-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 420px;
    margin: 0 10px 10px;
    padding: 32px 28px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 1px solid #f0f0ff;
    transition: transform 0.25s ease;
}

.pet-card h2 {
    font-size: 2.1rem;
    margin-bottom: 20px;
    color: #3d3d8f;
    font-weight: 700;
}

.pet-card p {
    font-size: 1.2rem;
    margin-top: 14px;
    margin-bottom: 4px;
    font-weight: 600;
    color: #4a4a8c;
}

.progress {
    width: 100%;
    height: 14px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.bar.energy {
    background: linear-gradient(to right, #ff9f1c, #ffbf69);
}

.bar.fullness {
    background: linear-gradient(to right, #2ecc71, #6ee7b7);
}

.bar.happiness {
    background: linear-gradient(to right, #ff4d6d, #ff8fab);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.actions button {
    padding: 16px 32px;
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.22s;
    min-width: 120px;
}

.napBtn {
    background: linear-gradient(to right, #ff9f1c, #ffbf69);
    color: white;
}

.playBtn {
    background: linear-gradient(to right, #ff4d6d, #ff8fab);
    color: white;
}

.eatBtn {
    background: linear-gradient(to right, #2ecc71, #6ee7b7);
    color: white;
}

.deleteBtn {
    padding: 10px;
    max-width: 50px;
    font-size: larger;
    text-align: center;
    background: linear-gradient(to right, #f90b02f8, #820000);
    border-radius: 25px;
}

.actions button:hover {
    transform: translateY(-3px);
}

.petImage {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin: 10px auto 30px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
}

h3 {
    text-align: center;
    margin: 40px 0 20px;
    color: #4a4a8c;
}

#log {
    max-width: 580px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    padding: 24px;
    min-height: 140px;
    max-height: 360px;
    overflow-y: auto;
    border: 1px dashed #d0d0ff;
}

#log p {
    margin: 6px 0;
    padding-left: 10px;
    border-left: 4px solid #a29bfe;
}

.pet-card.spawn {
    animation: spawnPop 0.45s ease;
}

@keyframes spawnPop {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    60% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.pet-card.dying {
    animation: fadeOutDown 1s ease forwards;
}

@keyframes fadeOutDown {
    to {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
}
