/* GLOBAL RESET */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a202c; 
    color: #a0aec0; 
    margin: 0;
    padding: 0; 
    /* CHANGED: display block allows the footer to follow naturally below the container */
    display: block; 
    min-height: 100vh;
    height: auto !important;
    overflow-y: auto !important;
}

:root {
    --very-dark-blue: #2d3748;
    --subtle-dark-blue: #4a5568; 
    --subtle-dark-blue-hover: #556477;
    --primary-accent: #63b3ed;
    --secondary-accent: #f6ad55;
    --text-highlight: #a0aec0;
    --nepali-crimson: #A52A2A;
    --default-grey: #4a5568;
    --grey-hover: #556477;
    --submit-green: #38a169;
    --reveal-yellow: var(--secondary-accent);
    --incorrect-orange: #e53e3e;
}

/* --- QUIZ CONTAINER --- */
.quiz-container {
    background: var(--very-dark-blue); 
    max-width: 500px;
    width: 95%;
    border-radius: 0 0 8px 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
    border: 2px solid #2b3a67;
    padding: 0.8em 1em 1em 1em;
    text-align: center;
    /* CHANGED: margin: auto centers the container without needing Flexbox on the body */
    margin: 0 auto 40px auto; 
    height: auto;
}

/* --- BOTTOM INFO CONTAINER (Holds title and checkboxes) --- */
.bottom-info-container {
    display: flex;
    justify-content: center; 
    align-items: center; 
    gap: 20px;
    margin-top: 1.5em; 
    padding-top: 0.5em;
    border-top: 1px solid var(--subtle-dark-blue);
    flex-wrap: wrap; 
}

#bottom-left-title {
    font-size: 0.9rem; 
    color: var(--primary-accent);
    text-align: left;
    flex-grow: 1;
    white-space: nowrap;
}

.checkbox-container {
    display: flex;
    justify-content: center; 
    gap: 15px;
    color: #ffffff;
    flex-wrap: nowrap;
}

.checkbox-container label {
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* --- HEADER NAVIGATION --- */
.header-nav-container {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5em;
    margin-top: 0.3em; 
    flex-wrap: wrap;
}

.header-nav-container #search-input {
    flex-grow: 1;
    min-width: 100px;
    padding: 0.7em 0.8em;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    background-color: transparent;
    color: #e0e0e0;
    height: 44px;
}

.header-nav-container #search-input::placeholder {
    color: #ffffff; 
    opacity: 1; 
}

.header-nav-container select {
    padding: 0.7em 0.8em;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    background-color: var(--very-dark-blue); 
    color: #ffffff; 
    cursor: pointer;
    flex-shrink: 0;
    width: auto;
    height: 44px;
    min-width: 90px;
    text-align: left;
}

#english-mode-btn {
    padding: 0.7em 1em;
    background-color: var(--nepali-crimson); 
    border: 1px solid #3182ce; 
    color: #f0f0f0; 
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    flex: none; 
    width: 60px; 
    height: 44px;
    text-align: center;
}

#english-mode-btn:hover {
    opacity: 0.85;
}

/* --- CARD CONTENT --- */
.card {
    background: #ffffff; 
    border-radius: 6px;
    padding: 0.5em 1em 1em 1em;
    margin-bottom: 1em;
}

.card #question {
    font-size: 2.8rem;
    font-weight: 600;
    color: #1a202c; 
    margin-bottom: 0.5em;
}

/* 🚀 Answer (The Nepali word) 🚀 */
#answer {
    color: #77aaff !important; 
    font-size: 3.5em; 
    font-family: 'Noto Sans Devanagari', 'Arial Unicode MS', sans-serif; 
    text-align: center;
    font-weight: 700;
    margin-top: 0.5em;
    padding: 10px 0; 
}

/* 🎯 Feedback (The "Correct | सही" message) 🎯 */
#feedback {
    margin-top: 0.5em;
    font-size: 1.5rem; 
    color: #77aaff;
    font-weight: 700;
}

#feedback.incorrect {
    color: var(--incorrect-orange);
}

.input-action-row {
    display: flex;
    gap: 0.4em;
    margin: 0.8em 0;
    align-items: flex-start;
    min-width: 0;
}

.input-action-row input[type="text"] {
    flex: 1;
    padding: 0.6em;
    border: 1px solid var(--nepali-crimson); 
    border-radius: 6px;
    background-color: #FFFFFF; 
    color: #000000;
    caret-color: #000000; 
    min-height: 44px;
    font-size: clamp(1rem, 2.5vw, 2em);
    min-width: 0;
}

