@font-face {
    font-family: '7DB';
    src: url('/static/fonts/7DB.ttf') format('truetype');
}
@font-face {
    font-family: 'Akademitscheskaya';
    src: url('/static/fonts/Akademitscheskaya.ttf') format('truetype');
}
@font-face {
    font-family: 'Christopher';
    src: url('/static/fonts/Christopher.ttf') format('truetype');
}
@font-face {
    font-family: 'LiteraturnayaBook';
    src: url('/static/fonts/LiteraturnayaBook.ttf') format('truetype');
}
@font-face {
    font-family: 'LozungCapsBlack';
    src: url('/static/fonts/Lozung Caps Black.ttf') format('truetype');
}
@font-face {
    font-family: 'GazetaSans';
    src: url('/static/fonts/ofont.ru_Gazeta Sans Serif.ttf') format('truetype');
}
@font-face {
    font-family: 'NewJournalC';
    src: url('/static/fonts/ofont.ru_NewJournalC.ttf') format('truetype');
}

/* ============================================================
   SOVIET MAGAZINE EDITORIAL STYLE (1987-2026)
   Designed for: Museum "Time Machine" - History Section
   ============================================================ */

:root {
    --mag-paper: #f4f0e6;      /* Состаренная бумага */
    --mag-red: #a52a2a;        /* Советский красный (киноварь) */
    --mag-blue: #1e5084;       /* Технический синий */
    --mag-black: #1a1a1a;      /* Глубокий черный */
    --mag-border: #333333;
    --mag-shadow: rgba(0, 0, 0, 0.2);
    
    /* Шрифты (подставятся автоматически, если подключены в base.html) */
    --f-title: 'Bannikova', serif;
    --f-section: 'Akademitscheskaya', serif;
    --f-body: 'Literaturnaya', serif;
    --f-mono: 'NewJournalC', monospace;
}

/* Общая подложка */
.magazine-layout-root {
    display: flex;
    flex-direction: row;
    background-color: #2b2b2b; /* Цвет стола вокруг */
    min-height: 100vh;
    overflow: hidden;
}

/* Шум бумаги и зерно киноленты */
.grain-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    opacity: 0.4;
    pointer-events: none;
    z-index: 9999;
}

/* Лист журнала */
.magazine-canvas {
    background-color: var(--mag-paper);
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    
    /* Основные изменения для авто-расширения */
    width: 95%;
    max-width: 1100px;
    min-height: 100vh;      /* Минимально на весь экран */
    height: auto !important; /* Автоматическое расширение по контенту */
    display: block;         /* Обеспечивает правильный поток блоков */
    overflow: visible;      /* Чтобы тени и элементы не обрезались */
    
    padding: 80px 100px;    /* Комфортные поля */
    margin: 20px auto 200px;
    box-shadow: 0 0 50px rgba(0,0,0,0.2), 15px 15px 0px rgba(0,0,0,0.05);
    box-sizing: border-box;
    position: relative;
}
/* Верхняя техническая полоса */
.magazine-top-info {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 2px solid var(--mag-black);
    margin-bottom: 10px;
    color: var(--mag-black);
}

.font-mono { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }

/* --- БЛОКИ ВЁРСТКИ --- */

.block-wrapper-outer {
    position: relative;
    margin-bottom: 25px;
    padding: 10px;
    border: 2px solid transparent;
    transition: none !important; /* Убираем анимацию перехода */
    clear: both; /* Очистка потока после буквиц и плавающих элементов */

}

