:root {
    --table-green: #0b5e32;
    --table-gradient: linear-gradient(135deg, #0f6c3a 0%, #06381d 100%);
    --border-color: rgba(255, 215, 0, 0.4);
    --roulette-red: #d32f2f;
    --roulette-black: #1a1a1a;
    --roulette-green: #00b300;
    --gold: #d4af37;
    --gold-bright: #ffd700;
    --text-light: #ffffff;
    
    /* Chip Colors */
    --chip-5: #f44336;
    --chip-10: #2196f3;
    --chip-30: #4caf50;
    --chip-50: #ff9800;
    --chip-100: #9c27b0;
    --chip-1000: #ffd700;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Casino Felt Background Generation */
    background-color: #0a1f12;
    background-image: 
        radial-gradient(circle at 50% -20%, #164a2b 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h20v20H0V0zm10 10h10v10H10V10zM0 10h10v10H0V10zm10-10h10v10H10V0z' fill='%23000000' fill-opacity='0.08' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(to bottom, #2a2a2a, #111);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    font-size: 1.1rem;
    font-weight: bold;
    z-index: 100;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.4);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.label { color: #aaa; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
.value.gold { color: var(--gold-bright); text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }

/* Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

@media (min-width: 992px) {
    .game-area {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding-bottom: 0;
    }
    .wheel-section { flex: 0 0 400px; }
    .table-section { flex: 1; overflow: hidden; padding-right: 20px; }
}

/* Wheel */
.wheel-section {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 260px; /* Mobile size */
    height: 260px; /* Mobile size */
    border-radius: 50%;
    border: 10px solid #222;
    box-shadow: 0 0 30px rgba(0,0,0,0.9), inset 0 0 15px rgba(0,0,0,0.8);
    background: #111;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .wheel-container {
        width: 340px;
        height: 340px;
        border-width: 14px;
    }
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    will-change: transform;
}

.marker {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 24px solid var(--gold-bright);
    z-index: 10;
    filter: drop-shadow(0px 4px 4px rgba(0,0,0,0.6));
}

.pocket {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 30px;
    margin-left: -10px;
    margin-top: -15px;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    transform-origin: center center;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2px;
}

@media (min-width: 768px) {
    .pocket { font-size: 14px; }
}

/* Table / Board */
.table-section {
    display: flex;
    flex-direction: column;
    padding: 10px;
    width: 100%;
}

.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px 5px;
}

/* Custom Scrollbar for the table */
.table-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}
.table-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

.board-container {
    min-width: 800px;
    max-width: 950px;
    background: var(--table-gradient);
    padding: 12px;
    border-radius: 12px;
    border: 4px solid #8b6508;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 30px rgba(0,0,0,0.7);
    margin: 0 auto;
    position: relative;
}

.board-top, .board-bottom {
    display: flex;
}

.board-top { height: 180px; }

/* Grid specific sections */
.zero-area {
    flex: 0 0 6%;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    font-weight: bold;
    position: relative;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.numbers-area {
    flex: 0 0 86%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(3, 1fr);
    position: relative;
}

.number-cell {
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    font-weight: bold;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.number-cell.red { background-color: rgba(211, 47, 47, 0.9); }
.number-cell.black { background-color: rgba(26, 26, 26, 0.9); }

.columns-area {
    flex: 0 0 8%;
    display: grid;
    grid-template-rows: repeat(3, 1fr);
}

.col-bet {
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    position: relative;
    font-size: 1.1rem;
}

.col-bet:first-child { border-top-right-radius: 8px; }
.col-bet:last-child { border-bottom-right-radius: 8px; }

.zero-spacer { flex: 0 0 6%; }
.col-spacer { flex: 0 0 8%; }
.bottom-bets-area {
    flex: 0 0 86%;
    display: flex;
    flex-direction: column;
}

.dozens-row, .outside-row {
    display: flex;
    height: 55px;
}

.dozen-bet, .outside-bet {
    flex: 1;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    position: relative;
    letter-spacing: 1px;
}

.red-diamond { width: 22px; height: 22px; background-color: var(--roulette-red); transform: rotate(45deg); box-shadow: 1px 1px 3px rgba(0,0,0,0.5); }
.black-diamond { width: 22px; height: 22px; background-color: var(--roulette-black); transform: rotate(45deg); box-shadow: 1px 1px 3px rgba(0,0,0,0.5); }

/* Interaction & Hitboxes */
.board-btn {
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.board-btn:active { opacity: 0.8; }

/* Invisible Hitbox Layer for exact positioning over main numbers */
.hitboxes-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

.hitbox {
    position: absolute;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 50%;
}

/* Hover effects to show playable area */
.hitbox:hover { background-color: rgba(255, 215, 0, 0.3); box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.board-btn:hover::after {
    content: '';
    position: absolute; top:0; left:0; right:0; bottom:0;
    background-color: rgba(255, 215, 0, 0.15);
    pointer-events: none;
}

/* Chips Rendering */
.chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    border: 3px dashed rgba(255,255,255,0.7);
    box-shadow: 0 3px 6px rgba(0,0,0,0.6), inset 0 0 4px rgba(0,0,0,0.5);
    position: absolute;
    z-index: 30;
    pointer-events: none;
}

/* Controls */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 5px;
    padding: 0 10px;
}

.chips-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.chip-select {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    border: 4px dashed rgba(255,255,255,0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.chip-select:hover { transform: scale(1.1); }
.chip-select.selected {
    transform: scale(1.15) translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.6), 0 0 15px var(--gold-bright);
    border: 4px solid var(--gold-bright);
}

.chip-select[data-value="5"] { background-color: var(--chip-5); }
.chip-select[data-value="10"] { background-color: var(--chip-10); }
.chip-select[data-value="30"] { background-color: var(--chip-30); }
.chip-select[data-value="50"] { background-color: var(--chip-50); }
.chip-select[data-value="100"] { background-color: var(--chip-100); }
.chip-select[data-value="1000"] { background-color: var(--chip-1000); color: black; border-color: #aa7c00; }

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

.btn:active { transform: translateY(2px); box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(100%); }

.btn-primary { 
    background: linear-gradient(to bottom, #ffe066, #d4af37); 
    color: #000; 
    border: 1px solid #aa7c00;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }

.btn-secondary { 
    background: linear-gradient(to bottom, #444, #222); 
    color: white; 
    border: 1px solid #555; 
}
.btn-secondary:hover:not(:disabled) { background: linear-gradient(to bottom, #555, #333); }

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid var(--gold-bright);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .status-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .action-buttons .btn {
        padding: 12px 20px;
        flex: 1;
        min-width: 100px;
    }
    .btn-primary {
        flex: 100%; /* Make spin full width on very small screens */
    }
}