@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --background-color: #f0f2f5;
    --text-color: #333;
    --white-color: #fff;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --light-gray: #ecf0f1;
    --dark-gray: #bdc3c7;
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    padding: 10px;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}

.page {
    width: min(1100px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex: 1;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.game-container {
    display: flex;
    gap: 30px;
    align-items: stretch;
    margin-top: 0;
    background-color: var(--white-color);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    width: min(100%, 980px);
    height: min(100vh, 680px);
    max-height: calc(100vh - 20px);
}

.left-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 24px;
}

.hangman-box {
    fill: none;
    stroke: var(--text-color);
    stroke-width: 4;
    stroke-linecap: round;
    width: 200px;
    height: 250px;
}

.figure-part {
    display: none;
}

.wrong-guesses {
    margin-top: 20px;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
}

.right-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 18px;
}

.hint-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    background: linear-gradient(135deg, rgba(52,152,219,0.15), rgba(41,128,185,0.15));
    padding: 12px 16px;
    border-radius: 12px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    font-weight: 600;
}

.hint-box span:first-child {
    color: var(--secondary-color);
}

.hint-box button {
    background-color: var(--secondary-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hint-box button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.word-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    min-height: 50px;
    justify-content: center;
}

.letter {
    border-bottom: 4px solid var(--primary-color);
    width: 30px;
    height: 40px;
    font-size: 2em;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    line-height: 40px;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 8px;
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.key {
    background-color: var(--light-gray);
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent; /* Mobil dokunma efektini kaldırır */
}

.key:hover:not(:disabled) {
    background-color: var(--dark-gray);
}

.key:disabled {
    background-color: var(--dark-gray);
    color: #888;
    cursor: not-allowed;
}

.key.correct {
    background-color: var(--success-color);
    color: var(--white-color);
}

.key.wrong {
    background-color: var(--error-color);
    color: var(--white-color);
}


/* Modal Styles */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-container.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--white-color);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-width: 90%;
}

.modal-container.show .modal {
    transform: scale(1);
}

.spikes {
    fill: none;
    stroke: #c0392b;
    stroke-width: 3;
    stroke-linejoin: round;
}

.fallen-body,
.fallen-leg {
    stroke: #c0392b;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fallen-head {
    fill: none;
    stroke: #c0392b;
    stroke-width: 3;
}

.fallen {
    opacity: 0;
    animation: fall 0.35s forwards;
}

@keyframes fall {
    to {
        opacity: 1;
    }
}

.modal h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal p {
    margin-bottom: 20px;
    font-size: 1.2em;
}

.modal strong {
    text-transform: uppercase;
    color: var(--secondary-color);
}

#play-again {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#play-again:hover {
    background-color: var(--secondary-color);
}

#modal-play-again {
    margin-top: 16px;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#modal-play-again:hover {
    background-color: var(--secondary-color);
}

@media (max-width: 960px) {
    .game-container {
        height: min(100vh - 20px, 640px);
        flex-wrap: wrap;
    }

    .left-panel,
    .right-panel {
        width: 100%;
    }

    .keyboard {
        max-height: 200px;
    }
}

@media (max-width: 640px) {
    body {
        padding: 0;
    }

    .game-container {
        padding: 16px;
        gap: 16px;
    }

    .hint-box {
        flex-direction: column;
        align-items: center;
    }

    .word-display {
        gap: 6px;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        max-height: 220px;
    }
}

@media (max-height: 600px) {
    .game-container {
        height: 100%;
    }

    .keyboard {
        max-height: 160px;
    }

    .hint-box {
        font-size: 0.85rem;
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        padding: 20px;
    }
    .right-panel {
        order: -1; /* Klavyeyi ve kelimeyi yukarı taşır */
    }
     .word-display {
        margin-bottom: 20px;
    }
    .key {
        font-size: 1em;
        padding: 10px;
    }
    h1 {
        font-size: 1.8em;
    }
}
