/* 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, #2c3e50 0%, #34495e 50%, #1a252f 100%);
    color: #ecf0f1;
    min-height: 100vh;
    position: relative;
}

/* Фон с эффектами контроля */
.control-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(52, 73, 94, 0.3) 50%, transparent 100%),
        linear-gradient(0deg, transparent 0%, rgba(44, 62, 80, 0.3) 50%, transparent 100%),
        radial-gradient(circle at 50% 50%, rgba(52, 73, 94, 0.2) 0%, transparent 70%);
    background-size: 200px 200px, 200px 200px, 800px 800px;
    animation: controlGrid 20s linear infinite;
    opacity: 0.6;
}

@keyframes controlGrid {
    0% { 
        transform: translate(0, 0);
        opacity: 0.6;
    }
    50% { 
        transform: translate(20px, 20px);
        opacity: 0.8;
    }
    100% { 
        transform: translate(0, 0);
        opacity: 0.6;
    }
}

/* Container */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    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;
    justify-content: center;
    align-items: center;
}

/* Главный экран */
.main-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 245, 250, 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(52, 73, 94, 0.3);
    border: 3px solid rgba(52, 73, 94, 0.6);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 400px;
    margin: auto;
}

.main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(52, 73, 94, 0.05) 2px, rgba(52, 73, 94, 0.05) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(52, 73, 94, 0.05) 2px, rgba(52, 73, 94, 0.05) 4px);
    pointer-events: none;
}

.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: #2c3e50;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(52, 73, 94, 0.3);
    margin-bottom: 10px;
    transform: rotate(-1deg);
}

.subtitle {
    font-style: italic;
    color: #34495e;
    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: #2c3e50;
}

.control-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.control-icon {
    font-size: 5rem;
    color: #2c3e50;
    animation: controlPulse 2s infinite alternate;
    text-shadow: 0 0 20px rgba(52, 73, 94, 0.5);
}

@keyframes controlPulse {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.05) rotate(2deg); }
}

/* Buttons */
.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, #2c3e50, #34495e);
    color: white;
    box-shadow: 
        0 8px 20px rgba(44, 62, 80, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #1a252f;
    width: 100%;
}

.retake-btn {
    background: linear-gradient(45deg, #7f8c8d, #95a5a6);
    color: white;
    box-shadow: 
        0 8px 20px rgba(127, 140, 141, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #5d6d7e;
}

.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 screen */
.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 card */
.test-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 245, 250, 0.98) 100%);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(52, 73, 94, 0.6);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    color: #2c3e50;
}

.question-counter {
    text-align: center;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 10px;
    font-size: 1rem;
}

.question-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.answer-option {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(52, 73, 94, 0.5);
    border-radius: 15px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #2c3e50;
    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: 44px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 73, 94, 0.3), transparent);
    transition: left 0.3s ease;
}

.answer-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #2c3e50;
    background: rgba(255, 255, 255, 1);
}

.answer-option:hover::before {
    left: 100%;
}

.answer-option.selected {
    background: linear-gradient(45deg, #2c3e50, #34495e);
    color: white;
    border-color: #1a252f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.4);
}

/* Result screen */
.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: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 245, 250, 0.98) 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 3px solid rgba(52, 73, 94, 0.6);
    text-align: center;
    width: 100%;
    max-width: 350px;
    color: #2c3e50;
}

.result-title {
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50 !important;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 50px;
}

.result-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #34495e !important;
    margin-bottom: 25px;
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 60px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 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: 12px;
        height: 100%;
    }
    
    .question-text {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .answer-option {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .main-title {
        font-size: 2.2rem;
    }
    
    .main-card {
        padding: 15px;
    }
    
    .result-container {
        padding: 10px;
        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;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 3px;
    }
    
    .test-content {
        padding: 10px;
        height: 100%;
    }
    
    .question-text {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .answer-option {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .main-card {
        padding: 12px;
    }
    
    .result-container {
        padding: 5px;
        gap: 10px;
    }
    
    .result-content {
        padding: 15px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .result-description {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
}

