/* ========================================
   SURVEY STYLES - Formal Mobile & Desktop
   ======================================== */

/* Survey Container Styling - Enhanced Professional Look */
.survey-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Survey Card Styling - Enhanced Professional Look */
.survey-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 24px;
}

.survey-card-header {
    padding: 32px 40px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.survey-card-header h2 {
    margin: 0 0 12px 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: -0.025em;
}

.survey-card-header p {
    margin: 0;
    font-size: 1.125rem;
    color: #6c757d;
    font-weight: 400;
    line-height: 1.5;
}

.survey-card-body {
    padding: 40px;
    background: #ffffff;
}

/* Progress Bar Styling - Enhanced Professional Look */
.survey-progress {
    margin-bottom: 40px;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.survey-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #495057;
}

.survey-progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.survey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Form Styling - Enhanced Professional Look */
.survey-form .form-group {
    margin-bottom: 32px;
}

.survey-form .form-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
}

.survey-form .form-control {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1.125rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.survey-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15), 0 4px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.survey-form .form-select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 400;
    color: #2c3e50;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.survey-form .form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15), 0 4px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.survey-form .form-select option {
    font-weight: 400;
    color: #2c3e50;
    font-size: 1.125rem;
}

.survey-form .form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 4px;
}

/* Question Block Styling */
.question-block {
    margin-bottom: 40px;
}

/* Fieldset and Legend Styling */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #2c3e50;
    display: block;
    padding: 0;
    line-height: 1.3;
}

