/* Общие стили всех страниц. Light by default; data-skin="dark" is the site's own toggle. Home = choose an OGE task; task page = task strip + cards that reflow from two columns to one as the zoom grows. Everything in rem so zoom = root font-size. */
:root {
  --paper: #f6f8fc;
  --sheet: #ffffff;
  --ink: #18213a;
  --muted: #5b6684;
  --line: #d3d9e8;
  --pen: #2348c9;
  --pen-soft: #e6ecfc;
  --ok: #157a3c;
  --ok-bg: #e2f5e8;
  --bad: #c0262d;
  --bad-bg: #fde7e7;
  --cell: #c9d3ea;
  --f-display: "Unbounded", "Onest", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
:root[data-skin="dark"] {
  --paper: #0f1424; --sheet: #171e33; --ink: #e6eaf5; --muted: #9aa5c4; --line: #2c3654;
  --pen: #8ea8ff; --pen-soft: #222d50; --ok: #5fd68b; --ok-bg: #12321f; --bad: #ff7b7f; --bad-bg: #3a1619;
  --cell: #34406a; color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }
img { max-width: 100%; }
html { font-size: 100%; }
body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 1rem; line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--sheet); }
.wrap {
  max-width: 76rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }

/* toolbar */
.bar { font-size: 15px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--sheet); border-bottom: 1px solid var(--line); }
.bar .wrap { max-width: 1216px; display: flex; flex-wrap: wrap; align-items: center; gap: .5em 1em; padding-block: .6em; }
.brand { color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 1.05em; letter-spacing: .01em; margin-right: auto; display: flex; align-items: baseline; gap: .5em; flex-wrap: wrap; }
.brand small { font-family: var(--f-body); font-weight: 500; font-size: .8em; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; }
.zoom { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: .6em; overflow: hidden; }
.zoom button { background: none; border: 0; padding: .35em .7em; font-weight: 700; min-width: 2.6em; }
.zoom button:hover { background: var(--pen-soft); }
.zoom button:disabled { opacity: .35; cursor: default; background: none; }
.zoom output { display: grid; place-items: center; min-width: 3.6em; font-family: var(--f-mono); font-size: .85em; border-inline: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbtn { background: none; border: 1px solid var(--line); border-radius: .6em; padding: .35em .8em; font-weight: 500; }
.tbtn:hover { background: var(--pen-soft); }
.tbtn .short { display: none; }
@media (max-width: 600px) { .tbtn .short { display: inline; } }
.tbtn[aria-pressed="true"] { background: var(--pen); border-color: var(--pen); color: var(--sheet); }

@media (max-width: 480px) { .brand small { display: none; } }

/* task-number tabs (future: 1..16) */
.nums { display: flex; flex-wrap: wrap; gap: .4rem; padding-block: 1.4rem .2rem; align-items: center; }
.back { color: var(--pen); font-weight: 500; text-decoration: none; padding: .3rem 0; }
.back:hover { text-decoration: underline; }

/* home */
.hero { padding-block: 2.2rem 1.4rem; display: grid; gap: .5rem; }
.hero h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); line-height: 1.1; margin: 0; text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); max-width: 40rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; padding-bottom: 3rem; }
.tile { display: grid; gap: .5rem; grid-template-columns: auto minmax(0, 1fr); align-items: center; text-decoration: none; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: .9rem; padding: 1.1rem 1.2rem; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--pen); transform: translateY(-2px); }
.tile .no { font-family: var(--f-display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--pen); grid-row: span 2; padding-right: .5rem; }
.tile .nm { font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.tile .meta { font-size: .9rem; color: var(--muted); }
.tile .bar2 { grid-column: 1 / -1; height: .4rem; border-radius: 1rem; background: var(--pen-soft); overflow: hidden; }
.tile .bar2 i { display: block; height: 100%; background: var(--ok); }

/* section head */
.head { display: grid; gap: .4rem; padding-block: 1rem 1.2rem; }
.head h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.head h1 b { color: var(--pen); }
.head p { margin: 0; color: var(--muted); max-width: 42rem; }
.stats { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; font-size: .95rem; }
.stats strong { font-variant-numeric: tabular-nums; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pen); text-decoration: underline; text-underline-offset: .2em; font-size: .9rem; }

