/* ================================================================
   StoryNest — Handwriting Practice Book Styles
   Companion to handwriting.js
   Fonts: KG Primary Dots loaded dynamically via JS
================================================================ */

/* ── Hero ─────────────────────────────────────────────────────── */
.scai-hw-hero {
    background: linear-gradient(135deg, #b5471f 0%, #c1622f 50%, #d9834f 100%);
    border-radius: 0;
    padding: 52px 48px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.scai-hw-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 250px; height: 250px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.scai-hw-hero::after {
    content: '';
    position: absolute;
    bottom: -50px; left: -30px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.scai-hw-hero-inner { position: relative; z-index: 2; max-width: 720px; }
.scai-hw-hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}
.scai-hw-hero h2 {
    font-size: clamp(26px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin: 0 0 14px;
}
.scai-hw-hero p {
    font-size: 17px;
    opacity: 0.9;
    margin: 0 0 24px;
    max-width: 480px;
    line-height: 1.6;
}
.scai-hw-features {
    display: flex; flex-wrap: wrap; gap: 10px;
}
.scai-hw-features span {
    background: rgba(255,255,255,0.18);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 13px; font-weight: 500;
    backdrop-filter: blur(4px);
}

/* ── Generator Container ──────────────────────────────────────── */
.scai-hw-generator {
    padding: 40px 48px 56px;
    max-width: 860px;
    margin: 0 auto;
}
@media (max-width: 640px) {
    .scai-hw-generator { padding: 24px 20px 40px; }
    .scai-hw-hero { padding: 36px 24px; }
}

/* ── Section Labels ───────────────────────────────────────────── */
.scai-hw-section {
    margin-bottom: 32px;
}
.scai-hw-section-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #b5471f;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.scai-hw-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #f0ddc9, transparent);
}

/* ── Type Selector Cards ──────────────────────────────────────── */
.scai-hw-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 600px) {
    .scai-hw-type-grid { grid-template-columns: repeat(2, 1fr); }
}
.scai-hw-type-card {
    border: 2px solid #e3dccf;
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: all .22s ease;
    background: #faf7f2;
    position: relative;
    overflow: hidden;
}
.scai-hw-type-card:hover {
    border-color: #c1622f;
    background: #f7ede3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(181,71,31,0.12);
}
.scai-hw-type-card.active {
    border-color: #b5471f;
    background: linear-gradient(135deg, #f7ede3, #e9e2d3);
    box-shadow: 0 4px 16px rgba(181,71,31,0.18);
}
.scai-hw-type-card.active::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 10px;
    font-size: 14px;
    color: #b5471f;
    font-weight: 700;
}
.scai-hw-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    line-height: 1;
}
.scai-hw-type-name {
    font-size: 14px;
    font-weight: 700;
    color: #1c1712;
    margin-bottom: 4px;
}
.scai-hw-type-desc {
    font-size: 11px;
    color: #6b5f52;
    line-height: 1.4;
}

/* ── Age Group Selector ───────────────────────────────────────── */
.scai-hw-age-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 600px) {
    .scai-hw-age-grid { grid-template-columns: repeat(2, 1fr); }
}
.scai-hw-age-card {
    border: 2px solid #e3dccf;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #faf7f2;
}
.scai-hw-age-card:hover {
    border-color: #c1622f;
    background: #f7ede3;
}
.scai-hw-age-card.active {
    border-color: #b5471f;
    background: linear-gradient(135deg, #f7ede3, #e9e2d3);
}
.scai-hw-age-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.scai-hw-age-range {
    font-size: 13px;
    font-weight: 700;
    color: #1c1712;
    margin-bottom: 2px;
}
.scai-hw-age-hint {
    font-size: 10px;
    color: #6b5f52;
    line-height: 1.4;
}

/* ── Dropdown Row ─────────────────────────────────────────────── */
.scai-hw-dropdowns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
@media (max-width: 520px) { .scai-hw-dropdowns { grid-template-columns: 1fr; } }

.scai-hw-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.scai-hw-field label {
    font-size: 13px;
    font-weight: 600;
    color: #2b241c;
}
.scai-hw-field select,
.scai-hw-field input[type="text"],
.scai-hw-field textarea {
    border: 2px solid #e3dccf;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    color: #1c1712;
    background: #fff;
    transition: border-color .2s;
    outline: none;
    width: 100%;
}
.scai-hw-field select:focus,
.scai-hw-field input:focus,
.scai-hw-field textarea:focus {
    border-color: #b5471f;
    box-shadow: 0 0 0 3px rgba(181,71,31,0.12);
}
.scai-hw-field-hint {
    font-size: 11px;
    color: #a89f8e;
    line-height: 1.4;
}

/* ── Prompt Box ───────────────────────────────────────────────── */
.scai-hw-prompt-wrap {
    margin-bottom: 28px;
}
.scai-hw-prompt-wrap label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2b241c;
    margin-bottom: 8px;
}
.scai-hw-prompt-wrap textarea {
    width: 100%;
    border: 2px solid #e3dccf;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    color: #1c1712;
    resize: vertical;
    min-height: 90px;
    transition: border-color .2s;
    outline: none;
    line-height: 1.6;
}
.scai-hw-prompt-wrap textarea:focus {
    border-color: #b5471f;
    box-shadow: 0 0 0 3px rgba(181,71,31,0.12);
}
.scai-hw-prompt-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.scai-hw-prompt-example {
    background: #f7ede3;
    border: 1px solid #e3c9a8;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    color: #b5471f;
    cursor: pointer;
    transition: all .18s;
    font-weight: 500;
}
.scai-hw-prompt-example:hover {
    background: #e9e2d3;
    border-color: #b5471f;
}

