/* ==================== RESET & VARIABLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #1a5f2a;
    --secondary-color: #0d3314;
    --table-color-1: var(--primary-color);
    --table-color-2: var(--secondary-color);
    --gold: #ffd700;
    --red: #dc3545;
    --dark: #1a1a2e;
}

/* Thèmes de table */
body.table-green {
    --primary-color: #1a5f2a;
    --secondary-color: #0d3314;
    --table-color-1: #1a5f2a;
    --table-color-2: #0d3314;
}

body.table-blue {
    --primary-color: #1a4a8e;
    --secondary-color: #0d2847;
    --table-color-1: #1a4a8e;
    --table-color-2: #0d2847;
}

body.table-red {
    --primary-color: #8e1a1a;
    --secondary-color: #470d0d;
    --table-color-1: #8e1a1a;
    --table-color-2: #470d0d;
}

body.table-purple {
    --primary-color: #5a1a8e;
    --secondary-color: #2d0d47;
    --table-color-1: #5a1a8e;
    --table-color-2: #2d0d47;
}

body.table-gold {
    --primary-color: #8e6a1a;
    --secondary-color: #473510;
    --table-color-1: #8e6a1a;
    --table-color-2: #473510;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, #16213e 100%);
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: pan-y;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    padding: 12px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
}

.header.active {
    display: flex;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 5px var(--gold), 0 0 10px var(--gold); }
    to { text-shadow: 0 0 20px var(--gold), 0 0 30px var(--gold); }
}

.settings-btn-header {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,215,0,0.2);
    color: var(--gold);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    z-index: 100;
}

.settings-btn-header:active {
    transform: translateY(-50%) scale(0.9);
    background: rgba(255,215,0,0.4);
}

.stats-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 50px;
}

.stat-item {
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.stat-item.balance {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    font-weight: bold;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* ==================== MENU PRINCIPAL ==================== */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark) 0%, #16213e 50%, var(--secondary-color) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s, visibility 0.5s;
    padding: 20px;
}

.main-menu.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.menu-title {
    font-size: clamp(2rem, 8vw, 4rem);
    color: var(--gold);
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    margin-bottom: 10px;
    animation: bounceIn 1s;
    text-align: center;
}

.menu-subtitle {
    color: #aaa;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    margin-bottom: 30px;
    text-align: center;
}

.menu-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    font-size: clamp(2rem, 8vw, 4rem);
}

.menu-card {
    animation: float 3s ease-in-out infinite;
}

.menu-card:nth-child(1) { animation-delay: 0s; }
.menu-card:nth-child(2) { animation-delay: 0.5s; }
.menu-card:nth-child(3) { animation-delay: 1s; }
.menu-card:nth-child(4) { animation-delay: 1.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.menu-btn {
    padding: 15px 35px;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    touch-action: manipulation;
    min-height: 50px;
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--gold), #ffaa00);
    color: var(--dark);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.menu-btn.secondary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 5px 20px rgba(26, 95, 42, 0.4);
}

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

/* ==================== GAME CONTAINER ==================== */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* ==================== TABLE DE JEU ==================== */
.game-table {
    background: radial-gradient(ellipse at center, var(--table-color-1) 0%, var(--table-color-2) 100%);
    border-radius: clamp(30px, 10vw, 200px) / clamp(20px, 5vw, 100px);
    padding: clamp(20px, 5vw, 40px);
    margin: 15px auto;
    position: relative;
    box-shadow: 
        inset 0 0 100px rgba(0,0,0,0.3),
        0 10px 50px rgba(0,0,0,0.5),
        0 0 0 clamp(8px, 2vw, 15px) #5d4e37,
        0 0 0 clamp(12px, 3vw, 20px) #3d2e1f;
    min-height: clamp(300px, 60vh, 500px);
}

.table-pattern {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    border: 3px dashed rgba(255,255,255,0.1);
    border-radius: 100px;
}

.dealer-area, .player-area {
    text-align: center;
    margin: 15px 0;
}

.area-label {
    color: rgba(255,255,255,0.7);
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: -30px;
    min-height: clamp(100px, 20vh, 140px);
    flex-wrap: wrap;
}

