.hangman {
    --hm-purple: #350853;
    --hm-glow: #6827ad;
    --hm-gold: #ffca36;
    --hm-on-gold: #271034;
    --ui-control-height: 44px;
    margin: 14px 0 32px;
}
.hangman [hidden] { display: none !important; }
.hangman-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; margin: 24px 0 18px; }
.hangman-categories { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.hangman-categories legend { margin-bottom: 10px; color: var(--text); font-size: .9rem; font-weight: 750; }
.hangman-categories label { position: relative; cursor: pointer; }
.hangman-categories input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hangman-categories span { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 22px; border: 1px solid var(--line); border-radius: var(--ui-tab-radius); color: var(--ui-tab-text); background: var(--ui-tab-bg); font-weight: var(--ui-control-weight); }
.hangman-categories input:checked + span { color: var(--ui-tab-active-text); background: var(--ui-tab-active-bg); border-color: var(--ui-tab-active-bg); }
.hangman-categories input:focus-visible + span { outline: 3px solid var(--ui-focus, #965ed0); outline-offset: 3px; }
.hangman button { font: inherit; cursor: pointer; touch-action: manipulation; }
.hangman button:disabled { cursor: default; }
.hangman .hangman-start { --ui-button-bg: var(--hm-gold); --ui-button-text: var(--hm-on-gold); --ui-button-hover: #ffda67; --ui-button-hover-text: var(--hm-on-gold); --ui-control-height: 46px; display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; }
.hangman-start:disabled { opacity: .6; }
.hangman-arena {
    display: grid;
    grid-template-columns: minmax(260px, .85fr) minmax(0, 1.65fr);
    border: 1px solid var(--line);
    border-radius: var(--ui-card-radius, 12px);
    background: var(--panel);
    overflow: hidden;
}
.hangman-stage {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(14px, 2vw, 24px);
    overflow: hidden;
    background: radial-gradient(ellipse at 0 5%, #472568 0%, transparent 52%),
        radial-gradient(ellipse at 100% 42%, #215e66 0%, transparent 65%),
        linear-gradient(155deg, #160d30 12%, #14273b 56%, #0e352e);
    color: #f2faf9;
}
.hangman-stage::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background: radial-gradient(ellipse at 15% 3%, #d7b0ff33, transparent 31%),
        radial-gradient(ellipse at 87% 3%, #99ffe633, transparent 31%);
    pointer-events: none;
}
.hangman-score {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #ebeeff2b;
    border-radius: 11px;
    background: #15102c85;
}
.hangman-score-count { display: grid; gap: 3px; min-width: 0; }
.hangman-score-count > span { color: #ded5ea; font-size: .72rem; font-weight: 700; line-height: 1.2; }
.hangman-score strong { color: #fff; font-size: clamp(1.75rem, 3.8vw, 2.55rem); line-height: 1; font-variant-numeric: tabular-nums; transform-origin: left center; }
.hangman-score small { color: #ded5ea; font-size: .8rem; font-weight: 700; }
.hangman-lights { display: flex; flex: 0 1 120px; gap: 4px; padding-bottom: 4px; }
.hangman-lights span { flex: 1 1 0; height: 7px; border-radius: 6px; background: #63edbf; box-shadow: 0 0 9px #63edbf68; }
.hangman-lights .is-used { background: #d9d0ef30; box-shadow: none; }
.hangman-arena[data-last-life] .hangman-lights span:not(.is-used) { background: #ffb363; box-shadow: 0 0 12px #ffb36391; }
.hangman-scene {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: clamp(215px, 28vw, 330px);
}
.hangman-scene::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 27% -5% -10%;
    border: 1px solid #c8fff470;
    border-radius: 8px;
    background: radial-gradient(ellipse at 50% 48%, transparent 30%, #d1f4df35 31% 32%, transparent 33%),
        linear-gradient(90deg, transparent calc(50% - 1px), #d1f4df45 50%, transparent calc(50% + 1px)),
        repeating-linear-gradient(90deg, #174c4394 0 12%, #1b5b4b94 12% 24%);
    box-shadow: inset 0 0 45px #071b2b, 0 12px 48px #06162580;
    transform: perspective(260px) rotateX(36deg);
    transform-origin: center bottom;
}
.hangman-figure {
    display: block;
    width: min(100%, 355px);
    height: auto;
    color: #ffdf7c;
    filter: drop-shadow(0 5px 9px #08172ea0);
}
.hangman-ground { fill: #07192970; stroke: none; }
.hangman-player { transform-box: view-box; transform-origin: 67% 25%; filter: drop-shadow(0 0 7px #ffdf7c64); }
.hangman-frame { color: #c9ebf2; }
.hangman-ball { color: #e6f9f1; }
.hangman-wrong {
    position: relative;
    z-index: 1;
    align-self: flex-start;
    max-width: 100%;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid #d7e6f338;
    border-radius: 999px;
    background: #14172e9c;
    color: #e2e7f5;
    font-size: .75rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.hangman-goal { position: absolute; inset: 0; display: none; }
.hangman-net {
    position: absolute;
    top: 14%;
    left: 12%;
    width: 76%;
    height: 53%;
    border: clamp(4px, .55vw, 8px) solid #f4fff6;
    border-bottom-width: 3px;
    border-radius: 12px 12px 4px 4px;
    background: repeating-linear-gradient(0deg, #e6fff96a 0 1px, transparent 1px 13px),
        repeating-linear-gradient(90deg, #e6fff96a 0 1px, transparent 1px 13px), #092f28b5;
    box-shadow: 0 0 30px #afffda75, 0 10px 24px #0b291f;
}
.hangman-shot {
    position: absolute;
    top: 45%;
    left: 55%;
    translate: -50% -50%;
    font: clamp(2.9rem, 6vw, 4.65rem) / 1 "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
    filter: drop-shadow(0 3px 5px #062d22);
}
.hangman-goal strong {
    position: absolute;
    inset: auto 0 4%;
    color: #ffe37e;
    text-align: center;
    font-size: clamp(2.6rem, 6vw, 4.45rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.06em;
    text-shadow: 0 4px 0 #805119, 0 10px 22px #071f24;
}
.hangman-impact {
    position: absolute;
    z-index: 2;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}
.hangman-confetti {
    position: absolute;
    z-index: 3;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.hangman-confetti i {
    position: absolute;
    top: 46%;
    width: 9px;
    height: 5px;
    border-radius: 1px;
    box-shadow: 0 1px 3px #20122b38;
}
.hangman-confetti i:nth-child(3n) { width: 5px; height: 5px; border-radius: 50%; }
.hangman-play { min-width: 0; align-self: center; padding: clamp(18px, 3vw, 34px); }
.hangman-round-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8rem; }
.hangman-round-meta > :first-child { font-weight: 800; color: var(--ui-link); }
.hangman-clues { display: grid; justify-items: end; gap: 4px; min-width: 0; margin-inline-start: auto; text-align: end; line-height: 1.35; }
.hangman-country { display: flex; align-items: center; gap: 7px; }
.hangman-flag { display: inline-flex; flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; }
.hangman-flag svg { display: block; overflow: hidden; }
.hangman-clues strong { color: var(--text); font-weight: 750; }
.hangman-status { min-height: 2.8em; margin: 12px 0 6px; color: var(--text); font-size: .95rem; line-height: 1.45; font-weight: 650; }
.hangman-word { display: flex; align-content: center; justify-content: center; flex-wrap: wrap; gap: 16px; min-height: 94px; padding: 10px 0 18px; }
.hangman-word-group { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(3px, .6vw, 7px); max-width: 100%; }
.hangman-tile { display: inline-grid; place-items: center; width: clamp(20px, 2.4vw, 32px); height: 42px; border: 1px solid var(--line); border-bottom: 3px solid var(--muted); border-radius: 7px; background: linear-gradient(var(--panel), color-mix(in srgb, var(--ui-link) 9%, var(--panel))); color: var(--text); font-size: clamp(.95rem, 1.8vw, 1.4rem); font-weight: 850; }
.hangman-tile.is-revealed { border-color: color-mix(in srgb, var(--ui-link) 40%, var(--line)); border-bottom-color: var(--ui-link); background: color-mix(in srgb, var(--ui-link) 12%, var(--panel)); }
.hangman-empty-word { align-self: center; color: var(--muted); opacity: .7; font-size: clamp(1.2rem, 3vw, 1.9rem); font-weight: 850; letter-spacing: .2em; }
.hangman-keyboard { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 7px; }
.hangman-keyboard button, .hangman-help button { --ui-button-bg: var(--panel); --ui-button-text: var(--text); --ui-button-hover: color-mix(in srgb, var(--ui-link) 10%, var(--panel)); --ui-button-hover-text: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.hangman-keyboard button { --ui-control-size: 1rem; --ui-control-weight: 800; display: grid; place-items: center; min-height: 44px; padding-inline: 0 !important; }
.hangman-keyboard button:hover:enabled { box-shadow: inset 0 0 0 1px var(--ui-link); }
body.public-site .hangman-keyboard button.is-correct { --ui-button-bg: #ddf4e7; --ui-button-text: #175b39; --ui-button-hover: #ddf4e7; --ui-button-hover-text: #175b39; box-shadow: inset 0 0 0 1px #79b394; opacity: 1; }
body.public-site .hangman-keyboard button.is-wrong { --ui-button-bg: color-mix(in srgb, var(--text) 6%, var(--panel)); --ui-button-text: var(--muted); --ui-button-hover: var(--ui-button-bg); --ui-button-hover-text: var(--muted); text-decoration: line-through; opacity: .7; }
.hangman-help { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.hangman-help button { --ui-button-text: var(--ui-link); --ui-button-hover-text: var(--ui-link); --ui-control-size: .8rem; min-height: 44px; }
.hangman-help small { margin-left: 6px; color: var(--muted); font-size: .75rem; }
.hangman-help button:disabled { opacity: .5; }
.hangman-help p { max-width: 28ch; margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.5; }
.hangman-arena[data-status="won"] { border-color: #4a9f73; }
.hangman-arena[data-status="won"] .hangman-status { color: var(--ui-link); }
.hangman-arena[data-status="won"] .hangman-figure { visibility: hidden; }
.hangman-arena[data-status="won"] .hangman-goal { display: block; }
.hangman-arena[data-status="won"] .hangman-tile.is-revealed { border-bottom-color: #4a9f73; background: color-mix(in srgb, #4a9f73 18%, var(--panel)); }
.hangman-arena[data-status="lost"] { border-color: #bc7864; }
.hangman-arena[data-status="lost"] .hangman-stage { background: radial-gradient(ellipse at 100% 35%, #623a50, transparent 65%), linear-gradient(150deg, #22122c, #41282f 65%, #182b32); }
.hangman-arena[data-status="lost"] .hangman-tile.is-revealed { border-bottom-color: #bc7864; background: color-mix(in srgb, #bc7864 14%, var(--panel)); }
body.public-site .hangman[aria-busy="true"] .hangman-arena[data-status="playing"] .hangman-keyboard button:not(.is-correct):not(.is-wrong) { opacity: 1; }
.hangman-bottom { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; margin-top: 24px; }
.hangman-bottom h2 { margin: 0 0 10px; color: var(--text); font-size: 1rem; }
.hangman-bottom p { margin: 8px 0; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.hangman-stats { padding: 20px; border: 1px solid var(--line); border-radius: var(--ui-card-radius); background: var(--panel); }
.hangman-stats dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.hangman-stats dt { color: var(--muted); font-size: .73rem; }
.hangman-stats dd { margin: 5px 0 0; color: var(--text); font-size: 1.65rem; font-weight: 850; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
    .hangman-keyboard { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    #privacy-settings [data-reopen]:not([hidden]) {
        display: grid;
        margin-inline-start: auto;
    }
    .hangman-arena { grid-template-columns: minmax(0, 1fr); }
    .hangman-stage { padding: 12px 14px; scroll-margin-top: 80px; }
    .hangman-scene { min-height: clamp(190px, 55vw, 265px); }
    .hangman-figure { width: min(91%, 335px); }
    .hangman-word { min-height: 76px; gap: 10px 12px; }
    .hangman-tile { width: clamp(18px, 4.8vw, 30px); height: 36px; font-size: 1.05rem; }
    .hangman-bottom { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 430px) {
    .hangman-play { padding: 15px 12px; }
    .hangman-keyboard { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
    .hangman-toolbar { align-items: stretch; }
    .hangman-start { width: 100%; }
    .hangman-categories { width: 100%; }
    .hangman-categories label { flex: 1; }
    .hangman-help p { max-width: none; }
}
@media (max-width: 350px) {
    .hangman-keyboard { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
    .hangman-arena, .hangman-stage { transition: border-color .3s ease; }
    .hangman-lights span { transition: background-color .25s ease; }
    .hangman-categories label span, .hangman-start, .hangman-keyboard button { transition: background-color .18s ease, box-shadow .18s ease, border-color .18s ease; }
    .hangman-start > span { transition: transform .18s ease; }
    .hangman-start:hover > span { transform: translateX(4px); }
}

