/* ==============================================
   Виртуальная гача 2.0 - Современные стили (Figma Design)
   ============================================== */

/* Базовые переменные согласно образцу дизайна */
:root {
    /* Основные цвета - синие тона */
    --gatcha-primary: #4FA0FF;
    --gatcha-secondary: #524FFF;
    --gatcha-accent: #B338FF;
    --gatcha-error: #FF4757;

    /* Фоновые цвета - темные с фиолетовым оттенком */
    --gatcha-bg-main: #221B28;
    --gatcha-bg-secondary: #2A2635;
    --gatcha-bg-tertiary: #343142;
    --gatcha-bg-gradient: radial-gradient(174.99% 62.71% at 50.77% 50%, rgba(4, 46, 255, 0.1) 0%, rgba(0, 0, 0, 0) 100%), #221b28;

    /* Градиент пакета - согласно образцу */
    --gatcha-pack-gradient: linear-gradient(180deg, #8B5CF6 0%, #6366F1 50%, #3B82F6 100%);
    --gatcha-pack-shadow: 0px 20px 40px rgba(99, 102, 241, 0.3);

    /* Цвета текста */
    --gatcha-text-primary: #FFFFFF;
    --gatcha-text-secondary: rgba(255, 255, 255, 0.7);
    --gatcha-text-muted: rgba(255, 255, 255, 0.4);

    /* Границы и тени */
    --gatcha-border: rgb(179 108 255 / 10%);
    --gatcha-border-accent: rgba(255, 255, 255, 0.2);
    --gatcha-shadow: 0px 10px 30px rgba(0, 0, 0, 0.3);
    --gatcha-shadow-lg: 0px 20px 60px rgba(0, 0, 0, 0.4);
    --gatcha-shadow-xl: 0px 30px 80px rgba(0, 0, 0, 0.5);

    /* Размеры */
    --gatcha-radius: 16px;
    --gatcha-radius-lg: 32px;
    --gatcha-radius-xl: 24px;

    /* Переходы */
    --gatcha-transition: 0.2s;
    --gatcha-transition-bounce: all 0.25s cubic-bezier(0.51, 0.32, 0.41, 1.3);

    /* Шрифты */
    --font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Скрытие v-cloak */
[v-cloak] {
    display: none !important;
}

.card-img {
    user-select: none;
    pointer-events: none;
}

/* ==============================================
   Основной контейнер модального окна
   ============================================== */

/* Стили для модального окна на главной странице */
.gatcha-v2-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-family: var(--font-family);
    /* pointer-events: none; */
    background: rgba(4, 3, 9, 0.8);
    backdrop-filter: blur(30px);
}

.gatcha-v2-window.visible {
    opacity: 1;
    visibility: visible;
}

.gatcha-v2-window.minimized {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gatcha-v2-window .gatcha-v2-container {
    pointer-events: all;
}

/* Мобильная версия главной страницы */
.gatcha-v2-window.mobile {
    align-items: flex-start;
}

.gatcha-v2-window.mobile .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    min-width: 350px !important;
    max-width: 420px !important;
    max-height: none !important;
    border-radius: 0 !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    background: var(--gatcha-bg-gradient);
    overflow: auto;
    border: none;
}

/* Полноэкранный режим главной страницы */
.gatcha-v2-window.fullscreen .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
}

/* Удален дублирующий CSS - используется выше */

/* Исходные стили для iframe контента */
.gatcha-v2-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: var(--gatcha-transition);
    font-family: var(--font-family);
    pointer-events: none;
}

.gatcha-v2-modal .gatcha-v2-container {
    pointer-events: all;
}

.gatcha-v2-modal.minimized {
    display: none;
}

/* Мобильная версия - полный экран */
.gatcha-v2-modal.mobile {
    background: var(--gatcha-bg-gradient);
}

.gatcha-v2-modal.mobile .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    min-width: 350px !important;
    max-width: 420px !important;
    max-height: none !important;
    border-radius: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    background: var(--gatcha-bg-gradient);
    overflow: auto;
}

/* Полноэкранный режим */
.gatcha-v2-modal.fullscreen .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px 30px;
}