/* Flexbox Container for Options */
.options-container {
    display: flex;
    justify-content: center;
    text-align: center;
    gap: 15px;
    margin-top: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Individual Option Container */
.option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.option label {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #4a5568;
    font-weight: 500;
    text-align: center;
    max-width: 150px;
    word-wrap: break-word;
    line-height: 1.2;
}

.option input[type="radio"] {
    transform: scale(1.2);
    accent-color: #4299e1;
    cursor: pointer;
}

/* Fieldset Styling - Remove default borders */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* Legend and Question Label Styling */
legend, .question-label {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    margin-bottom: 20px;
    color: #2c3e50 !important;
    display: block;
    padding: 0;
    line-height: 1.3 !important;
}

/* THE FLEXBOX MAGIC FOR OPTIONS */
.options-container {
    display: flex;
    justify-content: center;
    text-align: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Container for ONE label and its radio button */
.option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex: 0 1 auto;
}

.option label {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #4a5568;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

.option input[type="radio"] {
    transform: scale(1.2);
    accent-color: #4299e1;
    cursor: pointer;
}

/* Survey Form Radio Button Layout - Horizontal Row with Aligned Buttons */
.survey-form .form-check {
    display: inline-flex;
    align-items: flex-end;
    margin-right: 20px;
    margin-bottom: 12px;
    flex-direction: column;
    text-align: center;
    min-height: 120px;
}

/* Reduce gap between questions and answer choices - Higher specificity */
.survey-container .survey-form .mb-4 {
    margin-bottom: 16px !important;
}

.survey-container .survey-form .mb-3 {
    margin-bottom: 8px !important;
}

.survey-container .survey-form .text-primary.mb-3 {
    margin-bottom: 6px !important;
}

/* Reduce spacing between question text and radio button options */
.survey-container .survey-form h4.text-primary {
    margin-bottom: 4px !important;
}

/* Compact spacing for radio button containers */
.survey-container .survey-form .mb-3:has(.form-check) {
    margin-top: 2px !important;
    margin-bottom: 8px !important;
}

/* Additional spacing adjustments for question containers */
.survey-container .survey-form .mb-4 > .mb-3 {
    margin-top: 2px !important;
}

/* More aggressive spacing reduction for survey forms */
.survey-form form .mb-4 {
    margin-bottom: 12px !important;
}

.survey-form form .mb-3 {
    margin-bottom: 4px !important;
}

.survey-form form h4 {
    margin-bottom: 4px !important;
}

/* Target the specific gap between question and first answer choice */
.survey-form .mb-4 h4 + .mb-3 {
    margin-top: 0px !important;
}

/* Additional aggressive spacing reduction */
.survey-container .survey-card-body .survey-form .mb-4 {
    margin-bottom: 10px !important;
}

.survey-container .survey-card-body .survey-form .mb-3 {
    margin-bottom: 2px !important;
}

.survey-container .survey-card-body .survey-form h4.text-primary {
    margin-bottom: 2px !important;
}

/* Target Bootstrap margin classes directly */
.survey-container .mb-4 {
    margin-bottom: 10px !important;
}

.survey-container .mb-3 {
    margin-bottom: 4px !important;
}

/* Remove gap after question headings and make them larger */
.survey-container h4 {
    margin-bottom: 2px !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
}

/* Make survey question text larger and more prominent */
.survey-container .survey-form h4.text-primary {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #2c3e50 !important;
    line-height: 1.3 !important;
    text-align: left !important;
}

/* Left align all survey questions and content */
.survey-container {
    text-align: left !important;
}

.survey-container .survey-form {
    text-align: left !important;
}

.survey-container .survey-card {
    text-align: left !important;
}

.survey-container .survey-card-body {
    text-align: left !important;
}

/* Override any center alignment on form elements */
.survey-container .form-check,
.survey-container .rating-container .form-check,
.survey-container .form-check-inline {
    text-align: left !important;
}

.survey-container .form-check-label,
.survey-container .rating-container .form-check-label,
.survey-container .form-check-inline .form-check-label {
    text-align: left !important;
}

/* Reduce any padding that might be causing gaps */
.survey-container .survey-form .mb-4 {
    padding-bottom: 0 !important;
}

.survey-container .survey-form .mb-3 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure minimal spacing for question sections */
.survey-container .survey-form > .mb-4 {
    margin-bottom: 8px !important;
}

/* Target the specific structure from the HTML */
.survey-container .survey-form .mb-4 .mb-3 {
    margin-top: 0 !important;
    margin-bottom: 6px !important;
}

.survey-form .form-check-input {
    margin: 0;
    order: 2;
    flex-shrink: 0;
}

.survey-form .form-check-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    order: 1;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.2;
    text-align: center;
    max-width: 120px;
    word-wrap: break-word;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Rating Container */
.rating-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}

.rating-container .form-check {
    margin: 0;
    display: inline-flex;
    align-items: flex-end;
    margin-right: 20px;
    margin-bottom: 12px;
    flex-direction: column;
    text-align: center;
    min-height: 120px;
}

.rating-container .form-check-input {
    margin: 0;
    order: 2;
    flex-shrink: 0;
}

.rating-container .form-check-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    order: 1;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.2;
    text-align: center;
    max-width: 120px;
    word-wrap: break-word;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inline form check items (for rating scales) */
.survey-form .form-check-inline {
    display: inline-flex;
    align-items: flex-end;
    margin-right: 20px;
    margin-bottom: 12px;
    flex-direction: column;
    text-align: center;
    min-height: 120px;
}

.survey-form .form-check-inline .form-check-input {
    margin: 0;
    order: 2;
    flex-shrink: 0;
}

.survey-form .form-check-inline .form-check-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    order: 1;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.2;
    text-align: center;
    max-width: 120px;
    word-wrap: break-word;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Button Styling - Enhanced Professional Look */
.survey-btn {
    padding: 16px 32px;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    letter-spacing: -0.025em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.survey-btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.survey-btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.survey-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.4);
}

.survey-btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.4);
}

.survey-btn-secondary {
    background: #6c757d;
    color: white;
}

.survey-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 117, 125, 0.4);
}

.survey-btn-outline {
    background: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
}

.survey-btn-outline:hover {
    background: #6c757d;
    color: white;
}

.survey-btn:disabled,
.survey-btn-primary:disabled,
.survey-btn-success:disabled {
    background: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Navigation Buttons - Enhanced Professional Look */
.survey-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 24px 32px;
    margin-top: 40px;
}

/* ========================================
   HANZI WRITING SPECIFIC STYLES
   ======================================== */

