/* ============================================================
   KODEN GAME KIT — Direction B : Premium Dark (épuré)
   Pas de néon ni de glow : surfaces plates, contrastes doux,
   un seul accent par jeu. Seul effet conservé : la pluie de k-coins.
   ============================================================ */
:root {
    --gk-bg:        #0d0f14;
    --gk-surface:   #151821;
    --gk-surface-2: #1b1f2a;
    --gk-surface-3: #232838;
    --gk-line:      rgba(255,255,255,0.06);
    --gk-line-hi:   rgba(255,255,255,0.12);
    --gk-accent:    #8b5cf6;           /* surchargé par jeu via --gk-accent */
    --gk-accent-ink:#ffffff;
    --gk-gold:      #fbbf24;
    --gk-green:     #2fbf71;
    --gk-red:       #e5484d;
    --gk-text:      #eef0f4;
    --gk-muted:     #8a90a0;
    --gk-r-sm: 8px; --gk-r-md: 12px; --gk-r-lg: 16px;
    --gk-ease: cubic-bezier(.22,1,.36,1);
}

/* ---------- Surfaces (Style Blackjack #0f1923 Uniformisé) ---------- */
.gk-panel {
    background: var(--gk-surface);
    border: 1px solid var(--gk-line);
    border-radius: var(--gk-r-lg);
}
.gk-viewport,
.gk-stage,
main > section {
    position: relative;
    overflow: hidden;
    background: #0f1923 !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.35), 0 20px 50px rgba(0, 0, 0, 0.6) !important;
}

/* ---------- Boutons ---------- */
.gk-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    width: 100%; padding: 14px 18px; border: none; cursor: pointer;
    font-weight: 800; font-size: 13px; letter-spacing: .02em;
    color: var(--gk-accent-ink); border-radius: var(--gk-r-md);
    background: var(--gk-accent);
    transition: filter .15s, transform .1s, background .15s;
}
.gk-btn:hover { filter: brightness(1.1); }
.gk-btn:active { transform: scale(.98); }
.gk-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
.gk-btn-green { background: var(--gk-green); color: #06150c; }
.gk-btn-red   { background: var(--gk-red); }
.gk-btn-gold  { background: var(--gk-gold); color: #1a1205; }
.gk-btn-ghost { background: var(--gk-surface-2); color: var(--gk-text); border: 1px solid var(--gk-line); }

.gk-pill {
    padding: 8px 10px; border-radius: var(--gk-r-sm); cursor: pointer;
    background: var(--gk-surface-2); border: 1px solid var(--gk-line);
    color: var(--gk-muted); font-weight: 700; font-size: 12px; text-align: center;
    transition: background .15s, color .15s;
}
.gk-pill:hover { color: var(--gk-text); background: var(--gk-surface-3); }

/* ---------- Champs ---------- */
.gk-input {
    width: 100%; padding: 12px 14px; border-radius: var(--gk-r-md);
    background: var(--gk-bg); border: 1px solid var(--gk-line); color: var(--gk-text);
    font-weight: 700; font-size: 14px; outline: none; transition: border-color .15s;
}
.gk-input:focus { border-color: var(--gk-line-hi); }
.gk-input:disabled { opacity: .5; }

/* ---------- Stats ---------- */
.gk-stat {
    background: var(--gk-surface-2); border: 1px solid var(--gk-line);
    border-radius: var(--gk-r-md); padding: 10px 12px;
}
.gk-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gk-muted); }
.gk-num   { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; }
.gk-countup { font-variant-numeric: tabular-nums; }

