/* 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; 
    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;
    margin: 0 auto 5px auto; 
    height: auto;
}

/* --- BOTTOM INFO CONTAINER --- */
.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;
    display: inline-block;
}

.question-audio-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tts-button {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 1rem;
}

#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 {
    margin-top: 0.5em;
    font-size: 1.5rem; 
    color: #77aaff;
    font-weight: 700;
}

#feedback.incorrect {
    color: var(--incorrect-orange);
}

/* --- INPUTS & BUTTONS --- */
.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;
}

.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 --- */
.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; }

/* --- NAVIGATION & SEARCH --- */
.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); 
    color: #ffffff; 
}

/* --- TRACKER TABLE --- */
.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; }

/* --- ANIMATIONS --- */
#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; }

/* --- FOOTER & EXTERNAL LINKS (NO UNDERLINE FIX) --- */
.safe-board-container {
    text-align: center;
    margin: 20px 0 10px 0;
    padding: 10px;
}

.safe-board-link {
    color: var(--primary-accent) !important;
    text-decoration: none !important; /* Forced removal */
    font-size: 1.1rem;
    border: 1px solid var(--subtle-dark-blue);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    background: rgba(45, 55, 72, 0.3);
}

.link-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.extra-link {
    color: var(--primary-accent) !important;
    text-decoration: none !important; /* Forced removal */
    font-size: 1rem;
}

.extra-link:hover, .safe-board-link:hover {
    text-decoration: underline !important;
}

.about-section {
    text-align: center;
    margin: 20px auto;
    padding: 10px;
    color: #a0aec0;
    font-size: 0.9rem;
    max-width: 500px;
    border-top: 1px solid var(--subtle-dark-blue);
}

.about-content {
    margin-top: 10px;
    padding: 10px;
    line-height: 1.6;
    display: block !important;
}

/* --- UTILITY & MEDIA --- */
.hidden { display: none !important; }

@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 { font-size: 0.7rem; padding: 0.4em 0.6em; }
    .bottom-info-container { flex-direction: column; align-items: center; gap: 5px; }
}