/* 🐱 Cat Territory - Styles */

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

:root {
    --primary: #FF6B9D;
    --primary-dark: #E85A8A;
    --secondary: #7C3AED;
    --accent: #FFD93D;
    --bg-light: #FFF5F8;
    --bg-dark: #1a1a2e;
    --text: #333;
    --text-light: #666;
    --success: #4ADE80;
    --danger: #F87171;
    --white: #fff;
    --shadow: 0 4px 20px rgba(255, 107, 157, 0.3);
}

html {
    background: linear-gradient(135deg, #FFF5F8 0%, #F0E6FF 100%);
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

body {
    font-family: 'Jua', sans-serif;
    background: linear-gradient(135deg, #FFF5F8 0%, #F0E6FF 100%);
    min-height: 100vh;
    overflow: hidden;
    color: var(--text);
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s, transform 0.3s;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* Start Screen */
#start-screen {
    padding: 20px;
    gap: 20px;
}

.title-container {
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.title-container h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    color: var(--primary);
    text-shadow: 3px 3px 0 var(--accent), 
                 6px 6px 0 rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--text-light);
}

/* Cat Selection */
.cat-select {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 600px;
}

.cat-select > p {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--primary);
}

.cat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.cat-btn {
    background: var(--bg-light);
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
}

.cat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.cat-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #FFF0F5, #FFE4ED);
}

.cat-emoji {
    font-size: 2rem;
}

.cat-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text);
}

.cat-skill {
    font-size: 0.75rem;
    color: var(--secondary);
}

/* Buttons */
.main-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: 50px;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
    transition: all 0.2s;
    animation: pulse 2s ease-in-out infinite;
}

.main-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.5);
}

.main-btn:active {
    transform: translateY(0) scale(0.98);
}

.sub-btn {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-btn:hover {
    background: var(--bg-light);
}

/* How to Play */
.how-to-play {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 400px;
}

.how-to-play h3 {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 10px;
}

.how-to-play ul {
    list-style: none;
}

.how-to-play li {
    padding: 5px 0;
    font-size: 0.95rem;
    color: var(--text-light);
}

/* Game Screen */
#game-screen {
    background: #2a2a4a;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Game UI */
#game-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.ui-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
}

.timer {
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
}

.score-board {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.my-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: var(--white);
}

.score-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

#my-score {
    font-size: 1.5rem;
    color: var(--accent);
}

/* Skill Indicator */
.skill-indicator {
    position: fixed;
    bottom: 100px;
    left: 20px;
    pointer-events: auto;
}

#skill-btn {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#skill-btn:hover {
    transform: scale(1.05);
}

#skill-btn.skill-ready {
    box-shadow: 0 0 20px var(--accent);
}

#skill-btn.on-cooldown {
    opacity: 0.6;
}

#skill-icon {
    font-size: 1.8rem;
}

#skill-name {
    font-size: 0.8rem;
    color: var(--white);
}

#skill-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--accent);
    width: 100%;
    transition: width 0.1s linear;
}

/* Meow Popup */
.meow-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    color: var(--primary);
    padding: 20px 40px;
    border-radius: 30px;
    font-size: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: meowPop 0.5s ease-out;
    z-index: 100;
}

.meow-popup.hidden {
    display: none;
}

@keyframes meowPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Mobile Controls */
.mobile-only {
    display: none;
}

@media (max-width: 768px), (pointer: coarse) {
    .mobile-only {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        gap: 10px;
        z-index: 20;
        flex-direction: column;
    }
    
    .skill-indicator {
        bottom: 120px !important;
    }
}

.mobile-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mobile-btn:active {
    transform: scale(0.9);
    background: var(--primary);
}

/* Result Screen */
#result-screen {
    background: linear-gradient(135deg, #FFF5F8 0%, #F0E6FF 100%);
}

.result-container {
    background: var(--white);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: popIn 0.5s ease-out;
    max-width: 90%;
    width: 400px;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#result-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.result-cat {
    font-size: 5rem;
    margin: 20px 0;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.stat-value {
    font-size: 1.5rem;
    color: var(--secondary);
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Leaderboard in-game */
.leaderboard {
    position: fixed;
    top: 80px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 15px;
    min-width: 150px;
    backdrop-filter: blur(10px);
}

.leaderboard-title {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-align: center;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    color: var(--white);
    padding: 5px 0;
    font-size: 0.85rem;
}

.leaderboard-item.me {
    color: var(--accent);
    font-weight: bold;
}

/* Responsive */
@media (max-width: 600px) {
    .title-container h1 {
        font-size: 2rem;
    }
    
    .cat-btn {
        min-width: 60px;
        padding: 8px 10px;
    }
    
    .cat-emoji {
        font-size: 1.5rem;
    }
    
    .how-to-play {
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .how-to-play li {
        font-size: 0.85rem;
    }
    
    .result-container {
        padding: 25px;
    }
    
    .result-cat {
        font-size: 4rem;
    }
    
    .timer {
        padding: 8px 20px;
        font-size: 1.2rem;
    }
    
    .score-board {
        padding: 8px 15px;
    }
    
    #my-score {
        font-size: 1.2rem;
    }
    
    #skill-btn {
        padding: 12px 15px;
    }
    
    #skill-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 375px) {
    .title-container h1 {
        font-size: 1.6rem;
    }

    .cat-btn {
        min-width: 50px;
        padding: 6px 8px;
    }

    .cat-emoji {
        font-size: 1.3rem;
    }

    .cat-name {
        font-size: 0.75rem;
    }

    .cat-skill {
        font-size: 0.65rem;
    }

    .main-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }

    .how-to-play {
        padding: 12px;
    }

    .how-to-play li {
        font-size: 0.8rem;
    }

    .result-container {
        padding: 20px;
    }

    .result-cat {
        font-size: 3rem;
    }

    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
