body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

.container {
    max-width: 800px;
    margin: auto;
    border: 1px solid #ccc;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.exercise-counter {
    text-align: right;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #777;
}

.instructions {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 20px;
    font-weight: bold;
}

/* Exercise Header - Contains Exercise Counter and Timer */
.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.95em;
    color: #555;
}

.exercise-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 28px;
    font-weight: bold;
    padding: 0 10px;
    margin: 0;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
    white-space: nowrap;
}

#currentExercise {
    font-weight: 700;
    color: #333;
}

.task-status-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    width: calc(100% - 10px);
    margin-right: 10px;
}

#wordCounter,
#taskTimer {
    font-size: 14px;
    color: #555;
    padding: 5px 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
    font-weight: bold;
}

/* Form Element Styles */
textarea {
    width: calc(100% - 10px);
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    margin-right: 10px;
    min-height: 250px;
    resize: vertical;
    box-sizing: border-box;
}

/* Basic input field styling */
input[type="text"] {
    border: 1px solid #ccc;
    padding: 5px;
    margin: 3px;
    border-radius: 3px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: #4285f4;
    box-shadow: 0 0 3px rgba(66, 133, 244, 0.5);
    outline: none;
}

/* Exercise Content Styling */
.exercise-content {
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 16px;
}

/* Recorder UI Styling */
.recording-box {
    background-color: #f5f5f5;
    width: 400px;
    margin: 20px auto;
    padding: 18px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recording-box h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-weight: normal;
    color: #555;
    font-size: 16px;
}

.recording-box .status {
    margin: 15px 0;
    text-align: left;
    color: #555;
    line-height: 1.5;
    font-size: 14px;
    background-color: #f9f9f9;
    border-radius: 4px;
    padding: 8px 12px;
    border-left: 3px solid #ddd;
}

.recording-box .progress-bar {
    width: 100%;
    height: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 15px 0;
    background-color: #e9e9e9;
    overflow: hidden;
    /* Ensure this doesn't conflict with other progress bars */
    display: block;
    transition: background 0.3s ease;
}

.skip-prep-btn {
    margin: 10px auto;
    padding: 6px 12px;
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: block;
    width: 60%;
    max-width: 160px;
    font-weight: normal;
    text-align: center;
}

.skip-prep-btn:hover {
    background-color: #e8e8e8;
    color: #555;
}

.skip-prep-btn:active {
    background-color: #e0e0e0;
    transform: translateY(1px);
}

.skip-prep-btn:disabled {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
    border-color: #ddd;
}

/* Feedback Section Styles */
.feedback-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
    /* Ensure left-aligned content */
}

.feedback-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.2em;
    text-align: center;
    font-weight: 600;
}

/* Question Display Styles for Feedback */
.question-display {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8ff 100%);
    border-radius: 8px;
    border: 2px solid #2196f3;
    border-left: 6px solid #2196f3;
}

.question-label {
    font-size: 0.85em;
    font-weight: bold;
    color: #1565c0;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-text {
    font-size: 1.1em;
    font-weight: 500;
    color: #1976d2;
    line-height: 1.5;
    margin: 0;
}

.feedback-item {
    margin-bottom: 20px;
}

.feedback-item:last-child {
    margin-bottom: 0;
}

.feedback-item h4 {
    margin: 0 0 10px 0;
    color: #343a40;
    font-size: 1em;
    font-weight: 600;
}

.original-sentence {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
    font-style: italic;
    color: #1565c0;
    line-height: 1.4;
}

#transcriptionStatus {
    font-size: 0.8em;
    font-weight: 500;
    font-style: italic;
    color: #6c757d;
}

.transcription-text {
    background-color: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 6px;
    padding: 14px;
    margin: 8px 0 0 0;
    color: #e65100;
    line-height: 1.5;
    min-height: 24px;
    font-size: 1em;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Enhanced Visual Feedback for Word Analysis */
.transcription-text span[style*="background-color: #d4edda"] {
    background-color: #d4edda !important;
    color: #155724 !important;
    padding: 3px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    border: 1px solid #c3e6cb !important;
}

/* Gray styling for extra words - legible but less prominent */
.transcription-text span[style*="color: #868e96"] {
    color: #868e96 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    padding: 2px 4px !important;
}

.question-text span[style*="background-color: #d4edda"] {
    background-color: #d4edda !important;
    color: #155724 !important;
    padding: 3px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    border: 1px solid #c3e6cb !important;
}

.question-text span[style*="background-color: #f8d7da"] {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    padding: 3px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    border: 1px solid #f5c6cb !important;
}

/* Visual Feedback Legend Styles */
.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9em;
}

.legend-color.correct-word {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.legend-color.missed-word {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.legend-color.extra-word {
    background-color: #f8f9fa;
    color: #868e96;
    border: 1px solid #dee2e6;
    font-style: italic;
}

.legend-text {
    font-size: 0.9em;
    color: #495057;
    font-weight: 500;
}

.scores-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.score-label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
}

.score-value {
    font-weight: bold;
    color: #007bff;
    margin-left: 10px;
    min-width: 80px;
}

.score-level {
    margin-left: 10px;
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
}

/* Score level indicators */
.score-item.level-3 .score-value {
    color: #28a745;
    /* Green for excellent */
}

.score-item.level-2 .score-value {
    color: #ffc107;
    /* Yellow for good */
}

.score-item.level-1 .score-value {
    color: #fd7e14;
    /* Orange for fair */
}

.score-item.level-0 .score-value {
    color: #dc3545;
    /* Red for poor */
}

@media (max-width: 768px) {
    body {
        margin: 5px;
    }

    .container {
        padding: 20px 10px;
    }

    .instructions {
        line-height: 1.2;
    }

    .recording-box {
        width: auto;
        margin: 0;
        padding: 8px;
    }

    /* Responsive design for scores */
    .score-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .score-label {
        min-width: auto;
        margin-bottom: 5px;
    }

    .score-value {
        margin-left: 0;
        min-width: auto;
    }

    .score-level {
        margin-left: 0;
        margin-top: 5px;
    }

    .feedback-section {
        padding: 15px 8px;
    }

    /* Mobile responsiveness for legend */
    .legend-container {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .legend-item {
        gap: 6px;
    }

    .legend-color {
        width: 20px;
        height: 20px;
        font-size: 0.8em;
    }

    .legend-text {
        font-size: 0.85em;
    }

    /* Enhanced question display for mobile */
    .question-display {
        padding: 12px;
        margin-bottom: 15px;
    }

    .question-label {
        font-size: 0.8em;
        margin-bottom: 6px;
    }

    .question-text {
        font-size: 1em;
        line-height: 1.4;
    }
}