/* FLEXBOX - Part 2: The Actions Area */
.actions-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    width: 100%;
}

/* FLEXBOX - Part 3: The Button Group */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

/* Dropdown Styling for Button Group */
.dropdown-center {
    position: relative;
    width: 100%;
}

.drop_button,
.hsk_drop_button {
    padding: 12px 24px;
    background-color: #b92a43;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.drop_button:hover,
.hsk_drop_button:hover {
    background-color: #a0222f;
    transform: translateY(-2px);
}

/* Generate Button Styling */
.btn-generate,
#generateButton {
    padding: 12px 24px;
    background-color: #d9534f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-generate:hover,
#generateButton:hover {
    background-color: #c9302c;
    transform: translateY(-2px);
}

/* Dropdown Content Styling */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

.dropdown-content button {
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-content button:last-child {
    border-bottom: none;
}

.dropdown-content button:hover {
    background: #f8f9fa;
}

/* Volume Control - Clean Flexbox styling */
.volume-control {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.volume-control label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.volume-control input[type="range"] {
    width: 100px;
    margin: 0;
    accent-color: #b92a43;
}

/* Helper Buttons Container - All action buttons in one centered row */
.helper-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.helper-buttons-container button {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.helper-buttons-container button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* Info Displays Container - Below helper buttons */
.info-displays {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
    width: 100%;
}

.info-displays #definition-display,
.info-displays #pinyin-display {
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.info-displays #definition-display:not(:empty),
.info-displays #pinyin-display:not(:empty) {
    display: block;
}

.info-displays #definition-display:empty,
.info-displays #pinyin-display:empty,
.info-displays #definition-display[style*="display: none"],
.info-displays #pinyin-display[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Legacy - Corner Buttons */
.corner-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.corner-buttons button {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    background: #ffffff;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.corner-buttons button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Legacy - Button Container */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.button-container button {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.button-container button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* Top Bar Layout (Legacy - kept for compatibility) */
.survey-top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* Corner Buttons */
.survey-corner-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 180px;
}

.survey-corner-buttons button {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-corner-buttons button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Definition and Pinyin Displays */
.survey-definition-display,
.survey-pinyin-display {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.survey-definition-display.visible,
.survey-pinyin-display.visible {
    display: block;
}

.survey-definition-display p,
.survey-pinyin-display p {
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Dropdown and Generate Controls */
.survey-dropdown-container {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.survey-dropdown {
    position: relative;
}

.survey-dropdown-button {
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    transition: all 0.2s ease;
}

.survey-dropdown-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.survey-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.survey-dropdown-content button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: #495057;
    transition: background 0.2s ease;
}

.survey-dropdown-content button:hover {
    background: #f8f9fa;
}

.survey-generate-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-generate-button:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Volume Control */
.survey-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.survey-volume-control label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.survey-volume-control input[type="range"] {
    width: 80px;
    margin: 0;
}

/* Button Container */
.survey-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.survey-button-container button {
    width: 200px;
    max-width: 100%;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* ========================================
   CANVAS FIXES - Prevent Overlapping
   ======================================== */

/* Character Container - Fixed Grid Layout */
.survey-character-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    justify-content: center;
    width: 100%;
    margin: 24px 0;
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.survey-character-container.fade-in {
    opacity: 1;
    pointer-events: auto;
}

.survey-character-container.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Individual Canvas Containers - Fixed Positioning */
.survey-writer-div,
.survey-character-target-div {
    width: 100%;
    height: 280px;
    max-width: 280px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    opacity: 0;
    transform: scale(0.98);
    transition: all 0.3s ease;
    overflow: hidden;
}

.survey-writer-div.fade-in,
.survey-character-target-div.fade-in {
    opacity: 1;
    transform: scale(1);
}

.survey-writer-div.fade-out,
.survey-character-target-div.fade-out {
    opacity: 0;
    transform: scale(0.98);
}

/* Canvas Elements - Prevent Overlap */
.survey-character-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Character Display */
.survey-generated-character {
    color: #007bff;
    background: #ffffff;
    font-weight: 700;
    font-size: 3rem;
    padding: 16px 24px;
    border-radius: 8px;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.1);
    margin: 16px 0;
    animation: survey-reveal 0.4s ease-out forwards;
}

@keyframes survey-reveal {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   PRONUNCIATION SPECIFIC STYLES
   ======================================== */

.survey-pronunciation-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
}

.survey-pronunciation-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    text-align: center;
}

.survey-pronunciation-container .subtitle {
    font-size: 1rem;
    color: #6c757d;
    text-align: center;
    margin-bottom: 24px;
}

.survey-practice-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #dee2e6;
}

.survey-input-container {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.survey-input-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.survey-input-container input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.survey-input-container input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.survey-recording-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.survey-control-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.survey-control-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survey-control-group select,
.survey-control-group input[type="range"] {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
}

.survey-control-group input[type="range"] {
    padding: 4px 0;
}

.survey-recording-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
}

.survey-record-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-record-btn.record {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.survey-record-btn.stop {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.survey-record-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ========================================
   PLOT CONTAINER FIXES
   ======================================== */


/* JavaScript Created Plot Containers */
.pitch-plot-container {
    width: 100% !important;
    min-height: 800px !important;
    height: auto !important;
    margin-bottom: 20px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    background-color: #ffffff !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
    visibility: visible !important;
    box-sizing: border-box !important;
    padding: 20px 15px 50px 15px !important;
}

/* ========================================
   AUDIO PLOT LAYOUT SYSTEM - Clean Vertical Stacking
   ======================================== */

/* CSS Custom Properties for consistent spacing and sizing */
:root {
    --plot-container-gap: 10px;
    --plot-container-margin: 20px 0;
    --plot-container-padding: 0;
    --plot-individual-min-height: 500px;
    --plot-individual-padding: 20px 15px 50px 15px;
    --plot-individual-border-radius: 8px;
    --plot-individual-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --plot-individual-border: 1px solid #e9ecef;
    --plot-individual-background: #ffffff;
    --plot-layout-version: 2024-01-15-v4;
}

/* Main plot container - Vertical flexbox layout with maximum specificity */
#plot-container,
div#plot-container,
.audio-plot-container#plot-container,
div.audio-plot-container#plot-container,
div[id="plot-container"],
#plot-container.audio-plot-container {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--plot-container-gap) !important;
    margin: var(--plot-container-margin) !important;
    padding: var(--plot-container-padding) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    /* Force CSS refresh */
    --plot-layout-version: var(--plot-layout-version);
}

/* Audio plot container class for JavaScript - Same as main container */
.audio-plot-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin: 20px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

.audio-plot-container[style*="display: none"],
.audio-plot-container[style*="display:none"],
#user-plot-container[style*="display: none"],
#user-plot-container[style*="display:none"],
#target-plot-container[style*="display: none"],
#target-plot-container[style*="display:none"],
#stacked-plot-container[style*="display: none"],
#overlapped-plot-container[style*="display: none"],
.results-section[style*="display: none"],
.preview-section[style*="display: none"],
.loading-indicator[style*="display: none"],
.loading-spinner[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: none !important;
    visibility: hidden !important;
}


#user-pitch-plot h3,
#target-pitch-plot h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.1rem;
    text-align: center;
    font-weight: 600;
}


/* Enhanced results container */
#enhanced-results-container {
    margin: 20px 0 !important;
    padding: 20px !important;
    background: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}

#enhanced-results-container[style*="display: none"],
#enhanced-results-container[style*="display:none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: none !important;
    visibility: hidden !important;
}

/* Enhanced figures container */
.enhanced-figures-container {
    margin-top: 30px !important;
    padding: 20px !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    border: 2px solid #e9ecef !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Enhanced figures grid */
.enhanced-figures-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 20px !important;
    width: 100% !important;
    align-items: start !important;
    box-sizing: border-box !important;
}

/* Figure cards */
.figure-card {
    background: white !important;
    padding: 20px !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    border: 1px solid #e9ecef !important;
    min-height: 800px !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* General plot container class */
.plot-container {
    width: 100% !important;
    margin: 10px 0 !important;
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 6px !important;
    padding: 15px 15px 50px 15px !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    min-height: 800px !important;
}

.plot-container[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Individual plot containers - Full width, vertical stacking with maximum specificity */
#user-pitch-plot,
#target-pitch-plot,
div#user-pitch-plot,
div#target-pitch-plot,
.audio-plot-individual#user-pitch-plot,
.audio-plot-individual#target-pitch-plot,
div[id="user-pitch-plot"],
div[id="target-pitch-plot"],
#user-pitch-plot.audio-plot-individual,
#target-pitch-plot.audio-plot-individual {
    width: 100% !important;
    min-height: 500px !important;
    max-height: 700px !important;
    background: var(--plot-individual-background) !important;
    border: var(--plot-individual-border) !important;
    border-radius: var(--plot-individual-border-radius) !important;
    padding: var(--plot-individual-padding) !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: hidden !important;
    display: block !important;
    box-shadow: var(--plot-individual-shadow) !important;
    flex-shrink: 0 !important;
    order: 0 !important;
    /* Force vertical stacking */
    float: none !important;
    clear: both !important;
}

/* Override any inline styles that JavaScript might set */
#plot-container[style*="display"],
#plot-container[style*="flex-direction"],
#plot-container[style*="gap"] {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--plot-container-gap) !important;
}

#user-pitch-plot[style*="display"],
#target-pitch-plot[style*="display"],
#user-pitch-plot[style*="width"],
#target-pitch-plot[style*="width"] {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    clear: both !important;
}