.input-action-row .button-group {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    flex-shrink: 0;
}

.input-action-row button {
    padding: 0.5em 0.7em;
    font-size: 0.85rem;
    min-height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.input-action-row .submit-button:not(.reveal) {
    background-color: var(--submit-green); 
    color: #1a202c; 
}

.submit-button.reveal {
    background-color: var(--secondary-accent); 
    color: #1a202c; 
}

.submit-button:hover {
    opacity: 0.85;
}

.multiple-choice-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 1em 0;
    border: 2px solid var(--subtle-dark-blue); 
    border-radius: 6px;
    padding: 0.5em;
}

.multiple-choice-container button {
    background-color: #ffffff; 
    color: #1a202c; 
    border-radius: 6px;
    padding: 0.6em;
    font-size: clamp(1rem, 4vw, 1.6rem);
    cursor: pointer;
    min-height: 40px;
    word-break: break-word;
    white-space: normal;
    border: none; 
}

.multiple-choice-container button:hover {
    background-color: #e0e0e0; 
}

.bottom-nav-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 1em;
    width: 100%;
}

.nav-button {
    background-color: var(--default-grey); 
    border: 2px solid #ffffff;
    color: #f0f0f0;
    padding: 0.6em 1em;
    border-radius: 6px;
    cursor: pointer;
    min-height: 44px;
    flex: 1;
}

.nav-button:hover {
    background-color: var(--grey-hover);
}

.search-results-container {
    background: var(--very-dark-blue); 
    width: 100%;
    padding: 0;
    text-align: left;
}

#search-results-list {
    list-style: none;
    padding: 0;
    margin: 0.5em 0 1em 0;
    max-height: 300px;
    overflow-y: auto;
}

#search-results-list li {
    background-color: var(--subtle-dark-blue); 
    padding: 0.7em;
    margin-bottom: 0.5em;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    border-left: 4px solid var(--primary-accent); 
    padding-left: calc(0.7em - 4px);
    color: #ffffff; 
}

@media (max-width: 450px) {
    .header-nav-container {
        flex-wrap: wrap;
        gap: 5px;
    }

    .header-nav-container #search-input {
        flex-basis: 100%;
        order: 1;
    }
    
    .header-nav-container select {
        flex-basis: calc(50% - 3px);
        min-width: unset;
        order: 2;
    }
    
    #english-mode-btn {
        flex-basis: auto;
        order: 3;
        width: 60px; 
    }
    
    .bottom-nav-container {
        gap: 5px;
    }

    .input-action-row .button-group {
        flex-direction: column;
        gap: 0.2em;
    }

    .input-action-row button {
        flex: none;
        min-width: 38px;
        min-height: 34px;
        font-size: 0.7rem;
        padding: 0.4em 0.6em;
    }
    
    .bottom-info-container {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    #bottom-left-title {
        order: 1;
    }
    
    .checkbox-container {
        justify-content: center;
        order: 2;
        margin-top: 5px;
    }
}

.hidden {
    display: none;
}

#quiz-content {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.slide-out-left { transform: translateX(-100%); opacity: 0; }
.slide-out-right { transform: translateX(100%); opacity: 0; }
.slide-in-right { transform: translateX(100%); opacity: 0; }
.slide-in-left { transform: translateX(-100%); opacity: 0; }

/* --- TRACKER --- */
.tracker-container {
    display: flex;
    flex-direction: column;
    align-items: center; 
    margin-top: 1em;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.tracker-container table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    color: #a0aec0;
}

.tracker-container th,
.tracker-container td {
    padding: 6px 10px;
    font-size: 1rem;
}

.tracker-container th {
    font-weight: 600;
}

.lang-col {
    text-align: left;
    font-weight: 500;
}

.score-col {
    font-weight: 500;
}

.correct-col span {
    color: #4ade80;
    font-weight: 600;
}

.incorrect-col span {
    color: #f87171;
    font-weight: 600;
}

.tracker-container .total-row {
    font-weight: 700;
}

.about-section {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #a0aec0;
    font-size: 0.9rem;
}

.about-toggle {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    transition: opacity 0.2s ease;
}

.about-toggle:hover {
    opacity: 0.7;
}

.about-content {
    margin-top: 10px;
    padding: 10px;
    line-height: 1.4;
}

.question-audio-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#question {
    display: inline-block;
}