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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* Экраны */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

/* Главное меню */
.main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 30px;
}

.game-title {
    font-size: 64px;
    font-weight: bold;
    color: #667eea;
    text-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    letter-spacing: 4px;
    margin-bottom: 20px;
}

/* Баланс золота */
.gold-display {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    padding: 15px 20px;
    border-radius: 20px;
    border: 2px solid #ffc107;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.2);
    z-index: 10;
}

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

.gold-amount {
    font-size: 24px;
    font-weight: bold;
    color: #ffc107;
    min-width: 80px;
    text-align: center;
    transition: transform 0.2s ease;
}

.btn-topup {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.btn-topup:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

/* Кнопка дуэли */
.duel-button-container {
    margin: 40px 0;
}

.btn-duel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #e3f2fd;
    padding: 30px 60px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-duel:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.btn-duel:active {
    transform: translateY(-2px);
}

.duel-icon {
    font-size: 64px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.duel-text {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.duel-cost {
    font-size: 18px;
    color: #ffc107;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Кнопки */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

.btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
    transform: translateY(-2px);
}

/* Экран поиска */
.matchmaking-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 30px;
    text-align: center;
}

.matchmaking-content h2 {
    font-size: 32px;
    color: #667eea;
    font-weight: bold;
}

.search-animation {
    width: 150px;
    height: 150px;
    position: relative;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 8px solid #e3f2fd;
    border-top: 8px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-text {
    font-size: 20px;
    color: #495057;
}

.search-timer {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* Экран битвы */
.battle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

#gameCanvas {
    border: 4px solid #667eea;
    border-radius: 20px;
    background: linear-gradient(180deg, #e3f2fd 0%, #fff 100%);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.2);
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Результат битвы */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 30px;
    text-align: center;
}

.result-title {
    font-size: 56px;
    font-weight: bold;
    color: #667eea;
    animation: scaleIn 0.5s ease;
}

.result-message {
    font-size: 24px;
    color: #495057;
    max-width: 400px;
}

/* Пополнение */
#topup-screen h2 {
    color: #667eea;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
}

.topup-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.topup-option {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #ffc107;
    border-radius: 20px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

.topup-option:hover {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.25);
}

.topup-option:active {
    transform: translateY(-2px);
}

.topup-amount {
    font-size: 32px;
    font-weight: bold;
    color: #ffc107;
    margin-bottom: 10px;
}

.topup-price {
    font-size: 16px;
    color: #28a745;
    font-weight: 600;
}

/* Таблица лидеров */
#leaderboard-screen h2 {
    color: #667eea;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    font-size: 32px;
}

.leaderboard-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.leader-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 15px;
    border: 1px solid #e3f2fd;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.leader-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.leader-rank {
    font-size: 28px;
    font-weight: bold;
    margin-right: 15px;
    min-width: 50px;
    color: #667eea;
}

.leader-info {
    flex: 1;
}

.leader-name {
    font-weight: 600;
    color: #212529;
    margin-bottom: 3px;
    font-size: 16px;
}

.leader-stats {
    font-size: 12px;
    color: #6c757d;
}

.leader-score {
    font-size: 24px;
    font-weight: bold;
    color: #ffc107;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 18px;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Адаптивность */
@media (max-width: 600px) {
    .game-title {
        font-size: 48px;
    }
    
    .btn-duel {
        padding: 20px 40px;
    }
    
    .duel-icon {
        font-size: 48px;
    }
    
    .duel-text {
        font-size: 28px;
    }
    
    .gold-display {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
    }
    
    .gold-amount {
        font-size: 20px;
        min-width: 60px;
    }
    
    .topup-options {
        grid-template-columns: 1fr;
    }
    
    .result-title {
        font-size: 40px;
    }
    
    .result-message {
        font-size: 18px;
    }
    
    .battle-container {
        padding: 10px;
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f8f9fa;
}

::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}
