:root {
    --primary: #3157d5;
    --primary-hover: #2445b5;
    --text: #202938;
    --muted: #697586;
    --border: #e1e6ee;
    --background: #f5f7fb;
    --surface: #ffffff;
    --success: #18794e;
    --success-bg: #eaf7ef;
    --danger: #b42318;
    --danger-bg: #fff0ee;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(28, 39, 60, .05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

.translator {
    width: min(100% - 32px, 1000px);
    margin: 42px auto 64px;
}

.page-header {
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.2;
    letter-spacing: -.8px;
}

.subtitle {
    margin-bottom: 0;
    color: var(--muted);
}

.panel {
    margin-bottom: 22px;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.language-panel {
    padding: 20px 24px;
}

.language-form {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

.language-form label {
    margin: 0;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #d5dce7;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

input, select {
    min-height: 44px;
    padding: 10px 12px;
}

textarea {
    display: block;
    min-height: 20px;
    padding: 12px 14px;
    resize: vertical;
   
  height: calc(2 * 1.4em + 10px); /* Ajustez selon votre line-height et vos bordures */
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(49, 87, 213, .12);
}

.question-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 32px 0 18px;
}

.question-heading h2 {
    margin-bottom: 0;
    font-size: 25px;
}

.status, .correct-tag {
    display: inline-block;
    border-radius: 6px;
    background: #fff3d9;
    color: #865b00;
    font-size: 12px;
    font-weight: 700;
}

.status {
    padding: 7px 11px;
}

.correct-tag {
    margin-left: 5px;
    padding: 3px 6px;
    background: var(--success-bg);
    color: var(--success);
    white-space: nowrap;
}

.reference-panel {
    border-left: 4px solid var(--primary);
}

.reference-panel h3,
.section-heading h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.reference-question {
    margin-bottom: 22px;
    font-size: 17px;
    font-weight: 650;
    white-space: normal;
    overflow-wrap: anywhere;
}

.answer-list {
    display: grid;
    gap: 10px;
}

.answer-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow-wrap: anywhere;
}

.answer-letter {
    display: inline-flex;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #edf1ff;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.explanation {
    margin-top: 22px;
    padding: 15px 17px;
    border-radius: 9px;
    background: #f7f8fa;
}

.explanation strong {
    display: block;
    margin-bottom: 6px;
}

.explanation p {
    margin: 0;
    color: #4c586b;
}

.section-heading {
    margin-bottom: 22px;
}

.section-heading h3 {
    margin-bottom: 4px;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.translation-form > .panel > label {
    margin-top: 20px;
}

.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 18px;
    margin-top: 22px;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.form-footer p {
    max-width: 470px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

.button-primary {
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border-radius: 9px;
    font-weight: 600;
}

.success {
    background: var(--success-bg);
    color: var(--success);
}

.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.empty-state {
    padding: 45px 24px;
    text-align: center;
}

.empty-state h2 {
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.completion-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    font-size: 25px;
    font-weight: 800;
}


@media (max-width: 650px) {
    .translator {
        width: min(100% - 20px, 1000px);
        margin: 22px auto 40px;
    }

    .panel {
        padding: 19px;
        margin-bottom: 16px;
    }

    .language-form {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .question-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .fields-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .button-primary {
        width: 100%;
    }
}

.translation-row {
    padding: 20px 0;
    border-bottom: 1px solid #e2e8f0;
}

.source-line {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 6px;
}

.source-label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
}

.source-text {
    line-height: 1.6;
    white-space: normal;
    overflow-wrap: anywhere;
}

.translation-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    font-weight: 700;
}

.language-flag {
    display: inline-block;
    width: 28px;
    height: 19px;
    object-fit: contain;
    flex-shrink: 0;
}

.translation-row textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.translation-row textarea:focus {
    outline: 2px solid #93c5fd;
    border-color: #2563eb;
}

@media (max-width: 600px) {
    .translation-row {
        padding: 15px 0;
    }

    .source-line {
        padding: 10px;
    }
}