/* Peamine paigutuse konteiner */
.puzzle-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.puzzle-grid-wrapper {
    display: flex;
    justify-content: center;
}

.word-list-wrapper {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 350px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Rägastiku stiilid */
.puzzle-grid {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    line-height: 1.8;
    letter-spacing: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.puzzle-grid-row {
    white-space: nowrap;
}

.puzzle-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8em;
    height: 1.8em;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 2px;
}

.puzzle-cell:hover {
    background-color: #e3f2fd;
    transform: scale(1.1);
}

.puzzle-cell.selecting {
    background-color: #bbdefb;
}

.puzzle-cell.found {
    background-color: #4caf50;
    color: white;
}

/* Kui rakk on nii "found" kui "selecting", näita "selecting" värvi */
.puzzle-cell.found.selecting {
    background-color: #bbdefb;
    color: black;
}

.puzzle-cell.invalid {
    background-color: #f44336;
    color: white;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Sõnade nimekirja stiilid */
.word-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px;
}

.word-item {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.word-item.found {
    background-color: #4caf50;
    color: white;
    text-decoration: line-through;
    opacity: 0.7;
}

/* Responsiivsus */
@media screen and (max-width: 1024px) {
    .puzzle-container {
        flex-direction: column;
        align-items: center;
    }
    
    .word-list-wrapper {
        max-width: 100%;
        width: 100%;
    }
    
    .word-list {
        justify-content: center;
    }
    
    .word-list-wrapper h2 {
        text-align: center;
    }
}

@media screen and (max-width: 768px) {
    .puzzle-grid {
        font-size: 16px;
        padding: 15px;
    }
    
    .puzzle-cell {
        width: 1.6em;
        height: 1.6em;
    }
    
    .puzzle-container {
        gap: 20px;
    }
}

@media screen and (max-width: 480px) {
    .puzzle-grid {
        font-size: 14px;
        padding: 10px;
    }
    
    .puzzle-cell {
        width: 1.5em;
        height: 1.5em;
        margin: 1px;
    }
    
    .word-item {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .puzzle-container {
        gap: 15px;
    }
}

/* ========================================
   TUMEDA REŽIIMI STIILID
   ======================================== */
[data-theme="dark"] .puzzle-grid {
    background: var(--bg-card, #1f2940);
    color: #e4e4e7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .word-list-wrapper {
    background: var(--bg-card, #1f2940);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .word-list-wrapper .subtitle {
    color: #e4e4e7;
}

[data-theme="dark"] .puzzle-cell:hover {
    background-color: rgba(34, 211, 238, 0.15);
}

[data-theme="dark"] .puzzle-cell.selecting {
    background-color: rgba(34, 211, 238, 0.3);
}

[data-theme="dark"] .puzzle-cell.found {
    background-color: #22c55e;
    color: white;
}

[data-theme="dark"] .puzzle-cell.found.selecting {
    background-color: rgba(34, 211, 238, 0.3);
    color: #e4e4e7;
}

[data-theme="dark"] .word-item {
    background-color: #2a3a5a;
    color: #e4e4e7;
}

[data-theme="dark"] .word-item.found {
    background-color: #22c55e;
    color: white;
}