body { 
  font-family: system-ui, -apple-system, sans-serif; 
  padding: 30px; 
  background-color: #f4f6f8; 
  color: #333;
  margin: 0;
}

@font-face {
  font-family: 'Latin Modern Web';
  src: url('/fonts/latin-modern-roman.otf') format('opentype');
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: 'Latin Modern Web';
  src: url('/fonts/latin-modern-bold.otf') format('opentype');
  font-weight: 700;
  font-display: block;
}

html:has(body.tasks-page),
body.tasks-page {
  scrollbar-width: none;
}

html:has(body.tasks-page)::-webkit-scrollbar,
body.tasks-page::-webkit-scrollbar {
  display: none;
}

:root {
  --workspace-width: 1580px;
  --preview-column-width: 480px;
  --content-column-width: 950px;
  --workspace-gap: 20px;
  --color-brand: #2563eb;
  --color-brand-dark: #1e3a8a;
  --color-brand-soft: #eff6ff;
  --color-brand-border: #93c5fd;
  --color-text: #0f172a;
  --color-muted: #64748b;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -30px -30px 24px;
  background: #fff;
  border-bottom: 1px solid #dbe3ec;
  box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.site-nav {
  max-width: var(--workspace-width);
  margin: 0 auto;
  padding: 12px 30px;
}

.site-nav-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tasks-page .site-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--preview-column-width);
  gap: var(--workspace-gap);
  max-width: var(--workspace-width);
}

.tasks-page .site-nav-content {
  grid-column: 1;
  width: 100%;
  max-width: var(--content-column-width);
  justify-self: end;
}

.tasks-page .site-header {
  margin-bottom: 15px;
}

.site-logo {
  display: flex;
  width: auto;
  height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 2px solid #000080;
  border-radius: 7px;
  background: #ffffff;
  color: #000080;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.site-logo:hover,
.site-logo[aria-current='page'] {
  border-color: #2563eb;
  background: #93c5fd;
  color: #1e3a8a;
}

.logo-mark {
  display: block;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  overflow: hidden;
  border-radius: 5px;
  background: #fff;
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 6px;
  color: #000;
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  background: #dbeafe;
  color: #000;
}

.edit-mode-label {
  margin-left: 4px;
  color: #000;
  font-size: 20px;
  font-weight: 600;
}

.page-content {
  max-width: var(--workspace-width);
  margin: 0 auto;
}

.content-page .site-nav,
.content-page .page-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--preview-column-width);
  gap: var(--workspace-gap);
  max-width: var(--workspace-width);
}

.content-page .site-nav-content,
.content-page .page-content-inner {
  grid-column: 1;
  width: 100%;
  max-width: var(--content-column-width);
  justify-self: end;
}

.page-content h1 {
  margin: 0 0 8px;
}

.page-intro {
  margin: 0 0 24px;
  color: #475569;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.content-page .resource-list {
  width: calc(100% + var(--preview-column-width) + var(--workspace-gap) + 24px);
}

.download-materials {
  width: calc(100% + var(--preview-column-width) + var(--workspace-gap) + 24px);
  margin-bottom: 24px;
}

.download-materials > h2,
.online-resources-title {
  margin: 0 0 12px;
  font-size: 20px;
}

.download-material-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid #dbe3ec;
}

.download-material-item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 9px 4px;
  border-bottom: 1px solid #dbe3ec;
}

.download-material-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.download-material-info strong {
  color: #0f172a;
  font-size: 14px;
}

.download-material-info span {
  color: #64748b;
  font-size: 13px;
}

.download-material-link {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: #16a34a;
  color: #fff;
  transition: background 160ms ease, transform 160ms ease;
}

.download-material-link:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.download-material-link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resource-card,
.contacts-card {
  padding: 18px 20px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 5%);
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-height: 170px;
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.resource-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 14px rgb(37 99 235 / 16%);
}

.material-tag {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.resource-card h2 {
  margin: 0;
  font-size: 18px;
}

.resource-card p {
  margin: 8px 0 12px;
}

.resource-card a,
.contacts-card a {
  color: #1d4ed8;
  font-weight: 600;
}

.resource-card a {
  align-self: flex-start;
  margin-top: auto;
  padding: 7px 10px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
}

.resource-card a:hover {
  background: #1d4ed8;
}

@media (max-width: 650px) {
  .resource-list {
    grid-template-columns: 1fr;
  }

  .content-page .resource-list {
    width: 100%;
  }

  .download-materials {
    width: 100%;
  }
}

.contacts-card p {
  margin: 8px 0;
}

.contacts-note {
  color: #64748b;
  font-size: 15px;
}

.content-page .about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: calc(100% + var(--preview-column-width) + var(--workspace-gap) + 24px);
  gap: 14px;
}

.about-page .site-nav,
.about-page .page-content {
  grid-template-columns: minmax(0, 1fr) var(--preview-column-width);
  max-width: var(--workspace-width);
}

.about-page .site-nav-content,
.about-page .page-content-inner {
  grid-column: 1;
  max-width: var(--content-column-width);
  justify-self: end;
}

.about-page .about-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: calc(100% + var(--preview-column-width) + var(--workspace-gap) + 24px);
  gap: 9px;
}

.about-page .about-hero,
.about-page .about-section-title,
.about-page .about-note {
  box-sizing: border-box;
  width: calc(100% + var(--preview-column-width) + var(--workspace-gap) + 24px);
}

.about-page {
  padding-bottom: 4px;
}

.about-page .site-header {
  margin-bottom: 14px;
}

.about-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 10px;
  padding: 12px 22px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fbff 0%, #eaf3ff 100%);
}

.about-hero > div {
  max-width: 760px;
}

.about-eyebrow {
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-hero-title {
  margin: 4px 0 6px;
  color: #172554;
  font-size: clamp(21px, 2.2vw, 27px);
  font-weight: 750;
  line-height: 1.2;
}

.about-hero p:last-child {
  margin: 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.45;
}

.about-start-link,
.about-note > a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.about-start-link:hover,
.about-note > a:hover {
  background: #1d4ed8;
}

.about-section-title {
  margin: 0 0 8px;
  color: #334155;
  font-size: 16px;
  font-weight: 750;
}

.about-card {
  padding: 12px 17px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 6%);
}

.about-card-wide {
  grid-column: 1 / -1;
}

.about-card-label {
  display: inline-block;
  margin-bottom: 4px;
  padding: 3px 6px;
  border-radius: 999px;
  background: transparent;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.about-card h2 {
  margin: 0 0 6px;
  color: #1e3a8a;
  font-size: 17px;
}

.about-card ul,
.about-steps {
  margin: 0;
  padding-left: 19px;
  font-size: 14px;
  line-height: 1.35;
}

.about-card li + li {
  margin-top: 4px;
}

.about-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 20px;
}

.about-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 6px;
  padding: 10px 18px;
  border-left: 4px solid #60a5fa;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
}

.about-note p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 14px;
}

@media (max-width: 850px) {
  .content-page .about-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .about-page .about-hero,
  .about-page .about-section-title,
  .about-page .about-note {
    width: 100%;
  }

  .about-card-wide {
    grid-column: auto;
  }

  .about-steps {
    grid-template-columns: 1fr;
  }

  .about-hero,
  .about-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 851px) and (max-width: 1050px) {
  .about-page .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.task-search-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  width: 100%;
  margin: 0 0 8px;
}

.task-search-field {
  display: flex;
  flex: 1 1 420px;
  flex-direction: column;
  gap: 5px;
  max-width: 620px;
  min-width: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.task-search-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #0f172a;
  font: 14px/1.3 system-ui, -apple-system, sans-serif;
  box-shadow: 0 2px 6px rgb(30 64 175 / 8%);
}

.task-search-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
}

.task-search-field input::placeholder {
  color: #94a3b8;
}

.task-search-result {
  flex: 0 0 auto;
  min-width: 130px;
  padding-bottom: 9px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.task-search-submit,
.task-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  font: 700 14px/1 system-ui, -apple-system, sans-serif;
  white-space: nowrap;
}

.task-search-submit {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.task-search-submit:hover {
  background: #1d4ed8;
}

.task-search-clear {
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #1e3a8a;
  text-decoration: none;
}

.task-search-clear:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.task-search-empty {
  margin: 28px 0;
  padding: 18px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 600;
  text-align: center;
}

.task-search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 6px;
}

