body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.game-header {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
    max-width: 400px;
}

.game-header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #2c3e50;
}

.instruction-panel p {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.boss-key-hint {
    color: #e74c3c !important;
    font-weight: bold;
    margin-top: 8px !important;
    font-size: 13px !important;
}

#game-container {
    position: relative;
    width: 400px;
    height: 600px;
    background: linear-gradient(to bottom, #87CEEB 0%, #1E90FF 100%); /* Ocean gradient */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    border: 4px solid #fff;
}

#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    box-shadow: inset 0 0 0 0 rgba(0,0,0,0);
    transition: box-shadow 0.5s ease;
}

/* Level 2: Yellow Warning Glow */
@keyframes glowYellow {
    0%, 100% { box-shadow: inset 0 0 20px 0 rgba(255, 215, 0, 0.2); }
    50% { box-shadow: inset 0 0 60px 20px rgba(255, 215, 0, 0.6); }
}

/* Level 3: Red Critical Glow */
@keyframes glowRed {
    0%, 100% { box-shadow: inset 0 0 30px 0 rgba(255, 0, 0, 0.3); }
    50% { box-shadow: inset 0 0 100px 40px rgba(255, 0, 0, 0.8); }
}

.level-2::after {
    animation: glowYellow 2s infinite;
}

.level-3::after {
    animation: glowRed 1s infinite;
}

.ui-overlay {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 10;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-pill.score { color: #2980b9; }
.stat-pill.timer { color: #8e44ad; }
.stat-pill.lives { color: #c0392b; }

.best-records {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    font-size: 14px;
    color: #555;
    text-align: left;
}

.best-records p {
    margin: 5px 0;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* Transparent background to show container gradient */
    background-color: transparent; 
}

/* Game Over Screen */
#game-over {
    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: 20;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#game-over h2 {
    margin-top: 0;
    color: #e74c3c;
}

#game-over p {
    font-size: 18px;
    margin: 15px 0;
}

button {
    padding: 12px 25px;
    font-size: 16px;
    background: linear-gradient(to right, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

/* Boss Screen - Fullscreen Terminal */
#boss-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1e1e1e;
    z-index: 9999;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #cccccc;
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal {
    width: 90%;
    height: 90%;
    background-color: #000;
    border: 1px solid #333;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.header {
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #4caf50;
    font-weight: bold;
}

.content p {
    margin: 5px 0;
    line-height: 1.4;
}

.cursor {
    animation: blink 1s infinite;
    display: inline-block;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
