:root {
  --ink: #17211b;
  --muted: #68716b;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --green: #1f6b4b;
  --green-dark: #18563c;
  --orange: #d96f3d;
  --focus: #f2a65a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 1120px;
  margin: auto;
  padding: 32px 36px 60px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-block;
  width: min(250px, 55vw);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.languages {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
}

.languages a {
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.languages a.active {
  background: #e3ede4;
  color: var(--green);
}

.languages a:hover {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.hero {
  padding: 0 0 48px;
}

.eyebrow {
  margin-top: 66px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 15px 0 25px;
  font-size: clamp(52px, 8vw, 96px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.05em;
}

h1 em {
  color: var(--green);
  font-weight: 400;
}

.lead {
  max-width: 670px;
  color: #4c5650;
  font-size: 20px;
  line-height: 1.5;
}

.tool-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #ccd1cc;
  border-radius: 12px;
  background: #e8e6df;
}

.mode-button,
.utility-button,
.primary-button {
  min-height: 42px;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}

.mode-button {
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.mode-button[aria-pressed="true"] {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 12px #17211b12;
}

.utility-actions,
.answer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.utility-button {
  padding: 9px 13px;
  border: 1px solid #b9c0ba;
  background: transparent;
  color: var(--ink);
}

.utility-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.share-wrap {
  position: relative;
}

.share-status {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 240px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
}

.training-brief {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid #b9d0c0;
  border-radius: 14px;
  background: #e3ede4;
}

.training-brief p {
  margin: 5px 0 0;
  color: #3f5146;
  line-height: 1.45;
}

.score {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--green);
  white-space: nowrap;
}

.score span {
  display: grid;
  gap: 2px;
  text-align: center;
}

.score strong {
  font-size: 22px;
}

.score small {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
}

.card {
  padding: 30px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 20px 60px #202a2415;
}

.card.ref {
  background: #e3ede4;
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.num {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.head h2,
.answer h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 400;
}

.status {
  padding: 8px 10px;
  border-radius: 99px;
  background: #f5e3da;
  color: #913c1c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.ok,
.refstatus {
  background: var(--green);
  color: #fff;
}

.card > p {
  min-height: 40px;
  color: var(--muted);
  line-height: 1.4;
}

.fields {
  display: grid;
  gap: 13px;
  margin-top: 23px;
}

.field {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 4px 12px;
  padding-top: 13px;
  border-top: 1px solid #17211b20;
}

.field b {
  font-size: 14px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field select {
  grid-row: span 2;
  min-height: 44px;
  padding: 10px;
  border: 1px solid #b8beb9;
  border-radius: 9px;
  background: #ffffffd9;
  color: var(--ink);
}

.field select:disabled {
  border-color: transparent;
  background: #dbe5dc;
  color: #35463b;
  opacity: 1;
  cursor: not-allowed;
}

.field.is-target b::after {
  content: " •";
  color: var(--orange);
}

.bridge {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.answer {
  margin-top: 24px;
  padding: 32px;
  border-radius: 20px;
  background: var(--ink);
  color: #fff;
}

.answer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.kicker {
  display: block;
  margin-bottom: 8px;
  color: #9bc8ab;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker.green {
  color: var(--green);
}

.reset {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid #657069;
  border-radius: 99px;
  background: transparent;
  color: #d2d8d3;
  cursor: pointer;
}

.reset:hover {
  border-color: #9bc8ab;
  color: #fff;
}

.primary-button {
  padding: 9px 15px;
  border: 1px solid #a9d4b7;
  background: #a9d4b7;
  color: #173821;
}

.primary-button:hover {
  background: #c0e1ca;
}

.hint-button {
  margin-top: 16px;
}

.training-feedback .hint-button {
  margin-left: 8px;
  color: #dbe3dd;
}

.training-feedback {
  margin-top: 22px;
  padding: 17px;
  border: 1px solid #465248;
  border-radius: 14px;
  background: #263129;
  color: #dbe3dd;
  line-height: 1.5;
}

.training-feedback strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.suggestion {
  padding: 17px;
  border: 1px solid #465248;
  border-radius: 14px;
  background: #263129;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.suggestion:hover {
  border-color: #9bc8ab;
}

.suggestion small {
  display: block;
  min-height: 31px;
  color: #bec6c0;
  font-size: 12px;
  line-height: 1.35;
}

.suggestion strong {
  display: block;
  margin: 12px 0;
  font-size: 27px;
  font-weight: 400;
}

.suggestion span {
  color: #a9d4b7;
  font-size: 12px;
}

.success {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #4a7056;
  border-radius: 14px;
  background: #263d2f;
}

.success i {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #a9d4b7;
  color: #173821;
  font-size: 21px;
  font-style: normal;
}

.success p {
  margin: 4px 0;
  color: #cbd3cd;
}

.note {
  margin: 20px 0 0;
  color: #aeb7b0;
  font-size: 12px;
  line-height: 1.5;
}

.lesson {
  padding: 65px 4px 25px;
}

.equation {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 13px;
  margin: 20px 0;
}

.equation strong {
  color: var(--green);
  font-size: 30px;
  font-weight: 400;
}

.lesson p {
  max-width: 650px;
  color: var(--muted);
  line-height: 1.5;
}

.postscript {
  max-width: 760px;
  padding: 0 4px 32px;
  color: var(--muted);
  line-height: 1.5;
}

.postscript h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 16px;
}

.postscript p {
  margin: 0 0 8px;
}

.postscript a {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: left bottom;
  background-repeat: no-repeat;
  background-size: 0 1px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  transition: background-size 200ms ease;
}

.postscript a:hover,
.postscript a:focus-visible {
  background-size: 100% 1px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid #d8d7cf;
  color: var(--muted);
  font-size: 12px;
}

.courses {
  display: inline-block;
  min-height: 42px;
  padding: 12px 18px;
  border-radius: 99px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.courses:hover {
  background: var(--green-dark);
}

:where(a, button, select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.noscript {
  max-width: 700px;
  margin: 20px auto;
  padding: 16px 20px;
  border: 1px solid #c77a54;
  border-radius: 12px;
  background: #fff4ed;
  color: #6f2e12;
  line-height: 1.5;
}

@media (max-width: 800px) {
  main {
    padding: 24px 18px 42px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .bridge {
    height: 12px;
  }

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

  .suggestion small {
    min-height: 0;
  }

  .card,
  .answer {
    padding: 24px;
  }

  .tool-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .utility-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 470px) {
  .topbar {
    align-items: center;
  }

  .brand {
    width: min(200px, 58vw);
  }

  .languages {
    margin-top: 0;
  }

  .hero {
    padding-bottom: 36px;
  }

  .eyebrow {
    margin-top: 48px;
  }

  h1 {
    font-size: 48px;
  }

  .head {
    display: block;
  }

  .status {
    display: inline-block;
    margin-top: 12px;
    white-space: normal;
  }

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

  .field select {
    grid-row: auto;
  }

  .answer-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .answer-top h2 {
    font-size: 25px;
  }

  .answer-actions {
    width: 100%;
  }

  .answer-actions > button {
    flex: 1;
  }

  .training-brief {
    grid-template-columns: 1fr;
  }

  .score {
    justify-content: flex-start;
  }

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

  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .courses {
    width: 100%;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .postscript a {
    transition: none;
  }
}
