/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, #000011 0%, #1a0033 25%, #330066 50%, #1a0033 75%, #000011 100%);
    color: #e0e0e0;
    min-height: 100vh;
    position: relative;
}

/* Космический фон */
.galaxy-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, #fff, transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

.planets {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 20%, rgba(255, 100, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(100, 200, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 200, 100, 0.1) 0%, transparent 50%);
    animation: planetFloat 20s ease-in-out infinite;
}

@keyframes planetFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-15px) rotate(2deg); }
    66% { transform: translateY(10px) rotate(-1deg); }
}

.nebula {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 30% 40%, rgba(138, 43, 226, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 20, 147, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 20%, rgba(0, 191, 255, 0.2) 0%, transparent 60%);
    animation: nebulaPulse 15s ease-in-out infinite;
}

@keyframes nebulaPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* Container */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    position: relative;
    max-width: 100vw;
    width: 100%;
}

/* Screen management */
.screen {
    display: none;
    width: 100%;
    max-width: 100%;
    min-height: 90vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Главный экран - Космический стиль */
.cosmic-page {
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.9) 0%, rgba(51, 0, 102, 0.9) 100%);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(138, 43, 226, 0.4),
        0 0 40px rgba(138, 43, 226, 0.3),
        0 0 80px rgba(255, 20, 147, 0.2);
    border: 2px solid #8a2be2;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    margin-bottom: 150px;
}

.cosmic-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 20, 147, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 191, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    animation: cosmicGlow 8s ease-in-out infinite alternate;
}

