:root {
    --bg-dark: #06060a;
    --bg-card: #11111a;
    --bg-input: #1a1a26;
    --accent: #85f1d0;
    --accent-hover: #6ed4b5;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #85f1d0;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

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

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, #1e1b4b 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, #0f172a 0%, transparent 50%);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100vh;
    height: 100dvh;
    font-family: var(--font-sans);
    color: var(--text-primary);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 100px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    background: var(--bg-card);
}

@media (min-width: 1024px) {
    #game-container {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
}

@media (max-width: 600px) {
    .bet-controls {
        flex-direction: column;
        gap: 8px;
    }
    #multiplier-display {
        top: 12px;
        left: 12px;
        padding: 8px 12px;
    }
    #multiplier-value {
        font-size: 22px;
    }
    #bet-panel {
        padding: 16px;
        gap: 12px;
    }
    .quick-bets {
        margin-top: 8px !important;
    }
    #action-btn, #cashout-btn, #cancel-auto-btn {
        padding: 12px;
        font-size: 16px;
        margin-top: 8px !important;
    }
    header {
        padding: 12px 16px;
    }
    .logo {
        font-size: 18px;
    }
}

@media (max-height: 600px) {
    header {
        padding: 8px 16px;
    }
    #bet-panel {
        padding: 12px 16px;
        gap: 8px;
    }
    .quick-bets {
        display: none;
    }
    #action-btn, #cashout-btn {
        padding: 10px;
        margin-top: 4px !important;
    }
}

header {
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.balance-box {
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.balance-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.balance-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

#main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

#sidebar {
    width: 260px;
    background: rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 20px;
    min-height: 0;
}

@media (max-width: 768px) {
    #sidebar { display: none; }
}

.sidebar-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.1em;
}

#main-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #11111a 0%, #06060a 100%);
    min-height: 0;
    flex-shrink: 1;
}

#multiplier-display {
    position: absolute;
    top: 24px;
    left: 24px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 14px;
    text-align: left;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    min-width: 100px;
}

#multiplier-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    transition: color 0.3s;
}

#multiplier-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
}

svg#canvas {
    width: 100%;
    height: 100%;
}

#bet-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    padding: 10px 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    flex-shrink: 0;
}

#betting-ui {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auto-controls-row {
    display: flex;
    gap: 8px;
}

.auto-control-box {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 18px;
}

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

input:checked + .slider {
    background-color: var(--accent);
}

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

.auto-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mini-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-prefix {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}

#auto-cashout {
    width: 50px !important;
    padding: 0 !important;
    font-size: 14px !important;
    text-align: right;
    background: transparent;
    border: none;
    color: white;
    font-weight: 600;
    outline: none;
}

.bet-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group.bet-amount {
    width: 100%;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: var(--accent);
}

.input-prefix {
    color: var(--accent);
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 16px;
    margin-right: 8px;
    user-select: none;
}

#bet-input, #auto-cashout {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    padding: 10px 0;
    font-size: 16px;
    font-weight: 600;
    box-sizing: border-box;
    outline: none;
    flex: 1;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.checkbox-wrapper input {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

#active-ui {
    display: none;
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
}

#cashout-btn {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
    letter-spacing: 0.05em;
    background: var(--success);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

#cashout-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

#cashout-btn .live-amount {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
    font-family: var(--font-mono);
}

#cancel-auto-btn {
    flex: 1;
    padding: 14px;
    background: var(--danger);
    border: none;
    color: white;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.3);
}

#cancel-auto-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.input-group {
    flex: 1;
    position: relative;
}

.quick-bets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.btn-small {
    font-family: var(--font-display);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px 0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#action-btn {
    font-family: var(--font-display);
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.05em;
    background: var(--accent);
    color: #0f172a;
}