/* Stacked audio plot containers - Force vertical stacking */
#stacked-plot-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin: 20px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

#stacked-plot-container .plot {
    width: 100% !important;
    min-height: 800px !important;
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: 20px 15px 50px 15px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
    order: 0 !important;
}

/* Overlapped audio plot container - Force vertical stacking */
#overlapped-plot-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin: 20px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

#overlapped-plot-container .plot {
    width: 100% !important;
    min-height: 800px !important;
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: 20px 15px 50px 15px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    display: block !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
    order: 0 !important;
}

#performance-metrics,
#pronunciation-report,
#tone-specific-container {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

#performance-metrics:empty,
#pronunciation-report:empty,
#tone-specific-container:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#transcriptDisplay:empty,
#output:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Toggle container */
.toggle-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.toggle-container[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Ensure next-exercise-container doesn't show blank space when hidden */
#next-exercise-container[style*="display: none"],
#results-summary[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.toggle-container label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
}

.toggle-container input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
}

/* Optional text styling */
.optional-text {
    font-size: 0.85em;
    color: #718096;
    margin-top: 8px;
}

/* Textarea focus improvements */
textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.5);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Desktop Styles */
@media (min-width: 1200px) {
    .survey-character-container {
        grid-template-columns: repeat(4, 280px);
        justify-content: center;
    }
    
    .survey-top-bar {
        flex-wrap: nowrap;
    }
    
    .survey-dropdown-container {
        flex-wrap: nowrap;
    }
}

