.exam-page .layout {
  width: min(1000px, calc(100% - 35px));
  padding-block: clamp(15px, 3.8vh, 36px) 32px;
}

.exam-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: clamp(12px, 2.5vw, 22px);
}

.exam-panel {
  padding: clamp(12px, 2.5vw, 24px);
  border: 1px solid #cfdfd0;
  border-radius: clamp(22px, 3vw, 32px);
  color: #294941;
  background: #fff;
  box-shadow: 0 16px 47px #496a5420, 0 5px 0 #d3e7d7;
}

.exam-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 110px;
  margin-bottom: clamp(15px, 2.4vw, 24px);
  padding: 7px clamp(13px, 3vw, 27px);
  border: 1px solid #d3e5d4;
  border-radius: 17px;
  background:
    radial-gradient(ellipse at 12% 16%, #fff3d9 0 9%, transparent 51%),
    linear-gradient(140deg, #f5faee, #e8f5eb);
}

.exam-heading h1 {
  margin-bottom: 5px;
  color: #24443a;
  font-size: clamp(1.55rem, 5.2vw, 2.8rem);
  font-weight: 920;
  line-height: 1.2;
}

.exam-heading p {
  color: #3d6052;
  font-size: clamp(.83rem, 2.2vw, 1rem);
  font-weight: 620;
  line-height: 1.65;
}

.exam-heading img {
  width: clamp(73px, 17vw, 174px);
  height: auto;
  max-height: 104px;
  object-fit: contain;
}

#exam-form { display: grid; gap: clamp(13px, 2vw, 21px); }

.exam-settings {
  display: grid;
  grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr);
  align-items: start;
  gap: clamp(13px, 2vw, 21px);
}

.exam-section {
  min-width: 0;
  margin: 0;
  padding: clamp(8px, 1.7vw, 16px) clamp(10px, 2vw, 19px) 14px;
  border: 1px solid #dce7df;
  border-radius: 16px;
  background: #fcfdfb;
}

.exam-section legend {
  max-width: 100%;
  padding-inline: 6px;
  color: #294941;
  font-size: clamp(.99rem, 2.7vw, 1.22rem);
  font-weight: 880;
}

.exam-help {
  margin: 0 0 9px;
  color: #4a675c;
  font-size: .82rem;
  line-height: 1.58;
}

.exam-topic-tools,
.exam-level-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.exam-topic-tools { margin-bottom: 9px; }
.exam-secondary-button {
  min-height: 44px;
  padding: 5px 11px;
  border: 1px solid #d8caec;
  border-radius: 11px;
  color: #4d3880;
  background: #f4effc;
  font-weight: 810;
  font-size: .83rem;
  line-height: 1.3;
}