/* strip of 40 */
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.3rem, 1fr)); gap: .3rem; padding-bottom: 1.4rem; }
.strip button { border: 1px solid var(--line); background: var(--sheet); border-radius: .4rem; padding: .25rem 0; font-family: var(--f-mono); font-size: .8rem; font-variant-numeric: tabular-nums; }
.strip button:hover { border-color: var(--pen); }
.strip button.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.strip button.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.strip button.cur { outline: 2px solid var(--pen); outline-offset: 1px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 34rem), 1fr)); gap: 1rem; padding-bottom: 3rem; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: .9rem; padding: 1.2rem 1.25rem 1.3rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; min-width: 0; align-content: start; scroll-margin-top: 80px; }
.card header { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.card h2 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 1rem; }
.card h2 .of { color: var(--muted); font-family: var(--f-body); font-size: .85rem; font-weight: 400; }
.tag { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--pen); background: var(--pen-soft); border-radius: .3rem; padding: .05rem .4rem; }
.txt { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; white-space: pre-line; }
.txt code { font-family: var(--f-mono); font-size: .92em; font-weight: 500; background: var(--pen-soft); color: var(--ink); padding: .03em .25em; border-radius: .25em; white-space: normal; overflow-wrap: anywhere; }
.instr { margin: 0; color: var(--muted); font-size: .95rem; }

.frags { display: grid; grid-template-columns: repeat(auto-fit, minmax(4.6rem, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.frag { display: grid; grid-template-rows: auto 1fr; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.frag .k { font-weight: 700; font-size: .85rem; text-align: center; padding: .2rem .3rem; background: var(--paper); border-bottom: 1px solid var(--line); }
.frag .v { font-family: var(--f-mono); font-weight: 700; font-size: 1.1rem; text-align: center; padding: .45rem .35rem; overflow-wrap: anywhere; }

details.hint { border: 1px dashed var(--pen); border-radius: .6rem; padding: .5rem .8rem; background: var(--pen-soft); }
details.hint summary { cursor: pointer; font-weight: 700; color: var(--pen); }
details.hint p { margin: .4rem 0 .1rem; }

.answer { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; justify-items: start; }
.answer label { font-weight: 700; }
/* answer cells like the ОГЭ answer sheet: one character per cell */
.cells {
  --cw: calc(1ch + .55em);
  font-family: var(--f-mono); font-weight: 700; font-size: 1.35rem; text-transform: uppercase;
  letter-spacing: .55em; padding: .35em 0 .35em .275em;
  width: 100%; min-width: 0; justify-self: stretch;
  border: 2px solid var(--cell); border-radius: .35rem; color: var(--ink);
  background-color: var(--sheet);
  background-image: repeating-linear-gradient(90deg, transparent 0 calc(var(--cw) - 1px), var(--cell) calc(var(--cw) - 1px) var(--cw));
  transition: background-color .2s, border-color .2s;
}
.cells.free { text-transform: none; letter-spacing: .3em; --cw: calc(1ch + .3em); padding-left: .15em; }
.tag.src { color: var(--muted); background: var(--paper); border: 1px solid var(--line); }
.cells:focus { outline: none; border-color: var(--pen); }
.cells.ok { border-color: var(--ok); background-color: var(--ok-bg); color: var(--ok); }
.cells.bad { border-color: var(--bad); background-color: var(--bad-bg); color: var(--bad); }
.check { background: var(--pen); color: var(--sheet); border: 0; border-radius: .55rem; padding: .65rem 1.4rem; font-weight: 700; }
.check:hover { filter: brightness(1.08); }
.msg { font-weight: 700; min-height: 1.55em; margin: 0; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }

/* one-at-a-time mode for the projector */
.pager { display: none; gap: .6rem; align-items: center; justify-content: center; padding-bottom: 3rem; flex-wrap: wrap; }
body.single .grid { grid-template-columns: 1fr; max-width: 56rem; margin-inline: auto; padding-bottom: 1rem; }
body.single .card { display: none; }
body.single .card.cur { display: grid; }
body.single .pager { display: flex; }
.pager button { border: 1px solid var(--line); background: var(--sheet); border-radius: .6rem; padding: .5rem 1.1rem; font-weight: 700; }
.pager button:hover { border-color: var(--pen); }
.pager output { font-family: var(--f-mono); min-width: 5rem; text-align: center; }

@media (max-width: 600px) {
  .card { padding: 1rem .9rem 1.1rem; border-radius: .7rem; }
  .txt { font-size: 1rem; }
  .frag .v { font-size: 1rem; }
  .cells { font-size: 1.2rem; }
  .check { justify-self: stretch; }
  .bar .wrap { flex-wrap: nowrap; }
  .brand { font-size: .95em; min-width: 0; }
  .tools { flex-wrap: nowrap; gap: .35em; }
  .zoom button { min-width: 2.2em; padding: .35em .45em; }
  .zoom output { min-width: 3.2em; font-size: .8em; }
  .tbtn .long { display: none; }
  .strip { grid-template-columns: repeat(auto-fill, minmax(2.1rem, 1fr)); gap: .25rem; }
  .head { padding-block: .6rem 1rem; }
  .bar .wrap { padding-block: .45em; }
  .tbtn { padding: .35em .6em; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
