.academix-quiz-cards {
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.status-message {
    display: none;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    text-align: center;
    animation: messageSlideIn 0.3s ease-out;
    min-height: 56px; /* Altura fija para evitar saltos */
}

.status-message.visible {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-message.success {
    color: #03543F;
}

.status-message.error {
    color: #92400E;
}

.success-message,
.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 100vw;
    font-weight: 500;
    width: 100%;
    max-width: 700px;
}

.message-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.message-icon svg {
    width: 100%;
    height: 100%;
}

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

/* Contenedor principal - Flexbox para mejor control */
.quiz-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Estilos base para cards */
.quiz-card {
    position: relative;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto; /* No crecer o encoger */
    min-width: 250px;
    width: 320px; /* Ancho por defecto */
    max-width: 100%; /* Nunca superar el ancho del contenedor */
}

/* Configuraciones específicas para número de cards por fila */
.cards-per-row-1 .quiz-card {
    width: 100%;
    max-width: 600px;
}

.cards-per-row-2 .quiz-card {
    width: calc(50% - 1rem);
    max-width: 480px;
}

.cards-per-row-3 .quiz-card {
    width: calc(33.333% - 1.5rem);
    max-width: 400px;
}

.cards-per-row-4 .quiz-card {
    width: calc(25% - 1.5rem);
    max-width: 320px;
}

.quiz-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.12);
}

.quiz-card-content {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex: 1;
}

.quiz-card-imagen {
    margin-bottom: 1.5rem;
}

.quiz-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    object-fit: cover;
    aspect-ratio: 16/9;
}

.quiz-card-info {
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.quiz-card-titulo {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
    text-wrap: balance;
    -webkit-text-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.quiz-card-texto {
    font-size: 1rem;
    line-height: 1.5;
    color: #666;
    margin-bottom: 1rem;
    text-wrap: balance;
    -webkit-text-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.quiz-card-respuesta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
}

.quiz-card-preguntas {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-card-question {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-card-question-additional {
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.quiz-card-pregunta-texto {
    margin-bottom: 0;
}

.quiz-card-pregunta-texto > :last-child {
    margin-bottom: 0;
}

.respuesta-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.respuesta-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: all 0.2s ease;
}

.respuesta-input:focus {
    outline: none;
    border-color: #385DFF;
    box-shadow: 0 0 0 2px rgba(56, 93, 255, 0.2);
}

.respuesta-input.success {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.05);
}

.respuesta-input.error {
    border-color: #F44336;
    background-color: rgba(244, 67, 54, 0.05);
}

/* Añadir estilo para el estado "aria-invalid" de accesibilidad */
.respuesta-input[aria-invalid="true"] {
    border-color: #F44336;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.1);
}

.feedback-icon {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
}

.feedback-icon.success {
    color: #4CAF50;
}

.feedback-icon.error {
    color: #F44336;
}

.mensaje-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mensaje-exito, .mensaje-error {
    display: none;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    flex-direction: column;
    -webkit-text-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mensaje-exito {
    background-color: rgba(76, 175, 80, 0.1);
    color: #2E7D32;
    flex-direction: row !important;
    align-items: center !important;
}

.mensaje-error {
    background-color: rgba(244, 67, 54, 0.1);
    color: #C62828;
    gap: 0.5rem;
}

.mensaje-error-contenido {
    display: flex;
    align-items: center;
    width: 100%;
}

.mensaje-error-texto {
    margin-left: 0.5rem;
    font-weight: 500;
}

.mensaje-exito svg, .mensaje-error svg {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.respuesta-correcta-contenedor {
    background-color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #C62828;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    display: flex;
    flex-direction: column;
    width: 100%;
    line-height: 1.4;
    -webkit-text-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.respuesta-correcta-etiqueta {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
}

.respuesta-correcta-valor {
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.comprobar-btn, .reiniciar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    background-color: #385DFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comprobar-btn:hover, .reiniciar-btn:hover {
    background-color: #2D4CD7;
    transform: translateY(-2px);
}

.comprobar-btn:disabled, .reiniciar-btn:disabled {
    background-color: #A0AEC0;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* Agregar efecto de enfoque para accesibilidad por teclado */
.comprobar-btn:focus, .reiniciar-btn:focus, .respuesta-input:focus {
    outline: 2px solid #385DFF;
    outline-offset: 2px;
}

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* Estilos para accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.feedback-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Adaptaciones responsivas */
@media (max-width: 767px) {
    .quiz-cards-container {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
    }

    .quiz-card {
        width: 100%;
        max-width: 100%;
    }

    .quiz-card-content {
        padding: 1rem;
    }
    
    .quiz-card-titulo {
        font-size: 1.25rem;
    }
    
    .comprobar-btn, .reiniciar-btn {
        width: 100%;
    }
    
    /* Mejoras para mensaje de error en móvil */
    .mensaje-error, .mensaje-exito {
        padding: 0.75rem 0.75rem;
    }
    
    .respuesta-correcta-contenedor {
        padding: 0.5rem 0.625rem;
        margin-left: 0;
        width: 100%;
    }
    
    /* En móvil, ignorar configuraciones específicas de cards por fila */
    .cards-per-row-2 .quiz-card,
    .cards-per-row-3 .quiz-card,
    .cards-per-row-4 .quiz-card {
        width: 100%;
        max-width: 100%;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .cards-per-row-auto .quiz-card {
        width: calc(50% - 1rem);
        max-width: 480px;
    }
}

/* Desktop */
@media (min-width: 1024px) and (max-width: 1279px) {
    .cards-per-row-auto .quiz-card {
        width: calc(33.333% - 1.5rem);
        max-width: 400px;
    }
}

/* Large screens */
@media (min-width: 1280px) {
    .cards-per-row-auto .quiz-card {
        width: calc(25% - 1.5rem);
        max-width: 320px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.feedback-icon.error {
    animation: shake 0.5s ease-in-out;
}

.feedback-icon.success {
    animation: fadeIn 0.3s ease-in-out;
} 
/* Flip de imagen (opcional) */
.flip-image-enabled .quiz-card-imagen {
    position: relative;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.flip-image-enabled .quiz-card-imagen img,
.flip-image-enabled .quiz-card-imagen .quiz-card-cover {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    /* la animación principal vive en el contenedor */
    transition: none;
}

.flip-image-enabled .quiz-card-imagen .quiz-card-cover {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 8px;
    background: var(--quiz-card-cover-color, #e5e7eb);
    transform: rotateY(0deg);
    pointer-events: none;
    opacity: 1;
}

.flip-image-enabled .quiz-card-imagen img {
    transform: rotateY(180deg);
}

.flip-image-enabled .quiz-card-imagen.revealed {
    transform: rotateY(180deg);
}

.flip-image-enabled .quiz-card-imagen.revealed .quiz-card-cover {
    transform: rotateY(180deg);
    opacity: 0;
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .flip-image-enabled .quiz-card-imagen {
        transition: none;
    }
}
