:root {
    --bg-dark: #121614;
    --bg-panel: #1a1f1d;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --bg-input: #0d100f;
    --text-main: #9ca3af;
    --text-light: #ffffff;
    --accent-green: #10b981;
    --accent-green-hover: #34d399;
    --tile-bg: #222b28;
    --tile-hover: #2d3b36;
}

*, *::before, *::after { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Nunito', sans-serif; 
}

body { 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    height: 100vh; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
}

/* Header & Sidebar */
.top-bar { 
    height: 75px; 
    background-color: var(--bg-panel); 
    backdrop-filter: blur(12px);
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 25px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10; 
}
.logo { 
    color: var(--text-light); 
    font-size: 1.4rem; 
    font-weight: 800; 
    text-decoration: none; 
    font-family: 'Chakra Petch', sans-serif;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-controls { display: flex; align-items: center; gap: 15px; position: relative; }

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 240px;
    background-color: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    padding: 18px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-dropdown.hidden {
    display: none !important;
}

.dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.dropdown-label {
    font-size: 0.75rem;
    color: var(--text-main);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.dropdown-username {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-light);
    background-color: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    word-break: break-word;
    font-family: monospace;
}

.dropdown-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.dropdown-btn:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-primary { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: #ffffff; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 12px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.25s ease; 
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}
.btn-primary:hover { 
    background: linear-gradient(135deg, #34d399, #10b981); 
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.55);
}
.btn-secondary { 
    background-color: rgba(255, 255, 255, 0.06); 
    color: var(--text-light); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    padding: 10px 18px; 
    border-radius: 12px; 
    font-weight: 600;
    cursor: pointer; 
    transition: all 0.25s ease; 
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.balance-display { 
    background-color: var(--bg-input); 
    padding: 10px 18px; 
    border-radius: 10px; 
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-light); 
    font-weight: 700; 
    font-family: monospace;
}
.avatar { 
    background-color: rgba(255, 255, 255, 0.08); 
    width: 40px;
    height: 40px;
    border-radius: 12px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer;
    transition: all 0.2s; 
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.avatar:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.app-container { display: flex; flex: 1; height: calc(100vh - 75px); }
.sidebar { 
    width: 270px; 
    background-color: var(--bg-panel); 
    height: 100%; 
    overflow-y: auto; 
    padding: 25px 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-section h3 { font-size: 0.75rem; color: #6b7280; margin-bottom: 12px; padding-left: 10px; font-weight: 800; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: var(--text-main); text-decoration: none; border-radius: 10px; margin-bottom: 6px; font-weight: 600; transition: all 0.2s; }
.nav-item:hover, .nav-item.active { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.nav-item.active { border-left: 3px solid #10b981; }

.info-box { background-color: rgba(16, 185, 129, 0.05); border: 1px solid rgba(16, 185, 129, 0.15); padding: 18px; border-radius: 12px; margin-top: auto; }
.info-box h4 { color: #10b981; margin-bottom: 8px; font-size: 0.9rem; font-family: 'Chakra Petch', sans-serif; }
.info-box p { font-size: 0.8rem; line-height: 1.5; color: var(--text-main); }

.main-content { flex: 1; height: 100%; overflow-y: auto; padding: 35px; }
.hidden { display: none !important; }

/* Lobby Grid */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.game-card { background: var(--bg-panel); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 16px; overflow: hidden; text-decoration: none; display: block; transition: all 0.25s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.game-card:hover { transform: translateY(-5px); border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15); }
.game-img { height: 150px; display: flex; justify-content: center; align-items: center; font-size: 4rem; background-color: #161b18; }
.game-info { padding: 18px; display: flex; flex-direction: column; }
.game-title { color: white; font-weight: 700; font-size: 1.1rem; font-family: 'Chakra Petch', sans-serif; }
.game-players { color: #6b7280; font-size: 0.85rem; margin-top: 6px; font-weight: 600; }

/* --- MINES LAYOUT & STYLING --- */
.casino-game-wrapper { 
    display: flex; 
    gap: 25px; 
    background-color: var(--bg-panel); 
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px; 
    max-width: 950px; 
    margin: 0 auto; 
    padding: 25px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.game-controls-panel { 
    width: 320px; 
    background-color: var(--bg-input); 
    padding: 20px; 
    border-radius: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.mode-selector { display: flex; background: var(--bg-dark); border-radius: 10px; padding: 4px; border: 1px solid rgba(255, 255, 255, 0.06); }
.mode-btn { flex: 1; border: none; background: transparent; color: var(--text-main); padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 700; transition: all 0.2s; }
.mode-btn.active { background: var(--bg-hover); color: white; }

.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group label { font-size: 0.85rem; color: var(--text-main); font-weight: 700; }

.input-with-actions { display: flex; background: var(--bg-dark); border-radius: 10px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
.input-with-actions input { flex: 1; background: transparent; border: none; padding: 12px; color: white; font-weight: 700; outline: none; font-family: monospace; }
.btn-input-action { background: rgba(255, 255, 255, 0.06); border: none; color: white; padding: 0 14px; cursor: pointer; font-weight: 700; border-left: 1px solid rgba(255, 255, 255, 0.08); transition: background 0.2s; }
.btn-input-action:hover { background: rgba(255, 255, 255, 0.12); }

.select-input { background: var(--bg-dark); border: 1px solid rgba(255, 255, 255, 0.08); color: white; padding: 12px; border-radius: 10px; outline: none; font-weight: 700; cursor: pointer; }

.btn-action, .green-btn, .mines-action-btn { background: linear-gradient(135deg, #10b981, #059669); color: white; border: none; padding: 16px; border-radius: 12px; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); width: 100%; text-align: center; }
.btn-action:hover, .green-btn:hover, .mines-action-btn:hover { background: linear-gradient(135deg, #34d399, #10b981); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45); }

.sub-toggle-btn { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: white; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.sub-toggle-btn.active { background: #10b981; color: white; }

.mines-grid-container { flex: 1; display: flex; justify-content: center; align-items: center; }
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 10px; width: 100%; max-width: 420px; aspect-ratio: 1; }
.mine-tile { width: 100%; height: 100%; background-color: var(--tile-bg, #222b28); border-radius: 12px; cursor: pointer; transition: all 0.2s; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; border: 1px solid rgba(255, 255, 255, 0.06); }
.mine-tile:hover { background-color: var(--tile-hover, #2d3b36); transform: scale(1.03); }
.mine-tile.revealed { background-color: #0d100f; cursor: default; transform: none; }
.mine-tile.mine { background-color: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); }
.mine-tile.safe { background-color: rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.5); }

.stake-play-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    width: 100%;
    text-align: center;
}
.stake-play-btn:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

/* Modals & Live Stats */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal.hidden {
    display: none !important;
}
.modal-content {
    background-color: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.stats-modal-content {
    max-width: 600px;
}
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.stats-header h3 {
    font-family: 'Chakra Petch', sans-serif;
    color: white;
    font-size: 1.2rem;
}
.stats-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}
.stat-card {
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.stat-card-label {
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 700;
}
.stat-card-value {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: monospace;
    color: white;
}
.stat-card-value.green { color: #10b981; }
.stat-card-value.red { color: #ef4444; }
.chart-wrapper {
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 15px;
    border-radius: 12px;
}
.close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-main);
    transition: color 0.2s;
}
.close-btn:hover {
    color: white;
}
.icon-btn-small {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.icon-btn-small:hover {
    background: rgba(255, 255, 255, 0.12);
}

.modal-content input[type="text"],
#promo-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input, #0d100f);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}
.modal-content input[type="text"]:focus,
#promo-input:focus {
    border-color: #10b981;
}

