.wordsearch-wrapper {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 20px;
}

.wordsearch-container {
    max-width: 1400px;
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.3s ease;
}

.wordsearch-container > div:first-child {
    flex: 0 0 auto;
}

.wordsearch-container > div:nth-child(2) {
    flex: 0 0 auto;
}

.wordsearch-container > div:nth-child(3) {
    flex: 0 0 auto;
    width: 100%;
}

.wordsearch-fallback-notice {
    font-size: 14px;
}

.wordsearch-title {
    text-align: center;
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    font-weight: bold;
}

.wordsearch-grid {
    display: grid;
    gap: 2px;
    background: #333;
    padding: 2px;
    border-radius: 8px;
    margin: 0 auto;
    width: fit-content;
    touch-action: none;
}

.wordsearch-grid .cell {
    width: 40px;
    height: 40px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.wordsearch-grid .cell:hover {
    background: #f0f0f0;
}

.wordsearch-grid .cell.selected {
    background: #667eea;
    color: white;
}

.wordsearch-grid .cell.found {
    background: #10b981;
    color: white;
}

.wordsearch-wordlist {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
}

.wordsearch-wordlist h3 {
    margin-bottom: 15px;
    color: #333;
}

.wordsearch-wordlist .word-item {
    padding: 6px 10px;
    margin: 4px 0;
    background: white;
    border-radius: 5px;
    transition: all 0.3s;
    font-size: 14px;
}

.wordsearch-wordlist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wordsearch-wordlist .word-item.found {
    background: #10b981;
    color: white;
    text-decoration: line-through;
}

.wordsearch-progress {
    margin-top: 20px;
    padding: 15px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    text-align: center;
    font-size: 18px;
}

.wordsearch-progress.completed {
    background: #10b981;
}

@media (max-width: 768px) {
    .wordsearch-container {
        padding: 15px;
    }

    .wordsearch-container > div:nth-child(2) {
        flex: 1;
        min-width: 100%;
    }

    .wordsearch-grid .cell {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

/* Dark Mode */
.wordsearch-dark-mode .wordsearch-container {
    background: #1a1a1a;
    color: #e0e0e0;
}

.wordsearch-dark-mode .wordsearch-title {
    color: #ffffff;
}

.wordsearch-dark-mode .wordsearch-grid {
    background: #2a2a2a;
    border-color: #444;
}

.wordsearch-dark-mode .cell {
    background: #333;
    color: #fff;
    border-color: #444;
}

.wordsearch-dark-mode .cell:hover {
    background: #444;
}

.wordsearch-dark-mode .cell.selected {
    background: #4a90e2;
    color: #fff;
}

.wordsearch-dark-mode .cell.found {
    background: #28a745;
    color: #fff;
}

.wordsearch-dark-mode .wordsearch-wordlist {
    background: #2a2a2a;
}

.wordsearch-dark-mode .wordsearch-wordlist h3 {
    color: #fff;
}

.wordsearch-dark-mode .wordsearch-wordlist .word-item {
    background: #333;
    color: #e0e0e0;
}

.wordsearch-dark-mode .wordsearch-wordlist .word-item.found {
    background: #28a745;
    color: #fff;
}

.wordsearch-dark-mode .wordsearch-directions {
    color: #fff;
}

/* System Dark Mode Auto-Detect */
@media (prefers-color-scheme: dark) {
    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-title {
        color: #ffffff;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-grid {
        background: #2a2a2a;
        border-color: #444;
    }

    .wordsearch-wrapper:not(.has-user-preference) .cell {
        background: #333;
        color: #fff;
        border-color: #444;
    }

    .wordsearch-wrapper:not(.has-user-preference) .cell:hover {
        background: #444;
    }

    .wordsearch-wrapper:not(.has-user-preference) .cell.selected {
        background: #4a90e2;
        color: #fff;
    }

    .wordsearch-wrapper:not(.has-user-preference) .cell.found {
        background: #28a745;
        color: #fff;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-wordlist {
        background: #2a2a2a;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-wordlist h3 {
        color: #fff;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-wordlist .word-item {
        background: #333;
        color: #e0e0e0;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-wordlist .word-item.found {
        background: #28a745;
        color: #fff;
    }

    .wordsearch-wrapper:not(.has-user-preference) .wordsearch-directions {
        color: #fff;
    }
}

/* Dark Mode Toggle - immer sichtbar */
.wordsearch-dark-toggle {
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}
