/* Hangman */

.hm-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    user-select: none;
}

.hm-hud {
    display: flex;
    gap: 1.2rem;
    font-weight: 600;
    color: var(--color-text-light);
    font-variant-numeric: tabular-nums;
    flex-wrap: wrap;
    justify-content: center;
}

#category {
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* The gallows is built from absolutely placed bars, so no image is needed and
   each part can be revealed independently as a life is lost. */
.hm-gallows {
    position: relative;
    width: 160px;
    height: 150px;
}

.hm-part {
    position: absolute;
    background: #6d5335;
    border-radius: 3px;
    opacity: 0;
}

.hm-part.shown { opacity: 1; }

.hm-base { left: 20px; bottom: 0; width: 110px; height: 8px; }
.hm-post { left: 42px; bottom: 0; width: 8px; height: 142px; }
.hm-beam { left: 42px; top: 8px; width: 74px; height: 8px; }
.hm-rope { left: 112px; top: 16px; width: 5px; height: 26px; background: #a8865a; }

.hm-head {
    left: 98px;
    top: 40px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 5px solid var(--color-accent);
    box-sizing: border-box;
}

.hm-body {
    left: 111px;
    top: 72px;
    width: 6px;
    height: 46px;
    background: var(--color-accent);
}

@media (prefers-reduced-motion: no-preference) {
    .hm-part { transition: opacity 160ms ease; }
}

.hm-word {
    font-size: clamp(1.4rem, 6vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    margin: 0;
    min-height: 1.4em;
    text-align: center;
    word-break: break-word;
}

.hm-keys {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
    width: min(380px, 92vw);
}

.hm-key {
    aspect-ratio: 1;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card-bg);
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.hm-key:hover:not(:disabled) { border-color: var(--color-primary-dark); }

/* A used letter says which it was, so you never waste a guess twice. */
.hm-key.right { background: var(--color-success); color: #fff; border-color: #3d8b40; }
.hm-key.wrong { background: var(--color-border-light); color: var(--color-text-light); }
.hm-key:disabled { cursor: default; }

.hm-key:focus-visible,
.hm-btn:focus-visible {
    outline: 3px solid var(--color-text);
    outline-offset: 2px;
}

.hm-feedback {
    min-height: 1.4em;
    margin: 0;
    font-weight: 600;
    color: var(--color-text-light);
    text-align: center;
}

.hm-btn {
    padding: 0.7rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: var(--color-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.hm-btn:hover { background: var(--color-primary-dark); }
