* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

h1 {
    color: #d32f2f;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

@media (max-width: 480px) {
    .section {
        padding: 15px;
    }
}

.section h2 {
    color: #333;
    margin-top: 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-badge {
    font-size: 1.5rem;
}

.task {
    margin-bottom: 25px;
    padding: 15px 20px;
    background-color: #fafafa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    position: relative; /* Добавлено для корректного позиционирования чекбокса */
}

.task.completed {
    background-color: #f1f8f4;
    border-color: #c3e6cb;
}

.task-header {
    font-weight: 600;
    color: #d32f2f;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 100px; /* Место для чекбокса */
}

.task-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #f0f0f0;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.task-checkbox:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

.task.completed .task-checkbox {
    background-color: #c3e6cb;
    border-color: #4caf50;
}

.task.completed .task-checkbox:hover {
    background-color: #b1dfbb;
}

.task-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.task-checkbox label {
    color: #666;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    margin: 0;
}

.task.completed .task-checkbox label {
    color: #4caf50;
}

.task-description {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.8;
}

.task-description ul {
    margin: 10px 0;
    padding-left: 25px;
}

.task-description li {
    margin-bottom: 5px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-hint {
    background-color: #ff9800;
    color: white;
}

.btn-hint:hover {
    background-color: #f57c00;
}

.btn-solution {
    background-color: #d32f2f;
    color: white;
}

.btn-solution:hover {
    background-color: #b71c1c;
}

.hint {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background-color: #fff3e0;
    border-radius: 4px;
    border-left: 4px solid #ff9800;
    color: #666;
}

.hint.visible {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.hint-label {
    font-weight: 600;
    color: #f57c00;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.solution {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #4caf50;
}

.solution.visible {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

.solution-label {
    font-weight: 600;
    color: #4caf50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

pre {
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    color: #d32f2f;
    font-size: 0.9em;
}

.inline-code {
    background-color: #fff3e0;
    color: #e65100;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

/* Более спокойная цветовая схема для синтаксиса */
.keyword { color: #d73a49; font-weight: 600; }
.string { color: #22863a; }
.function { color: #005cc5; }
.number { color: #005cc5; }
.comment { color: #6a737d; font-style: italic; }

.progress-section {
    background: white;
    border-radius: 8px;
    padding: 8px 20px;
    margin: 20px 0 25px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 10px;
    z-index: 100;
    border: 1px solid #4caf50;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.progress-section h3 {
    color: #333;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.stats-text {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    white-space: nowrap;
}

.progress-bar {
    background-color: #e0e0e0;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
    min-width: 200px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #45a049 100%);
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.reset-btn {
    background-color: #666;
    color: white;
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.reset-btn:hover {
    background-color: #555;
    transform: scale(1.05);
}

/* Подсказка для кнопки исправления */
.fix-btn {
    background-color: #4caf50 !important;
    position: relative;
}

.fix-btn:hover {
    background-color: #45a049 !important;
}

.tips-section {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 15px 20px;
    margin: 30px 0;
    border-radius: 4px;
}

.tips-section h4 {
    color: #e65100;
    margin-top: 0;
    margin-bottom: 10px;
}

.tips-section ul {
    margin: 0;
    padding-left: 25px;
    color: #666;
}

.tips-section li {
    margin-bottom: 8px;
}

.example-output {
    background-color: #263238;
    color: #aed581;
    padding: 10px 15px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    margin: 10px 0;
}

@media (max-width: 768px) {
    .progress-section {
        gap: 10px;
    }
    
    .progress-bar {
        width: 100%;
        order: 4;
    }
    
    .task-header {
        padding-right: 0;
        margin-bottom: 15px;
    }
    
    .task-checkbox {
        position: static;
        margin-top: 10px;
        width: fit-content;
    }
}

@media (max-width: 600px) {
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .task-checkbox {
        padding: 4px 10px;
    }
    
    .task-checkbox label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 15px;
    }
    
    .button-group {
        width: 100%;
    }
    
    .button-group .btn {
        flex: 1;
        min-width: 80px;
    }
}