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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Pantalla de inicio */
#pantalla-inicio {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

#pantalla-inicio h1 {
    font-size: 4em;
    color: #fff;
    text-shadow: 0 0 20px rgba(65, 149, 255, 0.8), 0 0 40px rgba(65, 149, 255, 0.4);
    margin-bottom: 10px;
    letter-spacing: 15px;
}

#pantalla-inicio .subtitulo {
    color: #888;
    font-size: 1em;
    margin-bottom: 40px;
}

#btnStart {
    padding: 15px 60px;
    font-size: 1.3em;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

#btnStart:hover {
    background: linear-gradient(135deg, #00e5ff, #00d4ff);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
}

#btnStart:active {
    transform: scale(0.98);
}

.campo {
    position: relative;
    background: #1a1a2e;
    border: 2px solid rgba(65, 149, 255, 0.3);
    box-shadow: 0 0 30px rgba(65, 149, 255, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
}

.campo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.1) 0px,
        rgba(255, 255, 255, 0.1) 10px,
        transparent 10px,
        transparent 20px
    );
}

.pelota {
    background: radial-gradient(circle at 30% 30%, #fff, #4195FF);
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 0 15px rgba(65, 149, 255, 0.8), 0 0 30px rgba(65, 149, 255, 0.4);
}

.tab {
    position: absolute;
    top: 120px;
    border-radius: 6px;
}

#jugador {
    height: 60px;
    width: 12px;
    left: 15px;
    background: linear-gradient(180deg, #00d4ff, #0099cc);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6), -3px 0 10px rgba(0, 212, 255, 0.3);
}

#ia {
    height: 60px;
    width: 12px;
    top: 120px;
    left: 573px;
    background: linear-gradient(180deg, #ff6b6b, #cc3333);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.6), 3px 0 10px rgba(255, 107, 107, 0.3);
}

#contador {
    margin-bottom: 20px;
    width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#j1, #j2 {
    color: #fff;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
}

#j1 {
    color: #00d4ff;
}

#j2 {
    color: #ff6b6b;
}

#j1 h1, #j2 h1 {
    margin: 0;
}

#monitor {
    margin-top: 15px;
    min-height: 40px;
    text-align: center;
    color: #ffc800;
    font-size: 1.3em;
    font-weight: bold;
}

#monitor button {
    margin-left: 15px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

#monitor button:hover {
    background: linear-gradient(135deg, #00e5ff, #00d4ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

#controles {
    margin-top: 20px;
    padding: 15px 25px;
    background: rgba(26, 26, 46, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
}

.controles-grupo {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    margin-bottom: 12px;
}

.titulo-controles {
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-align: center;
}

.teclas-fila {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    justify-content: center;
}

.tecla {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.9em;
    font-weight: bold;
}

.tecla-label {
    color: #ccc;
    font-size: 0.85em;
}

.touch-info {
    color: #ccc;
    font-size: 0.85em;
    text-align: center;
    line-height: 1.5;
}

.velocidad-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 200, 0, 0.15);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: 20px;
    color: #ffc800;
    font-size: 0.85em;
    font-weight: bold;
}

.velocidad-icono {
    font-size: 1em;
}

/* Pantalla de rotacion */
#rotar-pantalla {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.rotar-contenido {
    color: #fff;
}

.rotar-icono {
    font-size: 4em;
    display: block;
    margin-bottom: 20px;
    animation: girar 2s ease-in-out infinite;
}

.rotar-contenido p {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.rotar-sub {
    color: #888;
    font-size: 1em !important;
}

@keyframes girar {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Movil vertical: ocultar juego, mostrar aviso */
@media (max-width: 600px) and (orientation: portrait) {
    body {
        padding: 0;
    }

    #rotar-pantalla {
        display: flex;
    }

    #pantalla-inicio,
    #contador,
    #campo,
    #controles {
        display: none;
    }
}

/* Movil horizontal: ajustar juego */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 10px;
        justify-content: center;
    }

    #pantalla-inicio h1 {
        font-size: 2.5em;
    }

    #pantalla-inicio .subtitulo {
        font-size: 0.85em;
        margin-bottom: 25px;
    }

    #btnStart {
        padding: 12px 40px;
        font-size: 1em;
    }

    .campo {
        transform: scale(0.85);
        transform-origin: center center;
    }

    #contador {
        width: 250px;
        margin-bottom: 10px;
        padding: 10px 20px;
    }

    #j1, #j2 {
        font-size: 2em;
    }

    #controles {
        margin-top: 10px;
        padding: 10px 15px;
        min-width: 250px;
    }

    .titulo-controles {
        font-size: 0.65em;
    }

    .tecla {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }

    .touch-info {
        font-size: 0.75em;
    }

    .velocidad-badge {
        font-size: 0.75em;
        padding: 4px 10px;
    }
}