.block-wrapper-outer.selected {
    border: 2px solid var(--mag-red) !important; /* Четкая красная рамка */
    background: rgba(165, 42, 42, 0.05) !important;
    outline: none !important;         /* ГАРАНТИРОВАННО УДАЛЯЕМ ПРЯМОУГОЛЬНИК */
    box-shadow: none !important;      /* Убираем любые тени */
    transform: none !important;       /* Запрещаем любые деформации */
    z-index: 100;
}
/* Заголовок темы */
.magazine-header-block {
    text-align: left;
    border-bottom: 5px solid var(--mag-black);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.header-meta-row { display: flex; gap: 20px; margin-bottom: 10px; }
.header-meta-row input { 
    background: transparent; border: none; border-bottom: 1px dotted #999; 
    font-family: var(--f-mono); font-size: 10px; width: 80px;
}

.font-title {
    font-family: var(--f-title);
    font-size: 4.5rem;
    line-height: 0.9;
    text-transform: uppercase;
    color: var(--mag-black);
    margin: 0;
    outline: none;
}

/* Заголовок раздела */
.section-divider-block h2 {
    font-family: var(--f-section);
    font-size: 2.2rem;
    color: var(--mag-red);
    border-bottom: 2px solid var(--mag-red);
    display: inline-block;
    margin-bottom: 20px;
    outline: none;
}

/* Текст и Буквица */
.font-body {
    font-family: var(--f-body);
    font-size: 1.15rem;
    line-height: 1.6;
    text-align: justify;
    color: #111;
    outline: none;
}

.drop-cap::first-letter {
    font-family: var(--f-title);
    font-size: 5rem;
    float: left;
    margin-right: 12px;
    line-height: 0.8;
    color: var(--mag-red);
    padding-top: 10px;
}

/* Две колонки (стиль Радио) */
.dual-columns-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;             /* Увеличили разрыв между колонками */
    margin: 30px 0;
}

.dual-columns-layout .col {
    padding-top: 10px;
    border-top: 1px solid var(--mag-black);
}

/* Фото-карточка */
.archive-photo-frame {
    width: 100%;
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-container {
    background: #fff;
    border: 1px solid var(--mag-black);
    padding: 15px;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.1);
    cursor: pointer;
    width: 100%;           /* Растягиваем контейнер */
    max-width: 800px;      /* Но ограничиваем, чтобы фото не «взорвалось» на весь экран */
    box-sizing: border-box;
}

.photo-container img {
    width: 100%;
    height: auto;          /* Сохраняем пропорции */
    display: block;
    filter: contrast(1.1) grayscale(0.2) sepia(0.1);
}

.photo-caption-input {
    width: 100%;
    text-align: center;
    border: none;
    background: transparent;
    margin-top: 15px;
    font-family: var(--f-mono);
    font-style: italic;
    color: #555;
}

/* Техническая заметка */
.technical-note-box {
    background: #e8f0f2;
    border: 2px solid var(--mag-blue);
    padding: 25px;
    position: relative;
    margin: 30px 0;
}

.note-header {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--mag-blue);
    color: white;
    padding: 2px 12px;
    font-size: 10px;
}

/* Памятный блок */
.memorial-sidebar-block {
    display: flex;
    gap: 25px;
    background: #fff;
    padding: 20px;
    border: 1px solid #ccc;
    margin: 20px 0;
}

.memorial-photo {
    width: 150px;
    height: 200px;
    background: #ddd;
    flex-shrink: 0;
    border: 1px solid #000;
}

.memorial-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Разделитель с эмблемой */
.graphic-line-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
}

.graphic-line-divider .line { flex: 1; height: 1px; background: var(--mag-black); }
.emblem-sep { width: 40px; filter: grayscale(1); opacity: 0.5; }

/* --- ПАНЕЛЬ УПРАВЛЕНИЯ (ИНЖЕНЕРНЫЙ ПУЛЬТ) --- */

.editor-control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #2b2b2b;
    border-top: 4px solid var(--mag-red);
    padding: 20px 40px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.panel-header { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 5px; }
.red-square { width: 12px; height: 12px; background: var(--mag-red); }

.add-block-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.tool-btn {
    background: #3d3d3d;
    border: 1px solid #555;
    color: #eee;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-width: 120px;
    transition: 0.2s;
}

.tool-btn:hover { background: #4d4d4d; border-color: var(--mag-red); color: #fff; }

.btn-icon { font-size: 1.2rem; margin-bottom: 5px; color: var(--mag-red); font-weight: bold; }
.btn-text { font-family: var(--f-mono); font-size: 8px; font-weight: bold; }

.panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    border-top: 1px solid #444;
    padding-top: 15px;
}

