/* === ESTILOS GENERALES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px;
}

h1 {
    color: #fff;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    text-align: center;
    font-size: 1.6rem;
}

.pantalla {
    display: none;
    width: 100%;
    max-width: 700px;
}

.pantalla.activa {
    display: block;
}

.oculto { display: none !important; }

/* === PANTALLA DE INICIO === */
.caja-bienvenida {
    background: #fff;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.caja-bienvenida h2 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.caja-bienvenida p {
    color: #555;
    margin-bottom: 25px;
}

.btn-principal {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1e3c72;
    box-shadow: 0 4px 0 #cc9900;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 8px 0;
}

.btn-principal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #cc9900;
}

.btn-secundario {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: #6c757d;
    color: #fff;
    margin: 6px 0;
    transition: background 0.2s;
}

.btn-secundario:hover {
    background: #5a6268;
}

.btn-peligro {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: #dc3545;
    color: #fff;
    margin: 12px 0;
}

.acceso-admin {
    margin-top: 20px;
}

.acceso-admin a {
    color: #ffd700;
    text-decoration: none;
    font-size: 15px;
}

/* === FORMULARIO === */
.contenedor-formulario {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.contenedor-formulario h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.contenedor-formulario input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.mensaje-aviso {
    color: #dc3545;
    margin: 10px 0;
    min-height: 20px;
    font-size: 14px;
}

.cargando {
    color: #ffd700;
    text-align: center;
    padding: 15px;
    display: none;
}

/* === CARTAS === */
.saludo {
    color: #ffd700;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.instruccion {
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.grid-cartas {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    .grid-cartas {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
}

@media (max-width: 450px) {
    .grid-cartas {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.carta {
    aspect-ratio: 3/4;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.carta.desactivada {
    cursor: not-allowed;
    opacity: 0.7;
}

.carta-interior {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #fff;
}

.carta.volteada .carta-interior {
    transform: rotateY(180deg);
}

.carta-frente, .carta-atras {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.carta-frente {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border: 3px solid #e5e5e5;
}

.logo-carta {
    width: 85%;
    height: auto;
    object-fit: contain;
}

.carta-atras {
    background: #fff;
    transform: rotateY(180deg);
    flex-direction: column;
    border: 3px solid #ffd700;
}

.texto-premio {
    font-size: 11px;
    font-weight: 700;
    color: #1e3c72;
    text-align: center;
    line-height: 1.3;
}

.texto-premio.ganado {
    color: #28a745;
    font-weight: 900;
}

/* === RESULTADO === */
.resultado {
    margin-top: 25px;
    padding: 20px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #1e3c72;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.resultado.visible {
    opacity: 1;
    transform: translateY(0);
}

.estado {
    color: #ffd700;
    margin-top: 15px;
    font-size: 15px;
    text-align: center;
}

/* === PANEL ADMIN === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

th, td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

th {
    background: #1e3c72;
    color: #fff;
    font-weight: 700;
}

tr:nth-child(even) {
    background: #f4f4f4;
}

/* === MODAL === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-contenido {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
}

.modal-contenido h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.modal-contenido input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.botones-modal {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
