/* =========================================================
   Matura z matmy — trener zadań (dokłada się do site.css)
   Zadanie wygląda jak w arkuszu: numer, punkty, treść szeryfowa, kratki A–D.
   ========================================================= */

.screen { display: flex; flex-direction: column; gap: clamp(20px, 3vw, 32px); padding-top: clamp(12px, 3vh, 32px); padding-bottom: 56px; }
.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(24, 33, 49, .04), 0 12px 32px -18px rgba(24, 33, 49, .18);
  padding: clamp(20px, 3.4vw, 40px);
}
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.label { margin: 0; font: 600 16px/1.3 var(--sans); color: var(--ink); }

/* ---------- Zapis matematyczny ---------- */
.mx { font-variant-numeric: lining-nums; white-space: nowrap; }
.m-frac { display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: middle; margin: 0 .12em; font-size: .86em; line-height: 1.1; text-align: center; }
.m-frac > span { display: block; padding: 0 .18em; }
.m-frac > span:first-child { border-bottom: .07em solid currentColor; padding-bottom: .08em; }
.m-frac > span:last-child { padding-top: .08em; }
.m-frac--sm { font-size: .72em; }
sub .m-frac, .m-log sub .m-frac { font-size: .9em; }
.m-sqrt { display: inline-flex; align-items: baseline; white-space: nowrap; }
.m-rad { border-top: .07em solid currentColor; padding: .04em .1em 0 .06em; margin-left: .02em; line-height: 1.15; }
.m-root-idx { font-size: .58em; margin-right: -.42em; position: relative; top: -.62em; line-height: 0; }
.m-log { font-style: normal; margin-right: .12em; }
.m-log sub { font-size: .66em; vertical-align: -.42em; line-height: 0; margin-left: .04em; }
.m-arg { white-space: nowrap; }
.screen sup { font-size: .68em; line-height: 0; }
.m-sys { display: inline-flex; align-items: center; gap: .15em; vertical-align: middle; }
.m-sys__br { font-size: 2.3em; font-weight: 400; line-height: 1; transform: scaleX(.8); margin-top: -.08em; }
.m-sys__eq { display: inline-flex; flex-direction: column; gap: .1em; line-height: 1.45; }
.m-frac, .m-sqrt, sup, sub { white-space: nowrap; }

/* ---------- Start: fakty i wybór wzorców ---------- */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, max-content)); gap: 14px 56px; margin: 0; padding: 18px 0 0; border-top: 1.5px solid var(--ink); }
@media (max-width: 600px) {
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .fact dt { font-size: 13px !important; }
  .fact dd { font-size: 26px !important; }
}
.fact { display: flex; flex-direction: column; gap: 2px; margin: 0; min-width: 0; }
.fact dt { order: 2; font: 400 15px/1.35 var(--sans); color: var(--ink-3); max-width: 24ch; }
.fact dd { order: 1; margin: 0; font: 600 clamp(28px, 3.4vw, 38px)/1.05 var(--display); letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }

