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

/* Utility helpers */
.hidden {
    display: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a5f7a 0%, #2e8b9e 50%, #57b8c5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Screen Management */
.screen {
    width: 100%;
    max-width: 900px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex-direction: column;
    overflow-y: auto;
}

.screen.hidden {
    display: none;
}

/* Intro Screen */
.intro-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.6s ease;
}

.intro-content h1 {
    font-size: 3rem;
    color: #1e3c72;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.story {
    margin: 30px 0;
    color: #333;
    line-height: 2;
}

.story p {
    margin: 10px 0;
    font-size: 1.1rem;
}

/* Game Screen */
#game-screen {
    flex-direction: column;
    padding: 10px;
    max-width: 100%;
    overflow: visible;
}

/* Game Info Bar */
.game-info {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.label {
    font-weight: bold;
    color: #1e3c72;
    font-size: 1.1rem;
}

.value {
    font-size: 1.3rem;
    color: #e74c3c;
    font-weight: bold;
}

/* Game Canvas */
#game-canvas {
    width: 800px;
    height: 600px;
    background: linear-gradient(180deg, #0d4f6e 0%, #1976a0 30%, #2596be 70%, #3ab0d4 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#game-canvas::after {
    display: none;
}

/* Player */
.player {
    position: absolute;
    font-size: 3rem;
    transition: all 0.1s ease;
    z-index: 10;
}

/* Enemy */
.enemy {
    position: absolute;
    font-size: 2.5rem;
    animation: enemyFloat 2s ease-in-out infinite;
    z-index: 5;
}

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

/* Level Complete Message */
.message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.message-overlay.hidden {
    display: none;
}

.message-content {
    background: white;
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    animation: popIn 0.4s ease;
}

.message-content h2 {
    color: #1e3c72;
    font-size: 2.5rem;
    margin-bottom: 15px;
}

/* Sea Snake Animation */
@keyframes snakeWiggle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(5deg);
    }
    75% {
        transform: translateY(-3px) rotate(-5deg);
    }
}

/* Win Screen */
.win-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.6s ease;
    width: 100%;
    max-width: 700px;
}

.win-content h1 {
    font-size: 3.5rem;
    color: #27ae60;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Fishbowl animation */
.fishbowl {
    width: 200px;
    height: 200px;
    margin: 30px auto;
    background: linear-gradient(180deg, rgba(100, 200, 255, 0.3) 0%, rgba(100, 200, 255, 0.6) 100%);
    border: 5px solid #4a90e2;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(100, 200, 255, 0.5);
}

.fish-home {
    position: absolute;
    font-size: 3rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: fishSwim 3s ease-in-out infinite;
}

@keyframes fishSwim {
    0%, 100% {
        transform: translate(-50%, -50%) translateX(0);
    }
    50% {
        transform: translate(-50%, -50%) translateX(20px);
    }
}

.bubbles {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.bubbles span {
    display: inline-block;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    animation: bubbleRise 2s ease-in-out infinite;
    margin: 0 5px;
}

.bubbles span:nth-child(1) {
    animation-delay: 0s;
}

.bubbles span:nth-child(2) {
    animation-delay: 0.7s;
}

.bubbles span:nth-child(3) {
    animation-delay: 1.4s;
}

@keyframes bubbleRise {
    0% {
        opacity: 0.6;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px);
    }
}

.big-message {
    font-size: 1.5rem;
    color: #333;
    margin: 20px 0;
}

.score-big {
    font-size: 3rem;
    color: #e74c3c;
    font-weight: bold;
}

.celebration {
    font-size: 3rem;
    margin: 30px 0;
    animation: bounce 1s infinite;
}

/* Game Over Screen */
.gameover-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.6s ease;
}

.gameover-content h1 {
    font-size: 3.5rem;
    color: #e74c3c;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.game-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3rem;
    border-radius: 30px;
    cursor: pointer;
    margin: 20px 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    font-weight: bold;
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.game-button:active {
    transform: translateY(0);
}

/* Back Link */
.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #667eea;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #764ba2;
    transform: translateX(-5px);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Responsive Design */
@media (max-width: 850px) {
    #game-canvas {
        width: 100%;
        max-width: 600px;
        height: 450px;
    }
    
    .intro-content h1,
    .win-content h1,
    .gameover-content h1 {
        font-size: 2rem;
    }
    
    .player {
        font-size: 2rem;
    }
    
    .enemy {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    #game-canvas {
        height: 400px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .intro-content,
    .win-content,
    .gameover-content {
        padding: 30px 20px;
    }
}
