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

body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: backgroundFloat 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(1deg); }
    66% { transform: translateY(10px) rotate(-1deg); }
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    animation: titlePulse 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2rem;
    color: #f0f0f0;
    font-weight: 300;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.5s forwards;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Cat Container */
.cat-container {
    position: relative;
    margin: 2rem 0;
    animation: slideInUp 1s ease-out 0.8s both;
}

.cat {
    cursor: pointer;
    transition: all 0.3s ease;
}

.cat:hover {
    transform: scale(1.05);
}

/* Cat Body */
.cat-body {
    position: relative;
    width: 200px;
    height: 180px;
}

/* Cat Head */
.cat-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 100px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 50px 50px 40px 40px;
    animation: catBreathe 3s ease-in-out infinite;
}

/* Cat Ears */
.cat-ears {
    position: absolute;
    top: -15px;
    width: 100%;
    height: 30px;
}

.ear {
    position: absolute;
    width: 25px;
    height: 30px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 15px 15px 0 0;
    animation: earTwitch 4s ease-in-out infinite;
}

.left-ear {
    left: 15px;
    transform: rotate(-20deg);
}

.right-ear {
    right: 15px;
    transform: rotate(20deg);
}

.ear::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 18px;
    background: #ff6b9d;
    border-radius: 10px 10px 0 0;
}

/* Cat Face */
.cat-face {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Eyes */
.eyes {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.eye {
    width: 20px;
    height: 15px;
    background: #333;
    border-radius: 50%;
    position: relative;
    animation: blink 3s ease-in-out infinite;
}

.pupil {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #4ecdc4;
    border-radius: 50%;
    animation: eyeShine 2s ease-in-out infinite;
}

/* Nose */
.nose {
    width: 8px;
    height: 6px;
    background: #ff6b9d;
    border-radius: 50%;
    margin-top: 5px;
    animation: noseWiggle 2s ease-in-out infinite;
}

/* Mouth */
.mouth {
    margin-top: 5px;
    position: relative;
}

.mouth-curve {
    position: absolute;
    width: 12px;
    height: 8px;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 12px 12px;
}

.left-curve {
    left: -8px;
}

.right-curve {
    right: -8px;
}

/* Whiskers */
.whiskers {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 2px;
}

.whisker {
    position: absolute;
    width: 30px;
    height: 2px;
    background: #333;
    border-radius: 1px;
    animation: whiskerMove 3s ease-in-out infinite;
}

.whisker-1 { left: -35px; top: -10px; transform: rotate(-10deg); }
.whisker-2 { left: -35px; top: -2px; transform: rotate(-5deg); }
.whisker-3 { left: -35px; top: 6px; transform: rotate(-15deg); }
.whisker-4 { right: -35px; top: -10px; transform: rotate(10deg); }
.whisker-5 { right: -35px; top: -2px; transform: rotate(5deg); }
.whisker-6 { right: -35px; top: 6px; transform: rotate(15deg); }

/* Cat Torso */
.cat-torso {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 80px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 30px;
    animation: catBreathe 3s ease-in-out infinite;
}

/* Cat Tail */
.cat-tail {
    position: absolute;
    top: 100px;
    right: -20px;
    width: 60px;
    height: 8px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 4px;
    transform-origin: left center;
    animation: tailWag 2s ease-in-out infinite;
}

.cat-tail::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -2px;
    width: 20px;
    height: 12px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 50%;
}

/* Hearts Animation */
.hearts {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
}

.heart {
    position: absolute;
    width: 20px;
    height: 20px;
    opacity: 0;
    animation: heartFloat 2s ease-out forwards;
}

.heart::before,
.heart::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 16px;
    background: #ff6b9d;
    border-radius: 10px 10px 0 0;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
}

.heart::after {
    left: 8px;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
}

