/* Стиль Московского Политеха, как на faq.rozb.pw: черный и белый как основа, красный акцент, синие ссылки.
   Логотип вуза не используется: прототип неофициальный. Заголовки — Gilroy (лежит на сервере), иначе системный. */
@font-face { font-family: "DejaVu Sans Web"; src: url("/static/fonts/DejaVuSans.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DejaVu Sans Web"; src: url("/static/fonts/DejaVuSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("/fonts/gilroy/Gilroy-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("/fonts/gilroy/Gilroy-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #ffffff; --well: #f8f8f8; --paper-2: #eeeeee; --rule: #e0e0e0; --rule-strong: #767676;
  --ink: #1e1e1e; --ink-2: #3a3a3a; --muted: #666666;
  --accent: #e63246; --accent-deep: #cf283b; --link: #4b6eb9; --focus: #4b6eb9;
  /* графики: результат, самооценка, уровни 1–4 (один тон, от светлого к темному) */
  --series-test: #4b6eb9; --series-self: #c2671b;
  --lvl-1: #86b6ef; --lvl-2: #3987e5; --lvl-3: #1c5cab; --lvl-4: #0d366b;
  --good: #2e7d1e; --bad: #cf283b;
  --font-display: "Gilroy", "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-body: Verdana, "DejaVu Sans Web", "DejaVu Sans", ui-sans-serif, system-ui, sans-serif;
  --radius: 4px; --gutter: 16px; --target: 24px; --bar-h: 4.5rem;
}
@media (pointer: coarse) { :root { --target: 48px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; scroll-padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--font-body); overflow-wrap: break-word; accent-color: var(--link); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 5vw + 0.6rem, 2.6rem); }
h2 { font-size: clamp(1.25rem, 2.5vw + 0.8rem, 1.75rem); margin-block: 2.5rem 0.75rem; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; text-wrap: pretty; }
a { color: var(--link); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; white-space: nowrap; }

.wrap { max-width: 46rem; margin-inline: auto; padding: 1.25rem var(--gutter) 4rem; }
.wrap.wide { max-width: 72rem; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 0.25rem 1rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.5rem; font-size: 0.875rem; color: var(--muted); }
.topline a { display: inline-flex; align-items: center; min-block-size: var(--target); }
.brand { font-family: var(--font-display); font-weight: 700; color: var(--ink); letter-spacing: -0.01em; text-decoration: none; }
.lead { font-size: 1.0625rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.note { border-inline-start: 3px solid var(--rule-strong); background: var(--well); padding: 0.75rem 1rem; font-size: 0.9rem; margin-block: 1rem; }
.note.warn { border-color: var(--accent); }
.error { color: var(--bad); font-weight: 700; }
.error:empty { display: none; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-block-size: 48px; padding: 0.6rem 1.25rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 700 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn.primary:hover { background: #b32032; border-color: #b32032; }
.btn.quiet { border-color: var(--rule-strong); font-weight: 400; }
.btn.small { min-block-size: var(--target); padding: 0.3rem 0.7rem; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block: 1rem; }

/* карточки и списки */
.cards { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); list-style: none; padding: 0; margin: 1rem 0; }
.card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; background: var(--paper); }
.card h3 { margin-bottom: 0.35rem; }
a.card, button.card { display: block; inline-size: 100%; text-align: start; color: inherit; text-decoration: none; font: inherit; cursor: pointer; border-color: var(--rule-strong); }
a.card:hover, button.card:hover { background: var(--well); border-color: var(--ink); }
.tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); margin-block: 1rem; }
.tile { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.9rem 1rem; }
.tile .k { font-size: 0.8125rem; color: var(--muted); }
.tile .v { font: 700 1.9rem/1.1 var(--font-display); letter-spacing: -0.02em; margin-block: 0.2rem; }
.tile .s { font-size: 0.875rem; color: var(--ink-2); }

/* тест */
.testbar { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 0.5rem var(--gutter) 0.6rem; padding-top: max(0.5rem, env(safe-area-inset-top, 0px)); }
.testbar-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; max-width: 44rem; margin-inline: auto; font-size: 0.875rem; }
.timer { font: 700 1.125rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
progress { display: block; inline-size: 100%; max-width: 44rem; margin: 0.4rem auto 0; block-size: 6px; appearance: none; -webkit-appearance: none; border: 0; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--paper-2); }
progress::-webkit-progress-value { background: var(--ink); }
progress::-moz-progress-bar { background: var(--ink); }
.question { max-width: 44rem; margin-inline: auto; padding: 1.25rem var(--gutter) calc(var(--bar-h) + 2rem + env(safe-area-inset-bottom, 0px)); }
.kicker { font-size: 0.8125rem; color: var(--muted); margin-bottom: 0.4rem; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
legend { padding: 0; font: 700 1.0625rem/1.4 var(--font-body); margin-bottom: 1rem; }
legend .title { display: block; font: 700 1.3rem/1.2 var(--font-display); letter-spacing: -0.02em; margin-bottom: 0.5rem; }
legend .desc { display: block; font-weight: 400; font-size: 0.9rem; color: var(--ink-2); }
.hint { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }
.choices { display: grid; gap: 0.6rem; }
.choice { position: relative; display: flex; align-items: flex-start; gap: 0.75rem; min-block-size: var(--target); padding: 0.8rem 0.9rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); cursor: pointer; }
.choice input { flex: none; inline-size: 1.25rem; block-size: 1.25rem; margin: 0.15rem 0 0; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--well); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice.dim { border-style: dashed; color: var(--ink-2); }
.sjt-opt { border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 0.8rem 0.9rem 0.7rem; }
.sjt-opt p { margin-bottom: 0.6rem; }
.sjt-opt.most { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.sjt-opt.least { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pick label { display: flex; align-items: center; gap: 0.4rem; min-block-size: var(--target); padding: 0.35rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 0.8125rem; line-height: 1.25; cursor: pointer; }
.pick label:has(input:checked) { border-color: var(--ink); background: var(--well); font-weight: 700; }
.pick label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.pick input { flex: none; margin: 0; inline-size: 1.1rem; block-size: 1.1rem; }
.submitbar { position: fixed; inset-inline: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--rule); padding: 0.6rem var(--gutter); padding-bottom: max(0.6rem, env(safe-area-inset-bottom, 0px)); }
.submitbar .in { max-width: 44rem; margin-inline: auto; display: flex; align-items: center; gap: 1rem; }
.submitbar .btn { flex: 1; }
.submitbar .error { flex: 2; font-size: 0.875rem; font-weight: 400; }

/* результат */
.level { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.meter { display: inline-grid; grid-template-columns: repeat(4, 10px); gap: 2px; }
.meter i { block-size: 14px; border-radius: 2px; background: var(--paper-2); }
.meter[data-l="1"] i:nth-child(-n+1) { background: var(--lvl-1); }
.meter[data-l="2"] i:nth-child(-n+2) { background: var(--lvl-2); }
.meter[data-l="3"] i:nth-child(-n+3) { background: var(--lvl-3); }
.meter[data-l="4"] i:nth-child(-n+4) { background: var(--lvl-4); }
.scroll { overflow-x: auto; margin-block: 0.75rem; border: 1px solid var(--rule); border-radius: var(--radius); }
table { border-collapse: collapse; inline-size: 100%; font-size: 0.875rem; }
th, td { text-align: start; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 700; background: var(--well); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody th { font-weight: 400; }
.trend { white-space: nowrap; }
.trend.up::before { content: "▲ "; color: var(--good); }
.trend.down::before { content: "▼ "; color: var(--bad); }
.comp-list { list-style: none; margin: 0.5rem 0; padding: 0; border-top: 1px solid var(--rule); }
.comp-list li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.3rem 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 40rem) { .comp-list li { grid-template-columns: minmax(0, 1fr) auto; } }
.comp-list .name { font-weight: 700; }
.comp-list .meta { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--muted); }
.review p { white-space: pre-line; }
.review .src { font-size: 0.8125rem; color: var(--muted); }
.req { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.875rem; }
.req li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-top: 1px solid var(--rule); }
.req .gap { font-weight: 700; }
.tag { display: inline-block; padding: 0.1rem 0.5rem; border: 1px solid var(--rule-strong); border-radius: 999px; font-size: 0.75rem; white-space: nowrap; }

