/**
 * Activity-specific styles for print bundles.
 * Used when rendering multi-page bundles (e.g. print-bundle.php).
 * Keeps bundle output consistent with individual activity print styles.
 */

/* ----- Bundle-only: page number (replaces footer), repeat label ----- */
.sheet-page-number {
    position: absolute;
    bottom: 5mm;
    right: 10mm;
    font-size: 0.75rem;
    color: #666;
    font-family: Arial, sans-serif;
}
/* ----- Trace Alphabets (language) — 6 columns × 5 rows = 30 per page ----- */
.worksheet-container {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
}

/* Bundle print: exactly 5 rows so one page = 30 cards, no overflow/truncation */
.worksheet-container-6x5 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.letter-card {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    aspect-ratio: auto;
    border: 1px dashed #ccc;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    position: relative;
    page-break-inside: avoid;
    overflow: hidden;
    box-sizing: border-box;
}

.worksheet-container .letter-card svg {
    width: 36px;
    height: 36px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    flex-shrink: 0;
}

.worksheet-container .path-bg {
    fill: none;
    stroke: #f0f0f0;
    stroke-width: 20;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.worksheet-container .path-trace {
    fill: none;
    stroke: #333;
    stroke-width: 1.2;
    stroke-dasharray: 4, 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.worksheet-container.hide-numbers .step-num,
.worksheet-container.hide-numbers .start-dot {
    display: none !important;
}

.worksheet-container .start-dot {
    fill: #6c5ce7;
}

.worksheet-container .step-num {
    fill: white;
    font-size: 7px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
}

/* Noto picture cue (A-only pilot) — scoped; does not target .letter-card svg */
.a4-sheet.theme-lang > .trace-picture-cue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 10px 4px;
    padding: 2px 6px;
    flex: 0 0 auto;
}
.a4-sheet.theme-lang > .trace-picture-cue img {
    width: 18mm;
    height: 18mm;
    max-width: 18mm;
    max-height: 18mm;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}
.a4-sheet.theme-lang > .trace-picture-cue .trace-picture-cue-label {
    font-family: var(--font-fun, 'Comic Neue', cursive);
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3436;
    line-height: 1.2;
    white-space: nowrap;
}

@media print {
    .a4-sheet.theme-lang > .trace-picture-cue {
        margin: 0 8px 2px;
        gap: 6px;
    }
    .a4-sheet.theme-lang > .trace-picture-cue img {
        width: 16mm;
        height: 16mm;
        max-width: 16mm;
        max-height: 16mm;
    }
    .a4-sheet.theme-lang > .trace-picture-cue .trace-picture-cue-label {
        font-size: 0.95rem;
    }
    /* @page and layout come from style.css for consistency */
    .worksheet-container,
    .worksheet-container-6x5 {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-rows: repeat(5, minmax(0, 1fr));
        gap: 3px;
        padding: 3px;
    }
    .letter-card {
        min-height: 0;
        overflow: hidden;
        min-width: 0;
        height: 100%;
        aspect-ratio: auto;
    }
    /* Match screen size: same card/SVG size as HTML so print and screen look the same */
    .worksheet-container .letter-card svg {
        width: 36px;
        height: 36px;
        max-width: 90%;
        max-height: 90%;
        overflow: hidden;
    }
    /* One sheet per printed page; no extra blank after last — page breaks owned by Print Core / style.css Ctrl+P */
    .a4-sheet.bundle-trace-sheet {
        overflow: hidden;
    }
}

/* ----- Numbers 1-15 (math-logic) ----- */
.number-row {
    border: 3px dashed #e0e0e0;
    border-radius: 20px;
    margin-bottom: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    page-break-inside: avoid;
}

.a4-sheet .sheet-content .number-row {
    margin-bottom: 6px;
    padding: 8px;
}

.number-display {
    font-size: 110px;
    font-weight: 900;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    -webkit-text-stroke: 3px black;
    width: 140px;
    text-align: center;
    line-height: 1;
    filter: drop-shadow(2px 2px 0px #000);
}

.a4-sheet .sheet-content .number-display {
    font-size: 72px;
    width: 100px;
    -webkit-text-stroke: 2px black;
}

.a4-sheet .sheet-content .activity-icon {
    font-size: 26px;
    flex-shrink: 0;
}

/* ----- Word Search (language) — table = reliable borders, larger grid + clear font ----- */
.a4-sheet.bundle-wordsearch-sheet.wordsearch-age-4 .ws-table { --cell-size: 46px; }
.a4-sheet.bundle-wordsearch-sheet.wordsearch-age-5 .ws-table { --cell-size: 42px; }
.a4-sheet.bundle-wordsearch-sheet.wordsearch-age-6 .ws-table { --cell-size: 38px; }
.a4-sheet.bundle-wordsearch-sheet.wordsearch-age-7 .ws-table { --cell-size: 38px; }
.a4-sheet.bundle-wordsearch-sheet .ws-table {
    border-collapse: collapse;
    border: 1px solid #000;
    margin: 0 auto;
    background: #fff;
    table-layout: fixed;
}
.a4-sheet.bundle-wordsearch-sheet .ws-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    min-height: var(--cell-size);
    max-height: var(--cell-size);
    box-sizing: border-box;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #000;
    font-family: Arial, 'Helvetica Neue', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    text-transform: uppercase;
}
.a4-sheet.bundle-wordsearch-sheet .words-display {
    margin: 12px 0;
    padding: 12px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #f9f9f9;
    width: 100%;
    max-width: 560px;
}
.a4-sheet.bundle-wordsearch-sheet .words-display h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: bold;
    text-align: center;
}
.a4-sheet.bundle-wordsearch-sheet .words-display-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.a4-sheet.bundle-wordsearch-sheet .words-display-item {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 10px;
    border: 1px solid #333;
    border-radius: 4px;
    background: white;
}

