/* 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: 'Crimson Text', serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e0e0e0;
    min-height: 100vh;
    position: relative;
}

/* Фон с зеркальными эффектами */
.mirror-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(200, 200, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(150, 150, 255, 0.05) 0%, transparent 60%);
    background-size: 600px 600px, 400px 400px, 800px 800px;
    animation: mirrorShimmer 15s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes mirrorShimmer {
    0%, 100% { 
        transform: translateX(0px) translateY(0px);
        opacity: 0.6;
    }
    33% { 
        transform: translateX(20px) translateY(-10px);
        opacity: 0.7;
    }
    66% { 
        transform: translateX(-15px) translateY(15px);
        opacity: 0.5;
    }
}

/* 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;
}

/* Главный экран - Зеркало */
.encyclopedia-page {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 255, 0.98) 100%);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        0 0 30px rgba(100, 150, 255, 0.3);
    border: 3px solid rgba(150, 150, 200, 0.5);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.encyclopedia-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.03) 10px,
            rgba(255, 255, 255, 0.03) 20px
        );
    animation: mirrorReflection 20s linear infinite;
    pointer-events: none;
}

@keyframes mirrorReflection {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(50px) translateY(50px); }
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.main-title {
    font-family: 'Caveat', cursive;
    font-size: 3rem;
    font-weight: 700;
    color: #1a1a2e;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(100, 150, 255, 0.3);
    margin-bottom: 10px;
    transform: rotate(-1deg);
}

.subtitle {
    font-style: italic;
    color: #4a4a6e;
    font-size: 1.1rem;
    transform: rotate(0.5deg);
}

.page-content {
    position: relative;
    z-index: 1;
}

.intro-text {
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #2a2a4e;
}

.other-apps-btn {
    background: linear-gradient(45deg, #6f86b7, #8fa4cd);
    color: #1a1a2e;
    border: 2px solid #5e72a2;
    width: 100%;
    margin-bottom: 10px;
}

.other-apps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mirror-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    perspective: 1000px;
}

.mirror-frame {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c0c0d0 0%, #a0a0b0 50%, #808090 100%);
    border: 4px solid #606070;
    box-shadow: 
        inset 0 0 30px rgba(255, 255, 255, 0.5),
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(100, 150, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: mirrorPulse 3s ease-in-out infinite;
}

.mirror-frame::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    animation: mirrorGlint 4s ease-in-out infinite;
}

@keyframes mirrorPulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        box-shadow: 
            inset 0 0 30px rgba(255, 255, 255, 0.5),
            0 10px 30px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(100, 150, 255, 0.4);
    }
    50% { 
        transform: scale(1.05) rotate(2deg);
        box-shadow: 
            inset 0 0 40px rgba(255, 255, 255, 0.7),
            0 15px 40px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(100, 150, 255, 0.6);
    }
}

@keyframes mirrorGlint {
    0%, 100% { 
        opacity: 0.6;
        transform: translate(0, 0);
    }
    50% { 
        opacity: 1;
        transform: translate(20px, 20px);
    }
}

.mirror-glass {
    font-size: 3rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(200, 200, 255, 0.2) 100%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.4);
}

/* Кнопки */
.btn {
    position: relative;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
    -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: 44px;
    min-width: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.sticker-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    box-shadow: 
        0 8px 20px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #e55a5a;
    width: 100%;
    margin-bottom: 15px;
}

.start-btn {
    background: linear-gradient(45deg, #4a90e2, #6ba3f5);
    color: white;
    box-shadow: 
        0 8px 20px rgba(74, 144, 226, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #3a7bc8;
    width: 100%;
}

.other-app-btn {
    background: linear-gradient(45deg, #8b9dc3, #a7b7d9);
    color: #1a1a2e;
    border: 2px solid #7283aa;
    font-size: 1rem;
    width: 100%;
}

.retake-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    box-shadow: 
        0 8px 20px rgba(78, 205, 196, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #3bb5ac;
    width: 100%;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn:hover .btn-glow {
    left: 100%;
}

.btn:active {
    transform: translateY(0);
}

/* Экран теста */
.test-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
}

/* Контент теста */
.test-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        0 0 30px rgba(100, 150, 255, 0.2);
    border: 2px solid rgba(150, 150, 200, 0.4);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    backdrop-filter: blur(10px);
    position: relative;
}

.test-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 5px,
            rgba(100, 150, 255, 0.02) 5px,
            rgba(100, 150, 255, 0.02) 10px
        );
    pointer-events: none;
    border-radius: 20px;
}

.question-counter {
    text-align: center;
    font-weight: 600;
    color: #4a4a6e;
    margin-bottom: 15px;
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

.question-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.2rem;
    line-height: 1.5;
    color: #1a1a2e;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.answer-option {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(100, 150, 255, 0.3);
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #2a2a4e;
    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;
    -webkit-appearance: none;
    appearance: none;
    min-height: 50px;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(100, 150, 255, 0.2), transparent);
    transition: left 0.4s ease;
}

.answer-option:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 0 20px rgba(100, 150, 255, 0.3);
    border-color: rgba(100, 150, 255, 0.6);
    background: rgba(255, 255, 255, 1);
}

.answer-option:hover::before {
    left: 100%;
}

.answer-option.selected {
    background: linear-gradient(45deg, #4a90e2, #6ba3f5);
    color: white;
    border-color: #3a7bc8;
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(74, 144, 226, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(100, 150, 255, 0.4);
}

/* Экран результата */
.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.result-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 35px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.4),
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        0 0 40px rgba(100, 150, 255, 0.3);
    border: 3px solid rgba(150, 150, 200, 0.5);
    text-align: center;
    width: 100%;
    max-width: 380px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.result-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(100, 150, 255, 0.03) 10px,
            rgba(100, 150, 255, 0.03) 20px
        );
    animation: mirrorReflection 25s linear infinite;
    pointer-events: none;
}

.result-title {
    font-family: 'Caveat', cursive;
    font-size: 2.8rem;
    font-weight: 700;
    color: #1a1a2e !important;
    margin-bottom: 20px;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(100, 150, 255, 0.3);
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 60px;
    position: relative;
    z-index: 1;
}

.result-description {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #2a2a4e !important;
    margin-bottom: 30px;
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 80px;
    position: relative;
    z-index: 1;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    z-index: 1;
}

/* 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.9rem;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .encyclopedia-page {
        padding: 20px;
    }
    
    .result-container {
        padding: 10px;
        gap: 15px;
    }
    
    .result-content {
        padding: 25px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 2.3rem;
        margin-bottom: 15px;
    }
    
    .result-description {
        font-size: 1.05rem;
        margin-bottom: 25px;
    }
}

@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.85rem;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .encyclopedia-page {
        padding: 15px;
    }
    
    .result-container {
        padding: 5px;
        gap: 10px;
    }
    
    .result-content {
        padding: 20px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .result-description {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
}