.logo-gatcha {
    height: 20px;
    width: 104px;
    background-image: url('/gatcha/logo.png');
    background-repeat: no-repeat;
    background-position: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions_btn {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: var(--gatcha-transition);
    background-repeat: no-repeat;
    background-position: center;
}

.header-actions_btn.gatcha {
    background-image: url('/gatcha/drop-icon.png');
}

.header-actions_btn.help {
    background-image: url('/gatcha/help-icon.png');
}

.header-actions_btn.close {
    background-image: url('/gatcha/close-icon.png');
}

.header-actions_btn:hover {
    opacity: .7;
}

.demo-toggle {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gatcha-text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: var(--gatcha-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.demo-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gatcha-text-primary);
}

.demo-toggle.active {
    background: var(--gatcha-accent);
    color: white;
    border-color: var(--gatcha-accent);
    box-shadow: 0px 4px 16px rgba(179, 56, 255, 0.3);
}

.divider {
    width: 1px;
    height: 16px;
    background: white;
    opacity: .08;
}



/* ==============================================
   Основной контейнер
   ============================================== */

.gatcha-v2-container {
    position: relative;
    width: 396px;
    height: 814px;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--gatcha-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: .2s background, .2s box-shadow, .2s transform;
    user-select: none;
    border: 1px solid var(--gatcha-border);
    background: var(--gatcha-bg-gradient);
}

.gatcha-v2-container.dragging {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.gatcha-v2-container.resizing {
    transition: none;
}

.gatcha-v2-container.minimized {
    transform: scale(0.8);
    opacity: 0.7;
}

/* Desktop адаптации */
.gatcha-v2-container.desktop {
    cursor: grab;
}

.gatcha-v2-container.desktop:active {
    cursor: grabbing;
}

/* ==============================================
   Header с элементами управления
   ============================================== */

.gatcha-v2-header {
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(34, 27, 40, 0.9);
    border-bottom: 1px solid var(--gatcha-border);
    cursor: grab;
    z-index: 10;
    border-top-left-radius: var(--gatcha-radius);
    border-top-right-radius: var(--gatcha-radius);
    backdrop-filter: blur(10px);
}

.gatcha-v2-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(160, 77, 255, 0.06), transparent);
    transition: left 0.5s;
}

.gatcha-v2-header:hover::before {
    left: 100%;
}

.gatcha-logo-img {
    height: 20px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo-accent {
    color: var(--gatcha-primary);
    font-weight: 500;
}

.gatcha-v2-controls {
    display: flex;
    gap: 8px;
}

.gatcha-v2-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--gatcha-radius);
    background: rgba(255, 255, 255, 0.1);
    color: var(--gatcha-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gatcha-transition);
    backdrop-filter: blur(8px);
}

.gatcha-v2-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gatcha-v2-control-btn.close:hover {
    background: var(--gatcha-error);
}

.gatcha-v2-control-btn:active {
    transform: scale(0.95);
}

/* ==============================================
   Основной контент
   ============================================== */

.gatcha-v2-content {
    flex: 1;
    padding: 32px 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--gatcha-border) transparent;
}

.gatcha-v2-content::-webkit-scrollbar {
    width: 6px;
}

/* 3D наклон для отдельных элементов */
.booster-item,
.drop-frame {
    transform-style: preserve-3d;
}

.gatcha-v2-content::-webkit-scrollbar-track {
    background: transparent;
}

.gatcha-v2-content::-webkit-scrollbar-thumb {
    background: var(--gatcha-border);
    border-radius: 3px;
}

/* ==============================================
   Статистика
   ============================================== */

.gatcha-v2-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    color: var(--gatcha-text-secondary);
}

.stats-text, .stats-link {
    font-weight: 500;
}

.stats-link {
    color: var(--gatcha-accent);
    text-decoration: none;
    transition: var(--gatcha-transition);
}

.stats-link:hover {
    color: var(--gatcha-text-primary);
    text-decoration: underline;
}

.stats-divider {
    width: 1px;
    height: 14px;
    background: var(--gatcha-border);
}

/* ==============================================
   Контейнер пакета
   ============================================== */

.gatcha-v2-pack-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
    padding: 40px 0;
}

.gatcha-v2-pack {
    position: relative;
    width: 235px;
    height: 420px;
    cursor: pointer;
    transition: .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* box-shadow: var(--gatcha-pack-shadow); */
    transform-origin: center;
    transition: var(--gatcha-transition-bounce);
    z-index: 100;
}

/* Убираем старые элементы pack-top и pack-bottom */
.gatcha-v2-pack .pack-top,
.gatcha-v2-pack .pack-bottom {
    display: none;
}

