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

body {
    background: linear-gradient(180deg, #0a0a2e 0%, #16213e 50%, #1a1a2e 100%);
    color: white;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    width: 400px;
    height: 600px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00ffff;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.ui {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    text-shadow: 0 0 10px #00ffff;
}

.level-info {
    position: absolute;
    top: 40px;
    left: 10px;
    right: 10px;
    z-index: 10;
    text-align: center;
    font-size: 14px;
    text-shadow: 0 0 10px #ffff00;
}

.powerup-info {
    position: absolute;
    top: 70px;
    left: 10px;
    right: 10px;
    z-index: 10;
    text-align: center;
    font-size: 18px;
    color: #00ff00;
    text-shadow: 0 0 15px #00ff00;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.keyboard-hint {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    gap: 10px;
}

.btn {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 10px 15px;
    font-size: 24px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.1s ease;
    user-select: none;
}

.btn:active {
    background: rgba(0, 255, 255, 0.4);
    transform: scale(0.95);
}

.fire-btn {
    background: rgba(255, 0, 100, 0.2);
    border-color: #ff0064;
    color: #ff0064;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fire-btn:active {
    background: rgba(255, 0, 100, 0.4);
}

.game-over, .level-complete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #ff0064;
    text-align: center;
    z-index: 20;
    display: flex; /* Changed from 'none' to 'flex' for visibility and layout control */
    flex-direction: column; /* Stack content vertically for portrait layout */
    align-items: center; /* Center items horizontally within the flex container */
    max-width: 90%; /* Limit width to ensure responsiveness on smaller screens */
    box-sizing: border-box; /* Ensure padding and border are included in the width */
}

.level-complete {
    border-color: #00ff00;
}

.restart-btn, .next-btn, .watch-ad-btn {
    background: #00ffff;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    transition: background 0.2s ease;
    user-select: none;
}

.restart-btn:hover, .next-btn:hover {
    background: #00dddd;
}

.restart-btn {
    background-color: #ff0064; /* Game Over button color */
    color: #fff;
}

.restart-btn:hover {
    background-color: #dd0055;
}

.next-btn {
    background-color: #00cc00; /* Level Complete button color */
    color: #fff;
}

.next-btn:hover {
    background-color: #00aa00;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.watch-ad-btn {
    background-color: #ff8800;
    color: #fff;
    font-weight: bold;
}

.watch-ad-btn:hover {
    background-color: #ff6600;
}

.watch-ad-btn:disabled {
    background-color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Joystick Styles */
.joystick-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.joystick-base {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-handle {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 255, 0.6);
    border: 2px solid #00ffff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.joystick-handle:active {
    background: rgba(0, 255, 255, 0.8);
    transform: scale(0.9);
}