:root {
    --bg-dark: #101116;
    --panel-bg: #1b1c24;
    --accent-red: #ff2e4d;
    --accent-green: #2ecc71;
    --text-main: #ffffff;
    --text-muted: #8b8e99;
    --history-low: #3b82f6; /* Blue for < 2x */
    --history-mid: #a855f7; /* Purple for 2x-10x */
    --history-high: #ec4899; /* Pink for > 10x */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.game-wrapper {
    width: 100%;
    max-width: 1200px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.back-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 100;
}
.back-btn:hover { color: white; }

/* History Bar */
.history-bar {
    background-color: var(--panel-bg);
    border-radius: 8px;
    padding: 8px 15px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    height: 30px;
    align-items: center;
}
.history-item {
    font-size: 0.85rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    white-space: nowrap;
}
.history-item.low { color: var(--history-low); }
.history-item.mid { color: var(--history-mid); }
.history-item.high { color: var(--history-high); }

/* Stage Container */
.stage-container {
    position: relative;
    background-color: var(--panel-bg);
    border-radius: 12px;
    overflow: hidden;
    flex-grow: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.balance-display {
    position: absolute;
    top: 15px;
    right: 20px;
    font-weight: bold;
    color: var(--accent-green);
    z-index: 10;
    font-size: 1.1rem;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    flex-grow: 1;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.center-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.multiplier-text {
    font-size: 5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px rgba(255,255,255,0.3);
    margin: 0;
    line-height: 1;
}
.multiplier-text.crashed { color: var(--accent-red); text-shadow: 0 0 20px rgba(255, 46, 77, 0.5); }

.status-text {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.countdown-bar {
    width: 0%;
    height: 4px;
    background-color: var(--accent-red);
    margin: 15px auto 0;
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Controls Container */
.controls-container {
    display: flex;
    gap: 15px;
    height: 140px;
}

.bet-panel {
    flex: 1;
    background-color: var(--panel-bg);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(255,255,255,0.05);
}

.bet-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-group {
    display: flex;
    background: #0f1014;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #333;
}

.input-group input {
    width: 80px;
    background: transparent;
    border: none;
    color: white;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    outline: none;
}

.adjust-btn {
    background: #2a2c36;
    border: none;
    color: white;
    width: 30px;
    cursor: pointer;
    font-size: 1.2rem;
}
.adjust-btn:hover { background: #3a3c46; }

.quick-bets {
    display: flex;
    gap: 5px;
}
.quick-bets button {
    background: #2a2c36;
    border: none;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.quick-bets button:hover { background: #3a3c46; color: white; }

.auto-cashout-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auto-cashout-row input[type="number"] {
    width: 60px;
    background: #0f1014;
    border: 1px solid #333;
    color: white;
    padding: 4px;
    border-radius: 4px;
    text-align: center;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.action-btn .sub-text {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.8;
}

.bet-btn {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 4px 0 #27ae60;
}
.bet-btn:hover { background: #27ae60; }
.bet-btn:active { transform: translateY(4px); box-shadow: none; }

.cashout-btn {
    background: #e67e22; /* Orange for cashout */
    color: white;
    box-shadow: 0 4px 0 #d35400;
}
.cashout-btn:hover { background: #d35400; }

.cancel-btn {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 4px 0 #c0392b;
}
.cancel-btn:hover { background: #c0392b; }

.waiting-btn {
    background: #333;
    color: #888;
    box-shadow: none;
    cursor: not-allowed;
}