body {
  margin: 0;
  padding: 2rem;
  background: #0b0d12;
  color: #f3efe6;
  font-family: Arial, sans-serif;
}

h1 {
  margin: 0 0 2rem;
  font-size: 1.8rem;
}

.pattern-section {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 9rem;
  justify-content: center;
  align-items: start;
  margin-bottom: 3rem;
}

.pattern-section h2 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

#stored-pattern,
#degraded-pattern,
#updated-pattern {
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 5px;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

#stored-pattern div,
#degraded-pattern div,
#updated-pattern div {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  font-family: monospace;
  font-weight: 700;
}

.state-positive {
  background: #c9a85f;
  color: #111;
}

.state-negative {
  background: #1f2933;
  color: #f3efe6;
}

@media (max-width: 760px) {
  body {
    padding: 1.25rem;
  }

  .pattern-section {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2rem;
  }
}

.math-pathway {
  margin: 3rem auto 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 1.25rem;
  align-items: center;
  max-width: 1100px;
}

.math-step {
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.math-label {
  display: block;
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
}

.equation {
  margin-bottom: 0.7rem;
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.math-step p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.78;
}

.math-arrow {
  font-size: 1.5rem;
  opacity: 0.45;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  line-height: 1;
  margin: 0 0.15rem;
}

.fraction span:first-child {
  padding: 0 0.15rem 0.12rem;
  border-bottom: 1px solid currentColor;
}

.fraction span:last-child {
  padding-top: 0.12rem;
}

@media (max-width: 760px) {
  body {
    padding: 1rem;
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  .pattern-section {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2.5rem;
  }

  .pattern-block {
    width: 100%;
    max-width: 260px;
  }

  .math-pathway {
    grid-template-columns: 1fr;
  }

  .math-arrow {
    text-align: center;
    transform: rotate(90deg);
  }
}

.math-note {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.62;
}

.recovery-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 2rem 0 3rem;
}

#recovery-result {
  flex-basis: 100%;
  width: 100%;
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.8;
}

#run-recovery {
  padding: 0.8rem 1.4rem;
  border: 1px solid #c9a85f;
  border-radius: 8px;
  background: transparent;
  color: #f3efe6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#run-recovery:hover {
  background: rgba(201, 168, 95, 0.12);
}

#run-recovery.is-active {
  background: #1aa6a6;
  color: #081012;
  border-color: #1aa6a6;
}

.pattern-block {
  max-width: 220px;
}

.pattern-block p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.72;
}

.recovery-explainer {
  max-width: 700px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.recovery-explainer h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.recovery-explainer p {
  margin: 0;
  line-height: 1.6;
  opacity: 0.76;
}

#reset-recovery {
  padding: 0.8rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: transparent;
  color: #f3efe6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#reset-recovery:hover {
  background: rgba(201, 168, 95, 0.12);
}

.run-math {
  max-width: 700px;
  margin: 1.5rem auto 0;
  padding: 1rem 1.25rem;
  border-top: 2px solid #1aa6a6;
  line-height: 1.55;
  text-align: center;
}

.run-math p {
  margin: 0.45rem 0 0;
  opacity: 0.82;
}

.pattern-block {
  max-width: 230px;
}

.pattern-description {
  margin-top: 1.5rem;
}

.pattern-description h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  text-align: center;
}

.pattern-description p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.72;
}

.pattern-block .pattern-description h3 {
  text-align: center;
}