/*
 * Spelling Practice & Flashcard Maker – V1.0 (Premium 2026)
 * Aligned with worksheet-base.css design system
 * Sheet dimensions & header follow handwriting.css conventions
 */

/* =========================================
   1. PRACTICE MODE — WRITING LINES
   ========================================= */
.spelling-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1 1 auto;
    gap: 4mm;
}

.word-group {
    display: flex;
    align-items: flex-start;
    gap: 3mm;
    page-break-inside: avoid;
}

.word-number {
    font-family: 'Nunito', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    min-width: 20px;
    text-align: right;
    line-height: 28px;
    flex-shrink: 0;
    padding-top: 1mm;
}

.word-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.writing-line {
    position: relative;
    height: 8mm;
    width: 100%;
    border-bottom: 1.5px solid #d1d5db;
    font-size: 22px;
    line-height: 8mm;
    color: #000;
    display: flex;
    align-items: flex-end;
    padding-bottom: 0.5mm;
}

.writing-line.model-line {
    color: #111827;
    font-weight: 600;
    border-bottom-color: #6b7280;
}

.writing-line.trace-line {
    color: #d1d5db;
    font-weight: 400;
    -webkit-text-stroke: 0.3px #d1d5db;
    text-stroke: 0.3px #d1d5db;
    letter-spacing: 0.5px;
}

/* =========================================
   2. FLASHCARD MODE
   ========================================= */
.flashcard-grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 0;
    box-sizing: border-box;
}

.flashcard-grid.cards-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.flashcard-grid.cards-6 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.flashcard-grid.cards-9 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.flashcard-grid.cards-12 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.flashcard {
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4mm;
    box-sizing: border-box;
    page-break-inside: avoid;
}

.flashcard-word {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin-bottom: 4mm;
    line-height: 1.2;
}

/* Adapt card font size for denser layouts */
.cards-9 .flashcard-word,
.cards-12 .flashcard-word {
    font-size: 22px;
}

.flashcard-write-area {
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 3mm;
}

.flashcard-line {
    width: 100%;
    height: 0;
    border-bottom: 1.5px solid #d1d5db;
}

/* =========================================
   3. TEST MODE
   ========================================= */
.test-grid {
    display: flex;
    gap: 10mm;
    flex: 1 1 auto;
    width: 100%;
}

.test-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.test-row {
    display: flex;
    align-items: flex-end;
    gap: 3mm;
    min-height: 14mm;
}

.test-number {
    font-family: 'Nunito', -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #374151;
    min-width: 22px;
    text-align: right;
    flex-shrink: 0;
}

.test-line {
    flex: 1;
    height: 0;
    border-bottom: 1.5px solid #000;
}

/* =========================================
   4. PRINT OVERRIDES
   ========================================= */
@media print {

    .spelling-grid,
    .flashcard-grid,
    .test-grid {
        color: #000 !important;
    }

    .flashcard {
        border-color: #aaa !important;
    }

    .writing-line.trace-line {
        color: #ccc !important;
        -webkit-text-stroke: 0.3px #ccc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .word-number,
    .test-number {
        color: #000 !important;
    }
}