:root {
  color-scheme: light;
  --ink: #18212a;
  --muted: #66717d;
  --line: #dce2e7;
  --paper: #ffffff;
  --canvas: #f4f6f7;
  --navy: #193649;
  --teal: #197c78;
  --teal-soft: #e4f3f1;
  --amber: #bd6b20;
  --amber-soft: #fff0df;
  --danger: #a33a3a;
  --shadow: 0 18px 46px rgb(23 43 55 / 9%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgb(25 124 120 / 7%), transparent 38rem),
    var(--canvas);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar,
.intro,
.progress-panel,
.workspace,
footer {
  width: min(1440px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 20px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(1.6rem, 2.8vw, 2.35rem);
  letter-spacing: -0.035em;
}

.eyebrow,
.muted {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.identity {
  min-width: 170px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 76%);
}

.identity span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.identity strong {
  color: var(--teal);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 28px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: var(--paper);
}

.intro h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.intro p,
footer p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

details {
  align-self: center;
}

summary {
  color: var(--teal);
  font-weight: 700;
  cursor: pointer;
}

.glossary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  margin-bottom: 0;
  font-size: 0.78rem;
}

.glossary div {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.glossary dt {
  font-weight: 750;
}

.glossary dd {
  margin: 2px 0 0;
  color: var(--muted);
}

.progress-panel {
  padding: 20px 28px;
  border: solid var(--line);
  border-width: 1px;
  background: #fbfcfc;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

#save-status {
  color: var(--muted);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7e7;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #48a79d);
  transition: width 180ms ease;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 720;
}

.button.primary {
  color: #fff;
  background: var(--teal);
}

.button.quiet {
  border-color: var(--line);
  color: var(--navy);
  background: var(--paper);
}

.button.danger-text {
  margin-right: auto;
  color: var(--danger);
  background: transparent;
}

.workspace {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  padding-top: 20px;
}

.pair-navigation,
.review-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.pair-navigation {
  position: sticky;
  top: 12px;
  padding: 16px;
}

.nav-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.nav-heading span,
.nav-heading strong {
  display: block;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 700;
}

.pair-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: calc(100vh - 145px);
  margin-top: 14px;
  overflow-y: auto;
}

.pair-list button {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.73rem;
  font-weight: 700;
}

.pair-list button.complete {
  border-color: #96cbc6;
  color: #14615e;
  background: var(--teal-soft);
}

.pair-list button.current {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.pair-list button i {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.pair-list button.complete i {
  background: var(--teal);
}

.review-card {
  padding: clamp(20px, 3vw, 34px);
}

.pair-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pair-heading h2 {
  margin-bottom: 0;
  color: var(--navy);
}

.status-badge {
  padding: 7px 11px;
  border-radius: 999px;
  color: #985113;
  background: var(--amber-soft);
  font-size: 0.76rem;
  font-weight: 750;
}

.status-badge.complete {
  color: #14615e;
  background: var(--teal-soft);
}

.comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  margin: 24px 0 30px;
}

.topic {
  min-height: 145px;
  padding: 19px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy);
  border-radius: 12px;
  background: #fbfcfd;
}

.topic-b {
  border-top-color: var(--teal);
}

.topic-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topic h3 {
  margin: 8px 0 12px;
  font-size: 1.06rem;
  line-height: 1.4;
}

.topic p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.comparison-mark {
  align-self: center;
  color: var(--teal);
  font-size: 1.4rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 25px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

legend {
  padding: 0 12px 0 0;
  color: var(--navy);
  font-weight: 800;
}

.field-help {
  margin: 6px 0 15px;
  color: var(--muted);
  font-size: 0.82rem;
}

.relation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.relation-grid label {
  display: flex;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.relation-grid label:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.relation-grid input {
  margin-top: 3px;
  accent-color: var(--teal);
}

.relation-grid strong,
.relation-grid small {
  display: block;
}

.relation-grid strong {
  font-size: 0.85rem;
}

.relation-grid small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.3;
}

.three-columns,
.score-grid {
  display: grid;
  gap: 12px;
}

.three-columns {
  grid-template-columns: repeat(3, 1fr);
}

.score-grid {
  grid-template-columns: repeat(4, 1fr);
}

label > span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.82rem;
  font-weight: 730;
}

label > small {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.35;
}

textarea,
input[type="number"] {
  width: 100%;
  border: 1px solid #cbd4da;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.45;
}

input[type="number"] {
  height: 44px;
  padding: 0 11px;
}

textarea:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgb(25 124 120 / 13%);
}

.form-navigation {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
}

.fatal {
  width: min(900px, calc(100% - 40px));
  margin: 30px auto;
  padding: 20px;
  border: 1px solid #e2b8b8;
  border-radius: 12px;
  color: var(--danger);
  background: #fff2f2;
}

footer {
  padding: 28px 0 36px;
  text-align: center;
  font-size: 0.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .pair-navigation {
    position: static;
  }

  .pair-list {
    grid-template-columns: repeat(15, minmax(32px, 1fr));
    max-height: 112px;
  }

  .relation-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .score-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .topbar,
  .intro,
  .progress-panel,
  .workspace,
  footer {
    width: min(100% - 22px, 1440px);
  }

  .topbar,
  .progress-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .identity {
    width: 100%;
  }

  .intro {
    grid-template-columns: 1fr;
  }

  .toolbar .button {
    flex: 1 1 150px;
  }

  .button.danger-text {
    margin-right: 0;
  }

  .comparison {
    grid-template-columns: 1fr;
  }

  .comparison-mark {
    justify-self: center;
    transform: rotate(90deg);
  }

  .relation-grid,
  .three-columns,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .pair-list {
    grid-template-columns: repeat(10, minmax(30px, 1fr));
  }
}