/* графики */
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.8125rem; color: var(--ink-2); margin-block: 0.5rem 1rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend svg { flex: none; }
.swatch { inline-size: 12px; block-size: 12px; border-radius: 2px; display: inline-block; }
.charts { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.chart { position: relative; border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.75rem 0.75rem 0.5rem; }
.chart h3 { font: 700 0.875rem/1.3 var(--font-body); letter-spacing: 0; }
h3.small { margin-block: 1.5rem 0.5rem; }
.chart .sub { font-size: 0.8125rem; color: var(--muted); margin-block: 0.15rem 0.25rem; }
.chart svg { display: block; inline-size: 100%; block-size: auto; }
.chart svg text { font: 11px var(--font-body); fill: var(--muted); }
.chart svg .val { fill: var(--ink); font-weight: 700; }
.grid { stroke: var(--rule); stroke-width: 1; }
.line-test { fill: none; stroke: var(--series-test); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-self { fill: none; stroke: var(--series-self); stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round; }
.dot-test { fill: var(--series-test); stroke: var(--paper); stroke-width: 2; }
.dot-self { fill: var(--paper); stroke: var(--series-self); stroke-width: 2; }
.hit { fill: transparent; cursor: pointer; }
.cross { stroke: var(--rule-strong); stroke-width: 1; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: #fff; font-size: 0.75rem; line-height: 1.35; padding: 0.4rem 0.55rem; border-radius: var(--radius); max-inline-size: 15rem; }
.dist { display: grid; grid-template-columns: 5.5rem 1fr 2.2rem; align-items: center; gap: 0.5rem; font-size: 0.75rem; margin-block: 0.25rem; }
.dist .bar { display: flex; gap: 2px; block-size: 14px; }
.dist .bar i { display: block; border-radius: 2px; min-inline-size: 0; }
.dist .bar i[data-l="1"] { background: var(--lvl-1); }
.dist .bar i[data-l="2"] { background: var(--lvl-2); }
.dist .bar i[data-l="3"] { background: var(--lvl-3); }
.dist .bar i[data-l="4"] { background: var(--lvl-4); }
.dist .n { text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* формы куратора */
.field { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin-block-end: 1.25rem; }
.field label { font-weight: 700; font-size: 0.9rem; }
input[type="password"], input[type="text"], select { font: inherit; font-size: max(1rem, 1em); min-block-size: 48px; padding: 0.5rem 0.75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); max-inline-size: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-block: 1rem; }
.toolbar .field { margin: 0; }
details { margin-block: 1rem; }
summary { cursor: pointer; min-block-size: var(--target); display: flex; align-items: center; font-weight: 700; }
footer.foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.8125rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .btn, .choice, .card { transition: background-color 120ms, border-color 120ms; } }