.task-search-page-list {
  display: flex;
  gap: 5px;
}

.task-search-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 34px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #fff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.task-search-page-wide {
  min-width: 88px;
}

.task-search-page:hover:not(.disabled),
.task-search-page.active {
  border-color: #2563eb;
  background: #dbeafe;
}

.task-search-page.disabled {
  color: #94a3b8;
  cursor: default;
  opacity: 0.65;
}

.global-search-results > .section-cards {
  display: grid;
  gap: 18px;
}

.global-search-result {
  display: grid;
  gap: 6px;
}

.task-search-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding-left: 4px;
  color: #475569;
  font-size: 13px;
}

.task-search-context strong {
  color: #1e3a8a;
}

.numbered-task-card.search-task-card {
  display: block;
}

.clear-selection {
  padding: 7px 11px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.clear-selection:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.class-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px;
  position: sticky;
  top: 64px;
  z-index: 9;
  max-width: 1000px;
  margin: 0 auto 16px;
  padding: 8px 0;
  background: #f4f6f8;
}

.tasks-page .class-filters {
  position: static;
  top: auto;
  max-width: none;
  margin: 0 0 8px;
}

.tasks-page .task-search-toolbar {
  position: sticky;
  top: 64px;
  z-index: 8;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 0 4px;
  background: #f4f6f8;
}

.tasks-page .task-search-toolbar::before,
.tasks-page .task-search-toolbar::after {
  position: absolute;
  right: -8px;
  left: -8px;
  background: #f4f6f8;
  content: '';
  pointer-events: none;
}

.tasks-page .task-search-toolbar::before {
  bottom: 100%;
  height: 12px;
}

.tasks-page .task-search-toolbar::after {
  top: 100%;
  height: 4px;
}

.tasks-page .tasks-panel {
  padding-top: 0;
}

.class-filter {
  padding: 2px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.class-filter:hover,
.class-filter.active {
  border-color: #2563eb;
  background: #dbeafe;
}

.tasks-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--preview-column-width);
  gap: var(--workspace-gap);
  max-width: var(--workspace-width);
  margin: 0 auto;
}

.tasks-panel {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  max-width: var(--content-column-width);
  min-width: 0;
  justify-self: end;
}

.tasks-workspace > .preview-column {
  grid-column: 2;
  grid-row: 1;
  position: fixed;
  top: 76px;
  right: max(18px, calc(50% - 814px));
  width: var(--preview-column-width);
  height: calc(100vh - 76px);
  transform: none;
}

.support-project {
  position: fixed;
  top: min(620px, calc(100vh - 330px));
  left: max(12px, calc(50% - 920px));
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  width: 220px;
  box-sizing: border-box;
  margin-top: 0;
  transform: none;
  padding: 16px 12px;
  border: 1px solid var(--color-brand-border);
  border-radius: 10px;
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
  box-shadow: 0 2px 7px rgb(30 64 175 / 10%);
  text-align: center;
}

.math-quotes {
  position: fixed;
  top: 88px;
  left: max(12px, calc(50% - 920px));
  z-index: 1;
  width: 205px;
  box-sizing: border-box;
  padding: 13px 14px 12px;
  border: 1px solid #bfd3ee;
  border-radius: 10px;
  background: linear-gradient(145deg, #f8fbff 0%, #eaf3ff 100%);
  box-shadow: 0 2px 7px rgb(30 64 175 / 9%);
  color: #1e3a5f;
}

.math-quotes-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #2457a6;
  font: 700 12px/1.2 system-ui, -apple-system, sans-serif;
}

.math-quotes-heading span {
  color: #6f91bf;
  font: 700 18px/1 Georgia, serif;
}

.math-quotes blockquote {
  margin: 10px 0 11px;
}

.math-quotes blockquote p {
  margin: 0;
  color: #334e72;
  font: italic 13px/1.42 Georgia, 'Times New Roman', serif;
}

.math-quotes blockquote footer {
  margin-top: 7px;
  color: #526b96;
  font: 600 11px/1.3 system-ui, -apple-system, sans-serif;
  text-align: right;
}

#next-math-quote {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #b8cceb;
  border-radius: 6px;
  background: #f7fbff;
  color: #315f9b;
  font: 700 11px/1.15 system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

#next-math-quote:hover,
#next-math-quote:focus-visible {
  border-color: #7ea8df;
  background: #e3efff;
}

.support-project strong {
  display: block;
  font-size: 11px;
  line-height: 1.2;
}

.support-project p {
  margin: 10px 0 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
}

.support-qr-placeholder {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  margin: 14px auto;
  border: 1px dashed #3b82f6;
  border-radius: 6px;
  background: #fff;
  color: #2563eb;
  font: 700 18px/1 system-ui, sans-serif;
}

.support-project-button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: var(--color-brand);
  color: #fff;
  font: 700 12px/1.2 system-ui, sans-serif;
}

.support-project-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (min-width: 851px) {
  .tasks-page .support-project {
    width: 205px;
    padding: 14px 10px;
  }

  .tasks-page .support-project p {
    margin-top: 8px;
  }

  .tasks-page .support-qr-placeholder {
    width: 108px;
    height: 108px;
    margin: 12px auto;
  }

  .tasks-page .support-project-button {
    min-height: 32px;
  }
}

.site-copyright {
  position: fixed;
  right: max(18px, calc(50% - 815px));
  bottom: 14px;
  z-index: 2;
  color: var(--color-muted);
  font: 600 14px/1.2 system-ui, sans-serif;
}

.preview-column {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 76px);
  min-height: 0;
  overflow: hidden;
  transform: translateX(24px);
}

.preview-title-field {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  color: #000;
  font-size: 13px;
  font-weight: 700;
}

.preview-title-field > span {
  font-size: 15px;
}

.preview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 5px;
  color: #000;
  font-size: 15px;
  font-weight: 700;
}

.preview-title-field input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.preview-title-field input:focus {
  border-color: #60a5fa;
  outline: none;
  box-shadow: none;
}

.document-settings {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 10px 0 0;
}

.document-settings-title {
  flex: 0 0 auto;
  margin: 10px 0 0;
  color: #1e3a8a;
  font-size: 15px;
}

.edit-document-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 21px;
  padding: 1px 7px;
  border: 1px solid #2563eb;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
  text-decoration: none;
}

.edit-document-link:hover {
  background: #dbeafe;
}

.edit-page {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(calc(440px + 0.7cm), 1.18fr);
  align-items: start;
  gap: 26px;
}

.edit-page > h1 {
  margin-top: 74px;
  font-size: 16px;
  white-space: nowrap;
}

.edit-page > .page-intro {
  margin-top: -14px;
}

.document-settings-page {
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: none;
  margin: 0;
  padding: 16px;
  border: 1px solid #93c5fd;
  border-radius: 12px;
  background: #eff6ff;
  box-shadow: 0 4px 14px rgb(30 64 175 / 10%);
}

@media (min-width: 851px) {
  .document-settings-page {
    position: sticky;
    top: 218px;
    z-index: 2;
    transform: translateY(-12px);
  }
}

.document-settings-page .document-setting {
  justify-content: space-between;
  font-size: 13px;
}

.document-settings-page .document-setting input {
  flex-basis: 68px;
  width: 68px;
  padding: 6px;
  font-size: 13px;
}