/* Hover эффект теперь управляется через JavaScript для более точного контроля */

/* Простая анимация появления контейнера карт */
.drop-frame {
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.8s ease-out, filter 0.8s ease-out;
}

.drop-frame.visible {
    opacity: 1;
    filter: none;
}

/* Размытие бустера при открытии управляется через JavaScript */

.gatcha-anim-frame {
    transform-origin: center 40%;
    transition: .5s;
}

.gatcha-anim-frame.shaking {
    animation: packShake 1.5s ease-in-out;
}

.gatcha-anim-frame.loading {
    animation: packPulse 2s ease-in-out infinite alternate;
}

.gatcha-anim-frame.opened {
    transform: scale(1.1);
}

.gatcha-anim-frame.opened .pack-content {
    opacity: 0;
    transform: translateY(8px);
}

.gatcha-anim-frame.opened .pack-count {
    opacity: 0;
    /* transform: translateY(8px); */
}

.booster-item {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    pointer-events: auto;
    user-select: none;
    transition: var(--gatcha-transition-bounce), opacity 1s ease-out 1s;
    /* z-index: 51; */
}

.gatcha-anim-frame.opened .booster-item {
    pointer-events: none;
    user-select: none;
}

.booster-top {
    width: 235px;
    height: 46px;
    background-image: url('/gatcha/booster-top.png');
    background-repeat: no-repeat;
    background-position: bottom right;
    transition: 1s ease-out;
}

.booster-bottom {
    width: 235px;
    height: 374px;
    background-image: url('/gatcha/booster-bottom.png');
    background-repeat: no-repeat;
    background-position: top center;
    margin-top: -1px;
    transition: 1s ease-out;
}

.gatcha-anim-frame.opened .booster-top {
    transform: translateY(-8px) rotate(3deg);
    opacity: 0;
}

.gatcha-anim-frame.opened .booster-bottom {
    transform: translateY(8px);
    opacity: 0;
}

/* .pack-shine удален полностью */

.pack-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    animation: packGlow 1.5s ease-in-out infinite alternate;
    border-radius: inherit;
}

/* Контент пакета */
.pack-content {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 5;
    flex: 1;
    justify-content: center;
    padding: 40px 20px;
    transition: 1.5s;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* Стили для простого заголовка в iframe */
.gatcha-v2-simple-header {
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    background: rgba(34, 27, 40, 0.9);
    border-bottom: 1px solid var(--gatcha-border);
    border-top-left-radius: var(--gatcha-radius);
    border-top-right-radius: var(--gatcha-radius);
    backdrop-filter: blur(10px);
}

.gatcha-v2-simple-header .gatcha-v2-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gatcha-v2-simple-header .gatcha-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.pack-name {
    font-family: 'Rubik', sans-serif;
    font-style: normal;
    font-weight: 700;
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--gatcha-text-primary);
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pack-cost {
    font-family: 'Rubik', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: 0.01em;
    color: var(--gatcha-text-primary);
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pack-count {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rubik', sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.2;
    color: var(--gatcha-text-primary);
    opacity: 0.8;
    z-index: 6;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    transition: 1.5s;
}

/* Частицы */
.pack-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--gatcha-accent);
    border-radius: 50%;
    animation: particleExplode 1s ease-out forwards;
}

/* Эффекты открытия */
.pack-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.spark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, var(--gatcha-accent), transparent);
    border-radius: 1px;
    animation: sparkFly 1s ease-out forwards;
}

.spark:nth-child(1) { transform: rotate(0deg); }
.spark:nth-child(2) { transform: rotate(45deg); }
.spark:nth-child(3) { transform: rotate(90deg); }
.spark:nth-child(4) { transform: rotate(135deg); }
.spark:nth-child(5) { transform: rotate(180deg); }
.spark:nth-child(6) { transform: rotate(225deg); }
.spark:nth-child(7) { transform: rotate(270deg); }
.spark:nth-child(8) { transform: rotate(315deg); }

/* ==============================================
   Результаты с навигацией
   ============================================== */

.gatcha-v2-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    z-index: 1;
}

.results-viewer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 250px;
}

/* Навигация */
.results-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--gatcha-radius);
    backdrop-filter: blur(8px);
}

.nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--gatcha-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gatcha-transition);
    backdrop-filter: blur(8px);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.card-counter {
    font-size: 14px;
    font-weight: 600;
    color: var(--gatcha-text-primary);
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

/* Просмотрщик карт */
.card-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 200px;
    touch-action: pan-y;
}

