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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-edit-container {
    align-items: flex-start;
    justify-content: flex-start;
}

.screen {
    display: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Стартовая страница */
.start-content {
    text-align: center;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    font-weight: 500;
}

.feature-icon {
    font-size: 1.5rem;
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Кнопки */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 25px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(76, 175, 80, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    box-shadow: 0 10px 20px rgba(255, 152, 0, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 152, 0, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 10px 20px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(244, 67, 54, 0.4);
}

/* Страница с вопросом */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.progress-container {
    flex: 1;
    min-width: 200px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.question-counter {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.timer-container {
    text-align: center;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.total-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.total-timer span {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.total-timer-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: #764ba2;
    background: rgba(118, 75, 162, 0.1);
    padding: 5px 10px;
    border-radius: 8px;
    min-width: 60px;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

.timer-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-container {
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
    line-height: 1.4;
    color: #333;
}

.options-container {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 20px;
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.option-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(5px);
}

.option-btn.correct {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.option-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.option-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Поле объяснений */
.explanation-container {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    animation: slideDown 0.5s ease-out;
}

.explanation-title {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.explanation-text {
    color: #555;
    line-height: 1.5;
    font-size: 1rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Навигация */
.navigation-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.nav-btn {
    min-width: 120px;
    padding: 12px 20px;
    font-size: 1rem;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.nav-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

.option-btn {
    padding: 20px;
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.option-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(5px);
}

.option-btn.correct {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.option-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.option-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.score-container {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px 20px;
    border-radius: 25px;
    min-width: 150px;
}

/* Страница результатов */
.result-content {
    text-align: center;
}

.result-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-stats {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.2rem;
}

.best-score {
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.best-score h3 {
    margin-bottom: 15px;
    color: #FF8C00;
}

.best-score-value {
    font-size: 3rem;
    font-weight: 700;
    color: #FF8C00;
}

.result-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Стили редактора */
.edit-header {
    text-align: center;
    margin-bottom: 30px;
}

.edit-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.edit-subtitle {
    font-size: 1.1rem;
    color: #666;
}

.edit-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.questions-list {
    margin-bottom: 30px;
}

.question-item {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.question-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.question-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1rem;
}

.question-actions {
    display: flex;
    gap: 10px;
}

.question-form {
    display: grid;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.question-form .options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.correct-answer-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.correct-answer-group label {
    margin: 0;
}

.correct-answer-group select {
    flex: 1;
}

.edit-info {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

.edit-info h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.edit-info ul {
    list-style: none;
    padding: 0;
}

.edit-info li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    color: #555;
}

.edit-info li:last-child {
    border-bottom: none;
}

.edit-info li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    margin-right: 10px;
}

.no-questions {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
}

/* Адаптивность */
@media (max-width: 768px) {
    .quiz-container {
        padding: 10px;
    }
    
    .screen {
        padding: 20px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .timer-container {
        order: -1;
    }
    
    .question-text {
        font-size: 1.3rem;
    }
    
    .option-btn {
        padding: 15px;
        font-size: 1rem;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .edit-controls {
        flex-direction: column;
    }
    
    .question-form .options-grid {
        grid-template-columns: 1fr;
    }
    
    /* Улучшенная мобильная навигация */
    .navigation-container {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .nav-btn {
        min-width: auto;
        width: 100%;
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .score-container {
        order: 2;
        max-width: none;
        width: 100%;
    }
    
    .prev-btn {
        order: 1;
    }
    
    .next-btn {
        order: 3;
    }
    
    /* Компактный таймер для мобильных */
    .timer-container {
        flex-direction: row;
        justify-content: space-around;
        gap: 20px;
    }
    
    .total-timer {
        flex: 1;
    }
    
    .total-timer-display {
        font-size: 1rem;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    .features {
        grid-template-columns: 1fr;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
    
    .edit-title {
        font-size: 2rem;
    }
    
    /* Еще более компактная навигация для маленьких экранов */
    .navigation-container {
        gap: 10px;
    }
    
    .nav-btn {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .score-container {
        padding: 8px 15px;
        font-size: 1.1rem;
    }
    
    /* Компактный таймер */
    .timer-container {
        gap: 15px;
    }
    
    .total-timer span {
        font-size: 0.7rem;
    }
    
    .total-timer-display {
        font-size: 0.9rem;
        padding: 3px 8px;
    }
}
