/* Premium Games Styles */

.premium-game-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    margin: 10px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    color: white;
    min-height: 500px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.game-header h3 {
    margin: 0;
    font-size: 1.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls, .game-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.game-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 52px;
    min-width: 52px;
    margin: 8px;
    font-size: 16px;
    /* Enhanced touch feedback */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    overflow: hidden;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.game-btn:active {
    transform: translateY(0);
}

/* Sudoku Styles */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: #333;
    padding: 10px;
    border-radius: 10px;
    max-width: 360px;
    margin: 0 auto 20px;
    aspect-ratio: 1;
}

.sudoku-cell {
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    border-radius: 3px;
    /* Touch optimizations */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

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

.sudoku-cell.selected {
    background: #2196f3;
    color: white;
}

.sudoku-cell.given {
    background: #f5f5f5;
    cursor: not-allowed;
}

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

.number-btn {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 52px;
    min-width: 52px;
    touch-action: manipulation;
    /* Enhanced touch feedback */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    overflow: hidden;
}

.number-btn:hover {
    transform: scale(1.05);
}

.number-btn.selected {
    background: linear-gradient(45deg, #ff9800, #f57c00);
}

.number-btn.erase {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

/* Tetris Styles */
.tetris-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

#tetrisCanvas {
    border: 3px solid #fff;
    border-radius: 10px;
    background: #000;
}

.tetris-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
}

.control-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(45deg, #9c27b0, #7b1fa2);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 52px;
    min-height: 52px;
    touch-action: manipulation;
    /* Enhanced touch feedback */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Pac-Man Styles */
.pacman-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

#pacmanCanvas {
    border: 3px solid #fff;
    border-radius: 10px;
    background: #000;
}

.pacman-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
}

/* Snake Styles */
.snake-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

#snakeCanvas {
    border: 3px solid #fff;
    border-radius: 10px;
    background: #000;
}

.snake-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
}

