/* Game Wrapper */
.game-wrapper {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 600px;
    width: 100%;
}

.game-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.difficulty-control label {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
}

.difficulty-select {
    border: 2px solid #ccc;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.95rem;
    background: white;
    color: #333;
    cursor: pointer;
}

.difficulty-select:focus {
    outline: none;
    border-color: #667eea;
}

.game-status {
    margin-top: 2rem;
    text-align: center;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 1.1rem;
}

#statusMessage {
    margin: 0;
    color: #333;
}

/* Sudoku Styles */
.sudoku-grid {
    display: inline-grid;
    grid-template-columns: repeat(9, 40px);
    gap: 0;
    margin: 0;
    border: 3px solid #333;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sudoku-cell {
    width: 40px;
    height: 40px;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    background: white;
    border-right: solid;
    border-bottom: solid;
    border-color: #ccc;
}

/* Bold borders for 3x3 box boundaries */
.sudoku-cell:nth-child(9n + 3),
.sudoku-cell:nth-child(9n + 6) {
    border-right: 3px solid #333;
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
    border-bottom: 3px solid #333;
}

.sudoku-cell.given {
    background: #e8e8e8;
    color: #333;
    font-weight: bold;
}

.sudoku-cell.user-input {
    background: #fff8e1;
    color: #667eea;
}

.sudoku-cell.correct {
    background: #c8e6c9;
    color: #2e7d32;
    font-weight: bold;
}

.sudoku-cell.incorrect {
    background: #ffcdd2;
    color: #c62828;
    font-weight: bold;
}

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

.sudoku-cell.number-highlight {
    box-shadow: inset 0 0 0 2px #ffd700;
}

.sudoku-cell.error {
    background: #ffebee;
    color: #c62828;
}

.sudoku-cell:hover:not(.given) {
    background: #f0f0f0;
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

.sudoku-cell input:focus {
    outline: none;
}

/* Sudoku Container and Number Selector */
.sudoku-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
}

.sudoku-number-selector {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
}

.sudoku-number-selector h3 {
    display: none;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.5rem;
}

.number-btn {
    padding: 0.8rem;
    font-size: 1.1rem;
    font-weight: bold;
    border: 2px solid #ccc;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.number-btn:hover {
    border-color: #667eea;
    background: #f0f0f0;
}

.number-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.number-btn.disabled {
    background: #ccc;
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.number-btn.disabled:hover {
    border-color: #ccc;
    background: #ccc;
}

.clear-number-btn {
    display: none;
}

/* Sudoku Actions */
.sudoku-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Solitaire Styles */
.solitaire-layout {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #2d5016;
    border-radius: 8px;
}

.stock-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.foundation-section {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    gap: 1rem;
    align-content: start;
    justify-content: center;
}

.tableau-section {
    display: grid;
    grid-template-columns: repeat(7, 100px);
    gap: 1rem;
    padding: 1rem;
    background: #2d5016;
    border-radius: 8px;
    justify-content: center;
}

.card-pile {
    width: 100px;
    min-height: 40px;
    border: 2px dashed #888;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-wrap: wrap;
    overflow: hidden;
}

.card-pile.stock {
    background: rgba(100, 150, 100, 0.3);
}

.card-pile.waste {
    background: rgba(100, 150, 100, 0.3);
}

.card {
    width: 80px;
    height: 120px;
    border: 1px solid #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: grab;
    user-select: none;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-align: center;
    line-height: 1.2;
}

.card:active {
    cursor: grabbing;
}

.card.red {
    color: #c62828;
}

.card.black {
    color: #000;
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2rem;
}

.empty-foundation {
    border: 2px dashed #888;
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive - Games */
@media (max-width: 768px) {
    .sudoku-grid {
        grid-template-columns: repeat(9, 35px);
    }

    .sudoku-cell {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .sudoku-container {
        flex-direction: column;
        gap: 1rem;
    }

    .sudoku-number-selector {
        max-width: 100%;
    }

    .number-buttons {
        grid-template-columns: repeat(5, 1fr);
    }

    .solitaire-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .foundation-section {
        grid-template-columns: repeat(4, 80px);
    }

    .tableau-section {
        grid-template-columns: repeat(7, 80px);
        gap: 0.5rem;
    }

    .card {
        width: 70px;
        height: 100px;
        font-size: 0.9rem;
    }

    .game-controls {
        gap: 0.5rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .difficulty-control {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .sudoku-grid {
        grid-template-columns: repeat(9, 30px);
    }

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

    .sudoku-container {
        gap: 0.5rem;
    }

    .sudoku-number-selector {
        min-width: 100%;
    }

    .number-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.3rem;
    }

    .number-btn {
        padding: 0.6rem;
        font-size: 1rem;
    }

    .foundation-section {
        grid-template-columns: repeat(2, 70px);
        gap: 0.5rem;
    }

    .tableau-section {
        grid-template-columns: repeat(4, 70px);
        gap: 0.3rem;
    }

    .card {
        width: 60px;
        height: 90px;
        font-size: 0.8rem;
    }

    .game-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
    }

    .difficulty-control {
        width: 100%;
    }
}