/* ── Pages Row ────────────────────────────────────────────────── */
.scai-hw-pages-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f0e8;
    border: 2px solid #e3dccf;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.scai-hw-pages-row label {
    font-size: 15px;
    font-weight: 600;
    color: #2b241c;
}
.scai-hw-page-counter {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #b5471f;
    border-radius: 10px;
    overflow: hidden;
}
.scai-hw-page-counter button {
    width: 40px; height: 40px;
    border: none;
    background: #f7ede3;
    color: #b5471f;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
    line-height: 1;
}
.scai-hw-page-counter button:hover { background: #e9e2d3; }
.scai-hw-page-counter input {
    width: 52px;
    text-align: center;
    border: none;
    border-left: 2px solid #b5471f;
    border-right: 2px solid #b5471f;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    color: #1c1712;
    padding: 0;
    height: 40px;
}

/* ── Price Display ────────────────────────────────────────────── */
.scai-hw-price-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #b5471f, #c1622f);
    color: #fff;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* ── Generate Button ──────────────────────────────────────────── */
.scai-hw-generate-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #b5471f, #c1622f);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all .24s;
    letter-spacing: 0.3px;
    box-shadow: 0 6px 24px rgba(181,71,31,0.30);
    margin-bottom: 10px;
}
.scai-hw-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(181,71,31,0.40);
}
.scai-hw-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.scai-hw-generate-note {
    text-align: center;
    font-size: 12px;
    color: #a89f8e;
    margin: 0 0 28px;
}

/* ── Status Bar ───────────────────────────────────────────────── */
.scai-hw-status {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}
.scai-hw-status.visible { display: flex; }
.scai-hw-status.info    { background: #f7ede3; color: #b5471f; border: 1.5px solid #e3c9a8; }
.scai-hw-status.error   { background: #f6ede9; color: #a4392f; border: 1.5px solid #e3c3ba; }
.scai-hw-status.success { background: #f7ede3; color: #8a3417; border: 1.5px solid #d29a5c; }

/* ── Progress Bar ─────────────────────────────────────────────── */
.scai-hw-progress-wrap {
    margin-bottom: 20px;
    display: none;
}
.scai-hw-progress-wrap.visible { display: block; }
.scai-hw-progress-label {
    font-size: 13px;
    color: #6b5f52;
    margin-bottom: 8px;
    font-weight: 500;
}
.scai-hw-progress-bar {
    height: 8px;
    background: #e3dccf;
    border-radius: 50px;
    overflow: hidden;
}
.scai-hw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #b5471f, #d9834f);
    border-radius: 50px;
    transition: width .4s ease;
}

/* ── Preview Section ──────────────────────────────────────────── */
.scai-hw-preview-section {
    margin-top: 36px;
    display: none;
}
.scai-hw-preview-section.visible { display: block; }
.scai-hw-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.scai-hw-preview-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1c1712;
    margin: 0;
}
.scai-hw-preview-header small {
    font-size: 11px;
    color: #a89f8e;
    flex-basis: 100%;
}
@media (min-width: 560px) {
    .scai-hw-preview-header small { flex-basis: auto; }
}
.scai-hw-preview-grid {
    display: grid;
    grid-template-columns: 1fr;          /* mobile: 1 column — full width, no clipping */
    gap: 20px;
    margin-bottom: 32px;
}
@media (min-width: 560px) {
    .scai-hw-preview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
    .scai-hw-preview-grid { grid-template-columns: repeat(3, 1fr); }
}
.scai-hw-preview-card {
    border: 2px solid #e3dccf;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(181,71,31,0.10);
    position: relative;
    transition: box-shadow .2s, transform .2s;
}
.scai-hw-preview-card:hover {
    box-shadow: 0 8px 32px rgba(181,71,31,0.18);
    transform: translateY(-2px);
}
/* Canvas generated by html2canvas — always fills card width */
.scai-hw-preview-card canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
}
.scai-hw-preview-card .hw-page-thumb {
    width: 100%;
    display: block;
    aspect-ratio: 794/1123;
    object-fit: cover;
}
/* Loading spinner inside card */
.hw-card-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    background: #f7ede3;
    min-height: 200px;
    color: #b5471f;
    font-size: 13px;
    font-weight: 600;
}
.hw-card-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e3c9a8;
    border-top-color: #b5471f;
    border-radius: 50%;
    animation: hw-spin .8s linear infinite;
}
@keyframes hw-spin { to { transform: rotate(360deg); } }
/* Fallback text card */
.hw-card-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    font-size: 20px;
    font-weight: 700;
    color: #b5471f;
    background: #f7ede3;
    min-height: 200px;
}
.scai-hw-preview-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) rotate(-30deg);
    font-size: 18px;
    font-weight: 800;
    color: rgba(181,71,31,0.18);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.scai-hw-preview-num {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
}

