.word-page {
  --tile-correct: #386e51;
  --tile-present: #e2b34e;
  --tile-absent: #54525c;
  background: radial-gradient(ellipse at 42% 5%, #712747, transparent 63%), #210819;
}

.word-game {
  width: min(100% - 1.25rem, 55rem);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 1.6rem) 0 1.25rem;
}

.word-header {
  display: grid;
  justify-items: center;
  gap: .38rem;
  margin-bottom: .95rem;
  text-align: center;
}

.word-header h1 {
  padding: 0;
  border: 0;
  background: none;
  font-size: clamp(1.95rem, 6vw, 3.15rem);
}

.word-header p { margin: 0; color: #f9d1e4; }
.word-back, .word-finish-back { text-decoration: none; }
.word-back { justify-self: start; }

.word-panel {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(.85rem, 4vw, 2.4rem);
  align-items: center;
  padding: clamp(.75rem, 2.7vw, 1.65rem);
  border: 1px solid #ffc79779;
  border-radius: 1.2rem;
  background: linear-gradient(150deg, #551b38, #351027 66%);
  box-shadow: 0 .45rem 1.65rem #1706138c, inset 0 0 2.4rem #ffbe9d1c;
}

.word-help img {
  display: block;
  width: min(100%, 20rem);
  margin: 0 auto .8rem;
  filter: drop-shadow(0 .3rem .6rem #22091a91);
}

.word-legend {
  display: grid;
  gap: .45rem;
  width: fit-content;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  color: #ffe4e9;
  font-size: .85rem;
}

.word-legend li { display: flex; align-items: center; gap: .55rem; }
.word-legend span { width: .72rem; aspect-ratio: 1; border: 1px solid #ffe4d16e; border-radius: .18rem; }

.word-play { min-width: 0; }
.word-board {
  display: grid;
  gap: .26rem;
  width: max-content;
  margin-inline: auto;
  outline: none;
}
.word-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .26rem; }
.word-tile {
  display: grid;
  place-items: center;
  width: clamp(1.86rem, 4.65vh, 2.65rem);
  aspect-ratio: 1;
  border: 1px solid #ad6d82;
  border-radius: .38rem;
  color: #fff5e3;
  background: #290f23;
  font: bold clamp(1.05rem, 3.1vh, 1.52rem) Georgia, serif;
}

.word-row[aria-current="true"] .word-tile { border-color: #e3b089; }
.word-tile[data-filled="true"] { border-color: #ffd2a2; background: #6a2a46; }

.word-feedback {
  min-height: 1.4em;
  margin: .55rem 0;
  color: #ffe6d2;
  text-align: center;
  font-size: .9rem;
}

.word-keyboard { min-width: 0; margin: 0; padding: 0; border: 0; }
.word-key-row { display: flex; justify-content: center; gap: clamp(.16rem, .7vw, .32rem); }
.word-key-row + .word-key-row { margin-top: .24rem; }

.word-key {
  flex: 0 1 2.35rem;
  min-width: 0;
  min-height: 2rem;
  padding: .25rem .05rem;
  border: 1px solid #ad6d82;
  border-radius: .38rem;
  color: #fff1df;
  background: #6b2e4d;
  font: 700 clamp(.76rem, 3vw, .98rem) system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.word-key:hover:not(:disabled) { border-color: #ffd1a0; }
.word-key:disabled { cursor: default; }
.word-action-key { flex-basis: 3.65rem; font-size: .69rem; }
.word-key:focus-visible { outline: 2px solid #ffdc92; outline-offset: 1px; }
.word-page [data-result="correct"] { background: var(--tile-correct); border-color: #96c7a6; }
.word-page [data-result="present"] { color: #28151c; background: var(--tile-present); border-color: #ffe294; }
.word-page [data-result="absent"] { background: var(--tile-absent); border-color: #98919f; }

.word-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; margin-top: .65rem; }
.word-actions[hidden], .word-retry[hidden] { display: none; }

@media (max-width: 39rem) {
  .word-header h1 { margin-top: max(.35rem, calc(env(safe-area-inset-top) - .45rem)); }
  .word-panel { display: grid; grid-template-columns: 1fr; gap: .6rem; }
  .word-help img { display: none; }
  .word-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .25rem .65rem;
    font-size: .7rem;
  }
  .word-legend li { gap: .24rem; }
  .word-key { min-height: 2.2rem; }
}
