:root {
    --bg-overlay: rgba(44, 24, 16, 0.6);
    --bg-modal: #FDFBF7;
    --bg-panel: #FFFFFF;
    --text-primary: #2C1810;
    --text-secondary: #6D5E57;
    --brand-primary: #8D6E63;
    --brand-dark: #5D4037;
    --brand-accent: #A1887F;
    --border-color: #D7CCC8;
    --danger: #D32F2F;
    --success: #388E3C;
    --link: #0645AD;
    --input-bg: #FFFFFF;
    --paper: #f7f3e9;
    --ink: #222;
    --font-serif: "Playfair Display", Georgia, serif;
    --font-sans: "Lato", Arial, sans-serif;
}



#titles-section {
    display: none;
    margin-top: 20px;
}

#category-search {
    margin: 15px 0 20px 0;
    display: flex;
}

.search-wrapper {
    position: relative;
    display: inline-block;
}

.category-item {
    min-height: 62px;
}

#back-button {
    min-height: auto;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#category-input {
    padding: 10px 15px 10px 38px;
    font-size: 16px;
    border-radius: 25px;
    border: 1px solid #fff;
    outline: none;
    width: 238px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    transition: box-shadow .08s ease, border-color .08s ease;
}

#category-input:focus {
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.625);
}

#practice-modes {
    display: flex;
}

#practice-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 250px;
    text-align: center;
    padding: 0;
    gap: 20px;
}

.mcq-question,
.main_question {
    background: transparent;
    width: 100%;
    margin: 40px 0 5px 0;
    padding: 0;
    text-align: center;
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.mcq-word {
    font-weight: 600;
    font-style: italic;
    font-size: 1.1em;
    color: #2a2a2a;
    letter-spacing: 0.5px;
}

.popup {
    font-family: var(--font-sans);
}

.practice-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 16px;
    font-weight: bold;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
}


#checkspelling {
    position: absolute;
    top: 10%;
}

.checkspelling_typed_word {
    border: none;
    border-bottom: 2px solid black;
    outline: none;
    font-size: inherit;
    font-family: inherit;
    box-sizing: content-box;
    transition: width 0.2s ease;
    background-color: transparent;
    font-size: 1.2em;
    padding-left: 5px;
    text-align: center;
    position: static;
    width: auto;
    margin-top: 10px;
    margin-bottom: 20px;

}

.spelling-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 16px;
    font-weight: bold;
}


.volume-toggle {
    position: absolute;
    top: 10%;
    right: 2%;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2000;
    color: var(--brand-dark);
    padding: 5px;
    border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
}



#markdown-title,
.popup .markdown-title {
    display: none !important;
}

.lesson-title-prefix,
.lesson-title-main {
    display: block;
    font-weight: 600;
    line-height: 1.25;
    font-size: 0.8rem;
}

.lesson-title-note {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}


.keyboard-special-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.key-spacebar {
    flex-grow: 1;
}

.key-backspace {
    flex-basis: 90px;
    flex-grow: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.key-backspace svg {
    width: 28px;
    height: 28px;
    pointer-events: none;
}

@media (max-width: 600px) {
    .mcq-options {
        grid-template-columns: 1fr !important;
    }

    .option-btn {
        width: fit-content;
    }
}

.spelling-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 40px auto 60px auto;
    width: 80%;
    max-width: 400px;
}

.spelling-input-wrapper .checkspelling_typed_word {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #E0E0E0;
    border-radius: 0;
    padding: 10px 40px 10px 10px;
    font-family: var(--font-serif);
    font-size: 2.2rem;
    color: var(--brand-dark);
    text-align: center;
    transition: border-color 0.3s ease, transform 0.2s ease;
    box-shadow: none;
}

.spelling-input-wrapper .checkspelling_typed_word:focus {
    border-bottom-color: var(--brand-primary);
    outline: none;
}

.keyboard-toggle {
    position: absolute;
    right: 0;
    bottom: 15px;
    transform: none;
    top: auto;
    color: #A1887F;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    background: transparent;
    border: none;
}

.keyboard-toggle:hover {
    opacity: 1;
    color: var(--brand-dark);
}

.spelling-actions {
    display: flex;
    justify-content: end;
    margin-top: 120px;
    margin-right: 60px;
    width: 100%;
}


@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}



.keyboard-special-row {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    max-width: 600px;
}

.key-spacebar {
    flex-grow: 2;
    font-size: 1rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    max-width: none;
}

.key-special {
    background: #E0E4E9;
    box-shadow: 0 1px 0px #bdc1c6;
}

/* Container: Warm background instead of generic gray */
.checkspelling_keyboard {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 10px 25px 10px;
    background: var(--bg-modal);
    /* Matches your modal background */
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    z-index: 100;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Keys: White "tiles" with warm brown text and shadows */
.checkspelling_keyboard_keys {
    flex: 1 0 8.5%;
    max-width: 48px;
    height: 54px;
    background: #FFFFFF;
    border: 1px solid transparent;
    /* This creates a warm, high-quality tactile depth */
    box-shadow: 0 3px 0 var(--border-color), 0 2px 5px rgba(93, 64, 55, 0.1);
    border-radius: 8px;
    font-family: var(--font-serif);
    /* Use your serif font */
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transition: all 0.1s ease;
    cursor: pointer;
}

.checkspelling_keyboard_keys:active {
    background: #FDFBF7;
    transform: translateY(3px);
    box-shadow: none;
}

.checkspelling_keyboard_keys:disabled {
    opacity: 0.4;
    box-shadow: none;
    background: #f4f4f4;
    transform: translateY(3px);
    color: var(--text-secondary);
}

.key-spacebar {
    font-size: 0.9rem;
    font-family: var(--font-sans);
    letter-spacing: 1px;
    color: var(--brand-accent);
    text-transform: uppercase;
    font-weight: 700;
    padding: 0px 100px;
}

.key-backspace {
    background-color: #fff;
    color: var(--brand-dark);
}

.key-backspace:active {
    color: var(--danger);
    background-color: #fff0f0;
}

.key-backspace svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5px;
}