.test-page {
    min-height: calc(100vh - 110px);
    padding: 32px 20px 48px;
    color: #24313a;
    font-family: 'Stag Sans LC', Arial, sans-serif;
}

.test-shell {
    width: min(900px, 100%);
    min-height: 680px;
    margin: 0 auto;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(19, 39, 52, .14);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(10, 29, 40, .18);
}

.test-kicker {
    display: block;
    color: #62727c;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.test-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 680px;
    padding: 54px 64px 38px;
    box-sizing: border-box;
    background: #fff;
}

.test-progress {
    display: grid;
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: clamp(4px, .65vw, 9px);
    align-items: center;
    width: 72%;
    margin-bottom: 38px;
    margin-left: auto;
    margin-right: auto;
}

.test-progress-dot {
    display: block;
    width: 100%;
    max-width: 24px;
    padding: 0;
    aspect-ratio: 1;
    justify-self: center;
    background: #d7e3e8;
    border: 1px solid #b7cbd4;
    border-radius: 50%;
    box-shadow: inset 0 2px 3px rgba(35, 71, 89, .2);
    color: #526b77;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.test-progress-dot:hover { border-color: #17ade6; transform: scale(1.15); }
.test-progress-dot.is-current { outline: 2px solid #17ade6; outline-offset: 3px; }

.test-progress-dot.is-correct {
    color: #fff;
    background: #24b474;
    border-color: #168254;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, .42), 0 0 8px rgba(36, 180, 116, .9), 0 0 14px rgba(36, 180, 116, .5);
    transform: scale(1.08);
}

.test-progress-dot.is-wrong {
    color: #fff;
    background: #dd165d;
    border-color: #9f0e42;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, .38), 0 0 8px rgba(221, 22, 93, .9), 0 0 14px rgba(221, 22, 93, .5);
    transform: scale(1.08);
}

.test-question-header h1,
.test-result h1 {
    margin: 10px 0 34px;
    color: #172b36;
    font-size: 34px;
    line-height: 1.25;
    letter-spacing: 0;
}

.test-question-header { text-align: center; }

.test-question-prompt {
    margin: -12px 0 28px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
}

.test-question-prompt-multi-fill-gap {
    line-height: 2.6;
}

.test-question-prompt-multi-fill-gap .test-gap-cell {
    min-width: 132px;
    min-height: 40px;
    padding: 6px 18px;
    color: #263740;
    background: #f5f7f8;
    border-color: #dce3e6;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.test-question-prompt-multi-fill-gap .test-gap-cell.is-filled:not(.is-answer-correct):not(.is-answer-wrong) {
    color: #17ade6;
}

.test-question-image {
    display: flex;
    justify-content: center;
    margin: -18px 0 22px;
}

.test-question-image img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
}

.test-audio-player {
    display: flex;
    gap: 22px;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    margin: -12px 0 22px;
}

.test-audio-control {
    flex: 0 0 auto;
    padding: 0;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 0;
    border: 0;
    cursor: pointer;
}

.test-audio-rewind,
.test-audio-forward {
    width: 70px;
    height: 73px;
    background-size: 70px auto;
}

.test-audio-rewind { background-image: url('/application/templates/images/common/songs/buttons-prev.png'); }
.test-audio-forward { background-image: url('/application/templates/images/common/songs/buttons-next.png'); }
.test-audio-rewind:active,
.test-audio-forward:active { background-position: 0 -73px; }

.test-audio-toggle {
    width: 120px;
    height: 96px;
    background-image: url('/application/templates/images/common/songs/buttons-play.png');
    background-size: 120px auto;
}

.test-audio-toggle.is-playing { background-image: url('/application/templates/images/common/songs/buttons-pause.png'); }
.test-audio-toggle:active { background-position: 0 -96px; }
.test-audio-control:focus-visible { outline: 4px solid rgba(23, 173, 230, .3); outline-offset: 4px; border-radius: 50%; }

.test-gap-cell {
    display: inline-flex;
    min-width: 150px;
    min-height: 36px;
    margin: 0 8px;
    padding: 2px 14px;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    color: #124f67;
    background: #f1f6f8;
    border: 2px solid #b9ccd5;
    border-radius: 6px;
    box-shadow: inset 0 2px 4px rgba(35, 71, 89, .1);
    font-size: .8em;
    font-family: inherit;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.test-gap-cell.is-selected {
    background: #e0f1f8;
    border-color: #17ade6;
    box-shadow: 0 0 0 3px rgba(23, 173, 230, .18);
}

.test-gap-cell.is-answer-correct { color: #12683f; background: #e2f5eb; border-color: #24b474; }
.test-gap-cell.is-answer-wrong { color: #982044; background: #fbe4ec; border-color: #dd165d; }
.test-gap-cell:focus-visible { outline: 3px solid rgba(23, 173, 230, .25); outline-offset: 2px; }

.test-answer-area { min-height: 0; }

.test-sentence-order {
    display: grid;
    gap: 42px;
    justify-items: center;
    padding-top: 10px;
}

.test-multi-fill-gap { padding-top: 0; }

.test-caption-pictures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: 16px;
    width: 100%;
}
.test-caption-picture { margin: 0; min-width: 0; display: grid; grid-template-rows: auto auto; align-content: start; justify-items: center; gap: 12px; }
.test-caption-picture img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.test-caption-slot {
    width: fit-content; max-width: 100%; min-width: min(132px, 100%); min-height: 40px; padding: 6px 18px;
    border: 2px solid #dce3e6; border-radius: 6px; background: #f5f7f8;
    color: #263740; font: inherit; font-size: 18px; line-height: 1.35;
    overflow-wrap: anywhere; cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s;
}
.test-caption-slot.is-selected, .test-caption-slot:focus-visible { border-color: #17ade6; outline: 0; }
.test-caption-slot.is-answer-correct { color: #12683f; background: #e2f5eb; border-color: #24b474; }
.test-caption-slot.is-answer-wrong { color: #982044; background: #fbe4ec; border-color: #dd165d; }
.test-caption-slot:disabled { cursor: default; }

.test-sentence-slots,
.test-sentence-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.test-sentence-order-vertical .test-sentence-slots {
    flex-direction: column;
    align-items: stretch;
}

.test-sentence-order-vertical .test-sentence-slot {
    width: 100%;
    text-align: left;
}

.test-sentence-order-vertical .test-sentence-word { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.test-sentence-order-vertical .test-sentence-slot { min-width: 0; overflow-wrap: anywhere; }

.test-sentence-slot,
.test-sentence-word {
    min-width: 132px;
    min-height: 40px;
    padding: 6px 18px;
    color: #263740;
    background: #f5f7f8;
    border: 2px solid #dce3e6;
    border-radius: 6px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    cursor: grab;
    transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.test-sentence-slot {
    color: #124f67;
    background: #f1f6f8;
    border-color: #b9ccd5;
    box-shadow: inset 0 2px 4px rgba(35, 71, 89, .1);
}

.test-sentence-slot:not(.is-filled) { cursor: default; }
.test-sentence-slot.is-filled { background: #e0f1f8; border-color: #17ade6; }
.test-sentence-slot.is-answer-correct { color: #12683f; background: #e2f5eb; border-color: #24b474; cursor: default; }
.test-sentence-slot.is-answer-wrong { color: #982044; background: #fbe4ec; border-color: #dd165d; cursor: default; }
.test-sentence-word:hover { border-color: #17ade6; transform: translateY(-2px); }
.test-sentence-word:active { cursor: grabbing; }
.test-sentence-word.is-used { visibility: hidden; pointer-events: none; }
.test-sentence-word.is-dragging,
.test-sentence-slot .is-dragging { opacity: .45; }
.test-sentence-slot:focus-visible,
.test-sentence-word:focus-visible { outline: 3px solid rgba(23, 173, 230, .25); outline-offset: 2px; }
.test-group-bank, .test-group-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.test-group-bank { margin-bottom: 24px; }
.test-group-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 20px; }
.test-group-column {
    min-width: 0; min-height: 180px; padding: 20px; text-align: center;
    border: 2px solid #dce3e6; border-radius: 8px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.test-group-column.is-drag-over { border-color: #17ade6; box-shadow: 0 0 0 3px rgba(23, 173, 230, .15); }
.test-group-title { margin: 0 0 20px; font-size: 20px; font-weight: 700; line-height: 1.4; letter-spacing: 0; overflow-wrap: anywhere; }
.test-group-word, .test-group-placed {
    display: inline-block; max-width: 100%; overflow-wrap: anywhere; padding: 8px 18px;
    border: 2px solid #dce3e6; border-radius: 6px; background: #f5f7f8;
    color: #263740; font: inherit; font-size: 18px; letter-spacing: 0;
}
.test-group-column[aria-disabled="false"] { cursor: pointer; }
.test-group-word:not(:disabled) { cursor: grab; }
.test-group-word.is-dragging { opacity: .45; }
.test-group-word.is-selected { border-color: #17ade6; background: #e0f1f8; }
.test-group-word:disabled { opacity: .45; }
.test-group-placed.is-answer-correct { border-color: #24b474; background: #e2f5eb; color: #12683f; }
.test-group-placed.is-answer-wrong { border-color: #dd165d; background: #fbe4ec; color: #982044; }
.test-group-word:focus-visible, .test-group-column:focus-visible { outline: 3px solid #17ade6; outline-offset: 2px; }
.test-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.test-writing-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    max-width: 620px;
    margin: 0 auto;
}

.test-writing-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
}

.test-writing-item span:empty { display: none; }
.test-writing-item span { min-width: 0; overflow-wrap: anywhere; }

.test-writing-item input {
    width: 132px;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 6px 18px;
    color: #124f67;
    background: #fff;
    border: 2px solid #dce3e6;
    border-bottom-color: #17ade6;
    border-radius: 6px;
    outline: 0;
    font: inherit;
}

.test-writing-item input:focus { border-color: #17ade6; }
.test-writing-item input.is-answer-correct { color: #12683f; background: #e2f5eb; border-color: #24b474; }
.test-writing-item input.is-answer-wrong { color: #982044; background: #fbe4ec; border-color: #dd165d; }

.test-statement-list {
    display: grid;
    gap: 5px;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
}

.test-chain-scroll {
    width: 100%;
    overflow-x: auto;
    padding: 4px 2px 14px;
}

.test-chain-canvas {
    position: relative;
    min-width: 820px;
}

.test-chain-canvas-vertical { min-width: 0; }

.test-chain-lines {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}

.test-chain-lines line {
    stroke-width: 1;
    stroke-linecap: round;
    opacity: .9;
}

.test-chain-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 26px;
}

.test-chain-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
}

.test-chain-column .test-chain-row-choices { display: grid; gap: 10px; }

.test-chain-grid-vertical {
    grid-template-columns: 1fr;
    gap: 42px;
}

.test-chain-row {
    display: flex;
    justify-content: center;
}

.test-chain-row-choices {
    display: grid;
    grid-template-columns: repeat(3, var(--chain-cell-width, max-content));
    gap: 20px;
    justify-content: center;
}

.test-chain-row .test-chain-choice {
    width: var(--chain-cell-width, max-content);
    min-width: 0;
    min-height: 30px;
    padding: 3px 7px;
    font-size: 14px;
}

.test-chain-column h2 {
    min-height: 34px;
    margin: 0 0 4px;
    color: #526b77;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.test-chain-choice {
    width: 100%;
    min-height: 38px;
    padding: 5px 8px;
    color: #263740;
    background: #f5f7f8;
    border: 2px solid #dce3e6;
    border-radius: 6px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}

.test-chain-choice:hover:not(:disabled) { border-color: #17ade6; }
.test-chain-choice.is-selected { color: #124f67; background: #e0f1f8; border-color: #17ade6; transform: translateY(-2px); }
.test-chain-choice.is-mismatch { color: #982044; background: #fbe4ec; border-color: #dd165d; }
.test-chain-choice.is-solved { color: var(--chain-color); background: #fff; border-color: var(--chain-color); cursor: default; }
.test-chain-choice:focus-visible { outline: 3px solid rgba(23, 173, 230, .25); outline-offset: 2px; }
.chain-color-0 { --chain-color: #17ade6; }
.chain-color-1 { --chain-color: #8b5cf6; }
.chain-color-2 { --chain-color: #24b474; }
.chain-color-3 { --chain-color: #d88800; }
.chain-color-4 { --chain-color: #e84b8a; }
.chain-color-5 { --chain-color: #ef6c35; }

.test-chain-lines line.is-mismatch-line { stroke-width: 1; }

.test-option {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 0;
    cursor: pointer;
}

.test-option.is-locked { cursor: default; }

.test-options .test-option { flex: 0 0 auto; }

.test-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.test-option span {
    display: block;
    padding: 6px 18px;
    background: #f5f7f8;
    border: 2px solid #dce3e6;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1.35;
    transition: border-color .15s ease, background .15s ease;
}

.test-option input:checked + span { color: #124f67; background: #e0f1f8; border-color: #17ade6; }
.test-option input:focus-visible + span { outline: 3px solid rgba(23, 173, 230, .25); }
.test-option.is-answer-correct span { color: #12683f; background: #e2f5eb; border-color: #24b474; }
.test-option.is-answer-correct input:checked + span { color: #12683f; background: #e2f5eb; border-color: #24b474; }
.test-option.is-answer-wrong input:checked + span { color: #982044; background: #fbe4ec; border-color: #dd165d; }

.test-statement {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: 100%;
    padding: 3px 0;
}

.test-match-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.test-match-column { display: grid; align-content: start; gap: 12px; }
.test-match-column:first-child { justify-items: end; }
.test-match-column:last-child { justify-items: start; }

.test-match-choice {
    width: max-content;
    max-width: 100%;
    min-height: 36px;
    padding: 4px 16px;
    color: #263740;
    background: #f5f7f8;
    border: 2px solid #dce3e6;
    border-radius: 6px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    opacity: 1;
    transition: color .35s ease, background-color .35s ease, border-color .35s ease, box-shadow .35s ease, transform .15s ease, opacity 1s ease;
}

.test-match-choice:hover:not(:disabled) { border-color: #17ade6; }
.test-match-choice:disabled { cursor: default; }
.test-match-choice.is-selected { color: #124f67; background: #e0f1f8; border-color: #17ade6; transform: translateY(-2px); }
.test-match-choice.is-mismatch {
    color: #982044;
    background: #fbe4ec;
    border-color: #dd165d;
    box-shadow: 0 0 0 3px rgba(221, 22, 93, .08);
    transform: translateY(-2px);
    pointer-events: none;
}
.test-match-choice.is-solving { opacity: 0; pointer-events: none; }
.test-match-choice.is-solved { visibility: hidden; opacity: 0; pointer-events: none; }

.test-statement p { margin: 0; font-size: 17px; white-space: nowrap; }
.test-segmented { display: flex; justify-content: flex-end; }
.test-segmented .test-option { flex: 0 0 auto; }
.test-segmented .test-option span { padding: 6px 10px; text-align: center; border-radius: 0; }
.test-segmented .test-option:first-child span { border-radius: 5px 0 0 5px; }
.test-segmented .test-option:last-child span { margin-left: -2px; border-radius: 0 5px 5px 0; }

.test-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: auto;
    padding-top: 24px;
}

.test-lives {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 64px;
}

.test-lives[hidden] { display: none; }

.test-life {
    color: #ff3b3b;
    transition: color .2s ease;
}

.test-life svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.test-life.is-lost {
    color: #b8bec2;
}

.test-button {
    position: relative;
    min-width: 190px;
    height: 64px;
    padding: 0 28px;
    color: #fff;
    background: #17ade6;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 8px 0 #326699;
    font-family: 'M PLUS Rounded 1c', 'Stag Sans LC', Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 64px;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.test-button:hover:not(:disabled) { background: #52b8e0; }
.test-button:active:not(:disabled) { box-shadow: 0 3px 0 #326699; transform: translateY(5px); }
.test-button:focus-visible { outline: 4px solid rgba(23, 173, 230, .3); outline-offset: 4px; }
.test-button:disabled { opacity: .45; box-shadow: 0 8px 0 #60778c; cursor: default; }
.test-button.is-correct { background: #24b474; box-shadow: 0 8px 0 #17784d; }
.test-button.is-correct:hover { background: #35c684; }
.test-button.is-correct:active { box-shadow: 0 3px 0 #17784d; }
.test-button.is-wrong { background: #dd165d; box-shadow: 0 8px 0 #98103f; }
.test-button.is-wrong:hover { background: #e63776; }
.test-button.is-wrong:active { box-shadow: 0 3px 0 #98103f; }
.test-result { padding-top: 100px; text-align: center; }
.test-result p { margin: -18px 0 30px; font-size: 18px; }

@media (max-width: 800px) {
    .test-page { padding: 12px; }
    .test-shell { min-height: 0; }
    .test-workspace { min-height: 580px; padding: 30px 20px 24px; }
    .test-progress { gap: 3px; width: 100%; }
    .test-progress-dot { max-width: 18px; font-size: 9px; }
    .test-question-header h1, .test-result h1 { font-size: 26px; }
    .test-question-image { margin-top: -8px; }
    .test-question-image img { max-height: 240px; }
    .test-audio-player { gap: 12px; min-height: 88px; }
    .test-audio-rewind, .test-audio-forward { width: 56px; height: 58px; background-size: 56px auto; }
    .test-audio-rewind:active, .test-audio-forward:active { background-position: 0 -58px; }
    .test-audio-toggle { width: 96px; height: 77px; background-size: 96px auto; }
    .test-audio-toggle:active { background-position: 0 -77px; }
    .test-statement { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
    .test-statement p { white-space: normal; }
    .test-writing-list { grid-template-columns: 1fr; }
    .test-match-board { gap: 10px; }
    .test-match-choice { min-height: 34px; padding: 4px 8px; font-size: 16px; }
    .test-sentence-order { gap: 30px; }
    .test-sentence-slot, .test-sentence-word { min-width: 110px; min-height: 38px; padding: 5px 12px; font-size: 16px; }
}

.test-answer-label {
    display: inline;
    margin-right: 8px;
    color: #9a9fa3;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 700;
    font-style: normal;
    line-height: inherit;
    letter-spacing: 0;
    pointer-events: none;
    user-select: none;
}

.is-answer-correct .test-answer-label,
.is-answer-wrong .test-answer-label,
.test-match-choice.is-mismatch .test-answer-label,
.test-chain-choice.is-mismatch .test-answer-label,
.test-chain-choice.is-solved .test-answer-label {
    color: inherit;
}
