:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --text-color: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

/* Экран загрузки */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Основной контейнер */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Верхняя панель */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
}

.header-left, .header-right {
    flex: 1;
}

.header-center {
    flex: 2;
    text-align: center;
}

.online-counter {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.balance-display {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-color);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-left: auto;
}

.user-avatar.large {
    width: 60px;
    height: 60px;
    font-size: 24px;
}

/* Основное содержимое */
.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-section, .profile-section {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Мультипликатор и статус игры */
.multiplier-display {
    text-align: center;
    margin-bottom: 20px;
}

.current-multiplier {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.game-status {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Ракета и график */
.rocket-container {
    text-align: center;
    margin: 20px 0;
    height: 80px;
}

.rocket-fallback {
    font-size: 60px;
    transition: transform 0.3s ease;
}

.rocket-flying {
    animation: rocketFly 2s ease-in-out infinite;
}

@keyframes rocketFly {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.rocket-crash {
    animation: rocketCrash 0.5s ease-out forwards;
}

@keyframes rocketCrash {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(50px) rotate(45deg); }
}

.graph-container {
    height: 100px;
    margin: 20px 0;
    background: var(--secondary-color);
    border-radius: 10px;
    overflow: hidden;
}

#game-graph {
    width: 100%;
    height: 100%;
}

/* Панель ставок */
.bet-panel {
    background: var(--secondary-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.bet-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.bet-input, .auto-cashout-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--primary-color);
    color: var(--text-color);
    font-size: 14px;
}

.auto-cashout-group {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.auto-cashout-input {
    width: 80px;
}

.bet-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.bet-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--primary-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 12px;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.place-bet-btn {
    background: var(--accent-color);
    color: white;
}

.cashout-btn {
    background: var(--danger-color);
    color: white;
}

.action-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Секции */
.section-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.recent-games, .bets-section {
    margin-bottom: 20px;
}

.history-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-item {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.history-item.win {
    background: var(--accent-color);
    color: white;
}

.history-item.loss {
    background: var(--danger-color);
    color: white;
}

.bets-list {
    max-height: 200px;
    overflow-y: auto;
}

.bet-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 5px;
    margin-bottom: 5px;
}

.bet-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bet-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.bet-details {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

/* Профиль */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.profile-id {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-stats {
    background: var(--secondary-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: bold;
    color: var(--accent-color);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-game {
    background: var(--secondary-color);
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 8px;
}

.history-game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.history-multiplier {
    font-weight: bold;
}

.history-multiplier.win {
    color: var(--accent-color);
}

.history-multiplier.loss {
    color: var(--danger-color);
}

.history-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Нижняя навигация */
.bottom-nav {
    display: flex;
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    padding: 5px;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.nav-btn.active {
    color: var(--accent-color);
}

.nav-icon {
    font-size: 20px;
}

.nav-text {
    font-size: 10px;
}

/* Попап */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background: var(--secondary-color);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 300px;
    width: 90%;
}

/* Адаптивность */
@media (max-height: 700px) {
    .rocket-container {
        height: 60px;
        margin: 10px 0;
    }
    
    .rocket-fallback {
        font-size: 40px;
    }
    
    .current-multiplier {
        font-size: 24px;
    }
}