.test-page { background: #f7fbff; }
.test-hero { padding: 22px 0 38px; background: radial-gradient(circle at 85% 15%, rgba(21,126,192,.16), transparent 28%), linear-gradient(180deg,#f1f9ff,#fff); }
.test-hero__grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 32px; align-items: end; }
.test-hero h1 { max-width: 850px; margin: 12px 0 14px; font-size: clamp(1.95rem,4vw,3.85rem); }
.test-hero .lead { max-width: 760px; color: #3b5e79; font-size: .96rem; line-height: 1.55; }
.test-rules { margin-top: 16px; display: grid; gap: 6px; }
.test-rules li { position: relative; padding-left: 25px; color: #36566f; font-size: .93rem; }
.test-rules li::before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: 900; }
.score-card { display: grid; gap: 8px; padding: 28px; border: 1px solid #b8d9ee; border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); }
.score-card__maximum { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 12px; align-items: center; color: var(--primary-dark); }
.score-card__maximum > span { min-width: 0; display: grid; justify-items: center; gap: 7px; }
.score-card__maximum strong { font-size: 4.2rem; font-weight: 900; line-height: .9; }
.score-card__maximum small { color: var(--muted); font-size: .72rem; font-weight: 780; line-height: 1; text-transform: lowercase; }
.score-card__maximum i { width: 4px; height: 4.2rem; flex: 0 0 auto; border-radius: 999px; background: currentColor; }
.score-card > div:not(.score-card__maximum) { padding-top: 9px; border-top: 1px solid var(--line); color: #36566f; }
.score-card > small { margin-top: 7px; color: var(--muted); }
.score-card__scale-link { margin-top: 7px; color: var(--primary-dark); font-size: .82rem; font-weight: 780; line-height: 1.4; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.score-card__scale-link:hover, .score-card__scale-link:focus-visible { color: var(--primary); }

.test-start { padding: 30px 0 20px; }
.start-card { display: grid; grid-template-columns: minmax(0,1fr) minmax(360px,.82fr); gap: 28px; padding: clamp(24px,3.5vw,36px); border: 1px solid var(--line); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.start-card h2 { font-size: clamp(1.7rem,3vw,2.55rem); }
.start-card p { color: var(--muted); font-size: .92rem; }
.field-label { display: block; margin-bottom: 7px; color: var(--secondary); font-weight: 800; }
.consent-check { margin-top: 17px; display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; color: #526b82; font-size: .85rem; line-height: 1.5; }
.consent-check input { width: 18px; height: 18px; margin-top: 2px; }
.consent-check a { color: var(--primary-dark); text-decoration: underline; }
.consent-note { margin: 8px 0 0 !important; color: var(--muted) !important; font-size: .78rem !important; }
.consent-note a { color: var(--primary-dark); text-decoration: underline; }
.start-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.button-start { min-height: 58px; padding-inline: 25px; border-color: #1f9d63; background: #1f9d63; color: #fff; box-shadow: 0 12px 28px rgba(31,157,99,.22); }
.button-start:hover, .button-start:focus-visible { background: #fff; color: #167b4c; }
.button-resume { min-height: 54px; border-color: #f28c28; background: #f28c28; color: #fff; box-shadow: 0 12px 28px rgba(197,96,12,.2); }
.button-resume:hover, .button-resume:focus-visible { background: #fff; color: #c5630f; }
.form-error { min-height: 1.4em; margin: 10px 0 0; color: #a52a2a !important; font-size: .86rem; }

.attempt-toolbar { position: sticky; top: 88px; z-index: 100; margin-top: 26px; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 13px 18px; border: 1px solid #b9d8ea; border-radius: 16px; background: rgba(255,255,255,.96); box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); }
.attempt-toolbar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 18px; }
.attempt-toolbar span { color: var(--muted); font-size: .84rem; }
.attempt-toolbar__actions { justify-content: flex-end; }
.attempt-toolbar [data-timer] { color: var(--primary-dark); font-variant-numeric: tabular-nums; font-weight: 850; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--primary-dark); font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.exam-form { padding: 42px 0 80px; }
.part-heading { margin: 48px 0 22px; display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.part-heading:first-child { margin-top: 0; }
.part-heading h2 { margin: 0; font-size: clamp(2rem,4vw,3.2rem); }
.part-heading > span { color: var(--muted); font-size: .86rem; }
.task-card { margin-bottom: 18px; padding: clamp(24px,4vw,38px); border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow-sm); }
.task-card > header { margin-bottom: 20px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.task-card > header span { color: var(--primary-dark); font-size: 1.18rem; font-weight: 900; }
.task-card > header small { padding: 5px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.task-card p { max-width: 960px; color: #304f68; font-size: .95rem; }
.condition-list { margin: -4px 0 18px; display: grid; gap: 8px; color: #304f68; }
.condition-list li { position: relative; padding-left: 22px; }
.condition-list li::before { content: "—"; position: absolute; left: 0; color: var(--primary); font-weight: 800; }
.task-card.is-correct { border-color: #72c995; background: #fbfffc; }
.task-card.is-incorrect { border-color: #e2a5a5; background: #fffdfd; }
.task-card.is-partial { border-color: #e4b35e; background: #fffdf7; }
.task-card--advanced { border-left: 5px solid var(--primary); }
.task-image { width: auto; max-width: min(100%,460px); max-height: 390px; display: block; margin: 22px auto; object-fit: contain; }
.task-image--wide { max-width: min(100%,620px); }
.answer-row { margin-top: 25px; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.answer-row label { display: grid; gap: 7px; color: var(--secondary); font-weight: 800; }
.answer-row--end { justify-content: flex-end; }
.answer-input { width: min(100%,260px); min-height: 48px; padding: 10px 13px; border: 1px solid #abc7da; border-radius: 11px; background: #fff; color: var(--ink); }
.answer-input--wide { width: min(100%,620px); }
.answer-input:focus { border-color: var(--primary); outline: 3px solid rgba(21,126,192,.14); }
.check-button { min-height: 48px; border-color: #aac8dc; background: #fff; color: var(--primary-dark); }
.answer-feedback { min-height: 1.5em; margin: 12px 0 0 !important; font-weight: 800; }
.is-correct .answer-feedback { color: #16713c; }
.is-incorrect .answer-feedback { color: #a02d2d; }
.answer-hint { margin-top: 15px; padding: 12px 14px; border-radius: 11px; background: #f3f8fc; font-size: .88rem !important; }
.answer-hint code { color: var(--primary-dark); }
.multi-answer { margin-top: 24px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.multi-answer label { display: grid; gap: 7px; color: var(--secondary); font-weight: 800; }
.multi-answer .answer-input { width: 100%; }

.advanced-parts { margin-top: 30px; display: grid; gap: 28px; }
.advanced-part { display: grid; gap: 14px; }
.advanced-prompt { margin: 0 !important; padding: 14px 16px; border-left: 4px solid var(--primary); border-radius: 0 11px 11px 0; background: #f2f8fc; color: var(--secondary) !important; font-weight: 720; }
.choice-grid { margin: 30px 0 0; padding: 0; border: 0; display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; }
.advanced-parts .choice-grid { margin-top: 0; }
.choice-grid legend { grid-column: 1 / -1; margin-bottom: 11px; color: var(--secondary); font-weight: 850; }
.choice-option { width: 100%; min-height: 66px; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 14px; align-items: center; padding: 15px 18px; border: 1px solid #bdd2e1; border-radius: 14px; background: #fff; color: #284d69; cursor: pointer; line-height: 1.5; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.choice-option:hover { border-color: var(--primary); background: #f4faff; }
.choice-option input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.choice-option:has(input:checked) { border-color: var(--primary); background: #eaf6ff; box-shadow: inset 0 0 0 1px var(--primary); }
.choice-option--unknown { color: var(--muted); }
.choice-grid.is-locked .choice-option { cursor: default; opacity: .62; }
.choice-grid.is-locked .choice-option:has(input:checked) { opacity: 1; }
.choice-note { margin: 15px 0 0 !important; color: var(--muted) !important; font-size: .82rem !important; }

.proof-toggle { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.proof-toggle legend { grid-column: 1 / -1; margin-bottom: 7px; color: var(--secondary); font-weight: 850; }
.proof-toggle label { min-height: 56px; display: grid; grid-template-columns: 21px 1fr; gap: 10px; align-items: center; padding: 13px 15px; border: 1px solid #bdd2e1; border-radius: 13px; background: #fff; color: #284d69; font-weight: 760; cursor: pointer; }
.proof-toggle input { width: 19px; height: 19px; margin: 0; accent-color: var(--primary); }
.proof-toggle label:hover { border-color: var(--primary); background: #f4faff; }
.proof-toggle label:has(input:checked) { border-color: var(--primary); background: #eaf6ff; box-shadow: inset 0 0 0 1px var(--primary); }
.proof-toggle.is-locked label { cursor: default; opacity: .62; }
.proof-toggle.is-locked label:has(input:checked) { opacity: 1; }

.exam-submit-action { margin: 34px 0 18px; display: flex; justify-content: center; }
.exam-submit-action .button { min-width: min(100%, 360px); }
.button-large { min-height: 58px; padding-inline: 28px; }
.result-panel { margin-top: 24px; padding: clamp(30px,5vw,52px); border: 1px solid #a9d4ee; border-radius: 28px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.result-numbers { margin: 26px 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.result-numbers div { padding: 22px; border-radius: 17px; background: #eff8fe; }
.result-numbers strong { display: block; color: var(--primary-dark); font-size: clamp(2.3rem,5vw,4rem); line-height: 1; }
.result-numbers span { display: block; margin-top: 8px; color: var(--muted); }
.result-note { max-width: 900px; margin-inline: auto; color: var(--muted); }
.result-panel .cta-row { justify-content: center; }

html[data-theme="dark"] .test-page { background: #081722; }
html[data-theme="dark"] .test-hero { background: radial-gradient(circle at 85% 15%, rgba(74,164,218,.14), transparent 28%), linear-gradient(180deg,#0b2130,#081722); }
html[data-theme="dark"] .test-hero .lead,
html[data-theme="dark"] .test-rules li,
html[data-theme="dark"] .score-card > div:not(.score-card__maximum),
html[data-theme="dark"] .task-card p,
html[data-theme="dark"] .condition-list,
html[data-theme="dark"] .consent-check { color: var(--muted); }
html[data-theme="dark"] .score-card,
html[data-theme="dark"] .start-card,
html[data-theme="dark"] .attempt-toolbar,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .answer-input,
html[data-theme="dark"] .check-button,
html[data-theme="dark"] .choice-option,
html[data-theme="dark"] .proof-toggle label,
html[data-theme="dark"] .result-panel { border-color: var(--line); background: var(--surface); }
html[data-theme="dark"] .attempt-toolbar { background: rgba(16,36,49,.96); }
html[data-theme="dark"] .answer-hint,
html[data-theme="dark"] .advanced-prompt,
html[data-theme="dark"] .result-numbers div { background: #153245; }
html[data-theme="dark"] .choice-option,
html[data-theme="dark"] .proof-toggle label { color: #d6e8f3; }
html[data-theme="dark"] .choice-option:hover,
html[data-theme="dark"] .proof-toggle label:hover,
html[data-theme="dark"] .choice-option:has(input:checked),
html[data-theme="dark"] .proof-toggle label:has(input:checked) { background: #173b52; }
html[data-theme="dark"] .task-card.is-correct { border-color: #3d805a; background: #102d20; }
html[data-theme="dark"] .task-card.is-incorrect { border-color: #8a4d4d; background: #301c1c; }
html[data-theme="dark"] .task-card.is-partial { border-color: #8c6c35; background: #302817; }
html[data-theme="dark"] .button-start:hover,
html[data-theme="dark"] .button-start:focus-visible,
html[data-theme="dark"] .button-resume:hover,
html[data-theme="dark"] .button-resume:focus-visible { background: #d9effc; }

@media (max-width: 900px) {
  .test-hero__grid, .start-card { grid-template-columns: 1fr; }
  .score-card { max-width: 500px; }
  .multi-answer { grid-template-columns: 1fr; }
  .proof-toggle { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .test-hero { padding: 12px 0 30px; }
  .test-hero h1 { font-size: clamp(1.95rem,9vw,2.85rem); }
  .attempt-toolbar { top: 78px; margin-inline: 14px; }
  .part-heading { align-items: flex-start; flex-direction: column; }
  .task-card { border-radius: 17px; }
  .choice-grid { gap: 12px; }
  .choice-option { min-height: 68px; padding: 15px 14px; }
  .answer-row { align-items: stretch; flex-direction: column; }
  .answer-row label, .answer-input, .answer-input--wide, .answer-row .button { width: 100%; max-width: none; }
  .result-numbers { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .test-start { padding-top: 28px; }
  .start-card { padding: 23px 19px; }
  .attempt-toolbar { top: 73px; align-items: flex-start; flex-direction: column; }
  .attempt-toolbar__actions { width: 100%; justify-content: space-between; }
  .exam-form { padding-top: 22px; }
  .task-card { padding: 23px 18px; }
}
