html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #1e2127;
    color: #e0e0e0;
    line-height: 1.5;
    padding-top: 50px;
    box-sizing: border-box;
    min-height: 100vh;
    height: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #1a1f25;
    z-index: 1000;
    height: 45px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.bankroll {
    font-size: 1.1em;
    color: #28a745;
    font-weight: 600;
}

.digital-clock {
    font-family: 'Orbitron', 'Courier New', Courier, monospace;
    font-size: 1.8em;
    color: #32cd32;
    background-color: #1a1a1a;
    padding: 4px 12px;
    border-radius: 5px;
    border: 1px solid #2a2a2a;
    text-shadow: 0 0 3px rgba(50, 205, 50, 0.7), 0 0 6px rgba(50, 205, 50, 0.5);
    letter-spacing: 1px;
}

.main-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1000px;
    padding: 5px;
    gap: 10px;
    box-sizing: border-box;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    max-width: 350px;
}

.side-panel {
    width: 320px;
    flex-shrink: 0;
    background-color: #282c34;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    align-self: stretch;
}

@media (max-width: 900px) {
    .main-container { 
        flex-direction: column; 
        align-items: center; 
        height: auto;
        max-height: none;
    }
    .side-panel { width: 100%; max-width: 550px; margin-top: 20px; }
}

h1 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.6em;
    font-weight: 600;
    text-align: center;
}

.simulation-container {
    background-color: #282c34;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    padding: 2px;
    width: 100%;
    box-sizing: border-box;
}

#simulationCanvas {
    display: block;
    background-color: #282c34;
    border-radius: 6px;
    max-width: 100%;
    width: 320px !important;
    height: 320px !important;
}

.betting-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 6px;
    background-color: #2c313a;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px;
    background-color: #2c313a;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.speed-label {
    color: #e0e0e0;
    font-size: 0.9em;
    font-weight: 500;
    min-width: 45px;
}

.speed-buttons {
    display: flex;
    gap: 4px;
    flex-grow: 1;
}

.speed-button {
    background-color: #4a5058;
    color: #ffffff;
    border: 2px solid #6c757d;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease;
    flex-grow: 1;
}

.speed-button:hover:not(:disabled) {
    background-color: #5a6268;
    border-color: #888e99;
}

.speed-button.selected {
    background-color: #17a2b8;
    border-color: #117a8b;
    box-shadow: 0 0 8px rgba(23, 162, 184, 0.6);
}

.speed-button:disabled {
    background-color: #3a3f47;
    color: #888c92;
    border-color: #4a5058;
    cursor: not-allowed;
    box-shadow: none;
}

