.mt-container {
    max-width: 500px;
    background-color: #fff;
    padding: 1rem 1.5rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    margin: 1rem auto 3rem;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    position: relative;
}

.mt-container.result-view {
    max-width: 450px;
}

.mt-text-title {
    font-size: 1.875rem;
    font-weight: 500;
    color: #1f2937;
    text-align: center;
    margin-bottom: 1.5rem;
    margin-top: 0;
}

.mt-section-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mt-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mt-label {
    font-weight: 500;
    color: #374151;
    font-size: 17px;
}

.mt-container .mt-input-field,
.mt-container .mt-select-field {
    padding: 8px;
    border: 1px solid #d4d6db;
    border-radius: 0.375rem;
    outline: none;
    font-size: 16px;
    color: #26344d;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background-color: #fff;
    /* Ensure default background is white */
}

/* Custom arrow for select dropdown */
.mt-select-field {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

.mt-container input[type="number"]:hover,
    .mt-container input[type="number"]:active,
    .mt-container input[type="number"]:focus,
    .mt-container select:hover,
    .mt-container select:active,
    .mt-container select:focus {
        background-color: #fff;
        border-color: #4a6cf7;
        box-shadow: 0 0 0 1px rgba(74, 108, 247, 0.1);
        outline: none;
    }

.mt-container .mt-answer-input {
    border-radius: 0.375rem;
}

.mt-error-message {
    color: #ef4444;
    font-size: 15px;
    margin-top: 4px;
}

.mt-select-field:hover {
    cursor: pointer;
}


/* Hides the spinners on number input fields */
.mt-container input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.mt-container input[type="number"]::-webkit-inner-spin-button,
.mt-container input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mt-hidden {
    display: none;
}

.mt-btn {
    font-weight: 500;
    padding: 8px 13px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: background-color 0.2s ease, transform 0.2s ease;
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.mt-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mt-btn-blue {
    background-color: #2563eb;
}

.mt-btn-blue:hover,
.mt-btn-blue:active,
.mt-btn-blue:focus {
    background-color: #2563eb;
    /* Keep original color */
}

.mt-btn:active {
    transform: scale(0.98);
}

.mt-btn-green {
    background-color: #068736;
}

.mt-btn-green:hover,
.mt-btn-green:active,
.mt-btn-green:focus {
    background-color: #068736;
    /* Keep original color */
}

.mt-btn-gray {
    background-color: #6b7280;
}

.mt-btn-gray:hover,
.mt-btn-gray:active,
.mt-btn-gray:focus {
    background-color: #6b7280;
    /* Keep original color */
}

.mt-mute-button:active {
    transform: scale(0.9);
}

.mt-mute-button:hover,
.mt-mute-button:focus,
.mt-mute-button:active {
    background-color: transparent;
    outline: none;
    color: #6b7280;
}

.mt-game-header {
    display: flex;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    color: #374151;
    font-weight: 500;
    font-size: 1.125rem;
    gap: 0.5rem 1rem;
}

#mt-question-count,
#mt-total-timer {
    justify-self: start;
}

#mt-score,
#mt-question-timer {
    justify-self: end;
}

.mt-game-header div {
    display: flex;
    align-items: center;
}

.mt-question-card {
    background-color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    text-align: center;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mt-question-row {
    display: flex;
    flex-direction: column;
    /* Stacked on mobile by default */
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.mt-question-text {
    font: 33px Arial;
    /* font-size: 2rem;
        font-weight: 500; */
    color: #0000ff;
    margin: 0;
}

.mt-equals-sign {
    display: none;
    /* Hidden on mobile */
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
}

.mt-answer-input {
    width: 100%;
    max-width: 250px;
    /* Set a max-width for mobile */
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 1.25rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    outline: none;
    transition: all 0.2s;
}

.mt-answer-input:focus {
    outline: none;
}

.mt-result-message:not(:empty) {
    min-height: 1.5rem;
    /* Reserve space only when message is shown */
}

.mt-result-message.correct {
    color: #22c55e;
}

.mt-result-message.incorrect {
    color: #ef4444;
}

/* New styles for input field icons */
.mt-answer-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 250px;
    /* Match input's max-width */
}

.mt-answer-input {
    padding-right: 30px;
    /* Make space for the icon */
}

.mt-feedback-icon {
    position: absolute;
    right: 10px;
    /* Adjust as needed */
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
    /* Allow clicks to pass through to the input */
    display: none;
    /* Hidden by default */
}

.mt-feedback-icon svg {
    width: 100%;
    height: 100%;
}

.mt-correct-icon {
    color: #22c55e;
    /* Green */
}

.mt-incorrect-icon {
    color: #ef4444;
    /* Red */
}

.mt-keyboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.mt-key-btn {
    background-color: #e5e7eb;
    color: #1f2937;
    font-weight: 700;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s;
}

.mt-key-btn.clear {
    background-color: #ef4444;
    color: #fff;
}

.mt-key-btn.clear:hover {
    background-color: #dc2626;
}

.mt-key-btn.submit {
    background-color: #2563eb;
    color: #fff;
}

.mt-key-btn.submit:hover {
    background-color: #1d4ed8;
}

.mt-end-game-text {
    font-size: 1.25rem;
    color: #374151;
}

.mt-final-score {
    font-weight: 500;
    color: #2563eb;
}

.mt-history-container {
    max-height: 150px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
}

#mt-history-container:empty {
    display: none;
}

