.exam-topics {
  color: var(--blue, #0028f9);
  padding-bottom: 20px;
}

.exam-topics [hidden] {
  display: none !important;
}

.exam-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.exam-learning-note {
  margin: 0 0 26px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: #5d6986;
}

.exam-filters {
  display: grid;
  grid-template-columns: 1.25fr .8fr .75fr 1.5fr auto;
  align-items: end;
  gap: 13px;
  padding: 24px;
  border-radius: 22px;
  background: #f3f6ff;
}

.exam-topics[data-exam-mode="contests"] .exam-filters {
  grid-template-columns: 1.15fr .65fr 1.3fr 1.25fr auto;
}

.exam-filters label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
}

.exam-filters select,
.exam-filters input {
  width: 100%;
  min-width: 0;
  height: 45px;
  border: 1px solid #d4ddff;
  border-radius: 12px;
  background: #fff;
  color: var(--blue, #0028f9);
  padding: 0 13px;
  font-family: inherit;
  font-size: 12px;
}

.exam-filters select {
  padding-right: 25px;
  cursor: pointer;
}

.exam-filters input::placeholder {
  color: #8a94b0;
}

.exam-reset,
.exam-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  border: 1px solid #d4ddff;
  border-radius: 30px;
  padding: 10px 21px;
  background: #fff;
  color: var(--blue, #0028f9);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.exam-reset:hover,
.exam-more:hover {
  background: #e7edff;
}

.exam-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin: 31px 0 20px;
}

.exam-results-head p {
  font-size: 15px;
  font-weight: 700;
}

.exam-results-head > span {
  font-size: 11px;
  color: #74809e;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 42px 24px;
}

.exam-card {
  min-width: 0;
}

.exam-preview {
  display: block;
  width: 100%;
  padding: 15px 15px 13px;
  border: 1px solid #e3e9fa;
  border-radius: 18px;
  background: #f3f6ff;
  color: var(--blue, #0028f9);
  text-align: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.exam-sheet-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 210 / 297;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 3px 12px #1728530a;
}

.exam-preview-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  margin-top: 13px;
  font-size: 12px;
  font-weight: 600;
}

.exam-preview-action svg,
.exam-card-download svg,
.exam-dialog-actions svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.exam-preview:hover {
  background: #e9efff;
  border-color: #becdff;
}

.exam-card-copy {
  padding: 18px 2px 0;
}

.exam-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 9px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 600;
}

.exam-kind {
  padding: 4px 8px;
  border-radius: 20px;
  background: #eef2ff;
  font-size: 9px;
  line-height: 1.4;
}

.exam-kind-example {
  background: #fff0dc;
  color: #945600;
}

.exam-card h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  word-break: keep-all;
}

.exam-card-subject {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  color: #55627f;
}

.exam-card-question {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.75;
  color: #7b859d;
  word-break: keep-all;
}

.exam-card-actions{display:flex;align-items:center;flex-wrap:wrap;column-gap:15px}
.exam-card-original svg{width:14px;height:14px}
.exam-card-download,
.exam-card-original {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0 2px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
}

.exam-card-download small {
  margin-left: 9px;
  font-size: 9px;
  font-weight: 400;
  color: #7b859d;
}

.exam-card-download:hover,
.exam-card-original:hover,
.exam-dialog-source:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.exam-empty {
  padding: 65px 20px;
  border-radius: 20px;
  background: #f3f6ff;
  text-align: center;
}