.chips-container { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.chip {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid #4f545c;
    color: #ffffff; font-size: 11px; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.chip:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 3px 6px rgba(0,0,0,0.3); }
.chip:active:not(:disabled) { transform: scale(0.98); }
.chip[data-value="1"] { background-color: #adb5bd; border-color: #6c757d;}
.chip[data-value="5"] { background-color: #dc3545; border-color: #a71d2a;}
.chip[data-value="10"] { background-color: #007bff; border-color: #0056b3;}
.chip[data-value="25"] { background-color: #28a745; border-color: #19692c;}
.chip[data-value="100"] { background-color: #343a40; border-color: #1d2124; color: #fff;}
.chip:disabled {
    opacity: 0.5; cursor: not-allowed;
    background-image: repeating-linear-gradient( 45deg, transparent, transparent 4px, rgba(0,0,0,0.1) 4px, rgba(0,0,0,0.1) 8px );
}

.current-bet-section { display: flex; align-items: center; gap: 6px; }
.current-bet {
    font-size: 1em; color: #ffc107; font-weight: 600;
    padding: 4px 7px; background-color: #3a3f47; border-radius: 4px;
}
.clear-bet-button {
    background-color: #ffc107; color: #212529; border: none;
    padding: 4px 8px; font-size: 11px; font-weight: 500;
    border-radius: 6px; cursor: pointer; transition: background-color 0.2s ease-in-out;
}
.clear-bet-button:hover:not(:disabled) { background-color: #e0a800; }
.clear-bet-button:disabled { background-color: #7d6a2c; color: #aaa; cursor: not-allowed; }

.betting-controls { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; margin-top: 0; }
.bet-option-button {
    background-color: #4a5058; color: #ffffff; border: 2px solid #6c757d;
    padding: 5px 8px; font-size: 11px; font-weight: 500; border-radius: 6px;
    cursor: pointer; transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease;
}
.bet-option-button:hover:not(:disabled) { background-color: #5a6268; border-color: #888e99; }
.bet-option-button.selected {
    background-color: #28a745; border-color: #1c7430;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
}
.bet-option-button:disabled { background-color: #3a3f47; color: #888c92; border-color: #4a5058; cursor: not-allowed; box-shadow: none; }

/* Container for Start buttons */
.start-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
    width: 100%;
}

button#startButton, button#simulate10xButton, button#simulate100xButton {
    color: #ffffff; border: none;
    padding: 7px 10px; font-size: 12px; border-radius: 6px;
    flex-grow: 1;
    max-width: 100px;
}

button#startButton {
    background-color: #17a2b8; /* Teal */
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.2);
}
button#startButton:hover:not(:disabled) { background-color: #117a8b; transform: translateY(-1px); }

button#simulate10xButton {
    background-color: #fd7e14; /* Orange */
    box-shadow: 0 3px 8px rgba(253, 126, 20, 0.2);
}
button#simulate10xButton:hover:not(:disabled) { background-color: #e36700; transform: translateY(-1px); }

button#simulate100xButton {
    background-color: #6f42c1; /* Purple */
    color: #ffffff;
    border: none;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    flex-grow: 1;
    max-width: 100px;
    box-shadow: 0 3px 8px rgba(111, 66, 193, 0.2);
}
button#simulate100xButton:hover:not(:disabled) {
    background-color: #563d7c;
    transform: translateY(-1px);
}
button#simulate100xButton:disabled {
    background-color: #4a5058;
    color: #888c92;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

button#simulate1000xButton {
    background-color: #20c997; /* Teal */
    color: #ffffff;
    border: none;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    flex-grow: 1;
    max-width: 100px;
    box-shadow: 0 3px 8px rgba(32, 201, 151, 0.2);
}
button#simulate1000xButton:hover:not(:disabled) {
    background-color: #1ba87e;
    transform: translateY(-1px);
}
button#simulate1000xButton:disabled {
    background-color: #4a5058;
    color: #888c92;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

button#startButton:disabled, button#simulate10xButton:disabled {
    background-color: #4a5058; color: #888c92; cursor: not-allowed; box-shadow: none; transform: none;
}

/* Cancel Button Style */
button#cancelSimulationButton {
    background-color: #dc3545; /* Red */
    color: #ffffff;
    border: none;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    margin-bottom: 6px;
    width: 100%;
    max-width: 100px;
}
button#cancelSimulationButton:hover {
    background-color: #c82333;
}


#resultDisplay {
    font-size: 1em; font-weight: 600; padding: 5px 8px; border-radius: 6px;
    min-width: 90px; text-align: center; background-color: #2c313a;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.2); margin-bottom: 6px;
}
#resultDisplay.default { color: #a0a0a0; }
#resultDisplay.in { color: #28a745; font-weight: 700; }
#resultDisplay.out { color: #dc3545; font-weight: 700; }

.payout-message {
    margin-top: 3px; font-size: 0.95em; min-height: 16px;
    text-align: center; font-weight: 600; margin-bottom: 8px;
}
.payout-message.win { color: #28a745; }
.payout-message.lose { color: #dc3545; }
.payout-message.no-bet { color: #adb5bd; }
.payout-message.info { color: #17a2b8; } /* Info color for multi-run status */


.reset-button {
    background-color: #6c757d; color: #ffffff; border: none;
    padding: 5px 8px; font-size: 11px; font-weight: 500; border-radius: 6px;
    cursor: pointer; transition: background-color 0.2s ease-in-out;
    margin-top: 6px;
}
.reset-button:hover { background-color: #5a6268; }

/* Side Panel Specific Styles */
.side-panel h2 {
    text-align: center; color: #e0e0e0; margin-top: 0; margin-bottom: 6px;
    font-size: 1em; border-bottom: 1px solid #4a5058; padding-bottom: 3px;
}
.zoom-view-container {
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 16px;
    background-color: #1e2127; border: 1px solid #4a5058;
    border-radius: 6px; padding: 4px; height: 200px;
}
#zoomCanvas { display: block; background-color: #1e2127; border-radius: 4px; width: 180px !important; height: 180px !important; }
.history-table-container {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid #4a5058;
    border-radius: 6px;
    background-color: #1e2127;
}
#historyTable { width: 100%; border-collapse: collapse; font-size: 0.9em; }
#historyTable th, #historyTable td { border: 1px solid #4a5058; padding: 6px 8px; text-align: center; font-size: 0.95em; }
#historyTable th { background-color: #3a3f47; color: #e0e0e0; position: sticky; top: 0; z-index: 1; }
#historyTable tbody tr:nth-child(even) { background-color: #2c313a; }
#historyTable tbody tr:hover { background-color: #3a3f47; }
#historyTable td.win { color: #28a745; font-weight: bold; }
#historyTable td.lose { color: #dc3545; font-weight: bold; }
#historyTable td.no-bet { color: #adb5bd; }