/* Game container styles */
.game-container {
    background: var(--color-bg-elevated, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin: 0; /* Remove margin to prevent ad overlap */
    position: relative;
    z-index: 10; /* Ensure game stays above ads */
    border: 1px solid var(--color-border-primary, rgba(255, 255, 255, 0.2));
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border-secondary, #eee);
}

.game-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-text-primary, #333);
}

.game-score {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary, #667eea);
}

/* Game canvas */
.game-canvas {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 300px);
    border: 2px solid var(--color-canvas-border, #ddd);
    border-radius: 8px;
    background: var(--color-canvas-bg, #f8f9fa);
    display: block;
    margin: 0 auto 20px auto;
    box-shadow: var(--shadow-md, 0 4px 15px rgba(0, 0, 0, 0.1));
}

/* Game controls */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.controls button {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Game instructions */
.game-instructions {
    background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.8));
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid var(--color-primary, #667eea);
}

.game-instructions h4 {
    margin-bottom: 10px;
    color: var(--color-text-primary, #333);
}

.game-instructions p {
    margin: 5px 0;
    color: var(--color-text-secondary, #666);
    font-size: 0.9rem;
}

/* Tetris-specific styles */
.tetris-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.tetris-stats > div {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

.tetris-game-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    margin: 20px 0;
}

.tetris-next-piece {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    min-width: 150px;
}

.tetris-next-piece h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

#tetris-next-canvas {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    display: block;
}

#tetris-canvas {
    border: 2px solid #667eea;
    background: #000;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Responsive Tetris layout */
@media (max-width: 768px) {
    .tetris-game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .tetris-stats {
        justify-content: center;
        text-align: center;
    }
    
    .tetris-next-piece {
        margin-top: 15px;
        text-align: center;
    }
    
    /* Remove canvas size override - let JS handle it */
    #tetris-canvas {
        /* width and height set by JavaScript */
    }
}

/* Target Practice specific styles */
.target-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.target-stats > div {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

/* Space Adventure specific styles */
.space-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.space-stats > div {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

/* Dice Master specific styles */
.dice-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.dice-stats > div {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

.dice-game-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    margin: 20px 0;
}

.dice-controls {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    min-width: 200px;
}

.dice-controls h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

.bet-buttons, .prediction-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.bet-btn, .pred-btn {
    padding: 8px 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.bet-btn:hover, .pred-btn:hover {
    background: #667eea;
    color: white;
}

.bet-btn.active, .pred-btn.active {
    background: #667eea;
    color: white;
}

/* Pong specific styles */
.pong-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.pong-stats > div {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

.difficulty-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.diff-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.diff-btn:hover {
    background: #667eea;
    color: white;
}

.diff-btn.active {
    background: #667eea;
    color: white;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Balloon Popper Game Styles */
.balloon-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.balloon-stats > div {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #ff6b6b;
    color: #333;
    font-weight: 600;
    text-align: center;
    min-width: 100px;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.2);
}

.balloon-stats .game-score {
    border-color: #51cf66;
    color: #2b8a3e;
}

.balloon-stats .game-combo {
    border-color: #ffd43b;
    color: #fab005;
    animation: pulse-combo 0.5s ease-in-out;
}

.balloon-stats .game-time {
    border-color: #74c0fc;
    color: #1971c2;
}

.balloon-stats .game-balloons {
    border-color: #ff8cc8;
    color: #c2255c;
}

@keyframes pulse-combo {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

#balloon-canvas {
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEFA 70%, #98FB98 100%);
    border: 3px solid #ff6b6b;
    border-radius: 12px;
    cursor: crosshair;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

#balloon-canvas:hover {
    border-color: #ff5252;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
}

/* Flappy Bird Game Styles */
.flappy-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.flappy-stats > div {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #4CAF50;
    color: #333;
    font-weight: 600;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.2);
}

.flappy-stats .game-score {
    border-color: #2196F3;
    color: #1976D2;
}

.flappy-stats .game-high-score {
    border-color: #FF9800;
    color: #F57C00;
    animation: pulse-high-score 2s ease-in-out infinite;
}

@keyframes pulse-high-score {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(255, 152, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    }
}

#flappy-canvas {
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8E8 70%, #B8E6B8 100%);
    border: 3px solid #4CAF50;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    width: 100%;
    max-width: 400px;
    height: 600px;
}

#flappy-canvas:hover {
    border-color: #45a049;
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
}

/* Frogger Game Styles */
.frogger-stats {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.frogger-stats > div {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #228B22;
    color: #333;
    font-weight: 600;
    text-align: center;
    min-width: 100px;
    box-shadow: 0 2px 10px rgba(34, 139, 34, 0.2);
}

.frogger-stats .game-score {
    border-color: #32CD32;
    color: #228B22;
}

.frogger-stats .game-lives {
    border-color: #FF6B6B;
    color: #DC143C;
}

.frogger-stats .game-level {
    border-color: #4169E1;
    color: #0000CD;
}

.frogger-stats .game-time {
    border-color: #FFD700;
    color: #FF8C00;
    animation: pulse-time 1s ease-in-out infinite;
}

@keyframes pulse-time {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

#frogger-canvas {
    background: #90EE90;
    border: 3px solid #228B22;
    border-radius: 12px;
    cursor: default;
    box-shadow: 0 8px 25px rgba(34, 139, 34, 0.3);
    width: 100%;
    max-width: 600px;
    height: 600px;
}

#frogger-canvas:hover {
    border-color: #32CD32;
    box-shadow: 0 10px 30px rgba(34, 139, 34, 0.4);
}

/* Mobile responsive for new games */
@media (max-width: 768px) {
    .dice-game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .dice-controls {
        margin-top: 15px;
        text-align: center;
        width: 100%;
        max-width: 300px;
    }
    
    .target-stats, .space-stats, .dice-stats, .pong-stats, .balloon-stats, .flappy-stats, .frogger-stats {
        justify-content: center;
        text-align: center;
        gap: 10px;
    }
    
    .balloon-stats > div, .flappy-stats > div, .frogger-stats > div {
        min-width: 80px;
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .difficulty-controls {
        flex-wrap: wrap;
    }
}

/* Blackjack Game Styles */
.blackjack-game {
    max-width: 800px;
    margin: 0 auto;
}

.balance-display h3 {
    text-align: center;
    color: #228B22;
    margin-bottom: 20px;
}

.betting-area {
    background: rgba(102, 126, 234, 0.1);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.bet-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
}

.bet-btn {
    padding: 10px 20px;
    background: #228B22;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.bet-btn:hover {
    background: #1a6b1a;
}

.deal-btn {
    padding: 12px 40px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    margin-top: 15px;
}

.deal-btn:hover:not(:disabled) {
    background: #5568d3;
}

.deal-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.game-area {
    margin: 20px 0;
}

.dealer-area, .player-area {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.card-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    justify-content: center;
}

.card {
    width: 70px;
    height: 100px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.card-red {
    color: #DC143C;
}

.card-black {
    color: #000;
}

.card-back {
    background: linear-gradient(45deg, #1e3a8a, #3b82f6);
    color: white;
    font-size: 40px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.action-btn {
    padding: 12px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

.action-btn:hover:not(:disabled) {
    background: #45a049;
}

.action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.message-area {
    text-align: center;
    margin: 20px 0;
    min-height: 30px;
}

.message-area p {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

/* Solitaire Game Styles */
.solitaire-game {
    max-width: 1000px;
    margin: 0 auto;
}

.top-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 20px;
}

.stock-waste {
    display: flex;
    gap: 15px;
}

.stock-pile, .waste-pile {
    width: 70px;
    height: 100px;
    cursor: pointer;
}

.foundations {
    display: flex;
    gap: 10px;
}

.foundation {
    width: 70px;
    height: 100px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-placeholder {
    width: 70px;
    height: 100px;
    background: rgba(102, 126, 234, 0.05);
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
}

.tableau-area {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.tableau-column {
    min-height: 300px;
    cursor: pointer;
}

.card.selected {
    box-shadow: 0 0 0 3px #FFD700;
    transform: translateY(-5px);
}

/* Reversi Game Styles */
.reversi-game {
    max-width: 600px;
    margin: 0 auto;
}

.board-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.reversi-board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    gap: 2px;
    background: #228B22;
    border: 4px solid #1a6b1a;
    border-radius: 8px;
    padding: 2px;
}

.reversi-cell {
    width: 60px;
    height: 60px;
    background: #2d8a2d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    transition: background 0.2s;
}

.reversi-cell:hover {
    background: #3a9d3a;
}

.reversi-cell.valid-move {
    background: #4CAF50;
}

.move-hint {
    color: rgba(255,255,255,0.5);
    font-size: 30px;
}

.piece {
    animation: place-piece 0.3s ease-out;
}

@keyframes place-piece {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

.game-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.player-indicator {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    background: rgba(102, 126, 234, 0.1);
}

/* Mancala Game Styles */
.mancala-game {
    max-width: 900px;
    margin: 0 auto;
}

.mancala-board {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    background: #8B4513;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    margin: 20px 0;
}

.store {
    width: 100px;
    height: 280px;
    background: #654321;
    border: 4px solid #3e2a14;
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.3);
}

.store-label {
    font-weight: bold;
    color: #f4e4c1;
    margin-bottom: 10px;
    font-size: 18px;
}

.store-count {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
}

.pits-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pit-row {
    display: flex;
    gap: 10px;
}

.mancala-pit {
    width: 80px;
    height: 80px;
    background: #654321;
    border: 3px solid #3e2a14;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.mancala-pit.clickable {
    cursor: pointer;
}

.mancala-pit.clickable:hover {
    transform: scale(1.05);
    background: #7a5a34;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.2), 0 0 0 3px #FFD700;
}

.pit-stones {
    font-size: 20px;
    text-align: center;
}

.stone-count {
    font-size: 24px;
    font-weight: bold;
    color: #f4e4c1;
}

.game-rules {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
}

.game-rules summary {
    cursor: pointer;
    font-weight: 600;
    padding: 5px;
    color: #667eea;
}

.game-rules ul {
    margin-top: 10px;
    padding-left: 20px;
}

.game-rules li {
    margin: 5px 0;
    color: #666;
}

/* Responsive for new card/board games */
@media (max-width: 768px) {
    .reversi-board {
        grid-template-columns: repeat(8, 45px);
        grid-template-rows: repeat(8, 45px);
    }
    
    .reversi-cell {
        width: 45px;
        height: 45px;
        font-size: 30px;
    }
    
    .mancala-board {
        flex-direction: column;
        padding: 20px;
    }
    
    .store {
        width: 280px;
        height: 80px;
        flex-direction: row;
    }
    
    .pit-row {
        justify-content: center;
    }
    
    .card {
        width: 60px;
        height: 85px;
        font-size: 20px;
    }
    
    .card-back {
        font-size: 32px;
    }
}