:root {
  color-scheme: light;
  color: #192f43;
  background: #f1f5f8;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 100%;
  line-height: 1.5;
  --ink: #192f43;
  --muted: #526579;
  --line: #d5e0e9;
  --navy: #132b42;
  --blue: #124e76;
  --accent: #ffb454;
  --white: #fff;
  --green: #176346;
  --red: #a52b36;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #0879bc; outline-offset: 4px; }
[hidden] { display: none !important; }

.shell { width: min(100% - 2rem, 59rem); margin-inline: auto; }
.site-header { background: var(--navy); color: var(--white); }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; background: none; border: 0; padding: .25rem 0; text-align: left; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; flex: 0 0 auto; border: 2px solid var(--accent); border-radius: .35rem; }
.brand-mark span { width: .8rem; height: .48rem; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translateY(-.08rem) rotate(-45deg); }
.header-note, .site-footer { font-size: .875rem; }
.header-note { color: #cddeea; }
.site-footer { display: flex; justify-content: space-between; gap: .5rem 1.25rem; flex-wrap: wrap; color: var(--muted); padding: 0 0 1.5rem; }
.app { padding-block: clamp(1rem, 3vw, 2rem); }
.loading { padding-block: 2rem; }

.hero { color: var(--white); background: #173651; position: relative; overflow: hidden; border-radius: 1.1rem; padding: clamp(1.25rem, 5vw, 2.7rem); }
.hero::after { position: absolute; content: ''; pointer-events: none; inset: 0 0 0 46%; opacity: .23; background-image: linear-gradient(#8eb3cf 1px, transparent 1px), linear-gradient(90deg, #8eb3cf 1px, transparent 1px); background-size: 2rem 2rem; mask-image: linear-gradient(90deg, transparent, #000); }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--accent); }
.eyebrow { color: var(--blue); font-weight: 700; font-size: .9rem; }
.hero h1 { font-size: clamp(1.75rem, 4.9vw, 3.2rem); line-height: 1.08; max-width: 16.5em; margin-block: .4rem .9rem; letter-spacing: -.035em; }
.hero p:last-child { color: #dceaf3; max-width: 38rem; }
.setup { margin-top: 1.5rem; }
.setup h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.2; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-block: .75rem 1rem; }
.mode-choice, .answer { position: relative; cursor: pointer; display: flex; gap: .8rem; background: var(--white); border: 1px solid var(--line); border-radius: .85rem; }
.mode-choice { padding: 1rem; align-items: flex-start; }
.mode-choice:has(input:checked), .answer:has(input:checked) { background: #edf6fc; border-color: #3876a1; box-shadow: inset 0 0 0 1px #3876a1; }
.mode-choice:hover, .answer:hover { border-color: #647f95; }
.mode-choice input, .answer input { accent-color: var(--blue); flex: 0 0 auto; width: 1.12rem; height: 1.12rem; margin: .21rem 0 0; }
.mode-choice strong { display: block; font-size: 1.08rem; }
.mode-choice small { display: block; font-size: .92rem; color: var(--muted); margin-top: .25rem; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3.5vw, 1.75rem); box-shadow: 0 5px 20px #193d5510; }
.form-row { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.field { display: grid; gap: .3rem; flex: 1 1 12rem; min-width: 0; }
.field > span { font-weight: 650; font-size: .925rem; }
select { appearance: none; width: 100%; min-height: 3rem; border: 1px solid #9bafbf; border-radius: .55rem; padding: .6rem 2.3rem .6rem .7rem; background: var(--white); color: var(--ink); }
.select-wrap { display: block; position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 1rem; top: 1.07rem; width: .55rem; height: .55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.button { border: 1px solid transparent; border-radius: .55rem; font-weight: 700; padding: .65rem 1rem; min-height: 3rem; background: var(--blue); color: var(--white); }
.button:hover { background: #0c3b5b; }
.button:disabled { opacity: .5; }
.button.secondary { background: var(--white); border-color: #9eb1c0; color: var(--ink); }
.button.secondary:hover { background: #edf4f9; }
.form-note { margin-top: .75rem; font-size: .9rem; color: var(--muted); }

.test-shell, .result-shell { max-width: 47rem; margin-inline: auto; }
.test-top { display: flex; justify-content: space-between; align-items: start; gap: .65rem; margin-bottom: .7rem; }
.test-top h1 { font-size: clamp(1.25rem, 3.3vw, 1.65rem); line-height: 1.2; }
.timer { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--navy); color: var(--white); padding: .4rem .65rem; border-radius: .5rem; }
.timer.urgent { background: #8b2932; }
.progress-line { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .9rem; }
progress { display: block; width: 100%; height: .48rem; border: 0; border-radius: 1rem; overflow: hidden; margin: .35rem 0 .9rem; background: #dce6ee; }
progress::-webkit-progress-bar { background: #dce6ee; }
progress::-webkit-progress-value { background: #1673a0; }
progress::-moz-progress-bar { background: #1673a0; }
.question-source { font-size: .88rem; color: var(--muted); font-weight: 650; margin-bottom: .35rem; }
.question-title { font-size: clamp(1.25rem, 3.4vw, 1.75rem); line-height: 1.27; margin-bottom: 1rem; overflow-wrap: anywhere; }
.marking { display: inline-block; border: 1px solid #273d50; padding: .05em .2em; font-variant-numeric: tabular-nums; }
.answers { display: grid; gap: .55rem; }
.answer { padding: .7rem .8rem; min-height: 3.05rem; align-items: flex-start; }
.answer.correct { border-color: #2c8b65; box-shadow: inset 0 0 0 1px #2c8b65; background: #eaf7ef; }
.answer.incorrect { border-color: #c25c63; box-shadow: inset 0 0 0 1px #c25c63; background: #fff0f1; }
.answer:has(input:disabled) { cursor: default; }
.actions { display: flex; justify-content: space-between; gap: .65rem; flex-wrap: wrap; margin-top: 1rem; }
.actions > :last-child { margin-left: auto; }
.feedback { background: #edf4fa; border-radius: .6rem; padding: .75rem .85rem; margin-top: .8rem; }
.feedback.good { background: #eaf7ef; }
.feedback.bad { background: #fff0f1; }
.feedback.good strong { color: var(--green); }
.feedback.bad strong { color: var(--red); }
.feedback p { margin-top: .3rem; }
.source-link { display: inline-block; margin-top: .35rem; font-size: .9rem; }
.result-shell h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
.score { font-size: clamp(2.4rem, 7vw, 3.7rem); font-weight: 800; line-height: 1.1; margin-block: .3rem; color: var(--blue); }
.score span { color: var(--muted); font-size: .53em; }
.result-note { color: var(--muted); margin-top: .55rem; }
.review { margin-top: .85rem; }
.review h2 { font-size: 1.22rem; margin-bottom: .25rem; }
.review-item { border-top: 1px solid var(--line); padding-block: .8rem; }
.review-item summary { cursor: pointer; font-weight: 650; }
.review-item p { margin: .4rem 0 0 1rem; }
.review-status { font-weight: 600; font-size: .9rem; color: var(--muted); }
.review-status.good { color: var(--green); }
.review-status.bad { color: var(--red); }
dialog { width: min(100% - 2rem, 28rem); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; color: var(--ink); box-shadow: 0 8px 50px #132b4250; }
dialog::backdrop { background: #0a1a2b88; }
dialog h2 { font-size: 1.25rem; margin-bottom: .4rem; }

@media (max-width: 38rem) {
  .header-note { display: none; }
  .site-footer { display: grid; }
  .mode-grid { grid-template-columns: 1fr; }
  .form-row > .button { width: 100%; }
}
@media (max-width: 25rem) {
  .shell { width: calc(100% - 1.25rem); }
  .actions .button { flex: 1 1 auto; }
}
