/* Three Card Poker - Casino Style */
.three-card-poker-game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
}

.poker-header {
    text-align: center;
    margin-bottom: 15px;
}

.poker-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.8em;
}

.game-info {
    color: #666;
    font-size: 0.85em;
}

.game-info p {
    margin: 5px 0;
}

/* Two Column Layout */
.poker-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.poker-table-column {
    flex: 2;
}

.poker-sidebar-column {
    flex: 1;
    min-width: 280px;
}

/* Poker Table */
.poker-table {
    background: linear-gradient(135deg, #0a5f0a 0%, #085208 100%);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    position: relative;
}

/* Card Areas */
.dealer-section,
.player-section {
    margin-bottom: 15px;
}

.dealer-section h3,
.player-section h3 {
    color: white;
    text-align: center;
    margin: 0 0 8px 0;
    font-size: 1em;
}

/* Player Section with Betting Area - Side by Side Layout */
.player-section-with-betting {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.betting-area-left {
    flex: 0 0 auto;
    min-width: 200px;
}

.player-section {
    flex: 1;
    margin-bottom: 0;
}

.card-area {
    display: flex;
    justify-content: center;
    gap: 6px;
    min-height: 100px;
    align-items: center;
}

/* Playing Cards */
.card {
    width: 70px;
    height: 98px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    display: flex;
    position: relative;
    transition: transform 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
}

.card-image {
    padding: 0;
    background: #ffffff;
}

.card-image-wrapper {
    position: relative;
    padding: 0;
    background: #ffffff;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Fallback CSS card styling if images fail to load */
.card-fallback {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
    font-weight: bold;
    font-size: 1.5em;
}

.card-fallback .card-rank {
    position: absolute;
    top: 5px;
    left: 8px;
    font-size: 0.6em;
}

.card-fallback .card-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
}

.card-fallback .card-rank-bottom {
    position: absolute;
    bottom: 5px;
    right: 8px;
    transform: rotate(180deg);
    font-size: 0.6em;
}

.card-fallback.red {
    color: #d32f2f;
}

.card-fallback.black {
    color: #000;
}

.card-back {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
}

.card-back::before {
    content: '';
    width: 60px;
    height: 90px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 4px;
}

/* Card back image alternative */
.card-back-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.card-placeholder {
    color: rgba(255,255,255,0.5);
    font-size: 1em;
    text-align: center;
    padding: 40px 20px;
}

.hand-type {
    text-align: center;
    color: #ffd700;
    font-weight: bold;
    margin-top: 6px;
    font-size: 1em;
    min-height: 20px;
}

/* Chip Selector */
.chip-selector-container {
    margin: 0 0 15px 0;
}

.chip-selector {
    background: rgba(0,0,0,0.75);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #8B4513;
}

.chip-selector h3 {
    margin: 0 0 10px 0;
    color: #ffd700;
    font-size: 0.9em;
    text-transform: uppercase;
}

.chip-tray-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.chip-tray {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* When chips are direct children of chip-tray-row (mobile layout) */
.chip-selector .chip-tray-row > .chip {
    display: flex;
}

.chip {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 
        0 3px 8px rgba(0,0,0,0.6), 
        inset 0 2px 3px rgba(255,255,255,0.3),
        inset 0 -2px 3px rgba(0,0,0,0.3);
}

.chip:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.8);
}

.chip.selected {
    transform: translateY(-6px) scale(1.15);
    box-shadow: 0 0 20px currentColor;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px currentColor; }
    50% { box-shadow: 0 0 25px currentColor; }
}

