/* Базовые настройки */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}
h1 { margin-bottom: 20px; font-size: 2em; color: #2c3e50; text-align: center; }
h2 { margin-top: 0; margin-bottom: 10px; font-size: 1.3em; color: #2c3e50; }
p { margin-top: 0; margin-bottom: 10px; line-height: 1.5; }

/* Стили для главного меню (index.html) */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}
.task-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid #0984e3;
    display: flex;
    flex-direction: column;
}
.task-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.task-title { font-weight: bold; font-size: 1.2em; margin-bottom: 10px; color: #0984e3; }
.task-desc { font-size: 0.9em; color: #636e72; flex-grow: 1; line-height: 1.4; }

/* Навигация внутри самих задач */
.nav-bar { margin-bottom: 20px; }
.back-link { text-decoration: none; color: #0984e3; font-weight: bold; font-size: 1.1em; }
.back-link:hover { text-decoration: underline; }

/* Общие стили для тренажёров (Этапы 1, 2, 3) */
.stage {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: none;
}
.stage.active { display: block; }

.problem-text {
    font-size: 1.1em;
    line-height: 1.6;
    padding: 15px;
    background: #eef2f3;
    border-radius: 6px;
    margin-bottom: 20px;
}
.draggable-text {
    background-color: #ffeaa7;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: grab;
    border: 1px dashed #d69e2e;
    transition: background 0.2s;
}
.draggable-text:hover { background-color: #fdcb6e; }
.draggable-text:active { cursor: grabbing; }

.targets-container { display: flex; flex-direction: column; gap: 8px; }
.target-row {
    display: flex; align-items: center; background: #fafafa;
    padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px;
}
.math-part { width: 140px; font-weight: bold; font-size: 1.1em; }
.drop-zone {
    flex-grow: 1; min-height: 36px; border: 2px dashed #b2bec3;
    border-radius: 4px; margin-left: 15px; display: flex;
    align-items: center; padding: 0 10px; color: #636e72; transition: all 0.3s;
}
.drop-zone.drag-over { background-color: #dfe6e9; border-color: #0984e3; }
.drop-zone.correct { background-color: #d4edda; border-color: #28a745; color: #155724; border-style: solid; }
.drop-zone.error { background-color: #f8d7da; border-color: #dc3545; }

.equation-builder { display: flex; gap: 8px; margin-bottom: 15px; flex-wrap: wrap; align-items: center; }
.eq-piece {
    padding: 8px 12px; 
    background: #0984e3; 
    color: white;
    border-radius: 6px; 
    cursor: grab; 
    font-size: 1.1em; 
    font-weight: bold;
    white-space: nowrap; /* Запрещаем перенос текста внутри карточки */
}
.eq-drop-zone {
    min-width: 60px; /* Минимальная ширина для пустой ячейки */
    width: max-content; /* Ширина автоматически подстраивается под карточку */
    min-height: 45px;
    height: auto;
    padding: 5px 10px; /* Добавляем внутренние отступы */
    border: 2px dashed #0984e3;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    font-weight: bold;
    box-sizing: border-box;
}
.eq-drop-zone.filled { border-style: solid; background: #eef2f3; }

.solution-step { margin-bottom: 12px; font-size: 1.1em; }
input[type="number"] {
    width: 70px; padding: 6px; font-size: 1em;
    border: 1px solid #ccc; border-radius: 4px; text-align: center;
}
.btn {
    background: #00b894; color: white; border: none;
    padding: 10px 20px; font-size: 1em; border-radius: 4px; cursor: pointer; margin-top: 5px;
}
.btn:hover { background: #00a884; }
.feedback { margin-left: 10px; font-weight: bold; font-size: 1em; }
.success-text { color: #28a745; }
.error-text { color: #dc3545; }
/* Стили для пройденных задач */
.task-card.completed {
    background-color: #f0fdf4;
    border-top-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e inset;
}
.task-card.completed .task-title {
    color: #166534;
}
.task-card.completed::after {
    content: '✓ Выполнено';
    display: block;
    margin-top: 10px;
    color: #15803d;
    font-weight: bold;
    font-size: 0.9em;
}
/* Делаем курсор-указатель для карточек, которые уже вставлены в уравнение */
.eq-drop-zone .eq-piece {
    cursor: pointer;
}
.eq-drop-zone .eq-piece:hover {
    background-color: #ff7675; /* При наведении карточка будет краснеть, намекая на удаление */
}