:root {
    --gold-primary: #D4AF37;
    --gold-light: #F7E7CE;
    --gold-dark: #AA8C2C;
    --black-bg: #050505;
    --glass: rgba(20, 20, 20, 0.9);
    --glass-border: rgba(212, 175, 55, 0.3);
    --green-win: #2ecc71;
    --red-lose: #e74c3c;
}

html {
    background-color: #050505;
}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    background-color: var(--black-bg);
    background-image: radial-gradient(circle at 20% 50%, #1a1a1a 0%, #000 100%);
    color: #e0e0e0;
    font-family: 'Poppins', sans-serif;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

/* --- SCREENS (Splash & Menu) --- */
.full-screen {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #000; z-index: 2000;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    transition: opacity 0.5s;
}

/* Splash Animation */
.splash-logo {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--gold-primary);
    text-align: center;
    padding: 0 20px;
    text-shadow: 0 0 20px rgba(212,175,55,0.5);
    animation: pulseLogo 2s infinite;
}
@keyframes pulseLogo {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 40px var(--gold-primary); }
    100% { transform: scale(1); opacity: 0.8; }
}

/* --- MENU STYLES --- */
.menu-content {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 1s ease-out;
    z-index: 10;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.game-icon-box {
    width: 200px; height: 200px;
    margin-bottom: 50px;
    border-radius: 30px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    position: relative;
}

.game-icon-box::before {
    content: ''; position: absolute; inset: 0; border-radius: 30px; padding: 2px;
    background: linear-gradient(135deg, transparent, var(--gold-primary), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}

.game-icon-box img { width: 100%; height: 100%; object-fit: cover; }
.game-icon-placeholder { font-size: 5rem; color: #444; text-shadow: 0 0 20px #000; }

.menu-btn {
    width: 280px; padding: 18px; margin-bottom: 20px;
    font-family: 'Cinzel', serif; font-size: 1.1rem; font-weight: bold;
    border-radius: 50px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase; letter-spacing: 2px;
    position: relative; overflow: hidden;
}

.btn-play {
    background: var(--gold-primary); color: #050505; border: none;
    box-shadow: 0 0 30px rgba(212,175,55,0.3);
}
.btn-play:hover { transform: scale(1.05); box-shadow: 0 0 50px rgba(212,175,55,0.6); background: #fff; }

.btn-rules {
    background: transparent; border: 1px solid rgba(212,175,55,0.5); color: var(--gold-primary);
}
.btn-rules:hover { background: rgba(212,175,55,0.1); border-color: var(--gold-primary); transform: translateY(-2px); }

.menu-bg-fx {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #000 80%);
    z-index: 1;
}
.particles {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23D4AF37' fill-opacity='0.05'%3E%3Ccircle cx='2' cy='2' r='1'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

/* --- MAIN LAYOUT --- */
#mainGame {
    display: none;
    grid-template-columns: 300px 1fr 400px;
    grid-template-rows: 70px 1fr 60px;
    height: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

#mainGame.active {
    display: grid;
}

/* --- Header --- */
header {
    grid-column: 1 / -1;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 2rem;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

.logo {
    font-family: 'Cinzel', serif; font-size: 1.8rem; color: var(--gold-primary);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.wallet-box {
    background: linear-gradient(135deg, #222, #000);
    border: 1px solid var(--gold-dark);
    padding: 8px 20px;
    border-radius: 50px;
    font-family: 'Cinzel', serif; font-size: 1.2rem; color: var(--gold-primary);
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
    cursor: pointer; transition: 0.2s;
}
.wallet-box:hover { transform: scale(1.05); }

/* --- Left Side: History --- */
.sidebar-left {
    background: var(--glass);
    border-right: 1px solid #222;
    padding: 20px;
    display: flex; flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(15px);
}

.history-header {
    font-family: 'Cinzel', serif; color: var(--gold-light);
    border-bottom: 1px solid var(--gold-dark);
    padding-bottom: 10px; margin-bottom: 15px;
    display: flex; justify-content: space-between; align-items: center;
}

.history-list {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
    padding-right: 5px;
}
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.log-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #555;
    padding: 10px; border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    display: flex; align-items: center; gap: 10px;
    animation: fadeIn 0.3s ease-in;
}
.log-item.win { border-left-color: var(--green-win); background: rgba(46, 204, 113, 0.1); }
.log-item.lose { border-left-color: var(--red-lose); background: rgba(231, 76, 60, 0.1); }
.log-item.info { border-left-color: var(--gold-primary); }
.log-time { font-size: 0.7rem; color: #666; margin-left: auto; }

/* --- Center: Game Area --- */
.game-area {
    position: relative;
    display: flex; justify-content: center; align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 70%);
    overflow: hidden;
}

.wheel-wrapper {
    position: relative;
    width: 80%; max-width: 550px; aspect-ratio: 1;
    border-radius: 50%; padding: 10px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

canvas#wheelCanvas { width: 100%; height: 100%; border-radius: 50%; transition: transform 0s; }

.wheel-pointer {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 50px; z-index: 5;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.8));
}
.wheel-pointer::after {
    content: ''; position: absolute; top: 0; left: 10px;
    width: 20px; height: 30px;
    background: linear-gradient(to bottom, #fff, var(--gold-primary));
    clip-path: polygon(100% 0, 0 0, 50% 100%);
}

.center-nut {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 15%; height: 15%;
    background: radial-gradient(circle, var(--gold-light), var(--gold-dark));
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0,0,0,1);
    z-index: 3;
    display:flex; justify-content:center; align-items:center;
    font-size: 2rem;
}

/* --- Right Side: Controls --- */
.sidebar-right {
    background: var(--glass);
    border-left: 1px solid #222;
    padding: 20px;
    display: flex; flex-direction: column; gap: 15px;
    overflow-y: auto;
    backdrop-filter: blur(15px);
}

.panel-section {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 8px;
}

.panel-header {
    font-family: 'Cinzel', serif; color: var(--gold-light);
    margin-bottom: 6px; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 4px;
    display: flex; justify-content: space-between;
}

/* Game UI Components */
.number-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.number-grid.number-grid-with-colors { grid-template-columns: repeat(6, 1fr); }
.num-btn {
    aspect-ratio: 1; background: #222; border: 1px solid #444; color: #fff;
    border-radius: 6px; font-weight: bold; font-size: 0.85rem;
    padding: 4px; cursor: pointer; transition: 0.2s;
}
.num-btn:hover { border-color: #888; }
.num-btn.selected {
    background: var(--gold-primary); color: #000;
    border-color: var(--gold-light);
    box-shadow: 0 0 10px var(--gold-primary); transform: scale(1.1);
}

.num-btn.color-cell {
    aspect-ratio: auto;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72rem;
}

.num-btn.color-cell.selected {
    color: #fff;
    transform: none;
}

.num-btn.color-cell#betRed,
.num-btn.color-cell#betRedDesktop {
    border-color: #C0392B;
}

.num-btn.color-cell#betBlack,
.num-btn.color-cell#betBlackDesktop {
    border-color: #666;
}

.color-inline-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* Estado bloqueado — modo exclusivo */
.mode-locked {
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
}

.risk-options { display: flex; flex-direction: column; gap: 5px; }
.risk-btn {
    background: transparent; border: 1px solid #444; padding: 6px 8px;
    color: #888; text-align: left; border-radius: 4px; font-size: 0.75rem;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.risk-btn small { display: block; font-size: 0.6rem; }
.risk-btn.active {
    border-color: var(--gold-primary); background: rgba(212,175,55,0.05); color: #fff;
}
.multiplier-tag { color: var(--gold-primary); font-weight: bold; }

/* Bet Stepper Control */
.bet-stepper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.bet-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111;
    border: 2px solid var(--gold-primary);
    color: var(--gold-primary);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.bet-btn:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    transform: scale(1.05);
}

.bet-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #444;
}

.bet-display {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-size: 1rem;
    color: white;
    min-width: 110px;
    text-align: center;
}

.bet-chips { display: flex; justify-content: space-between; margin-top: 10px; }
.chip {
    width: 50px; height: 50px; border-radius: 50%;
    border: 2px dashed #555; background: #111; color: #fff;
    font-size: 0.8rem; display: flex; justify-content: center; align-items: center; cursor: pointer;
}
.chip.active {
    border-style: solid; border-color: var(--gold-primary); background: #222;
    transform: translateY(-3px); box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.spin-btn {
    width: 100%; padding: 20px;
    background: linear-gradient(to bottom, var(--gold-primary), var(--gold-dark));
    border: none; font-family: 'Cinzel', serif; font-weight: 900; font-size: 1.5rem;
    cursor: pointer; border-radius: 4px; margin-top: 10px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2); transition: 0.2s;
}
.spin-btn:disabled { filter: grayscale(1); cursor: not-allowed; }
.spin-btn:active { transform: scale(0.98); }

.ad-banner {
    width: 100%; height: 100px; background: #111; border: 1px solid #333;
    display: flex; justify-content: center; align-items: center;
    color: #444; font-size: 0.8rem; margin-top: auto;
    text-align: center; overflow: hidden; position: relative;
}

/* Footer */
footer {
    grid-column: 1 / -1; background: #000;
    display: flex; justify-content: center; align-items: center; gap: 20px;
    font-size: 0.8rem; color: #666; border-top: 1px solid #222; padding: 0 20px;
}

.footer-skin-btn {
    background: #141414;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.72rem;
    cursor: pointer;
}

.footer-skin-btn.vip {
    border-color: var(--gold-dark);
    color: var(--gold-primary);
    background: linear-gradient(45deg, #333, #000);
}

.toggle-control { display: none; }
.modern-toggle {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    background: rgba(255,255,255,0.05); border: 1px solid #333; border-radius: 30px;
    cursor: pointer; transition: all 0.3s; font-size: 0.85rem; color: #888;
}
.toggle-control:checked + .modern-toggle {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.2));
    border-color: var(--gold-primary); color: var(--gold-primary);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

/* Color Bet Selector */
.optional-badge {
    font-size: 0.6rem; color: #666; font-family: 'Poppins', sans-serif;
    font-weight: 300; letter-spacing: 0; text-transform: none;
}
.color-bet-selector {
    display: flex; gap: 6px; margin-top: 4px;
}
.color-btn {
    flex: 1; padding: 6px 8px; background: #1a1a1a;
    border: 1px solid #444; color: #888; border-radius: 4px;
    font-size: 0.72rem; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 5px; transition: 0.2s;
}
.color-btn:hover { border-color: #888; color: #ccc; }
.color-btn.active {
    border-color: var(--gold-primary); background: rgba(212,175,55,0.08); color: #fff;
}
.color-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.color-payout-preview {
    margin-top: 5px; padding: 4px 6px; background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.2); border-radius: 4px;
    color: var(--gold-light); font-size: 0.72rem;
}
.number-payout-preview {
    margin-top: 4px; margin-bottom: 2px; padding: 4px 6px;
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.2); border-radius: 4px;
    color: var(--gold-light); font-size: 0.72rem;
}

/* Color Risk Selector */
.risk-label-sub {
    font-size: 0.65rem; color: #666; text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 4px;
}
.color-risk-selector {
    display: flex; gap: 4px; margin-top: 2px;
}
.color-risk-btn {
    flex: 1; padding: 4px 5px; background: #1a1a1a;
    border: 1px solid #333; color: #666; border-radius: 4px;
    font-size: 0.65rem; cursor: pointer; text-align: center;
    transition: 0.2s; line-height: 1.3;
}
.color-risk-btn:hover { border-color: #666; color: #aaa; }
.color-risk-btn.active {
    border-color: #C0392B; background: rgba(192,57,43,0.1); color: #fff;
}
.color-mult-tag {
    display: block; color: #C0392B; font-weight: bold; font-size: 0.68rem;
}
.color-risk-btn.active .color-mult-tag { color: #ff6b6b; }

/* --- MOBILE PANELS & TAB BAR (Hidden by default on desktop) --- */
.mobile-panels {
    display: none;
}

.bottom-tab-bar {
    display: none;
}

.mobile-panels { display: none; }
.bottom-tab-bar { display: none; }

@media (max-width: 1024px) {
    body { overflow: hidden; height: 100dvh; }
    .splash-logo { font-size: 2rem; }
    #mainGame.active { display: flex !important; flex-direction: column; height: 100dvh; overflow: hidden; }
    header { flex-shrink: 0; order: 0; position: sticky; top: 0; z-index: 1000; height: 56px; padding: 0 12px; }
    .logo { font-size: 1rem; }
    .wallet-box { font-size: 0.8rem; padding: 6px 10px; }
    .game-area { order: 1; flex-shrink: 0; height: 200px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at center, #1a1a1a 0%, #000 70%); }
    .wheel-wrapper { width: 170px; height: 170px; max-width: 170px; max-height: 170px; }
    .sidebar-left, .sidebar-right, footer { display: none !important; }
    .mobile-panels { order: 2; flex: 1; overflow: hidden; position: relative; min-height: 0; display: block; }
    .tab-panel { display: none; height: 100%; overflow-y: auto; padding: 10px 12px 70px 12px; box-sizing: border-box; }
    .tab-panel.active { display: block; }
    .panel-section { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); border-radius: 6px; padding: 4px 7px; margin-bottom: 4px; }
    .panel-header { font-size: 0.6rem; margin-bottom: 3px; padding-bottom: 2px; }
    .number-grid { gap: 3px; }
    .num-btn { aspect-ratio: unset; font-size: 1.5rem; border-radius: 4px; padding: 4px 2px; line-height: 1; }
    .color-bet-selector { gap: 4px; }
    .color-btn { padding: 3px 5px; font-size: 0.62rem; }
    .number-grid.number-grid-with-colors { grid-template-columns: repeat(6, 1fr); }
    .num-btn.color-cell { font-size: 0.6rem; min-height: 24px; }
    .color-inline-dot { width: 8px; height: 8px; }
    .color-payout-preview { font-size: 0.6rem; padding: 2px 5px; margin-top: 2px; }
    .number-payout-preview { font-size: 0.6rem; padding: 2px 5px; margin-top: 2px; margin-bottom: 1px; }
    .color-risk-selector { gap: 3px; margin-top: 3px; }
    .color-risk-btn { padding: 3px 4px; font-size: 0.6rem; }
    .color-mult-tag { font-size: 0.6rem; }
    .bet-stepper { gap: 6px; margin: 2px 0; }
    .bet-btn { width: 28px; height: 28px; font-size: 1rem; }
    .bet-display { font-size: 0.82rem; min-width: 80px; }
    .risk-options { gap: 4px; }
    .risk-btn { padding: 5px 8px; font-size: 0.72rem; }
    .risk-btn small { font-size: 0.58rem; }
    .spin-btn { width: 100%; padding: 9px; font-size: 1rem; margin-top: 4px; }
    .modern-toggle { font-size: 0.72rem; padding: 6px 10px; }
    .bottom-tab-bar { position: fixed; bottom: 0; left: 0; width: 100%; height: 56px; display: flex !important; background: #0a0a0a; border-top: 1px solid rgba(212,175,55,0.3); z-index: 1000; }
    .tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; border: none; color: #666; font-size: 1rem; cursor: pointer; padding: 6px; border-top: 2px solid transparent; transition: all 0.2s; }
    .tab-btn.active { color: var(--gold-primary); border-top-color: var(--gold-primary); }
    .tab-btn span { font-size: 0.6rem; font-family: Cinzel, serif; display: block; }
    .history-header { padding: 0 0 8px 0; margin: 0 0 8px 0; font-size: 0.75rem; }
    .log-item { padding: 6px 8px; font-size: 0.72rem; gap: 6px; }
}

@media (max-width: 600px) {
    .bottom-tab-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(56px + env(safe-area-inset-bottom)); }
}

/* Modals */
.modal-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    display: none; justify-content: center; align-items: center;
}
.modal-content {
    background: #111; border: 2px solid var(--gold-primary);
    padding: 20px; text-align: center; max-width: 90%; width: 450px;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.2); position: relative;
}
.ad-banner-large {
    width: 100%; height: 250px; background: #fff; color: #000;
    border: 1px solid #333; margin: 15px 0;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; font-size: 2rem;
}
.ad-timer { font-size: 3rem; color: #fff; margin: 10px 0; font-family: 'Cinzel'; }
.rules-list {
    text-align: left; color: #ccc; margin: 20px 0; padding-left: 20px;
    font-size: 0.9rem; line-height: 1.6;
}