/* ==================== SPLIT — MAINS SÉPARÉES ==================== */
.split-container {
    display: flex;
    justify-content: center;
    gap: clamp(12px, 4vw, 24px);
    flex-wrap: wrap;
    width: 100%;
}

.split-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: clamp(8px, 2vw, 14px);
    border-radius: 16px;
    border: 3px solid transparent;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
    background: rgba(0,0,0,0.15);
    min-width: clamp(100px, 28vw, 160px);
}

/* Main inactive — légèrement estompée */
.split-hand:not(.active) {
    opacity: 0.55;
    transform: scale(0.96);
}

/* Main active — contour doré pulsant, bien visible au doigt */
.split-hand.active {
    border-color: var(--gold);
    box-shadow:
        0 0 0 2px rgba(255,215,0,0.35),
        0 0 18px rgba(255,215,0,0.55),
        inset 0 0 12px rgba(255,215,0,0.08);
    background: rgba(255,215,0,0.07);
    transform: scale(1.03);
    animation: splitPulse 1.6s ease-in-out infinite;
}

@keyframes splitPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255,215,0,0.35), 0 0 18px rgba(255,215,0,0.55), inset 0 0 12px rgba(255,215,0,0.08); }
    50%       { box-shadow: 0 0 0 3px rgba(255,215,0,0.55), 0 0 30px rgba(255,215,0,0.75), inset 0 0 16px rgba(255,215,0,0.14); }
}

/* Label "✋ À vous" au dessus de la main active */
.split-hand.active::before {
    content: "▶ À vous";
    display: block;
    color: var(--gold);
    font-size: clamp(0.65rem, 2vw, 0.78rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
    animation: splitPulseTxt 1.6s ease-in-out infinite;
}

@keyframes splitPulseTxt {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.score-display {
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 6px 15px;
    border-radius: 15px;
    display: none;
    margin-top: 8px;
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: bold;
}

.score-display.show {
    display: inline-block;
}

.score-display.bust {
    background: var(--red);
    animation: shake 0.5s;
}

.score-display.blackjack {
    background: linear-gradient(135deg, var(--gold), #ffaa00);
    color: var(--dark);
    animation: pulse 0.5s;
}

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

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

/* ==================== CARTES ==================== */
.card {
    width: clamp(70px, 15vw, 90px);
    height: clamp(100px, 21vw, 130px);
    background: white;
    border-radius: 8px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
    margin: 0 clamp(-20px, -3vw, -15px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    transition: transform 0.3s;
    animation: dealCard 0.3s ease-out;
}

.card:hover, .card:active {
    transform: translateY(-10px);
    z-index: 10;
}

@keyframes dealCard {
    0% {
        transform: translateY(-200px) rotate(20deg);
        opacity: 0;
    }
    100% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
}

.card.hidden-card {
    background: linear-gradient(135deg, #1a1a8e, #0a0a4e);
}

.card.hidden-card::before {
    content: "🎴";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(2rem, 5vw, 3rem);
}

.card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
}

.card-corner.bottom {
    transform: rotate(180deg);
}

.card-value {
    font-size: clamp(1rem, 3vw, 1.4rem);
}

.card-suit {
    font-size: clamp(0.7rem, 2vw, 1rem);
}

.card-center {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card.red {
    color: #dc3545;
}

.card.black {
    color: #1a1a2e;
}

/* ==================== ZONE DE PARIS ==================== */
.betting-area {
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
    padding: clamp(15px, 4vw, 30px);
    margin: 15px 0;
    display: block;
}

.betting-area.hidden {
    display: none;
}

.betting-title {
    color: var(--gold);
    text-align: center;
    margin-bottom: 15px;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
}

.betting-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-bet-zone {
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,170,0,0.1));
    border: 3px solid var(--gold);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    touch-action: manipulation;
}

.main-bet-zone:active {
    transform: scale(0.98);
}

.main-bet-zone.active {
    box-shadow: 0 0 30px rgba(255,215,0,0.5);
    border-width: 4px;
}

.bet-zone-label {
    color: var(--gold);
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.bet-zone-amount {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: white;
    font-weight: bold;
    background: rgba(0,0,0,0.4);
    padding: 10px 20px;
    border-radius: 15px;
    display: inline-block;
}

.bonus-bets-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 40vw, 200px), 1fr));
    gap: 15px;
}

