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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #0f1923;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.demo-banner {
    background: linear-gradient(90deg, #ff6b35, #f7c530);
    color: #0f1923;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
}

.app-container {
    display: flex;
    height: calc(100vh - 90px);
    padding: 16px;
    gap: 16px;
}

/* Controls Panel */
.controls-panel {
    width: 320px;
    background: #1a2c38;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.mode-toggle {
    display: flex;
    background: #0f1923;
    border-radius: 8px;
    overflow: hidden;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #6b8a9a;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: #2b4254;
    color: #ffffff;
}

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

.control-group label,
.label-row {
    font-size: 12px;
    color: #6b8a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-row {
    display: flex;
    justify-content: space-between;
}

.label-row .value {
    color: #ffffff;
}

.bet-input-row {
    display: flex;
    gap: 8px;
}

.bet-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #0f1923;
    border-radius: 8px;
    padding: 0 12px;
}

.btc-icon {
    color: #f7931a;
    font-size: 18px;
    margin-right: 8px;
}

.bet-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    padding: 12px 0;
    outline: none;
}

.quick-btn {
    padding: 12px 16px;
    background: #0f1923;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-btn:hover {
    background: #2b4254;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 16px;
    background: #0f1923;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    outline: none;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #6b8a9a;
    pointer-events: none;
}

.auto-controls {
    padding: 12px;
    background: #0f1923;
    border-radius: 8px;
}

.auto-controls input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: #1a2c38;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.auto-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
}

.bet-button {
    width: 100%;
    padding: 16px;
    background: #00e701;
    border: none;
    border-radius: 8px;
    color: #0f1923;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bet-button:hover:not(:disabled) {
    background: #00ff00;
    transform: translateY(-1px);
}

.bet-button:disabled {
    background: #3a5a6a;
    cursor: not-allowed;
}

.balance-display {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: #0f1923;
    border-radius: 8px;
}

.balance-display span:first-child {
    color: #6b8a9a;
    font-size: 13px;
}

.balance-value {
    font-weight: 600;
    color: #00e701;
}

.stats-panel {
    padding: 12px;
    background: #0f1923;
    border-radius: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
}

.stat-row span:first-child {
    color: #6b8a9a;
}

.stat-row .positive { color: #00e701; }
.stat-row .negative { color: #ff4757; }
.stat-row .neutral { color: #6b8a9a; }

.history-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.history-panel h3 {
    font-size: 13px;
    color: #6b8a9a;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0f1923;
    border-radius: 6px;
    font-size: 12px;
}

.history-item.win { border-left: 3px solid #00e701; }
.history-item.loss { border-left: 3px solid #ff4757; }

.history-item .multiplier {
    color: #f7c530;
    font-weight: 600;
}

/* Game Area */
.game-area {
    flex: 1;
    position: relative;
    background: #0f1923;
    border-radius: 12px;
    overflow: hidden;
}

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

.win-notification {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.win-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.win-notification.win { 
    color: #00e701;
    box-shadow: 0 0 30px rgba(0, 231, 1, 0.3);
}

.win-notification.loss { 
    color: #ff4757; 
}

.win-notification.big-win {
    font-size: 36px;
    animation: bigWin 0.5s ease;
}

@keyframes bigWin {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

/* Footer */
.footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #1a2c38;
}

.footer-left,
.footer-right {
    display: flex;
    gap: 12px;
}

.footer-center a {
    color: #6b8a9a;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-center a:hover {
    color: #ffffff;
}

.icon-btn {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #2b4254;
    border-radius: 6px;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #2b4254;
}

.fairness-btn {
    padding: 8px 16px;
    background: #2b4254;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.fairness-btn:hover {
    background: #3a5a6a;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1a2c38;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body p {
    color: #6b8a9a;
    font-size: 14px;
    margin-bottom: 16px;
}

.seed-info {
    margin-bottom: 12px;
}

.seed-info label {
    display: block;
    font-size: 12px;
    color: #6b8a9a;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.seed-info code {
    display: block;
    padding: 10px 12px;
    background: #0f1923;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #00e701;
    word-break: break-all;
}

.close-modal {
    width: 100%;
    padding: 12px;
    background: #2b4254;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.close-modal:hover {
    background: #3a5a6a;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 90px);
    }
    
    .controls-panel {
        width: 100%;
        order: 1;
    }
    
    .game-area {
        order: 0;
        height: 50vh;
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px;
        gap: 8px;
    }
    
    .controls-panel {
        padding: 12px;
    }
    
    .bet-input-row {
        flex-wrap: wrap;
    }
    
    .bet-input-wrapper {
        width: 100%;
    }
    
    .quick-btn {
        flex: 1;
    }
}