/* Стиль "Тетрадная клетка" */

.mch-notebook {
    background: #fcf9f0;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
}

/* Шапка */
.mch-header {
    background: #444444;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #dee2e6;
}

.mch-lang {
    color: #1f75fe;
    font-weight: bold;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.mch-copy {
    background: #1f75fe;
    color: #fff;
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
}

.mch-copy:hover {
    background: #2980b9;
    transform: scale(0.95);
}

.mch-copy:active {
    transform: scale(0.9);
}

/* Контейнер с кодом - тетрадная клетка 20px */
.mch-code-wrap {
    background: #fcf9f0;
    padding: 0;
    overflow: auto;
    max-height: 500px;
    position: relative;
}

/* Создаем тетрадную клетку 20px */
.mch-code-wrap pre {
    margin: 0 !important;
    padding: 20px 24px !important;
    background: 
        /* Горизонтальные линии - синие, 20px */
        repeating-linear-gradient(
            transparent,
            transparent 19px,
            #b1dcfc 19px,
            #b1dcfc 20px
        ),
        /* Вертикальные линии - синие, 20px */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 19px,
            #b1dcfc 19px,
            #b1dcfc 20px
        ),
        /* Основной фон - тетрадный */
        #fcf9f0 !important;
    background-size: 20px 20px !important;
    background-position: 0 0 !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
    font-size: 13px !important;
    line-height: 20px !important;
    color: #cee6f5 !important;
    min-height: 200px;
    position: relative;
}

/* Текст кода - синий, высота строки 20px */
.mch-code-wrap code {
    display: block;
    color: #002338 !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
    font-size: 13px !important;
    line-height: 20px !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* Стилизация скроллбара */
.mch-code-wrap::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.mch-code-wrap::-webkit-scrollbar-track {
    background: #e8e0d0;
    border-radius: 0;
}

.mch-code-wrap::-webkit-scrollbar-thumb {
    background: #4a90d9;
    border-radius: 6px;
    border: 2px solid #e8e0d0;
}

.mch-code-wrap::-webkit-scrollbar-thumb:hover {
    background: #2c6fb0;
}

/* Для Firefox */
.mch-code-wrap {
    scrollbar-width: thin;
    scrollbar-color: #4a90d9 #e8e0d0;
}

/* Выделение строк при наведении */
.mch-code-wrap code:hover {
    background: rgba(74, 144, 217, 0.05);
}

/* Дополнительный эффект - как будто страница из тетради */
.mch-notebook::before {
    content: '';
    position: absolute;
    top: 38px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e74c3c;
    opacity: 0.3;
    pointer-events: none;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .mch-code-wrap pre {
        padding: 15px 18px !important;
        font-size: 12px !important;
        line-height: 18px !important;
        background-size: 18px 18px !important;
    }
    
    .mch-code-wrap code {
        font-size: 12px !important;
        line-height: 18px !important;
    }
    
    .mch-header {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
        text-align: center;
    }
    
    .mch-copy {
        width: 100%;
    }
}

/* Красная вертикальная линия (как в тетрадях) */
.mch-code-wrap::after {
    content: '';
    position: absolute;
    top: 38px;
    right: 30px;
    bottom: 0;
    width: 2px;
    background: #e74c3c;
    opacity: 0.2;
    pointer-events: none;
}