/* Paw Prints */
.paw-prints {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.paw-print {
    position: absolute;
    width: 15px;
    height: 15px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0;
    animation: pawPrintFade 1s ease-out forwards;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: slideInUp 1s ease-out 1.2s both;
}

.pet-button {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pet-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(78, 205, 196, 0.4);
}

.pet-button:active {
    transform: translateY(-1px);
    animation: buttonPulse 0.3s ease;
}

.pet-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.pet-button:hover::before {
    left: 100%;
}

.button-icon {
    animation: handWave 2s ease-in-out infinite;
}

.pet-counter {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: white;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.session-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.current-session,
.personal-best {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 0.3rem 0.8rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.personal-best {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* High Scores Panel */
.high-scores {
    margin-top: 1.5rem;
    max-width: 400px;
    width: 100%;
}

.toggle-scores {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 25px;
    padding: 0.8rem 1.5rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(240, 147, 251, 0.3);
    font-size: 1rem;
}

.toggle-scores:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.4);
}

.scores-content {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s ease;
}

.scores-content.show {
    max-height: 500px;
    opacity: 1;
}

.scores-content h3 {
    color: white;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.scores-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    transition: all 0.3s ease;
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.score-item.current-user {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.score-rank {
    font-weight: 700;
    min-width: 30px;
}

.score-name {
    flex: 1;
    text-align: left;
    margin-left: 0.5rem;
    font-weight: 600;
}

.score-value {
    font-weight: 700;
    color: #ffd700;
}

.score-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 0.5rem;
}

.name-input-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.name-input-section input {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    outline: none;
}

.name-input-section input:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.name-input-section button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.name-input-section button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(78, 205, 196, 0.3);
}

.name-input-section button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.total-stats {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.total-stats span {
    color: #ffd700;
    font-weight: 700;
}

/* Message */
.message {
    min-height: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    animation: slideInUp 1s ease-out 1.5s both;
}

.message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
.footer {
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    animation: fadeIn 1s ease-out 1.8s both;
}

/* Animation Keyframes */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes catBreathe {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.02); }
}

@keyframes earTwitch {
    0%, 95%, 100% { transform: rotate(var(--rotation, 0deg)); }
    97% { transform: rotate(calc(var(--rotation, 0deg) + 5deg)); }
}

@keyframes blink {
    0%, 90%, 100% { height: 15px; }
    95% { height: 2px; }
}

@keyframes eyeShine {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes noseWiggle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes whiskerMove {
    0%, 100% { transform: rotate(var(--whisker-rotation)) scaleX(1); }
    50% { transform: rotate(var(--whisker-rotation)) scaleX(1.1); }
}

@keyframes tailWag {
    0%, 100% { transform: rotate(10deg); }
    50% { transform: rotate(-5deg); }
}

@keyframes heartFloat {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    20% {
        opacity: 1;
        transform: translateY(-10px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.5);
    }
}

@keyframes pawPrintFade {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 0.7;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.2);
    }
}

@keyframes buttonPulse {
    0% { transform: translateY(-1px) scale(1); }
    50% { transform: translateY(-1px) scale(1.05); }
    100% { transform: translateY(-1px) scale(1); }
}

@keyframes handWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Cat States */
.cat.petted {
    animation: catJoy 0.6s ease-out;
}

.cat.purring .cat-body {
    animation: purr 0.1s ease-in-out infinite;
}

@keyframes catJoy {
    0% { transform: scale(1); }
    25% { transform: scale(1.1) rotate(-2deg); }
    50% { transform: scale(1.15) rotate(2deg); }
    75% { transform: scale(1.1) rotate(-1deg); }
    100% { transform: scale(1.05); }
}

@keyframes purr {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(1px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .cat-body {
        width: 160px;
        height: 144px;
    }
    
    .cat-head {
        width: 96px;
        height: 80px;
    }
    
    .cat-torso {
        width: 80px;
        height: 64px;
        top: 56px;
    }
    
    .pet-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .session-stats {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .high-scores {
        margin-top: 1rem;
    }
    
    .scores-content {
        padding: 1rem;
    }
    
    .name-input-section {
        flex-direction: column;
    }
    
    .name-input-section input {
        min-width: auto;
    }
}