.exam-secondary-button:not(:disabled):hover { border-color: #bca6dd; background: #ede1fa; }
.exam-secondary-button[aria-pressed='true'] { border-color: #987fc7; background: #e9ddf9; }

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

.exam-topic-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  min-height: 52px;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid #dce7df;
  border-radius: 12px;
  background: #fff;
  color: #304e42;
  cursor: pointer;
}

.exam-topic-option:hover { border-color: #9bbdab; }
.exam-topic-option:has(.exam-topic-check:checked) { border-color: #96c5a8; background: #eaf6ec; }
.exam-topic-option:has(.exam-topic-check:focus-visible) { outline: 3px solid var(--outline); outline-offset: 2px; }

.exam-topic-check,
.exam-rule-check {
  appearance: auto;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #257654;
  cursor: inherit;
}

.exam-topic-icon {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #f3edf9;
  font-size: 1rem;
  line-height: 1;
}

.exam-topic-label {
  min-width: 0;
  align-self: center;
  font-weight: 780;
  font-size: .79rem;
  line-height: 1.36;
  overflow-wrap: anywhere;
}

.exam-topic-count {
  color: #4e6c5f;
  font-size: .69rem;
  font-weight: 790;
  white-space: nowrap;
}

.exam-total-label {
  display: block;
  margin: 0 0 6px;
  color: #315046;
  font-weight: 750;
  font-size: .86rem;
}

.exam-number {
  width: min(100%, 84px);
  min-height: 42px;
  padding: 4px 7px;
  border: 1px solid #bad3c5;
  border-radius: 10px;
  color: #264639;
  background: #fff;
  font: inherit;
  font-size: .95rem;
  font-weight: 810;
  text-align: center;
}

.exam-number:focus-visible { outline: 3px solid var(--outline); outline-offset: 2px; }
.exam-number[aria-invalid='true'] { border-color: #c86a80; background: #fff3f5; }
.exam-total-section .exam-help { margin: 8px 0 0; }

.exam-level-list { display: grid; gap: 5px; }

.exam-level-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 68px;
  align-items: center;
  gap: clamp(7px, 2vw, 13px);
  min-height: 46px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f0f6ef;
}

.exam-level-row:nth-child(even) { background: #f4f1fa; }
.exam-level-row label { font-size: .86rem; font-weight: 770; }
.exam-level-row .exam-number { width: 100%; min-height: 40px; }

.exam-level-availability {
  color: #516b60;
  font-size: .74rem;
  font-weight: 670;
  white-space: nowrap;
}

.exam-level-tools { justify-content: space-between; margin-top: 10px; }
.exam-level-tools p { font-size: .82rem; font-weight: 790; }

#exam-sum {
  display: inline-grid;
  width: 2.2em;
  min-height: 1.9em;
  margin-inline-start: 5px;
  place-items: center;
  border-radius: 7px;
  background: #e6f2e8;
  color: #2d604b;
}

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

.exam-rule-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 7px 10px;
  border: 1px solid #dce7df;
  border-radius: 11px;
  background: #fff;
  color: #304e42;
  font-size: .84rem;
  font-weight: 760;
  line-height: 1.45;
  cursor: pointer;
}

.exam-rule-option small {
  display: block;
  margin-top: 2px;
  color: #4a675c;
  font-size: .72rem;
  font-weight: 620;
}

.exam-rule-option:hover { border-color: #9bbdab; }
.exam-rule-option:has(.exam-rule-check:checked) { border-color: #96c5a8; background: #eaf6ec; }
.exam-rule-option:has(.exam-rule-check:focus-visible) { outline: 3px solid var(--outline); outline-offset: 2px; }
.exam-heart-option { grid-template-columns: minmax(0, 1fr) auto; }
.exam-heart-select { width: 4em; padding-inline: 4px; cursor: pointer; }

.exam-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e0eae3;
}

#exam-status {
  min-width: 0;
  padding-inline: 3px;
  color: #3b6155;
  font-size: .84rem;
  font-weight: 770;
  line-height: 1.5;
}

#exam-status:is([data-state='error'], .is-error, .exam-status--error) { color: #923b53; }
#exam-start { align-self: start; border: 1px solid #235644; }
#exam-start:disabled {
  border-color: #dce5de;
  color: #52665c;
  background: #eaf0ea;
  box-shadow: 0 3px 0 #dfe8e0;
}

@media (max-width: 710px) {
  .exam-topic-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (pointer: coarse) {
  .exam-number,
  .exam-level-row .exam-number {
    min-height: 44px;
    font-size: 1rem;
  }
}

@media (max-width: 565px) {
  .exam-page .layout { width: calc(100% - 22px); }
  .exam-settings,
  .exam-rule-options { grid-template-columns: 1fr; }
  .exam-heading { min-height: 78px; }
  .exam-topic-option {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
    min-height: 48px;
  }
  .exam-topic-icon { display: none; }
  .exam-topic-label { font-size: .75rem; }
  .exam-topic-count { font-size: .65rem; }
  #exam-start { width: max-content; min-width: 0; min-height: 44px; gap: 5px; padding-inline: 8px; }
  #exam-start span { width: 24px; }
  #exam-status { font-size: .77rem; }
}
