/* ══════════════════════════════════════════
   THÈMES — Variables CSS
══════════════════════════════════════════ */
:root,
[data-theme="sombre"] {
    --bg-body: #0b1120;
    --bg-grad-bottom: #1e293b;
    --bg-grad-mid: #0f172a;
    --bg-grad-top: #0b1120;
    --bg-dots: rgba(255, 255, 255, 0.035);
    --header-tint: rgba(6, 18, 34, 1);
    --header-tint-75: rgba(6, 18, 34, 0.75);
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --accent-text: #ffffff;
    --collect-bg: linear-gradient(180deg, rgba(42, 86, 120, 0.38) 0%, rgba(25, 58, 84, 0.42) 100%);
    --collect-border: rgba(75, 140, 185, 0.35);
    --collect-color: #729ebc;
    --collect-active-bg: linear-gradient(180deg, rgba(50, 130, 200, 0.72) 0%, rgba(26, 85, 145, 0.78) 100%);
    --collect-active-border: rgba(130, 205, 255, 0.60);
    --collect-active-color: #ffffff;
    --collect-active-glow: rgba(28, 90, 155, 0.35);
    --card-bg: rgba(30, 41, 59, 0.35);
    --card-border: rgba(255, 255, 255, 0.12);
    --play-box-bg: rgba(0, 0, 0, 0.55);
    --play-box-border: rgba(255, 255, 255, 0.08);
    --bg-image: url('img_theme2.PNG');
    --bg-image-opacity: 0.35;
    --bg-image-opacity-idle: 0.12;

    /* Variables écran de connexion */
    --login-bg-top: #0f172a;
    --login-bg-bottom: #0b1120;
    --login-accent: #3b82f6;
    --login-accent-dim: #2563eb;
    --login-accent-glow: rgba(59, 130, 246, 0.35);
    --login-accent-text: #ffffff;
    --login-field-border-focus: rgba(59, 130, 246, 0.55);

    /* Variables écran de victoire */
    --win-banner-color: #9be51b;
    --win-mult-bg: #14532d;
    --win-mult-color: #4ade80;
    --replay-btn-bg: linear-gradient(180deg, #5b9ff2 0%, #3578e5 100%);
    --replay-btn-color: #ffffff;
    --replay-btn-shadow: 0 4px 12px rgba(53, 120, 229, 0.35);
    --nouvelle-mise-bg: rgba(0, 0, 0, 0.85);
    --nouvelle-mise-border: rgba(255, 255, 255, 0.45);
    --nouvelle-mise-color: #ffffff;
}

[data-theme="noire"] {
    --bg-body: #0a0a0a;
    --bg-grad-bottom: #1a1a1a;
    --bg-grad-mid: #0f0f0f;
    --bg-grad-top: #0a0a0a;
    --bg-dots: rgba(255, 255, 255, 0.02);
    --header-tint: rgba(10, 10, 10, 1);
    --header-tint-75: rgba(10, 10, 10, 0.75);
    --accent: #eab308;
    --accent-hover: #facc15;
    --accent-glow: rgba(234, 179, 8, 0.5);
    --accent-text: #000000;
    --collect-bg: linear-gradient(180deg, rgba(42, 86, 120, 0.50) 0%, rgba(25, 58, 84, 0.55) 100%);
    --collect-border: rgba(75, 140, 185, 0.32);
    --collect-color: #729ebc;
    --collect-active-bg: linear-gradient(180deg, rgba(234, 179, 8, 0.88) 0%, rgba(180, 130, 0, 0.92) 100%);
    --collect-active-border: rgba(254, 240, 138, 0.7);
    --collect-active-color: #000000;
    --collect-active-glow: rgba(234, 179, 8, 0.45);
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.12);
    --play-box-bg: rgba(0, 0, 0, 0.82);
    --play-box-border: rgba(255, 255, 255, 0.05);
    --bg-image: url('img_theme2.PNG');
    --bg-image-opacity: 0.25;
    --bg-image-opacity-idle: 0.08;

    /* Variables écran de connexion */
    --login-bg-top: #18181b;
    --login-bg-bottom: #09090b;
    --login-accent: #eab308;
    --login-accent-dim: #ca8a04;
    --login-accent-glow: rgba(234, 179, 8, 0.35);
    --login-accent-text: #000000;
    --login-field-border-focus: rgba(234, 179, 8, 0.55);

    /* Variables écran de victoire */
    --win-banner-color: #facc15;
    --win-mult-bg: rgba(85, 65, 0, 0.9);
    --win-mult-color: #fde047;
    --replay-btn-bg: linear-gradient(180deg, #fde047 0%, #eab308 100%);
    --replay-btn-color: #000000;
    --replay-btn-shadow: 0 4px 12px rgba(234, 179, 8, 0.35);
    --nouvelle-mise-bg: rgba(18, 18, 18, 0.9);
    --nouvelle-mise-border: rgba(234, 179, 8, 0.45);
    --nouvelle-mise-color: #ffffff;
}

[data-theme="holon"] {
    --bg-body: #0c1a11;
    --bg-grad-bottom: #11261a;
    --bg-grad-mid: #0d1e14;
    --bg-grad-top: #0c1a11;
    --bg-dots: rgba(255, 255, 255, 0.015);
    --header-tint: rgba(12, 26, 17, 1);
    --header-tint-75: rgba(12, 26, 17, 0.75);
    --accent: #84cc16;
    --accent-hover: #a3e635;
    --accent-glow: rgba(132, 204, 22, 0.55);
    --accent-text: #0b1120;
    --collect-bg: linear-gradient(180deg, rgba(42, 86, 120, 0.50) 0%, rgba(25, 58, 84, 0.55) 100%);
    --collect-border: rgba(75, 140, 185, 0.32);
    --collect-color: #729ebc;
    --collect-active-bg: linear-gradient(180deg, rgba(132, 204, 22, 0.88) 0%, rgba(90, 150, 10, 0.92) 100%);
    --collect-active-border: rgba(217, 249, 157, 0.7);
    --collect-active-color: #0b1120;
    --collect-active-glow: rgba(132, 204, 22, 0.45);
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.12);
    --play-box-bg: rgba(0, 0, 0, 0.78);
    --play-box-border: rgba(255, 255, 255, 0.05);
    --bg-image: url('img_theme2.PNG');
    --bg-image-opacity: 0.35;
    --bg-image-opacity-idle: 0.12;

    /* Variables écran de connexion */
    --login-bg-top: #14171c;
    --login-bg-bottom: #0a0b0d;
    --login-accent: #39ff8c;
    --login-accent-dim: #2ed678;
    --login-accent-glow: rgba(57, 255, 140, 0.35);
    --login-accent-text: #05170c;
    --login-field-border-focus: rgba(57, 255, 140, 0.55);

    /* Variables écran de victoire */
    --win-banner-color: #a3e635;
    --win-mult-bg: rgba(20, 83, 45, 0.9);
    --win-mult-color: #86efac;
    --replay-btn-bg: linear-gradient(180deg, #bef264 0%, #84cc16 100%);
    --replay-btn-color: #0b1120;
    --replay-btn-shadow: 0 4px 12px rgba(132, 204, 22, 0.35);
    --nouvelle-mise-bg: rgba(10, 20, 14, 0.9);
    --nouvelle-mise-border: rgba(132, 204, 22, 0.45);
    --nouvelle-mise-color: #ffffff;
}

/* ══════════════════════════════════════════
   BASE
══════════════════════════════════════════ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    touch-action: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    background-color: var(--bg-body);
    width: 100%;
    color: white;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease;
}

/* ══════════════════════════════════════════
   FOND
══════════════════════════════════════════ */
.game-bg {
    background: var(--bg-body);
    position: relative;
    transition: background 0.4s ease;
}

/* Image de fond */
.game-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    opacity: var(--bg-image-opacity, 0.35);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease;
}