.card-container {
    position: relative;
    width: 100%;
    max-width: 180px;
    transition: var(--gatcha-transition);
    cursor: pointer;
}

.card-container.card-fade-in {
    animation: cardFadeIn 0.3s ease-out;
}

@keyframes cardFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Индикаторы точки */
.card-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 8px 8px;
}

.indicator {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.149);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.309);
}

.indicator.active {
    background: var(--gatcha-primary);
    box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.309);
}

.indicator:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Карточка в просмотрщике */
.results-viewer .result-card {
    width: 100%;
    background: var(--gatcha-bg-secondary);
    border-radius: var(--gatcha-radius);
    padding: 12px;
    position: relative;
    overflow: hidden;
    transition: var(--gatcha-transition);
    border: 1px solid var(--gatcha-border);
}

.results-viewer .result-card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--gatcha-shadow-lg);
}

.results-viewer .card-image {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.results-viewer .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--gatcha-transition);
}

.results-viewer .result-card:hover .card-image img {
    transform: scale(1.05);
}

.results-viewer .card-info {
    text-align: center;
}

.results-viewer .card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gatcha-text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-viewer .card-rarity {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--gatcha-primary);
    color: var(--gatcha-text-primary);
    display: inline-block;
}

.results-viewer .card-new-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--gatcha-error);
    color: var(--gatcha-text-primary);
    font-size: 8px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    animation: badgePulse 1s ease-in-out infinite alternate;
}

/* Редкости карт */
.results-viewer .result-card.rarity-UR .card-glow {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
}

.results-viewer .result-card.rarity-SSR .card-glow {
    background: radial-gradient(circle, rgba(138, 43, 226, 0.3) 0%, transparent 70%);
}

.results-viewer .result-card.rarity-SR .card-glow {
    background: radial-gradient(circle, rgba(30, 144, 255, 0.3) 0%, transparent 70%);
}

.results-viewer .result-card.rarity-R .card-glow {
    background: radial-gradient(circle, rgba(50, 205, 50, 0.3) 0%, transparent 70%);
}

.results-viewer .card-glow {
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    animation: cardGlow 2s ease-in-out infinite alternate;
}

/* Контейнер с навигацией */
.cards-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Стрелки навигации */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgb(0 0 0 / 20%);
    color: var(--gatcha-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gatcha-transition);
    backdrop-filter: blur(12px);
    font-size: 28px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 1px #75757524;
}

.nav-arrow-left {
    left: -25px;
}

.nav-arrow-right {
    right: -25px;
}

.nav-arrow:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.378);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.nav-arrow:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

/* Стили для .drop-frame в результатах - новая концепция стопки */
.gatcha-v2-results .drop-frame.card-stack {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 240px;
    max-width: 270px;
    margin: 0 auto;
    position: relative;
    min-height: 400px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    perspective: 1000px;
}

.gatcha-v2-results .drop-frame.card-stack:active {
    cursor: grabbing;
}

/* Базовые стили для всех карточек */
.card-wrapper {
    width: 100%;
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: none;
    transform-origin: center bottom;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, opacity, z-index;
}

/* Карты в стопке (подложные карты) */
.card-wrapper.card-stack-item {
    z-index: 5;
    transform: translate3d(0, 3px, 0) scale(0.98);
    opacity: 0.9;
    filter: brightness(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s ease,
                filter 0.3s ease;
}

/* Текущая карта (верхняя в стопке) */
.card-wrapper.card-current {
    z-index: 20;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    opacity: 1;
    filter: none;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s ease;
}

/* Карта во время перетаскивания */
.card-wrapper.card-dragging {
    z-index: 25;
    transition: none !important;
    will-change: transform, opacity;
    transform-origin: center center;
}

/* Возвращающаяся предыдущая карта (появляется сверху) */
.card-wrapper.card-returning {
    z-index: 30;
    transition: none !important;
    will-change: transform, opacity;
    transform-origin: center top;
}

/* Эффект яркости для редких карт */
.card-wrapper.card-bright {
    animation: cardBrightEffect 1s ease-in-out;
    /* filter: brightness(1.1) saturate(1.2); */
}

/* Улучшенные анимации для плавных переходов */
.card-wrapper.animate-smooth {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.3s ease;
}


/* ==============================================
   Нижняя панель
   ============================================== */

.gatcha-v2-bottom {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 24px 32px;
}

.balance-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.balance-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.28);
    padding: 14px 16px;
    border-radius: 100px;
    background-color: rgba(54, 47, 69, 0.4);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.balance-label {
    font-weight: 400;
}

