/* =========================================================================
   STATE 1: GAME
========================================================================= */
#state-game {
    background: #70c5ce; /* Color del cielo de Flappy Bird */
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#mute-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#mute-btn:active {
    background: rgba(0, 0, 0, 0.6);
}

#touch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    /* Permite capturar eventos táctiles sin interferir visualmente */
}

/* --- Start Screen Overlay --- */
#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    pointer-events: none;
    gap: 30px;
    padding-top: 32%;
}

#start-overlay.hidden {
    display: none;
}

#game-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.title-line {
    font-family: 'Press Start 2P', monospace;
    font-size: 38px;
    letter-spacing: 4px;
    line-height: 1.3;
    /* Borde pixel-art grueso: múltiples text-shadow apilados */
    text-shadow:
        /* Capa negra gruesa (contorno) */
        -3px -3px 0 #000,
         3px -3px 0 #000,
        -3px  3px 0 #000,
         3px  3px 0 #000,
         0   -3px 0 #000,
         0    3px 0 #000,
        -3px  0   0 #000,
         3px  0   0 #000,
        /* Capa blanca intermedia (borde de brillo) */
        -1px -1px 0 rgba(255,255,255,0.5),
         1px -1px 0 rgba(255,255,255,0.5),
        -1px  1px 0 rgba(255,255,255,0.5),
         1px  1px 0 rgba(255,255,255,0.5),
        /* Sombra de profundidad */
         4px  4px 0 rgba(0,0,0,0.4);
}

.title-flappy {
    color: #FFD700;
}

.title-snoopy {
    color: #FF6B9D;
    font-size: 42px;
    letter-spacing: 6px;
}

#tap-instruction {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow:
        -2px -2px 0 #000,
         2px -2px 0 #000,
        -2px  2px 0 #000,
         2px  2px 0 #000,
         0   -2px 0 #000,
         0    2px 0 #000,
        -2px  0   0 #000,
         2px  0   0 #000;
    animation: blink 1s steps(2, start) infinite;
}

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

/* --- Game Over Overlay --- */
#gameover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#gameover-overlay.hidden {
    display: none;
}

#gameover-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
}

#gameover-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 80%;
    max-width: 220px;
    margin: 0 auto;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

#gameover-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 28px;
    color: #ff0000;
    white-space: nowrap;
    letter-spacing: 3px;
    text-shadow:
        -3px -3px 0 #000,
         3px -3px 0 #000,
        -3px  3px 0 #000,
         3px  3px 0 #000,
         0   -3px 0 #000,
         0    3px 0 #000,
        -3px  0   0 #000,
         3px  0   0 #000,
         4px  4px 0 rgba(0,0,0,0.4);
    margin: 0;
}

#scoreboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 12px;
    padding: 20px 30px;
    border-radius: 4px;
    /* Estética Arcade 3D Final */
    background-color: #8a2be2;
    border: 10px solid;
    border-color: #e8e8e8 #555555 #555555 #e8e8e8;
    outline: 3px solid #000;
    box-shadow: inset 0 0 0 3px #000;
}

#medal-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #555;
    border: 3px solid #000;
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.4),
        inset -2px -2px 0 rgba(0,0,0,0.3),
        2px 2px 0 rgba(0,0,0,0.2);
}

#medal-circle.bronze {
    background: linear-gradient(135deg, #e39a5c, #b0621f, #753b0b);
}

#medal-circle.silver {
    background: linear-gradient(135deg, #f0f0f0, #c0c0c0, #808080);
}

#medal-circle.gold {
    background: linear-gradient(135deg, #ffe066, #ffcc00, #b38600);
}

#medal-circle.none {
    background: conic-gradient(#cccccc 90deg, #ffffff 90deg 180deg, #cccccc 180deg 270deg, #ffffff 270deg);
    background-size: 10px 10px;
}

.scoreboard-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    text-shadow:
        -1.5px -1.5px 0 #000,
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000;
}

.label-score {
    color: #4dc3ff; /* Azul claro/celeste brillante */
}

.label-highscore {
    color: #f8c028; /* Amarillo brillante del HUD */
}

.label-medal {
    color: #ffffff; /* Blanco puro */
}

.scoreboard-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #fff;
    text-shadow:
        -2px -2px 0 #000,
         2px -2px 0 #000,
        -2px  2px 0 #000,
         2px  2px 0 #000,
         0   -2px 0 #000,
         0    2px 0 #000,
        -2px  0   0 #000,
         2px  0   0 #000;
}

#btn-restart {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #f8c028;
    letter-spacing: 2px;
    background: #184fe6;
    border: 3px solid #000;
    border-radius: 4px;
    padding: 14px 40px;
    cursor: pointer;
    box-shadow:
        inset 0 -3px 0 rgba(0,0,0,0.25),
        inset 0 3px 0 rgba(255,255,255,0.2),
        3px 3px 0 rgba(0,0,0,0.3);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
    transition: transform 0.1s;
}

#btn-restart:active {
    transform: scale(0.95);
    box-shadow:
        inset 0 -1px 0 rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.2),
        1px 1px 0 rgba(0,0,0,0.3);
}

