:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #27231f;
  background: #f4efe6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(circle at 50% 0, rgb(255 255 255 / 65%), transparent 32rem),
    #f4efe6;
}

button,
input {
  font: inherit;
}

.game-shell {
  width: min(100% - 2rem, 29rem);
  margin: 0 auto;
  padding: clamp(2.75rem, 8vh, 5.5rem) 0 2rem;
}

.mode-switch {
  display: flex;
  width: fit-content;
  margin: 0 auto 1.7rem;
  padding: 0.2rem;
  border: 1px solid #d8cec3;
  border-radius: 0.7rem;
  background: rgb(255 255 255 / 42%);
}

.mode-switch button {
  border: 0;
  border-radius: 0.5rem;
  padding: 0.45rem 0.8rem;
  background: transparent;
  color: #7a7067;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.mode-switch button[aria-pressed="true"] {
  background: #33271d;
  color: #fffaf4;
  box-shadow: 0 0.15rem 0.45rem rgb(62 44 29 / 15%);
}

.game-header {
  text-align: center;
}

.date {
  min-height: 1.1rem;
  margin: 0 0 0.35rem;
  color: #766c62;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #33271d;
  font-size: clamp(3.2rem, 15vw, 5.25rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.96;
}

h1 span {
  color: #8b5b38;
}

.intro {
  max-width: 24rem;
  margin: 1.15rem auto 2rem;
  color: #625a52;
  font-size: 1rem;
  line-height: 1.6;
}

.intro strong {
  color: #27231f;
  font-weight: 800;
}

.ladder {
  display: grid;
  gap: 0.55rem;
  width: fit-content;
  margin: 0 auto 1.5rem;
  padding: 0;
  list-style: none;
}

.word-row {
  display: grid;
  grid-template-columns: repeat(4, 3.45rem);
  gap: 0.45rem;
  animation: enter 180ms ease-out both;
}

.letter {
  display: grid;
  width: 3.45rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #d2c8bc;
  border-radius: 0.7rem;
  background: rgb(255 255 255 / 63%);
  box-shadow: 0 0.2rem 0.65rem rgb(62 44 29 / 5%);
  font-size: 1.5rem;
  font-weight: 850;
  text-transform: uppercase;
}

.letter.changed {
  border-color: #b58a69;
  background: #ead8c8;
  color: #623e27;
}

.word-row.target .letter {
  border-color: #70452c;
  background: #70452c;
  color: #fffaf4;
}

.guess-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  margin-top: 1rem;
}

.guess-form[hidden] {
  display: none;
}

.guess-form input {
  min-width: 0;
  height: 3.35rem;
  border: 1px solid #c7b9ab;
  border-radius: 0.75rem;
  outline: none;
  background: rgb(255 255 255 / 75%);
  color: #27231f;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.guess-form input::placeholder {
  color: #a59a8f;
}

.guess-form input:focus {
  border-color: #8b5b38;
  box-shadow: 0 0 0 3px rgb(139 91 56 / 14%);
}

.guess-form button {
  min-width: 5.4rem;
  border: 0;
  border-radius: 0.75rem;
  padding: 0 1.15rem;
  background: #33271d;
  color: #fffaf4;
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}

.guess-form button:hover {
  background: #513a29;
}

.guess-form button:active {
  transform: translateY(1px);
}

.give-up {
  display: block;
  margin: 0.8rem auto 0;
  border: 0;
  padding: 0.25rem;
  background: transparent;
  color: #92877c;
  font-size: 0.72rem;
  text-decoration: underline;
  text-decoration-color: #c6b9ad;
  text-underline-offset: 0.18rem;
  cursor: pointer;
}

.give-up:hover {
  color: #6f6257;
}

.give-up[hidden] {
  display: none;
}

.message {
  min-height: 1.35rem;
  margin: 0.65rem 0 0;
  color: #9a382c;
  font-size: 0.88rem;
  font-weight: 650;
  text-align: center;
}

.finish {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.1rem 0 0.25rem;
  color: #625a52;
}

.finish[hidden] {
  display: none;
}

.finish strong {
  color: #70452c;
  font-size: 1.35rem;
}

.next-practice {
  display: block;
  margin: 1rem auto 0;
  border: 1px solid #bca99a;
  border-radius: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: transparent;
  color: #5e4c3f;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.next-practice[hidden] {
  display: none;
}

.solution {
  margin-top: 1.4rem;
  padding: 1rem;
  border: 1px solid #d7c8ba;
  border-radius: 0.8rem;
  background: rgb(255 255 255 / 45%);
  text-align: center;
}

.solution[hidden] {
  display: none;
}

.solution p {
  margin: 0 0 0.75rem;
  color: #766c62;
  font-size: 0.75rem;
}

.solution p strong {
  color: #4b3b2f;
}

.solution-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.route-word {
  border-radius: 0.38rem;
  padding: 0.3rem 0.42rem;
  background: #ead8c8;
  color: #623e27;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.route-arrow {
  color: #a59689;
  font-size: 0.72rem;
}

.rule {
  margin: 2rem 0 0;
  color: #877d73;
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
}

footer {
  padding: 1rem 1rem 1.4rem;
  color: #968c82;
  font-size: 0.67rem;
  text-align: center;
}

footer a {
  color: inherit;
}

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

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

@media (max-width: 25rem) {
  .word-row {
    grid-template-columns: repeat(4, min(19vw, 3.2rem));
  }

  .letter {
    width: min(19vw, 3.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
