* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Для мобильных устройств */
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #120012;
    color: white;
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation; /* Для лучшего touch */
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100vw;
    overflow: hidden;
}

/* Шапка - Улучшена для мобильного */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: linear-gradient(180deg, #200020, #000);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.title {
    font-size: 24px; /* Увеличено */
    font-weight: 600;
    letter-spacing: 2px;
}

/* Главный контент */
.main-content {
    flex: 1;
    padding: 15px;
    background: linear-gradient(135deg, #1a001a 0%, #3c003c 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
}

.user-info {
    margin-bottom: 25px;
    text-align: center;
}

.username {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.balance {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.amount {
    color: #fff;
}

.currency {
    background: linear-gradient(45deg, #e91e63, #ff4081);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 10px rgba(233, 30, 99, 0.4);
}

.stats-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    width: 100%;
}

.stat-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.85;
    text-transform: uppercase;
}

.logo-container {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(45deg, #e91e63, #ff4081);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    box-shadow: 0 0 25px rgba(233, 30, 99, 0.6), 0 0 50px rgba(233, 30, 99, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(233, 30, 99, 0.5); }
    to { box-shadow: 0 0 30px rgba(233, 30, 99, 0.8); }
}

.logo {
    font-size: 90px;
    font-weight: 800;
    color: white;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    font-style: italic;
}

/* Нижняя панель навигации - Улучшена для touch */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(180deg, #1a1a1a, #000);
    padding: 12px 0;
    border-top: 1px solid #444;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.5);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    color: #ddd;
    cursor: pointer;
    font-size: 13px;
    background: none;
    border: none;
    transition: transform 0.2s;
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-item.active {
    color: #ff4081;
}

.nav-item.active .icon {
    color: #ff4081;
}

.icon {
    font-size: 28px;
    margin-bottom: 6px;
}

/* Скрытые вкладки */
.tab {
    display: none;
}

.tab.active {
    display: block;
}

/* Паки */
.pack {
    background: linear-gradient(45deg, #1a1a1a, #2a2a2a);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.pack h3 {
    margin-bottom: 10px;
    color: white;
    font-size: 20px;
}

.pack p {
    margin-bottom: 15px;
    color: #ddd;
    font-size: 16px;
}

.pack button {
    background: linear-gradient(45deg, #e91e63, #ff4081);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 18px;
    cursor: pointer;
    width: 100%;
    max-width: 250px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pack button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.6);
}

.pack button:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(233, 30, 99, 0.4);
}

/* Профиль - карточки по редкостям */
.rarity-sections {
    margin-top: 30px;
}

.rarity-sections h3 {
    margin-bottom: 15px;
    color: #ff4081;
    font-size: 20px;
}

.rarity-category {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.rarity-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rarity-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.rarity-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.rarity-card-item {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.rarity-card-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 5px;
}

.rarity-card-item .name {
    font-size: 10px;
    color: white;
}

/* Цвета редкостей */
.common { background: #b0c3d9; }
.rare { background: #4b69ff; }
.epic { background: #8847ff; }
.legendary { background: #d32ce6; }

/* Анимация открытия пака как в FIFA */
.fifa-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a000a, #1a001a);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.opening-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
    padding: 20px;
}

/* Пакетик */
.pack-wrapper {
    perspective: 1000px;
    margin-bottom: 50px;
}

.pack-envelope {
    position: relative;
    width: 300px;
    height: 200px;
    margin: 0 auto;
    transform-style: preserve-3d;
}

.pack-front, .pack-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.pack-front {
    background: linear-gradient(45deg, #1a1a1a, #000000);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    padding: 10px;
}

.pack-back {
    background: linear-gradient(45deg, #1a1a1a, #000000);
    transform: rotateY(180deg);
}

/* Логотип и текст на пакете */
.pack-logo {
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    text-align: center;
}

.pack-stripe {
    background: linear-gradient(90deg, #fbb000, #ff0000);
    padding: 5px 10px;
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #000;
    text-align: center;
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.5);
}

.pack-number {
    font-family: 'Arial', sans-serif;
    font-size: 48px;
    font-weight: bold;
    color: #fbb000;
    text-shadow: 0 0 10px rgba(255, 176, 0, 0.5);
    text-align: center;
    margin-top: 10px;
}

/* Область свайпа */
.swipe-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.swipe-area:hover {
    background: rgba(0, 0, 0, 0.5);
}

.swipe-instruction {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Анимация открытия пакета */
.pack-envelope.opening {
    animation: openPack 1s forwards;
}

@keyframes openPack {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(180deg); }
}

/* Карточки по одной */
.cards-reveal {
    margin: 30px 0;
}

.card-slot {
    width: 200px;
    height: 280px;
    margin: 0 auto 20px;
    position: relative;
    perspective: 1000px;
}

/* Карточка с двумя сторонами */
.card-reveal {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
    transform: rotateY(0deg);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-reveal.flipping {
    transform: rotateY(180deg);
}

.card-back, .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: none;
    left: 0;
    top: 0;
    transform: rotateY(0deg);
}

.card-front {
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(45deg, #1a001a, #000000);
    background-image: url('/cards/back-pattern.png');
    background-size: cover;
    background-position: center;
    border: 4px solid #333; /* Жирная обводка */
}

/* Обводка только для карточек с "card" в названии */
.card-rarity-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    box-shadow: inset 0 0 30px currentColor;
    opacity: 0.7;
    pointer-events: none;
    z-index: 10; /* Обводка поверх карточки */
}

.counter {
    color: #e91e63;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
}

/* Финальный результат - в виде веера */
.final-result .result-cards {
    position: relative;
    width: 600px;
    height: 400px;
    margin: 0 auto;
    top: 50%;
    transform: translateY(-50%);
}

.final-result .result-card-item {
    width: 200px;
    height: 280px;
    position: absolute;
    border: 4px solid transparent; /* Жирная обводка */
    border-radius: 15px;
    transition: all 0.5s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.final-result .result-card-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #333;
}

/* Бейдж редкости */
.final-result .result-card-item .rarity-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 4px solid #1a1a1a; /* Жирная обводка */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Кнопка "Продолжить" */
.final-result button {
    background: #e91e63;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.final-result button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.5);
}

.card-item {
    background: #1a1a1a;
    border: 4px solid transparent; /* Жирная обводка */
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.card-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.card-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 2px solid #333;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.card-item .name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.card-item .status {
    font-size: 12px;
    color: #e91e63;
}

.card-item .duplicate-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e91e63;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 15px;
    border: 2px solid #1a1a1a;
}

/* Подсветка дубликатов */
.card-item.duplicate {
    border: 4px solid #e91e63 !important;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.5) !important;
}

/* Бейдж редкости */
.rarity-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 4px solid #1a1a1a; /* Жирная обводка */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Адаптивность */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
    
    .user-info {
        margin-bottom: 20px;
    }
    
    .username {
        font-size: 24px;
    }
    
    .balance {
        font-size: 28px;
    }
    
    .stats-grid {
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .logo-container {
        width: 150px;
        height: 150px;
        margin: 0 auto 15px;
    }
    
    .logo {
        font-size: 70px;
    }
    
    /* Паки */
    .pack {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .pack h3 {
        font-size: 16px;
    }
    
    .pack p {
        font-size: 12px;
    }
    
    .pack button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* Карточки */
    #cards-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .card-item {
        padding: 10px;
    }
    
    .card-item img {
        width: 100px;
        height: 100px;
    }
    
    .card-item .name {
        font-size: 12px;
    }
    
    .card-item .status {
        font-size: 10px;
    }
    
    /* Вкладки */
    .bottom-nav {
        padding: 15px 0;
    }
    
    .nav-item .icon {
        font-size: 28px;
    }
    
    .nav-item .label {
        font-size: 12px;
    }
}

/* Улучшения для анимации веера */
.final-result .result-cards {
    position: relative;
    width: 600px;
    height: 400px;
    margin: 0 auto;
    top: 50%;
    transform: translateY(-50%);
}

.final-result .result-card-item {
    width: 200px;
    height: 280px;
    position: absolute;
    border: 4px solid transparent;
    border-radius: 15px;
    transition: all 0.6s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
}

.final-result .result-card-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #333;
}

.final-result .result-card-item.appear {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(var(--angle)) !important;
}

.final-result .result-card-item.common {
    --glow-color: rgba(176, 195, 217, 0.6);
}

.final-result .result-card-item.rare {
    --glow-color: rgba(75, 105, 255, 0.6);
}

.final-result .result-card-item.epic {
    --glow-color: rgba(136, 71, 255, 0.6);
}

.final-result .result-card-item.legendary {
    --glow-color: rgba(211, 44, 230, 0.6);
    animation: legendaryGlow 1.5s ease-in-out infinite alternate;
}

@keyframes legendaryGlow {
    from {
        box-shadow: 0 10px 30px var(--glow-color);
    }
    to {
        box-shadow: 0 15px 45px var(--glow-color);
    }
}

.final-result .result-card-item.appear {
    box-shadow: 0 10px 30px var(--glow-color);
}