@import url('../global.css');

/* =============================================================================
   Le Hangman (Hangman) — gallows figure, masked word, on-screen A–Z keyboard.
   ========================================================================== */

:root {
  --title-color: var(--color-hangman);
}

.hangman-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--background-color-light);
}

/* --- Gallows + figure ------------------------------------------------------ */

.hangman-figure {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.hangman-svg {
  height: 100%;
  max-height: 42vh;
  color: var(--title-color);
}

.hangman-svg line,
.hangman-svg circle {
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
}

.hangman-part {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.hangman-part.is-shown {
  opacity: 1;
}

/* --- Masked word ----------------------------------------------------------- */

.hangman-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.hangman-slot {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 1.1em;
  padding-bottom: 0.1em;
  border-bottom: 3px solid var(--text-color-muted);
  font-size: clamp(1.4rem, 6vw, 2.4rem);
  font-weight: var(--font-weight-bolder);
  text-transform: uppercase;
  color: var(--text-color);
}

.hangman-slot.is-filled {
  border-bottom-color: var(--title-color);
}

/* --- Keyboard -------------------------------------------------------------- */

.hangman-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 30rem;
  flex: 0 0 auto;
}

.hangman-krow {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.hangman-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 2.6rem;
  height: 2.8rem;
  border: none;
  border-radius: var(--border-radius-sm);
  background: var(--onscreen-key-bg);
  color: var(--onscreen-key-ink);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
  cursor: pointer;
  transition:
    background 0.12s,
    transform 0.05s,
    opacity 0.12s;
}

.hangman-key:not(:disabled):hover {
  background: color-mix(in srgb, var(--title-color) 14%, var(--white-color));
}

.hangman-key:active {
  transform: scale(0.94);
}

.hangman-key:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.hangman-key:disabled {
  cursor: default;
}

.hangman-key.is-hit {
  background: #22c55e;
  color: var(--white-color);
  opacity: 1;
}

.hangman-key.is-miss {
  background: var(--error-color);
  color: var(--white-color);
  opacity: 0.6;
}