@keyframes cosmicGlow {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.main-title {
    font-family: 'Orbitron', monospace;
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(45deg, #8a2be2, #ff1493, #00bfff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    animation: titleShimmer 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(138, 43, 226, 0.5);
}

@keyframes titleShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.subtitle {
    font-style: italic;
    color: #00bfff;
    font-size: 1.2rem;
    text-shadow: 0 0 15px #00bfff;
    animation: subtitlePulse 2s ease-in-out infinite alternate;
}

@keyframes subtitlePulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.page-content {
    position: relative;
    z-index: 1;
}

.intro-text {
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.7;
    color: #c0c0c0;
    font-size: 1.1rem;
}

.guy-types-preview {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.preview-guy {
    font-size: 2.5rem;
    padding: 15px;
    background: linear-gradient(45deg, rgba(138, 43, 226, 0.2), rgba(255, 20, 147, 0.2));
    border-radius: 50%;
    border: 3px solid #8a2be2;
    transition: all 0.4s ease;
    cursor: pointer;
    animation: guyFloat 4s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}

.preview-guy:nth-child(2n) {
    animation-delay: 0.8s;
}

.preview-guy:nth-child(3n) {
    animation-delay: 1.6s;
}

.preview-guy:hover {
    transform: scale(1.3) rotate(15deg);
    box-shadow: 0 0 30px rgba(255, 20, 147, 0.6);
    border-color: #ff1493;
}

@keyframes guyFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(5deg); }
    50% { transform: translateY(-5px) rotate(-3deg); }
    75% { transform: translateY(-12px) rotate(8deg); }
}

/* Кнопки */
.btn {
    position: relative;
    padding: 18px 35px;
    border: none;
    border-radius: 30px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s ease;
    text-transform: none;
    letter-spacing: 0.8px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 50px;
    min-width: 50px;
}

.sticker-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    box-shadow: 
        0 10px 25px rgba(255, 107, 107, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(255, 107, 107, 0.4);
    border: 2px solid #ff6b6b;
    width: 100%;
    margin-bottom: 15px;
    animation: buttonShimmer 3s ease-in-out infinite;
}

.start-btn {
    background: linear-gradient(45deg, #8a2be2, #ff1493, #00bfff);
    background-size: 200% 200%;
    color: white;
    box-shadow: 
        0 10px 25px rgba(138, 43, 226, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(138, 43, 226, 0.4);
    border: 2px solid #8a2be2;
    width: 100%;
    animation: buttonShimmer 3s ease-in-out infinite;
}

@keyframes buttonShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.share-btn {
    background: linear-gradient(45deg, #00bfff, #8a2be2);
    color: white;
    box-shadow: 
        0 10px 25px rgba(0, 191, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(0, 191, 255, 0.4);
    border: 2px solid #00bfff;
}

.retake-btn {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    color: white;
    box-shadow: 
        0 10px 25px rgba(255, 20, 147, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(255, 20, 147, 0.4);
    border: 2px solid #ff1493;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: left 0.6s ease;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn:hover .btn-glow {
    left: 100%;
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Экран теста */
.test-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
    margin-bottom: 150px;
}

/* Прогресс-бар (космический) */
.progress-cosmic {
    width: 100%;
    max-width: 350px;
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(138, 43, 226, 0.2);
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #8a2be2;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8a2be2, #ff1493, #00bfff);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.6);
    animation: progressGradient 3s ease-in-out infinite;
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.progress-text {
    text-align: center;
    color: #00bfff;
    font-size: 1rem;
    margin-top: 8px;
    text-shadow: 0 0 10px #00bfff;
    font-weight: 600;
}

/* Контент теста */
.test-content {
    background: rgba(26, 26, 46, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(138, 43, 226, 0.4),
        0 0 25px rgba(138, 43, 226, 0.2);
    border: 2px solid #8a2be2;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.question-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    line-height: 1.5;
    color: #e0e0e0;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.answer-option {
    background: linear-gradient(145deg, rgba(51, 0, 102, 0.8), rgba(26, 26, 46, 0.8));
    border: 2px solid #8a2be2;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.4s ease;
    font-size: 1rem;
    line-height: 1.4;
    color: #e0e0e0;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 50px;
    backdrop-filter: blur(5px);
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(138, 43, 226, 0.3), transparent);
    transition: left 0.4s ease;
}

.answer-option:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(138, 43, 226, 0.4);
    border-color: #ff1493;
    background: linear-gradient(145deg, rgba(51, 0, 102, 0.9), rgba(26, 26, 46, 0.9));
}

.answer-option:hover::before {
    left: 100%;
}

.answer-option.selected {
    background: linear-gradient(45deg, #8a2be2, #ff1493);
    color: white;
    border-color: #ff1493;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 20, 147, 0.5);
}

/* Экран результата */
.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.result-content {
    background: rgba(26, 26, 46, 0.95);
    border-radius: 25px;
    padding: 35px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(138, 43, 226, 0.4),
        0 0 40px rgba(138, 43, 226, 0.3);
    border: 2px solid #8a2be2;
    text-align: center;
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(10px);
}

.result-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #8a2be2, #ff1493, #00bfff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
    text-align: center;
    display: block;
    width: 100%;
    animation: titleShimmer 3s ease-in-out infinite;
}


.result-description {
    font-size: 1.2rem;
    line-height: 1.7;
    color: #c0c0c0;
    margin-bottom: 30px;
    text-align: center;
    display: block;
    width: 100%;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.2);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 150px;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 5px;
        justify-content: flex-start;
        padding-top: 10px;
    }
    
    .screen {
        min-height: 95vh;
    }
    
    .test-content {
        padding: 15px;
        height: 100%;
    }
    
    .question-text {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .answer-option {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .cosmic-page {
        padding: 20px;
        margin-bottom: 150px;
    }
    
    .result-container {
        padding: 10px;
        gap: 20px;
    }
    
    .result-content {
        padding: 25px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 2.2rem;
        margin-bottom: 15px;
    }
    
    .result-description {
        font-size: 1.1rem;
        margin-bottom: 25px;
    }
    
    .guy-types-preview {
        gap: 15px;
    }
    
    .preview-guy {
        font-size: 2rem;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 3px;
    }
    
    .test-content {
        padding: 12px;
        height: 100%;
    }
    
    .question-text {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .answer-option {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .main-title {
        font-size: 2.2rem;
    }
    
    .cosmic-page {
        padding: 15px;
        margin-bottom: 150px;
    }
    
    .result-container {
        padding: 5px;
        gap: 15px;
    }
    
    .result-content {
        padding: 20px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .result-description {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .guy-types-preview {
        gap: 12px;
    }
    
    .preview-guy {
        font-size: 1.8rem;
        padding: 10px;
    }
}
