@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Inter:wght@300;400;600&display=swap');

/* ---- RESET ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    font-family: 'Inter', sans-serif;
    background: #080808;
    color: #EAEAEA;
}

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

body {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* ---- CSS VARIABLES ---- */
:root {
    --gold: #D4AF37;
    --gold-light: #F9F1D0;
    --gold-dark: #996515;
    --gold-gradient: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    --bg-dark: #0a0a0a;
    --bg-panel: #121212;
    --border-gold: 2px solid #D4AF37;
}

/* ---- BACKGROUND LUXURY ---- */
.bg-particles {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% -20%, #2a2000 0%, #050505 70%);
}

.bg-particles::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ---- TOP BAR ---- */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 1px solid var(--gold-dark);
    z-index: 100;
}

.top-bar .logo {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(14px, 2.5vh, 20px);
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 16px);
}

.coins-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #1A1500 0%, #050505 100%);
    border: 1px solid var(--gold);
    padding: 4px 12px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(12px, 2.5vh, 16px);
    color: var(--gold-light);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.coins-display.pulse {
    animation: coinPulse 0.4s ease-out;
}

@keyframes coinPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 10px rgba(212, 175, 55, 0.1); }
    50% { transform: scale(1.1); box-shadow: 0 2px 20px rgba(212, 175, 55, 0.4); }
}

