/* ===========================================================
   Hangman — game-specific styling only.
   Chrome, body, buttons, #status, .hint, .stat all come
   from ../shared.css. Colours use shared tokens so the
   game flips cleanly between light and dark mode.
   =========================================================== */

/* Tighten the default 20px column gap a touch for this layout. */
body { gap: 16px; }

/* ---------- stat chips row ---------- */
.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- gallows / hangman figure ---------- */
#gallows {
  width: 180px;
  height: 216px;
  max-width: 60vw;
}

/* The wooden frame is always on show. */
#gallows .frame line {
  stroke: var(--text);
  stroke-width: 6;
  stroke-linecap: round;
}

/* Body parts are drawn but kept invisible until revealed. */
#gallows .part {
  stroke: var(--red);
  stroke-width: 6;
  stroke-linecap: round;
  fill: none;
  visibility: hidden;
}
/* The head is a stroked circle, never filled. */
#gallows circle.part { fill: none; }

/* A revealed part pops into view with a small grow. */
#gallows .part.show {
  visibility: visible;
  animation: pop 0.25s ease;
  transform-origin: 150px 120px;
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- the masked word ---------- */
#word {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.slot {
  width: 1.4em;
  text-align: center;
  border-bottom: 4px solid var(--text);
  text-transform: uppercase;
  line-height: 1.2;
  /* Filled letters fade in. */
  transition: color 0.2s;
}
/* A space between words (none in this list, but future-proof). */
.slot.space { border-bottom: none; }

/* Reveal the missing letters in red after a loss. */
.slot.missed { color: var(--red); }

/* ---------- on-screen keyboard ---------- */
#keyboard {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 420px;
}
.key {
  /* Override shared button padding for compact square keys. */
  padding: 0;
  aspect-ratio: 1 / 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px var(--shadow);
}
.key:hover:not(:disabled) { background: var(--surface-3); opacity: 1; }

/* Correct guess — gone green. */
.key.correct {
  background: var(--green);
  color: #fff;
}
/* Wrong guess — gone red. */
.key.wrong {
  background: var(--red);
  color: #fff;
}
/* Any used / disabled key stops responding. */
.key:disabled { cursor: default; opacity: 0.85; }

/* ---------- responsive tweaks ---------- */
@media (max-width: 380px) {
  #word { font-size: 1.6rem; }
  .key { font-size: 0.9rem; }
}
