body {
    background: #f6f7f9;
}

.card {
    max-width: 950px;
    margin: 0 auto;
    border-radius: 14px;
}

textarea {
    resize: vertical;
}

.step-label {
    font-size: 0.9rem;
    color: #6c757d;
}

/* AI assistant panel */

.ai-panel {
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 18px;
    background: #e8eef6;
    color: #1f2937;
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.ai-panel .text-muted {
    color: #475569 !important;
}

.ai-phase-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbe4f0;
    color: #334155;
    border: 1px solid #b8c4d4;
    white-space: nowrap;
}

.ai-instruction-box {
    font-size: 0.9rem;
    background: #f4f7fb;
    color: #1f2937;
    border-left: 4px solid #64748b;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

/* Chat */

.chat-box {
    background: #cfd9e6;
    border: 1px solid #b8c4d4;
    border-radius: 12px;
    padding: 14px;
    min-height: 240px;
    max-height: 380px;
    overflow-y: auto;
}

.chat-message {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    line-height: 1.45;
}

.chat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.user-message {
    background: #ffffff;
    color: #111827;
    border: 1px solid #cbd5e1;
    margin-left: 70px;
}

.user-message .chat-label {
    color: #2563eb;
}

.ai-message {
    background: #f8fafc;
    color: #111827;
    border: 1px solid #cbd5e1;
    margin-right: 70px;
}

.ai-message .chat-label {
    color: #475569;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px;
}

.chat-input-area textarea {
    flex: 1;
    background: #ffffff;
    color: #111827;
}

.chat-input-area button {
    min-width: 90px;
    height: 42px;
}

.task-prompt-box {
    background: #f8fafc;
    border-left: 4px solid #2563eb;
    padding: 12px 14px;
    border-radius: 8px;
}

/* Questionnaire */

.questionnaire-section {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
}

.questionnaire-section + .questionnaire-section {
    margin-top: 2.25rem;
}

/* Clearly separate the two questionnaire parts */
.questionnaire-section.section-a {
    background: #f7faff;
    border-color: #dbe7f6;
}

.questionnaire-section.section-b {
    background: #fffaf5;
    border-color: #eee0cf;
}

.feedback-section {
    background: #fbfcfe;
}

.section-heading {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #eef5ff;
    color: #0d6efd;
    font-weight: 700;
    flex: 0 0 auto;
}

.section-b .section-badge {
    background: #fff0df;
    color: #9a5a12;
}

.scale-item {
    padding: 1.2rem 0 1.35rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.scale-item:last-child {
    border-bottom: 0;
    padding-bottom: 0.3rem;
}

.scale-question {
    display: flex;
    gap: 0.35rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.45;
}

.scale-question-number {
    color: #0d6efd;
    min-width: 1.8rem;
}

.likert-scale {
    width: min(100%, 700px);
    margin: 0 auto;
}

/* Endpoint text sits over the actual left and right ends of the scale */
.scale-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    width: 100%;
    color: #64748b;
    font-size: 0.88rem;
    margin-bottom: 0.55rem;
}

.scale-labels span:first-child {
    text-align: left;
}

.scale-labels span:last-child {
    text-align: right;
}

/* One draggable thumb instead of 5/7 separate circles */
.likert-slider {
    display: block;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.likert-slider::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
}

.likert-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    margin-top: -8.5px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #0d6efd;
    box-shadow: 0 0 0 1px #0d6efd, 0 3px 8px rgba(15, 23, 42, 0.2);
    appearance: none;
    -webkit-appearance: none;
}

.likert-slider::-moz-range-track {
    height: 5px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
}

.likert-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #0d6efd;
    box-shadow: 0 0 0 1px #0d6efd, 0 3px 8px rgba(15, 23, 42, 0.2);
}

.likert-slider:focus-visible {
    outline: none;
}

.likert-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px #0d6efd, 0 0 0 5px rgba(13, 110, 253, 0.18);
}

.likert-slider:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 1px #0d6efd, 0 0 0 5px rgba(13, 110, 253, 0.18);
}

.scale-numbers {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1;
}

.scale-required-message {
    display: none;
    margin-top: 0.65rem;
    color: #b42318;
    font-size: 0.82rem;
    font-weight: 600;
}

.scale-item.scale-unanswered {
    margin-left: -0.7rem;
    margin-right: -0.7rem;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    border-radius: 10px;
    background: rgba(220, 53, 69, 0.045);
}

.scale-item.scale-unanswered .scale-required-message {
    display: block;
}

.scale-item.scale-unanswered .likert-slider::-webkit-slider-runnable-track {
    background: #e6a5ad;
}

.scale-item.scale-unanswered .likert-slider::-moz-range-track {
    background: #e6a5ad;
}

@media (max-width: 576px) {
    .questionnaire-section {
        padding: 1rem;
    }

    .questionnaire-section + .questionnaire-section {
        margin-top: 1.6rem;
    }

    .scale-labels {
        gap: 0.75rem;
        font-size: 0.77rem;
    }

    .scale-question {
        font-size: 0.95rem;
    }

    .scale-numbers {
        font-size: 0.76rem;
    }
}

/* GenAI writing page - two-column layout */

.writing-card-wide {
    max-width: 1350px;
}

.writing-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 28px;
    align-items: start;
}

/* LEFT: actual writing task */
.writing-task-column {
    order: 1;
    min-width: 0;
}

/* RIGHT: GenAI assistant */
.writing-ai-column {
    order: 2;
    min-width: 0;
    position: sticky;
    top: 24px;
}

.writing-ai-column .ai-panel {
    margin-bottom: 0;
}

.writing-task-column .task-prompt-box {
    background: #f8fafc;
    border: 1px solid #dbe3ec;
    border-left: 4px solid #2563eb;
    padding: 18px;
    border-radius: 12px;
}

.writing-textarea {
    min-height: 330px;
}

/* Chat sizing */
.writing-ai-column .chat-box {
    min-height: 320px;
    max-height: 470px;
}

.writing-ai-column .user-message {
    margin-left: 40px;
}

.writing-ai-column .ai-message {
    margin-right: 40px;
}


/* Smaller screens */
@media (max-width: 900px) {
    .writing-split {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .writing-task-column {
        order: 1;
    }

    .writing-ai-column {
        order: 2;
        position: static;
    }

    .writing-card-wide {
        max-width: 950px;
    }

    .writing-ai-column .chat-box {
        min-height: 240px;
        max-height: 380px;
    }
}