.types-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.types-head p { margin: 4px 0 0; font: 400 15px/1.4 var(--sans); color: var(--ink-3); }
.linkbtn { min-height: 44px; padding: 0 4px; border: 0; background: none; font: 600 15px/1 var(--sans); color: var(--pen); cursor: pointer; text-decoration: underline; text-underline-offset: .25em; }
.linkbtn:hover { color: var(--pen-2); }
.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
@media (max-width: 720px) { .types { grid-template-columns: minmax(0, 1fr); } }
.type {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--grid);
  background: none;
  text-align: left;
  cursor: pointer;
}
.type__box { position: relative; display: block; width: 24px; height: 24px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--sheet); }
.type__box .mark { inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); }
.type__box .mark path { stroke-width: 3.4; }
.type[aria-checked="true"] .mark path { stroke-dashoffset: 0; }
.type:hover .type__name { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .2em; }
.type__name { font: 400 18px/1.3 var(--serif); }
.type[aria-checked="false"] .type__name { color: var(--ink-3); }
.type__stat { font: 400 14px/1.2 var(--sans); color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.type__stat.is-weak { color: var(--bad); }
.type__stat.is-good { color: var(--ok); }

/* ---------- Pasek rundy ---------- */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--rule); transition: background 200ms ease; }
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }
.dots i.now { background: var(--pen); }
.dots i.done { background: var(--ink-3); }
@media (max-width: 480px) { .dots { gap: 4px; } .dots i { width: 14px; } }
.hud__count { font: 600 15px/1 var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Zadanie ---------- */
.task { display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 26px); }
@media (prefers-reduced-motion: no-preference) { .task { animation: task-in 260ms var(--ease) both; } }
@keyframes task-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.task__meta { display: flex; flex-direction: column; gap: 6px; }
.task__no { margin: 0; font: 600 17px/1.3 var(--sans); }
.task__no span { font-weight: 400; color: var(--ink-3); }
.task__src { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font: 400 14px/1.4 var(--sans); color: var(--ink-3); }
.task__tag { color: var(--ink-2); }
.task__body { margin: 0; font: 400 clamp(20px, 2.4vw, 24px)/1.65 var(--serif); overflow-wrap: anywhere; }
.task__body i, .answer__v i, .steps i, .open__l i { font-style: italic; }
.task__prefix, .task__suffix { color: var(--ink-3); }
.task__prefix { margin-right: .3em; }
.task__fig { display: flex; justify-content: center; }
.task__body .mx, .steps .mx { white-space: normal; }

.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 600px) { .answers { grid-template-columns: minmax(0, 1fr); } }
.answer {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 68px;
  padding: 10px 14px 10px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.answer:not(:disabled):hover { background: var(--pen-wash); }
.answer:disabled { cursor: default; }
.answer__l { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--sheet); }
.answer__l b { font: 600 17px/1 var(--sans); transition: color 150ms ease; }
.answer:not(:disabled):hover .answer__l .mark path { stroke-dashoffset: 30; }
.answer__v { font: 400 clamp(20px, 2.4vw, 23px)/1.5 var(--serif); overflow-wrap: anywhere; }
.answer__why { grid-column: 2; margin: -4px 0 2px; font: 400 15px/1.45 var(--sans); color: var(--bad); }
.answer.is-picked .answer__l b { color: var(--ink-3); }
.answer.is-picked .mark path { stroke-dashoffset: 0; }
.answer.is-ok { background: var(--ok-wash); border-color: var(--ok); }
.answer.is-ok .answer__l { border-color: var(--ok); }
.answer.is-ok .mark path { stroke: var(--ok); }
.answer.is-ok:not(.is-picked)::after { content: 'poprawna'; grid-column: 2; margin-top: -6px; font: 600 14px/1 var(--sans); color: var(--ok); }
.answer.is-bad { background: var(--bad-wash); border-color: var(--bad); }
.answer.is-bad .answer__l { border-color: var(--bad); }
.answer.is-bad .mark path { stroke: var(--bad); }
.answer.is-dim { opacity: .5; }
@media (prefers-reduced-motion: no-preference) { .answer.is-bad { animation: nudge 360ms ease; } }
@keyframes nudge { 20% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }

/* ---------- Rozwiązanie ---------- */
.solution { display: flex; flex-direction: column; gap: 16px; padding-top: clamp(18px, 2.4vw, 26px); border-top: 1.5px dashed var(--rule); }
@media (prefers-reduced-motion: no-preference) { .solution { animation: task-in 300ms var(--ease) both; } }
.verdict { display: flex; align-items: center; gap: 12px; margin: 0; font: 600 clamp(20px, 2.6vw, 26px)/1.3 var(--serif); }
.verdict i { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; color: #FFFFFF; }
.verdict i svg { width: 20px; height: 20px; }
.verdict.is-ok i { background: var(--ok); }
.verdict.is-bad i { background: var(--bad); }
.verdict span { min-width: 0; }
.verdict .mx, .answer__v .mx { white-space: normal; }
.answer__v { min-width: 0; }
.steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding-left: 40px; font: 400 19px/1.7 var(--serif); counter-increment: step; }
.steps li::before { content: counter(step) '.'; position: absolute; left: 0; top: .15em; width: 28px; text-align: right; font: 600 15px/1.7 var(--sans); color: var(--ink-3); }
.steps b { font-weight: 600; color: var(--ok); }
.tip { margin: 0; font: 400 17px/1.6 var(--serif); color: var(--ink); }
.tip strong { font: 600 16px/1 var(--sans); }
.tip > span { background: linear-gradient(transparent 12%, var(--marker) 12%, var(--marker) 92%, transparent 92%); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 .15em; }

