* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0d0f16;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    height: 100vh;
    overflow: hidden;
}

.crash-fullscreen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: radial-gradient(circle at top center, #1b1c31 0%, #0d0f16 100%);
}

/* --- ВЕРХНЯЯ НАВИГАЦИЯ --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(18, 20, 32, 0.95);
    border-bottom: 1px solid #2a2c47;
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    background: #1a1c2a;
    border: 1px solid #2d2f4a;
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: 0.2s;
}

.back-btn:hover {
    background: #2d2f4a;
    color: #fff;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
}

.logo span {
    color: #a855f7;
}

.balance-box {
    background: #1a1c2a;
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid #a855f7;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.balance-box span:first-child {
    color: #f59e0b;
}

/* --- ИСТОРИЯ --- */
.crash-history-bar {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(20, 22, 37, 0.8);
    border-bottom: 1px solid #2a2c47;
    height: 50px;
    align-items: center;
    overflow-x: auto;
}

.crash-history-bar::-webkit-scrollbar {
    display: none;
}

.history-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    background: #373a5e;
    white-space: nowrap;
}

.history-pill.blue {
    background: #3c82f6;
}

.history-pill.purple {
    background: #9d4edd;
}

.history-pill.gold {
    background: #f59e0b;
    color: #000;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* --- ПОЛЕ ИГРЫ --- */
.crash-viewport {
    position: relative;
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
}

#crashCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

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

.crash-multiplier-text {
    font-size: 5vw;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transition: color 0.1s;
}

.crash-multiplier-text.crashed {
    color: #ff3366;
    text-shadow: 0 0 30px rgba(255, 51, 102, 0.5);
}

.crash-status-text {
    font-size: 18px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: -15px;
    font-weight: 600;
}

.crash-status-text.loading {
    color: #f59e0b;
}

/* --- ПАНЕЛИ СТАВОК --- */
.crash-controls-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #121420;
    border-top: 1px solid #2a2c47;
    height: 190px;
}

.bet-panel {
    background: #1a1c2a;
    border: 1px solid #2d2f4a;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    color: #94a3b8;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2d2f4a;
    transition: 0.3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: '';
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #a855f7;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Обновленный бокс для ввода цели X */
.auto-target-box {
    display: flex;
    align-items: center;
    background: #121420;
    border: 1px solid #2d2f4a;
    border-radius: 6px;
    height: 28px;
    overflow: hidden;
}

.auto-target-box .prefix {
    color: #94a3b8;
    font-weight: 900;
    font-size: 12px;
    padding-left: 8px;
    padding-right: 2px;
}

.auto-target-box input {
    background: transparent;
    border: none;
    color: #fff;
    width: 40px;
    font-weight: bold;
    outline: none;
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
}

.auto-target-box input::-webkit-inner-spin-button {
    display: none;
}

/* Кастомные кнопки вверх/вниз */
.target-controls {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 100%;
    background: #1a1c2a;
    border-left: 1px solid #2d2f4a;
}

.target-controls button {
    flex: 1;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.target-controls button:hover {
    background: #2d2f4a;
    color: #fff;
}

.target-controls button:first-child {
    border-bottom: 1px solid #2d2f4a;
}

/* Ввод ставки и кнопка */
.bet-body {
    display: grid;
    grid-template-columns: 1fr 130px;
    gap: 12px;
    flex-grow: 1;
}

.bet-inputs {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bet-main-input {
    display: flex;
    align-items: center;
    background: #121420;
    border-radius: 8px;
    height: 40px;
}

.bet-main-input button {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 40px;
    font-size: 20px;
    cursor: pointer;
}

.bet-main-input button:hover {
    color: #fff;
}

.bet-main-input input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    outline: none;
    -moz-appearance: textfield;
}

.bet-main-input input::-webkit-inner-spin-button {
    display: none;
}

.bet-quick-adds {
    display: flex;
    gap: 6px;
}

.bet-quick-adds button {
    flex: 1;
    background: #252840;
    border: none;
    color: #94a3b8;
    border-radius: 6px;
    padding: 6px 0;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.bet-quick-adds button:hover {
    background: #373a5e;
    color: #fff;
}

/* Кнопка ставки */
.action-btn {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.action-btn:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
    transform: translateY(-2px);
}

.action-btn span.win-sum {
    font-size: 13px;
    font-weight: normal;
    margin-top: 2px;
}

/* Статусы кнопок */
.action-btn.cancel {
    background: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.action-btn.cashout {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.action-btn.disabled {
    background: #2d2f4a;
    color: #6b7280;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .crash-controls-wrapper {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    .bet-panel {
        max-width: 100%;
    }
}
