:root {
    color-scheme: light;
    font-family: Poppins, "Avenir Next", system-ui, sans-serif;
    color: #333;
    background: #f9f9f9;
    --header-blue: #007bff;
    --blue: #0059ae;
    --bot: #e0f4ff;
    --reply: #d4edda;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow-anchor: none; }
button { font: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #1260aa; outline-offset: 3px; }

.site-header {
    min-height: 39px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    color: white;
    background: var(--header-blue);
    border-bottom: 2px solid #0056b3;
}
.site-header h1 { margin: 0; font-size: .94rem; font-weight: 680; line-height: 1.2; }
.mark { width: 20px; text-align: center; font-size: 15px; }

.quiz {
    display: grid;
    grid-template-rows: minmax(130px, 1fr) auto auto;
    height: calc(95svh - 39px);
    min-height: 458px;
}
.quiz.is-complete { height: auto; min-height: calc(95svh - 39px); }
.conversation {
    width: min(100%, 700px);
    margin: 0 auto;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 10px #00000015;
    scrollbar-color: #cdd9e4 transparent;
}
.quiz.is-complete .conversation { overflow: visible; }
.messages { padding: 11px 13px; display: flex; flex-direction: column; gap: 10px; }

.turn { align-self: flex-start; max-width: 85%; min-width: 0; }
.message-body, .reply { border-radius: 10px; padding: 9px 13px; line-height: 1.42; overflow-wrap: anywhere; }
.message-body { background: var(--bot); color: #085aa9; }
.question { margin: 0; font-size: .98rem; font-weight: 600; }
.turn.past .question { font-size: .9rem; font-weight: 500; }
.reply { align-self: flex-end; max-width: 80%; margin: 0; background: var(--reply); color: #155724; font-size: .92rem; }
.exam-stage { margin: 0 0 3px; color: #315d82; font-size: .73rem; font-weight: 750; }
.aside-turn { margin-left: 9px; max-width: 88%; }
.aside-note { padding: 7px 10px; background: #fff8df; border-left: 3px solid #ceae60; border-radius: 2px 7px 7px 2px; color: #574117; font-size: .87rem; line-height: 1.34; }
.aside-note p { margin: 0; }
.aside-note .aside-speaker { margin-bottom: 3px; font-size: .71rem; font-weight: 750; }
.aside-note .doctor-interjection { margin-top: 4px; color: #164d7a; }
.doctor-interjection::before { content: "Doctor "; font-weight: 750; }
.colour-chip { display: inline-block; flex: 0 0 20px; width: 20px; height: 20px; border-radius: 5px; border: 1px solid #0003; }
.colour-chip.red { background: #db514a; }
.colour-chip.blue { background: #4076c5; }
.colour-chip.yellow { background: #f6cb57; }
.colour-chip.green { background: #477e5e; }

.composer {
    border-top: 2px solid #e0e0e0;
    background: #f9f9f9;
    padding: 9px 11px;
}
.choices, .result-actions, .analysis-actions { max-width: 600px; margin: 0 auto; }
.choices { display: grid; grid-template-columns: 1fr; gap: 6px; }
.choice {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 6px 13px;
    text-align: left;
    line-height: 1.23;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #fff;
    color: #323232;
    box-shadow: 0 2px 4px #0000000a;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 530;
    transition: border-color 150ms, background-color 150ms;
}
.choice-text { flex: 1; }
.choices.mouse-hover .choice:not(:disabled):hover { background: #edf6ff; border-color: #5894ce; }
.choice.is-selected { background: #dceeff; border-color: #6a9ac5; }
.choice:disabled { cursor: default; }

.quiz-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 41px;
    text-align: center;
    border-top: 2px solid #ccc;
    background: #e9ecef;
    color: #555;
    font-size: .83rem;
}
.text-button {
    min-height: 36px;
    padding: 5px 8px;
    color: var(--blue);
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 650;
}
.text-button:hover { text-decoration: underline; }
.reopen-file { display: block; margin: 4px auto 0; }
.back-button { position: absolute; right: max(12px, calc((100% - 600px) / 2)); }

.dots { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 4px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; background: #2672ba; border-radius: 50%; animation: dot-pulse .72s infinite alternate; }
.dots i:nth-child(2) { animation-delay: .12s; }
.dots i:nth-child(3) { animation-delay: .24s; }
.thought-line { margin: 0; padding-block: 3px; color: #5f6872; font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }
.thought-line .dots i { background: currentColor; }
.enter { animation: appear .16s ease-out both; }

.result-turn { max-width: 100%; width: 100%; }
.result-card {
    margin-top: 7px;
    padding: 9px;
    border: 1px solid #c3deef;
    border-radius: 9px;
    background: white;
    color: #2a3c4f;
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 6px 9px;
    align-items: center;
}
.result-card img { display: block; width: 68px; height: 48px; object-fit: contain; border-radius: 4px; background: #eef3f8; }
.result-card .file-colour { display: flex; align-items: center; gap: 6px; color: var(--blue); font-size: .75rem; font-weight: 700; }
.file-colour .colour-chip { flex-basis: 12px; width: 12px; height: 12px; border-radius: 3px; }
.result-card h2 { font-size: 1.23rem; line-height: 1.15; margin: 2px 0 0; }
.result-description { grid-column: 1 / -1; }
.result-card p, .observations { margin: 0; line-height: 1.35; font-size: .88rem; }
.observations { padding: 0 0 0 17px; margin-bottom: 6px; }
.result-card p + p { margin-top: 3px; }
.match-reason { font-weight: 650; }
.result-actions { display: grid; gap: 3px; }
.return-invite { margin: 5px 0 0; text-align: center; font-size: .8rem; color: #3f596e; }
.result-card .previous-game { margin-top: 6px; color: #3f596e; }
.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 8px 15px;
    border-radius: 8px;
    color: #fff;
    background: #005fba;
    text-decoration: none;
    font-weight: 700;
}
.play-button:hover { background: #00509f; }
.details { max-width: 700px; margin: 0 auto; padding: 26px 13px 35px; line-height: 1.5; }
.details h2 { font-size: 1.02rem; margin: 0 0 4px; }
.details p, .details ul { margin: 0; font-size: .92rem; }
.details ul { margin-top: 6px; padding-left: 20px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes dot-pulse { from { opacity: .28; transform: translateY(1px); } to { opacity: 1; transform: translateY(-2px); } }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
