/* Game Container Styles */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 50px;
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 1rem;
}

.game-header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.game-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

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

.game-controls select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.game-controls select:focus {
    outline: none;
    border-color: #6c5ce7;
}

/* Sudoku Styles */
.sudoku-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    background: #333;
    border: 3px solid #333;
    max-width: 450px;
    width: 100%;
    aspect-ratio: 1;
}

.sudoku-cell {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sudoku-cell:hover {
    background: #f0f0f0;
}

.sudoku-cell.selected {
    background: #6c5ce7;
    color: white;
}

.sudoku-cell.given {
    background: #e9ecef;
    color: #333;
    cursor: default;
}

.sudoku-cell.error {
    background: #ff6b6b;
    color: white;
}

.sudoku-cell.highlight {
    background: #74b9ff;
    color: white;
}

/* Add thick borders for 3x3 box separation */
.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #333;
}

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

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.number-btn {
    padding: 12px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.number-btn:hover {
    background: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
}

.number-btn.erase {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.number-btn.erase:hover {
    background: #e55656;
}

.game-info {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    flex-wrap: wrap;
    font-weight: 600;
    color: #333;
}

/* Word Match Styles */
.word-match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.words-column,
.definitions-column {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
}

.words-column h3,
.definitions-column h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.3rem;
}

.word-list,
.definition-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.word-item,
.definition-item {
    padding: 12px 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.word-item:hover,
.definition-item:hover {
    border-color: #6c5ce7;
    background: #f0f0ff;
}

.word-item.selected,
.definition-item.selected {
    background: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
}

.word-item.matched,
.definition-item.matched {
    background: #00b894;
    color: white;
    border-color: #00b894;
    cursor: default;
}

.word-item.wrong,
.definition-item.wrong {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
    animation: shake 0.5s ease-in-out;
}

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

.game-message {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: none;
}

.game-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.game-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

/* Tetris Styles */
.tetris-layout {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 2rem;
    align-items: start;
}

.game-info-panel,
.controls-panel {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
}

.next-piece {
    margin-bottom: 2rem;
    text-align: center;
}

.next-piece h3 {
    margin-bottom: 1rem;
    color: #333;
}

#next-canvas {
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat {
    text-align: center;
}

.stat label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.stat div {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.tetris-game-area {
    text-align: center;
}

#tetris-canvas {
    border: 3px solid #333;
    background: #000;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.controls-panel h3 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

.control-info {
    margin-bottom: 2rem;
}

.control-info div {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.control-info i {
    width: 20px;
    margin-right: 10px;
    color: #6c5ce7;
}

.mobile-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.mobile-btn {
    padding: 15px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-btn:hover {
    background: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
}

/* Mine Search Styles */
.mine-search-info {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.mine-search-info .game-stats {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    background: #f8f9fa;
    padding: 1rem 2rem;
    border-radius: 10px;
}

.mine-search-info .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    color: #333;
}

.mine-search-info .stat i {
    color: #6c5ce7;
    font-size: 1.2rem;
}

.mine-field-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    overflow: auto;
}

.mine-field {
    display: inline-grid;
    gap: 1px;
    background: #999;
    border: 2px solid #999;
    border-radius: 5px;
}

.mine-field.easy {
    grid-template-columns: repeat(9, 1fr);
}

.mine-field.medium {
    grid-template-columns: repeat(16, 1fr);
}

.mine-field.hard {
    grid-template-columns: repeat(30, 1fr);
}

.mine-cell {
    width: 25px;
    height: 25px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.mine-cell:hover {
    background: #d0d0d0;
}

.mine-cell.revealed {
    background: #e0e0e0;
    border: 1px inset #999;
}

.mine-cell.flagged {
    background: #ff6b6b;
    color: white;
}

.mine-cell.mine {
    background: #ff0000;
    color: white;
}

.mine-cell.mine-1 { color: #0000ff; }
.mine-cell.mine-2 { color: #008000; }
.mine-cell.mine-3 { color: #ff0000; }
.mine-cell.mine-4 { color: #000080; }
.mine-cell.mine-5 { color: #800000; }
.mine-cell.mine-6 { color: #008080; }
.mine-cell.mine-7 { color: #000000; }
.mine-cell.mine-8 { color: #808080; }

.game-instructions {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.game-instructions h3 {
    margin-bottom: 1rem;
    color: #333;
}

.game-instructions ul {
    margin-left: 1.5rem;
}

.game-instructions li {
    margin-bottom: 0.5rem;
    color: #666;
}

/* Responsive Game Styles */
@media (max-width: 1024px) {
    .tetris-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .game-info-panel,
    .controls-panel {
        order: 2;
    }

    .tetris-game-area {
        order: 1;
    }

    .next-piece,
    .game-stats {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .mine-search-info .game-stats {
        gap: 1.5rem;
    }
}

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

    .game-content {
        padding: 1.5rem;
    }

    .word-match-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sudoku-grid {
        max-width: 350px;
        font-size: 1rem;
    }

    .number-pad {
        grid-template-columns: repeat(3, 1fr);
        max-width: 300px;
    }

    .game-info {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    #tetris-canvas {
        width: 250px;
        height: 500px;
    }

    .mine-search-info .game-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .mine-cell {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .control-info {
        display: none;
    }

    .mobile-controls {
        display: grid;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 2rem;
    }

    .game-header p {
        font-size: 1rem;
    }

    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sudoku-grid {
        max-width: 300px;
    }

    .sudoku-cell {
        font-size: 1rem;
    }

    .number-pad {
        max-width: 250px;
    }

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

    #tetris-canvas {
        width: 200px;
        height: 400px;
    }

    .mine-cell {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
}
