/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #001a33;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Ocean Background */
.ocean-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, 
        #1a4d8d 0%, 
        #2666b8 20%, 
        #3399ff 40%, 
        #66b3ff 60%, 
        #99ccff 80%, 
        #ccddff 100%);
    opacity: 0.9;
}

.ocean-bg.animated {
    animation: ocean-wave 10s ease-in-out infinite;
}

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

.ocean-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

/* Content Container */
.content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Menu Screen */
.menu-screen {
    text-align: center;
}

.game-title {
    font-size: clamp(2.5rem, 8vw, 4rem);
    color: #fff;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 182, 193, 0.5);
    margin-bottom: 10px;
    animation: title-float 3s ease-in-out infinite;
}

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

.title-icon {
    display: inline-block;
    animation: icon-spin 4s ease-in-out infinite;
}

@keyframes icon-spin {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #ffccdd;
    margin-bottom: 40px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

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

.btn-primary {
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff8fb2 0%, #d6678a 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #8095f0 0%, #9369bd 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
}

/* Difficulty Selector */
.difficulty-selector {
    margin-top: 30px;
    color: #fff;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

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

.diff-btn {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.diff-btn.active {
    background: rgba(255, 182, 193, 0.3);
    border-color: #ffb6c1;
    transform: scale(1.05);
}

/* High Score */
.high-score {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.high-score-icon {
    font-size: 1.5rem;
    animation: trophy-shine 2s ease-in-out infinite;
}

@keyframes trophy-shine {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

/* Tutorial Screen */
.tutorial-screen .content {
    max-width: 800px;
    overflow-y: auto;
    padding: 40px 20px;
}

.tutorial-screen h2 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.tutorial-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.tutorial-section {
    margin-bottom: 30px;
}

.tutorial-section:last-child {
    margin-bottom: 0;
}

.tutorial-section h3 {
    color: #ffccdd;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.control-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
}

.control-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.control-item p {
    color: #fff;
    font-size: 0.9rem;
}

.objectives-list {
    list-style: none;
    color: #fff;
}

.objectives-list li {
    margin-bottom: 10px;
    padding-left: 30px;
    position: relative;
}

.objectives-list li::before {
    content: attr(data-emoji);
    position: absolute;
    left: 0;
}

.powerup-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.powerup-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
}

.powerup-item span {
    font-size: 2rem;
    display: block;
    margin-bottom: 5px;
}

.powerup-item p {
    color: #fff;
    font-size: 0.85rem;
}

/* Game Screen */
.game-screen {
    flex-direction: column;
}

/* Game HUD */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-icon {
    font-size: 1.2rem;
}

.hud-value {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.hud-label {
    color: #ffccdd;
    font-size: 0.8rem;
    font-weight: 600;
}

.combo-display {
    flex-direction: column;
    gap: 2px;
}

.combo-value {
    color: #ffd700;
    font-size: 1.3rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.pause-btn-container {
    pointer-events: auto;
}

.pause-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

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

/* HUD Bottom */
.hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
    gap: 15px;
}

.health-bar {
    flex: 0 0 auto;
}

.health-icons {
    display: flex;
    gap: 5px;
}

.health-heart {
    font-size: 1.8rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.health-heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.8);
}

.hunger-meter {
    flex: 1;
    max-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hunger-bar {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hunger-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ffd93d 100%);
    transition: width 0.3s ease;
    width: 100%;
}

.hunger-icon {
    font-size: 1.5rem;
}

.level-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-label {
    color: #ffccdd;
    font-size: 0.9rem;
    font-weight: 600;
}

.level-value {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Game Canvas */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* Touch Overlay */
.touch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    touch-action: none;
}

/* Effects Layer */
.effects-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.effect {
    position: absolute;
    font-weight: 700;
    font-size: 1.5rem;
    animation: effect-pop 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes effect-pop {
    0% {
        transform: scale(0) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) translateY(-20px);
    }
    100% {
        transform: scale(1) translateY(-40px);
        opacity: 0;
    }
}

.effect.damage {
    color: #ff4444;
}

.effect.heal {
    color: #44ff44;
}

.effect.score {
    color: #ffdd44;
}

.effect.combo {
    color: #ff44dd;
    font-size: 2rem;
}

/* Pause Screen */
.pause-screen {
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.pause-content h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 30px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Game Over Screen */
.gameover-screen {
    text-align: center;
}

.gameover-title {
    font-size: clamp(2rem, 6vw, 3rem);
    color: #fff;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.gameover-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #fff;
}

.stat-item:last-child {
    margin-bottom: 0;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
}

.gameover-message {
    color: #ffccdd;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .btn {
        min-width: 180px;
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .hud-top {
        padding: 10px 15px;
    }
    
    .hud-item {
        padding: 6px 12px;
    }
    
    .hud-value {
        font-size: 1rem;
    }
    
    .health-heart {
        font-size: 1.5rem;
    }
    
    .hunger-meter {
        max-width: 150px;
    }
    
    .tutorial-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .hud-bottom {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .hunger-meter {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .game-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        margin-bottom: 20px;
    }
    
    .menu-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn {
        min-width: 150px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .hud-top, .hud-bottom {
        padding: 8px 15px;
    }
}