body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Alinea al inicio para que el contenido no se apriete */
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f8ff, #e0f2f7); /* Fondo más festivo */
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* Sombra más pronunciada */
    text-align: center;
    width: 90%;
    max-width: 1000px; /* Ampliado para los 100 cuadros */
    margin-top: 20px;
}

h1 {
    color: #4a4a4a;
    margin-bottom: 10px;
    font-size: 2.2em;
}

p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr); /* 10 columnas */
    gap: 8px; /* Espacio entre cuadros */
    margin-top: 25px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 850px; /* Ancho máximo para el contenedor de la cuadrícula */
    margin-left: auto;
    margin-right: auto;
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 8px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.05);
}

.grid-square {
    aspect-ratio: 1 / 1; /* Para que los cuadros sean siempre cuadrados */
    background-color: #6a05ad; /* Morado vibrante */
    color: white;
    display: flex;
    flex-direction: column; /* Para colocar el ID y el emoji */
    justify-content: center;
    align-items: center;
    font-size: 1.2em; /* Tamaño de fuente para el ID inicial */
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.grid-square:hover:not(.locked) {
    background-color: #8a2be2; /* Morado más claro al pasar el ratón */
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.grid-square.locked {
    background-color: #a0a0a0; /* Gris para cuadros bloqueados */
    cursor: not-allowed;
    color: #333; /* Texto más oscuro para el número asignado */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.grid-square .square-id {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em; /* Visible inicialmente */
    color: white;
}

.grid-square .hidden-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0; /* Oculto por defecto */
    font-weight: bold;
    color: #333; /* Color del número revelado */
    transition: font-size 0.3s ease;
    z-index: 2; /* Para que se vea por encima del emoji si es necesario */
}

.grid-square .emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0; /* Oculto por defecto */
    transition: font-size 0.3s ease;
    z-index: 1; /* Para que el número quede por encima */
}

.grid-square.locked .square-id {
    display: none; /* Oculta el ID del cuadro cuando está bloqueado */
}

.grid-square.locked .hidden-number {
    font-size: 2.2em; /* Muestra el número oculto cuando está bloqueado */
}

.grid-square.locked .emoji {
    font-size: 2.5em; /* Muestra el emoji cuando está bloqueado */
    opacity: 0.6; /* Un poco transparente para no opacar el número */
}

/* Botones */
.button-group {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px; /* Espacio entre los botones */
}

.reset-button, .view-participants-button {
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px; /* Botones más redondeados */
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.reset-button {
    background-color: #ff4757; /* Rojo festivo */
}

.reset-button:hover {
    background-color: #e63946;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.view-participants-button {
    background-color: #2ed573; /* Verde vibrante */
}

.view-participants-button:hover {
    background-color: #2bc465;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.5); /* Black w/ more opacity */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px); /* Blurred background más fuerte */
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 550px; /* Max width for participant form */
    position: relative;
    animation: fadeInScale 0.4s ease-out; /* Animación de entrada */
}

@keyframes fadeInScale {
    from { opacity: 0; transform: translateY(-50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Specific styles for the participants list modal content */
#participants-list-modal .modal-content {
    max-width: 900px; /* Make it wider for the table */
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    color: #666;
    text-decoration: none;
    cursor: pointer;
}

/* Form Styles */
.modal h2 {
    color: #4a4a4a;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.modal p {
    color: #555;
    margin-bottom: 25px;
    font-size: 1.05em;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-weight: bold;
    font-size: 1.1em;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    width: calc(100% - 24px); /* Ajuste para padding */
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1.05em;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.confirm-button {
    background-color: #2ed573;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 25px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.confirm-button:hover {
    background-color: #2bc465;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Styles for Participants List Table */
#participants-list-modal h2 {
    color: #4a4a4a;
    margin-bottom: 25px;
}

.table-container {
    max-height: 450px; /* Limit height for scrolling */
    overflow-y: auto; /* Enable vertical scrolling */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.03);
}

#participants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

#participants-table th,
#participants-table td {
    padding: 12px 18px;
    border: 1px solid #eee;
    text-align: left;
    font-size: 0.95em;
}

#participants-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #555;
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 10; /* Ensure it's above scrolling content */
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
}

#participants-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#participants-table tbody tr:hover {
    background-color: #eef; /* Un color suave al pasar el ratón */
}

#no-participants-message {
    color: #777;
    font-style: italic;
    padding: 20px;
    font-size: 1.1em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    h1 {
        font-size: 1.8em;
    }
    p {
        font-size: 1em;
    }
    .grid-container {
        grid-template-columns: repeat(5, 1fr); /* 5 columnas en pantallas más pequeñas */
        gap: 6px;
    }
    .grid-square {
        font-size: 1em;
    }
    .grid-square.locked .hidden-number {
        font-size: 1.8em;
    }
    .grid-square.locked .emoji {
        font-size: 2em;
    }
    .button-group {
        flex-direction: column; /* Botones apilados en móvil */
        gap: 10px;
    }
    .reset-button, .view-participants-button, .confirm-button {
        padding: 10px 20px;
        font-size: 1em;
    }
    .modal-content {
        padding: 20px;
    }
    #participants-table th,
    #participants-table td {
        padding: 8px 10px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr); /* 4 columnas en pantallas muy pequeñas */
    }
    .grid-square {
        font-size: 0.9em;
    }
    .grid-square.locked .hidden-number {
        font-size: 1.5em;
    }
    .grid-square.locked .emoji {
        font-size: 1.8em;
    }
    h1 {
        font-size: 1.5em;
    }
    p {
        font-size: 0.9em;
    }
}
