:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --text: #18212d;
  --muted: #5d6b7a;
  --line: #d9e0e7;
  --primary: #194b73;
  --primary-dark: #123856;
  --green: #2f7d5a;
  --green-soft: #e3f4eb;
  --red: #a33b35;
  --red-soft: #f8e8e7;
  --amber: #9a641f;
  --amber-soft: #fff2d9;
  --shadow: 0 18px 44px rgba(24, 33, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html {
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(900px, 100%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.brand {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}

.nav-links form {
  margin: 0;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 32px auto 48px;
}

footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.page-head > * {
  min-width: 0;
}

.page-head.compact {
  align-items: center;
}

.page-head h1,
.login-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-head.compact h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.page-head p,
.login-panel p,
.material-card p {
  color: var(--muted);
}

.eyebrow,
.source {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.source {
  color: var(--muted);
  text-transform: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.stats div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stats dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.stats dd {
  margin: 3px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stats-overview article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stats-overview span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stats-overview strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.stats-section {
  margin-top: 28px;
}

.stats-section h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.notice,
.result-panel,
.candidate,
.combined-test,
.empty-state {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.notice span {
  display: block;
  margin-top: 6px;
}

.combined-test {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.combined-test > * {
  min-width: 0;
}

.combined-test h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.combined-test p {
  margin: 0;
  color: var(--muted);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

.material-card,
.summary-section,
.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.material-card {
  display: flex;
  min-height: 268px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  min-width: 0;
}

.material-card h2,
.summary-section h2,
.question h2 {
  margin: 0 0 10px;
  font-size: 1.18rem;
  line-height: 1.3;
}

.card-actions,
.submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.button:hover {
  background: var(--primary-dark);
  color: #ffffff;
  text-decoration: none;
}

.button.secondary {
  background: #ffffff;
  color: var(--primary);
}

.button.secondary:hover {
  background: var(--surface-2);
  color: var(--primary-dark);
}

.summary-list {
  display: grid;
  gap: 14px;
}

.summary-section {
  padding: 22px;
}

.summary-section ul,
.question-list {
  margin: 0;
}

.summary-section li {
  margin: 8px 0;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 32px;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-stack,
.test-form,
.candidate {
  display: grid;
  gap: 14px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-results {
  display: grid;
  gap: 14px;
}

.search-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-card h2 {
  margin: 10px 0;
  font-size: 1.12rem;
  line-height: 1.35;
}

.search-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.search-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 800;
}

.search-meta strong {
  color: var(--text);
}

.suggested-answer {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green) !important;
}

.search-hit {
  padding: 0 0.12em;
  border-radius: 3px;
  background: #fff09a;
  color: inherit;
  box-shadow: inset 0 -1px 0 rgba(154, 100, 31, 0.28);
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

input:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(47, 125, 90, 0.28);
  outline-offset: 2px;
}

.validation {
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

.timer {
  min-width: 148px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.timer span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.timer strong {
  display: block;
  margin-top: 2px;
  font-size: 1.45rem;
}

.candidate {
  grid-template-columns: minmax(0, 1fr);
}

.candidate legend {
  grid-column: 1 / -1;
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 16px;
  padding-left: 24px;
}

.question {
  padding: 20px;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  grid-template-columns: 22px 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-weight: 400;
}

.option input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.option-letter {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 800;
}

.submit-row {
  justify-content: flex-end;
  margin-top: 20px;
}

.result-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.result-panel h2 {
  margin: 0;
  font-size: 2.6rem;
}

.status {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.question.correct {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(47, 125, 90, 0.18), var(--shadow);
}

.question.incorrect {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(163, 59, 53, 0.16), var(--shadow);
}

.question.missing {
  border-color: var(--red);
  background: #fffafa;
  box-shadow: 0 0 0 2px rgba(163, 59, 53, 0.16), var(--shadow);
}

.question.missing .option {
  border-color: rgba(163, 59, 53, 0.34);
}

.missing-message {
  margin: 0 0 12px;
  color: var(--red);
  font-weight: 800;
}

.answer-line {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
}

.answer-correct {
  background: var(--green-soft);
  color: var(--green);
}

.answer-wrong {
  background: var(--red-soft);
  color: var(--red);
}

.explanation {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-size: 0.86rem;
}

tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 760px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 18px;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 12px;
  }

  .page-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 16px;
  }

  .page-head h1,
  .login-panel h1 {
    font-size: 2rem;
  }

  .stats {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .stats div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
  }

  .stats dd {
    margin: 0;
  }

  .shell {
    width: min(100% - 24px, 1160px);
    margin-top: 18px;
  }

  .combined-test {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    padding: 16px;
  }

  .combined-test .button {
    width: 100%;
  }

  .material-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .material-card {
    min-height: 0;
    padding: 16px;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card-actions .button {
    width: 100%;
  }

  .question-list {
    padding-left: 20px;
  }

  .result-panel,
  .login-panel,
  .candidate,
  .search-form {
    grid-template-columns: 1fr;
  }

  .search-form .button {
    width: 100%;
  }

  .submit-row {
    justify-content: stretch;
  }

  .submit-row .button {
    width: 100%;
  }
}