.action-btn {
    padding: 12px 30px;
    font-family: var(--f-section);
    font-weight: bold;
    cursor: pointer;
    border: none;
    text-transform: uppercase;
}

.save-btn { background: var(--mag-red); color: #fff; box-shadow: 5px 5px 0px #4d1414; }
.save-btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0px #4d1414; }
.cancel-btn { background: #555; color: #ccc; }

/* Мини-кнопки блоков */
.block-controls-mini {
    position: absolute;
    left: -45px;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ctrl-btn {
    width: 30px; height: 30px;
    background: var(--mag-black);
    color: #fff; border: none;
    font-size: 10px; cursor: pointer;
}
.ctrl-btn:hover { background: var(--mag-red); }
.del-btn:hover { background: #ff0000; }

/* Модалка */
.magazine-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    z-index: 100000; display: flex; align-items: center; justify-content: center;
}

.modal-box {
    background: var(--mag-paper);
    padding: 40px;
    border: 3px solid var(--mag-black);
    max-width: 450px; width: 90%;
    box-shadow: 20px 20px 0px var(--mag-red);
}

/* Скроллбар в стиле ретро */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2b2b2b; }
::-webkit-scrollbar-thumb { background: var(--mag-red); }

@media (max-width: 768px) {
    .magazine-canvas {
        padding: 40px 20px;
    }
    .dual-columns-layout {
        grid-template-columns: 1fr; /* На телефонах колонки встают друг под друга */
        gap: 20px;
    }
    .font-title {
        font-size: 2.5rem; /* Уменьшаем заголовок на мобилках */
    }
}
/* Кнопка редактирования для админа */
.magazine-edit-btn {
    text-decoration: none;
    display: inline-block;
    padding: 12px 25px;
    background-color: rgba(165, 42, 42, 0.05);
    border: 1px dashed var(--mag-red);
    color: var(--mag-red) !important;
    transition: all 0.3s ease;
    cursor: pointer;
    z-index: 1000;
}

.magazine-edit-btn:hover {
    background-color: var(--mag-red);
    color: #fff !important;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.1);
    transform: translate(-3px, -3px);
}

.magazine-edit-btn span {
    font-weight: bold;
    letter-spacing: 1px;
}

/* На мобильных устройствах центрируем кнопку */
@media (max-width: 768px) {
    .admin-edit-bar { text-align: center !important; }
    .magazine-edit-btn { width: 90%; }
}

/* Динамический заголовок техзаметки */
.technical-note-box .note-header {
    cursor: text;
    min-width: 50px;
}

/* Композитная галерея */
.composite-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 30px 0;
}
.composite-gallery .top-row {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.composite-gallery .bottom-row {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 15px;
    align-items: start;
}

/* Рукописный заголовок (стиль 80-90х) */
.soviet-script {
    font-family: 'Playfair Display', serif; /* Или похожий на рукописный */
    font-style: italic;
    font-size: 2.5rem;
    color: var(--mag-red);
    transform: rotate(-3deg);
    margin-bottom: 20px;
    display: block;
}

/* Трехколоночный блок (как рецепты в Крестьянке) */
.magazine-columns-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 25px 0;
}
.magazine-columns-3 .col-text {
    font-size: 0.95rem;
    line-height: 1.4;
    border-right: 0.5px solid #ccc;
    padding-right: 10px;
}
.magazine-columns-3 .col-text:last-child { border-right: none; }

/* Блок-извинение / Сноска */
.soviet-callout {
    border-top: 2px solid #ff8c00;
    border-bottom: 2px solid #ff8c00;
    padding: 10px 0;
    margin: 20px 0;
    text-transform: uppercase;
    font-family: var(--f-mono);
    font-weight: bold;
    color: #ff8c00;
    font-size: 0.8rem;
}

#upload-bar {
    background-image: linear-gradient(
        45deg, 
        rgba(255,255,255,.15) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255,255,255,.15) 50%, 
        rgba(255,255,255,.15) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 40px 40px;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}

