/* === MODERN ROULETTE STYLES === */
.pf-btn {
    background: #1f2933; color: #ece8e1; border: 1px solid #2a3642; 
    border-radius: 6px; padding: 10px 15px; font-weight: bold; 
    cursor: pointer; transition: 0.2s;
}
.pf-btn:hover { background: #2a3642; }

.tape-box {
    width: 35px; height: 35px; min-width: 35px; border-radius: 6px; 
    display: flex; align-items: center; justify-content: center; 
    font-weight: bold; font-family: 'Rajdhani', sans-serif; font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5); cursor: pointer; transition: 0.1s;
}
.tape-box:hover { filter: brightness(1.2); transform: translateY(-2px); }

.bet-column-modern {
    flex: 1; background: #0b0f14; border: 1px solid #2a3642; 
    border-radius: 12px; display: flex; flex-direction: column; overflow: hidden;
}
.bets-list-modern {
    padding: 10px; display: flex; flex-direction: column; gap: 8px; 
    height: 300px; overflow-y: auto;
}
.bet-row {
    display: flex; justify-content: space-between; align-items: center;
    background: #121822; padding: 8px; border-radius: 6px; border: 1px solid #1a2230;
}

:root { 
    --bg-dark: #090d14; /* Deep, modern app background */
    --bg-panel: #121822; /* Bento box fill color */
    --accent: #ff4655; 
    --text-main: #ece8e1; 
    --text-muted: #8b97a3; 
    --steam-btn: #171a21; 
}

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

body { 
    font-family: 'Roboto', sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    height: 100vh; 
    overflow: hidden; 
}

/* Beautiful custom scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3642; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #3a4755; }

/* === BENTO BOX GRID LAYOUT === */
.bento-layout {
    display: grid;
    grid-template-columns: 1fr 320px; /* Layout split for Main Content vs Activity/Chat Panel */
    grid-template-rows: auto 1fr;
    gap: 16px;
    padding: 16px;
    height: 100vh;
    box-sizing: border-box;
}

