:root {
    --gold: #f39c12;
    --gold-glow: #f1c40f;
    --bg-dark: #0a0d14;
    --panel-bg: rgba(20, 27, 38, 0.95);
    --felt-green: radial-gradient(circle, #185a2b 0%, #0c3317 80%, #05180c 100%);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; user-select: none; }

body {
    background: var(--bg-dark);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.auth-landing {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1c2636 0%, #0a0d14 100%);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; padding: 20px;
}

.auth-box {
    background: var(--panel-bg); border: 2px solid var(--gold); border-radius: 20px;
    padding: 35px; width: 100%; max-width: 480px; box-shadow: 0 15px 40px rgba(0,0,0,0.9);
    text-align: center; backdrop-filter: blur(10px);
}

.auth-logo { font-size: 2.2rem; font-weight: bold; color: var(--gold); margin-bottom: 5px; text-shadow: 0 0 15px rgba(243, 156, 18, 0.4); }
.auth-subtitle { font-size: 0.9rem; color: #bdc3c7; margin-bottom: 25px; }

.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: #bdc3c7; font-weight: 600; }
.form-control {
    width: 100%; padding: 12px 16px; background: #080b10; border: 1px solid #34495e;
    border-radius: 8px; color: white; font-size: 1rem; transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--gold); outline: none; }

.gender-selector { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-gender {
    flex: 1; padding: 10px; border: 1px solid #34495e; background: #080b10; color: #fff;
    border-radius: 8px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.2s;
}
.btn-gender.active { border-color: var(--gold); background: rgba(243, 156, 18, 0.2); color: var(--gold-glow); }

.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 20px; }
.avatar-card {
    font-size: 2.2rem; padding: 12px 8px; border: 2px solid #2c3e50; border-radius: 12px;
    cursor: pointer; transition: all 0.2s; background: #080b10; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.avatar-card span.label { font-size: 0.7rem; color: #bdc3c7; }
.avatar-card:hover, .avatar-card.selected { border-color: var(--gold); background: rgba(241, 196, 15, 0.2); transform: translateY(-2px); }

.game-container { flex: 1; display: flex; flex-direction: column; height: 100vh; }

.top-bar {
    background: linear-gradient(180deg, #1c2430 0%, #121822 100%);
    border-bottom: 2px solid #2c3e50; padding: 10px 20px; display: flex;
    justify-content: space-between; align-items: center; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 100;
}

.brand { font-size: 1.4rem; font-weight: bold; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.user-profile { display: flex; align-items: center; gap: 15px; }
.avatar-badge {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold);
    background: #2c3e50; display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-weight: bold; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
.user-title { font-size: 0.75rem; color: #bdc3c7; background: #34495e; padding: 2px 6px; border-radius: 4px; }

.stat-pill {
    background: rgba(0,0,0,0.4); padding: 6px 12px; border-radius: 20px;
    border: 1px solid rgba(241, 196, 15, 0.3); font-weight: bold; color: var(--gold-glow);
}

.xp-container { width: 100px; height: 8px; background: #2c3e50; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.xp-fill { height: 100%; background: linear-gradient(90deg, #3498db, #2ecc71); width: 0%; }

.btn {
    padding: 10px 18px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer;
    transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-gold { background: linear-gradient(180deg, #f39c12, #d35400); color: #fff; }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4); }
.btn-danger { background: #c0392b; color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-secondary { background: #34495e; color: white; }

.poker-arena { flex: 1; display: flex; justify-content: center; align-items: center; position: relative; padding: 50px 20px; overflow: hidden; }

.table-felt {
    width: 900px; height: 460px; background: var(--felt-green);
    border-radius: 230px; border: 18px solid #3d2314;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.8), 0 15px 35px rgba(0,0,0,0.7);
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.table-line { position: absolute; width: 84%; height: 84%; border: 2px solid rgba(255,255,255,0.15); border-radius: 200px; pointer-events: none; }
.community-area { display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 10; }
.pot-display { background: rgba(0,0,0,0.7); padding: 8px 20px; border-radius: 20px; border: 1px solid var(--gold); font-weight: bold; font-size: 1.05rem; color: var(--gold-glow); }
.community-cards { display: flex; gap: 8px; min-height: 88px; }

.deck { position: absolute; left: 215px; top: 50%; width: 60px; height: 88px; transform: translateY(-50%); border-radius: 6px;
    background: linear-gradient(135deg, #b91d1d, #7f1d1d); border: 2px solid #fff; box-shadow: 2px 2px 0 #7f1d1d, 4px 4px 0 #5a1515, 0 6px 14px rgba(0,0,0,.6); }

.dealer-btn { position: absolute; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #111; font-weight: 800; font-size: .85rem;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,.6); z-index: 14;
    transition: left .6s ease, top .6s ease, bottom .6s ease, right .6s ease; left: 50%; top: 50%; }

/* mises devant chaque joueur */
.bet-chip { position: absolute; display: none; align-items: center; gap: 6px; background: rgba(0,0,0,.8); border: 2px solid var(--gold);
    color: var(--gold-glow); padding: 3px 10px; border-radius: 15px; font-size: .85rem; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,.7); z-index: 12; }
.bet-chip.pop { animation: chipPop .3s ease; }
@keyframes chipPop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.bet-seat-0 { left: calc(50% + 100px); bottom: 70px; }
.bet-seat-1 { left: 150px; top: calc(50% - 14px); }
.bet-seat-2 { left: calc(50% + 100px); top: 70px; }
.bet-seat-3 { right: 150px; top: calc(50% - 14px); }

.action-badge { position: absolute; top: -24px; left: 50%; transform: translateX(-50%); background: #2980b9; color: #fff; font-size: .75rem; font-weight: bold;
    padding: 2px 9px; border-radius: 10px; border: 1px solid #fff; display: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 30; }
.action-badge.fold { background: #7f8c8d; } .action-badge.raise { background: #d35400; } .action-badge.call { background: #27ae60; }
.action-badge.allin { background: linear-gradient(90deg,#c0392b,#e67e22); animation: pulse 1s infinite; }
.action-badge.thinking { background: #34495e; }
.action-badge.show { animation: badgeIn .25s ease; }
@keyframes badgeIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse { 50% { box-shadow: 0 0 14px #e67e22; } }

.role-tag { position: absolute; right: -8px; bottom: -8px; display: flex; gap: 3px; }
.role-tag span { background: #8e44ad; color: #fff; font-size: .65rem; font-weight: 800; padding: 1px 6px; border-radius: 8px; border: 1px solid #fff; }
.role-tag span.bb { background: #2980b9; }

.seat-timer-bg { width: 100%; height: 5px; background: #34495e; border-radius: 3px; margin-top: 5px; overflow: hidden; display: none; }
.seat-timer-fill { height: 100%; width: 100%; background: var(--gold-glow); box-shadow: 0 0 6px var(--gold); }

/* cartes : recto/verso avec flip 3D */
.card { width: 60px; height: 88px; perspective: 700px; position: relative; flex: none; }
.card .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3,.7,.3,1); }
.card.up .inner { transform: rotateY(180deg); }
.card .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6px; box-shadow: var(--card-shadow); }
.card .back { background: repeating-linear-gradient(45deg, #b91d1d 0 6px, #8e1616 6px 12px); border: 3px solid #fff; }
.card .front { transform: rotateY(180deg); background: #fff; padding: 5px; display: flex; flex-direction: column; justify-content: space-between; font-weight: bold; font-size: 1.1rem; }
.card .front .big { align-self: center; font-size: 1.9rem; line-height: 1; }
.card.red .front { color: #e74c3c; } .card.black .front { color: #2c3e50; }
.card.dim { filter: brightness(.45); transition: filter .4s; }
.card.win .face { box-shadow: 0 0 0 3px var(--gold-glow), 0 0 18px var(--gold-glow); }
.card.win { transform: translateY(-8px); transition: transform .4s; }

.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat-0 { bottom: -25px; left: 50%; margin-left: -70px; }
.seat-1 { left: -30px; top: 50%; transform: translateY(-50%); }
.seat-2 { top: -25px; left: 50%; margin-left: -70px; }
.seat-3 { right: -30px; top: 50%; transform: translateY(-50%); }
.seat-0, .seat-2 { width: 140px; }

.player-box { background: var(--panel-bg); border: 2px solid #34495e; border-radius: 12px; padding: 8px 14px; text-align: center; min-width: 120px;
    box-shadow: 0 4px 15px rgba(0,0,0,.5); position: relative; transition: all .3s; }
.seat-name { font-weight: bold; } .seat-chips { font-size: .85rem; color: #2ecc71; }
#name-0 { color: var(--gold); }
.seat.active-turn .player-box { border-color: var(--gold); box-shadow: 0 0 20px var(--gold-glow); transform: scale(1.05); }
.seat.winner .player-box { border-color: #2ecc71; box-shadow: 0 0 26px #2ecc71; animation: winPulse 1s ease 3; }
@keyframes winPulse { 50% { transform: scale(1.1); } }
.seat.out-hand .player-box { opacity: .55; }

.player-cards { display: flex; gap: 4px; margin-bottom: -15px; z-index: 5; min-height: 88px; transition: opacity .4s, transform .4s; }
.player-cards.folded { opacity: .25; transform: translateY(14px) scale(.85); }

/* barre de contrôles */
.controls-bar { background: #161f2c; padding: 12px 15px; border-top: 2px solid #2c3e50; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; position: relative; }
.controls-bar.disabled { opacity: .45; pointer-events: none; }
.controls-bar.disabled #raiseBox, .controls-bar.disabled .btn-allin { filter: grayscale(.6); }
.ctrl-info { position: absolute; left: 15px; top: -30px; font-size: .85rem; color: #bdc3c7; background: rgba(0,0,0,.6); padding: 3px 10px; border-radius: 10px; display: none; }
.raise-box { display: flex; flex-direction: column; gap: 6px; background: #0f141d; padding: 6px 14px; border-radius: 16px; }
.raise-row { display: flex; align-items: center; gap: 10px; }
.presets { display: flex; gap: 6px; justify-content: center; }
.btn-mini { background: #2c3e50; color: #fff; border: none; border-radius: 10px; padding: 2px 9px; font-size: .75rem; cursor: pointer; }
.btn-mini:hover { background: #34495e; }
.btn-allin { background: linear-gradient(180deg, #e74c3c, #962d22); color: #fff; box-shadow: 0 0 0 2px #f1c40f inset; letter-spacing: 1px; }
.btn-allin:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px #f1c40f inset, 0 4px 14px rgba(231,76,60,.6); }
.btn[hidden], .raise-box[hidden], .btn-allin[hidden] { display: none !important; }
.emotes { display: flex; gap: 5px; margin-left: 10px; }

/* résultat de la main */
.result-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); z-index: 40; min-width: 380px; max-width: 520px; text-align: center;
    background: rgba(10,13,20,.94); border: 2px solid var(--gold); border-radius: 16px; padding: 16px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.8);
    opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
.result-banner.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.result-title { font-size: 1.3rem; font-weight: 800; color: var(--gold-glow); margin-bottom: 8px; }
.result-title.lose { color: #e74c3c; }
.result-lines { font-size: .9rem; color: #dfe6e9; margin-bottom: 12px; line-height: 1.5; }

/* toasts */
#toasts { position: fixed; top: 70px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 5000; pointer-events: none; }
.toast { background: rgba(20,27,38,.97); border: 1px solid var(--gold); border-left: 5px solid var(--gold); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem;
    box-shadow: 0 6px 20px rgba(0,0,0,.6); animation: toastIn .3s ease; max-width: 320px; }
.toast.success { border-color: #2ecc71; } .toast.error { border-color: #e74c3c; }
.toast.out { opacity: 0; transform: translateX(30px); transition: all .35s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.fly { position: fixed; z-index: 4000; pointer-events: none; font-weight: 800; color: var(--gold-glow); text-shadow: 0 2px 6px #000; font-size: 1.05rem; white-space: nowrap; }
.emote-bubble { position: absolute; top: -52px; left: 50%; font-size: 2.2rem; z-index: 50; pointer-events: none; animation: emoteUp 1.8s ease forwards; }
@keyframes emoteUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.5); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -40px) scale(1); } }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; justify-content: center; align-items: center; z-index: 3000; opacity: 0; pointer-events: none; transition: opacity .3s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-card { background: var(--panel-bg); border: 2px solid var(--gold); border-radius: 16px; padding: 30px; width: 90%; max-width: 420px; text-align: center; }