/* ---------- Pluie de k-coins (seul effet de victoire) ---------- */
.gk-fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9000; overflow: hidden; }
.gk-coin {
    position: absolute; top: -40px; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font: 900 12px/1 ui-sans-serif, system-ui, sans-serif; color: #7a4a06;
    background: radial-gradient(circle at 35% 30%, #fff3c4, #fbbf24 50%, #c07a10 100%);
    box-shadow: inset 0 -2px 3px rgba(120,60,10,.5), 0 2px 4px rgba(0,0,0,.35);
    will-change: transform;
}
@keyframes gk-coin-fall {
    0%   { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(110vh) rotate(540deg); }
}

@media (prefers-reduced-motion: reduce) {
    .gk-fx-layer { display: none; }
}

/* Garde la classe utilitaire .hidden prioritaire sur les boutons du kit. */
.gk-btn.hidden, .gk-stat.hidden { display: none; }

/* ============================================================
   BOUTONS D'ACTION KODEN — base pour tous les jeux
   Vert ou violet au repos ; néon au survol, plus intense au clic.
   Usage : <button class="kd-btn kd-btn-green">Jouer</button>
   ============================================================ */
.kd-btn {
    position: relative; width: 100%; height: 52px; border: 0; border-radius: 12px; cursor: pointer;
    font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .06em; font-size: 14px;
    transition: box-shadow .18s ease, filter .18s ease, transform .08s ease;
}
.kd-btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.3); box-shadow: none !important; }
.kd-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.kd-btn.hidden { display: none; }

.kd-btn-green {
    color: #04260a;
    background: linear-gradient(180deg, #19ff1a 0%, #00e701 55%, #00c401 100%);
    box-shadow: 0 4px 0 #009a01;
}
.kd-btn-green:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 4px 0 #009a01, 0 0 18px rgba(0,231,1,.55), 0 0 42px rgba(0,231,1,.28);
}
.kd-btn-green:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #009a01, 0 0 26px rgba(0,231,1,.8), 0 0 60px rgba(0,231,1,.4);
}

.kd-btn-violet {
    color: #fff;
    background: linear-gradient(180deg, #a07bff 0%, #8b5cf6 55%, #7341ea 100%);
    box-shadow: 0 4px 0 #5b2fc4;
}
.kd-btn-violet:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: 0 4px 0 #5b2fc4, 0 0 18px rgba(139,92,246,.6), 0 0 42px rgba(139,92,246,.3);
}
.kd-btn-violet:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #5b2fc4, 0 0 26px rgba(139,92,246,.85), 0 0 60px rgba(139,92,246,.45);
}

@media (prefers-reduced-motion: reduce) {
    .kd-btn { transition: none; }
}

/* ============================================================
   LIVE STATS CARD — Amovible (Stake Style)
   Positionnée par défaut à droite du plateau de jeu, déplaçable.
   ============================================================ */
.gk-livestats {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 260px;
    background: #151822;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.4);
    z-index: 35;
    user-select: none;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.gk-livestats.gk-dragging {
    box-shadow: 0 28px 65px rgba(0, 0, 0, 0.85), 0 0 20px rgba(0, 231, 1, 0.15);
    border-color: rgba(0, 231, 1, 0.3);
    transition: none;
}
.gk-livestats.hidden {
    display: none !important;
}

.gk-ls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: #11141d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: grab;
}
.gk-ls-header:active {
    cursor: grabbing;
}
.gk-ls-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
    color: #eef0f4;
    letter-spacing: 0.02em;
}
.gk-ls-title svg {
    width: 14px;
    height: 14px;
    color: #00e701;
}
.gk-ls-close {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #71717a;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.gk-ls-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.gk-ls-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gk-ls-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.gk-ls-badge {
    flex: 1;
    background: #0e1017;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 800;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gk-ls-reset {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #0e1017;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #8a90a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.gk-ls-reset:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
    transform: rotate(-45deg);
}
.gk-ls-reset:active {
    transform: rotate(-180deg) scale(0.92);
}