.document-settings-page .document-setting select {
  box-sizing: border-box;
  flex: 0 0 104px;
  width: 104px;
  padding: 6px;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.document-settings-page .reset-document-settings {
  min-height: 34px;
  font-size: 13px;
}

.edit-preview-actions.preview-actions {
  grid-column: 1;
  align-self: start;
  margin-top: -34px;
}

.edit-preview-column {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 4;
  width: 100%;
  margin-top: 0;
  transform: none;
  overflow: visible;
}

@media (min-width: 851px) {
  body.content-page:has(.edit-page) {
    padding-bottom: 0;
  }

  .edit-support-project {
    top: 76px;
    right: 10px;
    left: auto;
  }

  .edit-page > h1 {
    position: sticky;
    top: 163px;
    z-index: 4;
    align-self: start;
    width: 100%;
    background: #f4f6f8;
    box-shadow: 0 -12px 0 #f4f6f8, 0 8px 0 #f4f6f8;
  }

  .edit-preview-column {
    position: sticky;
    top: 89px;
    width: 100%;
    height: calc(100vh - 89px);
    margin-top: 0;
    transform: none;
  }

  .edit-preview-column .edit-title-field {
    position: sticky;
    top: 76px;
    z-index: 4;
    margin-top: -13px;
    background: #f4f6f8;
    box-shadow: 0 -12px 0 #f4f6f8;
  }

  .edit-preview-column .preview-heading {
    position: sticky;
    top: 149px;
    z-index: 3;
    background: #f4f6f8;
    box-shadow: 0 -10px 0 #f4f6f8, 0 4px 0 #f4f6f8;
  }

  .edit-preview-column .document-preview {
    width: 100%;
    flex-basis: calc(720px + 1cm);
  }

  .edit-preview-column .preview-order-controls {
    max-height: calc(100vh - 185px);
  }
}

.document-settings[hidden] {
  display: none !important;
}

.document-setting,
.reset-document-settings {
  min-width: 0;
  color: #475569;
  font: 600 11px/1.2 system-ui, -apple-system, sans-serif;
}

.document-setting {
  display: flex;
  align-items: center;
  gap: 5px;
}

.document-setting span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-setting input {
  box-sizing: border-box;
  flex: 0 0 50px;
  width: 50px;
  padding: 4px;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.reset-document-settings {
  padding: 4px 6px;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  background: #eff6ff;
  cursor: pointer;
}

.document-preview {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 0 1 720px;
  min-height: 0;
  height: auto;
  padding: 10px;
  overflow: hidden;
  border: 1px solid #000080;
  border-radius: 8px;
  background: #e2e8f0;
  box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.pdf-preview-shell {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #cbd5e1;
}

.pdf-preview-shell[hidden],
.pdf-preview-status[hidden] {
  display: none;
}

.pdf-preview-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 7px;
  border-bottom: 1px solid #94a3b8;
  background: #dbeafe;
  color: #0f172a;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.pdf-preview-toolbar button {
  display: grid;
  min-width: 30px;
  height: 28px;
  place-items: center;
  padding: 0 7px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
}

.pdf-preview-toolbar button:hover:not(:disabled) {
  border-color: #60a5fa;
  background: #eff6ff;
}

.pdf-preview-toolbar button:disabled {
  cursor: default;
  opacity: 0.45;
}

.pdf-page-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font: 13px/1 system-ui, sans-serif;
}

.pdf-page-field input {
  box-sizing: border-box;
  width: 42px;
  height: 28px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  text-align: center;
}

.pdf-toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: #cbd5e1;
}

.pdf-toolbar-spacer {
  flex: 1 1 auto;
}

.pdf-viewer-container {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  background: #cbd5e1;
  outline: none;
}

.pdf-viewer-container .pdfViewer {
  padding: 10px 0;
}

.pdf-viewer-container .pdfViewer .page {
  margin: 0 auto 10px;
  border: 0;
  box-shadow: 0 1px 5px rgb(15 23 42 / 25%);
}

.pdf-preview-status {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  margin: 0;
  max-width: calc(100% - 36px);
  padding: 7px 10px;
  border-radius: 6px;
  background: rgb(15 23 42 / 88%);
  color: #fff;
  font: 13px/1.3 system-ui, sans-serif;
  box-shadow: 0 2px 8px rgb(15 23 42 / 20%);
}

.tasks-page .pdf-preview-status {
  bottom: 62px;
}

.pdf-print-container {
  display: none;
}

.preview-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  gap: 16px;
}

.preview-content[hidden] {
  display: none;
}

.document-page {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  align-self: flex-start;
  width: 210mm;
  height: 297mm;
  padding: var(--document-margin-top, 11mm) var(--document-margin-right, 14mm) var(--document-margin-bottom, 11mm) var(--document-margin-left, 14mm);
  font-family: 'Latin Modern Web', 'Latin Modern Roman', serif;
  font-size: var(--document-font-size, 14pt);
  font-variant-numeric: lining-nums tabular-nums;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 18%);
  zoom: var(--preview-scale, 1);
}

.document-page.is-landscape {
  width: 297mm;
  height: 210mm;
  page: landscape;
}

.document-page-title {
  margin: 0 0 1em;
  color: #000;
  font-size: var(--document-font-size, 14pt);
  font-weight: 700;
  text-align: center;
  flex: 0 0 auto;
}

.document-page-body {
  display: grid;
  grid-template-columns: repeat(var(--document-columns, 1), minmax(0, 1fr));
  flex: 1 1 0;
  min-height: 0;
  gap: 10mm;
  overflow: hidden;
}

