.challenge-page main {
  width: min(calc(100% - 2rem), 1180px);
}

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

.challenge-shell {
  padding: 1rem 0 4.5rem;
}

.challenge-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.55fr);
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.2rem;
}

.challenge-intro h1 {
  max-width: 13ch;
  margin: 0.15rem 0 0;
  font-size: clamp(2.2rem, 6vw, 5.1rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.challenge-intro-copy {
  margin: 0;
  color: var(--page-ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.65;
}

.challenge-symbol-note {
  grid-column: 2;
  margin: -0.65rem 0 0;
  color: var(--page-muted);
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1.5;
}

.challenge-symbol-note a {
  color: var(--page-sage-ink);
  font-weight: 880;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.challenge-card {
  overflow: hidden;
  border: 1px solid var(--page-line-strong);
  border-radius: 1.25rem;
  background: rgba(255, 249, 238, 0.95);
  box-shadow: 0 22px 54px var(--page-shadow);
}

.challenge-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1.2rem;
  padding: 1rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--page-line);
}

.challenge-progress,
.challenge-detail {
  margin: 0;
}

.challenge-symbol-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
}

.challenge-symbol-switcher legend {
  color: var(--page-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.challenge-symbol-switcher > div {
  display: flex;
  padding: 0.22rem;
  border: 1px solid var(--page-line);
  border-radius: 0.62rem;
  background: rgba(255, 249, 238, 0.78);
}

.challenge-symbol-switcher input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.challenge-symbol-switcher label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.45rem 0.66rem;
  border-radius: 0.43rem;
  color: var(--page-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.challenge-symbol-switcher input:checked + label {
  background: var(--page-sage-soft);
  color: var(--page-text);
  box-shadow: 0 3px 0 rgba(67, 50, 30, 0.08);
}

.challenge-symbol-switcher input:focus-visible + label {
  outline: 3px solid var(--page-honey);
  outline-offset: 2px;
}

.challenge-progress {
  font-size: 0.83rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.challenge-detail {
  color: var(--page-muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.challenge-stage {
  display: grid;
  width: 100%;
  min-height: 230px;
  place-items: center;
  overflow-x: auto;
  padding: 0.8rem;
  background:
    radial-gradient(circle at 50% 15%, rgba(211, 226, 203, 0.6), transparent 23rem),
    linear-gradient(180deg, #fffdf7, #f8f0e2);
}

.challenge-stage .number-visual {
  display: block;
  width: min(100%, var(--visual-natural-width));
  height: auto;
  margin: auto;
}

.challenge-answer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, 0.75fr);
  gap: 1.25rem;
  align-items: center;
  padding: 1.2rem;
  border-top: 1px solid var(--page-line);
  background: rgba(244, 235, 219, 0.58);
}

.challenge-answer-panel h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
}

.challenge-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

.challenge-form input {
  min-width: 0;
  min-height: 50px;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--page-line-strong);
  border-radius: 0.72rem;
  background: #fffdf8;
  color: var(--page-text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 850;
}

.challenge-form input:focus {
  outline: 3px solid rgba(226, 160, 55, 0.4);
  outline-offset: 2px;
  border-color: var(--page-honey);
}

.challenge-button,
.challenge-secondary-button,
.challenge-reset-button {
  min-height: 48px;
  border-radius: 0.72rem;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.challenge-button {
  padding: 0.75rem 1.15rem;
  border: 2px solid var(--page-text);
  background: var(--page-text);
  color: #fffdf8;
  box-shadow: 0 7px 0 rgba(37, 52, 50, 0.18);
}

.challenge-button:hover,
.challenge-button:focus-visible {
  background: #38544e;
}

.challenge-button:focus-visible,
.challenge-secondary-button:focus-visible,
.challenge-reset-button:focus-visible {
  outline: 3px solid var(--page-honey);
  outline-offset: 3px;
}

.challenge-secondary-button {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--page-line-strong);
  background: var(--page-paper);
  color: var(--page-text);
}

.challenge-reset-button {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 0;
  background: transparent;
  color: var(--page-muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.challenge-actions {
  display: grid;
  gap: 0.6rem;
}

.challenge-feedback {
  min-height: 1.55em;
  margin: 0.7rem 0 0;
  color: var(--page-muted);
  font-weight: 820;
  line-height: 1.45;
}

.challenge-feedback.is-error {
  color: #8a3e35;
}

.challenge-feedback.is-success {
  color: #356b47;
}

.challenge-reveal {
  margin: 0.55rem 0 0;
  color: var(--page-text);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 950;
  line-height: 1.15;
}

.challenge-free-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.3rem;
  align-items: center;
  margin-top: 1.35rem;
  padding: 1.25rem;
  border: 1px solid rgba(119, 161, 126, 0.5);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(211, 226, 203, 0.88), rgba(217, 230, 228, 0.72));
}

.challenge-free-card h2,
.challenge-free-card p {
  margin: 0;
}

.challenge-free-card h2 {
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.challenge-free-card p:not(.eyebrow) {
  margin-top: 0.42rem;
  color: var(--page-ink-soft);
  line-height: 1.5;
}

.challenge-store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.challenge-store-badges a {
  display: inline-flex;
  min-height: 48px;
}

.challenge-store-badges img {
  display: block;
  width: auto;
  height: 48px;
}

.challenge-note {
  max-width: 72ch;
  margin: 1.2rem auto 0;
  color: var(--page-muted);
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: center;
}

@media (max-width: 760px) {
  .challenge-intro,
  .challenge-answer-panel,
  .challenge-free-card {
    grid-template-columns: 1fr;
  }

  .challenge-intro {
    align-items: start;
  }

  .challenge-symbol-note {
    grid-column: 1;
    margin-top: -0.45rem;
  }

  .challenge-store-badges {
    justify-content: flex-start;
  }

  .challenge-symbol-switcher {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .challenge-page main {
    width: min(calc(100% - 1rem), 1180px);
  }

  .challenge-shell {
    padding-top: 0.4rem;
  }

  .challenge-intro {
    gap: 0.75rem;
  }

  .challenge-card-header,
  .challenge-answer-panel,
  .challenge-free-card {
    padding: 0.9rem;
  }

  .challenge-stage {
    padding: 0.35rem 0;
  }

  .challenge-form {
    grid-template-columns: 1fr;
  }

  .challenge-form .challenge-button,
  .challenge-actions,
  .challenge-secondary-button,
  .challenge-reset-button {
    width: 100%;
  }

  .challenge-store-badges {
    display: grid;
    grid-template-columns: 1fr;
  }

  .challenge-store-badges a {
    width: fit-content;
  }

  .challenge-symbol-switcher {
    display: grid;
    gap: 0.35rem;
  }

  .challenge-symbol-switcher > div,
  .challenge-symbol-switcher label {
    width: 100%;
  }
}

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

@media (forced-colors: active) {
  .challenge-card,
  .challenge-free-card,
  .challenge-form input,
  .challenge-button,
  .challenge-secondary-button {
    border: 2px solid CanvasText;
  }


  .challenge-symbol-switcher > div {
    border: 2px solid CanvasText;
  }
}
