/* ==================
   Estilos Generales y Nueva Paleta
   ================== */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --header-height: 120px;
    --font-body: 'Baloo 2', cursive;
    --font-heading: 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #f0f2f5;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
        url('assets/images/ui/background-main.png');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

h1,
h2,
h3,
.rule-title,
.start-button,
.start-exam-button,
.review-errors-button,
.start-selected-button {
    font-family: var(--font-heading);
    font-weight: 700;
}

.hidden {
    display: none !important;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ==================
   PANTALLA DE BIENVENIDA
   ================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(240, 242, 245, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    background-color: white;
    padding: 3rem 4rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

.splash-logo {
    height: 100px;
    margin-bottom: 1.5rem;
}

.splash-content h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: 2rem;
}

.music-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.music-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.music-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.start-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 4rem;
    font-size: 1.5rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.25);
}

.start-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.35);
}

/* ==================
   CABECERA GLOBAL (MODIFICADA)
   ================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;

    /* --- CAMBIOS AQUÍ --- */
    background: rgba(255, 255, 255, 0.1);
    /* Fondo blanco con 80% de opacidad */
    backdrop-filter: blur(100px);
    /* Efecto de desenfoque para lo que está detrás */
    -webkit-backdrop-filter: blur(10px);
    /* Para compatibilidad con Safari */

    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    /* Borde también semitransparente */
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .logo-img {
    height: 100px;
    width: auto;
}

.icon-button {
    background: #eef2ff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.icon-button:hover {
    background: #e0e7ff;
    transform: scale(1.1);
}

.icon-button svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.view {
    padding-top: var(--header-height);
}


/* ==================
   Contenido Principal y Disposición
   ================== */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.main-logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.main-logo-container .logo-img {
    height: 220px;
    width: auto;
}

.welcome-card {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.welcome-card p {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.start-actions-container {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.exam-action-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 500px;
}

.review-errors-button {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
    width: 100%;
    max-width: 450px;
}

.review-errors-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(245, 158, 11, 0.4);
}

.start-exam-button {
    flex-grow: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.25);
}

.start-exam-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(139, 92, 246, 0.35);
}

.icon-button {
    background: #eef2ff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.icon-button:hover {
    background: #e0e7ff;
    transform: scale(1.1);
}

.icon-button svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2.5rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before {
    margin-right: 1em;
}

.divider:not(:empty)::after {
    margin-left: 1em;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.rule-card {
    background-color: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    position: relative;
    text-align: center;
}

.rule-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.08);
}

.rule-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.rule-title {
    font-size: 1.25rem;
}

.rule-card.selected {
    border-color: var(--primary-color);
    transform: translateY(-6px);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.2);
}

.rule-card.selected::after {
    content: '✔';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
}

.start-practice-container {
    margin-top: 2rem;
    text-align: center;
}

.start-selected-button {
    background-color: var(--primary-dark);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.2);
    width: 100%;
    max-width: 450px;
}

.start-selected-button:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.start-selected-button.hidden {
    display: none;
}

.vocabulary-button {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    width: 100%;
    max-width: 450px;
}

.vocabulary-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(16, 185, 129, 0.4);
}

/* Estilos para la cabecera de la nueva vista de vocabulario */
.vocabulary-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.vocabulary-header .back-button {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    font-size: 1rem;
}

.vocabulary-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.vocabulary-header p {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}


.external-link-container {
    text-align: center;
    margin-top: 4rem;
}

.external-link-button {
    display: inline-block;
    background-color: var(--success-color);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
    transition: all 0.3s ease;
}

.external-link-button:hover {
    background-color: #059669;
    transform: translateY(-3px);
}

/* ==================
   Vista de Ejercicio
   ================== */
.exercise-header-content {
    max-width: 100%;
    margin: 0;
    padding: 1rem 1.5rem;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.exercise-content {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.exercise-card {
    background-color: white;
    padding: 2rem;
    position: relative;
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    padding-top: 4rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background 0.2s;
}

.back-button:hover {
    background: #f1f5f9;
}

.exercise-title {
    flex-grow: 1;
    text-align: center;
    font-size: 1.2rem;
    font-family: var(--font-heading);
}

.hearts {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    display: flex;
    gap: 0.5rem;
    font-size: 1.8rem;
}

.exercise-image-container {
    margin: 2rem auto 1.5rem auto;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.exercise-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.question-title {
    font-size: 1.8rem;
    font-family: var(--font-heading);
    margin-bottom: 2rem;
    text-align: center;
}

.word-display {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
}

.blank-input {
    width: 80px;
    height: 90px;
    font-size: 4rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--primary-color);
    border: none;
    border-bottom: 4px dotted var(--primary-dark);
    text-align: center;
    background: transparent;
    outline: none;
    margin: 0 0.5rem;
    line-height: 1;
}

.word-to-classify-display {
    font-size: 3.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.jumbled-letters-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    letter-spacing: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #eef2ff;
    border-radius: 8px;
}

.text-answer-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-body);
}