.preview-page-column {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.preview-task-entry {
  break-inside: avoid;
}

.preview-empty {
  margin: 0;
  color: #64748b;
  line-height: 1.5;
}

.preview-task {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  padding-bottom: 0.8em;
  font-size: var(--document-font-size, 14pt);
  line-height: 1.25;
  break-inside: avoid;
}

.preview-task-entry:has(.preview-grid-paper) .preview-task,
.preview-task-entry.has-grid-after .preview-task,
.preview-task-entry.has-answer-line .preview-task {
  padding-bottom: 0;
}

.preview-task-number {
  flex: 0 0 auto;
  padding-top: 0;
  color: #000;
  font-size: var(--document-font-size, 14pt);
  font-weight: 700;
}

.preview-order-controls {
  position: absolute;
  top: 84px;
  left: calc(100% + 10px);
  display: grid;
  gap: 6px;
  box-sizing: border-box;
  width: 170px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.preview-order-controls[hidden] {
  display: none;
}

.preview-order-row {
  display: grid;
  grid-template-columns: 40px 28px 30px 30px;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #7fb5f5;
  border-radius: 5px;
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px #dcecff;
  box-sizing: border-box;
  width: 150px;
}

.preview-order-label {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 2px;
  box-sizing: border-box;
  border: 1px solid #60a5fa;
  border-radius: 4px;
  background: #bfdbfe;
  box-shadow: 0 1px 3px rgb(37 99 235 / 22%), inset 0 0 0 1px rgb(255 255 255 / 45%);
  color: #1e3a8a;
  font: 800 14px/1 system-ui, sans-serif;
  text-align: center;
  align-self: center;
}

.preview-order-label.is-text-label {
  padding-inline: 1px;
  font-size: 12px;
  letter-spacing: -0.2px;
}

.preview-order-button {
  display: grid;
  width: 30px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 1px solid #93c5fd;
  border-radius: 3px;
  background: #eff6ff;
  color: #1e3a8a;
  font: 700 16px/1 system-ui, sans-serif;
  cursor: pointer;
}

.preview-order-button.move-up {
  grid-column: 3;
  grid-row: 1;
}

.preview-order-button.move-down {
  grid-column: 4;
  grid-row: 1;
}

.preview-order-button:hover:not(:disabled) {
  background: #dbeafe;
}

.preview-order-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.preview-remove-task {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  height: 24px;
  padding: 0 4px;
  border: 1px solid #fca5a5;
  border-radius: 3px;
  background: #fef2f2;
  color: #b91c1c;
  font: 700 18px/1 system-ui, sans-serif;
  cursor: pointer;
}

.preview-remove-task:hover {
  background: #fee2e2;
}

.preview-spacing-controls {
  grid-column: 3 / 5;
  display: grid;
  grid-template-columns: 26px 12px 22px;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.preview-spacing-button,
.preview-grid-button {
  width: 100%;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid #93c5fd;
  border-radius: 3px;
  background: #eff6ff;
  color: #1e3a8a;
  font: 700 15px/1 system-ui, sans-serif;
  cursor: pointer;
}

.preview-spacing-button:hover:not(:disabled),
.preview-grid-button:hover:not(:disabled) {
  background: #dbeafe;
}

.preview-spacing-button:disabled,
.preview-grid-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.preview-spacing-count {
  color: #047857;
  font: 700 11px/1 system-ui, sans-serif;
  text-align: center;
}

.preview-grid-controls {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: 28px 12px 24px;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.preview-grid-count {
  color: #1e3a8a;
  font: 700 11px/1 system-ui, sans-serif;
  text-align: center;
}

.preview-field-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.preview-solution-label-button,
.preview-answer-line-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  padding: 0 2px;
  box-sizing: border-box;
  border: 1px solid #93c5fd;
  border-radius: 3px;
  background: #eff6ff;
  color: #1e3a8a;
  font: 700 10px/1.05 system-ui, sans-serif;
  cursor: pointer;
}

.preview-solution-label-button:hover,
.preview-answer-line-button:hover {
  background: #dbeafe;
}

.preview-solution-label-button.is-active,
.preview-answer-line-button.is-active {
  border-color: #34d399;
  background: #dcfce7;
  color: #047857;
}

.preview-inline-solution-label {
  margin: 0.15em 0 0.2em;
  color: #000;
  font-size: var(--document-font-size, 14pt);
  line-height: 1.25;
}

.preview-inline-solution-label > strong {
  font-family: 'Times New Roman', Times, serif;
  font-weight: 700;
}

.preview-inline-answer {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.35em;
  margin: 0.15em 0 0.8em;
  color: #000;
  font-size: var(--document-font-size, 14pt);
  line-height: 1.25;
}

.preview-inline-answer > strong {
  font-family: 'Times New Roman', Times, serif;
  font-weight: 700;
}

.preview-inline-answer-rule {
  flex: 0 0 35mm;
  height: 0.8em;
  border-bottom: 1px solid #000;
}

.preview-blank-lines {
  flex: 0 0 auto;
}

.preview-grid-paper {
  box-sizing: border-box;
  width: var(--document-grid-width, 100%);
  margin-top: 3mm;
  margin-bottom: 0.8em;
  border: 1px solid #cbd5e1;
  background-image: linear-gradient(#dbeafe 1px, transparent 1px), linear-gradient(90deg, #dbeafe 1px, transparent 1px);
  background-size: 5mm 5mm;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.preview-task .task-content {
  min-width: 0;
}

.preview-task.is-unnumbered .task-content {
  flex: 1 1 100%;
  width: 100%;
}

.document-page:not(.is-two-columns) .preview-task:not(.has-diagram) .task-content {
  flex: 0 0 88%;
}

.preview-task .task-text {
  text-align: justify;
}

.preview-task .task-content:has(.task-diagram) {
  align-items: flex-start;
}

.preview-task.has-diagram .preview-task-number {
  flex-basis: 7%;
}

.preview-task.has-diagram .task-content {
  gap: 5%;
}

.preview-task.has-diagram .task-text {
  flex: 1 1 0;
}

.preview-task.has-diagram .task-diagram {
  flex-basis: var(--task-diagram-preview-width, 31%);
  width: var(--task-diagram-preview-width, 31%);
}

.print-document-title {
  display: none;
}

@media (max-width: 850px) {
  .tasks-page .class-filters {
    position: static;
  }

  .tasks-page .task-search-toolbar {
    position: sticky;
    top: 64px;
    z-index: 8;
    align-items: stretch;
    flex-direction: column;
    padding: 8px 0;
    background: #f4f6f8;
  }

  .task-search-field {
    flex-basis: auto;
    max-width: none;
  }

  .task-search-result {
    min-width: 0;
    padding-bottom: 0;
  }

  .task-search-pagination {
    flex-wrap: wrap;
  }

  .tasks-page .site-nav {
    display: block;
  }

  .tasks-page .site-nav-content {
    max-width: none;
  }

  .content-page .site-nav,
  .content-page .page-content {
    display: block;
  }

  .content-page .site-nav-content,
  .content-page .page-content-inner {
    max-width: none;
  }

  .content-page .resource-list {
    width: 100%;
  }

  .edit-page {
    grid-template-columns: 1fr;
  }

  .edit-page > h1,
  .edit-page > .page-intro {
    grid-column: auto;
  }

  .edit-preview-column {
    grid-column: auto;
    grid-row: auto;
  }

  .preview-order-controls {
    position: static;
    width: 100%;
    max-height: none;
    grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
    margin-top: 8px;
  }

  .preview-order-row {
    width: auto;
  }

  .tasks-workspace {
    grid-template-columns: 1fr;
  }

  .tasks-panel,
  .tasks-workspace > .preview-column,
  .support-project {
    grid-column: auto;
    grid-row: auto;
  }

  .tasks-page .tasks-panel {
    padding-top: 0;
  }


  .tasks-workspace > .preview-column {
    position: static;
    width: auto;
    height: auto;
    transform: none;
  }

  .support-project {
    position: static;
    width: 100%;
    max-width: 280px;
    margin-top: 0;
    transform: none;
    margin-bottom: 12px;
  }

  .preview-column {
    position: static;
    height: auto;
    overflow: visible;
  }

  .document-preview {
    flex-basis: 750px;
  }

  .task-content:has(.task-diagram) {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 1400px) {
  .tasks-page .site-nav {
    display: block;
  }

  .tasks-page .site-nav-content {
    box-sizing: border-box;
    max-width: none;
    padding-right: 48px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tasks-page .site-nav-content::-webkit-scrollbar {
    display: none;
  }

  .tasks-page .site-logo,
  .tasks-page .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (min-width: 851px) and (max-width: 1400px) {
  body.tasks-page {
    --preview-column-width: 400px;
    --workspace-gap: 16px;
  }

  .tasks-page .tasks-panel {
    max-width: none;
  }

  .tasks-workspace > .preview-column {
    right: 18px;
  }

  .tasks-page .task-search-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .tasks-page .task-search-field {
    max-width: none;
  }

  .tasks-page .task-search-result {
    flex: 1 1 100%;
    min-width: 0;
    padding-bottom: 0;
  }

  .tasks-page .task-search-result:empty {
    display: none;
  }
}

@media (min-width: 851px) and (max-width: 1100px) {
  body.tasks-page {
    --preview-column-width: 340px;
    --workspace-gap: 12px;
  }

  .tasks-page .preview-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .tasks-page .card > .task-content {
    flex-basis: 100%;
  }

  .tasks-page .task-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}

@media (max-width: 1100px) {
  .numbered-task-card.has-screen-number > .card {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .numbered-task-card.has-screen-number > .card > .task-actions {
    grid-column: 2;
    justify-content: flex-end;
    padding: 0 7px 7px 14px;
  }

  .numbered-task-card.has-screen-number > .card > .task-solution-panel {
    grid-column: 2;
  }

  .section-cards > .card.is-analog,
  .json-task-group-cards > .card.is-analog {
    width: calc(100% - 68px);
    margin-left: 68px;
  }
}

@media (max-width: 1760px) {
  .tasks-page .math-quotes {
    display: none;
  }

  .tasks-page .support-project {
    position: fixed;
    top: 50%;
    left: 0;
    z-index: 7;
    display: grid;
    width: 30px;
    padding: 10px 5px;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    transform: translateY(-50%);
  }

  .tasks-page .support-project strong {
    justify-self: center;
    font-size: 10px;
    line-height: 1;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }

  .tasks-page .support-project p,
  .tasks-page .support-qr-placeholder,
  .tasks-page .support-project-button {
    display: none;
  }
}

.edit-title-field {
  margin-top: -4px;
}

.edit-preview-column .edit-title-field,
.edit-preview-column .preview-heading {
  color: #000;
}

.selection-actions {
  display: flex;
  gap: 8px;
}

.selection-actions button,
.preview-actions button {
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.selection-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.preview-actions {
  display: flex;
  justify-content: normal;
  width: 100%;
  box-sizing: border-box;
  flex: 0 0 auto;
  gap: 4px;
  margin-top: 14px;
}

.preview-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 5px;
  min-width: 0;
  min-height: 32px;
  padding: 6px 7px;
  border: 1px solid rgb(15 23 42 / 14%);
  border-radius: 7px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 13%);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.preview-actions button .action-icon {
  margin-right: 0;
  vertical-align: 0;
}

.preview-actions .button-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2.1;
}

.preview-actions button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgb(15 23 42 / 17%);
}

.preview-actions button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgb(15 23 42 / 13%);
}

.preview-actions .preview-clear {
  background: #dc2626;
}

.preview-actions .preview-clear .action-icon {
  position: relative;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  margin-right: 0;
  font-size: 0;
  line-height: 0;
}

.preview-actions .preview-clear .action-icon::before,
.preview-actions .preview-clear .action-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.preview-actions .preview-clear .action-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.preview-actions .add-action-symbol {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 700;
  line-height: 0.7;
}

.preview-actions #add-answers {
  flex: 0.9 1 0;
  background: #d97706;
}

.preview-actions #add-answers.is-active {
  background: #92400e;
}

.preview-actions #add-solutions {
  flex: 0.95 1 0;
  background: #0284c7;
}

.preview-actions #add-solutions.is-active {
  background: #075985;
}

.preview-actions #add-solutions:hover:not(:disabled) {
  background: #0369a1;
}

.preview-actions #print-selected {
  flex: 0.9 1 0;
  background: #2563eb;
}

