* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    background: linear-gradient(to bottom, #0a0a1a, #1a0a2a);
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;

    /* FIX: evita que se “pique” en pantallas pequeñas */
    overflow: auto;
}

/* Screen Management */
.screen {
    display: none;
    text-align: center;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* Typography */
h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: #4FC3F7;
    text-shadow: 0 0 20px rgba(79, 195, 247, 0.5);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #aaa;
}

.success {
    color: #4CAF50;
}

.game-over {
    color: #F44336;
}

/* Instructions Box */
.instructions-box {
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid #444;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto 1.5rem auto;
    backdrop-filter: blur(10px);
}

.instructions-box ul {
    list-style: none;
    text-align: left;
}

.instructions-box li {
    padding: 0.5rem 0;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background: #2196F3;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6);
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.8rem;
}

/* NEW: Size selector */
.size-select {
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid #444;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 500px;
    margin: 0 auto 2rem auto;
    backdrop-filter: blur(10px);
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.size-btn {
    font-size: 1rem;
    padding: 0.8rem 1rem;
    opacity: 0.85;
}

.size-btn.selected {
    outline: 3px solid #4FC3F7;
    box-shadow: 0 0 0 2px rgba(79,195,247,0.25), 0 6px 18px rgba(33,150,243,0.55);
    opacity: 1;
}

.size-hint {
    font-size: 0.9rem;
    color: #cfcfcf;
    margin-top: 0.75rem;
}

/* Canvas */
#gameCanvas {
    background: #0a0a1a;
    display: block;
    margin: 0 auto;
    border: 4px solid #444;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);

    /* El tamaño real del canvas lo define JS.
       Esto ayuda a mantenerlo centrado visualmente. */
    max-width: 100%;
}

/* Score Display */
.score-display {
    font-size: 2rem;
    margin: 1rem 0;
    color: #FFD700;
}

.level-display {
    font-size: 1.5rem;
    margin: 1rem 0;
    color: #4FC3F7;
}

/* Upgrade System */
.upgrade-container {
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid #444;
    border-radius: 12px;
    padding: 2rem;
    max-width: 700px;
    margin: 2rem auto;
    backdrop-filter: blur(10px);
}

.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.upgrade-btn {
    padding: 1.5rem;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    color: white;
    text-align: center;
}

.upgrade-btn:hover:not(:disabled) {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.damage-upgrade {
    background: linear-gradient(135deg, #F44336, #D32F2F);
}

.damage-upgrade:hover:not(:disabled) {
    border-color: #FF6B6B;
}

.firerate-upgrade {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.firerate-upgrade:hover:not(:disabled) {
    border-color: #FFB74D;
}

.speed-upgrade {
    background: linear-gradient(135deg, #FFC107, #FFA000);
}

.speed-upgrade:hover:not(:disabled) {
    border-color: #FFD54F;
}

.multishot-upgrade {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.multishot-upgrade:hover:not(:disabled) {
    border-color: #BA68C8;
}

.upgrade-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.upgrade-level {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.upgrade-desc {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    
    .upgrade-grid {
        grid-template-columns: 1fr;
    }

    .size-grid {
        grid-template-columns: 1fr;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 700px;
        height: auto;
    }
}

#gameScreen {
    position: relative;
}

/* Top Buttons */
#topControls {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 1000;
}

#topControls .btn {
    font-size: 0.9rem !important;
    padding: 0.4rem 1rem !important;
    border-radius: 6px !important;
}

#gameCanvas {
    margin-top: 70px !important; /* espacio entre botones y canvas */
}

/* FIX: separa el canvas de la barra de tareas */
#gameCanvas {
    margin-bottom: 25px !important;
}