/* БОКОВАЯ ПАНЕЛЬ (СЛЕВА) */
.editor-sidebar {
    width: 300px;
    background: #1a1a1a;
    border-right: 2px solid var(--mag-red);
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    color: #eee;
}

.label-mono-sm {
    font-family: var(--f-mono);
    font-size: 9px;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

/* Панель форматирования текста */
.text-format-panel {
    background: #252525;
    padding: 15px;
    border: 1px solid #333;
    margin-bottom: 20px;
}

.format-select {
    width: 100%;
    background: #000;
    color: #fff;
    border: 1px solid #444;
    padding: 5px;
    font-family: var(--f-mono);
    font-size: 11px;
    margin-bottom: 10px;
}

.btn-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.format-btn {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 8px;
    cursor: pointer;
    font-size: 12px;
}

.format-btn:hover { background: var(--mag-red); }

/* Вертикальная сетка кнопок блоков */
.add-block-vertical-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 30px;
}

.tool-btn {
    background: #333;
    border: 1px solid #444;
    color: #ccc;
    padding: 10px;
    text-align: left;
    font-family: var(--f-mono);
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.tool-btn:hover { border-left: 5px solid var(--mag-red); color: #fff; padding-left: 15px; }

/* ОБЛАСТЬ ПРОСМОТРА (СПРАВА) */
.magazine-viewport {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 40px;
    background: #d2cfc4; /* Цвет стола под бумагой */
}

.magazine-top-info-fixed {
    max-width: 1100px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
}

.magazine-canvas {
    margin: 0 auto 100px !important; /* Центрируем лист */
}

/* ГЛОБАЛЬНЫЙ МАКЕТ РЕДАКТОРА */
.magazine-editor-layout {
    display: flex;
    height: 100vh;
    background-color: #2b2b2b;
    overflow: hidden;
}

/* ЛЕВАЯ КОЛОНКА (САЙДБАР) */
.magazine-sidebar {
    width: 320px;
    background: #1a1a1a;
    border-right: 2px solid var(--mag-red);
    display: flex;
    flex-direction: column;
    padding: 25px;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
}

.sidebar-header { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; }
.sidebar-section { margin-bottom: 35px; }
.section-label { 
    font-family: var(--f-mono); 
    font-size: 10px; 
    color: #666; 
    margin-bottom: 15px; 
    letter-spacing: 2px; 
}

/* ИНСТРУМЕНТЫ ФОРМАТИРОВАНИЯ */
.format-select {
    width: 100%; background: #000; color: #fff; border: 1px solid #444;
    padding: 8px; font-family: var(--f-mono); font-size: 11px; margin-bottom: 10px;
    outline: none;
}
.format-btn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 5px; }
.format-tool {
    background: #333; border: 1px solid #444; color: #eee; padding: 10px;
    cursor: pointer; transition: 0.2s;
}
.format-tool:hover { background: var(--mag-red); color: #fff; }

/* СПИСОК КНОПОК БЛОКОВ */
.add-block-vertical-list { display: flex; flex-direction: column; gap: 8px; }
.tool-btn-v {
    background: #252525; border: 1px solid #333; color: #ccc;
    padding: 12px; text-align: left; cursor: pointer;
    font-family: var(--f-mono); font-size: 10px; font-weight: bold;
    display: flex; align-items: center; gap: 10px; transition: 0.2s;
}
.tool-btn-v:hover { background: #333; border-color: var(--mag-red); color: #fff; padding-left: 20px; }
.v-icon { color: var(--mag-red); font-size: 14px; width: 20px; text-align: center; }

/* НИЗ САЙДБАРА */
.sidebar-footer { margin-top: auto; padding-top: 20px; display: grid; gap: 10px; }

/* ОБЛАСТЬ ПРОСМОТРА (ПРАВАЯ ЧАСТЬ) */
.magazine-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 60px 40px;
    background-color: #d2cfc4; /* Цвет стола под бумагой */
    display: flex;
    flex-direction: column;
}

.magazine-top-info-fixed {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--mag-black);
    padding-bottom: 8px;
    opacity: 0.6;
}

.magazine-canvas {
    margin: 0 auto 100px !important; /* Центрируем лист */
}

/* Общий контейнер редактора (с сайдбаром) */
.magazine-editor-layout {
    display: flex;
    height: 100vh;
    background-color: #2b2b2b; /* Темный стол только для админа */
}

/* Публичный корень (без сайдбара) */
.magazine-layout-root {
    background-color: #d2cfc4; /* Светлый стол для читателя */
    min-height: 100vh;
}

/* Лист журнала - ФИНАЛЬНЫЕ НАСТРОЙКИ */
.magazine-canvas {
    background-color: #f4f0e6; /* Цвет бумаги */
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    width: 95%;
    max-width: 1000px; /* Оптимально для чтения */
    margin: 0 auto;
    padding: 80px 100px; /* Большие "журнальные" поля */
    box-shadow: 0 0 50px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

/* Фикс шрифтов для всей страницы */
.font-body {
    font-family: 'Literaturnaya', serif;
    text-align: justify;
    hyphens: auto;
}

/* Тип: СОВЕТСКИЙ ПЛАКАТ (Bold Blocky) */
.soviet-poster-head {
    font-family: 'Bannikova', serif; /* Здесь лучше всего подошел бы Lozung Caps */
    font-size: 4.5rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--mag-red);
    text-shadow: 4px 4px 0px #000;
    line-height: 0.8;
    letter-spacing: -2px;
    margin: 40px 0;
    text-align: center;
    position: relative;
}

.soviet-poster-head::after {
    content: attr(data-text);
    position: absolute;
    left: -2px;
    top: -2px;
    color: #fff;
    z-index: -1;
    -webkit-text-stroke: 1px var(--mag-red);
}

/* Тип: ЭКСПРЕССИВНЫЙ ЛЕТТЕРИНГ (Script + Sans) */
.soviet-lettering-box {
    margin: 50px 0;
    position: relative;
    padding: 20px 0;
}

.lettering-script {
    font-family: 'Literaturnaya', serif; /* Здесь идеально Christopher или Jikharev */
    font-style: italic;
    font-size: 3.5rem;
    color: #1a1a1a;
    line-height: 1;
    transform: rotate(-5deg);
    display: block;
    margin-bottom: -15px;
    z-index: 2;
    position: relative;
}

.lettering-sub {
    font-family: 'NewJournalC', sans-serif; /* Gazeta Sans или Sclate */
    font-size: 2.2rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--mag-red);
    padding-left: 40px;
    letter-spacing: 2px;
    z-index: 1;
}