.preview-actions #save-pdf {
  flex: 1.3 1 0;
  background: #15803d;
}

.preview-actions .preview-clear:hover:not(:disabled) {
  background: #b91c1c;
}

.preview-actions #print-selected:hover:not(:disabled) {
  background: #1d4ed8;
}

.preview-actions #save-pdf:hover:not(:disabled) {
  background: #166534;
}

.document-answers,
.document-solutions {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #94a3b8;
}

.document-answers h4,
.document-answers ol,
.document-solutions h4 {
  margin: 0;
}

.document-answers ol {
  padding-left: 22px;
  list-style: none;
}

.document-answer-number {
  display: inline-block;
  min-width: 30px;
  margin-right: 0.25em;
  color: #1e3a8a;
  font-weight: 700;
}

.document-answer-solution {
  margin: 0.2em 0 0.7em calc(30px + 0.25em);
  white-space: pre-wrap;
}

.document-solutions p {
  margin: 0.7em 0 0;
  white-space: pre-wrap;
}

.document-solution-number {
  color: #1e3a8a;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
  vertical-align: -3px;
}

.button-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pdf-preview-toolbar .button-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.preview-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Контейнер, выстраивающий карточки вертикально */
.cards-container { 
  display: flex; 
  flex-direction: column; 
  gap: 10px;
  max-width: 1000px; 
  margin: 0 auto;
}

.tasks-page .cards-container {
  margin-top: 5mm;
}

@media (min-width: 851px) {
  .tasks-page .tasks-panel {
    position: relative;
    display: flex;
    height: calc(100vh - 84px);
    height: calc(100dvh - 84px);
    min-height: 0;
    flex-direction: column;
  }

  .tasks-page .cards-container {
    box-sizing: border-box;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    padding-right: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .tasks-page .cards-container::-webkit-scrollbar {
    display: none;
  }

  .tasks-page .cards-scrollbar {
    position: absolute;
    z-index: 6;
    display: block;
    width: 11px;
    min-height: 36px;
    border-radius: 999px;
    background: rgb(147 197 253 / 28%);
    cursor: pointer;
    touch-action: none;
  }

  .tasks-page .cards-scrollbar-thumb {
    position: absolute;
    top: 0;
    right: 1px;
    left: 1px;
    min-height: 32px;
    border-radius: 999px;
    background: #93c5fd;
    cursor: grab;
  }

  .tasks-page .cards-scrollbar:hover .cards-scrollbar-thumb,
  .tasks-page .cards-scrollbar-thumb:focus-visible {
    background: #60a5fa;
  }

  .tasks-page .cards-scrollbar-thumb:active {
    cursor: grabbing;
  }
}

.cards-scrollbar {
  display: none;
}

.cards-scrollbar[hidden] {
  display: none !important;
}

.cards-container.is-filtering {
  pointer-events: none;
  opacity: 0.58;
  transition: opacity 120ms ease;
}

.task-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-section h2,
.task-section h3 {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 2px solid #93c5fd;
  color: #1e3a8a;
  font-size: 21px;
}

.task-section h3 {
  font-size: 18px;
}

.task-section-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.task-section-toggle h2,
.task-section-toggle h3 {
  flex: 0 1 auto;
}

.task-section-toggle-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  color: #1e3a8a;
  transform: translateY(-3px);
}

.task-section-toggle-icon::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-top: 6px solid currentColor;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  transition: transform 140ms ease;
}

.task-section.is-collapsed > .task-section-toggle .task-section-toggle-icon::before {
  transform: rotate(-90deg);
}

.task-section.is-collapsed > .section-cards {
  display: none;
}

.class-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.class-section > h2 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
}

.ege-task-filters {
  display: flex;
  flex-basis: 100%;
  flex-wrap: nowrap;
  gap: 5px;
  padding-top: 5px;
  padding-bottom: 5px;
  border-top: 1px dashed #b9dced;
  border-bottom: 1px dashed #b9dced;
  overflow-x: auto;
}

.ege-task-filter {
  flex: 1 0 40px;
  padding: 7px 2px;
  border: 1px solid #7aa7c5;
  border-radius: 6px;
  background: #f3faff;
  color: #1e3a8a;
  box-shadow: inset 0 0 0 1px rgb(72 132 169 / 14%);
  cursor: pointer;
  font: 600 15px/1 system-ui, -apple-system, sans-serif;
  font-weight: 600;
}