.balance-value {
    font-weight: 500;
    color: var(--gatcha-text-primary);
}

.balance-divider {
    width: 1px;
    height: 16px;
    background: var(--gatcha-border);
}

/* ==============================================
   Кнопки действий
   ============================================== */

.gatcha-v2-action {
    display: flex;
    justify-content: center;
}

.gatcha-v2-btn {
    position: relative;
    padding: 16px 24px;
    min-height: 56px;
    border-radius: var(--gatcha-radius-lg);
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--gatcha-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.41);
    outline: none;
    border: none;
    font-family: var(--font-family);
}

.gatcha-v2-btn.primary {
    background: linear-gradient(135deg, var(--gatcha-primary) 0%, var(--gatcha-secondary) 50%, var(--gatcha-accent) 100%);
    color: var(--gatcha-text-primary);
}

.gatcha-v2-btn.primary:hover:not(:disabled) {
}

.gatcha-v2-btn.primary:active:not(:disabled) {
    filter: brightness(0.9);
}

.gatcha-v2-btn.disabled {
    background: var(--gatcha-bg-tertiary);
    color: var(--gatcha-text-muted);
    cursor: not-allowed;
}

.gatcha-v2-btn.loading {
    background: var(--gatcha-bg-tertiary);
    color: var(--gatcha-text-secondary);
    cursor: wait;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.gatcha-v2-btn.primary:hover .btn-shine {
    left: 100%;
}

.btn-loader {
    width: 16px;
    height: 16px;
    border: 2px solid var(--gatcha-text-muted);
    border-top: 2px solid var(--gatcha-text-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* ==============================================
   Resize handle
   ============================================== */

.gatcha-v2-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    background: linear-gradient(-45deg, transparent 30%, var(--gatcha-border) 30%, var(--gatcha-border) 70%, transparent 70%);
    opacity: 0.5;
    transition: var(--gatcha-transition);
}

.gatcha-v2-resize-handle:hover {
    opacity: 1;
}

/* ==============================================
   Backdrop
   ============================================== */

.gatcha-v2-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 3, 9, 0.8);
    backdrop-filter: blur(30px);
    z-index: 9998;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gatcha-v2-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ==============================================
   Модальное окно помощи
   ============================================== */

.help-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.help-content {
    background: var(--gatcha-bg-primary);
    padding: 32px;
    border-radius: var(--gatcha-radius-xl);
    max-width: 400px;
    margin: 20px;
    box-shadow: var(--gatcha-shadow-xl);
    border: 1px solid var(--gatcha-border);
}

.help-content h3 {
    color: var(--gatcha-text-primary);
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 600;
}

.help-content ul {
    color: var(--gatcha-text-secondary);
    margin-bottom: 20px;
    padding-left: 20px;
}

.help-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.help-content button {
    background: var(--gatcha-primary);
    color: var(--gatcha-text-primary);
    border: none;
    padding: 12px 24px;
    border-radius: var(--gatcha-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--gatcha-transition);
    width: 100%;
}

.help-content button:hover {
    background: var(--gatcha-secondary);
}

/* ==============================================
   Анимации
   ============================================== */

@keyframes packShake {
    0%, 100% { transform: translateX(0);  }
    10%, 30%, 50%, 70% { transform: translateX(-2px) rotate(-1deg); }
    20%, 40%, 60%, 80% { transform: translateX(2px) rotate(1deg); }
    100% { transform: translateX(0) rotate(0); }
}

@keyframes packPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* packShine анимация удалена полностью */

@keyframes packGlow {
    0% { opacity: 0.4; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes particleExplode {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle)) scale(1);
        opacity: 0;
    }
}

@keyframes sparkFly {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translateY(-50px) scale(0);
        opacity: 0;
    }
}

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cardGlow {
    0% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

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

/* Анимации для стопки карт */

/* Анимация выхода карты из стопки */
@keyframes cardExitSwipe {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate3d(-120%, -15%, 0) rotate(-20deg);
        opacity: 0;
    }
}

/* Анимация подъема нижней карты на верх */
@keyframes cardRiseUp {
    0% {
        transform: translate3d(0, 3px, 0) scale(0.98);
        opacity: 0.8;
        filter: brightness(0.9);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 1;
        filter: brightness(1) drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
    }
}

