/* Estilos generales */
body {
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    background-color: #87CEEB;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/background.png'); /* Cambia esto por la ruta a tu imagen */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1; /* Ajusta la transparencia según necesites */
    z-index: -1; /* Asegura que esté detrás de los otros elementos */
}

#container {
    position: relative;
    width: 100%;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* Elementos del juego */
#game {
    position: relative;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    background-color: white;
    overflow: hidden;
    z-index: 1;
}

#board {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Puntuación */
#score, #high-score {
    position: absolute;
    top: 20px;
    font-size: 24px;
    color: #535353;
    display: none;
    z-index: 5;
}

#score {
    right: 20px;
}

#high-score {
    right: 120px;
}

/* Texto Game Over */
#game-over-text {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    color: #535353;
    display: none;
    z-index: 10;
}

/* Pantalla de inicio */
#start-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    z-index: 10;
}

/* Fondo común para pantallas */
#start-screen, #game, #ranking-screen, #info-screen {
    background-color: transparent; /* Cambiado de #87CEEB a transparent */
}
#start-screen, #restart-options, #game-over-text, #ranking-screen, #info-screen {
    position: relative;
    z-index: 2;
}
body.dark-mode .background-image {
    opacity: 0.2; /* Más transparente en modo oscuro */
    filter: brightness(0.7); /* Oscurece un poco la imagen en modo oscuro */
}

/* Contenedores de botones */
#button-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    width: 80%;
    max-width: 300px;
}

#restart-options {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    z-index: 100;
}

#restart-button-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

/* Estilo del Logo */
#logo-container {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 80%;
}

#game-logo {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

#game-logo:hover {
    transform: scale(1.05);
}

/* Estilo de botones */
button {
    position: relative;
    padding: 12px 24px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    border: 2px solid #535353;
    background-color: white;
    color: #535353;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 50;
    width: 100%;
    margin: 8px 0;
}

button:hover {
    background-color: #535353;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Cuenta regresiva */
#countdown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 100;
    pointer-events: none;
}

#countdown-number {
    font-size: 120px;
    font-weight: bold;
    color: #535353;
    transform-origin: center;
    animation: countdown-pulse 1s ease-in-out infinite;
}

@keyframes countdown-pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* Pantalla de ranking */
#ranking-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 100;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#ranking-screen h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
    color: #535353;
}

/* Make sure the screen content is properly positioned and styled */
.screen-content {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .screen-content {
    background-color: rgba(30, 30, 40, 0.8);
}

/* Prize display styles */
.prize-info {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0 20px 0;
    padding: 10px;
    color: #000;
    background-color: #FFD700;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: prize-pulse 2s infinite ease-in-out;
}

body.dark-mode .prize-info {
    color: #fff;
    background-color: #B8860B;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Add animation to make it stand out */
@keyframes prize-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Ensure the ranking table is styled properly */
.ranking-table {
    width: 100%;
    margin: 15px 0;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ranking-table table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th, 
.ranking-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.ranking-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #333;
}

body.dark-mode .ranking-table th {
    background-color: #333;
    color: #f0f0f0;
}

#ranking-source {
    font-size: 14px;
    font-style: italic;
    margin-top: 5px;
    margin-bottom: 10px;
    color: #555;
}

#close-ranking-btn {
    margin-top: 15px;
    width: 120px;
    padding: 10px;
    font-size: 16px;
}

#refresh-ranking-btn {
    margin-right: 10px;
    background-color: #4CAF50;
    color: white;
}

#refresh-ranking-btn:hover {
    background-color: #388E3C;
}

/* Pantalla de información */
#info-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 100;
    display: none;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    box-sizing: border-box;
}

#info-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: bold;
}

#info-content-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    width: 100%;
    height: calc(100% - 60px);
}

#info-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

#info-screen #close-info-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 1000;
    pointer-events: auto;
}

.info-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 20px;
    text-align: left;
    border-bottom: 2px solid #87CEEB;
    padding-bottom: 8px;
}

.info-section p, .info-section li {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    text-align: left;
}

.info-section ul {
    padding-left: 20px;
    text-align: left;
}

/* Fixes for the close button in info screen */
.close-btn {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 102;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.close-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Selector de modo oscuro */
#dark-mode-toggle {
    opacity: 0;
    pointer-events: none; /* Esto lo hace invisible pero la lógica sigue funcionando */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

#dark-mode-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#moon-icon {
    fill: #333333;
}

#moon-icon, #sun-icon {
    transition: all 0.3s ease;
}

#sun-icon {
    display: none;
}

