:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --text-color: #212529;
    --light-gray: #e9ecef;
    --white: #fff;
    --success-color: #28a745;
    --error-color: #dc3545;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    background-color: var(--white);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 20px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.exit-btn {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.exit-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#header-title {
    margin: 0;
    font-size: 1.5em;
}

#progress-container {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    width: 150px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--white);
    transition: width 0.3s ease;
    width: 0%;
}

#progress-text {
    font-size: 0.9em;
    min-width: 40px;
}

main {
    padding: 30px;
    padding-bottom: 100px; /* 为固定按钮留出空间 */
    flex: 1;
    overflow-y: auto;
}

footer {
    background-color: var(--light-gray);
    text-align: center;
    padding: 15px;
    font-size: 0.9em;
    color: var(--secondary-color);
}

.hidden {
    display: none;
}

/* Mode Selection */
#mode-selection-view h2 {
    text-align: center;
    margin-bottom: 30px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mode-btn {
    padding: 20px;
    font-size: 1.1em;
    cursor: pointer;
    border: 2px solid var(--primary-color);
    background-color: var(--white);
    color: var(--primary-color);
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
}

.mode-btn:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Quiz View */
.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: bold;
}

#question-container {
    margin-bottom: 20px;
}

#question-container p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.option-btn {
    width: 100%;
    padding: 15px;
    font-size: 1em;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--light-gray);
    background-color: var(--white);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

.option-btn.selected {
    background-color: #e3f2fd;
    border-color: var(--primary-color);
    border-width: 2px;
}

.option-btn.correct {
    background-color: var(--success-color);
    color: var(--white);
    border-color: var(--success-color);
}

.option-btn.incorrect {
    background-color: var(--error-color);
    color: var(--white);
    border-color: var(--error-color);
}

#feedback-container {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
}

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

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

#next-btn, #restart-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    color: var(--white);
    background-color: var(--primary-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

/* Question Container - Fixed Height */
.question-container {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.question-container p {
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Fill-in-blank Input */
.fill-input {
    display: inline-block;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    background: transparent;
    font-size: 1.2em;
    padding: 2px 8px;
    margin: 0 4px;
    min-width: 160px;
    text-align: center;
    outline: none;
}

.fill-input:focus {
    border-bottom-color: var(--secondary-color);
    background-color: rgba(0, 123, 255, 0.1);
}

.fill-input.correct {
    border-bottom-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.fill-input.incorrect {
    border-bottom-color: var(--error-color);
    background-color: rgba(220, 53, 69, 0.1);
}

/* True/False Questions - Highlight Verb */
.highlighted-verb {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    color: #856404;
}

/* Button Container */
.button-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 0 30px;
    box-sizing: border-box;
    z-index: 100;
}

#check-btn, #continue-btn {
    display: inline-block;
    width: 200px;
    padding: 15px;
    font-size: 1.1em;
    color: var(--white);
    background-color: var(--primary-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#check-btn:hover, #continue-btn:hover {
    background-color: #0056b3;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--text-color);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

#confirm-exit-btn {
    background-color: var(--error-color);
    color: var(--white);
}

#cancel-exit-btn {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* Score View Buttons */
#wrong-questions-section, #difficulty-section {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    background-color: #f8f9fa;
}

#retry-wrong-btn, #skip-retry-btn, #higher-difficulty-btn, #back-home-btn {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

#retry-wrong-btn, #higher-difficulty-btn {
    background-color: var(--primary-color);
    color: var(--white);
}

#skip-retry-btn, #back-home-btn {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* Mode buttons - 5 buttons layout */
.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mode-buttons .mode-btn:last-child {
    grid-column: 1 / -1;
    width: 100%;
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .mode-buttons .mode-btn:last-child {
        max-width: none;
        margin: 0;
    }

    main {
        padding: 20px;
        padding-bottom: 100px; /* 为固定按钮留出空间 */
    }

    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }

    .exit-btn {
        position: static;
        order: 1;
    }

    #progress-container {
        position: static;
        order: 2;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    #header-title {
        display: none;
    }

    .button-container {
        padding: 0 20px;
        bottom: 15px;
    }

    #check-btn, #continue-btn {
        width: 100%;
        max-width: 300px;
    }
}
