/* Mobile-first with CSS variables */
:root {
    --bg-sky: #87CEEB;
    --bg-grass: #90EE90;
    --color-score: #FFFFFF;
    --color-button: #FF6B6B;
    --color-button-hover: #FF5252;
    --color-button-secondary: #4ECDC4;
    --color-text: #333333;
    --color-text-light: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --transition-speed: 0.3s;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(to bottom, var(--bg-sky) 0%, var(--bg-sky) 70%, var(--bg-grass) 100%);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Screen Management */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen.overlay {
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

/* Start Screen */
#screen-start {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.start-content {
    text-align: center;
    max-width: 320px;
}

.title {
    font-size: 2rem;
    color: var(--color-text);
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 white;
}

.fruit-preview {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 3rem;
    margin-bottom: 30px;
    animation: bounce 2s ease-in-out infinite;
}

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

.high-score-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-text);
    box-shadow: var(--shadow);
}

.high-score-display span:last-child {
    color: var(--color-button);
    font-size: 1.5rem;
    margin-left: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: block;
    width: 100%;
    min-height: 60px;
    padding: 15px 30px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--color-button);
    color: var(--color-text-light);
    box-shadow: var(--shadow);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: var(--color-button-secondary);
    color: var(--color-text-light);
    box-shadow: var(--shadow);
    margin-top: 15px;
}

.btn-secondary:active {
    transform: scale(0.95);
}

.btn-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:active {
    transform: scale(0.9);
}

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

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.score-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-text);
    box-shadow: var(--shadow);
}

.score-display span:last-child {
    color: var(--color-button);
    margin-left: 5px;
}

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

/* Pause Screen */
.pause-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    box-shadow: var(--shadow);
}

.pause-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--color-text);
}

.pause-score {
    font-size: 1.2rem;
    margin-bottom: 25px;
    color: var(--color-text);
}

.pause-score span:last-child {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-button);
    margin-top: 5px;
}

/* Catch Effect */
.catch-effect {
    position: fixed;
    pointer-events: none;
    font-size: 2rem;
    opacity: 0;
    z-index: 50;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

.catch-effect.show {
    opacity: 1;
    animation: catchPop 0.5s ease-out forwards;
}

@keyframes catchPop {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5) translateY(-50px);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .title {
        font-size: 3rem;
    }

    .fruit-preview {
        font-size: 4rem;
    }

    .start-content {
        max-width: 400px;
    }
}

/* Safe area for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .game-header {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}