/* Chip Colors */
.chip-1 { 
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%); 
    color: #333; 
    border-color: #ccc;
}
.chip-5 { 
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%); 
    color: white; 
    border-color: #b71c1c;
}
.chip-10 { 
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%); 
    color: white; 
    border-color: #0d47a1;
}
.chip-25 { 
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%); 
    color: white; 
    border-color: #1b5e20;
}
.chip-50 { 
    background: linear-gradient(135deg, #fb8c00 0%, #e65100 100%); 
    color: white; 
    border-color: #bf360c;
}
.chip-100 { 
    background: linear-gradient(135deg, #000 0%, #424242 100%); 
    color: #ffd700; 
    border-color: #ffd700;
}

.selected-chips-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

#selected-chips {
    color: #ffd700;
    font-weight: bold;
    font-size: 1em;
}

.clear-selected-btn {
    padding: 6px 12px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    color: #fff;
    transition: all 0.2s;
}

.clear-selected-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

/* Betting Area */
.betting-area {
    display: flex;
    flex-direction: row; /* Ante and Pair Plus side by side */
    gap: 12px;
    margin: 12px 0;
}

.bet-spot {
    background: rgba(255,255,255,0.1);
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 10px;
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.bet-spot:hover:not(.betting-disabled) {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: scale(1.05);
}

.bet-spot.betting-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.bet-spot label {
    display: block;
    color: white;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.bet-amount-display {
    color: #ffd700;
    font-size: 1.3em;
    font-weight: bold;
    padding: 6px;
    margin-bottom: 6px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bet-helper-btn {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    color: #fff;
    transition: all 0.2s;
    margin-top: 5px;
}

.bet-helper-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.02);
}

.bet-helper-btn:active {
    transform: scale(0.98);
}

.play-amount {
    color: #ffd700;
    font-size: 1.2em;
    font-weight: bold;
    padding: 6px;
}

.bet-chips {
    min-height: 40px;
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    align-items: flex-start;
}

.placed-chip {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7em;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.4), 
        inset 0 1px 2px rgba(255,255,255,0.3);
    position: relative;
    margin: -8px 0 0 0;
    transition: transform 0.2s;
}

.placed-chip:hover {
    transform: translateY(-2px);
    z-index: 10;
}

.placed-chip:nth-child(1) { z-index: 6; }
.placed-chip:nth-child(2) { z-index: 5; margin-top: -12px; }
.placed-chip:nth-child(3) { z-index: 4; margin-top: -16px; }
.placed-chip:nth-child(4) { z-index: 3; margin-top: -20px; }
.placed-chip:nth-child(5) { z-index: 2; margin-top: -24px; }
.placed-chip:nth-child(6) { z-index: 1; margin-top: -28px; }

.clear-bet-btn {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255,0,0,0.3);
    color: #fff;
    transition: all 0.2s;
    margin-top: 8px;
}

.clear-bet-btn:hover {
    background: rgba(255,0,0,0.5);
    transform: scale(1.02);
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.poker-btn {
    padding: 10px 24px;
    font-size: 0.95em;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.deal-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.deal-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}

.play-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
}

.play-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    transform: translateY(-2px);
}

.fold-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.fold-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    transform: translateY(-2px);
}

.new-hand-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.new-hand-btn:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-2px);
}

.new-game-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
}

.new-game-btn:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%);
    transform: translateY(-2px);
}


.poker-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Result Message - Below Dealer Hand */
.result-message-inline {
    text-align: center;
    margin-top: 8px;
    font-size: 1.2em;
    font-weight: bold;
    padding: 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
}

/* Payout Details - Below Controls */
.payout-details {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
}

.result-win {
    color: #4caf50;
}

.result-lose {
    color: #f44336;
}

.result-push {
    color: #ff9800;
}

.payout-breakdown {
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 6px;
}