/* Tablet Styles */
@media (max-width: 1199px) and (min-width: 768px) {
    .survey-character-container {
        grid-template-columns: repeat(3, 280px);
        justify-content: center;
    }
    
    .survey-top-bar {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .survey-corner-buttons {
        order: 3;
        width: 100%;
        flex-direction: row;
        justify-content: center;
    }
}

/* Mobile Styles - Enhanced Professional Look */
@media (max-width: 767px) {
    .survey-container {
        padding: 20px;
        margin: 16px;
        border-radius: 12px;
    }
    
    .survey-card-body {
        padding: 24px;
    }
    
    .survey-card-header {
        padding: 24px;
    }
    
    .survey-card-header h2 {
        font-size: 1.5rem;
        letter-spacing: -0.025em;
    }
    
    /* Stack options vertically on mobile */
    .options-container {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .option {
        flex-direction: row-reverse;
        margin-bottom: 10px;
        align-items: center;
        width: 100%;
    }
    
    .option label {
        margin-bottom: 0;
        margin-left: 10px;
        text-align: left;
        max-width: none;
    }
    
    .option {
        flex-direction: row-reverse;
        margin-bottom: 10px;
        align-items: center;
        width: 100%;
    }
    
    .option label {
        margin-bottom: 0;
        margin-left: 10px;
        text-align: left;
    }
    
    /* Responsive Fix for Actions Container */
    .actions-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .button-group {
        width: 100%;
    }
    
    .volume-control {
        width: 100%;
        justify-content: center;
    }
    
    .helper-buttons-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .helper-buttons-container button {
        width: 100%;
        max-width: 250px;
    }
    
    .corner-buttons {
        flex-direction: row;
        gap: 8px;
    }
    
    .corner-buttons button {
        flex: 1;
        min-width: 100px;
    }
    
    .button-container {
        flex-direction: row;
        gap: 12px;
    }
    
    .button-container button {
        flex: 1;
        min-width: 120px;
    }
    
    .survey-character-container {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 20px 0;
    }
    
    .survey-writer-div,
    .survey-character-target-div {
        height: 250px;
        max-width: 100%;
        width: 100%;
    }
    
    .survey-top-bar {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .survey-corner-buttons {
        width: 100%;
        max-width: 300px;
        flex-direction: row;
        justify-content: space-around;
    }
    
    .survey-corner-buttons button {
        flex: 1;
        margin: 0 4px;
    }
    
    .survey-dropdown-container {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }
    
    .survey-dropdown {
        width: 100%;
    }
    
    .survey-volume-control {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .survey-button-container button {
        width: 100%;
        max-width: 250px;
    }
    
    .survey-navigation {
        flex-direction: column;
        gap: 16px;
    }
    
    .survey-navigation .survey-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .survey-recording-controls {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }
    
    .survey-control-group {
        min-width: 0;
    }
    
    .survey-control-group label {
        font-size: 0.8rem;
        white-space: normal;
        line-height: 1.3;
    }
    
    .survey-recording-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .survey-record-btn {
        width: 100%;
        max-width: 200px;
    }
    
    /* Mobile audio plot fixes - Individual containers with 10px spacing */
    #plot-container {
        gap: 10px !important;
        padding: 0 !important;
    }
    
    #user-pitch-plot,
    #target-pitch-plot {
        min-height: 500px !important;
        padding: 15px 10px 40px 10px !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    #stacked-plot-container,
    #overlapped-plot-container {
        gap: 10px !important;
        padding: 0 !important;
    }
    
    #stacked-plot-container .plot,
    #overlapped-plot-container .plot {
        min-height: 500px !important;
        padding: 15px 10px 40px 10px !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    .survey-generated-character {
        font-size: 2.5rem;
        padding: 12px 20px;
    }
    
    .rating-container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .rating-container .form-check {
        text-align: center;
        margin-right: 15px;
        margin-bottom: 8px;
        flex-direction: column;
        align-items: flex-end;
        min-height: 100px;
    }
    
    .rating-container .form-check-input {
        margin: 0;
        order: 2;
        flex-shrink: 0;
    }
    
    .rating-container .form-check-label {
        order: 1;
        margin-bottom: 8px;
        font-size: 0.8rem;
        max-width: 100px;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile styles for survey form radio buttons - horizontal layout with aligned buttons */
    .survey-form .form-check {
        display: inline-flex;
        align-items: flex-end;
        margin-right: 15px;
        margin-bottom: 8px;
        flex-direction: column;
        text-align: center;
        min-height: 100px;
    }
    
    .survey-form .form-check-input {
        margin: 0;
        order: 2;
        flex-shrink: 0;
    }
    
    .survey-form .form-check-label {
        order: 1;
        margin-bottom: 8px;
        font-size: 0.8rem;
        max-width: 100px;
        line-height: 1.1;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile styles for inline form check items */
    .survey-form .form-check-inline {
        display: inline-flex;
        align-items: flex-end;
        margin-right: 15px;
        margin-bottom: 8px;
        flex-direction: column;
        text-align: center;
        min-height: 100px;
    }
    
    .survey-form .form-check-inline .form-check-input {
        margin: 0;
        order: 2;
        flex-shrink: 0;
    }
    
    .survey-form .form-check-inline .form-check-label {
        order: 1;
        margin-bottom: 8px;
        font-size: 0.8rem;
        max-width: 100px;
        line-height: 1.1;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .survey-container {
        padding: 12px;
    }
    
    .survey-card-body {
        padding: 16px;
    }
    
    .survey-card-header {
        padding: 16px;
    }
    
    .survey-card-header h2 {
        font-size: 1.25rem;
    }
    
    .survey-writer-div,
    .survey-character-target-div {
        height: 200px;
    }
    
    .survey-generated-character {
        font-size: 2rem;
        padding: 8px 16px;
    }
    
    .survey-corner-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .survey-corner-buttons button {
        margin: 0;
    }
    
    .helper-buttons-container {
        flex-direction: column !important;
        gap: 8px;
    }
    
    .helper-buttons-container button {
        width: 100%;
        max-width: 220px;
    }
    
    /* Small mobile styles for radio buttons - even more compact with aligned buttons */
    .survey-form .form-check,
    .rating-container .form-check,
    .survey-form .form-check-inline {
        margin-right: 10px;
        margin-bottom: 6px;
        align-items: flex-end;
        min-height: 80px;
    }
    
    .survey-form .form-check-label,
    .rating-container .form-check-label,
    .survey-form .form-check-inline .form-check-label {
        font-size: 0.75rem;
        max-width: 80px;
        line-height: 1.0;
        margin-bottom: 6px;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .survey-form .form-check-input,
    .rating-container .form-check-input,
    .survey-form .form-check-inline .form-check-input {
        margin: 0;
        flex-shrink: 0;
    }
    
    /* Small mobile left alignment */
    .survey-container .survey-form,
    .survey-container .survey-card,
    .survey-container .survey-card-body,
    .survey-container .form-check,
    .survey-container .rating-container .form-check,
    .survey-container .form-check-inline {
        text-align: left !important;
    }
    
    .survey-container .form-check-label,
    .survey-container .rating-container .form-check-label,
    .survey-container .form-check-inline .form-check-label {
        text-align: left !important;
    }
    
    /* Mobile responsive font sizes for question headings */
    .survey-container h4,
    .survey-container .survey-form h4.text-primary {
        font-size: 1.25rem !important;
        line-height: 1.2 !important;
        text-align: left !important;
    }
    
    /* Ensure left alignment on mobile */
    .survey-container .survey-form,
    .survey-container .survey-card,
    .survey-container .survey-card-body {
        text-align: left !important;
    }
    
    .survey-container .form-check,
    .survey-container .rating-container .form-check,
    .survey-container .form-check-inline {
        text-align: left !important;
    }
    
    .survey-container .form-check-label,
    .survey-container .rating-container .form-check-label,
    .survey-container .form-check-inline .form-check-label {
        text-align: left !important;
    }
}

/* ========================================
   ANIMATION REDUCTIONS
   ======================================== */

/* Reduce excessive animations */
.survey-character-container,
.survey-writer-div,
.survey-character-target-div {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.survey-generated-character {
    animation: survey-reveal 0.3s ease-out forwards;
}

@keyframes survey-reveal {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Smooth but subtle transitions */
.survey-btn,
.survey-form .form-control,
.survey-form .form-select {
    transition: all 0.2s ease;
}

/* Remove excessive hover effects on mobile */
@media (max-width: 767px) {
    .survey-btn:hover,
    .survey-form .form-control:hover,
    .survey-form .form-select:hover {
        transform: none;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.survey-text-center {
    text-align: center;
}

.survey-mb-0 {
    margin-bottom: 0;
}

.survey-mt-4 {
    margin-top: 24px;
}

.survey-d-none {
    display: none;
}

.survey-d-block {
    display: block;
}

.survey-d-flex {
    display: flex;
}

.survey-justify-content-between {
    justify-content: space-between;
}

.survey-align-items-center {
    align-items: center;
}

/* ========================================
   INTONATION PATTERN CARDS
   ======================================== */

/* A container to constrain the overall width and center the content */
.intonation-main-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    font-family: inherit;
    overflow: visible;
    position: relative;
}

/* Style for the cards with the colored borders */
.intonation-card {
    border-left: 5px solid;
    padding: 20px;
    margin-bottom: 80px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-sizing: border-box;
    overflow: visible;
    position: relative;
    clear: both;
}

/* Specific border colors */
.card-your-pattern {
    border-left-color: #3498db; /* Blue */
}

.card-standard-pattern {
    border-left-color: #e74c3c; /* Red */
}

.graph-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

/* This is the KEY container for the graph itself - the white box */
.graph-container {
    background-color: white;
    padding: 20px;
    padding-bottom: 80px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    
    /* CRITICAL: This ensures padding is included IN the width, not added to it. */
    box-sizing: border-box;
    
    /* This is needed for D3.js to size the SVG correctly */
    position: relative;
    
    /* Make the container take up the full width of its parent card */
    width: 100%;
    
    /* Make the box tall enough to contain the entire graph */
    height: auto;
    min-height: 600px;
    max-height: 800px;
    
    /* Allow overflow to show x-axis labels */
    overflow: visible;
}

/* Make sure SVG elements fill their container properly */
.graph-container svg {
    width: 100% !important;
    height: auto !important;
    display: block;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Ensure the audio-plot-individual inside graph-container behaves correctly */
.graph-container .audio-plot-individual {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    position: relative;
    overflow: visible !important;
}

/* Override the pitch plot divs when they're inside the graph-container */
.graph-container #user-pitch-plot,
.graph-container #target-pitch-plot {
    min-height: 500px !important;
    max-height: 700px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    position: relative !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .intonation-main-container {
        width: 95%;
        margin: 15px auto;
    }
    
    .intonation-card {
        padding: 15px;
        margin-bottom: 60px;
    }
    
    .graph-title {
        font-size: 1.1rem;
    }
    
    .graph-container {
        padding: 15px;
        padding-bottom: 70px;
        min-height: 550px;
        max-height: 700px;
    }
    
    .graph-container #user-pitch-plot,
    .graph-container #target-pitch-plot {
        min-height: 450px !important;
        max-height: 600px !important;
    }
}

/* Mobile responsiveness for audio players */
@media (max-width: 768px) {
    audio {
        width: 100% !important;
        height: 60px !important;
        min-height: 60px;
    }
    
    .audio-playback-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .audio-playback-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    audio {
        height: 50px !important;
        min-height: 50px;
    }
    
    .audio-playback-section {
        padding: 10px;
        margin: 10px 0;
    }
}

/* ========================================
   RESPONSIVE RADIO BUTTON QUESTION BLOCKS
   ======================================== */

/* Enhanced responsive styles for question-block radio buttons */
.question-block {
    margin-bottom: 2rem;
}

.question-block fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.question-block legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-primary, #0d6efd);
    margin-bottom: 1rem;
    padding: 0;
    width: 100%;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.survey-form .question-block .option {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 3rem;
}

.survey-form .question-block .option:hover {
    background-color: #f8f9fa;
    border-color: var(--bs-primary, #0d6efd);
}

.survey-form .question-block .option input[type="radio"] {
    margin: 0 !important;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.survey-form .question-block .option label {
    margin: 0 !important;
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
    font-weight: 400;
    display: flex;
    align-items: center;
    min-height: 1.5rem;
}

.survey-form .question-block .option input[type="radio"]:checked + label,
.survey-form .question-block .option:has(input[type="radio"]:checked) {
    font-weight: 500;
}

.survey-form .question-block .option:has(input[type="radio"]:checked) {
    background-color: #e7f3ff;
    border-color: var(--bs-primary, #0d6efd);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .question-block legend {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .option {
        padding: 1rem;
        gap: 1rem;
    }
    
    .option label {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .options-container {
        gap: 0.5rem;
    }
    
    .option {
        padding: 0.875rem;
        gap: 0.875rem;
    }
    
    .option label {
        font-size: 0.9rem;
    }
    
    .question-block legend {
        font-size: 0.95rem;
    }
}

