:root {
    --bg-dark: #0f172a;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --tile-bg: rgba(30, 41, 59, 0.7);
    --tile-border: rgba(255, 255, 255, 0.1);
    --correct: #10b981;
    --error: #ef4444;
    --surface: #1e293b;
}

.wisielec-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.game-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

/* Hangman Visuals */
.hangman-visual {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    padding: 30px;
    border: 1px solid var(--tile-border);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.hangman-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.gallows {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.part {
    fill: none;
    stroke: var(--text-main);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
}

.part.visible {
    opacity: 1;
}

.part.head {
    fill: none;
}

/* Game Play Area */
.game-play {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.word-display {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 80px;
}

.letter-slot {
    width: 45px;
    height: 55px;
    border-bottom: 4px solid var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.letter-slot.filled {
    border-bottom-color: var(--correct);
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Keyboard */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    user-select: none;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
    color: var(--text-main);
}

.key:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.key.correct {
    background: var(--correct);
    color: white;
    border-color: #059669;
}

.key.incorrect {
    background: var(--error);
    color: white;
    border-color: #b91c1c;
    opacity: 0.6;
}

.key.disabled {
    cursor: default;
    pointer-events: none;
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.difficulty-actions {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-primary {
    padding: 12px 25px;
    /* less padding to fit 3 buttons */
    border-radius: 30px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary.mix {
    background: #475569;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.4);
}

.btn-primary.mix:hover {
    background: #334155;
    box-shadow: 0 6px 20px rgba(71, 85, 105, 0.4);
}

.btn-primary.easy {
    background: var(--correct);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-primary.easy:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary.hard {
    background: #4338ca;
    box-shadow: 0 4px 15px rgba(67, 56, 202, 0.4);
}

.btn-primary.hard:hover {
    background: #3730a3;
    box-shadow: 0 6px 20px rgba(67, 56, 202, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

@media (max-width: 480px) {
    .difficulty-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .btn-primary {
        width: 100%;
        max-width: 250px;
        padding: 12px 20px;
    }
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
    opacity: 0;
}

.overlay-content {
    background: var(--surface);
    padding: 50px;
    border-radius: 32px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--tile-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.overlay-content h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.overlay-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.reveal-word {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 35px;
}

.reveal-word span {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 41, 59, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: transform 0.3s ease;
    z-index: 2000;
    border: 1px solid var(--tile-border);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 850px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .hangman-visual {
        order: -1;
    }

    .game-header h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .wisielec-container {
        padding: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .game-layout {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .game-header {
        margin-bottom: 15px;
        width: 100%;
        text-align: center;
    }

    .game-header h1 {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .game-header p {
        font-size: 0.9rem;
        display: none;
        /* Hide description on very small screens to save space */
    }

    .hangman-visual {
        padding: 10px;
        border-radius: 16px;
        width: 100%;
        max-width: 280px;
        /* Limit box width but keep it centered */
        margin: 0 auto;
        justify-content: center;
    }

    .hangman-svg {
        max-width: 160px;
        /* Much smaller to fit everything */
        display: block;
        margin: 0 auto;
    }

    .word-display {
        gap: 6px;
        min-height: 50px;
        justify-content: center;
        width: 100%;
    }

    .kb-row {
        gap: 5px;
        justify-content: center;
        width: 100%;
    }

    .key {
        padding: 12px 6px;
        min-width: 30px;
        font-size: 1rem;
        border-radius: 6px;
    }

    .letter-slot {
        width: 25px;
        height: 35px;
        font-size: 1.2rem;
        border-bottom-width: 3px;
    }

    .game-play {
        gap: 15px;
        width: 100%;
        align-items: center;
    }
}