/* Анимация возвращения предыдущей карты */
@keyframes cardReturnFromLeft {
    0% {
        transform: translate3d(-120%, -15%, 0) rotate(-20deg);
        opacity: 0;
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 1;
        filter: brightness(1.2) drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
    }
}

@keyframes cardBrightEffect {
    0% {
        filter: brightness(1) drop-shadow(0 10px 60px rgba(255, 255, 255, 0));
    }
    10% {
        filter: brightness(1.2) drop-shadow(0 -10px 80px rgba(255, 217, 0, 0.179));
    }
    100% {
        filter: brightness(1) drop-shadow(0 10px 0px transparent);
    }
}

/* Новые анимации для концепции стопки карт */

/* Анимация поднятия следующей карты из стопки */
@keyframes cardStackRise {
    0% {
        transform: translate3d(0, 3px, 0) scale(0.98);
        opacity: 0.9;
        filter: brightness(0.95);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 1;
        filter: brightness(1);
    }
}

/* Анимация выхода карты за пределы экрана */
@keyframes cardSwipeExit {
    to {
        transform: translate3d(var(--exit-x, 120%), var(--exit-y, -10%), 0)
                   rotate(var(--exit-rotation, 20deg));
        opacity: 0;
    }
}

/* Анимация возвращения карты на место */
@keyframes cardReturn {
    to {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 1;
    }
}

/* Анимация появления предыдущей карты сверху */
@keyframes cardReturnFromTop {
    from {
        transform: translate3d(0, -100%, 0) rotate(-20deg);
        opacity: 0.3;
    }
    to {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 1;
    }
}

/* Пульсация карт в стопке для показа интерактивности */
@keyframes stackCardPulse {
    0%, 100% {
        transform: translate3d(0, 3px, 0) scale(0.98);
    }
    50% {
        transform: translate3d(0, 1px, 0) scale(0.99);
    }
}

/* Микро-анимация при касании */
@keyframes cardTouchFeedback {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* ==============================================
   Модальное окно с iframe в cards.ejs
   ============================================== */

.modal.gatcha-v2-modal {
    background: rgba(4, 3, 9, 0.8);
    backdrop-filter: blur(30px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    max-width: none;
    max-height: none;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Убираем стандартные стили dialog для совместимости */
.modal.gatcha-v2-modal::backdrop {
    display: none;
}

.gatcha-v2-modal.mobile .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 420px !important;
    max-height: none !important;
    border-radius: 0 !important;
    position: relative !important;
    transform: none !important;
    box-shadow: none !important;
    border-width: 0 !important;
}

.gatcha-v2-modal.mobile .gatcha-v2-container .main-header {
    display: none;
}

.modal.gatcha-v2-modal.fullscreen .gatcha-v2-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
}

.modal.gatcha-v2-modal .gatcha-v2-container {
    position: relative;
    width: 396px;
    height: 814px;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--gatcha-bg-gradient);
    border-radius: var(--gatcha-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--gatcha-transition);
    user-select: none;
    box-shadow: var(--gatcha-shadow);
    border: 1px solid var(--gatcha-border);
}

.modal.gatcha-v2-modal .gatcha-v2-container.dragging {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal.gatcha-v2-modal .gatcha-v2-container.resizing {
    transition: none;
}

.modal.gatcha-v2-modal .gatcha-v2-container.minimized {
    transform: scale(0.8);
    opacity: 0.7;
}

/* Iframe контейнер */
.gatcha-v2-iframe-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.gatcha-v2-iframe-container.dragging-disabled {
    pointer-events: none;
}

.gatcha-v2-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--gatcha-bg-gradient);
}

/* Лоадер */
.gatcha-v2-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gatcha-bg-gradient);
    z-index: 100;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gatcha-border);
    border-top: 3px solid var(--gatcha-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loader-text {
    color: var(--gatcha-text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Дублирующий стиль backdrop удален */

/* ==============================================
   Кнопка триггер для открытия gatcha-v2
   ============================================== */

.gatcha-v2-trigger {
    position: relative;
    background: linear-gradient(135deg, var(--gatcha-primary) 0%, var(--gatcha-secondary) 100%);
    border: none;
    border-radius: var(--gatcha-radius-lg);
    color: var(--gatcha-text-primary);
    font-weight: 600;
    font-size: 16px;
    padding: 16px 24px;
    cursor: pointer;
    transition: var(--gatcha-transition-bounce);
    box-shadow: var(--gatcha-shadow);
    overflow: hidden;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gatcha-v2-trigger:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--gatcha-shadow-lg);
}

.gatcha-v2-trigger:active {
    transform: translateY(0) scale(0.98);
}

.gatcha-v2-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.gatcha-v2-trigger:hover::before {
    left: 100%;
}

/* Анимация ракеты */
@keyframes rocketBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(2deg); }
    75% { transform: translateY(2px) rotate(-2deg); }
}