/* Эффект подчеркивания как на фото "Комплексный обед" */
.lettering-underline {
    height: 3px;
    background: var(--mag-red);
    width: 150px;
    margin-top: 5px;
}

/* Блок: Агитплакат (на базе Lozung Caps) */
.soviet-poster-container {
    padding: 60px 0;
    text-align: center;
}

.poster-title {
    font-family: 'LozungCapsBlack', sans-serif;
    font-size: 6rem;
    color: var(--mag-red);
    line-height: 0.8;
    text-transform: uppercase;
    letter-spacing: -2px;
    text-shadow: 4px 4px 0px var(--mag-black);
    position: relative;
    display: inline-block;
    outline: none;
}

/* Блок: Леттеринг Маяк ( Christopher + Gazeta Sans ) */
.lettering-style-box {
    margin: 50px 0;
    position: relative;
    min-height: 120px;
}

.script-part {
    font-family: 'Christopher', cursive;
    font-size: 4.5rem;
    color: var(--mag-black);
    position: relative;
    z-index: 2;
    transform: rotate(-4deg);
    display: block;
    line-height: 1;
}

.sans-part {
    font-family: 'GazetaSans', sans-serif;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--mag-red);
    text-transform: uppercase;
    position: relative;
    top: -25px;
    left: 60px;
    z-index: 1;
    letter-spacing: 2px;
}

