/* =========================================
   СТИЛІ ДЛЯ ГЕНЕРАТОРА КАРТОК (FLASHCARDS)
   ========================================= */

.preview-section {
    width: 100%;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
    background-color: #f1f5f9;
}

#pages-container {
    display: flex;
    flex-direction: column;
    gap: 20mm; 
    align-items: center; 
    padding: 20px;
}

/* Жорсткий захист меж А4 */
.a4-page {
    width: 210mm;
    height: 297mm;
    max-height: 297mm;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden; 
    box-sizing: border-box;
}

/* ЗАФІКСОВАНО ВИСОТУ: 262mm - це ідеальний розмір, який залишає відступи 
   зверху (10mm) та знизу для водяного знака, гарантуючи ОДНУ сторінку */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr); 
    width: 100%;
    height: 262mm; 
}

/* Стиль однієї картки */
.flashcard {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed #94a3b8; 
    padding: 15px; 
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Текст на картці */
.flashcard-text {
    font-family: 'Comic Neue', cursive, sans-serif;
    font-size: 32pt; 
    font-weight: 700;
    color: #1e293b;
    word-wrap: normal;
    hyphens: auto; 
    line-height: 1.1;
    z-index: 2;
    max-width: 100%;
}

/* Чорно-білий режим */
.theme-outline .flashcard {
    background-color: #ffffff !important;
    border: 1px dashed #475569;
}
.theme-outline .flashcard-text {
    color: #000000 !important;
}

/* Адаптивність для планшетів */
@media (max-width: 1024px) {
    #pages-container {
        align-items: flex-start;
        padding: 15px;
    }
}

/* ПРАВИЛА ДЛЯ ДРУКУ (Повністю прибирають 2 сторінку) */
@media print {
    @page { 
        size: A4 portrait; 
        margin: 0 !important; 
    }
    html, body { 
        margin: 0 !important; 
        padding: 0 !important; 
        height: 297mm !important;
        max-height: 297mm !important;
        overflow: hidden !important; 
        background: #fff !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
    .app-header, .controls-section, .seo-text-block, .ad-placeholder, .back-link { 
        display: none !important; 
    }
    .main-layout, .preview-section, #pages-container { 
        display: block !important; 
        padding: 0 !important; 
        margin: 0 !important; 
        overflow: visible !important; 
        background: #fff !important; 
    }
    .a4-page {
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: avoid !important; 
        page-break-inside: avoid !important;
    }
}