.text-answer-input:focus {
    border-color: var(--primary-color);
}

.sentence-container {
    font-size: 1.5rem;
    color: var(--text-dark);
    text-align: center;
    line-height: 2;
    margin-bottom: 1.5rem;
}

.sentence-input {
    width: 150px;
    font-size: 1.5rem;
    border: none;
    border-bottom: 3px solid var(--primary-color);
    text-align: center;
    background: transparent;
    outline: none;
    margin: 0 0.5rem;
    font-family: var(--font-body);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-button.selected {
    background: #eef2ff;
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.option-button.multi-selected {
    background: #dbeafe;
    /* Un azul un poco más oscuro */
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px var(--primary-dark);
}





.option-button {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
    transition: all 0.2s;
}

.option-button:hover {
    border-color: #9ca3af;
}

.option-button.selected {
    background: #eef2ff;
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.option-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-button.correct {
    background-color: #dcfce7;
    border-color: var(--success-color);
}

.option-button.incorrect {
    background-color: #fee2e2;
    border-color: var(--error-color);
    opacity: 1;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.2s;
}

.hint-button {
    background: #fef3c7;
    color: #92400e;
}

.hint-button:hover {
    background: #fde68a;
}

.hint-box {
    background: #fef9c3;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 5px 5px 0;
}

.hint-text {
    color: #92400e;
    font-weight: 500;
}

.feedback-container {
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.feedback-container.correct {
    background: #dcfce7;
    border-left: 5px solid var(--success-color);
}

.feedback-container.incorrect {
    background: #fee2e2;
    border-left: 5px solid var(--error-color);
}

.feedback-title {
    font-size: 1.2rem;
    font-family: var(--font-heading);
}

.feedback-title.correct {
    color: #166534;
}

.feedback-title.incorrect {
    color: #b91c1c;
}

.feedback-explanation {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: #991b1b;
}

.action-button {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.2s;
}

.check-button {
    background: var(--primary-color);
    color: white;
}

.check-button:hover:not(:disabled) {
    background: var(--primary-dark);
}

.check-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.next-button {
    background: var(--success-color);
    color: white;
}

.next-button:hover {
    background: #059669;
}

/* ==================
   PANTALLA DE RESUMEN FINAL
   ================== */
.completion-screen {
    text-align: left;
    padding: 1rem;
}

.completion-screen h2 {
    text-align: center;
    color: var(--text-dark);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.completion-summary {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.score-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.score-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
}

.score-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.progress-bar {
    width: 100%;
    height: 16px;
    background-color: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success-color);
    border-radius: 8px;
    transition: width 0.5s ease-in-out;
}

.failed-rules-section {
    margin-top: 1.5rem;
}

.failed-rules-section h3 {
    font-size: 1.1rem;
    color: var(--error-color);
    margin-bottom: 0.5rem;
}

.failed-rules-list {
    list-style-type: '❌';
    padding-left: 1.5rem;
}

.failed-rules-list li {
    padding-left: 0.5rem;
    margin-bottom: 0.25rem;
    color: var(--text-light);
}

.review-section {
    margin-top: 2rem;
}

.review-section h3 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.review-item {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-item p {
    margin: 0;
    font-size: 1rem;
}

.review-question {
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.review-answer {
    padding-left: 1rem;
}

.review-answer .correct {
    color: #166534;
}

.review-answer .incorrect {
    color: var(--error-color);
}

@media (max-width: 768px) {
    .main-logo-container .logo-img {
        height: 100px;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .word-display {
        font-size: 2.5rem;
    }

    .blank-input {
        width: 50px;
        height: 60px;
        font-size: 2.5rem;
    }

    .welcome-card h2 {
        font-size: 1.5rem;
    }

    .exercise-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .main-logo-container .logo-img {
        height: 80px;
    }

    .main-content,
    .exercise-content {
        padding: 1.5rem 1rem;
    }

    .welcome-card,
    .exercise-card {
        padding: 1.5rem;
    }

    .option-button {
        font-size: 1.1rem;
    }
}