/* style.css */

* { box-sizing: border-box; }

body { 
    background-color: #34495e; 
    padding: 10px; 
    font-family: 'Caveat', cursive; 
    color: #000080; 
    margin: 0; 
}

.paper-sheet {
    background: #fff;
    background-image: linear-gradient(#e1eff9 1px, transparent 1px), linear-gradient(90deg, #e1eff9 1px, transparent 1px);
    background-size: 30px 30px; 
    max-width: 900px; 
    margin: 0 auto; 
    min-height: 95vh;
    padding: 15px; 
    position: relative; 
    border-radius: 4px; 
    overflow: hidden;
}

.red-margin { 
    position: absolute; 
    left: 25px; 
    top: 0; 
    bottom: 0; 
    border-left: 2px solid #ffb6c1; 
    z-index: 1; 
}

.content { 
    position: relative; 
    z-index: 2; 
    padding-left: 30px; 
}

/* --- ГОЛОВНЕ МЕНЮ --- */
.menu-container { text-align: center; padding-top: 40px; }

.app-title {
    font-size: 3.5rem; 
    margin-bottom: 30px; 
    color: #d35400;
    text-shadow: 2px 2px 0px #f1c40f; 
    transform: rotate(-2deg);
}

.stats-box {
    background: rgba(255, 255, 0, 0.1);
    border: 2px dashed #f39c12;
    display: inline-block;
    padding: 15px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
    text-align: left;
}
.stat-item { font-size: 1.6rem; margin: 5px 0; font-weight: bold; }
.stat-val { color: #e67e22; float: right; margin-left: 20px; }
.big-star { color: #f1c40f; text-shadow: 1px 1px 0 #d35400; }

.btn-menu {
    display: block; width: 100%; max-width: 300px; margin: 15px auto; padding: 12px;
    font-family: 'Caveat', cursive; font-size: 2rem; border: none;
    border-radius: 50px 15px 50px 15px; cursor: pointer;
    transition: transform 0.1s; box-shadow: 0 5px 0 rgba(0,0,0,0.2);
}
.btn-menu:active { transform: translateY(5px); box-shadow: none; }
.btn-start { background: #27ae60; color: white; border: 3px solid #2ecc71; }
.btn-share { background: #3498db; color: white; border: 3px solid #2980b9; }

/* --- ІГРОВИЙ ЕКРАН --- */
h1.level-header { 
    text-align: center; 
    margin: 0 0 15px; 
    font-size: 2rem; 
    line-height: 1.2;
    padding-right: 60px; /* Місце для кнопки Меню, щоб не налізала */
}

/* Блок з прикладом і поясненням */
.demo-section {
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin-bottom: 30px;
    background: rgba(255, 255, 0, 0.05); 
    border: 1px solid #f1c40f;
    border-radius: 10px; 
    padding: 10px;
}

.visual-col { flex: 0 0 auto; } /* Стовпчик займає стільки місця, скільки треба */
.text-col { flex: 1; min-width: 250px; } /* Текст займає решту місця */

.teacher-chat {
    background: #fff; 
    border: 1px solid #ddd; 
    border-radius: 8px;
    padding: 15px; /* Більше простору всередині */
    font-family: 'Segoe UI', sans-serif; 
    font-size: 1rem; 
    color: #333;
    height: 100%; /* Розтягуємо на всю висоту */
}
.step-bubble { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed #ccc; }
.step-bubble:last-child { border-bottom: none; margin-bottom: 0; }
.step-num { font-weight: bold; color: #e67e22; font-size: 0.9em; margin-bottom: 5px; }

/* Сітка цифр */
.math-row { display: flex; font-family: 'Courier Prime', monospace; font-size: 22px; font-weight: bold; line-height: 30px; }
.cell { width: 30px; height: 30px; text-align: center; flex-shrink: 0; }
.corner { border-left: 2px solid #000; padding-left: 5px; margin-left: 5px; }
.border-bot { border-bottom: 2px solid #000; }
.underline { border-bottom: 2px solid #000; }

.tasks-container { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.task-card { 
    background: #fff; border: 2px dashed #000080; padding: 15px; 
    border-radius: 10px; width: 100%; max-width: 350px; 
    box-shadow: 3px 3px 10px rgba(0,0,0,0.05); position: relative;
}

.big-expr { font-family: 'Courier Prime', monospace; font-size: 1.8rem; font-weight: bold; text-align: center; margin-bottom: 10px; }

input { 
    border: none; border-bottom: 2px solid #d63384; 
    background: transparent; font-family: 'Courier Prime'; 
    font-size: 1.4rem; color: #d63384; text-align: center; width: 60px; outline: none; border-radius: 0;
}
.wrong-input { border-bottom: 2px solid red !important; color: red !important; background-color: rgba(255, 0, 0, 0.1) !important; }
input::placeholder { color: #ccc; opacity: 1; }

.cheat-sheet { margin-top: 15px; background: #e8f8f5; padding: 10px; border-radius: 5px; font-size: 1rem; font-family: 'Courier Prime', monospace; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cheat-item { color: #27ae60; font-weight: bold; }

.btn-submit { 
    display: block; width: 100%; padding: 15px; margin-top: 20px; 
    background: #27ae60; color: white; border: none; border-radius: 30px; 
    font-family: 'Caveat'; font-size: 1.8rem; cursor: pointer; 
}

/* Кнопка "Меню" (Будиночок) */
.btn-home {
    position: absolute; 
    top: 10px; 
    right: 10px;
    background: #fff; 
    border: 2px solid #bdc3c7;
    padding: 5px 15px; 
    border-radius: 20px;
    font-family: 'Caveat'; 
    font-size: 1.2rem; 
    cursor: pointer; 
    z-index: 100;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.msg { text-align: center; font-size: 1.5rem; padding: 10px; margin-bottom: 20px; border-radius: 5px; }
.success { background: #d4edda; color: #155724; }
.error { background: #f8d7da; color: #721c24; }

/* === АДАПТАЦІЯ ПІД МОБІЛЬНІ (ВАЖЛИВО) === */
@media (max-width: 600px) {
    /* Зменшуємо шрифти заголовків */
    h1.level-header { 
        font-size: 1.5rem; 
        text-align: left; /* Вирівнюємо вліво, щоб не конфліктувати з кнопкою */
        margin-top: 10px;
    }
    
    .app-title { font-size: 2.5rem; }

    /* Поля зошита */
    .content { padding-left: 20px; padding-right: 5px; }
    .red-margin { left: 15px; }
    
    /* Зміни для демонстраційного блоку */
    .demo-section {
        flex-direction: column; /* Ставимо блоки вертикально: зверху приклад, знизу текст */
        gap: 15px;
    }
    
    /* Текст пояснення розтягуємо на всю ширину */
    .text-col { 
        min-width: 100%; 
        width: 100%; 
    }
    
    .teacher-chat {
        font-size: 1rem; /* Оптимальний розмір для читання */
        line-height: 1.4;
    }

    /* Інпути і кнопки */
    input { width: 50px; font-size: 1.2rem; }
    
    /* Кнопка Меню на телефоні компактніша */
    .btn-home {
        padding: 5px 10px;
        font-size: 1rem;
        top: 5px;
        right: 5px;
    }
}