.exam-empty h3 { font-size: 22px; line-height: 1.4; }
.exam-empty p { margin: 13px 0 22px; font-size: 12px; color: #74809e; }
.exam-more-wrap { text-align: center; margin: 35px 0 0; overflow-anchor: none; }
.exam-more { min-width: 210px; background: var(--blue, #0028f9); color: #fff; border-color: var(--blue, #0028f9); }
.exam-more:hover { background: #0021cf; }

body.exam-dialog-open { overflow: hidden; }
.exam-dialog { width: min(1000px, 94vw); height: min(1100px, 92dvh); max-width: 94vw; max-height: 92dvh; border: 0; border-radius: 20px; padding: 22px; overflow: hidden; color: var(--blue, #0028f9); background: #fff; }
.exam-dialog[open] { display: flex; flex-direction: column; gap: 15px; }
.exam-dialog::backdrop { background: #071a49d9; backdrop-filter: blur(8px); }
.exam-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; flex-shrink: 0; }
.exam-dialog-head > div { min-width: 0; }
.exam-dialog-meta { margin-bottom: 7px; font-size: 11px; line-height: 1.6; color: #65708d; }
.exam-dialog-head h2 { font-size: 23px; line-height: 1.45; word-break: keep-all; }
.exam-dialog-subject { margin-top: 6px; font-size: 11px; line-height: 1.7; color: #7b859d; }
.exam-dialog-close { padding: 8px 0 8px 15px; background: transparent; color: inherit; white-space: nowrap; font-size: 12px; cursor: pointer; }
.exam-dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; flex-shrink: 0; }
.exam-dialog-actions > a, .exam-dialog-actions > button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; font-family: inherit; font-size: 11px; font-weight: 600; }
.exam-dialog-zoom { border: 1px solid #d9e2fa; border-radius: 30px; padding: 8px 16px; background: #f2f5ff; color: inherit; cursor: pointer; }
.exam-dialog-download { padding: 8px 16px; border-radius: 30px; background: var(--blue, #0028f9); color: #fff; }
.exam-question { flex-shrink: 0; font-size: 11px; color: #65708d; }
.exam-question > summary { width: fit-content; cursor: pointer; padding: 3px 0; }
.exam-question > p { white-space: pre-line; max-height: 120px; overflow: auto; margin-top: 9px; padding: 10px 12px; border-radius: 8px; background: #f3f6ff; font-size: 11px; line-height: 1.85; }
.exam-dialog-view { position: relative; flex: 1; min-height: 0; border-radius: 12px; background: #f2f4fa; overflow: auto; overscroll-behavior: contain; }
.exam-dialog-view > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.exam-dialog-view.is-original > img { position: static; width: auto; height: auto; max-width: none; }
.exam-image-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px; font-size: 13px; text-align: center; line-height: 1.8; }
.exam-topics :is(button, a, select, input, summary, [tabindex]):focus-visible { outline: 3px solid #ffbd4c; outline-offset: 4px; }

@media (max-width: 1100px) {
  .exam-filters { grid-template-columns: 1.2fr 1fr 1fr; gap: 17px 13px; }
  .exam-search-label { grid-column: 1 / 3; }
  .exam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 37px 22px; }
  .exam-filters > .exam-reset { justify-self: end; min-width: 110px; }
  .exam-topics[data-exam-mode="contests"] .exam-filters { grid-template-columns: 1.2fr 1fr 1.2fr; }
  .exam-topics[data-exam-mode="contests"] .exam-search-label { grid-column: 1 / 3; }
}

@media (max-width: 700px) {
  .exam-learning-note { margin-bottom: 21px; font-size: 10px; }
  .exam-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px 15px; gap: 15px 12px; border-radius: 18px; }
  .exam-filters label { font-size: 11px; gap: 7px; }
  .exam-filters label:first-child { grid-column: 1 / -1; }
  .exam-search-label { grid-column: 1 / -1; }
  .exam-filters select, .exam-filters input { height: 44px; font-size: 12px; }
  .exam-filters > .exam-reset { grid-column: 1 / -1; justify-self: center; min-width: 110px; min-height: 36px; padding: 8px 22px; font-size: 11px; }
  .exam-topics[data-exam-mode="contests"] .exam-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .exam-topics[data-exam-mode="contests"] .exam-search-label { grid-column: 1 / -1; }
  .exam-results-head { margin: 26px 0 18px; }
  .exam-results-head p { font-size: 14px; }
  .exam-results-head > span { font-size: 10px; }
  .exam-grid { gap: 30px 16px; }
  .exam-preview { padding: 10px 10px 12px; border-radius: 13px; }
  .exam-preview-action { font-size: 11px; margin-top: 12px; gap: 14px; }
  .exam-card-copy { padding-top: 14px; }
  .exam-card-meta { gap: 6px 8px; font-size: 9px; }
  .exam-kind { font-size: 8px; padding: 4px 7px; }
  .exam-card h3 { font-size: 17px; }
  .exam-card-subject { font-size: 10px; margin-top: 6px; }
  .exam-card-question { font-size: 10px; margin-top: 6px; }
  .exam-card-download { font-size: 10px; gap: 6px; }
  .exam-card-download small { display: none; }
  .exam-more-wrap { margin-top: 29px; }
  .exam-more { font-size: 11px; min-width: 190px; }
  .exam-dialog { width: 96vw; max-width: 96vw; height: 94dvh; max-height: 94dvh; padding: 15px; border-radius: 15px; }
  .exam-dialog[open] { gap: 12px; }
  .exam-dialog-head { gap: 13px; }
  .exam-dialog-head h2 { font-size: 17px; line-height: 1.5; }
  .exam-dialog-meta { font-size: 10px; margin-bottom: 5px; }
  .exam-dialog-subject { font-size: 10px; margin-top: 5px; }
  .exam-dialog-close { font-size: 10px; padding-left: 5px; }
  .exam-dialog-actions { gap: 7px 12px; }
  .exam-dialog-actions > a, .exam-dialog-actions > button { font-size: 10px; min-height: 34px; }
  .exam-dialog-zoom, .exam-dialog-download { padding: 8px 12px; }
  .exam-question > p { max-height: 100px; font-size: 10px; }
}

@media (max-width: 480px) {
  .exam-grid { grid-template-columns: 1fr; gap: 32px; }
  .exam-preview { padding: 17px 17px 15px; }
  .exam-card-copy { padding-top: 16px; }
  .exam-card h3 { font-size: 20px; }
  .exam-card-meta { font-size: 10px; }
  .exam-kind { font-size: 9px; }
  .exam-card-subject { font-size: 12px; }
  .exam-card-question { font-size: 11px; }
  .exam-card-download { font-size: 11px; }
  .exam-card-download small { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .exam-preview { transition: none; }
}
