:root {
  --peach-50: #fff7f2;
  --peach-100: #f1e3d3;
  --peach-200: #fed7ba;
  --coral: #ea9e8d;
  --coral-dark: #d9746b;
  --ink: #3d2b28;
  --muted: #7a6460;
  --green: #7fb38a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(var(--peach-100), var(--peach-50));
  display: flex;
  flex-direction: column;
}

.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.6);
}
.top h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.9rem;
  color: var(--coral-dark);
}
.back {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.back:hover { color: var(--coral-dark); }
.lives {
  justify-self: end;
  color: var(--coral-dark);
  font-size: 1.3rem;
  letter-spacing: 0.1em;
}

.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1rem 2rem;
  text-align: center;
}

.gallows { width: min(220px, 55vw); height: auto; }
.gallows line, .gallows circle {
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  fill: none;
}
.gallows .part { stroke: var(--coral-dark); opacity: 0; transition: opacity 0.35s; }
.gallows .part.show { opacity: 1; }

.hint { color: var(--muted); font-style: italic; }

.word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.5rem;
}
.slot {
  width: clamp(1.6rem, 6vw, 2.6rem);
  border-bottom: 4px solid var(--ink);
  font-family: "Bagel Fat One", system-ui, sans-serif;
  font-size: clamp(1.4rem, 5vw, 2.3rem);
  text-transform: uppercase;
  line-height: 1.4;
}
.slot.filled { animation: pop 0.3s ease-out; }

.message { min-height: 1.6rem; font-weight: 500; color: var(--muted); }
.message.win { color: #3f7f4d; font-size: 1.2rem; }
.message.lose { color: var(--coral-dark); font-size: 1.2rem; }

.again {
  font: 600 1rem "Inter", sans-serif;
  padding: 0.75rem 1.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--coral-dark);
  color: white;
  cursor: pointer;
}
.again:hover { filter: brightness(1.08); }

.keyboard { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; width: 100%; max-width: 640px; }
.row { display: flex; justify-content: center; gap: 0.4rem; }
.key {
  flex: 0 1 3.4rem;
  aspect-ratio: 1 / 1.15;
  border: 0;
  border-radius: 12px;
  background: var(--coral);
  color: var(--ink);
  font-family: "Bagel Fat One", system-ui, sans-serif;
  font-size: clamp(1rem, 4vw, 1.6rem);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 #c98272;
  transition: transform 0.1s, box-shadow 0.1s, background 0.2s;
}
.key:hover:not(:disabled) { filter: brightness(1.06); }
.key:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #c98272; }
.key:disabled { cursor: default; box-shadow: none; transform: translateY(3px); }
.key.hit { background: var(--green); color: white; }
.key.miss { background: #e5d6d0; color: #b3a29d; }

@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
