body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #004b8d 0%, #001f3f 100%);
    font-family: Arial, sans-serif;
    color: white;
    overflow: hidden;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
}

.hidden {
    display: none !important;
}

/* Splash Screen */
#splash-screen {
    flex-direction: column;
    cursor: pointer;
    z-index: 1000;
    background: radial-gradient(circle, #004b8d 0%, #001f3f 100%);
    transition: background 0.8s ease-in-out;
}

#splash-screen.minimized {
    background: transparent;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-logo {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-title {
    font-size: 64px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation classes */
#splash-screen.minimized .splash-content {
    position: absolute;
    top: 20px;
    left: 20px;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

#splash-screen.minimized .splash-logo {
    width: 50px;
    transform: rotate(315deg);
    margin-bottom: 0;
}

#splash-screen.minimized .splash-title {
    font-size: 28px;
}

#splash-screen.minimized .splash-prompt {
    display: none;
}

.splash-prompt {
    font-size: 24px;
    margin-top: 20px;
    animation: blink 1.5s infinite;
}

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

/* Setup Screen */
#setup-screen {
    z-index: 500;
}

/* Common Canvas Styles */
#preview-canvas, #game-canvas {
    background: transparent;
    z-index: 1;
    position: absolute;
    top: 0;
}

/* Setup Screen Overlay */
.setup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 79px);
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Move panels to the top */
    align-items: center;
    padding: 20px; 
    box-sizing: border-box;
}

.control-panel {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
    align-items: center;
    text-align: center;
}

.selection-panel, .input-panel {
    background: rgba(0, 0, 0, 0.4); 
    padding: 10px 30px; 
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2); 
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.selection-panel h3, .input-panel h3 {
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 10px;
    color: white;
    margin-top: 0;
}

#start-btn {
    pointer-events: auto;
    margin-top: 20px; /* Space above button */
    margin-bottom: 20px; /* Space below button */
}

.tab-control {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #e74c3c;
    border-color: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.radio-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 22px;
    cursor: pointer;
    min-width: 170px;
}


.radio-group input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 22px;
    height: 22px;
    border: 2px solid white;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.radio-group input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.matrix-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.matrix-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.matrix-input {
    width: 55px;
    height: 35px;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid white;
    color: navy;
    font-size: 16px;
    border-radius: 4px;
}
.matrix-label {
    width: 55px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 0px;
}
#start-btn, #restart-btn {
    padding: 12px 35px;
    font-size: 22px;
    font-weight: bold;
    color: white;
    background: #2182af;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#start-btn:hover, #restart-btn:hover {
    background: #1253a8;
    transform: scale(1.05);
}

/* HUD Styles */
#hud {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 79px;
    background: #1e1f20;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-sizing: border-box;
    border-top: 2px solid white;
}

#score, #ammo-display {
    font-size: 24px;
    font-weight: bold;
}

#lives-display {
    display: flex;
}

.life-heart {
    width: 25px;
    height: 25px;
    margin: 0 4px;
    transition: filter 0.3s;
}

.life-heart.used {
    filter: brightness(0.2) grayscale(1);
}

/* Overlays */
#countdown-overlay {
    position: absolute;
    font-size: 150px;
    font-weight: bold;
    z-index: 2000;
    text-shadow: 0 0 30px rgba(0,0,0,0.5);
}

#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    text-align: center;
}

#game-over-overlay h1 {
    font-size: 60px;
    margin: 0;
    color: #e74c3c;
}

#game-over-overlay p {
    font-size: 40px;
    margin: 20px 0;
}
