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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    min-height: 100vh;
    padding: 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.background-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    z-index: 1;
    pointer-events: none;
}

.background-grid div {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 600;
    color: rgba(87, 189, 145, 0.3);
    letter-spacing: 2px;
}

.overlay {
    position: relative;
    z-index: 2;
    text-align: center;
    background-color: rgba(87, 189, 145, 0.1);
    backdrop-filter: blur(4px);
    padding: 30px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.title {
    background-color: #57BD91;
    color: white;
    padding: 20px;
    border-radius: 12px;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#word-grid {
    border-spacing: 8px;
    border-collapse: separate;
}

#word-grid td {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

#word-grid td.selected {
    background-color: #57BD91;
    color: white;
    transform: scale(0.95);
}

#word-grid td.correct {
    background-color: #45a678;
    color: white;
}

.word-list-container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    list-style: none;
    padding: 0;
}

#word-list li {
    background-color: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: #57BD91;
    font-weight: bold;
}

#word-list li.found {
    background-color: #57BD91;
    color: white;
    text-decoration: none;
    transform: scale(0.95);
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .overlay {
        padding: 10px 10px 20px 10px;
        height: calc(100vh - 20px);
        display: flex;
        flex-direction: column;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .title {
        font-size: 1.5rem;
        padding: 10px;
        margin-bottom: 10px;
    }

    .content {
        flex: 1;
        gap: 1rem;
    }

    .grid-container {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #word-grid {
        width: 100%;
        max-width: 100%;
        border-spacing: 2px;
    }

    #word-grid td {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
        padding: 0;
        touch-action: none;
    }

    .word-list-container {
        padding: 10px;
        margin-bottom: 15px;
    }

    #word-list li {
        padding: 8px 12px;
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .title {
        font-size: 1.2rem;
        padding: 8px;
    }

    #word-grid td {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    #word-list li {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    .content {
        flex-direction: row;
        align-items: flex-start;
    }

    .grid-container {
        flex: 2;
    }

    .word-list-container {
        flex: 1;
    }
}
