/* ============================================
   CAPYBARA & FRIENDS — Virtual Pet Styles
   ============================================ */

body {
    background: linear-gradient(180deg, #87CEEB 0%, #B5E8D5 50%, #E8F5E9 100%);
    min-height: 100vh;
}

.pet-game {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 60px;
}

.pet-title {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--capy-dark);
    margin-bottom: 20px;
}

/* --- Status Bars --- */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 15px var(--card-shadow);
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.status-info {
    flex: 1;
    min-width: 0;
}

.status-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.bar-track {
    width: 100%;
    height: 10px;
    background: #E0E0E0;
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

.bar-fill.happiness { background: linear-gradient(90deg, #FFD54F, #FFC107); }
.bar-fill.hunger { background: linear-gradient(90deg, #81C784, #4CAF50); }
.bar-fill.energy { background: linear-gradient(90deg, #64B5F6, #2196F3); }
.bar-fill.cleanliness { background: linear-gradient(90deg, #CE93D8, #9C27B0); }

/* Low stat warning colors */
.bar-fill.low { background: linear-gradient(90deg, #EF5350, #F44336) !important; }
.bar-fill.medium { background: linear-gradient(90deg, #FFA726, #FF9800) !important; }

.status-value {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--capy-dark);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* --- Pet Scene --- */
.pet-scene {
    position: relative;
    height: 260px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.4),
        0 8px 30px rgba(0, 0, 0, 0.15);
}

.scene-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #87CEEB 0%, #B5E8D5 60%, #7DB86A 85%, #6BA85A 100%);
    transition: background 2s ease;
}

.scene-bg.night {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 40%, #0f3460 70%, #1a3a2a 100%);
}

.scene-bg.evening {
    background: linear-gradient(180deg, #FF6B6B 0%, #FFB347 30%, #B5E8D5 70%, #6BA85A 100%);
}

.sun {
    position: absolute;
    top: 15px;
    right: 30px;
    font-size: 2.5rem;
    transition: all 2s ease;
    animation: float 6s ease-in-out infinite;
}

.cloud {
    position: absolute;
    font-size: 2rem;
    opacity: 0.7;
}

.cloud-1 {
    top: 20px;
    left: 10%;
    animation: cloudDrift 20s linear infinite;
}

.cloud-2 {
    top: 45px;
    left: 60%;
    animation: cloudDrift 25s linear infinite reverse;
}

@keyframes cloudDrift {
    0% { transform: translateX(-100px); }
    100% { transform: translateX(calc(100vw + 100px)); }
}

.pet-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
}

.pet-capybara {
    position: relative;
    z-index: 5;
}

.capy-sprite {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.capy-sprite:hover {
    transform: scale(1.05);
}

.capy-sprite:active {
    transform: scale(0.95);
}

.capy-mood {
    position: absolute;
    top: -10px;
    right: -25px;
    font-size: 1.5rem;
    animation: float 2s ease-in-out infinite;
}

.thought-bubble {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: white;
    border-radius: 16px;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
}

.thought-bubble.visible {
    opacity: 1;
}

.thought-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
}

/* ============================================
   CSS CAPYBARA CHARACTER — Pet Game
   ============================================ */

.capy-character {
    position: relative;
    width: 120px;
    height: 100px;
    margin: 0 auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

/* --- Body --- */
.pc-body {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 52px;
    background: #8B6914;
    border-radius: 48px 48px 40px 40px;
    z-index: 2;
}

.pc-body::after {
    /* Belly highlight */
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 28px;
    background: #9E7B20;
    border-radius: 30px;
    opacity: 0.5;
}

.pc-tail {
    position: absolute;
    right: -8px;
    bottom: 8px;
    width: 16px;
    height: 10px;
    background: #7A5C10;
    border-radius: 8px;
    transform: rotate(-15deg);
}

/* --- Head --- */
.pc-head {
    position: absolute;
    bottom: 48px;
    left: 10px;
    width: 58px;
    height: 48px;
    background: #8B6914;
    border-radius: 30px 32px 24px 26px;
    z-index: 3;
}

/* --- Ears --- */
.pc-ear {
    position: absolute;
    top: -4px;
    width: 14px;
    height: 10px;
    background: #5C4A1E;
    border-radius: 50% 50% 30% 30%;
    z-index: 4;
}

.pc-ear-left {
    left: 8px;
    transform: rotate(-12deg);
}

.pc-ear-right {
    right: 8px;
    transform: rotate(12deg);
}

/* --- Eyes --- */
.pc-eye {
    position: absolute;
    top: 14px;
    width: 12px;
    height: 14px;
    background: #3D2B0F;
    border-radius: 50%;
    z-index: 5;
    transition: all 0.3s ease;
}

.pc-eye-left {
    left: 10px;
}

.pc-eye-right {
    right: 10px;
}

.pc-pupil {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
}

/* Happy eyes (squint) */
.capy-character.happy .pc-eye {
    height: 5px;
    top: 18px;
    border-radius: 5px 5px 0 0;
}

.capy-character.happy .pc-pupil {
    display: none;
}

/* Sleepy eyes */
.capy-character.sleepy .pc-eye {
    height: 3px;
    top: 20px;
    border-radius: 3px;
}

.capy-character.sleepy .pc-pupil {
    display: none;
}

/* --- Nose --- */
.pc-nose {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 12px;
    background: #3D2B0F;
    border-radius: 50%;
    z-index: 5;
}

/* Nose nostrils */
.pc-nose::before,
.pc-nose::after {
    content: '';
    position: absolute;
    top: 3px;
    width: 4px;
    height: 4px;
    background: #2A1D08;
    border-radius: 50%;
}

.pc-nose::before { left: 3px; }
.pc-nose::after { right: 3px; }

/* --- Mouth --- */
.pc-mouth {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    border-bottom: 2px solid #5C4A1E;
    border-radius: 0 0 50% 50%;
    z-index: 5;
}

/* --- Cheeks (blush) --- */
.pc-cheek {
    position: absolute;
    bottom: 12px;
    width: 10px;
    height: 6px;
    background: rgba(255, 150, 100, 0.35);
    border-radius: 50%;
    z-index: 5;
}

.pc-cheek-left { left: 2px; }
.pc-cheek-right { right: 2px; }

/* --- Legs --- */
.pc-leg {
    position: absolute;
    bottom: 4px;
    width: 14px;
    height: 18px;
    background: #7A5C10;
    border-radius: 6px 6px 8px 8px;
    z-index: 1;
}

.pc-leg-fl { left: 24px; }
.pc-leg-fr { left: 38px; }
.pc-leg-bl { right: 24px; }
.pc-leg-br { right: 38px; }

/* Tiny feet */
.pc-leg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 5px;
    background: #6B4E0D;
    border-radius: 0 0 8px 8px;
}

/* ============================================
   CAPYBARA ANIMATIONS — Pet Game
   ============================================ */

/* Bounce (pet, gift, general happy) */
.capy-character.bounce {
    animation: petBounce 0.5s ease;
}

/* Sleep */
.capy-character.sleep {
    animation: petSleep 2s ease-in-out infinite;
}

.capy-character.sleep .pc-eye {
    height: 3px;
    top: 20px;
    border-radius: 3px;
}

.capy-character.sleep .pc-pupil {
    display: none;
}

/* Eat */
.capy-character.eat {
    animation: petEat 0.4s ease 3;
}

.capy-character.eat .pc-eye {
    height: 5px;
    top: 18px;
    border-radius: 5px 5px 0 0;
}

.capy-character.eat .pc-pupil {
    display: none;
}

/* Play */
.capy-character.play {
    animation: petPlay 0.3s ease 4;
}

/* Bathe */
.capy-character.bathe {
    animation: petBathe 0.6s ease 3;
}

@keyframes petBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes petSleep {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(3px) rotate(2deg); }
}

@keyframes petEat {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg) translateY(-3px); }
    75% { transform: rotate(5deg) translateY(-3px); }
}

@keyframes petPlay {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px) rotate(10deg); }
}

@keyframes petBathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px) scale(1.05); }
}

/* --- Friends in scene --- */
.friends-area {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
}

.scene-friend {
    position: absolute;
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
    transition: all 1s ease;
}

/* --- Effects layer --- */
.effects-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.floating-effect {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    animation: effectFloat 1.5s ease-out forwards;
}

@keyframes effectFloat {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(0.5); opacity: 0; }
}

/* --- Action Buttons --- */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px var(--card-shadow);
    font-family: var(--font-main);
}

.action-btn:hover {
    transform: translateY(-3px);
    border-color: var(--orange-accent);
    box-shadow: 0 4px 15px var(--card-shadow);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.cooldown {
    opacity: 0.5;
    pointer-events: none;
}

.action-icon {
    font-size: 1.8rem;
}

.action-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* --- Friends Panel --- */
.friends-panel {
    padding: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 15px var(--card-shadow);
    margin-bottom: 20px;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--capy-dark);
    margin-bottom: 12px;
    text-align: center;
}

.friends-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.friend-badge {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: var(--warm-cream);
    border-radius: var(--radius-md);
    border: 2px solid var(--capy-light);
    transition: all 0.3s ease;
}

.friend-badge.locked {
    filter: grayscale(1);
    opacity: 0.3;
    border-color: #ccc;
}

.friend-badge.unlocked {
    animation: pulse 2s ease-in-out infinite;
}

/* --- Pet Info Footer --- */
.pet-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .pet-game {
        padding: 15px;
        padding-top: 55px;
    }

    .pet-scene {
        height: 220px;
    }

    .capy-character {
        transform: scale(0.85);
    }

    .actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}