/* Memory Game Styles */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 20px auto;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(45deg, #3f51b5, #303f9f);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    min-height: 80px;
    touch-action: manipulation;
    /* Enhanced touch feedback */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.memory-card:hover {
    transform: scale(1.05);
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    border-radius: 10px;
}

.card-front {
    background: linear-gradient(45deg, #4caf50, #45a049);
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(45deg, #3f51b5, #303f9f);
    color: white;
    font-weight: bold;
}

/* Word Search Styles */
.word-search-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.word-search-grid {
    display: grid;
    gap: 2px;
    background: #333;
    padding: 10px;
    border-radius: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.word-search-cell {
    width: 32px;
    height: 32px;
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: bold;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    /* Enhanced touch feedback */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.word-search-cell:hover {
    background: #e3f2fd;
}

.word-search-cell.selected {
    background: #2196f3;
    color: white;
}

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

.word-list {
    min-width: 200px;
    max-width: 250px;
}

.word-list h4 {
    margin: 0 0 15px 0;
    color: #ffd700;
    font-size: 1.1em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
}

.word-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: bold;
    transition: all 0.2s ease;
}

/* Touch-specific feedback for all game elements */
@media (hover: none) and (pointer: coarse) {
    .game-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .game-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }
    
    .game-btn:active::before {
        width: 60px;
        height: 60px;
    }
    
    .number-btn:active {
        transform: scale(0.95);
    }
    
    .number-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }
    
    .number-btn:active::before {
        width: 50px;
        height: 50px;
    }
    
    .control-btn:active {
        transform: scale(0.9);
    }
    
    .control-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }
    
    .control-btn:active::before {
        width: 50px;
        height: 50px;
    }
    
    .sudoku-cell:active {
        transform: scale(0.95);
        background: rgba(33, 150, 243, 0.2);
    }
    
    .word-search-cell:active {
        transform: scale(0.95);
        background: rgba(33, 150, 243, 0.2);
    }
    
    .memory-card:active {
        transform: scale(0.95);
    }
}

/* Mobile-specific layouts */
@media (max-width: 768px) {
    .premium-game-container {
        padding: 15px;
        margin: 5px 0;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-controls, .game-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .game-btn {
        min-height: 56px;
        min-width: 56px;
        font-size: 18px;
        padding: 16px 20px;
    }
    
    .sudoku-grid {
        max-width: 320px;
        gap: 1px;
    }
    
    .sudoku-cell {
        min-height: 35px;
        font-size: 1.1em;
    }
    
    .number-pad {
        max-width: 280px;
        gap: 8px;
    }
    
    .number-btn {
        min-height: 56px;
        min-width: 56px;
        font-size: 1.3em;
        padding: 18px;
    }
    
    .control-btn {
        min-height: 56px;
        min-width: 56px;
        font-size: 1.6em;
        padding: 18px;
    }
    
    .memory-grid {
        max-width: 320px;
        gap: 8px;
    }
    
    .memory-card {
        min-height: 70px;
    }
    
    .word-search-grid {
        max-width: 320px;
        gap: 1px;
    }
    
    .word-search-cell {
        width: 28px;
        height: 28px;
        font-size: 0.9em;
    }
    
    .word-list {
        min-width: 100%;
        margin-top: 20px;
    }
    
    .tetris-container,
    .pacman-container,
    .snake-container,
    .word-search-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tetris-controls,
    .pacman-controls,
    .snake-controls {
        margin-top: 20px;
        min-width: 100%;
    }
    
    .control-row {
        gap: 15px;
    }
    
    #tetrisCanvas,
    #pacmanCanvas,
    #snakeCanvas {
        max-width: 100%;
        height: auto;
    }
}

.word-item.found {
    background: rgba(76, 175, 80, 0.3);
    text-decoration: line-through;
    color: #4caf50;
}

/* Crossword Styles */
.crossword-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.crossword-grid {
    display: grid;
    gap: 1px;
    background: #333;
    padding: 10px;
    border-radius: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.crossword-cell {
    width: 40px;
    height: 40px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 5px;
    position: relative;
    transition: all 0.2s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.crossword-cell.active-cell {
    background: white;
    color: #333;
    cursor: text;
    outline: none;
    border: 2px solid transparent;
}

.crossword-cell.active-cell:focus {
    border-color: #2196f3;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}

.crossword-cell.selected {
    background: #e3f2fd !important;
    border-color: #2196f3;
}

.crossword-cell.word-selected {
    background: #fff3e0 !important;
    border-color: #ff9800;
}

.crossword-cell.correct {
    background: #c8e6c9 !important;
    color: #2e7d32;
}

.crossword-cell.incorrect {
    background: #ffcdd2 !important;
    color: #c62828;
}

.crossword-cell.blocked-cell {
    background: #333;
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.7em;
    color: #666;
    font-weight: normal;
    line-height: 1;
}

.crossword-clues {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 250px;
    max-width: 300px;
}

.clues-section h4 {
    margin: 0 0 10px 0;
    color: #ffd700;
    font-size: 1.2em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.clue-item {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1em;
    line-height: 1.4;
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.clue-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.clue-item:active {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(0.98);
}

.crossword-cell.active-cell:active {
    transform: scale(0.95);
    background: #f0f0f0 !important;
}

.clue-item.selected {
    background: rgba(255, 215, 0, 0.3);
    border-left: 3px solid #ffd700;
}

.crossword-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Mobile Virtual Keyboard Styles */
.mobile-keyboard {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key-btn {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.key-btn:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.key-btn:active {
    transform: translateY(0) scale(0.95);
    background: linear-gradient(145deg, #dee2e6, #ced4da);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.backspace-btn {
    background: linear-gradient(145deg, #ffc107, #ffb300);
    border-color: #ff8f00;
    color: #fff;
    min-width: 60px;
}

.backspace-btn:hover {
    background: linear-gradient(145deg, #ffb300, #ff8f00);
    border-color: #ff6f00;
}

.hide-keyboard-btn {
    background: linear-gradient(145deg, #dc3545, #c82333);
    border-color: #bd2130;
    color: #fff;
    min-width: 120px;
}

.hide-keyboard-btn:hover {
    background: linear-gradient(145deg, #c82333, #bd2130);
    border-color: #a71e2a;
}

.mobile-keyboard-btn {
    background: linear-gradient(145deg, #28a745, #20c997);
    border-color: #1e7e34;
    color: #fff;
}

.mobile-keyboard-btn:hover {
    background: linear-gradient(145deg, #20c997, #17a2b8);
    border-color: #138496;
}

/* Touch optimizations for mobile keyboard */
@media (max-width: 768px) {
    .mobile-keyboard {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-radius: 15px 15px 0 0;
        margin: 0;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .key-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .keyboard-row {
        gap: 6px;
        margin-bottom: 6px;
    }
}

/* Modern Solitaire Styles */
.solitaire-container {
    background: linear-gradient(135deg, #1a5f3f 0%, #2d8f5f 50%, #0f4c2c 100%);
    border-radius: 20px;
    padding: 25px;
    min-height: 700px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.solitaire-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="felt" patternUnits="userSpaceOnUse" width="4" height="4"><rect width="4" height="4" fill="%23ffffff" opacity="0.02"/></pattern></defs><rect width="100" height="100" fill="url(%23felt)"/></svg>');
    pointer-events: none;
}

.solitaire-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.solitaire-header h2 {
    color: #ffffff;
    margin: 0;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

.solitaire-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px 16px;
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8em;
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-value {
    display: block;
    color: #ffffff;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.solitaire-game-board {
    position: relative;
    z-index: 1;
}

.solitaire-top-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.stock-waste-section {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.foundation-section {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

#stockPile, #wastePile, .foundation-pile {
    width: 75px;
    height: 100px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#stockPile:hover, #wastePile:hover, .foundation-pile:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.card-placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.foundation-placeholder {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.4);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#tableau {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    min-height: 250px;
    flex-wrap: wrap;
}

.tableau-column {
    width: 75px;
    min-height: 110px;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    transition: all 0.3s ease;
}

.tableau-column:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.solitaire-card {
    width: 65px;
    height: 90px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #2c3e50;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    margin: -15px 0 0 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 12px;
    font-weight: bold;
    position: relative;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    padding: 4px;
    user-select: none;
}

.solitaire-card:first-child {
    margin-top: 0;
}

.solitaire-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    z-index: 10;
    border-color: #34495e;
}

.solitaire-card .card-value {
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.solitaire-card .card-suit {
    font-size: 18px;
    line-height: 1;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
}

.solitaire-card.red {
    color: #e74c3c;
}

.solitaire-card.black {
    color: #2c3e50;
}

.solitaire-card.face-down {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1f4e79 100%);
    color: white;
    border-color: #1f4e79;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.solitaire-card.face-down::before {
    content: "🂠";
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.solitaire-card.selected {
    border: 3px solid #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.8);
    transform: translateY(-8px) scale(1.05);
    z-index: 15;
}

.solitaire-card.dragging {
    opacity: 0.8;
    transform: rotate(8deg) scale(1.1);
    z-index: 1000;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.solitaire-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.control-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    border: none;
    background: linear-gradient(145deg, #ffffff 0%, #ecf0f1 100%);
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.control-btn:hover {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.control-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.new-game {
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.new-game:hover {
    background: linear-gradient(145deg, #ec7063 0%, #d5392b 100%);
}

.auto-move {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.auto-move:hover {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 100%);
}

/* Enhanced Card Animations */
@keyframes cardFlip {
    0% { 
        transform: rotateY(0deg) scale(1); 
    }
    50% { 
        transform: rotateY(90deg) scale(1.1); 
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    }
    100% { 
        transform: rotateY(0deg) scale(1); 
    }
}

.solitaire-card.flipping {
    animation: cardFlip 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardDeal {
    0% { 
        opacity: 0; 
        transform: translateY(-100px) rotate(15deg) scale(0.8); 
    }
    50% {
        opacity: 0.7;
        transform: translateY(-20px) rotate(5deg) scale(1.05);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) rotate(0deg) scale(1); 
    }
}

.solitaire-card.dealing {
    animation: cardDeal 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardWin {
    0%, 100% { 
        transform: translateY(0) rotate(0deg); 
    }
    25% { 
        transform: translateY(-10px) rotate(5deg); 
    }
    75% { 
        transform: translateY(-10px) rotate(-5deg); 
    }
}

.solitaire-card.winning {
    animation: cardWin 0.5s ease-in-out infinite;
}

@keyframes foundationGlow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(241, 196, 15, 0.3); 
    }
    50% { 
        box-shadow: 0 0 25px rgba(241, 196, 15, 0.8); 
    }
}

.foundation-pile.can-drop {
    animation: foundationGlow 1s ease-in-out infinite;
    border-color: #f1c40f;
}

/* Minesweeper Styles */
.minesweeper-grid {
    display: grid;
    gap: 2px;
    background: #666;
    padding: 10px;
    border-radius: 8px;
    margin: 20px auto;
    max-width: fit-content;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.mine-cell {
    width: 30px;
    height: 30px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.1s ease;
    user-select: none;
}

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

.mine-cell:active {
    border: 2px inset #c0c0c0;
}

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

.mine-cell.revealed:hover {
    background: #e0e0e0;
}

.mine-cell.flagged {
    background: #c0c0c0;
    color: red;
    font-size: 16px;
}

.mine-cell.mine {
    background: #ff4444;
    color: white;
    font-size: 16px;
}

/* Number colors for minesweeper */
.mine-cell.revealed[style*="color: #0000FF"] { color: #0000FF !important; } /* 1 */
.mine-cell.revealed[style*="color: #008000"] { color: #008000 !important; } /* 2 */
.mine-cell.revealed[style*="color: #FF0000"] { color: #FF0000 !important; } /* 3 */
.mine-cell.revealed[style*="color: #800080"] { color: #800080 !important; } /* 4 */
.mine-cell.revealed[style*="color: #800000"] { color: #800000 !important; } /* 5 */
.mine-cell.revealed[style*="color: #008080"] { color: #008080 !important; } /* 6 */
.mine-cell.revealed[style*="color: #000000"] { color: #000000 !important; } /* 7 */
.mine-cell.revealed[style*="color: #808080"] { color: #808080 !important; } /* 8 */

/* Coming Soon Styles */
.coming-soon {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin: 20px 0;
}

.coming-soon h4 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #ffd700;
}

.coming-soon p {
    font-size: 1.1em;
    opacity: 0.9;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .premium-game-container {
        padding: 15px;
        margin: 5px 0;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .game-controls, .game-stats {
        justify-content: center;
    }
    
    .tetris-container, .pacman-container, .snake-container, .crossword-container {
        flex-direction: column;
        align-items: center;
    }
    
    #tetrisCanvas, #pacmanCanvas, #snakeCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .sudoku-grid {
        max-width: 300px;
    }
    
    .sudoku-cell {
        font-size: 1em;
        min-height: 30px;
    }
    
    .number-pad {
        max-width: 250px;
    }
    
    .number-btn {
        padding: 12px;
        font-size: 1em;
        min-height: 44px;
    }
    
    .control-btn {
        padding: 12px;
        font-size: 1.2em;
        min-width: 44px;
        min-height: 44px;
    }
    
    .memory-grid {
        max-width: 300px;
        gap: 8px;
    }
    
    .memory-card {
        min-height: 60px;
    }
    
    .card-front, .card-back {
        font-size: 1.5em;
    }
    
    .crossword-grid {
        max-width: 320px;
    }
    
    .crossword-cell {
        width: 30px;
        height: 30px;
        font-size: 1em;
    }
    
    .crossword-clues {
        min-width: 100%;
        max-width: 100%;
    }
    
    .clues-list {
        max-height: 150px;
    }
    
    .solitaire-container {
        max-width: 100%;
        padding: 10px;
    }
    
    .solitaire-top {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .foundation-piles {
        gap: 8px;
    }
    
    .foundation, .stock-pile, .waste-pile {
        width: 60px;
        height: 80px;
        font-size: 1.5em;
    }
    
    .tableau {
        gap: 8px;
        overflow-x: auto;
        padding: 10px 0;
    }
    
    .tableau-column {
        width: 60px;
        min-width: 60px;
    }
    
    .solitaire-card {
        width: 60px;
        height: 80px;
    }
    
    .empty-tableau {
        width: 60px;
        height: 80px;
        font-size: 1.5em;
    }
    
    .card-value {
        font-size: 1em;
    }
    
    .card-suit {
        font-size: 1.2em;
    }
    
    .minesweeper-grid {
        padding: 5px;
        gap: 1px;
    }
    
    .mine-cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .premium-game-container {
        padding: 10px;
    }
    
    .game-header h3 {
        font-size: 1.3em;
    }
    
    .game-btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    
    .sudoku-grid {
        max-width: 270px;
    }
    
    .sudoku-cell {
        font-size: 0.9em;
        min-height: 28px;
    }
    
    .number-pad {
        max-width: 220px;
    }
    
    .number-btn {
        padding: 10px;
        font-size: 0.9em;
    }
    
    .control-btn {
        padding: 10px;
        font-size: 1em;
    }
    
    #tetrisCanvas, #pacmanCanvas, #snakeCanvas {
        max-width: 100%;
        width: 280px;
        height: 280px;
        margin: 0 auto;
        display: block;
    }
    
    /* Ensure canvas games fit on very small screens */
    .tetris-container, .pacman-container, .snake-container {
        max-width: 100%;
        overflow-x: auto;
        padding: 0 5px;
    }
    
    .memory-grid {
        max-width: 260px;
    }
    
    .memory-card {
        min-height: 50px;
    }
    
    .card-front, .card-back {
        font-size: 1.2em;
    }
    
    .crossword-grid {
        max-width: 280px;
    }
    
    .crossword-cell {
        width: 26px;
        height: 26px;
        font-size: 0.9em;
    }
    
    .cell-number {
        font-size: 0.6em;
    }
    
    .clue-item {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

/* Touch-specific optimizations */
@media (hover: none) and (pointer: coarse) {
    .control-btn, .game-btn, .number-btn, .memory-card, .sudoku-cell, .word-search-cell, .mine-cell {
        min-height: 52px;
        min-width: 52px;
        padding: 12px 16px;
        margin: 10px 6px;
        font-size: 18px;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        touch-action: manipulation;
        transition: all 0.15s ease;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        /* Enhanced touch feedback */
        position: relative;
        overflow: hidden;
    }
    
    .game-btn:active {
        transform: scale(0.95);
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .game-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }
    
    .game-btn:active::before {
        width: 100px;
        height: 100px;
    }
    
    .control-btn:hover, .game-btn:hover, .number-btn:hover {
        transform: none;
    }
    
    .control-btn:active, .game-btn:active, .number-btn:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.2);
    }
    
    /* Word Search touch optimizations */
    .word-search-cell {
        font-size: 1.2em;
        font-weight: bold;
        border: 2px solid #ddd;
        transition: all 0.1s ease;
    }
    
    .word-search-cell:active {
        background: rgba(255, 215, 0, 0.3);
        transform: scale(0.95);
    }
    
    .word-search-cell.selected {
        background: rgba(255, 215, 0, 0.6);
        border-color: #ffd700;
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    }
    
    .word-search-cell.found-word {
        background: rgba(144, 238, 144, 0.8);
        border-color: #90EE90;
    }
    
    /* Memory card touch optimizations */
    .memory-card {
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .memory-card:active {
        transform: scale(0.95);
    }
    
    /* Minesweeper touch optimizations */
    .mine-cell {
        font-size: 1.1em;
        font-weight: bold;
        transition: all 0.1s ease;
    }
    
    .mine-cell:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.3);
    }
    
    /* Sudoku touch optimizations */
    .sudoku-cell {
        font-size: 1.2em;
        transition: all 0.1s ease;
    }
    
    .sudoku-cell:active {
        transform: scale(0.95);
        background: rgba(255, 215, 0, 0.2);
    }
    
    .sudoku-cell.selected {
        background: rgba(255, 215, 0, 0.4);
        border-color: #ffd700;
    }
    
    /* Crossword touch optimizations */
     .crossword-cell {
         min-height: 44px;
         min-width: 44px;
         font-size: 1.1em;
         touch-action: manipulation;
     }
     
     .crossword-cell:active {
         transform: scale(0.95);
     }
     
     /* Solitaire touch optimizations */
     .solitaire-card {
         min-height: 44px;
         min-width: 32px;
         touch-action: manipulation;
         transition: all 0.1s ease;
     }
     
     .solitaire-card:active {
         transform: scale(0.95);
         box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
     }
     
     .solitaire-card.selected {
         border: 2px solid #ffd700;
         box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
     }
     
     .tableau-column {
         min-height: 60px;
         touch-action: manipulation;
     }
     
     .foundation-placeholder {
         min-height: 44px;
         min-width: 32px;
         touch-action: manipulation;
     }
     
     /* General button touch optimizations */
     .control-btn, .game-btn, .number-btn {
         padding: 12px 16px;
         font-size: 1em;
     }
     
     /* Prevent text selection on game elements */
     .game-container, .game-grid, .word-search-grid, .sudoku-grid, .memory-grid, .minesweeper-grid, .crossword-grid, .solitaire-game {
         -webkit-user-select: none;
         -moz-user-select: none;
         -ms-user-select: none;
         user-select: none;
         -webkit-touch-callout: none;
     }
 }

/* Animation for game transitions */
.premium-game-container {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Extra small screens for canvas games */
@media (max-width: 360px) {
    #tetrisCanvas, #pacmanCanvas, #snakeCanvas {
        width: 240px !important;
        height: 240px !important;
        max-width: 95% !important;
    }
    
    .tetris-container, .pacman-container, .snake-container {
        padding: 0 2px;
    }
    
    .game-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .control-btn {
        padding: 8px;
        font-size: 0.85em;
        min-width: 60px;
    }
}

/* Ultra small screens for canvas games */
@media (max-width: 300px) {
    #tetrisCanvas, #pacmanCanvas, #snakeCanvas {
        width: 200px !important;
        height: 200px !important;
        max-width: 90% !important;
    }
    
    .control-btn {
        padding: 6px;
        font-size: 0.8em;
        min-width: 50px;
    }
}

/* Loading states */
.game-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 1.2em;
    color: #ffd700;
}

.game-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}