:root {
    --bg-color: #F9FBFF;
    --light-blue: #CADBFF;
    --dark: #070707;
    --green: #17C900;
    --red: #FF4242;
    --font-main: 'Dela Gothic One', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-color);
    font-family: var(--font-main);
    color: var(--dark);
    min-height: 100vh;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Back Button styling */
.back-button {
    position: absolute;
    padding: 10px 20px;
}

/* Top Layout */
.top-section {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 10%;
    gap: 20px;
}

.word-display {
    display: flex;
    gap: 15px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.letter-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
}

.letter-text {
    font-size: 48px;
    height: 60px;
    visibility: hidden; /* Shown when guessed */
}

.letter-text.visible { visibility: visible; }

.underline {
    width: 100%;
    height: 4px;
    background: var(--dark);
}

.hangman-svg {
    width: 350px;
    height: auto;
}

.part { display: none; }
.part.show { display: block; }

/* Keyboard Layout */
.keyboard-section {
    background: var(--light-blue);
    padding: 40px 5%;
    display: flex;
    justify-content: center;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 900px;
}

.key {
    background: white;
    border: none;
    border-radius: 5px;
    height: 60px;
    font-family: var(--font-main);
    font-size: 24px;
    cursor: pointer;
    transition: 0.2s;
}

.key.correct { background: var(--green); color: white; cursor: default; }
.key.wrong { background: var(--red); color: white; cursor: default; }

/* Modal Styles */
.modal {
    display: none; /* Скрит по подразбиране */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 80%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    font-family: var(--font-main);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--dark);
}

.modal-content p {
    margin-bottom: 30px;
    font-size: 18px;
    color: var(--absent);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s;
}

.modal-btn:hover {
    transform: scale(1.05);
}

.repeat-btn {
    background-color: var(--green);
    color: white;
}

.home-btn {
    background-color: var(--light-blue);
    color: var(--dark);
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .top-section { flex-direction: column-reverse; text-align: center; gap: 10px;}
    .letter-slot { width: 40px; }
    .letter-text { font-size: 32px; }
}