.gk-ls-grid {
    background: #0e1017;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 11px 12px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 10px;
    position: relative;
}
.gk-ls-grid::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 58%;
    width: 1px;
    background: rgba(255, 255, 255, 0.06);
}
.gk-ls-col {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}
.gk-ls-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gk-ls-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #8a90a0;
    letter-spacing: 0.03em;
}
.gk-ls-val {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gk-ls-val img {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.gk-ls-val.pos { color: #00e701; }
.gk-ls-val.neg { color: #ef4444; }
.gk-ls-val.neu { color: #eef0f4; }

.gk-ls-chart-box {
    background: #0e1017;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    height: 135px;
    position: relative;
}
.gk-ls-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}
.gk-ls-tip {
    position: absolute;
    top: 8px;
    left: 10px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(18, 20, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9px;
    font-weight: 800;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
}
.gk-ls-tip.show {
    opacity: 1;
}

.gk-ls-reopen {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border-radius: 12px;
    background: #151822;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}
.gk-ls-reopen:hover {
    border-color: #00e701;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 231, 1, 0.25);
}
.gk-ls-reopen svg {
    width: 13px;
    height: 13px;
    color: #00e701;
}
.gk-ls-reopen.hidden {
    display: none !important;
}

@media (max-width: 1150px) {
    .gk-livestats {
        width: 225px;
        right: 12px;
    }
}
@media (max-width: 768px) {
    .gk-livestats {
        right: 10px;
        top: auto;
        bottom: 10px;
        transform: none;
    }
}

/* ============================================================
   PILE DE JETONS DE CASINO 3D — Universel (Style Blackjack)
   Positionnée en bas à gauche de la table de jeu (.gk-chip-pot)
   ============================================================ */
.gk-chip-pot {
    position: absolute;
    bottom: 20px;
    left: 24px;
    z-index: 25;
    display: flex;
    align-items: center;
    pointer-events: none;
    user-select: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
@media (max-width: 640px) {
    .gk-chip-pot {
        display: none !important;
    }
}

.casino-chip-3d {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 900;
    font-size: 9px;
    color: #fff;
    box-shadow:
        0 4px 0 rgba(0, 0, 0, 0.55),
        0 8px 14px rgba(0, 0, 0, 0.65),
        inset 0 2px 4px rgba(255, 255, 255, 0.35);
    position: relative;
    user-select: none;
}
.casino-chip-3d::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    pointer-events: none;
}
@keyframes chipDropIn {
    0%   { transform: translateY(-35px) scale(1.25); opacity: 0; }
    70%  { transform: translateY(2px) scale(0.96); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.chip-drop-anim {
    animation: chipDropIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* ============================================================
   MESSAGE DE RÉSULTAT / WIN MIS EN SCÈNE (Style Blackjack)
   ============================================================ */
.ck-result {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 45;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.88);
    opacity: 0;
    min-width: 220px;
    padding: 16px 28px;
    border-radius: 20px;
    text-align: center;
    background: rgba(15, 25, 35, 0.96);
    border: 2px solid #00e701;
    box-shadow: 0 0 35px rgba(0, 231, 1, 0.32), 0 20px 50px rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ck-result.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.ck-result .ck-r-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: rgba(0, 231, 1, 0.15);
    color: #00e701;
    border: 1px solid rgba(0, 231, 1, 0.35);
    margin-bottom: 5px;
}
.ck-result .ck-r-mult {
    font: 900 italic 26px/1.05 ui-sans-serif, system-ui, sans-serif;
    color: #00e701;
    text-transform: uppercase;
}
.ck-result .ck-r-win {
    margin-top: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 800;
    font-size: 13px;
    color: #00e701;
}
.ck-result.lose {
    border-color: #ef4444;
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.28), 0 20px 50px rgba(0, 0, 0, 0.78);
}
.ck-result.lose .ck-r-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
}
.ck-result.lose .ck-r-mult {
    color: #ef4444;
    font-size: 24px;
}
.ck-result.lose .ck-r-win {
    color: #fca5a5;
}
.ck-result.push {
    border-color: #f59e0b;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.25), 0 20px 50px rgba(0, 0, 0, 0.78);
}
.ck-result.push .ck-r-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}
.ck-result.push .ck-r-mult {
    color: #fbbf24;
    font-size: 24px;
}
.ck-result.push .ck-r-win {
    color: #fef3c7;
}