@media print {
    .a4-sheet.bundle-wordsearch-sheet .ws-table {
        border: 1.5px solid #333;
    }
    .a4-sheet.bundle-wordsearch-sheet .ws-cell {
        border: 1.5px solid #333;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .a4-sheet.bundle-wordsearch-sheet.wordsearch-age-4 .ws-cell { font-size: 19px; }
    .a4-sheet.bundle-wordsearch-sheet.wordsearch-age-5 .ws-cell { font-size: 18px; }
    .a4-sheet.bundle-wordsearch-sheet.wordsearch-age-6 .ws-cell { font-size: 16px; }
    .a4-sheet.bundle-wordsearch-sheet.wordsearch-age-7 .ws-cell { font-size: 15px; }
    .a4-sheet.bundle-wordsearch-sheet .words-display {
        page-break-inside: avoid;
        border: 2px solid #000;
    }
}

.icon-container {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding-left: 40px;
    justify-content: flex-start;
}

.a4-sheet .sheet-content .icon-container {
    gap: 4px;
    padding-left: 20px;
    flex-wrap: nowrap;
}

.activity-icon {
    font-size: 45px;
    color: white;
    -webkit-text-stroke: 2px black;
}

/* ----- Number Writing Grid (numbers-write-2) ----- */
.a4-sheet.bundle-number-writing-sheet .worksheet-grid-host {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.a4-sheet.bundle-number-writing-sheet .worksheet-grid {
    display: grid;
    gap: 5px;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.a4-sheet.bundle-number-writing-sheet .practice-cell {
    border: 2px solid #93c5fd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    min-height: 0;
}

.a4-sheet.bundle-number-writing-sheet .trace-area {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    border-bottom: 2px dashed #93c5fd;
    background-color: #f8fafc;
    line-height: 1;
    min-height: 0;
}

.a4-sheet.bundle-number-writing-sheet .write-area {
    flex: 1;
    background-color: white;
    min-height: 0;
}

.a4-sheet.bundle-number-writing-sheet .blank-cell {
    border: 2px solid #93c5fd;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    min-height: 0;
}

.a4-sheet.bundle-number-writing-sheet .handwriting-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(to bottom,
        transparent 32%,
        #e2e8f0 32%, #e2e8f0 33%,
        transparent 33%, transparent 66%,
        #e2e8f0 66%, #e2e8f0 67%,
        transparent 67%
    );
    z-index: 1;
}

.a4-sheet.bundle-number-writing-sheet .hint-number {
    position: absolute;
    top: 4px;
    left: 6px;
    color: #9ca3af;
    font-family: sans-serif;
    z-index: 2;
    line-height: 1;
}

.a4-sheet.bundle-number-writing-sheet .layout-30 .trace-area { font-size: 3.5rem; }
.a4-sheet.bundle-number-writing-sheet .layout-30 .hint-number { font-size: 1.2rem; }
.a4-sheet.bundle-number-writing-sheet .layout-50 .trace-area { font-size: 2.5rem; }
.a4-sheet.bundle-number-writing-sheet .layout-50 .hint-number { font-size: 0.9rem; }
.a4-sheet.bundle-number-writing-sheet .layout-100 .trace-area { font-size: 1.5rem; }
.a4-sheet.bundle-number-writing-sheet .layout-100 .hint-number { font-size: 0.7rem; }

@media print {
    .a4-sheet.bundle-number-writing-sheet {
        overflow: hidden;
    }
    .a4-sheet.bundle-number-writing-sheet .worksheet-grid { gap: 4px; }
    .a4-sheet.bundle-number-writing-sheet .layout-30 .trace-area { font-size: 3.25rem; }
    .a4-sheet.bundle-number-writing-sheet .layout-50 .trace-area { font-size: 2.35rem; }
    .a4-sheet.bundle-number-writing-sheet .layout-100 .trace-area { font-size: 1.4rem; }
}