#action-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.btn-bet { background: var(--accent); color: #0f172a; }
.btn-bet:hover { background: var(--accent-hover); }
.btn-cashout { background: var(--success); color: white; }
.btn-cashout:hover { filter: brightness(1.1); }
.btn-disabled { background: #475569 !important; color: #94a3b8 !important; cursor: not-allowed !important; box-shadow: none !important; }

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 24px;
    max-width: 85%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

.modal h2 { margin-top: 0; color: var(--accent); font-family: var(--font-display); }
.modal p { color: var(--text-secondary); line-height: 1.6; font-size: 14px; }
.close-modal {
    margin-top: 24px;
    background: var(--glass);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

#result-toast {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 200px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    padding: 10px 20px;
    border-radius: 999px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--glass-border);
}

#result-toast.active {
    opacity: 1;
    top: 30px;
}

.toast-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 800;
    margin: 0;
    white-space: nowrap;
}

.toast-amount {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    white-space: nowrap;
}

.toast-title.win { color: var(--success); }
.toast-amount.win { color: var(--success); }
.toast-title.loss { color: var(--danger); }
.toast-amount.loss { color: var(--danger); }

#profit-indicator {
    position: absolute;
    bottom: 24px;
    right: 24px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

@keyframes screenShake {
    0% { transform: translate(0, 0); }
    25% { transform: translate(5px, -5px); }
    50% { transform: translate(-5px, 5px); }
    75% { transform: translate(5px, 5px); }
    100% { transform: translate(0, 0); }
}

.screen-shake {
    animation: screenShake 0.1s infinite;
}

#valve-handle {
    transition: transform 0.1s;
    cursor: pointer;
    transform-origin: 12.5px -7.5px;
}

#valve-handle.pressed {
    transform: rotate(45deg);
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    font-family: var(--font-display);
    font-size: 64px;
    color: var(--accent);
    margin-bottom: 40px;
    text-shadow: 0 0 30px rgba(133, 241, 208, 0.3);
    opacity: 0;
    transform: translateY(20px);
    animation: splashFadeIn 1s forwards 0.2s;
}

.loading-container {
    width: 240px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(133, 241, 208, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: containerPulse 2s infinite ease-in-out;
}

@keyframes containerPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(133, 241, 208, 0.1); }
    50% { box-shadow: 0 0 30px rgba(133, 241, 208, 0.3); }
}

.loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #ffffff, var(--accent));
    background-size: 200% 100%;
    box-shadow: 0 0 15px var(--accent);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0% 0; }
}

.loading-text {
    margin-top: 20px;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-weight: 700;
    animation: textPulse 1.5s infinite ease-in-out;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes splashFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#start-prompt {
    margin-top: 30px;
    padding: 12px 32px;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    display: none;
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(133, 241, 208, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(133, 241, 208, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(133, 241, 208, 0); }
}

@keyframes gasFlow {
    to { stroke-dashoffset: -20; }
}

/* ===== BONUS MODAL ===== */
#bonus-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bonus-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}
.bonus-modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1f2e 0%, #0f172a 100%);
    border: 2px solid #4aedc4;
    border-radius: 24px;
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 0 60px rgba(74, 237, 196, 0.3), 0 0 120px rgba(74, 237, 196, 0.1);
    animation: bonusModalIn 0.5s ease-out;
}
@keyframes bonusModalIn {
    from { transform: scale(0.7) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.bonus-modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bonusBounce 1s ease infinite;
}
@keyframes bonusBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.bonus-modal-title {
    font-size: 32px;
    font-weight: 900;
    color: #4aedc4;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}
.bonus-modal-text {
    color: #94a3b8;
    font-size: 16px;
    margin: 0 0 20px 0;
}
.bonus-modal-amount {
    font-size: 40px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 28px;
    text-shadow: 0 0 20px rgba(74, 237, 196, 0.5);
}
.bonus-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #4aedc4;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    padding: 16px 48px;
    border-radius: 16px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    box-shadow: 0 6px 0 #2eb89a, 0 0 30px rgba(74, 237, 196, 0.4);
}
.bonus-modal-btn:hover {
    background: #3cd4af;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #2eb89a, 0 0 40px rgba(74, 237, 196, 0.5);
}
.bonus-modal-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #2eb89a;
}
