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

body {
    background: linear-gradient(135deg, #ffd4a3 0%, #ffcfa3 50%, #ffe4c4 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Quicksand', 'Nunito', sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 960px;
    max-height: 540px;
    background: linear-gradient(180deg, #ffb07c 0%, #ffcfa3 100%);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(255, 228, 196, 0.95) 0%, rgba(255, 228, 196, 0) 100%);
}

#player-stats {
    display: flex;
    gap: 16px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-label {
    color: #5a4a3a;
    font-weight: 700;
    font-size: 13px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
}

.bar-container {
    width: 100px;
    height: 14px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 7px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.bar {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 7px;
}

.hp-bar {
    background: linear-gradient(180deg, #ff8a9b 0%, #ff6b7a 100%);
    box-shadow: 0 0 8px rgba(255, 107, 122, 0.5);
}

.hp-bar::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 4px;
    right: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.mp-bar {
    background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 100%);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

#hp-text, #mp-text {
    color: #5a4a3a;
    font-size: 11px;
    font-weight: 600;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
    min-width: 50px;
}

#score-display, #wave-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

#score-display .label, #wave-display .label {
    color: #8b7355;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
}

#score {
    color: #d97706;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 2px 2px 0 rgba(255,255,255,0.8);
}

#wave {
    color: #dc2626;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 2px 2px 0 rgba(255,255,255,0.8);
}

#combo-display {
    position: absolute;
    top: 45%;
    right: 25px;
    transform: translateY(-50%);
    text-align: center;
    transition: all 0.2s ease;
}

#combo-display.hidden {
    opacity: 0;
    transform: translateY(-50%) scale(0.5);
}

#combo-count {
    display: block;
    font-size: 56px;
    font-weight: 800;
    color: #ff6b9d;
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff;
}

#combo-text {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 0 #ff6b9d;
    letter-spacing: 3px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #ffcfa3 0%, #ffd4a3 50%, #ffe4c4 100%);
    z-index: 100;
}

.screen.hidden {
    display: none;
}

.title-container {
    text-align: center;
    margin-bottom: 25px;
}

.game-title {
    font-size: 58px;
    font-weight: 800;
    color: #4a3728;
    letter-spacing: 8px;
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff;
    animation: titleBounce 3s ease-in-out infinite;
}

.subtitle {
    font-size: 20px;
    color: #8b6b5a;
    letter-spacing: 6px;
    margin-top: 8px;
    text-shadow: 1px 1px 0 #fff;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-8px) rotate(1deg); }
}

.character-preview {
    width: 160px;
    height: 240px;
    margin-bottom: 30px;
    position: relative;
}

.character-silhouette {
    width: 100%;
    height: 100%;
    position: relative;
    animation: characterFloat 3s ease-in-out infinite;
}

.character-silhouette::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 30px;
    background: rgba(0,0,0,0.15);
    border-radius: 50%;
    animation: shadowPulse 3s ease-in-out infinite;
}

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

@keyframes shadowPulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.15; }
    50% { transform: translateX(-50%) scale(0.8); opacity: 0.25; }
}

.menu-btn {
    padding: 14px 50px;
    font-size: 20px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(180deg, #ff8fab 0%, #ff6b9d 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 
        0 6px 0 #e85a85,
        0 8px 20px rgba(255, 107, 157, 0.4);
    letter-spacing: 2px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
    border-radius: 30px 30px 0 0;
}

.menu-btn:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 10px 0 #e85a85,
        0 15px 30px rgba(255, 107, 157, 0.5);
}

.menu-btn:active {
    transform: translateY(2px);
    box-shadow: 
        0 4px 0 #e85a85,
        0 6px 15px rgba(255, 107, 157, 0.3);
}

.menu-btn.secondary {
    margin-top: 12px;
    background: linear-gradient(180deg, #a8a8a8 0%, #888888 100%);
    box-shadow: 
        0 6px 0 #666666,
        0 8px 20px rgba(0, 0, 0, 0.2);
}

.menu-btn.secondary:hover {
    box-shadow: 
        0 10px 0 #666666,
        0 15px 30px rgba(0, 0, 0, 0.3);
}

.menu-btn.secondary:active {
    box-shadow: 
        0 4px 0 #666666,
        0 6px 15px rgba(0, 0, 0, 0.2);
}

.controls-info {
    margin-top: 30px;
    text-align: center;
    color: #8b7355;
}

.controls-info h3 {
    color: #5a4a3a;
    font-size: 16px;
    letter-spacing: 3px;
    margin-bottom: 12px;
}

.controls-info p {
    font-size: 13px;
    margin: 6px 0;
}

.key {
    display: inline-block;
    background: #fff;
    color: #5a4a3a;
    padding: 4px 10px;
    border-radius: 6px;
    margin-right: 8px;
    font-weight: 700;
    min-width: 28px;
    box-shadow: 0 3px 0 #d4c4a8;
}

.game-over-title {
    font-size: 52px;
    font-weight: 800;
    color: #ff6b7a;
    letter-spacing: 6px;
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff;
    margin-bottom: 25px;
    animation: shake 0.6s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-15px); }
    40% { transform: translateX(15px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.final-stats {
    text-align: center;
    color: #5a4a3a;
    font-size: 20px;
    margin-bottom: 30px;
}

.final-stats p {
    margin: 8px 0;
}

.final-stats span {
    color: #d97706;
    font-weight: 700;
}

.pause-title {
    font-size: 46px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 6px;
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff;
    margin-bottom: 30px;
}

#wave-announce {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    text-align: center;
}

#wave-announce.hidden {
    display: none;
}

#wave-text {
    font-size: 52px;
    font-weight: 800;
    color: #5a4a3a;
    letter-spacing: 6px;
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff;
    animation: waveIn 1.5s ease forwards;
}

@keyframes waveIn {
    0% {
        opacity: 0;
        transform: scale(2.5) rotate(-5deg);
    }
    30% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    80% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) rotate(2deg);
    }
}

.hit-effect {
    position: absolute;
    font-size: 26px;
    font-weight: 800;
    color: #ff6b7a;
    text-shadow: 2px 2px 0 #fff;
    pointer-events: none;
    animation: hitFloat 0.5s ease forwards;
    z-index: 100;
}

@keyframes hitFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
}

.special-effect {
    position: absolute;
    font-size: 38px;
    font-weight: 800;
    color: #00e5ff;
    text-shadow: 
        2px 2px 0 #fff,
        -2px -2px 0 #fff,
        0 0 20px rgba(0, 229, 255, 0.8);
    pointer-events: none;
    animation: specialPop 0.7s ease forwards;
    z-index: 100;
}

@keyframes specialPop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-15deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.3) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: scale(1) rotate(0deg) translateY(-25px);
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 36px;
        letter-spacing: 4px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .controls-info {
        display: none;
    }
    
    #combo-count {
        font-size: 40px;
    }
    
    #wave-text {
        font-size: 36px;
    }
    
    .bar-container {
        width: 70px;
        height: 12px;
    }
    
    #score, #wave {
        font-size: 18px;
    }
}