.user-name {
    font-weight: 600;
    font-size: 11px;
    color: #AAAAAA;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-logout, .btn-admin {
    background: transparent;
    border: 1px solid #444;
    color: #AAA;
    padding: 4px 10px;
    font-weight: 600;
    font-size: clamp(9px, 1.5vh, 11px);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-logout:active {
    border-color: #ff3333;
    color: #ff3333;
}

.btn-admin {
    border-color: var(--gold-dark);
    color: var(--gold);
}

.btn-admin:active {
    background: var(--gold-dark);
    color: #000;
}

/* ---- MAIN CONTENT AREA ---- */
.main-content {
    position: fixed;
    top: 50px;
    left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(5px, 2vh, 20px);
}

/* ---- AUTH BOX ---- */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.auth-overlay.hidden { display: none; }

.auth-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: var(--border-gold);
    padding: clamp(20px, 4vh, 36px) clamp(16px, 3vh, 28px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.9), 0 0 20px rgba(212,175,55,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.auth-box::before {
    content: '';
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.auth-box h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(18px, 4vh, 24px);
    color: var(--gold);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.auth-box .subtitle {
    text-align: center;
    font-size: clamp(9px, 2vh, 11px);
    color: #777;
    margin-bottom: clamp(16px, 4vh, 30px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.input-display {
    width: 100%;
    height: clamp(40px, 8vh, 54px);
    background: #050505;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 4vh, 24px);
    color: var(--gold);
    letter-spacing: 6px;
    margin-bottom: clamp(16px, 4vh, 24px);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 2vh, 12px);
    margin-bottom: clamp(20px, 4vh, 30px);
}

.keypad-btn {
    aspect-ratio: 1.6;
    background: #111;
    border: 1px solid #222;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 3vh, 20px);
    color: #CCC;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keypad-btn:active {
    background: var(--gold-dark);
    color: #000;
    border-color: var(--gold);
}

.keypad-btn.btn-delete {
    color: var(--gold-dark);
}
.keypad-btn.btn-zero { grid-column: 2; }

/* ---- BUTTONS ---- */
.btn-submit {
    width: 100%;
    padding: clamp(12px, 3vh, 16px);
    background: var(--gold-gradient);
    border: none;
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(14px, 3vh, 16px);
    color: #000;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-submit:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(212, 175, 55, 0.2);
}

/* ---- GAMECARDS ---- */
.game-grid {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(12px, 3vw, 24px);
    justify-content: center;
    width: 100%;
}
.game-card {
    width: clamp(140px, 30vw, 180px);
    height: clamp(180px, 35vh, 220px);
    background: var(--bg-panel);
    border: var(--border-gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.game-card::before {
    content: '';
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}
.game-card:active {
    transform: scale(0.96);
}
.game-card .card-icon { font-size: clamp(36px, 8vh, 48px); filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }
.game-card .card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(12px, 2.5vh, 16px);
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.game-card .card-subtitle {
    font-size: clamp(9px, 1.8vh, 11px);
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.coming-soon { opacity: 0.5; filter: grayscale(1); pointer-events: none; }

/* ---- SLOT MACHINE ---- */
.slot-machine {
    width: 100%;
    max-width: 480px;
    max-height: 90vh; /* Empêche le dépassement */
    background: var(--bg-panel);
    border: var(--border-gold);
    padding: clamp(16px, 3vh, 32px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.9), 0 0 30px rgba(212,175,55,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.slot-machine::before {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.slot-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(18px, 4vh, 26px);
    color: var(--gold);
    margin-bottom: clamp(12px, 3vh, 28px);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.slot-reels-container {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(16px, 4vh, 32px);
    background: #050505;
    padding: clamp(10px, 2.5vh, 16px);
    border: 1px solid #222;
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.9);
}

.slot-reel {
    width: clamp(70px, 18vw, 100px);
    height: clamp(85px, 20vh, 120px);
    background: linear-gradient(180deg, #111 0%, #222 15%, #333 50%, #222 85%, #111 100%);
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-size: clamp(40px, 9vh, 60px);
}

.slot-reel::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
}

.reel-symbol {
    transition: transform 0.1s;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.8));
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-reel.spinning .reel-symbol {
    animation: slotSpin 0.1s linear infinite;
    filter: blur(2px);
}

@keyframes slotSpin {
    0% { transform: translateY(-100%); opacity: 0; }
    50% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(100%); opacity: 0; }
}

.slot-result {
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(12px, 3vh, 16px);
    min-height: 24px;
    margin-bottom: clamp(16px, 3vh, 28px);
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.slot-result.win {
    color: var(--gold);
    text-shadow: 0 0 15px rgba(212,175,55,0.4);
    animation: winScale 0.5s ease-out;
}
.slot-result.lose { color: #883333; }

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

.bet-controls {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2.5vw, 24px);
    margin-bottom: clamp(16px, 3vh, 28px);
    justify-content: center;
    width: 100%;
}

.bet-btn {
    width: clamp(38px, 8vh, 48px);
    height: clamp(38px, 8vh, 48px);
    background: #111;
    border: 1px solid var(--gold-dark);
    color: var(--gold);
    font-size: clamp(18px, 4vh, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
}
.bet-btn:active {
    background: var(--gold-dark);
    color: #000;
}

.bet-amount {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(16px, 3.5vh, 20px);
    color: var(--gold-light);
    min-width: clamp(110px, 15vw, 140px);
    text-align: center;
    border-bottom: 1px solid var(--gold-dark);
    padding-bottom: 6px;
    letter-spacing: 2px;
}

.btn-spin {
    width: 100%;
    max-width: 320px;
    padding: clamp(12px, 3vh, 20px);
    background: var(--gold-gradient);
    border: none;
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(16px, 4vh, 22px);
    color: #000;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.2);
    transition: all 0.1s;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.btn-spin:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}
.btn-spin:disabled {
    filter: grayscale(1);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-nav {
    position: fixed;
    bottom: clamp(10px, 2vh, 20px);
    left: clamp(10px, 2vh, 20px);
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vh, 16px);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    border: 1px solid #444;
    font-weight: 600;
    font-size: clamp(9px, 1.5vh, 11px);
    color: #AAA;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s;
    z-index: 200;
}
.btn-nav:active { border-color: var(--gold); color: var(--gold); }

/* ---- EFFECTS ---- */
.win-flash {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 999;
    background: radial-gradient(circle, rgba(212,175,55,0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease-out;
}
.win-flash.active { animation: flashBang 0.5s ease-out; }
@keyframes flashBang {
    0% { opacity: 0;}
    20% { opacity: 1;}
    100% { opacity: 0;}
}

.shake { animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes screenShake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
    40%, 60% { transform: translate3d(5px, 0, 0); }
}

.floating-coin {
    position: fixed;
    font-size: clamp(24px, 5vh, 32px);
    z-index: 900;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-100px); opacity: 0; }
}

.auth-message {
    text-align: center;
    font-size: clamp(11px, 2vh, 13px);
    margin-top: clamp(12px, 2vh, 20px);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.auth-message.error { color: #cf142b; }
.auth-message.success { color: var(--gold); }