/* ---------- Zadanie otwarte ---------- */
.open { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 0; }
.open__info { margin: 0; font: 400 15px/1.4 var(--sans); color: var(--ink-3); }
.open__fields { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.open__f { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font: 400 clamp(20px, 2.4vw, 23px)/1.4 var(--serif); }
.open__in {
  width: 8.5ch;
  min-height: 52px;
  padding: 6px 12px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--pen);
  font: 400 clamp(20px, 2.4vw, 23px) var(--serif);
  text-align: center;
}
.open__in:focus { outline: none; border-bottom-color: var(--pen); background: var(--pen-wash); }
.open__in--set { width: min(100%, 22ch); text-align: left; font-size: clamp(18px, 2.2vw, 21px); }
.open__f--set { flex-basis: 100%; }
.open__s { color: var(--ink-3); }
.open__f.is-ok .open__in { border-bottom-color: var(--ok); background: var(--ok-wash); color: var(--ok); }
.open__f.is-bad .open__in { border-bottom-color: var(--bad); background: var(--bad-wash); color: var(--bad); text-decoration: line-through; }
.open__ok { flex-basis: 100%; font: 600 15px/1.4 var(--sans); color: var(--ok); }
.open__err { margin: 0; font: 400 15px/1.4 var(--sans); color: var(--bad); }
.open__keys { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; margin-top: -2px; }
.open__key { min-width: 44px; min-height: 44px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); font: 400 18px var(--serif); color: var(--ink); cursor: pointer; }
.open__key:hover { border-color: var(--ink-3); }
.open__key:active { transform: translateY(1px); }