.game-bg.is-idle::after,
.game-bg:has(#gridTrack.idle-mode)::after {
    opacity: var(--bg-image-opacity-idle, 0.12);
}

.game-bg>* {
    position: relative;
    z-index: 1;
}

.game-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--bg-dots) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 1;
}

/* ══════════════════════════════════════════
   HEADER — flottant, déborde sur la 9e ligne
══════════════════════════════════════════ */
.dark-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 76px;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.dark-header button,
.dark-header .balance-badge {
    pointer-events: auto;
}

.dark-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, var(--header-tint) 0%, var(--header-tint) 70%, transparent 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dark-header::after {
    display: none;
}

.balance-badge {
    background: rgba(0, 0, 0, 0.40);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 9999px;
    padding: 2px 3px 2px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.game-subtitle {
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    padding: 2px 0;
    pointer-events: none;
    margin-top: 6px;
}

/* ══════════════════════════════════════════
   ZONE JEU
══════════════════════════════════════════ */
#gameArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ══════════════════════════════════════════
   GRILLE — 9 rangées visibles avec défilement fluide
══════════════════════════════════════════ */
#gridWrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 78px 8px 10px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

#gridTrack {
    display: flex;
    flex-direction: column;
    gap: 1.5px;
    width: 100%;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

/* ══════════════════════════════════════════
   UNE RANGÉE
══════════════════════════════════════════ */
.game-row {
    display: flex;
    align-items: center;
    gap: 4px;
    height: calc((100% - (8 * 1.5px)) / 9);
    flex-shrink: 0;
    width: 100%;
    transition: opacity 0.35s ease;
}

.game-row.row-dim {
    opacity: 0.68;
    transform: scale(0.98);
}

.game-row.row-active {
    opacity: 1;
    transform: scale(1);
}

.game-row.row-done {
    opacity: 1;
    transform: scale(1);
}

/* Multiplicateur / Capsules de côtes */
.row-mult {
    width: 44px;
    height: 28px;
    max-height: 82%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(12, 34, 25, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.75);
    user-select: none;
    box-sizing: border-box;
}

/* En mode IDLE (avant de cliquer sur JOUER) :
   - Toutes les capsules supérieures sont sombres et translucides
   - La capsule du bas est vert vif
   - Les chiffres sont masqués (transparents) */
#gridTrack.idle-mode .row-mult {
    color: transparent !important;
}