.mt-history-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 17px;
    white-space: nowrap;
}

.mt-history-item:last-child {
    border-bottom: none;
}

.mt-container .mt-history-item .correct {
    color: #06662a;
    font-weight: 500;
}

.mt-container .mt-history-item .incorrect {
    color: #b60101;
    font-weight: 500;
}

.mt-history-item .correct-ans-hint {
    font-size: 1rem;
    color: #6b7280;
    margin-left: 0.5rem;
}

.history-icon {
    width: 0.9em;
    height: 0.9em;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    /* The color will be inherited from .correct or .incorrect */
    stroke-width: 3;
}

.mt-history-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.mt-history-wrapper .mt-history-container {
    border: none;
    border-radius: 0;
    margin-top: 0;
}

.mt-results-summary-table {
    width: auto;
    margin: 0 auto;
    border-collapse: collapse;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.mt-results-summary-table th,
.mt-results-summary-table td {
    padding: 0.4rem 0.5rem;
    border: 1px solid #e5e7eb;
    font-size: 17px;
    text-align: center;
}

.mt-results-summary-table thead th {
    font-size: 19px;
    font-weight: 500;
    color: #1f2937;
    background-color: #f3f4f6;
}

.mt-results-summary-table td:first-child {
    color: #6b7280;
    font-weight: 500;
}

.mt-results-summary-table td:last-child {
    font-weight: 500;
    color: #0b51b5;
}

.mt-flex-row {
    display: flex;
    gap: 0.5rem;
}

.mt-flex-row .mt-input-field {
    width: 50%;
}

#mt-result-section>h2 {
    font-size: 1.5rem;
}

.mt-start-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.mt-end-game-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.mt-back-button {
    width: auto;
    padding: 9px 13px;
    font-size: 16px;
    align-self: center;
}

#mt-result-history-toggle-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 8px;
    background-color: #f3f4f6;
    cursor: pointer;
    font-weight: 500;
    font-size: 18px;
    color: #374151;
}

.mt-toggle-icon {
    display: inline-flex;
    align-items: center;
}

.mt-toggle-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #374151;
    transition: transform 0.2s ease-in-out;
}

.mt-toggle-icon.expanded svg {
    transform: rotate(180deg);
}

.mt-mute-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.mt-mute-button svg {
    width: 1.5rem;
    height: 1.5rem;
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

/* Desktop responsiveness */
@media (min-width: 768px) {
    .mt-game-header {
        display: flex;
        justify-content: space-between;
    }

    .mt-game-header>div {
        justify-self: auto;
    }

    .mt-container {
        max-width: 650px;
        min-height: 460px;
        /* Wider container for desktop */
    }

    #mt-settings-section:not(.mt-hidden) {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem 1.5rem;
        /* row-gap column-gap */
        align-items: start;
    }

    .mt-start-buttons {
        grid-column: 1 / -1;
        /* Span across both columns */
    }

    .mt-question-row {
        flex-direction: row;
        /* Side-by-side on desktop */
        align-items: center;
    }

    .mt-equals-sign {
        display: inline;
        /* Show on desktop */
    }

    .mt-answer-input-wrapper {
        width: auto;
        max-width: 200px;
        flex-grow: 1;
    }
}

/* Mobile responsiveness */
@media (max-width: 767px) {
    .mt-container {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding-left: 0;
        padding-right: 0;
        box-shadow: none;
    }

    .mt-container.result-view {
        max-width: none;
    }

    .mt-history-wrapper {
        width: 100%;
    }
}