/* Mensajes y notificaciones */
.loading-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    z-index: 1000;
    font-family: 'Courier New', Courier, monospace;
    animation: pulse 1.5s infinite ease-in-out;
}

.payment-error {
    position: fixed;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    z-index: 1000;
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
}

.game-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    z-index: 2000;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease;
}

.notification-success { background-color: #4caf50; color: white; }
.notification-error { background-color: #f44336; color: white; }
.notification-warning { background-color: #ff9800; color: white; }
.notification-info { background-color: #2196f3; color: white; }

/* Botones XUMM */
.xumm-button {
    background-color: #1e88e5;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.xumm-button:hover {
    background-color: #1565c0;
}

/* Animaciones */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Modo oscuro */
body.dark-mode {
    background-color: #121212;
}

body.dark-mode #start-screen,
body.dark-mode #game,
body.dark-mode #ranking-screen,
body.dark-mode #info-screen {
    background-color: transparent; /* Cambiado de #121212 a transparent */
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode #score,
body.dark-mode #high-score,
body.dark-mode #game-over-text {
    color: #f0f0f0;
}

body.dark-mode #countdown {
    background-color: rgba(13, 20, 66, 0.8);
}

body.dark-mode #countdown-number {
    color: #f0f0f0;
}

body.dark-mode button {
    border: 2px solid #f0f0f0;
    background-color: #1a237e;
    color: #f0f0f0;
}

body.dark-mode button:hover {
    background-color: #f0f0f0;
    color: #121212;
}

body.dark-mode #button-container {
    background-color: rgba(0, 0, 0, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode #ranking-table th {
    background-color: #333;
    color: #f0f0f0;
}

body.dark-mode #ranking-table td {
    color: #f0f0f0;
}

body.dark-mode #ranking-table tr:nth-child(even) {
    background-color: #242424;
}

body.dark-mode #ranking-table tr:hover {
    background-color: #333;
}

body.dark-mode #info-header {
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode #info-content {
    background-color: rgba(0, 0, 0, 0.75);
}

body.dark-mode .info-section {
    background-color: rgba(30, 30, 40, 0.8);
}

body.dark-mode #info-header h2,
body.dark-mode .info-section h3,
body.dark-mode .info-section p,
body.dark-mode .info-section li {
    color: #f0f0f0;
}

body.dark-mode .info-section h3 {
    border-bottom: 2px solid #3f51b5;
}

body.dark-mode #close-icon {
    fill: #f0f0f0;
}

body.dark-mode .close-btn {
    background-color: rgba(0, 0, 0, 0.6);
}

body.dark-mode .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode #moon-icon {
    fill: #FFD700;
}

body.dark-mode #sun-icon {
    display: block;
    fill: #f0f0f0;
}

body.dark-mode #dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .loading-msg {
    background-color: rgba(33, 33, 33, 0.9);
    color: #f0f0f0;
}

body.dark-mode #ranking-source {
    color: #bbb;
}

body.dark-mode #refresh-ranking-btn {
    background-color: #388E3C;
}

body.dark-mode #refresh-ranking-btn:hover {
    background-color: #2E7D32;
}

body.dark-mode .notification-success { background-color: #388e3c; }
body.dark-mode .notification-error { background-color: #d32f2f; }
body.dark-mode .notification-warning { background-color: #f57c00; }
body.dark-mode .notification-info { background-color: #0277bd; }

/* Responsive */
@media (max-width: 768px) {
    button {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    #score, #high-score {
        font-size: 20px;
    }
    
    #game-over-text {
        font-size: 30px;
    }

    #countdown-number {
        font-size: 80px;
    }
    
    .ranking-table {
        max-width: 100%;
        font-size: 14px;
    }
    
    #info-header h2 {
        font-size: 20px;
    }
    
    .info-section h3 {
        font-size: 18px;
    }
    
    .info-section p, .info-section li {
        font-size: 14px;
    }
    
    #game-logo {
        max-height: 100px;
    }

    .screen-content {
        width: 90%;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    button {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    #score, #high-score {
        font-size: 16px;
        top: 10px;
    }
    
    #high-score {
        right: 100px;
    }

    #game-over-text {
        font-size: 24px;
    }

    #countdown-number {
        font-size: 60px;
    }
    
    #info-header {
        padding: 10px 15px;
    }
    
    #info-content {
        padding: 12px;
    }
    
    #game-logo {
        max-height: 80px;
    }

    .prize-info {
        font-size: 16px;
        padding: 8px;
    }

    .screen-content {
        width: 95%;
        padding: 10px;
    }

    .ranking-table th,
    .ranking-table td {
        padding: 8px;
        font-size: 12px;
    }
}