/* =========================================================
   Про100ГИА — оформление сайта
   Фирменные цвета МЦКО (синий и красный), мягкие скруглённые
   формы, «тетрадная клетка» и цифры в клетках бланка ЕГЭ.
   Цвета предмета задаются переменными --subj-light / --subj-dark.
   ========================================================= */

@font-face {
  font-family: "PT Sans";
  src: url("../fonts/PTSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PT Sans";
  src: url("../fonts/PTSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #06408f;
  --blue-deep: #052f6b;
  --blue-soft: #e9f0fa;
  --red: #cf2624;
  --red-deep: #a81c1a;
  --ink: #1c2533;
  --muted: #5a6577;
  --line: #d6dfeb;
  --mist: #f1f5fa;
  --paper: #ffffff;
  --grid: rgba(6, 64, 143, .075);
  --ok: #1f7a43;
  --warn: #9a6200;

  --subj-light: #7aa2d6;
  --subj-dark: var(--blue);

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 32px;
  --pill: 999px;
  --t: .28s ease;
  --shadow: 0 1px 2px rgba(5, 47, 107, .06), 0 10px 30px -14px rgba(5, 47, 107, .22);
  --font: "PT Sans", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Тёмный оттенок цвета предмета для текста — пересчитывается там, где задан цвет предмета */
* { --subj-ink: color-mix(in srgb, var(--subj-dark) 72%, #1c2533); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font: 400 17px/1.55 var(--font);
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--red); }

/* Все наведения — плавные */
a, button, input, select, textarea, summary,
.btn, .card, .subject-tile, .tile, .nav__link, .mitem, .way {
  transition: color var(--t), background-color var(--t), border-color var(--t),
              box-shadow var(--t), transform var(--t), opacity var(--t);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

:focus-visible { outline: 3px solid #ffbf3c; outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; color: var(--blue-deep); }
h1 { font-size: clamp(32px, 4.6vw, 54px); letter-spacing: -.01em; }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: 21px; }
p { margin: 0 0 1em; }
.sr, .skip:not(:focus) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: #fff; padding: 8px 14px; border-radius: var(--pill); }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(720px + 2 * var(--gutter)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 26px;
  font: 700 16px/1.2 var(--font);
  color: #fff; background: var(--blue);
  border: 2px solid var(--blue); border-radius: var(--pill);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; box-shadow: 0 8px 18px -10px rgba(5, 47, 107, .7); }
.btn--red { background: var(--red); border-color: var(--red); }
.btn--red:hover { background: var(--red-deep); border-color: var(--red-deep); box-shadow: 0 8px 18px -10px rgba(168, 28, 26, .7); }
.btn--ghost { background: #fff; color: var(--blue); }
.btn--ghost:hover { background: var(--blue); color: #fff; }
/* Белая кнопка на синем: при наведении — фирменный красный */
.btn--light { background: #fff; color: var(--blue-deep); border-color: #fff; }
.btn--light:hover { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .45); }
.btn--sm { min-height: 38px; padding: 6px 16px; font-size: 14px; }
.btn--ok { background: var(--ok); border-color: var(--ok); }
.btn--ok:hover { background: #17603a; border-color: #17603a; }
.btn--danger { background: #fff; color: var(--red); border-color: currentColor; }
.btn--danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: saturate(1.4) blur(8px);
  box-shadow: 0 1px 0 var(--line);
}
.top__bar { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.mcko { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--blue-deep); flex-shrink: 0; }
.mcko:hover { color: var(--blue); }
.mcko img { width: 44px; height: 44px; border-radius: 50%; }
.mcko__name { font-size: 13px; line-height: 1.2; font-weight: 700; }
.brand {
  font-weight: 700; font-size: 26px; letter-spacing: -.01em; text-decoration: none;
  color: var(--blue); white-space: nowrap;
  padding: 6px 18px; background: var(--blue-soft); border-radius: var(--pill);
}
.brand:hover { color: var(--blue); background: #dfe9f7; }
.brand__pro { color: var(--red); font-style: italic; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--pill);
  font: 700 16px/1.2 var(--font); color: var(--ink); text-decoration: none;
  background: none; border: 0; cursor: pointer;
}
.nav__link:hover, .nav__link[aria-expanded="true"] { color: var(--blue); background: var(--mist); }
.nav__link[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
.nav__link--account { color: #fff; background: var(--blue); }
.nav__link--account:hover { color: #fff; background: var(--blue-deep); }
.nav__sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.nav__toggle svg { transition: transform var(--t); }
.nav__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav__subjects { position: relative; }

.subjects-panel {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  width: min(640px, 92vw); padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow);
}
.subjects-panel ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.subjects-panel a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px;
  border-radius: var(--pill); text-decoration: none; color: var(--ink); font-weight: 700;
}
.subjects-panel a:hover, .subjects-panel a[aria-current="page"] {
  background: color-mix(in srgb, var(--subj-light) 18%, #fff); color: var(--subj-dark);
}
.subjects-panel img { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; }

.menu-btn {
  display: none; margin-left: auto; width: 48px; height: 48px; padding: 14px 12px;
  background: var(--mist); border: 0; border-radius: 50%; cursor: pointer;
  flex-direction: column; justify-content: space-between;
}
.menu-btn:hover { background: var(--blue-soft); }
.menu-btn span { display: block; height: 2px; background: var(--blue-deep); border-radius: 2px; transition: transform var(--t), opacity var(--t); }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1080px) {
  .mcko__name { display: none; }
}
@media (max-width: 920px) {
  .top__bar { gap: 12px; min-height: 66px; }
  .brand { font-size: 21px; padding: 5px 14px; }
  .menu-btn { display: flex; }
  .nav {
    display: none; position: absolute; left: 12px; right: 12px; top: calc(100% + 8px);
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
    padding: 10px; max-height: calc(100vh - 90px); overflow: auto;
  }
  .nav.is-open { display: flex; }
  .nav__link { padding: 13px 16px; justify-content: space-between; }
  .nav__link--account { margin-top: 8px; justify-content: center; }
  .nav__sep { display: none; }
  .subjects-panel { position: static; transform: none; width: auto; box-shadow: none; border: 0; padding: 4px 0 8px; }
  .subjects-panel ul { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .subjects-panel ul { grid-template-columns: 1fr; }
}

/* ---------- Сообщения ---------- */
.flash { margin: 20px 0 0; padding: 14px 20px; border-radius: var(--r-sm); background: #e8f4ec; color: #134d2b; box-shadow: inset 5px 0 0 var(--ok); }
.flash--error { background: #fdecec; color: #7c1312; box-shadow: inset 5px 0 0 var(--red); }
.flash--warn { background: #fff5df; color: #6b4500; box-shadow: inset 5px 0 0 #e0a100; }

/* ---------- Главная: первый экран ---------- */
.hero { padding: 24px 0 0; }
.hero__panel {
  position: relative; overflow: hidden;
  padding: clamp(32px, 6vw, 72px);
  background-color: #fbfcfe;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
/* поле тетради */
.hero__panel::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(18px, 3vw, 40px);
  width: 2px; background: rgba(207, 38, 36, .3);
}
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero h1 { max-width: 15ch; margin-bottom: 20px; }
.hero__lead { font-size: clamp(18px, 1.6vw, 20px); max-width: 60ch; color: #2d3949; margin-bottom: 28px; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__panel::before { display: none; }
}
@media (max-width: 520px) {
  .hero { padding-top: 12px; }
  .hero__panel { padding: 28px 20px; border-radius: var(--r-md); }
  .hero h1 { font-size: 30px; }
  .hero__ctas .btn { width: 100%; }
}

/* Цифры конкурса: каждая цифра — клетка бланка, цифры «прокручиваются» */
.stats {
  --cell-h: 48px;
  list-style: none; margin: 0; padding: 24px 26px;
  display: grid; gap: 22px;
  background: #fff; border-radius: var(--r-md); box-shadow: var(--shadow);
}
.stat__value { display: flex; align-items: center; gap: 6px; font-size: 34px; line-height: 1; font-weight: 700; color: var(--red); }
.stat__label { display: block; margin-top: 8px; font-size: 15px; line-height: 1.3; color: var(--muted); }
.cell {
  position: relative; display: block; width: 40px; height: calc(var(--cell-h) + 4px); overflow: hidden;
  border: 2px solid var(--blue); border-radius: 10px; background: #fff;
  color: var(--blue-deep); font-size: 30px;
}
.cell:nth-child(odd) { background: #fafcff; }
.strip { display: flex; flex-direction: column; transform: translateY(0); transition: transform 1.6s cubic-bezier(.16, .84, .3, 1); }
.strip > span { display: block; height: var(--cell-h); line-height: var(--cell-h); text-align: center; }
.stats.is-on .strip { transform: translateY(calc(var(--d) * var(--cell-h) * -1)); }
.sym { font-size: 30px; color: var(--red); padding: 0 2px; }
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 420px) {
  .stats { --cell-h: 40px; padding: 20px; }
  .cell { width: 34px; font-size: 25px; }
}

/* ---------- Секции ---------- */
.section { padding: clamp(48px, 7vw, 88px) 0; }
.section--mist { background: var(--mist); border-radius: var(--r-lg); margin: 0 clamp(0px, 1.5vw, 20px); }
.section--tight { padding: 0 0 clamp(48px, 7vw, 88px); }
.section__head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.section__head p { margin: 0; max-width: 52ch; color: var(--muted); }

/* ---------- Плитки предметов ---------- */
.subjects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.subject-tile {
  position: relative; display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 16px;
  height: 100%; padding: 14px 20px 14px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--pill);
  text-decoration: none; color: var(--ink);
}
.subject-tile:hover {
  background: color-mix(in srgb, var(--subj-light) 16%, #fff); border-color: var(--subj-dark); color: var(--ink);
  transform: translateY(-2px); box-shadow: 0 10px 22px -14px var(--subj-dark);
}
.subject-tile img { width: 64px; height: 64px; border-radius: 50%; }
.subject-tile__name { display: block; font-weight: 700; font-size: 19px; line-height: 1.2; color: var(--ink); }
.subject-tile:hover .subject-tile__name { color: var(--subj-dark); }
.subject-tile__count { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }

/* ---------- О конкурсе ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); }
.about__text { font-size: 18px; }
.ways { display: grid; gap: 16px; align-content: start; }
.way { padding: 26px 28px; background: #fff; border-radius: var(--r-md); box-shadow: inset 0 5px 0 var(--blue), var(--shadow); }
.way:first-child { box-shadow: inset 0 5px 0 var(--red), var(--shadow); }
.way h3 { margin-bottom: 8px; }
.way p { color: #2d3949; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- Документы ---------- */
.docs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.docs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.docs__list > li {
  display: flex; align-items: center; gap: 16px; padding: 12px 18px 12px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--pill);
}
.docs__list > li:hover { border-color: var(--red); background: #fff7f7; }
.docs__kind {
  flex-shrink: 0; width: 48px; height: 48px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--red); border-radius: 50%;
}
.docs__list a { font-weight: 700; font-size: 18px; text-decoration: none; }
.docs__list a:hover { color: var(--red); }
@media (max-width: 860px) { .docs { grid-template-columns: 1fr; } }

/* ---------- Призыв стать автором ---------- */
.join {
  display: flex; align-items: center; justify-content: space-between; gap: 24px 48px; flex-wrap: wrap;
  padding: clamp(28px, 4vw, 48px); background: var(--blue-deep); color: #fff; border-radius: var(--r-lg);
  background-image: radial-gradient(circle at 100% 0, rgba(255, 255, 255, .12) 0 180px, transparent 181px);
}
.join h2 { color: #fff; margin-bottom: 8px; font-size: clamp(24px, 2.6vw, 30px); }
.join p { margin: 0; max-width: 62ch; color: #d7e3f5; }

/* ---------- Подвал ---------- */
.foot { background: #0d1f3c; color: #c7d3e6; font-size: 15px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.foot a { color: #fff; text-decoration: none; }
.foot a:hover { text-decoration: underline; color: #fff; }
.foot__grid { display: grid; grid-template-columns: 1.3fr 1.4fr 1fr; gap: 40px; padding-top: 56px; padding-bottom: 40px; }
.brand--foot { padding: 6px 18px; font-size: 26px; color: #fff; display: inline-block; margin-bottom: 14px; background: rgba(255, 255, 255, .08); }
.brand--foot:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .14); }
.brand--foot .brand__pro { color: #ff6b69; }
.foot__title { font-size: 16px; color: #fff; margin-bottom: 14px; }
.foot__subjects, .foot__links { list-style: none; margin: 0; padding: 0; }
.foot__subjects { columns: 2; column-gap: 24px; }
.foot__subjects li, .foot__links li { margin-bottom: 8px; break-inside: avoid; }
.foot__bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 18px; padding-bottom: 24px; font-size: 14px; color: #93a4c0; }
@media (max-width: 860px) { .foot__grid { grid-template-columns: 1fr; gap: 28px; } }

/* =========================================================
   Страница предмета
   ========================================================= */
.subject-wrap { padding-top: 24px; }
.subject-head {
  position: relative; overflow: hidden; color: #fff;
  display: flex; align-items: center; gap: clamp(16px, 3vw, 32px);
  padding: clamp(28px, 4vw, 48px);
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--subj-dark) 0%, var(--subj-dark) 45%, var(--subj-light) 100%);
}
.subject-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .13) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
}
.subject-head > * { position: relative; z-index: 1; }
.subject-head img { width: clamp(72px, 9vw, 112px); height: auto; flex-shrink: 0; border-radius: 50%; box-shadow: 0 0 0 6px rgba(255, 255, 255, .25); }
.subject-head h1 { color: #fff; margin: 0 0 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.subject-head p { margin: 0; color: rgba(255, 255, 255, .92); font-size: 18px; }
.crumbs { font-size: 15px; margin-bottom: 6px; }
.crumbs a { color: rgba(255, 255, 255, .9); }
.crumbs a:hover { color: #fff; }

.subject-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: clamp(28px, 4vw, 56px); padding-top: 40px; padding-bottom: 72px; }
.subject-side { position: sticky; top: 100px; align-self: start; padding: 18px; background: var(--mist); border-radius: var(--r-md); }
.subject-side h2 { font-size: 16px; color: var(--muted); margin: 0 0 10px 10px; }
.subject-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.subject-side a { display: block; padding: 8px 12px; border-radius: var(--pill); color: var(--ink); text-decoration: none; font-size: 16px; }
.subject-side a:hover { background: #fff; color: var(--subj-ink); }
.subject-side a[aria-current="page"] { background: var(--subj-ink); color: #fff; font-weight: 700; }
@media (max-width: 960px) {
  .subject-body { grid-template-columns: 1fr; }
  .subject-side { position: static; }
  .subject-side ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .subject-side a { background: #fff; font-size: 15px; padding: 6px 14px; }
}

.exam-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.exam-filter button {
  font: 700 15px/1 var(--font); padding: 11px 18px; border-radius: var(--pill); cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid var(--line);
}
.exam-filter button:hover { border-color: var(--subj-dark); color: var(--subj-dark); }
.exam-filter button[aria-pressed="true"] { background: var(--subj-ink); border-color: var(--subj-ink); color: #fff; }

/* Содержание страницы: закреплённая полоса с номерами заданий и темами */
.toc {
  position: sticky; top: 84px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 32px; padding: 8px 8px 8px 18px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--pill);
  box-shadow: 0 8px 24px -18px rgba(5, 47, 107, .5);
}
.toc__title { flex-shrink: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.toc__list {
  list-style: none; margin: 0; padding: 2px; display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: thin; scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  padding-right: 24px;
}
.toc__list li[hidden] { display: none; }
.toc__link {
  display: block; white-space: nowrap; padding: 8px 14px; border-radius: var(--pill);
  font-size: 15px; font-weight: 700; text-decoration: none; color: var(--subj-ink);
  background: color-mix(in srgb, var(--subj-light) 14%, #fff);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.toc__link--topic, .toc__link--other { font-weight: 400; color: var(--ink); background: var(--mist); }
.toc__link:hover { background: color-mix(in srgb, var(--subj-light) 30%, #fff); color: var(--subj-ink); }
.toc__link[aria-current="true"] { background: var(--subj-ink); color: #fff; }
.task, .devs { scroll-margin-top: 160px; }
@media (max-width: 920px) { .toc { top: 74px; } }
@media (max-width: 640px) {
  .toc { padding-left: 8px; border-radius: var(--r-md); margin-left: calc(var(--gutter) * -.5); margin-right: calc(var(--gutter) * -.5); }
  .toc__title { display: none; }
}

/* Блок задания: слева «клетки бланка» с номером */
.task { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px dashed var(--line); }
.task:first-of-type { border-top: 0; padding-top: 0; }
.task__cell { align-self: start; text-align: center; }
.task__kind { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; line-height: 1.2; }
.task__num { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.task__num b {
  display: grid; place-items: center; min-width: 46px; height: 52px; padding: 0 6px;
  font-size: 26px; line-height: 1; color: var(--subj-ink);
  border: 2px solid var(--subj-dark); border-radius: 10px;
  background: color-mix(in srgb, var(--subj-light) 14%, #fff);
}
.task__num b.is-small { font-size: 18px; min-width: 40px; }
.task__label {
  display: inline-block; padding: 8px 14px; font-weight: 700; font-size: 16px;
  color: var(--subj-ink); border: 2px dashed var(--subj-dark); border-radius: var(--pill); background: #fff;
}
.task__title { font-size: 22px; color: var(--ink); margin: 0 0 14px; }
.task__blocks { display: grid; gap: 28px; }
/* Несколько заголовков в одной группе: заголовки чуть мельче, с меткой цвета предмета */
.task--multi .task__title { font-size: 20px; display: flex; gap: 10px; align-items: baseline; }
.task--multi .task__title::before {
  content: ""; flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
  background: var(--subj-dark); transform: translateY(-2px);
}

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 16px 20px 16px 16px; background: #fff; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
}
a.card:hover {
  background: color-mix(in srgb, var(--subj-light) 12%, #fff); border-color: var(--subj-dark); color: var(--ink);
  transform: translateY(-2px); box-shadow: 0 12px 24px -16px var(--subj-dark);
}
.card__n {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--subj-ink); color: #fff; font-weight: 700;
}
.card__desc { display: block; }
.card__meta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 12px 4px 10px;
  font-size: 14px; font-weight: 700; color: var(--subj-ink);
  background: color-mix(in srgb, var(--subj-light) 16%, #fff); border-radius: var(--pill);
}
a.card:hover .card__meta { background: var(--subj-ink); color: #fff; }
.card__meta svg { flex-shrink: 0; }

.devs { margin-top: 48px; padding: 30px; background: color-mix(in srgb, var(--subj-light) 10%, #fff); border-radius: var(--r-lg); }
.devs h2 { font-size: 24px; color: var(--subj-ink); }
.devs ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.devs li { padding: 12px 16px; background: #fff; border-radius: var(--r-sm); }
.devs b { display: block; }
.devs span { font-size: 15px; color: var(--muted); }

.empty { padding: 36px; text-align: center; background: var(--mist); border-radius: var(--r-lg); }

@media (max-width: 640px) {
  .task { grid-template-columns: 1fr; gap: 12px; }
  .task__cell { display: flex; align-items: center; gap: 10px; text-align: left; }
  .task__kind { margin: 0; }
  .task__num b { min-width: 38px; height: 42px; font-size: 21px; }
  .task__title { font-size: 19px; }
  .card { grid-template-columns: 30px minmax(0, 1fr); padding: 14px; gap: 10px; }
  .card__n { width: 30px; height: 30px; font-size: 14px; }
  .devs { padding: 20px; }
}

/* =========================================================
   Формы, кабинет, управление
   ========================================================= */
.page { padding: clamp(32px, 5vw, 56px) 0 72px; }
.page h1 { font-size: clamp(28px, 3.4vw, 40px); }
.page__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page__head h1 { margin: 0; }

.form { display: grid; gap: 18px; }
.form--card { padding: clamp(22px, 4vw, 38px); background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-weight: 700; font-size: 15px; }
.field small, .hint { font-size: 14px; color: var(--muted); }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="tel"],
.field input[type="number"], .field input[type="search"], .field select, .field textarea, .input {
  width: 100%; min-height: 48px; padding: 10px 16px;
  font: 400 16px/1.4 var(--font); color: var(--ink);
  background: #fff; border: 1px solid #b9c6d8; border-radius: var(--r-sm);
}
.field input:hover, .field select:hover, .field textarea:hover, .input:hover { border-color: #8fa3bf; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(6, 64, 143, .14); }
.field input[type="color"] { width: 64px; height: 48px; padding: 3px; border: 1px solid #b9c6d8; border-radius: var(--r-sm); background: #fff; }
.field input[type="file"] { font: inherit; }
.field input[type="file"]::file-selector-button {
  font: 700 14px var(--font); margin-right: 12px; padding: 8px 16px; cursor: pointer;
  color: var(--blue); background: var(--blue-soft); border: 0; border-radius: var(--pill); transition: background-color var(--t);
}
.field input[type="file"]::file-selector-button:hover { background: #d6e3f5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 640px) { .row2, .row3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--blue); }
.radios { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.radios legend { font-weight: 700; font-size: 15px; margin-bottom: 6px; padding: 0; }
.radios label { position: relative; }
.radios input { position: absolute; opacity: 0; }
.radios span { display: inline-block; padding: 10px 20px; border: 2px solid var(--line); border-radius: var(--pill); font-weight: 700; cursor: pointer; transition: all var(--t); }
.radios span:hover { border-color: var(--blue); color: var(--blue); }
.radios input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.radios input:focus-visible + span { outline: 3px solid #ffbf3c; }
.form__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.errors { margin: 0; padding: 14px 20px; background: #fdecec; color: #7c1312; border-radius: var(--r-sm); box-shadow: inset 5px 0 0 var(--red); }
.captcha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.captcha img { border: 1px solid var(--line); border-radius: var(--r-sm); }

.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: clamp(32px, 6vw, 80px); align-items: start; }
.auth__aside { padding-top: 8px; }
.auth__aside ol { padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.auth__aside ol li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.auth__aside ol li::before {
  content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue); font-weight: 700;
}
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; gap: 24px; } }

/* Статусы */
.status { display: inline-block; padding: 4px 12px; border-radius: var(--pill); font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--mist); color: var(--muted); }
.status--draft { background: #eef1f5; color: #4a5568; }
.status--pending { background: #fff2d6; color: #7a4d00; }
.status--published, .status--legacy { background: #e3f3e8; color: #17603a; }
.status--rejected { background: #fde6e5; color: #8e1716; }

.note { padding: 14px 20px; border-radius: var(--r-sm); background: #fff8e8; box-shadow: inset 5px 0 0 #e0a100; }
.note--red { background: #fdecec; box-shadow: inset 5px 0 0 var(--red); }

/* Таблицы */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { font-size: 13px; color: var(--muted); font-weight: 700; background: #f8fafc; white-space: nowrap; }
.table tbody tr { transition: background-color var(--t); }
.table tbody tr:hover { background: #fafcff; }
.table tr:last-child td { border-bottom: 0; }
.table td.nowrap { white-space: nowrap; }
.table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--subj-dark); margin-right: 6px; vertical-align: 1px; }

/* Материалы автора */
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mitem {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 18px 22px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: inset 5px 0 0 var(--subj-dark);
}
.mitem:hover { border-color: var(--subj-dark); }
.mitem h3 { font-size: 18px; margin: 6px 0 4px; color: var(--ink); }
.mitem__meta { font-size: 14px; color: var(--muted); }
.mitem__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: start; justify-content: end; }
.mitem__actions form { display: flex; gap: 8px; flex-wrap: wrap; }
.mitem__comment { grid-column: 1 / -1; }
@media (max-width: 640px) { .mitem { grid-template-columns: 1fr; } .mitem__actions { justify-content: start; } }

/* Управление: боковое меню */
.admin { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 32px; padding-top: 32px; padding-bottom: 72px; }
.admin__nav { position: sticky; top: 100px; align-self: start; padding: 12px; background: var(--mist); border-radius: var(--r-md); }
.admin__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.admin__nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--pill); color: var(--ink); text-decoration: none; font-weight: 700;
}
.admin__nav a:hover { background: #fff; color: var(--blue); }
.admin__nav a[aria-current="page"] { background: var(--blue); color: #fff; }
.admin__nav small { font-weight: 400; color: var(--muted); display: block; padding: 14px 14px 4px; font-size: 13px; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: var(--pill); background: var(--red); color: #fff; font-size: 12px; font-weight: 700; }
.admin h1 { font-size: clamp(26px, 3vw, 34px); }
@media (max-width: 960px) {
  .admin { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; }
  .admin__nav { position: static; padding: 8px; }
  .admin__nav ul { display: flex; overflow-x: auto; gap: 6px; }
  .admin__nav a { white-space: nowrap; background: #fff; }
  .admin__nav small { display: none; }
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 32px; }
.tile { display: block; padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--blue); color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile b { display: block; font-size: 36px; line-height: 1.1; color: var(--blue-deep); }
.tile--hot b { color: var(--red); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; padding: 16px; background: var(--mist); border-radius: var(--r-md); }
.filters .field { min-width: 160px; flex: 1 1 160px; }
.filters .field--wide { flex: 2 1 240px; }

.mod { padding: 24px 26px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: inset 6px 0 0 var(--subj-dark); }
.mod__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 15px; color: var(--muted); }
.mod h2 { font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.mod__desc { padding: 14px 18px; background: var(--mist); border-radius: var(--r-sm); margin: 12px 0; }
.mod__file { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mod__decide { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.mod__decide textarea { min-height: 64px; }
@media (max-width: 640px) { .mod__decide { grid-template-columns: 1fr; } }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 12px; }

.swatch { display: inline-block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); vertical-align: middle; }
.preview-tile { max-width: 340px; }

details.box { border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin-bottom: 12px; overflow: hidden; }
details.box > summary { cursor: pointer; padding: 15px 20px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 12px; }
details.box > summary:hover { background: #fafcff; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--muted); }
details.box[open] > summary::after { content: "–"; }
details.box > .form { padding: 0 20px 20px; }

.plan { list-style: none; margin: 0 0 20px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.plan li { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 15px; display: flex; gap: 10px; }
.plan li:last-child { border-bottom: 0; }
.plan .s { flex-shrink: 0; width: 110px; font-weight: 700; }
.plan .s--add { color: var(--blue); }
.plan .s--ok { color: var(--ok); }
.plan .s--warn { color: var(--warn); }

/* Панель редактора текстов стоит внизу — не перекрываем подвал */
body[data-can-edit] .foot { padding-bottom: 64px; }

/* Дочерние элементы сеток не должны распирать страницу на узких экранах */
.hero__grid > *, .about > *, .docs > *, .auth > *, .subject-body > *, .admin > *, .row2 > *, .row3 > * { min-width: 0; }

@media (max-width: 640px) {
  .section--mist { margin: 0; border-radius: var(--r-md); }
  .subject-head { padding: 22px 20px; border-radius: var(--r-md); gap: 14px; }
  .subject-head h1 { font-size: 28px; }
  .subject-head p { font-size: 16px; }
  .subject-head img { width: 64px; }
  .subject-body { padding-top: 24px; }
  .join { border-radius: var(--r-md); }
  .join .btn { width: 100%; }
  .form--card { border-radius: var(--r-md); padding: 20px 18px; }
  .page__head .btn { width: 100%; }
  .stats { padding: 20px; }
  .way { padding: 22px 20px; }
  .docs__list > li { border-radius: var(--r-md); }
  .devs ul { grid-template-columns: 1fr; }
  .foot { border-radius: var(--r-md) var(--r-md) 0 0; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile { padding: 16px; }
  .tile b { font-size: 30px; }
  .mod { padding: 18px; }
  .table th, .table td { padding: 10px 12px; }
  .filters { padding: 12px; }
  .filters .field, .filters .field--wide { flex-basis: 100%; }
  .filters .btn { width: 100%; }
}

/* Таблицы админки на телефоне — карточками */
@media (max-width: 760px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table--cards tr:last-child { border-bottom: 0; }
  .table--cards td { padding: 4px 0; border: 0; }
  .table--cards td[data-label]:not(:first-child)::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: 13px;
  }
  .table--cards td[data-label="Порядок"] { display: none; }
  .table--cards .cell-actions { padding-top: 10px; }
  .table--cards td.nowrap { white-space: normal; }
}
