/* Juego de Burbujas - Estilos */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    overflow: hidden;
    background: linear-gradient(to top, #90e0ef, #caf0f8, #fefae0);
    font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
    min-height: 100vh;
    touch-action: manipulation;
}

canvas {
    display: block;
    cursor: pointer;
}

/* Botón flotante para volver */
.btn-volver-flotante {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    color: #ff4d6d;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(6px);
    transition: transform 0.2s, background 0.2s;
}

.btn-volver-flotante:hover {
    transform: scale(1.05);
    background: white;
}

/* HUD durante la partida */
.hud {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    pointer-events: none;
    z-index: 50;
}

.puntuacion, .tiempo {
    background: rgba(255, 255, 255, 0.92);
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 26px;
    font-weight: 700;
    color: #ff4d6d;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    border: 2px solid #ffd6e0;
}

.tiempo {
    color: #0077b6;
    border-color: #bde0fe;
}

.tiempo.alerta {
    color: #d90429;
    animation: pulso 0.5s infinite alternate;
}

@keyframes pulso {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.instruccion {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 18px;
    color: #555;
    font-weight: 600;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* Overlays (Pantallas de Inicio y Fin) */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(8px);
    padding: 16px;
}

.panel {
    background: white;
    border-radius: 36px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    max-width: 440px;
    width: 100%;
    border: 4px solid #ffccd5;
    animation: aparicion 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.panel h2 {
    font-size: 32px;
    margin-bottom: 8px;
    color: #ff4d6d;
}

.panel p.subtitulo {
    font-size: 18px;
    color: #666;
    margin-bottom: 16px;
}

.panel input {
    width: 85%;
    padding: 14px 20px;
    border-radius: 25px;
    border: 3px solid #ffccd5;
    font-size: 20px;
    font-family: inherit;
    text-align: center;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.panel input:focus {
    border-color: #ff4d6d;
}

.btn-jugar {
    background: linear-gradient(135deg, #ff4d6d, #ff758f);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 35px;
    font-size: 22px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 8px 18px rgba(255, 77, 109, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-jugar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(255, 77, 109, 0.45);
}

.btn-jugar:active {
    transform: scale(0.96);
}

/* Tabla de récords */
.record-table {
    margin-top: 24px;
    text-align: left;
    max-height: 180px;
    overflow-y: auto;
}

.record-table h3 {
    color: #0077b6;
    font-size: 20px;
    margin-bottom: 10px;
    text-align: center;
}

.record-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 14px;
    margin: 4px 0;
    background: #f0f9ff;
}

.record-row:nth-child(even) {
    background: #fff0f3;
}

.record-row.campeon {
    background: #ffe5ec;
    border: 2px solid #ffb3c1;
    font-weight: 700;
}

.oculto {
    display: none !important;
}