.payout-line {
    color: white;
    padding: 3px 0;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.payout-total {
    color: #ffd700;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 2px solid rgba(255,255,255,0.3);
}

/* Balance Display - Sidebar */
.balance-display {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 2px solid #ffd700;
}

.balance-display h3 {
    color: #ffd700;
    margin: 0 0 15px 0;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-amount {
    color: #4caf50;
    font-weight: bold;
    font-size: 2.5em;
    text-shadow: 0 2px 10px rgba(76, 175, 80, 0.5);
    margin: 0;
}

/* Paytables - Sidebar */
.paytable {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.paytable h4 {
    text-align: center;
    color: #0a5f0a;
    margin: 0 0 10px 0;
    font-size: 1em;
    padding-bottom: 8px;
    border-bottom: 2px solid #0a5f0a;
}

.paytable table {
    width: 100%;
    border-collapse: collapse;
}

.paytable td {
    padding: 6px 8px;
    font-size: 0.9em;
    border-bottom: 1px solid #eee;
}

.paytable tr:last-child td {
    border-bottom: none;
}

.paytable td:first-child {
    font-weight: bold;
    color: #333;
}

.paytable td:last-child {
    text-align: right;
    color: #0a5f0a;
    font-weight: bold;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .poker-container {
        flex-direction: column;
    }
    
    .poker-table-column,
    .poker-sidebar-column {
        width: 100%;
    }
    
    .poker-sidebar-column {
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .poker-table {
        padding: 10px;
    }
    
    .player-section-with-betting {
        flex-direction: column;
        gap: 10px;
    }
    
    .betting-area-left {
        width: 100%;
        min-width: auto;
        order: 1;
    }
    
    .player-section {
        order: 2;
    }
    
    /* Reorder: Betting buttons first, then chips */
    .chip-selector-container {
        margin: 10px 0 0 0;
    }
    
    .betting-area {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin: 0 0 10px 0;
    }
    
    .bet-spot {
        min-width: 90px;
        padding: 8px;
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
    }
    
    /* Larger chips in horizontal row on mobile */
    .chip-selector {
        padding: 8px;
    }
    
    .chip-selector h3 {
        font-size: 0.8em;
        margin: 0 0 8px 0;
    }
    
    .chip-tray-row {
        flex-direction: row;
        gap: 8px;
        margin-bottom: 8px;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
    }
    
    .chip-tray {
        display: none; /* Hide chip-tray wrapper on mobile, chips are direct children */
    }
    
    .chip-selector .chip-tray-row > .chip {
        display: flex; /* Show chips directly in chip-tray-row */
    }
    
    .chip {
        width: 70px;
        height: 70px;
        font-size: 1.1em;
        flex-shrink: 0;
    }
    
    .selected-chips-display {
        margin-top: 6px;
        font-size: 0.9em;
    }
    
    .card {
        width: 60px;
        height: 84px;
        font-size: 1.3em;
    }
    
    .card-area {
        gap: 4px;
        min-height: 90px;
    }
    
    .dealer-section,
    .player-section {
        margin-bottom: 10px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 8px;
        margin: 10px 0;
    }
    
    .poker-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .balance-amount {
        font-size: 1.8em;
    }
    
    /* Reduce spacing in paytables */
    .paytable {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .balance-display {
        padding: 15px;
        margin-bottom: 15px;
    }
}

/* Tutorial Styles */
.tutorial-header {
    margin-bottom: 15px;
    text-align: center;
}

.tutorial-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.tutorial-btn:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.tutorial-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.tutorial-header-bar {
    background: linear-gradient(135deg, #0a5f0a 0%, #085208 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tutorial-header-bar h2 {
    margin: 0;
    font-size: 1.5em;
    color: #ffd700;
}

.close-tutorial-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-tutorial-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.tutorial-body {
    padding: 30px;
}

.tutorial-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.tutorial-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tutorial-section h3 {
    color: #0a5f0a;
    font-size: 1.4em;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0a5f0a;
}

.tutorial-section h4 {
    color: #085208;
    font-size: 1.1em;
    margin: 20px 0 10px 0;
}

.tutorial-section p {
    color: #333;
    line-height: 1.6;
    margin: 10px 0;
}

.tutorial-section ul {
    margin: 10px 0;
    padding-left: 25px;
}

.tutorial-section li {
    color: #555;
    line-height: 1.8;
    margin: 8px 0;
}

.tutorial-section strong {
    color: #0a5f0a;
}

@media (max-width: 768px) {
    .tutorial-content {
        max-width: 95%;
        max-height: 95vh;
    }
    
    .tutorial-body {
        padding: 20px;
    }
    
    .tutorial-header-bar h2 {
        font-size: 1.2em;
    }
}