.bento-box {
    background-color: var(--bg-panel);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Force Navbar to span horizontally across the whole grid top */
.bento-nav {
    grid-column: 1 / -1; 
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #171a21;
    border: 1px solid #2a3642;
    border-radius: 12px;
    
    /* THE FIXES: Prevents clipping and forces it above the chat panel */
    overflow: visible; 
    z-index: 100;
}

.bento-main { grid-column: 1; grid-row: 2; overflow-y: auto; position: relative; }
.bento-history { grid-column: 2; grid-row: 2; }

/* === TOP NAVIGATION BAR === */
.logo { 
    font-family: 'Rajdhani', sans-serif; 
    font-size: 32px; 
    font-weight: 700; 
    color: var(--accent); 
    letter-spacing: 2px; 
    text-shadow: 0 0 15px rgba(255, 70, 85, 0.3);
    margin: 0;
}

/* Horizontal Link Container Formatting */
.nav-links-horizontal {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.nav-links-horizontal button {
    background: transparent;
    border: 1px solid transparent;
    color: #8b97a3;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links-horizontal button:hover {
    color: #ece8e1;
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}

.nav-links-horizontal button.active {
    color: var(--accent);
    background: rgba(255, 70, 85, 0.1);
    border-color: rgba(255, 70, 85, 0.15);
    font-weight: 700;
}

/* === GAME VIEWS (Main Center) === */
.game-view { display: none; height: 100%; width: 100%; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; padding-right: 5px; }
.game-view.active { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.game-view h2 { font-family: 'Rajdhani', sans-serif; font-size: 36px; margin-top: 10px; margin-bottom: 20px; color: var(--accent); flex-shrink: 0; }

/* === AUTH & USER CONTROLS === */
.steam-login { 
    background-color: var(--steam-btn); 
    color: white; 
    border: 1px solid #2a3642; 
    padding: 12px 24px; 
    border-radius: 12px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: bold; 
    transition: all 0.2s; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
}
.steam-login:hover { background-color: #2a2f3a; transform: translateY(-2px); }

/* Dropdown Alignment Architecture */
.profile-wrapper {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #2a3642;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #171a21;
    border: 1px solid #2a3642;
    border-radius: 8px;
    width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none; 
    flex-direction: column;
    overflow: hidden;
}

/* Visibility Trigger Class */
.dropdown-menu.show {
    display: flex;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-menu a {
    color: #8b97a3;
    padding: 12px 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    border-bottom: 1px solid rgba(42, 54, 66, 0.4);
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
    padding-left: 20px;
}

/* === STRICT 5-COLUMN INVENTORY GRID === */
.inventory-grid { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); /* Forces exactly 5 horizontal items */
    gap: 15px; 
    margin-top: 20px; 
    width: 100%; 
    max-width: 900px; 
}

/* Graceful fallback for smaller monitors/laptops */
@media (max-width: 1200px) {
    .inventory-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
    .inventory-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === ROULETTE & GAME STYLING === */
.roulette-container { 
    width: 100%; 
    /* Removed the max-width so the wheel box stretches the entire length of the left panel! */
    margin-bottom: 30px; 
    background: #0b0f14; 
    border-radius: 16px; 
    padding: 20px; 
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.5); 
    border: 1px solid #2a3642;
}
.wheel-window { width: 100%; height: 100px; overflow: hidden; position: relative; border-radius: 8px; border: 2px solid #2a3642; box-shadow: 0 10px 20px rgba(0,0,0,0.5);}
.selector-line { position: absolute; left: 50%; top: 0; width: 4px; height: 100%; background: #fff; z-index: 10; transform: translateX(-50%); box-shadow: 0 0 15px rgba(255,255,255,1); }
.wheel-strip { display: flex; height: 100%; width: max-content; transition: transform 6s cubic-bezier(0.15, 0.85, 0.15, 1); }
.roulette-block { width: 80px; height: 100%; display: flex; align-items: center; justify-content: center; font-family: 'Rajdhani', sans-serif; font-size: 24px; font-weight: bold; border-right: 2px solid #0b0f14; }
.block-red { background-color: var(--accent); color: white; }
.block-black { background-color: #2b2b2b; color: white; }
.block-green { background-color: #4caf50; color: white; }

.bet-controls { display: flex; flex-direction: column; gap: 15px; width: 100%; max-width: 600px; }
.bet-input-group input { width: 100%; padding: 15px; background: #0b0f14; border: 1px solid #2a3642; color: white; border-radius: 8px; font-size: 18px; outline: none; transition: 0.2s; }
.bet-input-group input:focus { border-color: #5c6776; }
.bet-buttons { display: flex; gap: 10px; }
.bet-btn { flex: 1; padding: 15px; font-size: 16px; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; text-transform: uppercase; transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.2);}
.bet-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.3); }
.btn-red { background-color: var(--accent); color: white; }
.btn-green { background-color: #4caf50; color: white; }
.btn-black { background-color: #2b2b2b; color: white; }

.timer-display { font-family: 'Rajdhani', sans-serif; font-size: 24px; font-weight: bold; text-align: center; margin-bottom: 15px; color: var(--text-main); }
.live-bets-container { display: flex; gap: 12px; width: 100%; max-width: 800px; margin-top: 20px; }
.bet-column { flex: 1; background: #0b0f14; border: 1px solid #2a3642; border-radius: 12px; padding: 15px; min-height: 200px; }
.bet-column h4 { text-align: center; margin-bottom: 12px; border-bottom: 1px solid #1a2230; padding-bottom: 8px; font-size: 16px; text-transform: uppercase; letter-spacing: 1px;}
.text-red { color: var(--accent); }
.text-green { color: #4caf50; }

/* === COINFLIP UI === */
.cf-layout { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    width: 100%; 
    /* Removed the max-width restriction to fill ultra-wide screens! */
    margin-top: 20px; 
}
.cf-create-panel { flex: 1; min-width: 250px; background: #0b0f14; padding: 24px; border-radius: 16px; border: 1px solid #2a3642; }
.cf-list-panel { flex: 2; min-width: 300px; background: #0b0f14; padding: 24px; border-radius: 16px; border: 1px solid #2a3642; max-height: 400px; overflow-y: auto; }
.coin-3d { width: 150px; height: 150px; position: relative; transform-style: preserve-3d; transition: transform 3s cubic-bezier(0.15, 0.85, 0.15, 1); margin: 0 auto 20px; }
.coin-face { position: absolute; width: 100%; height: 100%; border-radius: 50%; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; font-family: 'Rajdhani', sans-serif; font-size: 30px; font-weight: bold; border: 5px solid #fff; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.coin-heads { background: linear-gradient(135deg, #ffd700, #b8860b); color: white; border-color: #ffeb73; transform: rotateY(0deg); }
.coin-tails { background: linear-gradient(135deg, #e0e0e0, #808080); color: white; border-color: #fff; transform: rotateY(180deg); }

/* === MISC SHARED BUTTONS & GRIDS === */
.btn-deposit { background: #4caf50; color: white; border: none; padding: 8px 18px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(76, 175, 80, 0.2);}
.btn-deposit:hover { background: #45a049; transform: translateY(-1px);}
.btn-withdraw { background: #e53935; color: white; border: none; padding: 8px 18px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(229, 57, 53, 0.2);}
.btn-withdraw:hover { background: #d32f2f; transform: translateY(-1px);}

/* --- PROVABLY FAIR POPOVER FIX --- */
.pf-popover {
    position: fixed !important; /* THE FIX: Locks it to the monitor screen! */
    background: #0b0f14;
    border: 1px solid #2a3642;
    border-radius: 12px;
    padding: 15px;
    width: 320px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.9);
    z-index: 99999;
    color: #ece8e1;
    font-family: 'Roboto', sans-serif;
}

.pf-popover-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: bold;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.pf-popover-value {
    font-family: monospace;
    font-size: 12px;
    color: #ece8e1;
    word-break: break-all;
    background: #121822;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #1a2230;
    display: block;
}

.pf-popover-row {
    margin-bottom: 10px;
}