@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  font-family: "DM Sans", sans-serif;
  color: #242323;
  background: #f5f1e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 12% 18%, rgb(239 220 174 / 30%), transparent 32%),
    radial-gradient(ellipse at 88% 82%, rgb(190 207 190 / 35%), transparent 30%),
    #f5f1e8;
}

button {
  font: inherit;
}

.game {
  width: min(100% - 32px, 780px);
  margin: 0 auto;
  padding: 48px 0 22px;
}

.game__header {
  margin-bottom: 28px;
  text-align: center;
}

.eyebrow,
.hint-label {
  color: #8d7651;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 8vw, 4rem);
  letter-spacing: -0.07em;
  line-height: 1;
}

h1 span {
  color: #d26942;
}

.intro {
  margin: 12px 0 0;
  color: #6d6962;
  font-size: 0.98rem;
}

.game__panel {
  padding: clamp(18px, 5vw, 34px);
  border: 1px solid rgb(72 62 47 / 10%);
  border-radius: 24px;
  background: rgb(255 254 250 / 90%);
  box-shadow: 0 20px 60px rgb(75 60 39 / 10%);
}

.game__topline,
.game__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.category,
.lives {
  margin: 0;
  color: #777168;
  font-size: 0.9rem;
}

.category strong,
.lives strong {
  color: #302f2c;
}

.lives {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f5f1e8;
  white-space: nowrap;
}

.lives span {
  color: #8a8378;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) 1.15fr;
  align-items: center;
  min-height: 255px;
  margin: 14px 0 10px;
}

.drawing {
  display: grid;
  place-items: center;
}

.drawing svg {
  width: min(100%, 220px);
  overflow: visible;
}

.gallows,
.person {
  fill: none;
  stroke: #494640;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.person {
  display: none;
  stroke: #d26942;
  stroke-width: 4;
}

.person.is-visible {
  display: initial;
}

.word-area {
  text-align: center;
}

.hint-label {
  margin: 0 0 17px;
  font-size: 0.68rem;
}

.word {
  display: flex;
  justify-content: center;
  gap: clamp(5px, 2vw, 12px);
  min-height: 48px;
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  font-weight: 700;
  text-transform: uppercase;
}

.word-letter {
  display: grid;
  min-width: 20px;
  place-items: center;
  border-bottom: 3px solid #d6cbb7;
}

.message {
  min-height: 25px;
  margin: 20px 0 0;
  color: #6d6962;
  font-size: 0.9rem;
}

.message.is-win {
  color: #397a55;
  font-weight: 700;
}

.message.is-loss {
  color: #c04f35;
  font-weight: 700;
}

.keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
  border-top: 1px solid #eee9df;
}

.key {
  width: 42px;
  height: 42px;
  border: 1px solid #e8e1d5;
  border-radius: 12px;
  background: #fffefa;
  color: #36332e;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.key:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #d26942;
}

.key:focus-visible,
.new-game:focus-visible {
  outline: 3px solid #d26942;
  outline-offset: 3px;
}

.key:disabled {
  background: #f1eee8;
  color: #aaa49a;
  cursor: not-allowed;
}

.key.is-correct {
  border-color: #cce3d3;
  background: #e8f4eb;
  color: #397a55;
}

.key.is-wrong {
  border-color: #f0d4c9;
  background: #f9e9e3;
  color: #c04f35;
}

.keyboard-help {
  margin: 0;
  color: #8a8378;
  font-size: 0.8rem;
}

.new-game {
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  background: #d26942;
  color: #fffefa;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.new-game:hover {
  transform: translateY(-1px);
  background: #bb5835;
}

.page-footer {
  padding-top: 20px;
  color: #928a7d;
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 560px) {
  .game {
    padding-top: 32px;
  }

  .play-area {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 5px;
  }

  .drawing svg {
    width: 165px;
    height: 175px;
  }

  .word-area {
    padding-bottom: 16px;
  }

  .game__footer {
    align-items: flex-start;
    flex-direction: column-reverse;
  }

  .key {
    width: 38px;
    height: 40px;
  }
}

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