.gatcha-v2-trigger:hover {
    animation: rocketBounce 0.6s ease-in-out;
}

/* ==============================================
   Медиа-запросы
   ============================================== */

/* Планшеты */
@media (max-width: 768px) {
    .gatcha-v2-container {
        width: 360px;
        height: 640px;
    }

    .pack-name {
        font-size: 28px;
    }

    .pack-cost {
        font-size: 20px;
    }

    .results-container {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 8px;
    }
}

/* Мобильные */
@media (max-width: 480px) {
    .balance-info {
        flex-wrap: wrap;
    }

    .nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .nav-arrow-left {
        left: -20px;
    }

    .nav-arrow-right {
        right: -20px;
    }

    .gatcha-v2-results .drop-frame {
        min-height: 300px;
        max-width: 220px;
    }

    .indicator {
        width: 8px;
        height: 8px;
    }

    .card-indicators {
        gap: 8px;
        padding: 12px 8px 8px;
    }
}

/* ==============================================
   Минимизированная вкладка
   ============================================== */

.gatcha-v2-minimized-tab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 160px;
    height: 48px;
    background: var(--gatcha-bg-gradient);
    border-radius: var(--gatcha-radius);
    border: 1px solid var(--gatcha-border);
    box-shadow: var(--gatcha-shadow-lg);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    display: flex;
    align-items: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
}

.gatcha-v2-minimized-tab.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* CSS анимации заменены на JavaScript анимации для динамических координат */

.gatcha-v2-minimized-tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--gatcha-shadow-xl);
}

.gatcha-v2-minimized-tab:active {
    transform: translateY(0);
}

.gatcha-v2-minimized-tab .minimized-tab-header {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 18px;
    background: rgba(34, 27, 40, 0.9);
    backdrop-filter: blur(10px);
}

.gatcha-v2-minimized-tab .gatcha-v2-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gatcha-v2-minimized-tab .gatcha-logo-img {
    height: 14px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.gatcha-v2-minimized-tab .gatcha-v2-controls {
    display: flex;
    gap: 8px;
}

.gatcha-v2-minimized-tab .gatcha-v2-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--gatcha-radius);
    background: rgba(255, 255, 255, 0.1);
    color: var(--gatcha-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gatcha-transition);
    backdrop-filter: blur(8px);
}

.gatcha-v2-minimized-tab .gatcha-v2-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gatcha-v2-minimized-tab .gatcha-v2-control-btn.close:hover {
    background: var(--gatcha-error);
}

/* Очень маленькие экраны */
@media (max-width: 320px) {
}

/* Высокие экраны (ландшафт на мобильных) */
@media (max-height: 480px) and (orientation: landscape) {
    .gatcha-v2-modal.mobile .gatcha-v2-container {
        overflow-y: auto;
    }

    .gatcha-v2-pack-container {
        min-height: 200px;
    }

    .results-container {
        max-height: 120px;
    }
}

/* Мобильные стили для минимизированной вкладки */
@media (max-width: 480px) {
    .gatcha-v2-minimized-tab {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        bottom: 100px;
        right: 20px;
        left: auto;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }

    .gatcha-v2-minimized-tab.mobile {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gatcha-v2-minimized-tab.mobile.dragging {
        transform: scale(1.1);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
        z-index: 10000;
    }

    .gatcha-v2-minimized-tab.mobile.delete-zone {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        transform: scale(0.8);
        opacity: 0.6;
    }

    .gatcha-v2-minimized-tab .minimized-tab-header {
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .gatcha-v2-minimized-tab .gatcha-v2-logo {
        width: 100%;
        height: 100%;
    }

    .gatcha-v2-minimized-tab .gatcha-logo-img {
        height: 24px;
        width: 24px;
    }

    .gatcha-v2-minimized-tab .gatcha-v2-controls {
        display: none;
    }
}