/* Learner-facing Phase 3 result presenters: Speaking, Writing, and SST. */

.pte-subjective-result,
.pte-subjective-result *,
.pte-phase-three-writing-immediate,
.pte-phase-three-sst-immediate {
    box-sizing: border-box;
    min-width: 0;
}

.pte-subjective-result p,
.pte-subjective-result li,
.pte-subjective-result strong,
.pte-subjective-result span,
.pte-result-prompt,
.pte-result-response {
    overflow-wrap: anywhere;
    word-break: normal;
}

.pte-subjective-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, .75fr);
    gap: 1.25rem;
    align-items: start;
}

.pte-subjective-state {
    margin: 0 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid #d7d2bd;
    border-radius: 12px;
    background: #fff9e7;
    color: #5f501d;
    font-weight: 650;
}

.pte-subjective-state.is-failed,
.pte-subjective-state.is-timed_out {
    border-color: #e7c3bf;
    background: #fff2f0;
    color: #7b3029;
}

.pte-subjective-task img {
    display: block;
    width: min(100%, 760px);
    max-height: 480px;
    margin: 1rem 0;
    border-radius: 14px;
    object-fit: contain;
    background: #f4f4ef;
}

.pte-subjective-task details,
.pte-sst-phase-three-result details {
    margin-top: .85rem;
}

.pte-subjective-task details p,
.pte-sst-phase-three-result details p {
    white-space: pre-wrap;
    line-height: 1.65;
}

.pte-subjective-media {
    display: grid;
    gap: .5rem;
    margin-top: 1rem;
    padding: .85rem;
    border: 1px solid var(--border, #deded5);
    border-radius: 12px;
    background: var(--surface-soft, #f7f7f2);
}

.pte-subjective-media > span {
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pte-subjective-media audio,
.pte-sst-phase-three-result audio {
    width: 100%;
}

.pte-subjective-media.is-unavailable {
    border-style: dashed;
    color: var(--text-muted, #62645d);
}

.pte-subjective-media p {
    margin: 0;
}

.pte-subjective-traits,
.pte-writing-traits {
    display: grid;
    gap: .75rem;
}

.pte-subjective-trait,
.pte-writing-traits article {
    padding: .85rem;
    border: 1px solid var(--border, #deded5);
    border-radius: 12px;
    background: var(--surface, #fff);
}

.pte-subjective-trait > div,
.pte-writing-traits article > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
}

.pte-subjective-trait > span {
    display: block;
    height: 6px;
    margin-top: .6rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e7e8df;
}

.pte-subjective-trait > span i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #627f61;
}

.pte-writing-traits article p {
    margin: .55rem 0 0;
    color: var(--text-muted, #62645d);
    line-height: 1.5;
}

.pte-subjective-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.pte-subjective-facts > div {
    display: grid;
    gap: .25rem;
    padding: .8rem;
    border: 1px solid var(--border, #deded5);
    border-radius: 10px;
}

.pte-subjective-facts span {
    color: var(--text-muted, #62645d);
    font-size: .78rem;
}

.pte-subjective-facts .is-warning {
    border-color: #d7b65c;
    background: #fff9e8;
}

.pte-subjective-evidence-block {
    margin-top: 1rem;
}

.pte-subjective-coverage {
    display: grid;
    gap: .55rem;
    margin: .75rem 0 0;
    padding: 0;
    list-style: none;
}

.pte-subjective-coverage li {
    display: grid;
    grid-template-columns: 1.35rem minmax(0, 1fr);
    gap: .45rem;
    align-items: start;
    padding: .7rem .8rem;
    border-radius: 10px;
    background: #f2f4ef;
}

.pte-subjective-coverage li.is-covered {
    background: #edf6ec;
    color: #2c5b32;
}

.pte-subjective-coverage li.is-missed {
    background: #fff6ed;
    color: #70472b;
}

.pte-subjective-coaching-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.pte-subjective-coaching {
    padding: 1rem;
    border: 1px solid var(--border, #deded5);
    border-radius: 14px;
    background: var(--surface, #fff);
}

.pte-subjective-coaching h3 {
    margin: 0 0 .65rem;
    font-size: 1rem;
}

.pte-subjective-coaching ul {
    display: grid;
    gap: .55rem;
    margin: 0;
    padding-left: 1.15rem;
}

.pte-subjective-priority {
    display: grid;
    gap: .35rem;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 14px;
    background: #26382d;
    color: #fff;
}

.pte-subjective-priority span {
    color: #bdd5c0;
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pte-subjective-word-map {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.pte-subjective-word-map > span {
    display: inline-flex;
    gap: .35rem;
    align-items: baseline;
    padding: .35rem .55rem;
    border-radius: 8px;
    background: #edf5ec;
}

.pte-subjective-word-map > span.is-review {
    background: #fff0e7;
}

.pte-subjective-word-map small {
    opacity: .7;
}

.pte-subjective-transcript,
.pte-subjective-notes {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: var(--surface-soft, #f5f5ef);
}

.pte-subjective-transcript > span,
.pte-subjective-notes > span {
    display: block;
    margin-bottom: .4rem;
    color: var(--text-muted, #62645d);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.pte-subjective-transcript p,
.pte-subjective-notes p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.65;
}

.pte-writing-reviewed-response {
    white-space: pre-wrap;
}

.pte-writing-reviewed-response mark {
    border-bottom: 2px solid #bd5f4f;
    background: #fff0a8;
    color: inherit;
}

.pte-writing-language-issues {
    display: grid;
    gap: .65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pte-writing-language-issues li {
    display: grid;
    gap: .25rem;
    padding: .75rem;
    border: 1px solid var(--border, #deded5);
    border-radius: 10px;
}

.pte-writing-language-issues span {
    color: var(--text-muted, #62645d);
}

.pte-writing-better-response.is-locked {
    border-style: dashed;
}

.pte-writing-better-response button,
.pte-writing-better-response a {
    display: inline-flex;
    margin-top: .7rem;
}

.pte-phase-three-immediate-header + .ps-result-tabs,
.pte-phase-three-writing-immediate .pw-result-tabs,
.pte-phase-three-sst-immediate .pte-sst-result-tabs {
    overflow-x: auto;
}

@media (max-width: 760px) {
    .pte-subjective-overview-grid,
    .pte-subjective-coaching-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pte-subjective-facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .pte-subjective-task img {
        max-height: 320px;
    }

    .pte-result-review.is-phase-three .pte-result-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pte-result-review.is-phase-three .pte-result-tabs button {
        padding-inline: .55rem;
        font-size: .82rem;
    }
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .pte-subjective-state {
        background: #39341f;
        color: #f4e3a9;
        border-color: #665d35;
    }

    html:not([data-theme="light"]) .pte-subjective-state.is-failed,
    html:not([data-theme="light"]) .pte-subjective-state.is-timed_out {
        background: #3c2424;
        color: #ffc8c1;
        border-color: #70403b;
    }

    html:not([data-theme="light"]) .pte-subjective-coverage li,
    html:not([data-theme="light"]) .pte-subjective-word-map > span {
        background: #27322c;
        color: #d8e5d9;
    }

    html:not([data-theme="light"]) .pte-subjective-coverage li.is-missed,
    html:not([data-theme="light"]) .pte-subjective-word-map > span.is-review {
        background: #402f25;
        color: #f4cfb7;
    }
}

html[data-theme="dark"] .pte-subjective-state {
    background: #39341f;
    color: #f4e3a9;
    border-color: #665d35;
}