#gridTrack.idle-mode .row-mult.locked-mult {
    background: rgba(12, 34, 25, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

#gridTrack.idle-mode .row-mult.active-mult {
    background: #1ca848 !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 10px rgba(28, 168, 72, 0.45);
}

/* En jeu (PLAYING) : affichage des cotes */
.row-mult.locked-mult {
    background: rgba(12, 34, 25, 0.55);
    color: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.row-mult.active-mult {
    background: #1ca848 !important;
    color: #ffffff !important;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 12px rgba(28, 168, 72, 0.55);
}

.row-mult.win-mult {
    background: #14532d !important;
    color: #4ade80 !important;
    font-weight: 700;
    border: 1px solid rgba(74, 222, 128, 0.3);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.row-mult.lose-mult {
    background: rgba(120, 20, 20, 0.6) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Cellules */
.row-cells {
    flex: 1;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5px;
    align-items: center;
}

/* ══════════════════════════════════════════
   CASE — état WOOD (par défaut)
══════════════════════════════════════════ */
.cell {
    height: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.3s ease;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell::before {
    display: none;
}

.cell:active:not(.disabled):not([data-state="GOOD"]):not([data-state="BITTEN"]) {
    transform: scale(0.88);
}

.game-row.row-active .cell[data-state="WOOD"] {
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

.cell.locked {
    cursor: default;
    opacity: 0.72;
    filter: none;
}

.cell.disabled {
    cursor: default;
}

/* ══════════════════════════════════════════
   ÉTAT GOOD — pomme révélée (recouvrement total sans espace)
══════════════════════════════════════════ */
.cell[data-state="GOOD"] {
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: default;
}

/* ══════════════════════════════════════════
   ÉTAT BITTEN — pomme croquée (recouvrement total sans espace)
══════════════════════════════════════════ */
.cell[data-state="BITTEN"] {
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: default;
}

.cell .cell-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

.cell .cell-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.cell[data-state="GOOD"] .cell-icon img,
.cell[data-state="BITTEN"] .cell-icon img {
    filter: brightness(0.78);
    transition: filter 0.25s ease;
}

/* Bannière flottante Gagné ! avec assombrissement de la grille en arrière-plan */
.win-floating-banner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 36px;
    z-index: 60;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.40);
    backdrop-filter: brightness(0.70);
    -webkit-backdrop-filter: brightness(0.70);
    transition: all 0.3s ease;
}

.win-floating-banner.hidden {
    display: none !important;
}

.win-banner-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: #9be51b !important;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 18px rgba(155, 229, 27, 0.6) !important;
    line-height: 1.2;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.win-banner-gains {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
    font-size: 0.92rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.98);
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.22);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shakeCell {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-7px);
    }

    40% {
        transform: translateX(7px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

@keyframes glowGold {

    0%,
    100% {
        box-shadow: inset 0 3px 8px rgba(255, 230, 100, 0.4), 0 0 12px rgba(251, 191, 36, 0.35), 0 5px 12px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: inset 0 3px 8px rgba(255, 230, 100, 0.5), 0 0 26px rgba(251, 191, 36, 0.7), 0 5px 12px rgba(0, 0, 0, 0.4);
    }
}

@keyframes glowRed {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(220, 38, 38, 0.4), 0 5px 12px rgba(0, 0, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 26px rgba(239, 68, 68, 0.75), 0 5px 12px rgba(0, 0, 0, 0.5);
    }
}

@keyframes rowSlideIn {
    from {
        transform: translateY(22px) scale(0.93);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes numPop {
    from {
        transform: scale(0.82);
        opacity: 0.4;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes revealDim {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.45;
    }
}

.anim-pop {
    animation: popIn 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.anim-shake {
    animation: shakeCell 0.45s ease-in-out;
}

.anim-gold {
    animation: none;
}

.anim-red {
    animation: none;
}

@keyframes rowDisappear {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 90px;
        margin-bottom: 0;
    }

    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
        max-height: 0;
        margin-bottom: -6px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.anim-rowin {
    animation: rowSlideIn 0.32s ease forwards;
}

.anim-row-out {
    animation: rowDisappear 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    overflow: hidden;
}

.anim-num {
    animation: numPop 0.22s ease forwards;
}

/* ══════════════════════════════════════════
   OVERLAY VICTOIRE
══════════════════════════════════════════ */
.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.game-overlay.show {
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
}

.overlay-card {
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    animation: fadeSlideIn 0.4s ease forwards;
}

.overlay-card.win-card {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

.overlay-card.lose-card {
    background: rgba(20, 4, 4, 0.90);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.overlay-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 6px;
}

#winOverlay .overlay-title,
.overlay-title.win {
    color: #9BE51B !important;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.7);
    text-shadow:
        0 0 24px rgba(155, 229, 27, 0.65),
        0 3px 8px rgba(0, 0, 0, 0.9),
        -1px -1px 0 rgba(0, 0, 0, 0.85),
        1px -1px 0 rgba(0, 0, 0, 0.85),
        -1px 1px 0 rgba(0, 0, 0, 0.85),
        1px 1px 0 rgba(0, 0, 0, 0.85) !important;
    letter-spacing: 0.02em;
}

.overlay-title.lose {
    color: #f87171;
    text-shadow: 0 0 22px rgba(248, 113, 113, 0.65);
}

.overlay-sub {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.dark-footer {
    background: transparent;
    flex-shrink: 0;
    padding: 4px 20px 14px;
    position: relative;
    z-index: 50;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    /* Pas de backdrop ici — chaque élément enfant a son propre verre */
}

.btn-blue {
    background: var(--accent);
    color: white;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    padding: 10px 0;
    border-radius: 8px;
    border: none;
    transition: all 0.15s ease;
}

.btn-blue:active {
    transform: scale(0.96);
}

.zone-idle-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 8px 8px 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.bet-input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-right: 12px;
}

.bet-input-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
    margin-bottom: 4px;
    cursor: text;
    width: 100%;
}

.bet-input-row input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 1.15rem;
    font-weight: 500;
    padding: 0;
    margin: 0;
    max-width: 150px;
    -moz-appearance: textfield;
}

.bet-input-row input::-webkit-outer-spin-button,
.bet-input-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bet-input-row span,
.bet-input-row .bet-currency {
    color: white;
    font-size: 1.15rem;
    font-weight: 500;
    margin-left: 6px;
    user-select: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.bet-range-text {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

.btn-play {
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 14px 28px;
    border-radius: 8px;
    border: none;
    transition: all 0.15s ease;
    letter-spacing: 0.04em;
}

.btn-play:active {
    transform: scale(0.96);
}

.zone-play-box {
    background: var(--play-box-bg, rgba(0, 0, 0, 0.55));
    border: 1px solid var(--play-box-border, rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 9px;
    padding: 12px 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.04em;
    margin-top: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.btn-collect-new {
    background: var(--collect-bg, linear-gradient(180deg, rgba(42, 86, 120, 0.38) 0%, rgba(25, 58, 84, 0.42) 100%));
    border: 1px solid var(--collect-border, rgba(75, 140, 185, 0.35));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--collect-color, #729ebc);
    font-weight: 700;
    font-size: 0.84rem;
    padding: 12px 0;
    border-radius: 9px;
    width: 100%;
    letter-spacing: 0.04em;
    text-shadow: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.20);
    transition: all 0.2s ease;
    cursor: default;
    user-select: none;
}

.btn-collect-new.can-collect {
    background: var(--collect-active-bg, linear-gradient(180deg, rgba(50, 130, 200, 0.72) 0%, rgba(26, 85, 145, 0.78) 100%));
    border: 1px solid var(--collect-active-border, rgba(130, 205, 255, 0.60));
    color: var(--collect-active-color, #ffffff);
    box-shadow: 0 4px 18px var(--collect-active-glow, rgba(28, 90, 155, 0.35)), inset 0 1px 2px rgba(255, 255, 255, 0.25);
    cursor: pointer;
}

.btn-collect-new.can-collect:hover {
    filter: brightness(1.08);
}

.btn-collect-new.can-collect:active {
    transform: scale(0.98);
}

.btn-collect-new.can-collect:hover {
    filter: brightness(1.08);
}

.btn-collect-new.can-collect:active {
    transform: scale(0.98);
}

.btn-replay {
    background: var(--replay-btn-bg, linear-gradient(180deg, #5b9ff2 0%, #3578e5 100%));
    color: var(--replay-btn-color, #ffffff);
    font-weight: 700;
    font-size: 0.88rem;
    padding: 13px 0;
    border-radius: 12px;
    width: 100%;
    letter-spacing: 0.03em;
    border: none;
    cursor: pointer;
    box-shadow: var(--replay-btn-shadow, 0 4px 12px rgba(53, 120, 229, 0.35));
    transition: all 0.15s ease;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-replay:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-nouvelle-mise {
    background: var(--nouvelle-mise-bg, rgba(0, 0, 0, 0.85));
    border: 1.5px solid var(--nouvelle-mise-border, rgba(255, 255, 255, 0.45));
    color: var(--nouvelle-mise-color, #ffffff);
    font-weight: 700;
    font-size: 0.88rem;
    padding: 13px 0;
    border-radius: 12px;
    width: 100%;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-nouvelle-mise:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.98);
}

/* ══════════════════════════════════════════
   BOTTOM SHEET
══════════════════════════════════════════ */
#quickBetSheet {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
}

#quickBetSheet.open {
    pointer-events: auto;
}

#quickBetBackdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#quickBetSheet.open #quickBetBackdrop {
    opacity: 1;
}

#quickBetPanel {
    position: relative;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px 20px 36px;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    color: #111;
}

#quickBetSheet.open #quickBetPanel {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 18px;
}

.sheet-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    text-align: center;
    margin-bottom: 14px;
}

.sheet-subtitle {
    font-size: 0.78rem;
    color: #374151;
    margin-bottom: 12px;
}

.quick-bet-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.row-mult.active-mult {
    color: #fde68a;
}

.row-mult.win-mult {
    color: #6ee7b7;
}

.quick-bet-input {
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    background: #fff;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.quick-bet-input:focus {
    border-color: #3b82f6;
}

.sheet-range {
    font-size: 0.7rem;
    color: #6b7280;
    margin-bottom: 18px;
}

.btn-sheet-close {
    width: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 14px;
    border-radius: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-sheet-close:active {
    opacity: 0.85;
}

/* ══════════════════════════════════════════
   ÉCRAN DE CONNEXION
══════════════════════════════════════════ */
#loginScreen {
    --login-field-bg: rgba(255, 255, 255, 0.045);
    --login-field-border: rgba(255, 255, 255, 0.09);
    --login-text-secondary: rgba(255, 255, 255, 0.55);
    --login-text-tertiary: rgba(255, 255, 255, 0.32);

    position: fixed;
    inset: 0;
    z-index: 2000;
    background: radial-gradient(120% 90% at 50% 0%, var(--login-bg-top) 0%, var(--login-bg-bottom) 65%);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: auto;
    overflow-y: auto;
    transition: background 0.3s ease;
}

.hidden-screen {
    display: none !important;
}

.login-shell {
    width: 100%;
    max-width: 380px;
    padding: 28px 22px;
    margin: 0 16px;
}

.icon-orbit {
    width: 76px;
    height: 76px;
    margin: 0 auto 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--login-accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.icon-orbit::before {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--login-accent-glow) 0%, transparent 70%);
    opacity: 0.55;
    filter: blur(2px);
    transition: background 0.3s ease;
}

.icon-orbit i {
    position: relative;
    z-index: 1;
    width: 30px;
    height: 30px;
    color: var(--login-accent);
    transition: color 0.3s ease;
}

.login-title {
    font-size: 1.65rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.login-subtitle {
    font-size: 0.86rem;
    color: var(--login-text-secondary);
    text-align: center;
    margin-top: 6px;
    font-weight: 500;
}

.login-session-msg {
    font-size: 0.76rem;
    color: var(--login-text-tertiary);
    text-align: center;
    margin-top: 14px;
    margin-bottom: 30px;
    line-height: 1.5;
    padding: 0 8px;
}

.login-field-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}

.login-field {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--login-field-bg);
    border: 1px solid var(--login-field-border);
    border-radius: 16px;
    height: 54px;
    padding: 0 16px;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.login-field:focus-within {
    border-color: var(--login-field-border-focus);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--login-accent-glow);
}

.login-field i.field-icon {
    width: 18px;
    height: 18px;
    color: var(--login-text-tertiary);
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.login-field:focus-within i.field-icon {
    color: var(--login-accent);
}

.login-field input {
    flex: 1;
    background: transparent;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0 12px;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.login-field input:focus,
.login-field input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.login-field input::placeholder {
    color: var(--login-text-tertiary);
}

.login-toggle-eye {
    background: none;
    border: none;
    padding: 6px;
    margin: -6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--login-text-tertiary);
    transition: color 0.15s ease;
    border-radius: 8px;
}

.login-toggle-eye:hover {
    color: var(--login-text-secondary);
}

.login-toggle-eye:focus-visible,
.btn-login:focus-visible {
    outline: 2px solid var(--login-accent);
    outline-offset: 2px;
}

.login-toggle-eye i {
    width: 18px;
    height: 18px;
}

.btn-login {
    width: 100%;
    height: 54px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--login-accent) 0%, var(--login-accent-dim) 100%);
    color: var(--login-accent-text, #ffffff);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 22px var(--login-accent-glow), 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.15s ease, opacity 0.15s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: 0 0 28px var(--login-accent-glow), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn-login:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: default;
}

.login-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(5, 23, 12, 0.35);
    border-top-color: #05170c;
    border-radius: 50%;
    animation: loginSpin 0.7s linear infinite;
    display: none;
}

.btn-login.loading .login-spinner {
    display: inline-block;
}

.btn-login.loading .btn-label {
    opacity: 0.85;
}

@keyframes loginSpin {
    to {
        transform: rotate(360deg);
    }
}

.login-error-msg {
    font-size: 0.76rem;
    color: #ff6b6b;
    text-align: center;
    margin-top: 14px;
    min-height: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.login-error-msg.show {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {

    #loginScreen *,
    #loginScreen *::before,
    #loginScreen *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 340px) {
    .login-title {
        font-size: 1.45rem;
    }

    .login-shell {
        padding: 22px 16px;
    }
}

/* ══════════════════════════════════════════
   GESTION DU SOLDE DANS LES PARAMÈTRES
══════════════════════════════════════════ */
.settings-balance-form {
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
}

.settings-balance-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.settings-balance-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    background: rgba(0, 0, 0, 0.5);
}

.settings-balance-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 8px 10px 10px;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    -moz-appearance: textfield;
}

.settings-balance-input::-webkit-outer-spin-button,
.settings-balance-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.settings-balance-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
    font-size: 0.85rem;
}

.settings-balance-unit {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-weight: 600;
    padding-right: 12px;
    user-select: none;
}

.settings-balance-save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 14px;
    padding: 0 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px var(--accent-glow);
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-balance-save-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.settings-balance-save-btn:active {
    transform: scale(0.96);
}

.quick-balance-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    padding: 7px 4px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.quick-balance-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateY(-1px);
}

.quick-balance-btn:active {
    transform: scale(0.94);
    background: var(--accent-glow);
}