:root {
    --bg-gradient: linear-gradient(to bottom, #100B26, #1B143F);
    --accent-purple: #7D52FF;
    --action-orange: #FF9900;
    --high-multiplier: #D4A017;
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --bg-card: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.tab-button {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 10px 20px;
    margin: 0 5px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    touch-action: manipulation;
}

.tab-button.active, .tab-button:hover {
    background: #00ff88;
    color: #0a0f1a;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.tab-content {
    max-width: 400px;
    margin: 0 auto;
}

.stats-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    color: #ffffff;
}

.energy-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88 0%, #00cc66 100%);
    transition: width 0.3s ease;
    border-radius: 10px;
}

#tap-button {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #ff5722 0%, #d84315 100%);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px auto;
    display: block;
    box-shadow: 0 0 30px rgba(255, 87, 34, 0.5);
    transition: all 0.2s ease;
    touch-action: manipulation;
}

#tap-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 87, 34, 0.7);
}

#tap-button:active {
    transform: scale(0.95);
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { box-shadow: 0 0 30px rgba(255, 87, 34, 0.5); }
    50% { box-shadow: 0 0 50px rgba(255, 87, 34, 0.8); }
    100% { box-shadow: 0 0 30px rgba(255, 87, 34, 0.5); }
}

.upgrades {
    margin-top: 20px;
}

.upgrade-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
}

.upgrade-icon {
    font-size: 24px;
    margin-right: 15px;
}

.upgrade-info {
    flex: 1;
}

.upgrade-info div:first-child {
    font-weight: bold;
    margin-bottom: 5px;
}

.cost {
    color: #ffffff;
    font-size: 14px;
}

.upgrade-card button {
    background: #00ff88;
    color: #0a0f1a;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.upgrade-card button:hover {
    background: #00cc66;
    transform: translateY(-2px);
}

input {
    width: 100%;
    padding: 12px;
    border: 1px solid #00ff88;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #00ff88;
    margin-bottom: 15px;
    font-size: 16px;
}

input::placeholder {
    color: rgba(0, 255, 136, 0.7);
}

button {
    background: #00ff88;
    color: #0a0f1a;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

button:hover {
    background: #00cc66;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.3);
}

#multiplier-display {
    font-size: 48px;
    font-weight: bold;
    text-align: center;
    margin: 30px 0;
    background: linear-gradient(45deg, #00ff88 0%, #ffaa00 50%, #ff4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(0, 255, 136, 0.5); }
    to { text-shadow: 0 0 30px rgba(0, 255, 136, 0.8); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

#crash-status {
    text-align: center;
    margin-top: 20px;
    font-weight: bold;
}

#leaderboard-list {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.slots-panel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.slot-machine {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.slot-cell {
    width: 28%;
    padding: 20px 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 18px;
    font-size: 42px;
    color: #ffffff;
    box-shadow: inset 0 0 15px rgba(0, 255, 136, 0.1);
    transition: transform 0.2s ease;
}

#spin-button {
    width: 100%;
    margin-top: 10px;
}

.slot-bonus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.slot-bonus-dialog {
    background: rgba(18, 18, 32, 0.98);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 20px;
    padding: 20px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.slot-bonus-dialog h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.slot-bonus-chests {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.chest-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 16px;
    color: #ffffff;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.chest-btn:hover {
    transform: translateY(-3px);
    background: rgba(0, 255, 136, 0.12);
}

.close-bonus-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 10px;
}

.bet-input {
    margin-bottom: 15px;
}

