.elg-hangman {
    margin: 24px auto;
    padding: 20px;
    background: linear-gradient(160deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}
.elg-hangman *, .elg-hangman *::before, .elg-hangman *::after {
    box-sizing: border-box;
}
.elg-hangman [hidden] {
    display: none !important;
}

.elg-hg-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.elg-hg-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #4338ca;
}
.elg-hg-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .9rem;
}
.elg-hg-stats b { color: #4338ca; }
.elg-hg-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #4338ca;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .1s ease;
}
.elg-hg-icon-btn:hover,
.elg-hg-icon-btn:focus-visible {
    background: #eef2ff;
    outline: none;
}
.elg-hg-icon-btn:active {
    transform: scale(.96);
}
.elg-hg-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.elg-hg-setup {
    display: grid;
    gap: 14px;
    max-width: 520px;
    margin: 18px auto 4px;
}
.elg-hg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.elg-hg-field label {
    color: #334155;
    font-size: .92rem;
    font-weight: 700;
}
.elg-hg-help {
    color: #64748b;
    font-size: .84rem;
    line-height: 1.4;
}
.elg-hg-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #1e293b;
    font: inherit;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.elg-hg-textarea {
    min-height: 136px;
    line-height: 1.5;
    resize: vertical;
}
.elg-hg-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
.elg-hg-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .14);
}
.elg-hg-setup-actions {
    text-align: center;
}
.elg-hg-setup-message {
    min-height: 22px;
    color: #dc2626;
    font-size: .92rem;
    font-weight: 700;
    text-align: center;
}

.elg-hg-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
.elg-hg-figure {
    width: 210px;
    max-width: 60%;
    height: auto;
}
.elg-hg-gallows {
    stroke: #64748b;
    stroke-width: 6;
    stroke-linecap: round;
}
.elg-hg-part {
    stroke: #ef4444;
    stroke-width: 5;
    stroke-linecap: round;
    fill: none;
    opacity: .16;
    transition: opacity .35s ease, stroke .35s ease;
}
.elg-hg-part[data-part="0"] { fill: none; stroke: #ef4444; }
.elg-hg-part.show {
    opacity: 1;
    stroke: #dc2626;
}

.elg-hg-hint {
    text-align: center;
    font-style: italic;
    color: #475569;
    min-height: 22px;
    margin-bottom: 8px;
    font-size: .95rem;
}
.elg-hg-progress {
    text-align: center;
    color: #334155;
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.elg-hg-progress b {
    color: #4338ca;
}

.elg-hg-word {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 18px;
    min-height: 48px;
}
.elg-hg-letter {
    width: 34px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid #6366f1;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
}
.elg-hg-letter.revealed { animation: elg-pop .3s ease; }
@keyframes elg-pop {
    0%   { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

.elg-hg-keyboard {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}
.elg-hg-key {
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    background: #6366f1;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .1s ease, background .2s ease, opacity .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.elg-hg-key:hover:not(:disabled) { background: #4f46e5; }
.elg-hg-key:active:not(:disabled) { transform: scale(.92); }
.elg-hg-key:disabled { cursor: default; }
.elg-hg-key.correct { background: #22c55e; opacity: 1; }
.elg-hg-key.wrong   { background: #cbd5e1; color: #64748b; }

.elg-hg-message {
    text-align: center;
    font-weight: 700;
    min-height: 26px;
    font-size: 1.05rem;
    margin-bottom: 12px;
}
.elg-hg-message.win  { color: #16a34a; }
.elg-hg-message.lose { color: #dc2626; }

.elg-hg-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    text-align: center;
}
.elg-hg-btn {
    padding: 11px 26px;
    border: none;
    border-radius: 12px;
    background: #4338ca;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, transform .1s ease;
}
.elg-hg-btn:hover  { background: #312e81; }
.elg-hg-btn:active { transform: scale(.96); }
.elg-hg-btn:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: default;
    transform: none;
}
.elg-hg-btn:disabled:hover {
    background: #cbd5e1;
}
.elg-hg-btn-secondary {
    background: #e2e8f0;
    color: #334155;
}
.elg-hg-btn-secondary:hover {
    background: #cbd5e1;
}

/* Mobile */
@media (max-width: 480px) {
    .elg-hangman { padding: 14px; margin: 16px 8px; }
    .elg-hg-title { font-size: 1rem; }
    .elg-hg-letter { width: 28px; height: 38px; font-size: 1.25rem; }
    .elg-hg-key { padding: 12px 0; font-size: .95rem; }
    .elg-hg-keyboard { gap: 5px; }
}

.elg-hangman:fullscreen,
.elg-hangman.is-fullscreen {
    width: 100vw;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    border: 0;
    border-radius: 0;
    overflow: auto;
}
.elg-hangman:fullscreen .elg-hg-setup,
.elg-hangman.is-fullscreen .elg-hg-setup {
    max-width: 720px;
}
.elg-hangman:fullscreen .elg-hg-figure,
.elg-hangman.is-fullscreen .elg-hg-figure {
    width: min(320px, 70vw);
}
.elg-hangman:fullscreen .elg-hg-keyboard,
.elg-hangman.is-fullscreen .elg-hg-keyboard {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}
