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

html {
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #1a0d2e 0%, #2d1b4e 50%, #1a0d2e 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #e9d5ff;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Фоновые частицы */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

.particles::before,
.particles::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(199, 181, 253, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(167, 139, 250, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(196, 181, 253, 0.5), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(139, 92, 246, 0.4), transparent);
    background-size: 200% 200%;
    animation: particles 30s ease-in-out infinite;
}

@keyframes particles {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(3%, -3%); }
}

/* Контейнеры */
.loading-container,
.ticket-container,
.error-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    animation: fadeIn 0.5s ease-out;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Загрузка - Кристалл */
.loading-container {
    text-align: center;
    padding-top: 60px;
}

.crystal-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
}

.crystal {
    position: relative;
    width: 100px;
    height: 100px;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(180deg); }
}

.crystal-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.4) 0%,
        rgba(167, 139, 250, 0.6) 50%,
        rgba(196, 181, 253, 0.4) 100%
    );
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    animation: crystalPulse 3s ease-in-out infinite;
}

@keyframes crystalPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.1);
        opacity: 1;
    }
}

.crystal-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background: radial-gradient(circle, 
        rgba(139, 92, 246, 0.3) 0%,
        rgba(167, 139, 250, 0.1) 40%,
        transparent 70%
    );
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.loading-text {
    margin-bottom: 20px;
}

.loading-main {
    font-size: 20px;
    font-weight: 600;
    color: #e9d5ff;
    margin-bottom: 8px;
}

.loading-sub {
    font-size: 18px;
    color: #c4b5fd;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #8b5cf6;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Билет */
.ticket-card {
    padding: 20px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ticket-header {
    margin-bottom: 24px;
}

.ticket-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ticket-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.ticket-title-text {
    flex: 1;
}

.ticket-title {
    font-size: 22px;
    font-weight: 700;
    color: #f3e8ff;
    margin-bottom: 4px;
}

.ticket-subtitle {
    font-size: 14px;
    color: #c4b5fd;
}

.ticket-number-container {
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.3) 0%,
        rgba(167, 139, 250, 0.2) 100%
    );
    border-radius: 16px;
    padding: 24px 20px;
    margin-bottom: 24px;
    text-align: center;
    border: 2px solid rgba(167, 139, 250, 0.4);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
}

.ticket-number-label {
    font-size: 14px;
    color: #c4b5fd;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ticket-number {
    font-size: 64px;
    font-weight: 800;
    color: #f3e8ff;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.8);
}

/* Приз розыгрыша */
.raffle-prize {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.prize-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.prize-text {
    font-size: 16px;
    font-weight: 600;
    color: #f3e8ff;
    letter-spacing: 0.3px;
}

/* Цитата от Ирины */
.irina-quote {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid #8b5cf6;
    align-items: center;
}

.irina-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.irina-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quote-content {
    flex: 1;
}

.quote-text {
    font-size: 14px;
    line-height: 1.5;
    color: #e9d5ff;
    margin-bottom: 6px;
    font-style: italic;
}

.quote-text strong {
    color: #f3e8ff;
    font-weight: 700;
}

.quote-author {
    font-size: 12px;
    color: #c4b5fd;
    font-weight: 600;
}

.ticket-warning {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: rgba(220, 38, 38, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    margin-bottom: 20px;
}

.warning-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.warning-text {
    font-size: 12px;
    line-height: 1.5;
    color: #fecaca;
}

.warning-text strong {
    color: #fef2f2;
    display: block;
    margin-bottom: 3px;
}

.ticket-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(167, 139, 250, 0.2);
}

.ticket-footer p {
    font-size: 14px;
    color: #c4b5fd;
    font-style: italic;
}

/* Конфетти */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Ошибка */
.error-card {
    background: rgba(45, 27, 78, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.3);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-card h2 {
    font-size: 24px;
    color: #fecaca;
    margin-bottom: 12px;
}

.error-card p {
    font-size: 16px;
    color: #c4b5fd;
}

/* Поп-ап */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.popup-card {
    background: linear-gradient(135deg, #2d1b4e 0%, #1a0d2e 100%);
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 2px solid rgba(248, 113, 113, 0.5);
    box-shadow: 0 20px 60px rgba(220, 38, 38, 0.4);
    animation: popupSlide 0.4s ease-out;
}

@keyframes popupSlide {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.popup-title {
    font-size: 24px;
    font-weight: 700;
    color: #fef2f2;
    margin-bottom: 16px;
}

.popup-text {
    font-size: 16px;
    line-height: 1.6;
    color: #fecaca;
    margin-bottom: 28px;
}

.popup-button {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6);
}

.popup-button:active {
    transform: translateY(0);
}

/* Адаптивность */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }
    
    .ticket-number {
        font-size: 48px;
    }
    
    .ticket-title {
        font-size: 20px;
    }
    
    .popup-card {
        padding: 28px 20px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-text {
        font-size: 15px;
    }
}
