/* =============================================================================
   WISIELEC / HANGMAN — game-specific styles
   Loaded via $extraCss on /rozrywka/wisielec only, on top of games.css.
   Shared chrome (toolbar, select, buttons, modal, stats) lives in games.css.
   Uses the site design tokens from style.css :root.
   ============================================================================= */

/* ---------------- Layout: gallows left, word + keyboard right ---------------- */

.wisielec-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
}

.wisielec-figure {
    flex: 0 0 auto;
}

.wisielec-play {
    flex: 1 1 auto;
    max-width: 620px;
    min-width: 0;
}

/* ---------------- Gallows SVG (drawn progressively by JS) ---------------- */

.wisielec-svg {
    display: block;
    width: 220px;
    height: auto;
    color: var(--color-gray-700);
}

/* All 9 parts are always in the DOM; JS toggles the --show class per
   wrong-guess stage. Stroke via currentColor so the whole drawing follows
   the site palette. */
.wisielec-part {
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
    opacity: 0;
    transition: var(--transition);
}

.wisielec-part--show {
    opacity: 1;
}

/* Final stage (the legs — game over) is drawn in the site red. */
.wisielec-part--final.wisielec-part--show {
    stroke: var(--color-primary);
}

/* ---------------- Word slots ---------------- */

.wisielec-word {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0.5rem 0 1.75rem;
}

.wisielec-slot {
    width: clamp(30px, 8vw, 44px);
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--color-gray-400);
    color: var(--color-gray-900);
    font-family: var(--font-family);
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}

.wisielec-slot--revealed {
    border-bottom-color: var(--color-gray-700);
}

/* On a loss the unguessed letters are shown in red. */
.wisielec-slot--missed {
    color: var(--color-error);
    border-bottom-color: var(--color-error);
}

/* ---------------- On-screen alphabet keyboard ---------------- */

.wisielec-kb {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 560px;
    margin: 0 auto;
    user-select: none;
}

.wisielec-key {
    width: 46px;
    height: 46px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: var(--border-radius-sm);
    background: var(--color-gray-200);
    color: var(--color-gray-900);
    font-family: var(--font-family);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
}

.wisielec-key:hover {
    background: var(--color-gray-300);
}

.wisielec-key[disabled] {
    cursor: default;
}

/* Guessed letter that IS in the word */
.wisielec-key--hit,
.wisielec-key--hit:hover {
    background: var(--color-success);
    color: var(--color-white);
}

/* Guessed letter that is NOT in the word */
.wisielec-key--miss,
.wisielec-key--miss:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-400);
    text-decoration: line-through;
}

/* ---------------- Screen-reader-only live region ---------------- */

.wisielec-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 600px) {
    .wisielec-layout {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .wisielec-svg {
        width: 170px;
    }

    .wisielec-word {
        gap: 5px;
        margin-bottom: 1.25rem;
    }

    /* 10-letter words must fit (or wrap) on narrow screens */
    .wisielec-slot {
        width: clamp(24px, 8vw, 32px);
        height: 44px;
        font-size: 1.35rem;
        border-bottom-width: 2px;
    }

    .wisielec-kb {
        gap: 5px;
    }

    .wisielec-key {
        width: 40px;
        height: 42px;
        font-size: 0.95rem;
    }
}
