/* --- (Mismos estilos de body, h1, top-controls, card-container, #card-counter, .flashcard, .flashcard-inner) --- */
body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-color: #e0f7fa;
    color: #333;
    padding: 25px 20px 50px 20px;
    box-sizing: border-box;
}

h1 {
    color: #00796b;
    margin-bottom: 20px;
    text-align: center;
}

.top-controls {
    margin-bottom: 25px;
    text-align: center;
}

.top-controls button {
    padding: 8px 15px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #607d8b;
    color: white;
    transition: background-color 0.2s;
}
.top-controls button:hover {
    background-color: #455a64;
}
.top-controls button.active {
    background-color: #ef5350;
}


.card-container {
    position: relative;
    width: 350px;
    height: 220px; /* La altura puede necesitar ajuste si la imagen es grande */
    margin-bottom: 20px;
    perspective: 1000px;
}

#card-counter {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9em;
    color: #00796b;
    background-color: #b2ebf2;
    padding: 3px 8px;
    border-radius: 5px;
    z-index: 10;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-radius: 15px;
}

.flashcard.is-flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background-color: #ffffff;
    border: 2px solid #00acc1;
    border-radius: 15px;
    padding: 15px; /* Reducir padding para dejar espacio a imagen */
    box-sizing: border-box;
    text-align: center;
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column; /* Cambiado para apilar imagen y texto */
    justify-content: center; /* Centrar verticalmente el contenido */
    align-items: center;
}

.card-front {
    font-size: 3em;
    font-weight: bold;
    color: #d84315 !important;
    line-height: 1.2;
    /* flex ya centra el texto */
}

.card-back {
    /* font-size: 1.4em; No aplicar aquí, aplicar a #frase */
    color: #424242 !important;
    transform: rotateY(180deg);
    justify-content: space-around; /* Distribuir espacio entre imagen y texto */
}

/* NUEVO: Contenedor de la imagen */
.image-container {
    width: 100%;
    /* Altura flexible, o fija si prefieres */
    /* height: 100px; */
    margin-bottom: 10px; /* Espacio debajo de la imagen */
    display: flex; /* Para centrar la imagen si es más pequeña */
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Evita que el contenedor se encoja */
}

/* NUEVO: Estilos para la imagen */
#card-image {
    display: none; /* Oculta por defecto, JS la mostrará */
    max-width: 100%; /* Asegura que no se salga del contenedor */
    max-height: 100px; /* Altura máxima para la imagen, AJUSTA SEGÚN NECESITES */
    height: auto; /* Mantiene proporción */
    object-fit: contain; /* Escala la imagen manteniendo proporciones */
    border-radius: 5px; /* Opcional: bordes redondeados */
}

/* Párrafo de la frase */
.card-back #frase {
    font-size: 1.3em; /* Tamaño de la frase */
    margin: 0;
    padding: 5px;
    flex-grow: 1; /* Permite que ocupe espacio restante si es necesario */
    overflow-y: auto; /* Scroll si la frase es muy larga */
}


/* Estilos de Marcado */
.flashcard.correct .card-face {
    background-color: #c8e6c9;
    border-color: #4caf50;
}
.flashcard.incorrect .card-face {
    background-color: #ffcdd2;
    border-color: #f44336;
}

/* Controles de marcado */
.marking-controls {
    display: flex;
    justify-content: center;
    gap: 50px;
    width: 100%;
    margin-top: 15px; /* Espacio ARRIBA de los botones X/V */
    margin-bottom: 25px;
}

.marking-controls button {
    font-size: 2em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    line-height: 1;
    transition: transform 0.2s ease, background-color 0.2s;
}
.marking-controls button:hover {
    transform: scale(1.15);
    background-color: rgba(0, 0, 0, 0.05);
}
#mark-incorrect-button:active {
    color: #f44336;
}
#mark-correct-button:active {
     color: #4caf50;
}


/* Controles inferiores */
.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.controls button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #00acc1;
    color: white;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1;
    margin: 5px;
}
.controls button:hover {
    background-color: #00838f;
}
.controls button:active {
    transform: scale(0.98);
}

#flip-button {
    background-color: #ff8f00;
}
#flip-button:hover {
    background-color: #e65100;
}

#audio-button {
    background-color: #4caf50;
    font-size: 1.5em;
    padding: 8px 12px;
}
#audio-button:hover {
    background-color: #388e3c;
}