@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f2f3f5;
  --card: #ffffff;
  --ink: #16181d;
  --mute: #6f7480;
  --line: #e7e8ec;
  --bar: #23252b;
  --accent: #e3000f;
  --link: #2b4fd8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 6px 24px rgba(20, 22, 28, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 "Inter", "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 20px 20px 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* верхняя плашка */
.bar { background: var(--bar); color: #fff; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center; padding: 0 28px; height: 64px; }
.logo { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -.01em; display: flex; align-items: center; gap: 12px; }
.logo img { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: none; }
.bar nav a { font-weight: 600; font-size: 15px; text-decoration: none; margin-left: 28px; opacity: .85; }
.bar nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

/* ВК и Телеграм — круглые кнопки в шапке */
.bar nav { display: flex; align-items: center; }
.soc { display: flex; gap: 8px; margin-left: 24px; }
.bar nav .round { margin: 0; opacity: 1; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: rgba(255,255,255,.12); color: #fff;
  text-decoration: none; transition: background .15s ease, color .15s ease; }
.bar nav .round:hover { background: #fff; color: var(--bar); text-decoration: none; }

/* объявление при открытии сайта */
.notice { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(22, 24, 29, .45); animation: nfade .2s ease; }
.notice[hidden] { display: none; }
.notice-box { position: relative; width: 100%; max-width: 440px; background: var(--card); border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 30px 30px 26px; animation: nrise .25s ease; }
.notice-box h2 { margin: 0 32px 10px 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.notice-box p { margin: 0 0 10px; font-size: 16px; line-height: 1.55; color: #3a3d45; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.notice-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--bg); color: var(--ink); font: 400 22px/1 "Inter", Arial, sans-serif; }
.notice-x:hover { background: var(--line); }
/* обучение для новых посетителей */
.tour .notice-box { max-width: 460px; text-align: center; padding-top: 34px; }
.tour h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; }
.tour p { margin: 0 auto; max-width: 30em; color: #3a3d45; font-size: 15.5px; line-height: 1.55; }
.tour-logo { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: block; }
.tour-art { min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); border-radius: 16px; padding: 16px; margin-bottom: 18px; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.tour-btns { display: flex; gap: 8px; margin-left: auto; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: #d5d7de; }
.tour-dots i.on { background: var(--ink); width: 18px; border-radius: 999px; }
.tv-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.tv-tiles { display: flex; gap: 10px; }
.tv-tile { background: #fff; border-radius: 12px; padding: 10px 12px; text-align: left; box-shadow: var(--shadow); width: 150px; font-size: 12px; }
.tv-tile b { display: block; color: var(--accent); font-size: 12px; }
.tv-tile span { display: block; font-weight: 600; font-size: 13px; margin: 2px 0 8px; }
.tv-tile i { font-style: normal; color: var(--link); font-weight: 600; }
.tv-input { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 14px; min-width: 90px; text-align: left; font-size: 14px; }
.tv-pill { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.tv-pill.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.tv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.tv-ok { color: #11823b; font-weight: 600; font-size: 14px; }
.tv-btn { background: var(--accent); color: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px; }
.tv-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mute); }
.tv-check i { width: 14px; height: 14px; border-radius: 4px; background: var(--ink); display: inline-block; }
.tv-zoom { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.tv-draft { background: #fff; border-radius: 12px; padding: 8px 12px 12px; width: 100%; max-width: 300px; }
.tv-draft svg { width: 100%; height: 56px; display: block; }
footer a { color: inherit; text-underline-offset: 3px; }
/* ошибки и отзывы */
.report { margin-left: auto; font: inherit; font-size: 13px; color: var(--mute); background: none; border: 0; cursor: pointer;
  padding: 4px 2px; text-decoration: underline; text-decoration-color: #c9ccd3; text-underline-offset: 3px; }
.report:hover { color: var(--accent); text-decoration-color: currentColor; }
.fb-box { max-width: 520px; }
.fb-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; margin: 0 0 12px; }
.fb-copy { font: inherit; font-size: 13px; font-weight: 600; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.fb-frame { width: 100%; height: min(560px, 70vh); border: 0; border-radius: 12px; background: var(--bg); }
@media (max-width: 520px) { .tv-tiles .tv-tile:last-child { display: none; } .tour-foot { justify-content: center; } .tour-btns { margin: 0 auto; } }

@keyframes nfade { from { opacity: 0; } }
@keyframes nrise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .notice, .notice-box { animation: none; } }

/* главная */
.hero { margin-top: 24px; padding: 52px 56px; }
.hero h1 { margin: 0 0 12px; font-size: clamp(32px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -.035em; }
.hero p { margin: 0 0 28px; font-size: 19px; color: var(--mute); max-width: 40em; }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; }

.section { font-size: 24px; letter-spacing: -.02em; margin: 44px 4px 16px; }
.section span { font-size: 16px; font-weight: 400; color: var(--mute); margin-left: 10px; letter-spacing: 0; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.tile { position: relative; padding: 22px 24px 20px; min-height: 196px; display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,22,28,.05), 0 14px 34px rgba(20,22,28,.1); }
.tile .num { font-size: 15px; font-weight: 700; color: var(--accent); }
.tile .name { font-size: 19px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; margin-top: 6px; }
.tile .count { font-size: 14px; color: var(--mute); margin-top: 6px; flex: 1; }
.tile .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.tile .open { font-size: 15px; font-weight: 600; color: var(--link); text-decoration: none; }
.tile .open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tile:hover .open { text-decoration: underline; text-underline-offset: 3px; }
.pill { position: relative; z-index: 2; display: inline-block; font-weight: 600; font-size: 13px; color: var(--ink);
  text-decoration: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; background: #fff; }
.pill:hover { border-color: var(--ink); }

/* кнопки */
.btn { display: inline-block; background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 12px 24px; border-radius: 999px; border: 0; }
.btn:hover { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); background: #fff; }

.btn.red { background: var(--accent); }
.btn.red:hover { background: var(--ink); }
button.btn, button.pill { font: inherit; cursor: pointer; }
button.btn { font-weight: 600; font-size: 15px; }

/* новые номера, где заданий ещё нет */
.tile.soon { background: #fafafb; box-shadow: none; outline: 1.5px dashed #d5d7de; outline-offset: -1.5px; }
.tile.soon .name, .tile.soon .num { color: var(--mute); }
.tile.soon:hover { transform: none; }
.new { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent);
  border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }
.empty { margin-top: 18px; padding: 40px; }
.empty h2 { margin: 0 0 10px; font-size: 24px; letter-spacing: -.02em; }
.empty p { margin: 0 0 8px; color: var(--mute); max-width: 40em; }
.lead { margin: -6px 0 18px; color: var(--mute); }

/* ответ и решение */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.ans { width: 150px; font: inherit; font-size: 15px; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); }
.ans:focus { outline: none; border-color: var(--ink); }
.tools .pill { font-size: 14px; padding: 6px 14px; }
.verdict { font-size: 14px; font-weight: 600; min-height: 1em; }
.verdict.ok { color: #11823b; }
.verdict.bad { color: var(--accent); }
.verdict.wait, .wait { color: var(--mute); font-weight: 400; }
.sol { margin-top: 12px; padding: 14px 18px; background: #f6f7f9; border-radius: 12px; font-size: 16px; }
.sol p { margin: 0 0 8px; }
.sol p:last-child { margin: 0; }

/* страница задания */
.page-head { margin-top: 24px; padding: 32px 40px; }
.page-head h1 { margin: 16px 0 18px; font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1; letter-spacing: -.03em; }
.page-head h1 span { color: var(--accent); margin-right: .3em; }
.page-head .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head .count { color: var(--mute); font-size: 15px; margin-left: 6px; }

.doc { margin-top: 18px; padding: 8px 40px; }
.task { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.idx { font-weight: 700; font-size: 17px; color: var(--accent); text-decoration: none; padding-top: 1px; }
.body { min-width: 0; font-size: 18px; line-height: 1.65; }
.body p { margin: 0 0 8px; }
.body p:last-child { margin-bottom: 0; }
.body img { max-width: 100%; height: auto; vertical-align: middle; }
.body img.fig { display: block; margin: 14px 0 4px; cursor: zoom-in; }
.body svg { max-width: 100%; height: auto; }
.body math { font-size: 1.08em; math-style: normal; font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; }
.body table { border-collapse: collapse; margin: 6px 0; max-width: 100%; }
.body td, .body th { padding: 0 12px 0 0; vertical-align: top; border: 0; }
.body table.data td, .body table.data th { border: 1px solid var(--line); padding: 6px 12px; text-align: center; font-size: 16px; }

.pager { display: flex; justify-content: space-between; gap: 18px; margin-top: 18px; }
.pager a { flex: 0 1 48%; padding: 18px 24px; text-decoration: none; font-weight: 600; }
.pager a.right { text-align: right; margin-left: auto; }
.pager span { display: block; font-size: 13px; color: var(--mute); font-weight: 400; }

footer { text-align: center; font-size: 13px; color: var(--mute); padding: 40px 0 36px; }

/* формулы: без обводки — иначе при печати в PDF они выглядят жирными */
mjx-container svg, mjx-container svg * { stroke: none !important; }
mjx-container[display="true"] { margin: .4em 0 !important; }

/* черновик поверх задания */
.body { position: relative; }
.draw-layer { position: absolute; left: 0; top: 0; z-index: 3; display: none; touch-action: none; cursor: crosshair; }
.draw-layer.on { display: block; }
.draw-layer.erase { cursor: cell; }
.draw-pad { height: 220px; margin-top: 12px; border-radius: 12px;
  background-image: radial-gradient(circle, #d9dbe1 1px, transparent 1.2px); background-size: 22px 22px; }
.draw-pad[hidden] { display: none; }
.pill.draw-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.draw-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 3px; border-radius: 18px; background: #f2f3f5; }
.draw-tools[hidden] { display: none; }
.draw-tools button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; border-radius: 999px;
  padding: 4px 11px; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.draw-tools button:hover { background: #fff; }
.draw-tools button.sel { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.draw-tools .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.vans { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--mute); cursor: pointer; }
.print-head, .print-answers { display: none; }

/* увеличение рисунка */
.zoom { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: rgba(242, 243, 245, .97); cursor: zoom-out; padding: 24px; }
.zoom.on { display: flex; }
.zoom img { display: block; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }

@media (max-width: 980px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 12px 12px 0; }
  .bar { padding: 0 18px; height: 56px; }
  .logo { font-size: 16px; gap: 9px; }
  .logo img { width: 34px; height: 34px; }
  .bar nav a { margin-left: 14px; font-size: 14px; }
  .soc { margin-left: 14px; gap: 6px; }
  .bar nav .round { width: 32px; height: 32px; font-size: 11px; }
  .notice-box { padding: 24px 22px 20px; }
  .hero { padding: 32px 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 18px; min-height: 176px; }
  .tile .name { font-size: 16px; hyphens: auto; overflow-wrap: break-word; }
  .tile .foot { flex-direction: column; align-items: flex-start; }
  .page-head { padding: 24px; }
  .doc { padding: 4px 20px; }
  .task { grid-template-columns: 30px 1fr; gap: 10px; padding: 20px 0; }
  .body { font-size: 16px; }
}
@media (max-width: 520px) { .bar nav a.np { display: none; } }
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  .notice, .draw-layer, .draw-tools, .draw-pad, .vans, .report { display: none !important; }
  body { font-size: 12pt; }
  .wrap { max-width: none; padding: 0; }
  .print-head { display: block; font-size: 9pt; color: #6f7480; letter-spacing: .02em; margin: 0 0 4mm; }
  .page-head h1 { font-size: 20pt; margin: 0 0 2mm; }
  .task { grid-template-columns: 9mm 1fr; gap: 3mm; padding: 4mm 0; border-color: #ddd; }
  .idx { font-size: 12pt; color: #000; }
  .body { font-size: 11.5pt; line-height: 1.5; }
  .body img.fig { max-width: 100%; max-height: 62mm; width: auto !important; height: auto !important; }
  .body .layout td { vertical-align: top; }
  .print-answers:not([hidden]) { display: block; break-before: page; padding: 0; }
  .print-answers h2 { font-size: 16pt; margin: 0 0 4mm; }
  .print-answers table { border-collapse: collapse; }
  .print-answers td { border: 1px solid #bbb; padding: 2mm 5mm; font-size: 12pt; }
  .bar, .pager, footer, .page-head .row, .page-head .ghost, .tools, .sol, .lead { display: none !important; }
  .page-head { padding: 0 0 12px; } .doc { padding: 0; }
  .task { break-inside: avoid; }
  body { background: #fff; } .card { box-shadow: none; }
}