/* ---------- Wynik ---------- */
.result { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.score { display: flex; align-items: baseline; margin: 0; font: 600 clamp(72px, 12vw, 128px)/.9 var(--display); letter-spacing: -.03em; font-variant-numeric: lining-nums; }
.score small { font-size: .4em; color: var(--ink-3); letter-spacing: 0; margin-left: .06em; }
.end-line { margin: 0; max-width: 52ch; font: 400 20px/1.5 var(--serif); color: var(--ink-2); }
#end:focus { outline: none; } /* fokus tylko dla czytnika ekranu, bez ramki wokół całego wyniku */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
@media (max-width: 480px) { .actions .btn { flex: 1 1 100%; } }
.review { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1.5px solid var(--ink); }
.review li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; align-items: start; padding: 16px 2px; border-bottom: 1px solid var(--rule); font: 400 17px/1.55 var(--serif); }
.review li i { display: grid; place-items: center; width: 26px; height: 26px; margin-top: 2px; border-radius: 50%; color: #FFFFFF; }
.review li i svg { width: 15px; height: 15px; }
.review li.ok i { background: var(--ok); }
.review li.bad i { background: var(--bad); }
.review small { display: block; font: 400 14px/1.45 var(--sans); color: var(--ink-3); }
.review .task__body { font-size: 18px; line-height: 1.6; }
.kbd-hint { margin: 0; font: 400 14px/1.4 var(--sans); color: var(--ink-3); text-align: right; }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- Artykuł o temacie ---------- */
.article { max-width: 68ch; font-size: 18px; line-height: 1.65; color: var(--ink-2); }
.article h2 { margin: 0 0 12px; font: 600 clamp(26px, 3vw, 32px)/1.15 var(--display); color: var(--ink); letter-spacing: -.01em; }
.article h3 { margin: 26px 0 6px; font: 600 20px/1.3 var(--serif); color: var(--ink); }
.article p { margin: 0 0 12px; }
.article ul { margin: 0 0 12px; padding-left: 22px; }
.article li + li { margin-top: 4px; }
.article strong { color: var(--ink); font-weight: 600; }

/* ---------- Wykresy i rysunki ---------- */
.m-plot { width: min(100%, 340px); height: auto; display: block; }
.m-plot .pl-grid { stroke: var(--grid); stroke-width: 1; }
.m-plot .pl-axis { stroke: var(--ink-2); stroke-width: 1.4; }
.m-plot .pl-arrh { fill: var(--ink-2); }
.m-plot .pl-lab { font: italic 400 16px var(--serif); fill: var(--ink-2); }
.m-plot .pl-num { font: 400 12px var(--sans); fill: var(--ink-3); }
.m-plot .pl-line { stroke-width: 2.4; stroke-linecap: round; }
.m-plot .pl-line--0 { stroke: var(--pen); }
.m-plot .pl-line--1 { stroke: var(--bad); }
.m-plot .pl-line--2 { stroke: var(--ok); }
.m-plot .pl-line--3 { stroke: #8A5A00; }
.m-plot .pl-pt { fill: var(--ink); }
.m-plot .pl-name { font: italic 600 16px var(--serif); fill: var(--ink); }
.answer .m-sys { font-size: .92em; }
.m-fig { width: min(100%, 320px); height: auto; display: block; overflow: visible; }
.m-fig .cf-circle { fill: none; stroke: var(--ink-2); stroke-width: 1.8; }
.m-fig .cf-poly { fill: rgba(43, 71, 201, .05); stroke: var(--pen); stroke-width: 1.8; }
.m-fig .cf-seg { stroke: var(--ink); stroke-width: 1.6; }
.m-fig .cf-line { stroke: #8A5A00; stroke-width: 1.6; }
.m-fig .cf-arc { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.m-fig .cf-arc--hi { stroke: var(--bad); stroke-width: 2; }
.m-fig .cf-right { fill: none; stroke: var(--ink-2); stroke-width: 1.3; }
.m-fig .cf-alab { font: 400 15px var(--serif); fill: var(--ink-2); }
.m-fig .cf-alab--hi { fill: var(--bad); font-style: italic; }
.m-fig .cf-pt { fill: var(--ink); }
.m-fig .cf-plab { font: italic 600 16px var(--serif); fill: var(--ink); }
.m-fig .cf-slab { font: 400 15px var(--serif); fill: var(--pen); }

/* ---------- Diagram słupkowy ---------- */
.m-bars { width: min(100%, 380px); height: auto; display: block; overflow: visible; }
.m-bars .br-grid { stroke: var(--grid); stroke-width: 1; }
.m-bars .br-axis { stroke: var(--ink-2); stroke-width: 1.4; }
.m-bars .br-bar { fill: rgba(43, 71, 201, .14); stroke: var(--pen); stroke-width: 1.6; }
.m-bars .br-num { font: 400 12px var(--sans); fill: var(--ink-3); }
.m-bars .br-lab { font: 400 15px var(--serif); fill: var(--ink); }
.m-bars .br-cap { font: 400 12px var(--sans); fill: var(--ink-3); }
.m-fig .cf-hid { fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-dasharray: 5 4; }
.m-fig .cf-hid2 { stroke: var(--rule); stroke-width: 1.2; stroke-dasharray: 3 4; }

/* ---------- Oś liczbowa ---------- */
.m-line { width: min(100%, 420px); height: auto; display: block; overflow: visible; }
.m-line .nl-axis { stroke: var(--ink-2); stroke-width: 1.4; }
.m-line .nl-arrh { fill: var(--ink-2); }
.m-line .nl-set { stroke: var(--pen); stroke-width: 5; stroke-linecap: butt; opacity: .55; }
.m-line .nl-dot { fill: var(--pen); stroke: var(--pen); stroke-width: 2; }
.m-line .nl-hole { fill: var(--sheet); stroke: var(--pen); stroke-width: 2; }
.m-line .nl-num { font: 400 14px var(--serif); fill: var(--ink); }
.m-line .nl-x { font: italic 400 15px var(--serif); fill: var(--ink-2); }
