body {
    display: block; // Changed from flex to block
    margin: 0;
    padding: 20px;
    font-family: "Segoe UI", "Arial", sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #87CEEB 100%);
    min-height: 100vh;
    height: 100vh; // Ensure full height
    // display: flex; // Removed for proper layout
    // justify-content: center; // Removed for proper layout
    // align-items: center; // Removed for proper layout
    overflow-x: hidden;
}

.game-container {
    margin: 20px auto; // Center the container
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-width: 1100px;
    width: 100%;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.game-header {
    // display: flex; // Removed for proper layout
    justify-content: space-between;
    // align-items: center; // Removed for proper layout
    margin-bottom: 30px;
    padding: 0 25px;
}

.game-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 3.5em;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #e74c3c, #f39c12, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 2px;
}

.score {
    font-size: 2em;
    font-weight: bold;
    color: #e74c3c;
    background: linear-gradient(45deg, #fff, #f8f9fa);
    padding: 18px 30px;
    border-radius: 35px;
    border: 4px solid #e74c3c;
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-area {
    position: relative;
    margin: 30px 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border: 3px solid #34495e;
}

#gameCanvas {
    border: none;
    border-radius: 17px;
    background: linear-gradient(to bottom, 
        #87CEEB 0%, 
        #B0E0E6 15%, 
        #F0F8FF 35%, 
        #E6E6FA 55%, 
        #D3D3D3 75%, 
        #A9A9A9 100%);
    display: block;
    margin: 0 auto;
    image-rendering: auto;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    width: 100%;
    max-width: 800px;
    height: auto;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    text-align: center;
    z-index: 10;
    border: 4px solid #27ae60;
    backdrop-filter: blur(10px);
}

.game-over h2 {
    color: #27ae60;
    margin-bottom: 25px;
    font-size: 3em;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    font-weight: 800;
}

.game-over p {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 30px;
    font-weight: bold;
}

#restartBtn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 1.4em;
    font-weight: bold;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(231, 76, 60, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: "Segoe UI", sans-serif;
}

#restartBtn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(231, 76, 60, 0.6);
    background: linear-gradient(45deg, #c0392b, #a93226);
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    justify-content: space-between;
    // align-items: center; // Removed for proper layout
    gap: 30px;
    width: 100%;
}

.control-pad {
    // display: flex; // Removed for proper layout
    flex-direction: column;
    // align-items: center; // Removed for proper layout
    flex: 1;
}

.d-pad {
    display: grid;
    grid-template-areas: 
        ". up ."
        "left . right"
        ". down .";
    gap: 5px;
    background: #333;
    padding: 10px;
    border-radius: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.d-pad-middle {
    // display: flex; // Removed for proper layout
    gap: 5px;
    grid-area: left / left / right / right;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #555, #333);
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.control-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, #333, #555);
}

#btnUp { grid-area: up; }
#btnLeft { grid-area: left; }
#btnRight { grid-area: right; }
#btnDown { grid-area: down; }

.action-buttons {
    // display: flex; // Removed for proper layout
    flex-direction: column;
    gap: 10px;
    flex: 1;
    // align-items: center; // Removed for proper layout
}

.action-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-width: 100px;
    width: 100%;
    max-width: 120px;
}

.action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, #c0392b, #a93226);
}

#btnJump {
    background: linear-gradient(145deg, #27ae60, #229954);
}

#btnJump:active {
    background: linear-gradient(145deg, #229954, #1e8449);
}

#btnAttack {
    background: linear-gradient(145deg, #f39c12, #e67e22);
}

#btnAttack:active {
    background: linear-gradient(145deg, #e67e22, #d35400);
}

#btnBlock {
    background: linear-gradient(145deg, #3498db, #2980b9);
}

#btnBlock:active {
    background: linear-gradient(145deg, #2980b9, #21618c);
}

.controls {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    border: 4px solid #dee2e6;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.controls p {
    margin: 10px 0;
    color: #495057;
    font-size: 1.3em;
    font-weight: 600;
}

.controls strong {
    color: #e74c3c;
    font-size: 1.4em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 800;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
    display: block; // Changed from flex to block
        padding: 10px;
    }
    
    .game-container {
    margin: 20px auto; // Center the container
        padding: 15px;
        border-radius: 15px;
        max-width: 100%;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .game-header h1 {
        font-size: 2.5em;
    }
    
    .score {
        font-size: 1.5em;
        padding: 12px 20px;
    }
    
    .mobile-controls {
        // display: flex; // Removed for proper layout
    }
    
    .controls {
        margin-top: 20px;
        padding: 15px;
    }
    
    .controls p {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 2em;
    }
    
    .score {
        font-size: 1.2em;
        padding: 10px 15px;
    }
    
    .mobile-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .action-btn {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 80px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
    margin: 20px auto; // Center the container
        max-width: 100%;
        padding: 10px;
    }
    
    .game-header {
        flex-direction: row;
        margin-bottom: 15px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .score {
        font-size: 1.3em;
        padding: 8px 15px;
    }
    
    .mobile-controls {
        flex-direction: row;
        margin-top: 15px;
        padding: 15px;
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        // justify-content: center; // Removed for proper layout
    }
    
    .action-btn {
        flex: 1;
        min-width: 80px;
        max-width: 100px;
    }
    
    .controls {
        display: none;
    }
}

/* Smooth animations */
* {
    transition: all 0.3s ease;
}

/* Snow animation */
@keyframes snow {
    0% { 
        transform: translateY(-100vh) rotate(0deg); 
        opacity: 1; 
    }
    100% { 
        transform: translateY(100vh) rotate(360deg); 
        opacity: 0; 
    }
}

.snowflake {
    position: fixed;
    top: -10px;
    left: 0;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #ffffff, #f0f0f0);
    border-radius: 50%;
    animation: snow 12s linear infinite;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.snowflake:nth-child(odd) {
    animation-duration: 18s;
    animation-delay: -8s;
    width: 6px;
    height: 6px;
}

.snowflake:nth-child(even) {
    animation-duration: 15s;
    animation-delay: -3s;
    width: 10px;
    height: 10px;
}

/* Add some snowflakes */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20px 30px, #ffffff, transparent),
        radial-gradient(2px 2px at 40px 70px, #ffffff, transparent),
        radial-gradient(1px 1px at 90px 40px, #ffffff, transparent),
        radial-gradient(1px 1px at 130px 80px, #ffffff, transparent),
        radial-gradient(2px 2px at 160px 30px, #ffffff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: snow 20s linear infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

/* Copyright Notice Styling */
.copyright-notice {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    border-top: 3px solid #e74c3c;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    width: 100%;
    box-sizing: border-box;
}

.copyright-notice .main-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.copyright-notice .sub-text {
    font-size: 12px;
    opacity: 0.8;
}