/* ── Inline page renderer (off-screen) ───────────────────────── */
.scai-hw-render-offscreen {
    position: fixed;          /* fixed so it doesn't affect layout flow */
    left: -2000px;            /* far off-screen, still in render tree */
    top: 0;
    width: 794px;
    height: 1123px;
    pointer-events: none;
    z-index: -999;
    overflow: hidden;
    background: #fff;
}

/* ── Rendered page canvas thumbnail ──────────────────────────── */
.scai-hw-preview-card canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Download Section ─────────────────────────────────────────── */
.scai-hw-download-section {
    background: linear-gradient(135deg, #f7ede3, #e9e2d3);
    border: 2px solid #e3c9a8;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    display: none;
}
.scai-hw-download-section.visible { display: block; }
.scai-hw-download-section h4 {
    font-size: 20px;
    font-weight: 700;
    color: #1c1712;
    margin: 0 0 8px;
}
.scai-hw-download-section p {
    color: #4a4033;
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.6;
}
.scai-hw-price-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid #b5471f;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 18px;
    font-weight: 800;
    color: #b5471f;
    margin-bottom: 20px;
}
.scai-hw-email-row {
    display: flex;
    gap: 10px;
    max-width: 480px;
    margin: 0 auto 12px;
    flex-wrap: wrap;
}
.scai-hw-email-row input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e3c9a8;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.scai-hw-email-row input:focus { border-color: #b5471f; }
.scai-hw-pay-btn {
    padding: 13px 22px;
    background: linear-gradient(135deg, #b5471f, #c1622f);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.scai-hw-pay-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(181,71,31,0.35); }

/* ── Success Box ──────────────────────────────────────────────── */
.scai-hw-success-box {
    background: linear-gradient(135deg, #b5471f, #c1622f);
    color: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    display: none;
    margin-top: 24px;
}
.scai-hw-success-box.visible { display: block; }
.scai-hw-success-box h4 {
    font-size: 24px;
    font-weight: 800;
    margin: 16px 0 8px;
}
.scai-hw-success-box p { opacity: 0.9; margin: 0 0 24px; font-size: 15px; }
.scai-hw-final-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #b5471f;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.scai-hw-final-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.2); }

/* ═══════════════════════════════════════════════════════════════
   PRACTICE PAGE LAYOUT (rendered in DOM for html2canvas capture)
═══════════════════════════════════════════════════════════════ */
.hw-pdf-page {
    width: 794px;
    height: 1123px;
    background: #fff;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    padding: 36px 44px 28px;
    font-family: 'KG Primary Dots', 'Schoolbell', 'Caveat', cursive;
    display: flex;
    flex-direction: column;
    align-items: center;      /* horizontally centre all children */
}

/* Header bar */
.hw-pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #b5471f;
    padding-bottom: 10px;
    margin-bottom: 18px;
    width: 100%;           /* spans full page inner width */
    flex-shrink: 0;
}
.hw-pdf-header-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #b5471f;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hw-pdf-header-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    color: #a89f8e;
}

/* Example / model area */
.hw-pdf-example-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #f7ede3, #e9e2d3);
    border: 2px solid #e3c9a8;
    border-radius: 16px;
    padding: 14px 20px;
    margin-bottom: 14px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;       /* prevent giant letters from poking outside */
    flex-shrink: 0;
}
.hw-pdf-example-char {
    line-height: 1;
    color: #b5471f;
    font-weight: 700;
    display: block;
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
}
.hw-pdf-example-char.hw-lc { color: #c1622f; }

/* Instruction text */
.hw-pdf-instruction {
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    color: #6b5f52;
    margin: 0 0 14px;
    font-style: italic;
    width: 100%;
    flex-shrink: 0;
}

/* Practice grid container */
.hw-pdf-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: 1;
}

/* Each practice row (with guide lines) */
.hw-pdf-row {
    position: relative;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    border-bottom: 2.5px solid #b5471f;
    padding: 4px 0;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;          /* allow wrapped sentences to expand the row */
}
.hw-pdf-row::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    border-top: 1px dashed #f0ddc9;
}
.hw-pdf-row::after {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    border-top: 1px dashed #f4ebe0;
}

