/* ── 4-per-page: no outer padding in preview too ── */
#puzzle-preview.ns-fullpage {
    padding: 0 !important;
}

/* ── Line style variants ── */
.ns-ls-solid  .ns-line { border-bottom: 1px solid #999; }
.ns-ls-dashed .ns-line { border-bottom: 1px dashed #999; }
.ns-ls-bold   .ns-line { border-bottom: 2px solid #555; }

/* ── Line height variants ── */
.ns-lh-narrow .ns-line        { height: 7mm; }
.ns-lh-normal  .ns-line        { height: 10mm; }
.ns-lh-wide    .ns-line        { height: 14mm; }

.ns-lh-narrow .ns-cell4 .ns-line { height: 6mm; }
.ns-lh-normal  .ns-cell4 .ns-line { height: 7.5mm; }
.ns-lh-wide    .ns-cell4 .ns-line { height: 10mm; }

/* ── Override puzzle-preview padding to 15mm for this page ── */
#puzzle-preview {
    padding: 15mm !important;
}

/* ── Override generator layout for option-group ── */
.options .option-group:first-child {
    display: block;
    border-bottom: none;
    padding-bottom: 0;
    text-align: center;
}

.options .option-group h2 {
    text-align: center;
    margin-bottom: 1rem;
}

.options .case-options {
    justify-content: center;
}

/* ── Note Sheet: header ── */
.ns-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3mm;
    gap: 8px;
}

.ns-logo-wrap img {
    height: 10mm;
    width: auto;
}

.ns-fields {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ns-field {
    font-size: 9pt;
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
}

.ns-line-short {
    display: inline-block;
    width: 28mm;
    border-bottom: 1px solid #333;
    height: 14px;
}

/* ── Writing lines ── */
.ns-lines {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.ns-line {
    border-bottom: 1px solid #999;
    height: 10mm;
    flex-shrink: 0;
}

/* ── 1-per-page: fill full content area ── */
.ns-one-wrap {
    display: flex;
    flex-direction: column;
    height: 262mm; /* 297mm - 15mm top - 15mm bottom - 5mm copyright */
    overflow: hidden;
}

.ns-one-wrap .ns-lines {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── 2-per-page ── */
.ns-two-wrap {
    display: flex;
    flex-direction: column;
    height: 267mm; /* 297mm - 15mm top - 15mm bottom */
}

.ns-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 3mm 0 0;
    overflow: hidden;
    min-height: 0;
}

/* ── Cut line (dashed only, fixed at center) ── */
.ns-cut {
    flex-shrink: 0;
    height: 0;
    border-top: 1.5px dashed #bbb;
    margin: 0;
}

/* equal margin around cut line (matches page margin) */
.ns-half:first-child {
    padding-bottom: 15mm;
}

.ns-half:last-child {
    padding-top: 15mm;
}

/* ── 4-per-page: cross dashed lines, no borders ── */
.ns-grid4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 297mm;
    position: relative;
}

/* Horizontal center line */
.ns-grid4::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1.5px dashed #bbb;
    pointer-events: none;
}

/* Vertical center line */
.ns-grid4::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    border-left: 1.5px dashed #bbb;
    pointer-events: none;
}

.ns-cell4 {
    padding: 4mm;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ns-cell4 .ns-lines {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.ns-cell4 .ns-line {
    height: 7.5mm;
}

.ns-cell4 .ns-logo-wrap img {
    height: 7mm;
}

.ns-cell4 .ns-field {
    font-size: 7.5pt;
}

.ns-cell4 .ns-line-short {
    width: 18mm;
}

/* ── Print ── */
@media print {
    /* all layouts: 15mm padding */
    #puzzle-preview {
        padding: 15mm !important;
    }

    /* 4-per-page: no padding */
    #puzzle-preview.ns-fullpage {
        padding: 0 !important;
    }

    #puzzle-preview.ns-fullpage .copyright-footer {
        display: none !important;
    }

    .ns-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 3mm !important;
    }

    .ns-logo-wrap img {
        height: 10mm !important;
        width: auto !important;
    }

    .ns-fields {
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
    }

    .ns-field {
        font-size: 9pt !important;
    }

    .ns-line-short {
        display: inline-block !important;
        width: 28mm !important;
        border-bottom: 1px solid #333 !important;
    }

    .ns-one-wrap {
        display: flex !important;
        flex-direction: column !important;
        height: 262mm !important;
        overflow: hidden !important;
    }

    .ns-one-wrap .ns-lines {
        flex: 1 !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }

    .ns-two-wrap {
        display: flex !important;
        flex-direction: column !important;
        height: 267mm !important;
    }

    .ns-half {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 3mm 0 0 !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }

    .ns-cut {
        flex-shrink: 0 !important;
        height: 0 !important;
        border-top: 1.5px dashed #bbb !important;
        margin: 0 !important;
    }

    .ns-half:first-child {
        padding-bottom: 15mm !important;
    }

    .ns-half:last-child {
        padding-top: 15mm !important;
    }

    .ns-lines {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }

    .ns-line {
        border-bottom: 1px solid #999 !important;
        height: 10mm !important;
        flex-shrink: 0 !important;
    }

    .ns-grid4 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        height: 297mm !important;
        position: relative !important;
    }

    .ns-grid4::before {
        content: '' !important;
        position: absolute !important;
        top: 50% !important;
        left: 0 !important;
        right: 0 !important;
        border-top: 1.5px dashed #bbb !important;
    }

    .ns-grid4::after {
        content: '' !important;
        position: absolute !important;
        left: 50% !important;
        top: 0 !important;
        bottom: 0 !important;
        border-left: 1.5px dashed #bbb !important;
    }

    .ns-cell4 {
        padding: 4mm !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }

    .ns-cell4 .ns-lines {
        flex: 1 !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }

    .ns-cell4 .ns-line {
        height: 7.5mm !important;
    }

    .ns-cell4 .ns-logo-wrap img {
        height: 7mm !important;
        width: auto !important;
    }

    /* Line style variants */
    .ns-ls-solid  .ns-line { border-bottom: 1px solid #999 !important; }
    .ns-ls-dashed .ns-line { border-bottom: 1px dashed #999 !important; }
    .ns-ls-bold   .ns-line { border-bottom: 2px solid #555 !important; }

    /* Line height variants */
    .ns-lh-narrow .ns-line        { height: 7mm !important; }
    .ns-lh-normal  .ns-line        { height: 10mm !important; }
    .ns-lh-wide    .ns-line        { height: 14mm !important; }

    .ns-lh-narrow .ns-cell4 .ns-line { height: 6mm !important; }
    .ns-lh-normal  .ns-cell4 .ns-line { height: 7.5mm !important; }
    .ns-lh-wide    .ns-cell4 .ns-line { height: 10mm !important; }
}