.bet-input label {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

/* Crash Game Layout - Header with History and Balance */
.crash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.crash-history {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.history-list {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    min-width: max-content;
}

.history-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.badge-purple {
    background: var(--accent-purple);
    color: white;
}

.badge-gold {
    background: var(--high-multiplier);
    color: white;
}

.crash-balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 10px;
    min-width: 80px;
}

.balance-icon {
    font-size: 24px;
}

.balance-value {
    font-weight: bold;
    font-size: 18px;
    color: var(--text-primary);
}

/* Main Game Stage */
.crash-stage {
    position: relative;
    height: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.multiplier-display {
    font-size: 4rem;
    font-weight: bold;
    color: var(--accent-purple);
    text-shadow: 0 0 20px rgba(125, 82, 255, 0.5);
    margin: 0;
    z-index: 2;
}

.character-container {
    position: relative;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character {
    font-size: 3rem;
    animation: floating 2s ease-in-out infinite;
    z-index: 2;
}

.growth-curve {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Betting Panel - Adapted Layout */
.crash-betting-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.betting-header {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    color: var(--text-primary);
}

.auto-withdraw-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auto-withdraw-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.auto-withdraw-input {
    width: 100% !important;
    padding: 10px 35px 10px 10px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    text-align: center !important;
    margin-bottom: 0 !important;
}

.auto-withdraw-suffix {
    position: absolute;
    right: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    pointer-events: none;
}

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

.toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #555;
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

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

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label-compact {
    font-size: 14px;
    font-weight: 500;
}

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

.quick-btn {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.quick-btn:hover {
    background: var(--accent-purple);
    color: white;
    border-color: var(--accent-purple);
}

.quick-btn:active {
    transform: scale(0.95);
}

.bet-amount-input {
    padding: 12px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    font-size: 16px !important;
    text-align: center !important;
    margin-bottom: 0 !important;
}

.bet-amount-input::placeholder {
    color: var(--text-secondary);
}

.betting-buttons {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: var(--accent-purple);
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.action-btn:hover:not(.btn-disabled) {
    background: #6940d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(125, 82, 255, 0.4);
}

.action-btn.btn-active {
    background: var(--action-orange);
}

.action-btn.btn-active:hover {
    background: #ff8c00;
    box-shadow: 0 4px 16px rgba(255, 153, 0, 0.4);
}

.action-btn.btn-disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Legacy Crash Styles */
.crash-history {
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.badge-blue {
    background: #4A90E2;
    color: white;
}

.betting-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    display: none;
}

.bet-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-header {
    font-weight: bold;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.amount-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amount-controls input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-align: center;
    font-size: 16px;
}

.amount-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--accent-purple);
    color: white;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#crash-status {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    color: #00ff88;
    font-size: 16pxrtant;
    color: var(--text-primary) !important;
    font-size: 16px !important;
    text-align: center !important;
    margin-bottom: 0 !important;
}

.bet-amount-input::placeholder {
    color: var(--text-secondary);
}

.betting-buttons {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: var(--accent-purple);
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.action-btn:hover:not(.btn-disabled) {
    background: #6940d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(125, 82, 255, 0.4);
}

.action-btn.btn-active {
    background: var(--action-orange);
}

.action-btn.btn-active:hover {
    background: #ff8c00;
    box-shadow: 0 4px 16px rgba(255, 153, 0, 0.4);
}

.action-btn.btn-disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Legacy Crash Styles */
.crash-history {
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.badge-blue {
    background: #4A90E2;
    color: white;
}

.betting-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    display: none;
}

.bet-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-header {
    font-weight: bold;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.amount-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amount-controls input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-align: center;
    font-size: 16px;
}

.amount-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--accent-purple);
    color: white;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#crash-status {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    color: #00ff88;
    font-size: 16px;
}

#crash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.3);
    display: none;
    z-index: 9999;
    pointer-events: none;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    font-weight: bold;
}

.leaderboard-item span:first-child {
    min-width: 30px;
    color: #ffaa00;
}

.user-id {
    flex: 1;
    color: #00ff88;
}

.coins {
    color: #ffff00;
}


.payouts-table {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    overflow-x: auto;
}

.payouts-table h3 {
    text-align: center;
    color: #00ff88;
    margin-top: 0;
    font-size: 18px;
}

.payouts-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.payouts-table thead {
    background: rgba(0, 255, 136, 0.1);
}

.payouts-table th {
    padding: 12px;
    text-align: left;
    color: #00ff88;
    border-bottom: 2px solid rgba(0, 255, 136, 0.3);
    font-weight: bold;
}

.payouts-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
    color: #fff;
}

.payouts-table tbody tr:hover {
    background: rgba(0, 255, 136, 0.05);
}

.payouts-table tbody tr:last-child td {
    border-bottom: none;
}