.lettering-bar {
    height: 4px;
    background: var(--mag-black);
    width: 200px;
    margin-top: -15px;
}

/* ================================================================
   ФИНАЛЬНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ (МАКС. 1024px)
   ================================================================ */
@media (max-width: 1024px) {
    /* Перестраиваем макет в вертикальный стек */
    .magazine-editor-layout, 
    .magazine-layout-root {
        flex-direction: column !important;
        height: auto !important;
        overflow-y: visible !important;
    }

    /* ПАНЕЛЬ РЕДАКТОРА: Превращаем в компактный горизонтальный блок сверху */
    .magazine-sidebar {
        width: 100% !important;
        height: auto !important;
        max-height: 350px;
        border-right: none !important;
        border-bottom: 3px solid var(--mag-red) !important;
        position: sticky;
        top: 0;
        padding: 15px !important;
        box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    }

    /* Уплотняем элементы в сайдбаре для экономии места */
    .sidebar-section { margin-bottom: 15px !important; }
    .add-block-vertical-list {
        flex-direction: row !important;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
    }
    .tool-btn-v {
        min-width: 140px;
        padding: 8px !important;
        flex-shrink: 0;
    }

    /* ОБЛАСТЬ ПРОСМОТРА (ЛИСТ) */
    .magazine-viewport {
        padding: 15px 5px !important;
        background-color: #d2cfc4;
    }

    .magazine-canvas {
        width: 98% !important;
        max-width: 100% !important;
        padding: 30px 15px !important; /* Уменьшаем поля бумаги */
        margin: 10px auto 50px !important;
        box-shadow: 0 0 15px rgba(0,0,0,0.1) !important;
        height: auto !important;
    }

    /* ТИПОГРАФИКА: МАСШТАБИРОВАНИЕ */
    .font-title {
        font-size: 2.2rem !important;
        line-height: 1.1;
    }

    .poster-title {
        font-size: 2.8rem !important;
    }

    .font-body {
        font-size: 1rem !important;
        text-align: left !important;
        hyphens: auto;
    }

    .drop-cap::first-letter {
        font-size: 3.5rem !important;
    }

    /* СЕТКИ: ПЕРЕВОД В ОДНУ КОЛОНКУ */
    .dual-columns-layout, 
    .magazine-columns-3, 
    .composite-gallery,
    .composite-gallery .top-row,
    .composite-gallery .bottom-row {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .col-text {
        border-right: none !important;
        border-bottom: 1px solid #ccc;
        padding: 0 0 15px 0 !important;
    }
    .col-text:last-child { border-bottom: none !important; }

    /* ФОТО И МЕМОРЫ */
    .memorial-sidebar-block {
        flex-direction: column !important;
        text-align: center;
    }
    .memorial-photo {
        width: 100% !important;
        height: 250px !important;
    }

    .photo-container {
        padding: 8px !important;
    }

    /* ЛЕТТЕРИНГ */
    .script-part { font-size: 2.5rem !important; }
    .sans-part { 
        font-size: 1.5rem !important; 
        left: 0 !important; 
        top: 0 !important; 
        display: block; 
        margin-top: 5px;
    }

    /* КНОПКИ УПРАВЛЕНИЯ БЛОКОМ (Смещаем, чтобы не мешали) */
    .block-controls-mini {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        flex-direction: row !important;
        margin-bottom: 10px;
        justify-content: flex-end;
    }

    /* ТЕХНИЧЕСКИЕ ПАНЕЛИ */
    .magazine-top-info-fixed, 
    .magazine-top-info {
        flex-direction: column;
        font-size: 8px;
        text-align: center;
        gap: 5px;
    }
}

/* ФИКС ДЛЯ СОВСЕМ МАЛЕНЬКИХ ЭКРАНОВ */
@media (max-width: 480px) {
    .magazine-canvas { padding: 20px 10px !important; }
    .font-title { font-size: 1.8rem !important; }
    .poster-title { font-size: 2.2rem !important; }
}