:root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --primary-color: #e67e22;
    --green: #27ae60;
    --red: #c0392b;
    --black: #2c3e50;
    --text-color: #ecf0f1;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    width: 95%;
    max-width: 1200px;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

header h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

main {
    display: grid;
    grid-template-columns: 250px 1fr 1.5fr;
    gap: 20px;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
}

.game-timer {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    background: #3d3d3d;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
}

.player-item .bal { color: var(--green); font-weight: bold; }

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px var(--primary-color);
}

.modal-content h2 { color: var(--primary-color); margin-bottom: 20px; }

.modal-content input {
    padding: 12px;
    width: 250px;
    border-radius: 5px;
    border: none;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.modal-content button {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

/* Wheel Styles */
.wheel-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 10px solid #444;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

.wheel {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: transform 5s cubic-bezier(0.1, 0, 0.1, 1);
    overflow: hidden;
}

.wheel-number {
    position: absolute;
    width: 50%;
    height: 70px;
    top: calc(50% - 35px);
    left: 50%;
    transform-origin: left center;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    font-weight: bold;
    color: white;
    box-sizing: border-box;
    pointer-events: none;
}

.wheel-number span {
    display: block;
    width: 30px;
    text-align: center;
    /* Significant translateY to nudge the number further right into the visual center */
    transform: rotate(90deg) translateY(-10px); 
    font-size: 1.1em;
}

.wheel-number div {
    z-index: -1;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: #555;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    z-index: 5;
}

.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    width: 20px;
    height: 40px;
    background: gold;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    transform: translateX(-50%);
    z-index: 10;
}

.ball-container {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 4;
    transition: transform 5s cubic-bezier(0.1, 0, 0.1, 1);
}

.ball {
    position: absolute;
    top: 45px; /* Lowered from 30px */
    left: 50%;
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Betting Board Styles */
.betting-board {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    grid-template-rows: repeat(5, 50px);
    gap: 2px;
    background: #444;
    padding: 2px;
    border-radius: 5px;
}

.bet-item {
    background: var(--green);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    transition: filter 0.2s;
    position: relative;
    user-select: none;
}

.bet-item:hover {
    filter: brightness(1.2);
}

.bet-item.red { background: var(--red); }
.bet-item.black { background: var(--black); }
.bet-item.zero { background: var(--green); grid-row: 1 / 4; grid-column: 1; }

.bet-item.outside { background: #34495e; font-size: 0.8em; }

/* Control Section */
.controls-section {
    margin-top: 20px;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.chip-selection {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.chip {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px dashed white;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.chip-1 { background-color: #ecf0f1; color: #2c3e50; }
.chip-5 { background-color: #e74c3c; }
.chip-10 { background-color: #3498db; }
.chip-25 { background-color: #2ecc71; }
.chip-100 { background-color: #000000; border-color: #f1c40f; }

.chip.active {
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
    border-style: solid;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

#spin-btn {
    padding: 15px 40px;
    background: var(--primary-color);
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#spin-btn:hover {
    background: #d35400;
    transform: translateY(-2px);
}

#spin-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

#clear-btn {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid #7f8c8d;
    color: #7f8c8d;
    border-radius: 20px;
    cursor: pointer;
}

.history-section h3 {
    font-size: 1em;
    margin-bottom: 10px;
}

.history-list {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.history-item {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.8em;
    flex-shrink: 0;
}

.history-item.red { background: var(--red); }
.history-item.black { background: var(--black); }
.history-item.green { background: var(--green); }

.placed-chip {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-size: 0.75em;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    z-index: 5;
}

.placed-chip.color-1 { background-color: #ecf0f1; color: #2c3e50; border-color: #bdc3c7; }
.placed-chip.color-5 { background-color: #e74c3c; }
.placed-chip.color-10 { background-color: #3498db; }
.placed-chip.color-25 { background-color: #2ecc71; }
.placed-chip.color-100 { background-color: #000000; border-color: #f1c40f; }

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
    .wheel-container {
        width: 300px;
        height: 300px;
    }
}

/* Custom Alert Modal (Non-blocking) */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 400px;
    width: 90%;
    border: 2px solid var(--primary-color);
    animation: modalSlideIn 0.3s ease;
}

.custom-modal-content h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: 1.8em;
}

.custom-modal-content p {
    font-size: 1.2em;
    margin: 15px 0 25px 0;
    line-height: 1.4;
}

.custom-modal-content button {
    padding: 10px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.custom-modal-content button:hover {
    background: #d35400;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}