/* 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, #2d5016 0%, #1a3d0a 50%, #0f2a05 100%);
    color: #2c3e2a;
    min-height: 100vh;
    position: relative;
}

/* Ботанический фон */
.botanical-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 80%, rgba(34, 139, 34, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(50, 205, 50, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(107, 142, 35, 0.1) 0%, transparent 50%);
    background-size: 400px 400px, 300px 300px, 500px 500px;
    animation: botanicalFloat 20s ease-in-out infinite;
}

@keyframes botanicalFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(1deg); }
    66% { transform: translateY(5px) rotate(-1deg); }
}

/* 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, #f5f5dc 0%, #f0e68c 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 3px solid #8b7355;
    position: relative;
    overflow: hidden;
}

.encyclopedia-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(160, 82, 45, 0.1) 0%, transparent 50%);
    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: #2c3e2a;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    transform: rotate(-2deg);
}

.subtitle {
    font-style: italic;
    color: #5d4e37;
    font-size: 1.1rem;
    transform: rotate(1deg);
}

.page-content {
    position: relative;
    z-index: 1;
}

.intro-text {
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #3e4a2a;
}

.plant-preview {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.preview-plant {
    font-size: 2rem;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    border: 2px solid #8b7355;
    transition: all 0.3s ease;
    cursor: pointer;
    animation: plantFloat 3s ease-in-out infinite;
}

.preview-plant:nth-child(2n) {
    animation-delay: 0.5s;
}

.preview-plant:nth-child(3n) {
    animation-delay: 1s;
}

.preview-plant:hover {
    transform: scale(1.2) rotate(10deg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@keyframes plantFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

/* Кнопки */
.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, #228b22, #32cd32);
    color: white;
    box-shadow: 
        0 8px 20px rgba(34, 139, 34, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #1e7b1e;
    width: 100%;
}

.share-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;
}

.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;
}

.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;
}

/* Прогресс-бар (стебель) */
.progress-stem {
    position: relative;
    width: 20px;
    height: 300px;
    display: none; /* Скрываем стебель во время теста */
    flex-direction: column;
    align-items: center;
}

.stem-base {
    width: 30px;
    height: 20px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.stem-body {
    width: 8px;
    height: 250px;
    background: linear-gradient(to bottom, #228b22, #32cd32);
    border-radius: 4px;
    position: relative;
    box-shadow: 
        inset 2px 0 4px rgba(0, 0, 0, 0.2),
        inset -2px 0 4px rgba(255, 255, 255, 0.2);
}

.leaf {
    position: absolute;
    width: 15px;
    height: 8px;
    background: linear-gradient(45deg, #32cd32, #228b22);
    border-radius: 0 100% 0 100%;
    transform-origin: left center;
    animation: leafGrow 0.5s ease-out;
}

.leaf:nth-child(odd) {
    left: -10px;
    transform: rotate(-45deg);
}

.leaf:nth-child(even) {
    right: -10px;
    transform: rotate(45deg);
}

@keyframes leafGrow {
    0% { 
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    100% { 
        transform: scale(1) rotate(var(--rotation, 0deg));
        opacity: 1;
    }
}

.bud-container {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bud {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    border-radius: 50% 50% 50% 0;
    transform: rotate(45deg);
    animation: budGrow 0.8s ease-out;
    box-shadow: 0 2px 10px rgba(255, 20, 147, 0.4);
}

@keyframes budGrow {
    0% { 
        transform: scale(0) rotate(45deg);
        opacity: 0;
    }
    100% { 
        transform: scale(1) rotate(45deg);
        opacity: 1;
    }
}

/* Контент теста */
.test-content {
    background: rgba(245, 245, 220, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 2px solid #8b7355;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.question-counter {
    text-align: center;
    font-weight: 600;
    color: #5d4e37;
    margin-bottom: 10px;
    font-size: 1rem;
}

.question-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #2c3e2a;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.answer-option {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #8b7355;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #2c3e2a;
    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;
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 139, 34, 0.2), 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: #228b22;
    background: rgba(255, 255, 255, 0.95);
}

.answer-option:hover::before {
    left: 100%;
}

.answer-option.selected {
    background: linear-gradient(45deg, #228b22, #32cd32);
    color: white;
    border-color: #1e7b1e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34, 139, 34, 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(245, 245, 220, 0.95);
    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.5);
    border: 3px solid #8b7355;
    text-align: center;
    width: 100%;
    max-width: 350px;
}

.result-title {
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e2a !important;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 50px;
}


@keyframes plantPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.result-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #3e4a2a !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;
    }
    
    .encyclopedia-page {
        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;
    }
    
    .encyclopedia-page {
        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;
    }
    
    
}
