* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.game-wrapper {
    width: 100%;
    max-width: 600px;
}

.container {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

h1 {
    text-align: center;
    color: #333;
    margin: 0 0 15px 0;
    font-size: 2rem;
}

.stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 0.9rem;
}

.stats span {
    color: #666;
}

.stats strong {
    color: #333;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.controls label {
    font-size: 0.9rem;
    color: #666;
}

.controls select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.controls select:hover {
    border-color: #667eea;
}

.controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#new-game {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#hint {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

#grid-container {
    position: relative;
    margin: 0 auto 20px;
    width: fit-content;
}

#grid {
    display: grid;
    gap: 3px;
    background: #ddd;
    padding: 5px;
    border-radius: 8px;
    user-select: none;
    touch-action: none;
}

.cell {
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
}

.cell:hover {
    background: #e3f2fd;
}

.cell.selected {
    background: #81c784;
    color: white;
    transform: scale(1.05);
}

.cell.found {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
}

.cell.hint {
    animation: pulse 0.5s ease-in-out 3;
    background: #ffeb3b;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

#line-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
}

.word-list {
    text-align: center;
}

.word-list h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 1rem;
}

.word-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.word-list li {
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    transition: all 0.3s ease;
}

.word-list li.found {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    text-decoration: line-through;
}

#message {
    text-align: center;
    font-weight: bold;
    color: #2e7d32;
    min-height: 24px;
    margin: 15px 0 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#message.show {
    opacity: 1;
}

.music-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 0.9em;
    z-index: 1000;
}

.music-controls button {
    padding: 6px 12px;
    font-size: 14px;
    margin: 2px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #f0f0f0;
    transition: background 0.2s;
}

.music-controls button:hover {
    background: #e0e0e0;
}

.music-controls .song-name {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .cell {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .stats {
        font-size: 0.8rem;
    }

    .controls {
        flex-direction: column;
    }

    .music-controls {
        bottom: 10px;
        right: 10px;
        padding: 8px 10px;
    }
}