/* Individual trace character */
.hw-pdf-trace-char {
    color: rgba(181,71,31,0.18);
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
    line-height: 1;
    display: inline-block;
    user-select: none;
}

/* ── OTHERS page layout ───────────────────────────────────────── */
.hw-pdf-others-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.hw-pdf-item-img {
    width: 560px;
    height: 560px;
    object-fit: contain;
    margin: 16px auto 24px;
    display: block;
    border-radius: 12px;
    background: #f5f0e8;
}
.hw-pdf-item-img-placeholder {
    width: 560px;
    height: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px;
    background: #f7ede3;
    border-radius: 12px;
    margin: 16px auto 24px;
}
.hw-pdf-item-name {
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
    font-size: 90px;
    color: rgba(181,71,31,0.20);
    text-align: center;
    line-height: 1;
    margin-bottom: 8px;
}
.hw-pdf-item-name-solid {
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
    font-size: 54px;
    color: #b5471f;
    text-align: center;
    line-height: 1;
    margin-bottom: 18px;
}
.hw-pdf-item-trace-lines {
    width: 100%;
    border-bottom: 2.5px solid #b5471f;
    margin-top: 4px;
    position: relative;
}
.hw-pdf-item-trace-lines::before {
    content: '';
    position: absolute;
    top: -28px; left: 0; right: 0;
    border-top: 1px dashed #e3c9a8;
}

/* ── SENTENCE page layout ─────────────────────────────────────── */
/* ── School-ruled practice row — Zaner-Bloser 4-line style ──────────── */
/* Lines: sky-line (top) · mid-line (dashed, via JS ::before) · baseline (bottom) */
.hw-pdf-ruled-row {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border-bottom: 2.5px solid #b5471f;   /* baseline — bold green rule */
    border-top: 1.5px solid #d9834f;      /* sky-line — lighter green */
    background: #fff;
}

/* ── Sentence example area ────────────────────────────────────────────── */
.hw-pdf-sentence-area {
    text-align: center;
    margin-bottom: 16px;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: visible;
}
.hw-pdf-sentence-example {
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
    font-size: 64px;
    color: #b5471f;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 8px;
}
.hw-pdf-sentence-trace {
    font-family: 'KG Primary Dots', 'Schoolbell', cursive;
    font-size: 52px;
    color: rgba(181,71,31,0.18);
    line-height: 1.5;
    display: block;
    text-align: center;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    box-sizing: border-box;
    padding: 0 8px;
}

/* Watermark overlay for preview */
.hw-watermark-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
}
.hw-watermark-text {
    font-family: -apple-system, sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: rgba(181,71,31,0.13);
    letter-spacing: 3px;
    text-transform: uppercase;
    transform: rotate(-35deg);
    white-space: nowrap;
}

/* ── Responsive Tabs: 3-tab layout overrides ─────────────────── */
@media (max-width: 480px) {
    .scai-hw-type-grid { grid-template-columns: repeat(2, 1fr); }
    .scai-hw-age-grid  { grid-template-columns: repeat(2, 1fr); }
}
