:root {
  --ink: #16202b; --muted: #5b6876; --line: #d9e0e7; --bg: #f6f8fa; --card: #fff;
  --brand: #1d4ed8; --brand-ink: #fff; --accent: #e8eefc; --warn: #9a5b00; --bad: #b42318; --good: #157f3b;
  --radius: 10px; font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--brand); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: .2em 0 .5em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding: .7rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--brand); }
.top nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .92rem; }
.top nav a { text-decoration: none; color: var(--muted); padding: .2rem 0; }
.top nav a[aria-current] { color: var(--brand); font-weight: 600; border-bottom: 2px solid var(--brand); }

.page { max-width: 760px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.wide { max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.foot { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }

.lead { font-size: 1.1rem; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .8rem 0; }
.cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cards .card { margin: 0; display: flex; flex-direction: column; }
.cards .card p { flex: 1; color: var(--muted); margin: .3em 0 .8em; }
.btn { display: inline-block; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: .65rem 1.1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.note { background: var(--accent); border-radius: 8px; padding: .7rem .9rem; font-size: .92rem; }
.warn { color: var(--warn); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--card); }
th, td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--bg); }
.src { font-size: .8rem; color: var(--muted); }
.hidden { display: none !important; }

/* The test screen: a bar with the section and the clock, the task, the question strip. */
.exam { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.exam-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1rem; background: #1f2a36; color: #fff; border-radius: var(--radius) var(--radius) 0 0; font-size: .95rem; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.clock.low { color: #ffb4a8; }
.exam-body { padding: 1rem; }
.split { display: grid; gap: 1rem; }
@media (min-width: 900px) { .split.two { grid-template-columns: 1fr 1fr; } .split.two .passage { max-height: 70vh; overflow: auto; padding-right: .6rem; } }
.passage { font-size: .98rem; }
.passage p { margin: 0 0 .8em; }
.instr { font-weight: 600; margin: 0 0 .8rem; }
.q { padding: .6rem 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; }
.q .num { display: inline-block; min-width: 1.8rem; font-weight: 700; }
.q label.opt { display: block; padding: .35rem .5rem; margin: .2rem 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.q label.opt:has(input:checked) { border-color: var(--brand); background: var(--accent); }
.q input[type=text], .q select { font: inherit; padding: .35rem .5rem; border: 1px solid #9aa7b4; border-radius: 6px; min-width: 9rem; max-width: 100%; }
.q.right { background: #eefaf2; } .q.wrong { background: #fdf0ef; }
.key { font-size: .88rem; color: var(--muted); margin-top: .3rem; }
.strip { display: flex; flex-wrap: wrap; gap: .3rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.strip button { width: 2.1rem; height: 2.1rem; border: 1px solid var(--line); background: var(--card); border-radius: 6px; font: inherit; font-size: .85rem; cursor: pointer; }
.strip button.done { background: #1f2a36; color: #fff; }
.strip button.here { outline: 2px solid var(--brand); }
.nav-row { display: flex; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
audio { width: 100%; margin: .4rem 0 .8rem; }
.player { display: flex; align-items: center; gap: .8rem; background: var(--bg); border-radius: 8px; padding: .6rem .8rem; margin: 0 0 .8rem; }
.player .bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.player .bar i { display: block; height: 100%; width: 0; background: var(--brand); }

.result { text-align: center; padding: 1.4rem 1rem; }
.result .level { font-size: 3rem; font-weight: 800; color: var(--brand); line-height: 1; margin: .2em 0; }
.result .score { color: var(--muted); }
.bars { display: grid; gap: .5rem; max-width: 420px; margin: 1rem auto; text-align: left; }
.bars div { display: grid; grid-template-columns: 6.5rem 1fr 3rem; gap: .5rem; align-items: center; font-size: .92rem; }
.bars .track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--brand); }

textarea { width: 100%; min-height: 16rem; font: inherit; font-size: 1rem; line-height: 1.6; padding: .7rem; border: 1px solid #9aa7b4; border-radius: 8px; }
.counter { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin: .3rem 0 .8rem; }
.check { list-style: none; padding: 0; }
.check li { padding: .25rem 0 .25rem 1.6rem; position: relative; }
.check li::before { content: "○"; position: absolute; left: .2rem; color: var(--muted); }
.check li.ok::before { content: "●"; color: var(--good); }
.check li.no::before { content: "●"; color: var(--bad); }
.rec { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.mine { white-space: pre-wrap; }

/* The calculator: the form beside its result on a wide screen. */
.calc { display: grid; gap: 1rem; }
@media (min-width: 900px) { .calc { grid-template-columns: 1fr 1fr; align-items: start; } .calc .out { position: sticky; top: 1rem; } }
.calc label { display: block; font-weight: 600; font-size: .93rem; margin: .7rem 0 .25rem; }
.calc input[type=number], .calc select { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid #9aa7b4; border-radius: 8px; background: #fff; }
.calc .tick { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg label { margin: 0; font-weight: 400; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .7rem; cursor: pointer; background: #fff; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--accent); font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.out table td:nth-child(2), .out table th:nth-child(2) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.out .sub { color: var(--muted); font-size: .8rem; }
.out tr.sum td { font-weight: 700; background: var(--accent); }
.out tr.big td { font-weight: 800; font-size: 1.1rem; }