.bonus-bet-spot {
    background: linear-gradient(135deg, rgba(26,95,42,0.4), rgba(13,51,20,0.4));
    border: 3px dashed rgba(255,215,0,0.5);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    touch-action: manipulation;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bonus-bet-spot:active {
    transform: scale(0.95);
}

.bonus-bet-spot.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--gold);
    border-width: 4px;
    box-shadow: 0 0 30px rgba(255,215,0,0.5);
}

.bonus-bet-label {
    color: var(--gold);
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: bold;
    margin-bottom: 5px;
}

.bonus-bet-payouts {
    color: #4ade80;
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    margin-bottom: 8px;
    line-height: 1.4;
}

.bonus-bet-amount {
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 5px 10px;
    border-radius: 10px;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.total-bet-display {
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--gold);
    border-radius: 15px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.total-bet-label {
    color: #aaa;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    margin-bottom: 5px;
}

.total-bet-value {
    color: var(--gold);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
}

.total-bet-breakdown {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    color: #999;
    margin-top: 8px;
}

.chips-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(60px, 13vw, 70px), 1fr));
    gap: clamp(10px, 2.5vw, 15px);
    justify-items: center;
    margin-bottom: 20px;
}

.chip {
    width: clamp(60px, 13vw, 70px);
    height: clamp(60px, 13vw, 70px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px dashed rgba(255,255,255,0.5);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    touch-action: manipulation;
}

.chip::before {
    content: '';
    position: absolute;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

.chip:active {
    transform: scale(0.9);
}

.chip.chip-1 { background: linear-gradient(135deg, #ffffff, #cccccc); color: #333; }
.chip.chip-5 { background: linear-gradient(135deg, #ff0000, #aa0000); color: white; }
.chip.chip-10 { background: linear-gradient(135deg, #0066ff, #0044aa); color: white; }
.chip.chip-25 { background: linear-gradient(135deg, #00aa00, #006600); color: white; }
.chip.chip-50 { background: linear-gradient(135deg, #ff6600, #cc4400); color: white; }
.chip.chip-100 { background: linear-gradient(135deg, #1a1a1a, #000000); color: var(--gold); }
.chip.chip-500 { background: linear-gradient(135deg, #9900ff, #6600aa); color: white; }
.chip.chip-1000 { background: linear-gradient(135deg, var(--gold), #cc9900); color: var(--dark); }

.bet-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.bet-btn {
    padding: clamp(14px, 3.5vw, 16px);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    touch-action: manipulation;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.bet-btn.clear {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
    color: white;
    font-size: clamp(0.9rem, 2.8vw, 1.05rem);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.bet-btn.clear::before {
    content: '🗑️';
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
}

.bet-btn.double-bet {
    background: linear-gradient(135deg, #ff6600, #cc4400);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.4);
}

.bet-btn.rebet {
    background: linear-gradient(135deg, #9333ea, #7e22ce);
    color: white;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
    display: none;
}

.bet-btn.rebet.show {
    display: flex;
}

.bet-btn.deal {
    background: linear-gradient(135deg, var(--gold), #ffaa00);
    color: var(--dark);
    grid-column: 1 / -1;
    padding: clamp(16px, 4vw, 18px);
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    min-height: 58px;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

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

.bet-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== ACTIONS DE JEU ==================== */
.game-actions {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(clamp(110px, 28vw, 150px), 1fr));
    gap: 12px;
    margin: 20px 0;
}

.game-actions.active {
    display: grid;
}

.action-btn {
    padding: clamp(14px, 3.5vw, 16px);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    touch-action: manipulation;
    min-height: 52px;
}

.action-btn.hit {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.action-btn.stand {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
    color: white;
}

.action-btn.double {
    background: linear-gradient(135deg, var(--gold), #cc9900);
    color: var(--dark);
}

.action-btn.split {
    background: linear-gradient(135deg, #17a2b8, #117a8b);
    color: white;
    transition: all 0.3s, box-shadow 0.3s, border-color 0.3s;
    border: 3px solid transparent;
}

/* Bouton Split disponible — contour doré pulsant */
.action-btn.split.can-split-btn {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(255,215,0,0.4), 0 0 16px rgba(255,215,0,0.5);
    animation: splitBtnPulse 1.4s ease-in-out infinite;
}

@keyframes splitBtnPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255,215,0,0.4), 0 0 16px rgba(255,215,0,0.5); }
    50%       { box-shadow: 0 0 0 3px rgba(255,215,0,0.7), 0 0 28px rgba(255,215,0,0.8); }
}

/* Cartes du joueur encadrées en jaune quand split possible */
.card.can-split {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(255,215,0,0.7), 0 5px 15px rgba(0,0,0,0.3);
    animation: cardSplitPulse 1.4s ease-in-out infinite;
}

@keyframes cardSplitPulse {
    0%, 100% { outline-color: var(--gold); box-shadow: 0 0 10px rgba(255,215,0,0.6), 0 5px 15px rgba(0,0,0,0.3); }
    50%       { outline-color: #ffe866;    box-shadow: 0 0 22px rgba(255,215,0,0.95), 0 5px 15px rgba(0,0,0,0.3); }
}

.action-btn.surrender {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== MODALS ==================== */
.result-modal, .gameover-modal, .settings-modal, .rules-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

/* Overlay toujours semi-transparent pour la modale résultat :
   le joueur voit les cartes derrière à chaque partie */
.result-modal {
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Les autres modales gardent un fond sombre opaque */
.gameover-modal, .settings-modal, .rules-modal {
    background: rgba(0,0,0,0.85);
}

.result-modal.show, .gameover-modal.show, .settings-modal.show, .rules-modal.show {
    display: flex;
}

.result-content, .gameover-content, .settings-content, .rules-content {
    background: linear-gradient(135deg, var(--dark), #16213e);
    padding: clamp(20px, 5vw, 50px);
    border-radius: 30px;
    text-align: center;
    animation: scaleIn 0.5s;
    border: 3px solid var(--gold);
    max-width: 500px;
    width: 90%;
}

/* result-content : fond 100 % opaque + ombre forte pour se détacher
   de l'overlay translucide de la modale résultat */
.result-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    box-shadow:
        0 0 0 1px rgba(255,215,0,0.25),
        0 20px 60px rgba(0,0,0,0.9),
        0 0 40px rgba(0,0,0,0.6);
}

/* ==================== PARAMÈTRES : SCROLL MOBILE ==================== */
.settings-modal {
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.settings-content {
    overflow-y: auto;
    max-height: calc(100dvh - 40px);
    /* Scrollbar visible sur tous navigateurs */
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(255,255,255,0.1);
    /* iOS rubber-band scroll dans la modale */
    -webkit-overflow-scrolling: touch;
    /* Centrage vertical si la fenêtre est assez grande */
    margin: auto;
}

.settings-content::-webkit-scrollbar {
    width: 8px;
}
.settings-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}
.settings-content::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
    background: #ffaa00;
}

@keyframes scaleIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.result-icon, .gameover-icon {
    font-size: clamp(3rem, 10vw, 5rem);
    margin-bottom: 15px;
}

.result-title, .gameover-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    margin-bottom: 12px;
    color: var(--gold);
    font-weight: bold;
}

.result-title.win { color: #28a745; }
.result-title.lose { color: #dc3545; }
.result-title.push { color: #ffc107; }
.result-title.blackjack { color: var(--gold); }

.gameover-title {
    color: var(--red);
}

.result-amount {
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: var(--gold);
    margin-bottom: 20px;
}

.gameover-message {
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: #fff;
    margin-bottom: 20px;
    line-height: 1.6;
}

.gameover-stats {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.gameover-stat {
    color: #aaa;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    margin: 8px 0;
}

.gameover-stat strong {
    color: var(--gold);
}

.bonus-results {
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    padding: 15px;
    margin: 15px 0;
    display: none;
}

.bonus-results.show {
    display: block;
}

.bonus-result-item {
    color: white;
    padding: 8px;
    margin: 5px 0;
    border-radius: 8px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

.bonus-result-item.win {
    background: rgba(40,167,69,0.3);
    border-left: 4px solid #28a745;
}

.result-btn {
    padding: clamp(14px, 3.5vw, 16px) clamp(35px, 9vw, 55px);
    font-size: clamp(1rem, 3vw, 1.2rem);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--gold), #ffaa00);
    color: var(--dark);
    font-weight: bold;
    transition: all 0.3s;
    margin: 5px;
    touch-action: manipulation;
    min-height: 52px;
}

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

/* ==================== PARAMÈTRES ==================== */
.settings-content, .rules-content {
    max-width: 500px;
}

.rules-content {
    max-width: 700px;
    text-align: left;
}

.settings-title, .rules-title {
    color: var(--gold);
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin-bottom: 25px;
    text-align: center;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-label {
    color: white;
    margin-bottom: 8px;
    display: block;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.setting-select, .setting-input {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 2px solid #333;
    background: #1a1a2e;
    color: white;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    min-height: 48px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
}

.toggle-switch {
    width: 64px;
    height: 34px;
    background: #333;
    border-radius: 17px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: var(--primary-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-switch.active::after {
    transform: translateX(30px);
}

.table-color-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    min-height: 48px;
    border-radius: 10px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    touch-action: manipulation;
}

.color-option:active {
    transform: scale(0.9);
}

.color-option.active {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255,215,0,0.5);
}

.color-option.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.color-option.green {
    background: linear-gradient(135deg, #1a5f2a, #0d3314);
}

.color-option.blue {
    background: linear-gradient(135deg, #1a4a8e, #0d2847);
}

.color-option.red {
    background: linear-gradient(135deg, #8e1a1a, #470d0d);
}

.color-option.purple {
    background: linear-gradient(135deg, #5a1a8e, #2d0d47);
}

.color-option.gold {
    background: linear-gradient(135deg, #8e6a1a, #473510);
}

.settings-close {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    border: none;
    border-radius: 15px;
    background: var(--gold);
    color: var(--dark);
    font-weight: bold;
    font-size: clamp(1rem, 3vw, 1.1rem);
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    min-height: 52px;
}

.settings-close:active {
    transform: scale(0.98);
}

/* ==================== RÈGLES ==================== */
.rule-section {
    margin-bottom: 20px;
}

.rule-section h3 {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.rule-section ul, .rule-section ol {
    padding-left: 20px;
}

.rule-section li {
    margin-bottom: 8px;
    color: #ccc;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

/* ==================== STATISTIQUES ==================== */
.stats-panel {
    position: fixed;
    right: -100%;
    top: 0;
    height: 100%;
    width: min(350px, 85vw);
    background: linear-gradient(180deg, var(--dark), #16213e);
    padding: 25px;
    transition: right 0.3s;
    z-index: 999;
    overflow-y: auto;
}

.stats-panel.open {
    right: 0;
}

.stats-panel-title {
    color: var(--gold);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin-bottom: 25px;
    text-align: center;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

.stat-row .label {
    color: #aaa;
}

.stat-row .value {
    font-weight: bold;
}

.stat-row .value.positive { color: #28a745; }
.stat-row .value.negative { color: #dc3545; }

.stats-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
}

/* ==================== COMPTEUR CARTES ==================== */
.card-counter {
    position: fixed;
    bottom: 80px;
    left: 15px;
    background: rgba(0,0,0,0.8);
    padding: 15px;
    border-radius: 15px;
    color: white;
    display: none;
    z-index: 998;
}

.card-counter.show {
    display: block;
}

.counter-title {
    color: var(--gold);
    margin-bottom: 8px;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
}

.counter-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
    text-align: center;
}

.counter-value.positive { color: #28a745; }
.counter-value.negative { color: #dc3545; }
.counter-value.neutral { color: white; }

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    z-index: 998;
}

.quick-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: clamp(1.3rem, 3.5vw, 1.6rem);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.quick-btn:active {
    background: var(--primary-color);
    transform: scale(0.9);
}

/* ==================== HISTORY ==================== */
.history-container {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.history-item {
    width: clamp(25px, 6vw, 30px);
    height: clamp(25px, 6vw, 30px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    font-weight: bold;
}

.history-item.win { background: #28a745; color: white; }
.history-item.lose { background: #dc3545; color: white; }
.history-item.push { background: #ffc107; color: #333; }

/* ==================== CONFETTI ==================== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== GAME MODE BADGE ==================== */
.game-mode-badge {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold), #cc9900);
    color: var(--dark);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
}


/* ==================== WIDGET SOUTIEN ==================== */
.support-widget {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    max-width: 260px;
    font-family: system-ui,-apple-system,sans-serif;
    color: #e5e7eb;
}

.support-card {
    background: radial-gradient(circle at top left, rgba(34,211,238,0.25), rgba(15,23,42,0.96));
    border-radius: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(34,211,238,0.4);
    box-shadow: 0 12px 30px rgba(15,23,42,0.9);
    font-size: 0.78rem;
    line-height: 1.4;
    position: relative;
}

.support-card-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: #f9fafb;
}

.support-card-text {
    color: #cbd5f5;
    margin-bottom: 0.5rem;
}

.support-card-text span {
    color: #22d3ee;
}

.support-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: linear-gradient(135deg,#22d3ee,#4ade80);
    color: #0b1120;
    font-weight: 600;
    font-size: 0.75rem;
    text-decoration: none;
    box-shadow: 0 0 20px rgba(34,197,94,0.55);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    white-space: nowrap;
}

.support-card-button:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 24px rgba(34,197,94,0.75);
}

.support-card-close {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(148,163,184,0.7);
    color: #9ca3af;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ==================== SIGNATURE ==================== */
#vs-signature {
    position: fixed;
    bottom: 10px;
    right: 15px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    z-index: 9999;
    pointer-events: none;
    user-select: none;
    letter-spacing: 1px;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

/* ==================== BOUTON ARCADE ==================== */
.arcade-header-btn {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a1a2e;
    background: linear-gradient(135deg, #00e8c8, #6366f1);
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    text-decoration: none;
    box-shadow: 0 0 12px rgba(0,232,200,0.45);
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap;
    touch-action: manipulation;
    display: inline-block;
}
.arcade-header-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0,232,200,0.7);
}

.arcade-menu-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    background: linear-gradient(135deg, #00e8c8, #6366f1) !important;
    color: #1a1a2e !important;
}

/* ==================== BOUTONS PARTAGE & SOUTIEN (modal résultat) ==================== */
.result-extra-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 14px 0 4px;
}

.result-share-btn {
    font-family: inherit;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    border-radius: 50px;
    padding: 13px 22px;
    cursor: pointer;
    background: linear-gradient(135deg, #1d9bf0, #5865f2);
    color: #fff;
    box-shadow: 0 0 16px rgba(29,155,240,0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    touch-action: manipulation;
    min-height: 48px;
    width: 100%;
}
.result-share-btn:hover  { box-shadow: 0 0 24px rgba(29,155,240,0.65); transform: scale(1.02); }
.result-share-btn:active { transform: scale(0.96); }

.result-tip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: clamp(0.72rem, 2.3vw, 0.8rem);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: none;
    border-radius: 50px;
    padding: 13px 22px;
    cursor: pointer;
    background: linear-gradient(135deg, #fbbf24, #f97316);
    color: #1a1a2e;
    box-shadow: 0 0 14px rgba(251,191,36,0.35);
    transition: transform 0.1s, box-shadow 0.1s;
    touch-action: manipulation;
    min-height: 48px;
    width: 100%;
    text-decoration: none;
}
.result-tip-btn:hover  { box-shadow: 0 0 22px rgba(251,191,36,0.6); transform: scale(1.02); }
.result-tip-btn:active { transform: scale(0.96); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }

    .stats-bar {
        margin-right: 60px;
    }

    .game-table {
        margin: 10px auto;
    }

    .card-counter {
        bottom: 80px;
        left: 10px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        width: 100%;
        justify-content: center;
        margin-right: 0;
    }

    .settings-btn-header {
        top: 10px;
        transform: none;
    }

    .betting-layout {
        gap: 15px;
    }

    .bet-actions {
        gap: 10px;
    }

    .support-widget {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        max-width: none;
    }
}