/* Sizes are in rem: «Для экрана» only changes the root size and everything grows together. */
[hidden] { display: none !important; }
:root {
  --bg: #fbfaf6;
  --card: #ffffff;
  --ink: #1b2232;
  --ink-2: #465067;
  --muted: #747d91;
  --line: #e3dfd5;
  --accent: #2f6fab;
  --accent-soft: #e9f1fa;
  --on-accent: #fff;
  --ok: #1f8a4c; --ok-bg: #e5f6ec;
  --no: #c8382b; --no-bg: #fdecea;
  --hl: #d1495b;
  --sc: var(--accent);
  --fig-ink: #1b2232; --fig-soft: #c9d1dd; --fig-fill: #eef2f7;
  --fig-blue: #2f6fab; --fig-red: #d1495b; --fig-green: #2e9e6a; --fig-orange: #e98a15; --fig-gold: #f2b134;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-text: "PT Sans", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
  font-size: 17px;
}
:root[data-theme="dark"] {
  --bg: #14171d; --card: #1c2029; --ink: #e8eaf0; --ink-2: #bcc2cf; --muted: #8b93a4; --line: #2e3441;
  --accent: #8cb8e8; --accent-soft: #1f2a38; --on-accent: #0f1a26;
  --ok: #6fd39a; --ok-bg: #173023; --no: #f08a7e; --no-bg: #34201e; --hl: #ff8a98;
  --fig-ink: #e1e5ec; --fig-soft: #4a5466; --fig-fill: #232a35;
  --fig-blue: #6fa8e0; --fig-red: #f07a8a; --fig-green: #5cc995; --fig-orange: #f5a54a; --fig-gold: #f2c45c;
  color-scheme: dark;
}
/* the four subjects have their own colours */
body[data-subj="russkij"] { --sc: #c0392b; }
body[data-subj="matematika"] { --sc: #2f6fab; }
body[data-subj="okruzhayushchij"] { --sc: #23875a; }
body[data-subj="chtenie"] { --sc: #8a43b0; }
:root[data-theme="dark"] body[data-subj="russkij"] { --sc: #ff8f84; }
:root[data-theme="dark"] body[data-subj="matematika"] { --sc: #8cb8e8; }
:root[data-theme="dark"] body[data-subj="okruzhayushchij"] { --sc: #6fd39a; }
:root[data-theme="dark"] body[data-subj="chtenie"] { --sc: #d4a4f0; }
:root[data-tv="1"] { font-size: 24px; }
@media (max-width: 700px) { :root[data-tv="1"] { font-size: 19px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--sc); }
img, svg { max-width: 100%; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.25; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .9rem; min-height: 3.4rem; padding: .3rem 1.2rem; background: var(--bg); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; flex: none; }
.brand img { width: 1.7rem; height: 1.7rem; }
.brand b { color: var(--accent); }
.brand small { font-weight: 600; color: var(--muted); font-size: .8em; margin-left: .2rem; }
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; flex: 1; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--sc); }
.crumbs .sep { color: var(--line); }
.tv-btn, .theme-btn, .menu-btn { height: 2.2rem; border-radius: .6rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .35rem; font: 600 .85rem var(--font); flex: none; padding: 0 .6rem; }
.tv-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.theme-btn { width: 2.2rem; padding: 0; }
.theme-btn span { width: 1rem; height: 1rem; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 2px solid var(--ink); }
.menu-btn { display: none; width: 2.2rem; font-size: 1.1rem; }

/* ---------- layout ---------- */
.layout { flex: 1; width: 100%; max-width: 76rem; margin: 0 auto; padding: 2rem 1.2rem 4rem; }
:root[data-tv="1"] .layout { max-width: 92rem; }
.layout.with-side { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 2.4rem; }
:root[data-tv="1"] .layout.with-side { grid-template-columns: minmax(0, 1fr); }
:root[data-tv="1"] .layout.with-side .side { display: none; }
:root[data-tv="1"] .menu-btn { display: flex; }
.side { position: sticky; top: 4.4rem; align-self: start; max-height: calc(100vh - 5.4rem); overflow: auto; font-size: .85rem; padding-right: .5rem; scrollbar-width: thin; }
.side-title a { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1rem; }
.side-ch { margin-top: 1.1rem; }
.side-ch-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: .25rem; }
.side ol { list-style: none; margin: 0; padding: 0; }
.side li a { display: flex; gap: .45rem; padding: .3rem .5rem; border-radius: .5rem; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side li a:hover { background: var(--accent-soft); color: var(--ink); }
.side li.cur a { background: var(--accent-soft); color: var(--sc); font-weight: 700; }
.side .n { color: var(--muted); min-width: 2rem; flex: none; font-variant-numeric: tabular-nums; }
.main { min-width: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.6rem; padding: .45rem 1rem; border-radius: .7rem; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--sc); }
.btn:active { transform: scale(.97); }
.btn-main { background: var(--sc); border-color: var(--sc); color: #fff; }
:root[data-theme="dark"] .btn-main { color: #10141b; }
.btn-main:hover { filter: brightness(1.08); }
.btn-small { min-height: 2.1rem; padding: .25rem .7rem; font-size: .85rem; }
.btn.on { background: var(--sc); color: #fff; border-color: var(--sc); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--fig-gold); outline-offset: 2px; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 2rem 0 1.6rem; }
.hero h1 { font-size: 2.8rem; margin: 0 0 .8rem; letter-spacing: -.02em; }
.hero h1 b { color: var(--accent); }
.hero p { max-width: 44rem; margin: 0 auto; color: var(--ink-2); font-size: 1.1rem; }
.subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.2rem; margin: 1.6rem 0 0; }
.subject { display: flex; flex-direction: column; gap: .3rem; padding: 1.6rem; border-radius: 1.2rem; background: var(--card); border: 2px solid var(--line); border-top: .45rem solid var(--sc); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.subject:hover { transform: translateY(-3px); box-shadow: 0 .7rem 1.8rem rgba(20, 30, 50, .1); }
.subject-icon { font-size: 2.6rem; line-height: 1.1; }
.subject b { font-size: 1.45rem; }
.subject span:last-child { color: var(--muted); font-size: .9rem; }
.home-vpr, .home-tv { margin-top: 2.6rem; }
.home-vpr h2, .home-tv h2 { font-size: 1.5rem; margin: 0 0 .8rem; }
.home-vpr-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.home-vpr-row .btn { border-color: var(--sc); }
.home-tv { background: var(--card); border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.2rem 1.6rem; }
.home-tv li { margin: .3rem 0; }

/* ---------- subject page ---------- */
.subj-head { display: flex; gap: 1.2rem; align-items: flex-start; margin-bottom: 1.6rem; }
.subj-ico { font-size: 3.6rem; line-height: 1; }
.subj-head h1 { font-size: 2.4rem; margin: 0 0 .4rem; color: var(--sc); }
.lead { color: var(--ink-2); margin: 0; max-width: 46rem; }
.block-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; }
.vpr-block h2, .topics-block h2 { font-size: 1.6rem; margin: 0; }
.vpr-block { background: var(--card); border: 2px solid var(--sc); border-radius: 1.2rem; padding: 1.3rem 1.4rem 1.5rem; }
.vpr-block > p { margin: .5rem 0 1rem; }
.vpr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .7rem; }
.vpr-card { display: flex; flex-direction: column; gap: .15rem; padding: .8rem .9rem; border-radius: .8rem; background: var(--bg); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.vpr-card:hover { border-color: var(--sc); transform: translateY(-2px); }
.vpr-card b { color: var(--sc); font-size: 1.3rem; }
.vpr-card span { line-height: 1.3; font-weight: 600; }
.vpr-card small { color: var(--muted); }
.topics-block { margin-top: 2.2rem; }
.toc { columns: 2 22rem; column-gap: 2rem; margin-top: .8rem; }
.toc-sec { break-inside: avoid; margin-bottom: 1.2rem; }
.toc-sec h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .4rem; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list a { display: block; padding: .5rem .7rem; border-radius: .6rem; text-decoration: none; color: var(--ink); }
.toc-list a:hover { background: var(--accent-soft); }
.toc-list .t { display: block; font-weight: 600; }
.toc-list .l { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; }

/* ---------- a topic or a ВПР task ---------- */
.par { max-width: 52rem; }
:root[data-tv="1"] .par { max-width: none; }
.par-head { margin-bottom: 1.4rem; }
.par-ch { color: var(--sc); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.par h1 { font-size: 2.2rem; margin: .3rem 0 .6rem; letter-spacing: -.01em; }
.par-n { color: var(--sc); margin-right: .5rem; }
.par-lead { font-size: 1.15rem; color: var(--ink-2); margin: 0; }
.vpr-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .7rem; }
.vpr-meta span { background: var(--accent-soft); color: var(--ink-2); border-radius: 2rem; padding: .1rem .7rem; font-size: .85rem; font-weight: 600; }
.par-body { font: 1.08rem/1.65 var(--font-text); }
.par-body h2 { font: 700 1.45rem/1.3 var(--font); margin: 2rem 0 .6rem; }
.par-body h3 { font: 700 1.15rem/1.3 var(--font); margin: 1.4rem 0 .4rem; }
.par-body table { border-collapse: collapse; margin: 1rem 0; font-size: .98rem; background: var(--card); }
.par-body th, .par-body td { border: 1px solid var(--line); padding: .4rem .7rem; text-align: left; vertical-align: top; }
.par-body th { background: var(--accent-soft); }
.hl { color: var(--hl); font-weight: 800; }
.par-body blockquote { margin: 1rem 0; padding: .3rem 1.1rem; border-left: 4px solid var(--sc); background: var(--card); border-radius: 0 .6rem .6rem 0; }

/* boxes */
.box { margin: 1.3rem 0; padding: .9rem 1.2rem; border-radius: .9rem; border: 1px solid var(--line); border-left: 6px solid var(--bc, var(--sc)); background: var(--bb, var(--card)); }
.box > :last-child { margin-bottom: 0; }
.box-title { font: 800 .8rem var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--bc, var(--sc)); margin-bottom: .3rem; }
.box-need { --bc: #b4590a; --bb: #fdf4e8; }
.box-rule { --bc: #2f6fab; --bb: #ecf3fb; }
.box-remember { --bc: #c0392b; --bb: #fdeeec; }
.box-example { --bc: #3a4a63; --bb: #f3f5f8; }
.box-algo { --bc: #23875a; --bb: #eaf6ef; }
.box-tip { --bc: #8a6d00; --bb: #fbf6e0; }
.box-mistake { --bc: #c0392b; --bb: #fdefed; }
.box-interesting { --bc: #a8326e; --bb: #fbeff5; }
.box-summary { --bc: #465067; --bb: #f2efe6; }
.box-vpr { --bc: #8a43b0; --bb: #f6eefb; }
:root[data-theme="dark"] .box { --bb: var(--card); }
:root[data-theme="dark"] .box-need { --bc: #f0a75a; } :root[data-theme="dark"] .box-rule { --bc: #8cb8e8; }
:root[data-theme="dark"] .box-remember, :root[data-theme="dark"] .box-mistake { --bc: #f08a7e; }
:root[data-theme="dark"] .box-example, :root[data-theme="dark"] .box-summary { --bc: #b9c4d6; }
:root[data-theme="dark"] .box-algo { --bc: #6fd39a; } :root[data-theme="dark"] .box-tip { --bc: #e0c45a; }
:root[data-theme="dark"] .box-interesting { --bc: #ee8fbf; } :root[data-theme="dark"] .box-vpr { --bc: #d4a4f0; }
.box-algo ol { padding-left: 1.4rem; }
.box-algo li { margin: .25rem 0; }

/* «Зачем?» and «Показать ответ» */
.why { margin: .8rem 0 1.2rem; border: 1px dashed var(--line); border-radius: .8rem; background: var(--card); }
.why summary { cursor: pointer; padding: .55rem .9rem; font: 600 .95rem var(--font); color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: .55rem; }
.why summary::-webkit-details-marker { display: none; }
.why-q { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--sc); color: #fff; font-weight: 800; flex: none; font-size: .85rem; }
.why-body { padding: 0 1rem .6rem 3rem; }
.ask { margin: 1rem 0; padding: .8rem 1.1rem; border-radius: .9rem; background: var(--card); border: 2px solid var(--line); }
.ask-q { font-weight: 700; margin-bottom: .5rem; }
.ask-btn { font: 600 .9rem var(--font); border: 2px solid var(--sc); color: var(--sc); background: transparent; border-radius: .6rem; padding: .3rem .8rem; cursor: pointer; }
.ask-a { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.ask-a > :first-child { margin-top: 0; } .ask-a > :last-child { margin-bottom: 0; }

/* pictures */
.fig, .sim { margin: 1.4rem 0; text-align: center; }
.fig svg { max-height: 22rem; }
figcaption { font: .9rem/1.4 var(--font); color: var(--muted); margin-top: .5rem; }
.sim { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; }
.sim-body { font: 1rem var(--font); }
.ln { stroke: var(--fig-ink); fill: none; stroke-width: 2; }
.tx { fill: var(--fig-ink); font: 15px var(--font); }
.fb { fill: var(--fig-fill); stroke: var(--fig-ink); stroke-width: 2; }

/* ---------- trainer ---------- */
.trainer { margin: 1.6rem 0; border: 2px solid var(--sc); border-radius: 1.1rem; background: var(--card); overflow: hidden; text-align: left; }
.trainer > figcaption { margin: 0; padding: .6rem 1.1rem; background: var(--accent-soft); color: var(--ink); font: 700 1rem var(--font); }
.tr-badge { display: inline-block; background: var(--sc); color: #fff; border-radius: .4rem; padding: 0 .45rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; margin-right: .3rem; vertical-align: .1em; }
:root[data-theme="dark"] .tr-badge { color: #10141b; }
.tr-body { padding: 1rem 1.2rem 1.2rem; font-family: var(--font); }
.tr-body:focus { outline: none; }
.tr-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.tr-stat { font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-stat .ok { color: var(--ok); } .tr-stat .no { color: var(--no); margin-left: .4rem; }
.tr-full { margin-left: auto; }
.tr-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.tr-next { margin-left: auto; }
.btn-next { margin-left: auto; }
.tr-verdict { margin-top: .9rem; font-size: 1.05rem; }
.tr-verdict:empty { display: none; }
.v-ok { color: var(--ok); font-weight: 800; font-size: 1.2em; }
.v-no { color: var(--no); font-weight: 800; }
.v-show, .v-self { font-weight: 700; color: var(--ink-2); }
.tr-hint { padding: .5rem .8rem; border-radius: .6rem; background: #fbf6e0; color: #5a4a00; margin-bottom: .6rem; }
:root[data-theme="dark"] .tr-hint { background: #2a2716; color: #e0c45a; }
.tw-explain { margin-top: .7rem; padding: .7rem 1rem; border-radius: .7rem; background: var(--bg); border: 1px solid var(--line); line-height: 1.55; }
.tw-explain p { margin: .3rem 0; }
.ex-h { font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--sc); margin: .3rem 0; }
.ex-model { white-space: pre-line; }
.ex-crit { margin: .2rem 0; padding-left: 1.2rem; }

/* one task */
.tw-q { font-size: 1.15rem; line-height: 1.5; font-weight: 600; }
.tw-q p { margin: .3rem 0; }
.tw-q .big, .tw-q big { font-size: 1.5em; font-weight: 800; letter-spacing: .02em; }
.tw-q table { border-collapse: collapse; margin: .6rem 0; font-weight: 400; }
.tw-q th, .tw-q td { border: 1px solid var(--line); padding: .3rem .7rem; text-align: center; }
.tw-q th { background: var(--accent-soft); }
.tw-pic { margin: .6rem 0; }
.tw-pic svg { max-height: 18rem; }
.tw-area { margin-top: .8rem; }
.tw-input { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.ans { font: 700 1.3rem var(--font); padding: .4rem .7rem; width: 12rem; max-width: 100%; border: 2px solid var(--line); border-radius: .6rem; background: var(--bg); color: var(--ink); }
.tw-text .ans { width: 20rem; }
.ans:focus { border-color: var(--sc); outline: none; }
.ans.ok, .gap.ok { border-color: var(--ok); background: var(--ok-bg); }
.ans.no, .gap.no { border-color: var(--no); background: var(--no-bg); }
.tw-unit { font-weight: 700; color: var(--ink-2); }
.tw-right { color: var(--ink-2); margin-top: .4rem; }
.tw-gaps { font: 1.25rem/2.3 var(--font-text); }
.gap { width: 2.3em; font: 700 1em var(--font); text-align: center; padding: 0 .1em; border: 2px solid var(--line); border-bottom: 3px solid var(--sc); border-radius: .4rem; background: var(--bg); color: var(--ink); margin: 0 .05em; }
.gap:focus { outline: none; border-color: var(--sc); }
.tw-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; }
.tw-opts.wide { grid-template-columns: 1fr; }
.tw-opts.big .opt { font-size: 1.6rem; }
.opt { display: flex; align-items: center; gap: .5rem; text-align: left; font: 600 1.05rem/1.35 var(--font); padding: .7rem .9rem; border-radius: .7rem; border: 2px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; min-height: 3rem; }
.tw-opts.big .opt { justify-content: center; }
.opt:hover:not(:disabled) { border-color: var(--sc); }
.opt.on { border-color: var(--sc); background: var(--accent-soft); }
.opt:disabled { cursor: default; opacity: 1; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--no); background: var(--no-bg); }
.box-mark { width: 1.1rem; height: 1.1rem; border: 2px solid var(--muted); border-radius: .25rem; flex: none; }
.opt.on .box-mark { background: var(--sc); border-color: var(--sc); }
.tw-stress { display: flex; flex-wrap: wrap; font: 800 2.6rem/1.2 var(--font); letter-spacing: .02em; }
.tw-stress .sc { padding: .2rem .04em; }
.sv { font: inherit; color: var(--sc); background: var(--accent-soft); border: 2px dashed var(--sc); border-radius: .5rem; padding: 0 .12em; margin: 0 .03em; cursor: pointer; }
.sv.on { background: var(--sc); color: #fff; border-style: solid; }
.sv.right { background: var(--ok); color: #fff; border: 2px solid var(--ok); }
.sv.wrong { background: var(--no); color: #fff; border: 2px solid var(--no); }
.tw-pick { font: 1.3rem/2.4 var(--font-text); }
.pw { font: inherit; border: 2px solid transparent; border-bottom: 2px dashed var(--muted); background: transparent; color: var(--ink); padding: 0 .2em; margin: 0 .1em; border-radius: .4rem; cursor: pointer; }
.pw.on { background: var(--accent-soft); border-color: var(--sc); }
.pw.right { background: var(--ok-bg); border-color: var(--ok); }
.pw.wrong { background: var(--no-bg); border-color: var(--no); }
.pw-punct { margin-left: -.15em; margin-right: .15em; }
.tw-order-pool { display: flex; flex-wrap: wrap; gap: .5rem; }
.oi { font: 600 1rem/1.35 var(--font); padding: .5rem .8rem; border-radius: .6rem; border: 2px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; text-align: left; }
.oi:disabled { opacity: .35; cursor: default; }
.tw-order-seq { margin: .8rem 0; padding-left: 1.6rem; font-weight: 600; }
.tw-order-seq li { margin: .2rem 0; }
.tw-order-seq .empty { list-style: none; margin-left: -1.6rem; font-weight: 400; }
.ord { display: inline-block; margin-right: .8rem; }
.tw-sort { display: grid; gap: .45rem; }
.sr { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.sw { font: 700 1.2rem var(--font-text); min-width: 9rem; }
.sb { display: flex; flex-wrap: wrap; gap: .35rem; }
.sg { font: 600 .9rem var(--font); padding: .3rem .7rem; border-radius: .5rem; border: 2px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.sg.on { border-color: var(--sc); background: var(--accent-soft); }
.sg.right { border-color: var(--ok); background: var(--ok-bg); }
.sg.wrong { border-color: var(--no); background: var(--no-bg); }
.tw-grid { width: 100%; max-width: 30rem; display: block; margin-bottom: .6rem; }
.gc { fill: var(--card); stroke: var(--fig-soft); stroke-width: 1; cursor: pointer; }
.gc:hover { fill: var(--accent-soft); }
.gc.on { fill: var(--sc); fill-opacity: .55; }
.gc.pre { fill: var(--fig-soft); cursor: default; }
.gc.ex { stroke: var(--ok); stroke-width: 3; stroke-dasharray: 4 3; }
.tw-draft { width: 100%; font: 1rem/1.5 var(--font-text); padding: .6rem .8rem; border: 2px solid var(--line); border-radius: .6rem; background: var(--bg); color: var(--ink); resize: vertical; }
.tw-passage { margin-bottom: .8rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--bg); }
.tw-passage summary { cursor: pointer; padding: .5rem .9rem; font-weight: 700; }
.tw-passage-t { padding: 0 1.1rem .7rem; font: 1.05rem/1.65 var(--font-text); }
.tw-passage-t p { margin: .4rem 0; text-indent: 1.5em; }
.tw-passage-t .poem { white-space: pre-line; text-indent: 0; }
.tw-passage-t .src { text-align: right; color: var(--muted); font-style: italic; text-indent: 0; }
.clock-svg { width: 11rem; height: 11rem; }
.bars-svg { width: 100%; max-width: 32rem; }
.num-b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- the board: one task over the whole screen ---------- */
body.board-on { overflow: hidden; }
.board { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow: auto; font-size: clamp(18px, 2.3vw, 46px); }
.board-in { min-height: 100%; display: flex; flex-direction: column; padding: 1.2em 2.2em 1.6em; }
.board .tr-body, .board .tr { font-size: 1em; }
.tr-board { flex: 1; display: flex; flex-direction: column; }
.tr-board .tr-head { font-size: .8em; gap: 1em; }
.tr-title { font-weight: 800; color: var(--sc); }
.tr-board .tr-stat { margin-left: auto; font-size: 1.1em; }
.tr-x { width: 2em; height: 2em; border-radius: .5em; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-size: 1.1em; cursor: pointer; }
.tr-board .tr-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: .4em 0; }
.tr-board .tw-q { font-size: 1.3em; line-height: 1.4; }
.tr-board .tw-q .big, .tr-board .tw-q big { font-size: 1.4em; }
.tr-board .ans { font-size: 1.3em; width: 8em; padding: .2em .4em; }
.tr-board .tw-text .ans { width: 14em; }
.tr-board .opt { font-size: 1em; padding: .5em .7em; min-height: 0; }
.tr-board .tw-opts { grid-template-columns: repeat(auto-fit, minmax(7em, 1fr)); gap: .5em; }
.tr-board .tw-opts.wide { grid-template-columns: 1fr 1fr; }
.tr-board .tw-stress { font-size: 3.2em; }
.tr-board .tw-pick, .tr-board .tw-gaps { font-size: 1.25em; }
.tr-board .oi, .tr-board .sg, .tr-board .sw { font-size: .95em; }
.tr-board .tw-grid { max-width: 18em; }
.tr-board .tw-pic svg { max-height: 40vh; }
.tr-board .clock-svg { width: 7em; height: 7em; }
.tr-board .tr-bar { font-size: .75em; }
.tr-board .btn { font-size: 1em; min-height: 2.6em; padding: .4em 1em; }
.tr-board .btn-small { font-size: .9em; }
.tr-board .tr-verdict { font-size: .9em; }
.tr-board .tw-explain { font-size: .85em; }
.tr-board .tw-passage { font-size: .7em; }
.tr-board .tw-draft { font-size: .8em; }
.exam-badge { display: inline-block; font-size: .7em; vertical-align: .15em; background: var(--sc); color: #fff; border-radius: .4em; padding: .05em .5em; margin-right: .3em; }

/* ---------- the mock exam ---------- */
.together { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin: 2rem 0 0; padding: 1rem 1.2rem; border-radius: 1rem; background: var(--card); border: 1px dashed var(--sc); font-family: var(--font); }
.exam { font-family: var(--font); }
.exam-head { position: sticky; top: 3.4rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .7rem 1rem; background: var(--card); border: 2px solid var(--sc); border-radius: 1rem; margin-bottom: 1.2rem; }
.exam-var { font-size: 1.15rem; }
.exam-var b { color: var(--sc); }
.exam-open input { font: 600 1rem var(--font); width: 5rem; padding: .25rem .4rem; border: 2px solid var(--line); border-radius: .5rem; background: var(--bg); color: var(--ink); }
.exam-clock { font-weight: 800; font-variant-numeric: tabular-nums; }
.exam-clock.late { color: var(--no); }
.exam-passage { padding: 1rem 1.3rem; border-radius: 1rem; background: var(--card); border: 1px solid var(--line); margin-bottom: 1.4rem; }
.exam-passage h2 { margin: .2rem 0 .4rem; font-size: 1.3rem; }
.exam-passage .tw-passage-t { padding: 0; }
.exam-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.exam-task { padding: 1rem 1.2rem; border-radius: 1rem; background: var(--card); border: 2px solid var(--line); }
.exam-task.is-ok { border-color: var(--ok); }
.exam-task.is-no { border-color: var(--no); }
.exam-task.is-part { border-color: var(--fig-gold); }
.exam-n { display: flex; flex-wrap: wrap; gap: .8rem; align-items: baseline; margin-bottom: .4rem; }
.exam-n b { color: var(--sc); font-size: 1.1rem; }
.exam-n span { color: var(--muted); font-size: .85rem; }
.exam-n a { margin-left: auto; font-size: .85rem; }
.exam-res:empty { display: none; }
.exam-res { margin-top: .7rem; }
.exam-verdict { font-weight: 700; }
.exam-self { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-weight: 700; margin-bottom: .4rem; }
.exam-finish { margin: 1.4rem 0; font-size: 1.1rem; min-height: 3.2rem; padding: .5rem 1.6rem; }
.exam-total:empty { display: none; }
.exam-total { padding: 1rem 1.3rem; border-radius: 1rem; background: var(--card); border: 2px solid var(--sc); }
.exam-sum { font-size: 1.4rem; }
.mark { font-size: 1.3em; }
.mark-5, .mark-4 { color: var(--ok); } .mark-2 { color: var(--no); }
.scale { margin-top: 2rem; }
.scale-t { border-collapse: collapse; margin: .4rem 0; }
.scale-t th, .scale-t td { border: 1px solid var(--line); padding: .3rem .7rem; text-align: center; }

/* ---------- pager, footer ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.6rem; max-width: 52rem; }
:root[data-tv="1"] .pager { max-width: none; }
.pager a { display: block; padding: .8rem 1rem; border-radius: .8rem; border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--ink); font-weight: 600; line-height: 1.35; }
.pager a:hover { border-color: var(--sc); }
.pager small { display: block; color: var(--muted); font-weight: 400; }
.pager .next { text-align: right; }
.foot { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; padding: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot a { color: var(--muted); }
.changelog h2 { font-size: 1.2rem; margin-top: 1.6rem; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .layout.with-side { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; z-index: 30; top: 3.4rem; left: 0; bottom: 0; width: 18rem; max-width: 85vw; max-height: none; background: var(--bg); border-right: 1px solid var(--line); padding: 1rem; box-shadow: 0 0 2rem rgba(0, 0, 0, .15); }
  body.side-open .side { display: block; }
  .menu-btn { display: flex; }
  .tv-t { display: none; }
}
:root[data-tv="1"] body.side-open .layout.with-side .side { display: block; position: fixed; z-index: 30; top: 3.4rem; left: 0; bottom: 0; width: 22rem; max-width: 85vw; max-height: none; background: var(--bg); border-right: 1px solid var(--line); padding: 1rem; box-shadow: 0 0 2rem rgba(0, 0, 0, .15); }
@media (max-width: 600px) {
  :root { font-size: 16px; }
  .layout { padding: 1.2rem .9rem 3rem; }
  .hero h1 { font-size: 2rem; }
  .par h1, .subj-head h1 { font-size: 1.7rem; }
  .crumbs { display: none; }
  .top { justify-content: flex-end; }
  .brand { margin-right: auto; }
  .pager { grid-template-columns: 1fr; }
  .tw-stress { font-size: 2rem; }
  .board { font-size: 17px; }
  .board-in { padding: .8em 1em; }
  .tr-board .tw-opts.wide { grid-template-columns: 1fr; }
  .sw { min-width: 0; }
  .subj-ico { font-size: 2.6rem; }
}
@media print {
  .top, .side, .foot, .pager, .tr-bar, .exam-head, .together { display: none !important; }
  .layout.with-side { display: block; }
}
.plan { border-collapse: collapse; margin: .6rem 0; }
.plan td { width: 4.5rem; height: 3.2rem; border: 3px solid var(--fig-ink) !important; text-align: center; font-weight: 800; font-size: 1.2em; color: var(--sc); }
.frac { display: inline-flex; align-items: baseline; font-weight: 800; }
.frac sup, .frac sub { font-size: .8em; }
.grid-svg { width: 100%; display: block; }
.gap-show { display: inline-block; min-width: 1.2em; border-bottom: 3px solid var(--sc); color: var(--sc); text-align: center; }
.morph { font: 800 1.3em var(--font); letter-spacing: .02em; }
.mp { position: relative; padding: .1em .05em 0; margin: 0 .03em; }
.mp-root { border-top: 3px solid var(--fig-red); border-radius: 50% 50% 0 0 / 70% 70% 0 0; }
.mp-pre { border-top: 3px solid var(--fig-blue); border-right: 3px solid var(--fig-blue); }
.mp-suf { border-top: 3px solid var(--fig-green); }
.mp-suf::before { content: ""; position: absolute; top: -.55em; left: 50%; width: .5em; height: .5em; border-left: 3px solid var(--fig-green); border-top: 3px solid var(--fig-green); transform: translateX(-50%) rotate(45deg); }
.mp-suf { padding-top: .25em; }
.mp-end { border: 3px solid var(--fig-orange); padding: 0 .1em; }
.mp-zero { display: inline-block; width: .9em; height: 1em; vertical-align: -.1em; }
.poem-q { margin: .6rem 0; padding: .4rem 1rem; border-left: 4px solid var(--sc); font: italic 1.05em/1.5 var(--font-text); font-weight: 400; }
.poem-q small { color: var(--muted); font-style: normal; }
/* models */
.sim-sl { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem .8rem; margin: .5rem 0; font-weight: 600; }
.sim-sl input { width: min(22rem, 80vw); accent-color: var(--sc); }
.sim-out { margin: .6rem 0 0; font-size: 1.05rem; }
.sim-razr table { margin: .8rem auto; border-collapse: collapse; }
.sim-razr th, .sim-razr td { border: 1px solid var(--line); padding: .3rem .5rem; font-size: .8rem; text-align: center; }
.sim-razr th.cl { background: var(--accent-soft); font-size: .85rem; }
.sim-razr td { font: 800 1.8rem var(--font); color: var(--sc); min-width: 3.2rem; }
.sim-razr td.sep { border-right: 3px solid var(--fig-ink); }
.sim-razr .ans { text-align: center; width: 10rem; }
.sim-clock .clock-svg { width: 14rem; height: 14rem; }
.sim-road { position: relative; height: 5rem; margin: .5rem 0 1.5rem; border-bottom: 4px solid var(--fig-ink); }
.sim-car { position: absolute; bottom: 0; left: 0; font-size: 2.4rem; transform: translateX(-50%) scaleX(-1); }
.sim-marks span { position: absolute; bottom: -1.6rem; font-size: .75rem; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.sim-marks span::before { content: ""; position: absolute; left: 50%; top: -.6rem; height: .5rem; border-left: 2px solid var(--fig-ink); }
.sim-tl { position: relative; height: 6rem; margin: 1rem 1.5rem; }
.tl-axis { position: absolute; left: 0; right: 0; top: 2.8rem; border-top: 4px solid var(--fig-ink); }
.tl-c { position: absolute; top: 3.4rem; transform: translateX(-50%); font-weight: 800; color: var(--muted); font-size: .8rem; }
.tl-dot { position: absolute; top: 1.6rem; transform: translateX(-50%); font: 700 .7rem var(--font); padding: .15rem .3rem; border-radius: .4rem; border: 2px solid var(--sc); background: var(--card); color: var(--ink); cursor: pointer; }
.tl-dot:nth-child(odd) { top: .2rem; }
.tl-dot.on { background: var(--sc); color: #fff; }
.sim-morph-pick { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.sim-morph { margin: 1.4rem 0 .4rem; font-size: 1.8rem; }
.exam-list { grid-template-columns: minmax(0, 1fr); }
.tw, .tw-q { min-width: 0; overflow-wrap: break-word; }
.tw-q table, .par-body table { display: block; max-width: 100%; overflow-x: auto; }
.sim-razr { overflow-x: auto; }
@media (max-width: 600px) {
  .sim-razr th { font-size: .62rem; padding: .2rem; }
  .sim-razr td { font-size: 1.3rem; min-width: 2.2rem; }
  .exam-task { padding: .8rem; }
}
@media (max-width: 600px) { .sim-morph { font-size: 1.15rem; } }