.ege-task-filter:hover {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.ege-task-filter.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.ege-task-filter.empty {
  border-style: dashed;
  border-color: #94a3b8;
  background: #f8fafc;
  color: #64748b;
}

.ege-task-filter.empty:hover {
  border-color: #64748b;
  background: #e2e8f0;
}

.ege-task-filter.empty.active {
  border-color: #475569;
  background: #475569;
  color: #fff;
}

.grade-subject-filters {
  display: flex;
  flex-basis: 100%;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px dashed #b9dced;
  border-bottom: 1px dashed #b9dced;
}

.grade-subject-filters.numbered-task-filters {
  flex-wrap: nowrap;
  gap: 2px;
  overflow: visible;
}

.grade-subject-filters.compact-subject-filters {
  gap: 5px;
  padding: 4px 0;
  overflow-x: auto;
}

.compact-subject-filters .grade-subject-filter {
  padding: 5px 4px;
  font-size: 15px;
  white-space: nowrap;
}

.compact-subject-filters .grade-subject-filter:is(
  [data-grade-subject="algebra"],
  [data-grade-subject="geometry"],
  [data-grade-subject="probability"]
) {
  flex: 1 0 215px;
}

.compact-subject-filters .grade-subject-filter:is(
  [data-grade-subject="mental-math"],
  [data-grade-subject="olympiad"]
) {
  flex: 1 0 140px;
}

.numbered-task-filters .grade-subject-filter {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 1px;
  font-size: 12px;
  white-space: nowrap;
}

.grade-subject-filter {
  flex: 1 0 40px;
  padding: 7px 2px;
  border: 1px solid #7aa7c5;
  border-radius: 6px;
  background: #f3faff;
  color: #1e3a8a;
  box-shadow: inset 0 0 0 1px rgb(72 132 169 / 14%);
  cursor: pointer;
  font: 600 17px/1 system-ui, -apple-system, sans-serif;
}

.grade-subject-filter:hover {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.grade-subject-filter.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.grade-subject-filter.empty {
  border-style: dashed;
  border-color: #94a3b8;
  background: #f8fafc;
  color: #64748b;
}

.class-filter.empty,
.ege-task-filter.empty,
.grade-subject-filter.empty {
  border-style: dashed;
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.class-filter.empty:hover,
.ege-task-filter.empty:hover,
.grade-subject-filter.empty:hover,
.class-filter.empty.active,
.ege-task-filter.empty.active,
.grade-subject-filter.empty.active {
  border-color: #f87171;
  background: #fee2e2;
  color: #991b1b;
}

.exam-tag-filters {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  padding: 5px 0 0;
}

.exam-tag-filter {
  padding: 5px 10px;
  border: 1px solid #a7c7db;
  border-radius: 6px;
  background: #f7fbff;
  color: #31566f;
  font: 600 13px/1 system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

.exam-tag-filter:hover,
.exam-tag-filter.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.json-task-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.json-task-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.json-task-toggle-icon {
  display: inline-flex;
  align-items: center;
  align-self: center;
  color: #1e3a8a;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-5px);
  transition: transform 160ms ease;
}

.json-task-group.is-collapsed .json-task-group-cards {
  display: none;
}

.json-task-group.is-collapsed .json-task-toggle-icon {
  transform: translateY(-5px);
}

.json-task-heading {
  margin: 0;
  color: #1e3a8a;
  font-size: 16px;
}

.json-task-group-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vpr-part-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-section .vpr-part-heading {
  padding-bottom: 4px;
  border-bottom-color: #b8c7dd;
  color: #526b96;
  font-size: 17px;
  font-style: italic;
}

.task-section .json-task-heading {
  border-bottom-color: #bfdbfe;
  color: #2457a6;
}

/* Стили для рамки и отступов каждого прямоугольника */
.card { 
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 14px;
  row-gap: 7px;
  background-color: #ffffff; 
  border: 2px solid #333333; /* Рамка */
  border-radius: 8px;        /* Закругление углов */
  padding: 6px 14px 2mm;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); 
  white-space: pre-wrap;     /* Сохраняет переносы строк из файла */
  line-height: 1.5;
}

.task-source-tags,
.task-display-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.task-source-tags span,
.task-display-tags span,
.task-display-tags a {
  padding: 2px 6px;
  border: 1px solid #a7c7db;
  border-radius: 999px;
  background: #f7fbff;
  color: #31566f;
  font: 700 10px/1.2 system-ui, -apple-system, sans-serif;
  text-decoration: none;
}

.task-display-tags a:hover,
.task-display-tags a:focus-visible {
  border-color: #60a5fa;
  background: #eaf4ff;
  color: #1e40af;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-content:has(.task-diagram) {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.card > .task-content:has(.task-diagram) {
  gap: 12px;
}

.task-text {
  flex: 1;
}

.card .task-statement {
  display: block;
  overflow-wrap: break-word;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}

.card .task-statement mjx-container[display="true"] {
  text-align: center !important;
  text-align-last: center;
}

/* MathJax CHTML оставляет содержимое числителя и знаменателя у левого края
   растянутой области дроби. Центрируем сам математический узел, не меняя
   его display: это сохраняет правильную геометрию степеней и скобок. */
.task-statement mjx-num > :not(mjx-nstrut),
.task-statement mjx-den > :not(mjx-dstrut) {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.card .task-statement mjx-container[display="true"]:has(mjx-mtable) {
  text-align: left !important;
  text-align-last: left;
}

.card[data-task-file="vpr/5_klass/Задания 1-ой части (нужен только ответ)/10. Установление соответствия/010_1.json"]
  .task-statement mjx-container[display="true"]:has(mjx-mtable),
.card[data-task-file="vpr/5_klass/Задания 2-ой части (нужен развернутый ответ)/14. Текстовые задачи (анализ таблиц)/014_1.json"]
  .task-statement mjx-container[display="true"]:has(mjx-mtable) {
  text-align: center !important;
  text-align-last: center;
}

.card .task-display-tags {
  margin-top: 4px;
  margin-left: 0;
}

.numbered-task-card {
  display: block;
}

.numbered-task-card.has-screen-number > .card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.numbered-task-card > .card > .screen-task-number {
  display: flex;
  grid-column: 1;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 7px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.numbered-task-card.has-screen-number > .card > .task-content {
  grid-column: 2;
  min-width: 0;
  padding: 6px 14px 2mm;
}

.numbered-task-card.has-screen-number > .card > .task-actions {
  grid-column: 3;
  align-self: start;
  margin-right: 0;
  padding: 6px 7px 2mm 0;
}

.numbered-task-card.has-screen-number > .card > .task-solution-panel {
  grid-column: 2 / -1;
  width: auto;
  margin: 0 10px 8px 14px;
}

.section-cards > .card.is-analog,
.json-task-group-cards > .card.is-analog {
  box-sizing: border-box;
  width: calc(100% - 76px);
  margin-left: 76px;
}

.task-diagram {
  display: block;
  flex: 0 0 var(--task-diagram-card-width, 200px);
  width: var(--task-diagram-card-width, 200px);
  aspect-ratio: 8 / 5;
  height: auto;
  margin: 0;
  object-fit: contain;
}

.card .task-diagram.is-wide {
  aspect-ratio: auto;
}

.document-page.is-two-columns .preview-task .task-content:has(.task-diagram) {
  gap: 4%;
}

.document-page.is-two-columns .preview-task.has-diagram .preview-task-number {
  flex-basis: 8%;
}

.document-page.is-two-columns .preview-task.has-diagram .task-text {
  flex: 1 1 0;
}

.document-page.is-two-columns .preview-task .task-content:not(:has(.task-diagram)) {
  flex: 0 0 80%;
}

.document-page.is-two-columns .preview-task .task-diagram {
  flex-basis: var(--task-diagram-two-width, 38%);
  width: var(--task-diagram-two-width, 38%);
}

.document-page.is-two-columns:not(.is-landscape) .preview-task.has-diagram .task-content {
  flex-direction: column;
  align-items: stretch;
  gap: 1mm;
}

.document-page.is-two-columns:not(.is-landscape) .preview-task.has-diagram .task-text {
  flex-basis: auto;
  width: 100%;
}

.document-page.is-two-columns:not(.is-landscape) .preview-task.has-diagram .task-diagram {
  align-self: center;
  flex-basis: auto;
  width: var(--task-diagram-portrait-width, 62%);
}

.task-content.is-diagram-wrapped {
  display: block;
}

.task-content.is-diagram-wrapped::after {
  display: block;
  clear: both;
  content: '';
}

.task-content.is-diagram-wrapped .task-text {
  display: block;
}

.task-content.is-diagram-wrapped .task-diagram {
  float: right;
  flex: none;
  width: var(--task-diagram-card-width, 200px);
  margin: 0 0 8px 12px;
  aspect-ratio: auto;
}

.preview-task .task-content.is-diagram-wrapped .task-diagram {
  width: var(--task-diagram-preview-width, 31%);
  margin-left: 3mm;
}

.document-page.is-landscape .preview-task .task-content.is-diagram-wrapped .task-diagram {
  float: none;
  flex: 0 0 calc(55mm * var(--task-diagram-scale, 1));
  width: calc(55mm * var(--task-diagram-scale, 1));
  max-width: 31%;
  margin: 0;
}

.document-page.is-landscape .preview-task .task-content.is-diagram-wrapped {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 3mm;
}

.document-page.is-landscape .preview-task .task-content.is-diagram-wrapped .task-text {
  flex: 1 1 auto;
  min-width: 0;
}

.document-page.is-landscape.is-two-columns .preview-task .task-content.is-diagram-wrapped .task-diagram {
  flex-basis: calc(42mm * var(--task-diagram-scale, 1));
  width: calc(42mm * var(--task-diagram-scale, 1));
  max-width: 38%;
}

.document-page.is-landscape .preview-task .task-content.is-diagram-wrapped .task-diagram {
  align-self: center;
}

.document-page.is-two-columns .preview-task .task-content.is-diagram-wrapped .task-diagram {
  width: var(--task-diagram-two-width, 38%);
}

.document-page.is-two-columns:not(.is-landscape) .preview-task .task-content.is-diagram-wrapped {
  display: flex;
}

.document-page.is-two-columns:not(.is-landscape) .preview-task .task-content.is-diagram-wrapped .task-diagram {
  float: none;
  width: var(--task-diagram-portrait-width, 62%);
  margin: 0;
}

.task-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  margin-left: auto;
  margin-right: -7px;
  gap: 5px;
}

.task-solution-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #0284c7;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.task-solution-toggle:hover,
.task-solution-toggle.is-open {
  color: #0369a1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.task-solution-toggle:disabled {
  color: #94a3b8;
  cursor: default;
  opacity: 0.72;
  text-decoration: none;
}

.task-solution-toggle:disabled .task-solution-toggle-icon {
  opacity: 0.55;
}

.task-solution-control {
  display: flex;
  align-items: center;
  width: fit-content;
  margin-top: 3px;
}

.task-solution-toggle-icon {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 150ms ease;
}

.task-solution-toggle.is-open .task-solution-toggle-icon {
  transform: translateY(2px) rotate(225deg);
}

.task-solution-panel {
  box-sizing: border-box;
  flex: 0 0 100%;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #8b5cf6;
  border-radius: 6px;
  background: #faf9ff;
  color: #312e81;
  white-space: pre-wrap;
}

.task-solution-panel[hidden] {
  display: none;
}

.select-task {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  height: 26px;
  padding: 0 5px;
  border: 1px solid #60a5fa;
  border-radius: 6px;
  background: #dbeafe;
  color: #1e3a8a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}

.task-variant-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 11px;
  height: 11px;
  padding: 0 1px;
  border: 1px solid #1d4ed8;
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.select-task input {
  appearance: auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

.select-task:has(input:checked) {
  border-color: #2563eb;
  background: #bfdbfe;
}

.select-task:hover {
  border-color: #2563eb;
  background: #bfdbfe;
}

.card.is-selected {
  border-color: #2563eb;
  box-shadow: none;
}

.card.is-analog {
  border: 2px solid #22c55e;
  background: #fff;
  box-shadow: none;
}

.card.is-analog.is-selected {
  border-color: #2563eb;
}

.change-task {
  order: -1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  gap: 0;
  width: 32px;
  min-width: 32px;
  height: 26px;
  padding: 0;
  border: 1px solid #60a5fa;
  border-radius: 6px;
  background: #dbeafe;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(15 23 42 / 10%);
}

.change-task .change-task-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 18px;
  line-height: 1;
}

.change-task:hover:not(:disabled) {
  border-color: #2563eb;
  background: #bfdbfe;
}

.change-task:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.add-variant,
.add-all-variants {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  gap: 2px;
  min-width: 30px;
  height: 26px;
  padding: 0 4px;
  border: 1px solid #4ade80;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(22 163 74 / 15%);
}

.add-all-variants {
  min-width: 44px;
}

.add-variant-plus {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  transform: translateY(1px);
}

.add-variant-plus::before,
.add-variant-plus::after {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 1px;
  background: currentColor;
  content: '';
  transform: translate(-50%, -50%);
}

.add-variant-plus::before {
  width: 9px;
  height: 2px;
}

.add-variant-plus::after {
  width: 2px;
  height: 9px;
}

.add-variant-count,
.add-all-variants-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.add-variant-count {
  width: 7px;
}

.add-variant:hover:not(:disabled),
.add-all-variants:hover:not(:disabled) {
  border-color: #22c55e;
  background: #bbf7d0;
}

.add-all-variants.is-hide-mode {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 1px 2px rgb(185 28 28 / 12%);
}

.add-all-variants.is-hide-mode .add-variant-plus::after {
  display: none;
}

.add-all-variants.is-hide-mode:hover:not(:disabled) {
  border-color: #ef4444;
  background: #fee2e2;
}

.add-variant:disabled,
.add-all-variants:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.task-selector:disabled {
  cursor: not-allowed;
}

.remove-variant {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.remove-variant:hover {
  border-color: #ef4444;
  background: #fee2e2;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  @page landscape {
    size: A4 landscape;
    margin: 0;
  }

  .site-header,
  .printing-preview .math-quotes,
  .printing-preview .support-project,
  .printing-preview .site-copyright,
  .printing-preview .edit-page > h1,
  .printing-preview .tasks-panel,
  .printing-preview .preview-title-field,
  .printing-preview .preview-heading,
  .printing-preview .document-settings-title,
  .printing-preview .document-settings,
  .printing-preview .preview-actions {
    display: none;
  }

  body {
    padding: 0;
    background: #fff;
  }

  .printing-preview .tasks-workspace,
  .printing-preview .preview-column,
  .printing-preview .document-preview {
    display: block;
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .printing-preview .preview-column {
    transform: none;
  }

  .printing-preview .document-page {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    aspect-ratio: auto;
    padding: var(--document-margin-top, 11mm) var(--document-margin-right, 14mm) var(--document-margin-bottom, 11mm) var(--document-margin-left, 14mm);
    overflow: hidden;
    box-shadow: none;
    zoom: 1;
    break-after: page;
  }

  .printing-preview .document-page.is-landscape {
    width: 297mm;
    height: 210mm;
    min-height: 210mm;
  }

  .printing-preview .document-page:last-child {
    break-after: auto;
  }

  .printing-preview .document-page-title {
    margin-bottom: 20px;
  }

  .printing-preview .preview-task {
    break-inside: avoid;
  }

  .printing-preview .task-content:has(.task-diagram) {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  }

  body.printing-pdf > *:not(.pdf-print-container) {
    display: none !important;
  }

  body.printing-pdf .pdf-print-container {
    display: block;
  }

  .pdf-print-page {
    display: block;
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #fff;
    break-after: page;
    page-break-after: always;
  }

  .pdf-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .pdf-print-page canvas {
    display: block;
    width: 100%;
    height: 100%;
  }
}

@media screen {
  .theme-toggle {
    position: fixed;
    top: 14px;
    z-index: 12;
    display: inline-grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    margin-left: 0;
    padding: 0;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
  }

  .theme-toggle:hover {
    border-color: #60a5fa;
    background: #dbeafe;
    transform: translateY(-1px);
  }

  .theme-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .theme-icon-sun {
    display: none;
  }


















































  html[data-theme='dark'] {
    --color-brand-soft: #283b58;
    --color-brand-dark: #d6e2f2;
    --color-brand-border: #668bc2;
    --color-text: #d9e1ea;
    --color-muted: #a5afbd;
  }

  html[data-theme='dark'] body {
    background: #182230;
    color: #d9e1ea;
  }

  html[data-theme='dark'] .site-header {
    border-color: #3d4d61;
    background: #202c3b;
    box-shadow: 0 2px 10px rgb(8 15 25 / 20%);
  }

  html[data-theme='dark'] .nav-link,
  html[data-theme='dark'] .edit-mode-label,
  html[data-theme='dark'] .preview-title-field,
  html[data-theme='dark'] .preview-heading,
  html[data-theme='dark'] .edit-preview-column .edit-title-field,
  html[data-theme='dark'] .edit-preview-column .preview-heading,
  html[data-theme='dark'] .class-section > h2 {
    color: #dce3ec;
  }

  html[data-theme='dark'] .nav-link:hover,
  html[data-theme='dark'] .nav-link.active {
    background: #2b405e;
    color: #eef2f7;
  }

  html[data-theme='dark'] .theme-toggle {
    border-color: #526176;
    background: #2a3748;
    color: #e8be66;
  }

  html[data-theme='dark'] .theme-toggle:hover {
    border-color: #6d7c90;
    background: #35455a;
  }

  html[data-theme='dark'] .theme-icon-moon {
    display: none;
  }

  html[data-theme='dark'] .theme-icon-sun {
    display: block;
  }

  html[data-theme='dark'] .page-intro,
  html[data-theme='dark'] .contacts-note,
  html[data-theme='dark'] .download-material-info span,
  html[data-theme='dark'] .task-search-field,
  html[data-theme='dark'] .task-search-result,
  html[data-theme='dark'] .task-search-context,
  html[data-theme='dark'] .support-project p,
  html[data-theme='dark'] .preview-empty {
    color: #a5afbd;
  }

  html[data-theme='dark'] .download-material-info strong {
    color: #e7ebf0;
  }

  html[data-theme='dark'] .document-setting,
  html[data-theme='dark'] .reset-document-settings {
    color: #cbd3de;
  }

  html[data-theme='dark'] .contacts-card a {
    color: #82abe8;
  }

  html[data-theme='dark'] .download-material-list,
  html[data-theme='dark'] .download-material-item {
    border-color: #405065;
  }

  html[data-theme='dark'] .resource-card,
  html[data-theme='dark'] .contacts-card,
  html[data-theme='dark'] .about-card,
  html[data-theme='dark'] .card,
  html[data-theme='dark'] .document-settings-page,
  html[data-theme='dark'] .preview-order-row {
    border-color: #58708d;
    background: #222e3e;
    color: #d9e1ea;
    box-shadow: inset 0 0 0 1px #2d4055, 0 2px 8px rgb(8 15 25 / 18%);
  }

  html[data-theme='dark'] .resource-card:hover {
    box-shadow: 0 6px 16px rgb(8 15 25 / 24%);
  }

  html[data-theme='dark'] .card.is-selected {
    border-color: #79a0d6;
    box-shadow: none;
  }

  html[data-theme='dark'] .numbered-task-card > .card > .screen-task-number {
    background: #2b405e;
    color: #b9d4ff;
  }

  html[data-theme='dark'] .task-diagram {
    box-sizing: border-box;
    padding: 5px;
    border: 1px solid #607086;
    border-radius: 7px;
    background: #f8fafc;
  }

  html[data-theme='dark'] .material-tag,
  html[data-theme='dark'] .about-card-label,
  html[data-theme='dark'] .task-source-tags span,
  html[data-theme='dark'] .task-display-tags span,
  html[data-theme='dark'] .task-display-tags a {
    border-color: #496889;
    background: #283b58;
    color: #c8daf1;
  }

  html[data-theme='dark'] .task-display-tags a:hover,
  html[data-theme='dark'] .task-display-tags a:focus-visible {
    border-color: #77a7e8;
    background: #324b6d;
    color: #e0ebff;
  }

  html[data-theme='dark'] .about-card h2,
  html[data-theme='dark'] .task-section h2,
  html[data-theme='dark'] .task-section h3,
  html[data-theme='dark'] .task-search-context strong,
  html[data-theme='dark'] .document-settings-title,
  html[data-theme='dark'] .document-answer-number,
  html[data-theme='dark'] .document-solution-number,
  html[data-theme='dark'] .json-task-toggle-icon {
    color: #9dbde8;
  }

  html[data-theme='dark'] .about-hero {
    border-color: #58708d;
    background: linear-gradient(135deg, #202c3c 0%, #26374c 100%);
  }

  html[data-theme='dark'] .about-hero-title {
    color: #e6edf6;
  }

  html[data-theme='dark'] .about-hero p:last-child,
  html[data-theme='dark'] .about-note p,
  html[data-theme='dark'] .about-section-title {
    color: #aebdce;
  }

  html[data-theme='dark'] .about-note {
    background: #202c3c;
  }

  html[data-theme='dark'] .task-section .vpr-part-heading {
    border-bottom-color: #586b86;
    color: #afbed5;
  }

  html[data-theme='dark'] .task-section .json-task-heading {
    border-bottom-color: #496789;
    color: #82ace3;
  }

  html[data-theme='dark'] .task-search-field input,
  html[data-theme='dark'] .preview-title-field input,
  html[data-theme='dark'] .document-setting input,
  html[data-theme='dark'] .document-setting select,
  html[data-theme='dark'] .pdf-page-field input {
    border-color: #526176;
    background: #1f2b3a;
    color: #e7ebf0;
  }

  html[data-theme='dark'] .task-search-clear,
  html[data-theme='dark'] .task-search-page,
  html[data-theme='dark'] .clear-selection,
  html[data-theme='dark'] .class-filter,
  html[data-theme='dark'] .ege-task-filter,
  html[data-theme='dark'] .grade-subject-filter,
  html[data-theme='dark'] .exam-tag-filter,
  html[data-theme='dark'] .edit-document-link,
  html[data-theme='dark'] .reset-document-settings,
  html[data-theme='dark'] .preview-order-button,
  html[data-theme='dark'] .preview-spacing-button,
  html[data-theme='dark'] .preview-grid-button,
  html[data-theme='dark'] .preview-solution-label-button,
  html[data-theme='dark'] .preview-answer-line-button,
  html[data-theme='dark'] .select-task {
    border-color: #506b8f;
    background: #283b58;
    color: #c8daf1;
  }

  html[data-theme='dark'] .preview-solution-label-button.is-active,
  html[data-theme='dark'] .preview-answer-line-button.is-active {
    border-color: #3c8d6d;
    background: #24463c;
    color: #b8e4d2;
  }

  html[data-theme='dark'] .task-search-clear:hover,
  html[data-theme='dark'] .task-search-page:hover:not(.disabled),
  html[data-theme='dark'] .class-filter:hover,
  html[data-theme='dark'] .class-filter.active,
  html[data-theme='dark'] .ege-task-filter:hover,
  html[data-theme='dark'] .ege-task-filter.active,
  html[data-theme='dark'] .grade-subject-filter:hover,
  html[data-theme='dark'] .grade-subject-filter.active,
  html[data-theme='dark'] .exam-tag-filter:hover,
  html[data-theme='dark'] .exam-tag-filter.active,
  html[data-theme='dark'] .select-task:hover,
  html[data-theme='dark'] .select-task:has(input:checked) {
    border-color: #79a0d6;
    background: #324b6d;
    color: #d9e7f7;
  }

  html[data-theme='dark'] .class-filter.empty,
  html[data-theme='dark'] .ege-task-filter.empty,
  html[data-theme='dark'] .grade-subject-filter.empty {
    border-color: #7f1d1d;
    background: #45252c;
    color: #fca5a5;
  }

  html[data-theme='dark'] .task-search-empty,
  html[data-theme='dark'] .support-project {
    border-color: #506b8f;
    background: #25354c;
    color: #c8daf1;
  }

  html[data-theme='dark'] .math-quotes {
    border-color: #4c6382;
    background: linear-gradient(145deg, #25354a 0%, #203047 100%);
    color: #d5e2f2;
  }

  html[data-theme='dark'] .math-quotes-heading {
    color: #9dbde8;
  }

  html[data-theme='dark'] .math-quotes-heading span,
  html[data-theme='dark'] .math-quotes blockquote footer {
    color: #91a8c7;
  }

  html[data-theme='dark'] .math-quotes blockquote p {
    color: #d2deed;
  }

  html[data-theme='dark'] #next-math-quote {
    border-color: #526d91;
    background: #2b3e58;
    color: #b9d1ef;
  }

  html[data-theme='dark'] .support-qr-placeholder {
    background: #1f2b3a;
  }

  html[data-theme='dark'] .class-filters,
  html[data-theme='dark'] .tasks-page .task-search-toolbar,
  html[data-theme='dark'] .tasks-page .task-search-toolbar::before,
  html[data-theme='dark'] .tasks-page .task-search-toolbar::after,
  html[data-theme='dark'] .edit-page > h1,
  html[data-theme='dark'] .edit-preview-column .edit-title-field,
  html[data-theme='dark'] .edit-preview-column .preview-heading,
  html[data-theme='dark'] .document-settings-page {
    background-color: #182230;
  }

  html[data-theme='dark'] .edit-page > h1,
  html[data-theme='dark'] .edit-preview-column .edit-title-field,
  html[data-theme='dark'] .edit-preview-column .preview-heading {
    box-shadow: 0 -12px 0 #182230, 0 4px 0 #182230;
  }

  html[data-theme='dark'] .document-preview {
    border-color: #668bc2;
    background: #2b394b;
  }

  html[data-theme='dark'] .pdf-preview-shell,
  html[data-theme='dark'] .pdf-viewer-container {
    background: #354356;
  }

  html[data-theme='dark'] .pdf-preview-toolbar {
    border-color: #526176;
    background: #29394d;
    color: #d9e1ea;
  }

  html[data-theme='dark'] .pdf-preview-toolbar button {
    border-color: #526176;
    background: #222f40;
    color: #d9e1ea;
  }

  html[data-theme='dark'] .pdf-preview-toolbar button:hover:not(:disabled) {
    border-color: #79a0d6;
    background: #324b6d;
  }

  html[data-theme='dark'] .task-solution-panel {
    border-color: #6d5cae;
    border-left-color: #a78bfa;
    background: #302a42;
    color: #ddd7ef;
  }

  html[data-theme='dark'] .card.is-analog {
    border-color: #22c55e;
    background: #222e3e;
    box-shadow: none;
  }

  html[data-theme='dark'] .card.is-analog.is-selected {
    border-color: #79a0d6;
  }

  html[data-theme='dark'] .task-variant-count {
    border-color: #79a0d6;
    background: #1f2b3a;
    color: #9dbde8;
  }

  html[data-theme='dark'] .document-page,
  html[data-theme='dark'] .document-page * {
    color-scheme: light;
  }

  @media (max-width: 850px) {
    .theme-toggle {
      right: 12px;
      box-shadow: 0 2px 8px rgb(15 23 42 / 18%);
    }
  }
}
