/* ==========================================================
   字帖生成 · 样式（纸白字格，朱红描红，A4 打印适配）
   ========================================================== */
.tz-container { box-sizing: border-box; width: min(var(--brand-content-width), calc(100% - 32px)); margin: 0 auto; padding: 0 0 60px; }

.tz-panel {
    position: relative; padding: 22px 24px 20px; margin: 0 0 20px; border-radius: 12px;
    background: radial-gradient(ellipse 80% 100% at 12% 0%, rgba(184,58,43,.045), transparent 60%), linear-gradient(168deg,#fbf6ec,#f4e9d6);
    border: 1px solid rgba(139,105,20,.22); box-shadow: 0 8px 26px rgba(60,50,35,.06);
}
.tz-sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.tz-sectitle { font-family: var(--brand-title-font); font-size: 22px; font-weight: 400; letter-spacing: 4px; color: #5b4c37; position: relative; padding-left: 14px; margin: 0; }
.tz-sectitle::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 4px; height: 20px; border-radius: 2px; background: linear-gradient(180deg, #b83a2b, #8b6914); }
.tz-secsub { font-size: 13px; color: var(--text-muted); letter-spacing: 1px; }

.tz-field { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex: 1 1 190px; }
.tz-lab { font-size: 13.5px; color: var(--text-secondary); letter-spacing: 1px; flex: 0 0 auto; }
.tz-textarea {
    flex: 1; width: 100%; padding: 12px 16px; font-family: inherit; font-size: 16px; line-height: 1.9;
    color: var(--text-primary); background: #fffdf8; resize: vertical;
    border: 1.5px solid rgba(139,105,20,.25); border-radius: 10px; outline: none;
}
.tz-textarea:focus { border-color: var(--accent-gold); box-shadow: 0 0 0 3px rgba(139,105,20,.08); }
.tz-select {
    flex: 1; min-width: 96px; padding: 9px 12px; font-family: inherit; font-size: 14px; color: var(--text-primary);
    background: #fffdf8; border: 1.5px solid rgba(139,105,20,.25); border-radius: 9px; outline: none;
}
.tz-row { display: flex; align-items: center; gap: 16px; margin: 0 0 10px; flex-wrap: wrap; }
.tz-row-opts .tz-check { font-size: 13px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tz-row-opts input { accent-color: #b83a2b; }
.tz-btn {
    font-family: var(--brand-title-font); font-size: 16px; letter-spacing: 3px; cursor: pointer;
    padding: 11px 26px; border: none; border-radius: 10px; color: #fff;
    background: linear-gradient(135deg,#b83a2b,#922c21); box-shadow: 0 5px 16px rgba(184,58,43,.24);
    transition: transform .2s, box-shadow .2s;
}
.tz-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(184,58,43,.3); }
.tz-btn-ghost { color: #6b5a42; background: #fffdf8; border: 1.5px solid rgba(139,105,20,.3); box-shadow: none; }
.tz-btn-ghost:hover { box-shadow: 0 6px 16px rgba(139,105,20,.14); }
.tz-hint { font-size: 13px; color: var(--text-muted); }
.tz-note { font-size: 12.5px; line-height: 1.85; color: var(--text-muted); margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: rgba(139,105,20,.05); border: 1px dashed rgba(139,105,20,.24); }

/* ---------- 字帖纸张 ---------- */
.tz-sheetwrap { display: flex; justify-content: center; }
.tz-sheet {
    width: 100%; max-width: 760px; background: #fff; padding: 26px 30px 18px;
    border: 1px solid rgba(139,105,20,.28); border-radius: 8px;
    box-shadow: 0 10px 34px rgba(60,50,35,.12);
}
.tz-sheet-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid rgba(60,50,35,.18); }
.tz-sheet-title { font-family: var(--brand-title-font); font-size: 20px; letter-spacing: 6px; color: #3a3025; }
.tz-sheet-sub { font-size: 12px; color: #8b8267; letter-spacing: 1px; }
.tz-sheet-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 11px; color: #a39a80; letter-spacing: 1px; }

.tz-grid { display: grid; grid-template-columns: 1fr; }
.tz-grid .tz-row { display: flex; margin: 0; gap: 0; }
.tz-grid .tz-cell { flex: 1 1 0; min-width: 0; }
.tz-cell {
    position: relative; aspect-ratio: 1 / 1; box-sizing: border-box;
    border: 1px solid #c9b98f; display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.tz-cell.f-none { border-color: transparent; border-bottom: 1px solid #e0d5b8; }
.tz-cell .ch {
    font-family: 'KaiTi', 'STKaiti', 'Kaiti SC', '楷体', 'Noto Serif SC', serif;
    line-height: 1; color: #2f2a22; user-select: none;
}
.tz-cell.trace .ch { color: #cfc6ae; }
.tz-cell.blank .ch { color: transparent; }
.tz-cell .py {
    position: absolute; top: 2px; left: 0; right: 0; text-align: center;
    font-size: 9px; color: #b0a68b; letter-spacing: .3px; font-family: 'Noto Serif SC', serif;
}
/* 田字格：十字虚线 */
.tz-cell.f-tian::before, .tz-cell.f-tian::after { content: ''; position: absolute; background-image: linear-gradient(to right, #d9cba6 50%, transparent 50%); }
.tz-cell.f-tian::before { left: 0; right: 0; top: 50%; height: 1px; background-image: linear-gradient(to right, #d9cba6 0 6px, transparent 6px 12px); background-size: 12px 1px; }
.tz-cell.f-tian::after { top: 0; bottom: 0; left: 50%; width: 1px; background-image: linear-gradient(to bottom, #d9cba6 0 6px, transparent 6px 12px); background-size: 1px 12px; }
/* 米字格：再加两条对角虚线 */
.tz-cell.f-mi::before, .tz-cell.f-mi::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.tz-cell.f-mi::before {
    background:
        linear-gradient(to right, transparent calc(50% - .5px), #d9cba6 calc(50% - .5px), #d9cba6 calc(50% + .5px), transparent calc(50% + .5px)),
        linear-gradient(to bottom, transparent calc(50% - .5px), #d9cba6 calc(50% - .5px), #d9cba6 calc(50% + .5px), transparent calc(50% + .5px));
}
.tz-cell.f-mi::after {
    background:
        linear-gradient(45deg, transparent calc(50% - .5px), #e3d7b8 calc(50% - .5px), #e3d7b8 calc(50% + .5px), transparent calc(50% + .5px)),
        linear-gradient(-45deg, transparent calc(50% - .5px), #e3d7b8 calc(50% - .5px), #e3d7b8 calc(50% + .5px), transparent calc(50% + .5px));
}
.tz-cell .ch, .tz-cell .py { position: relative; z-index: 1; }
.tz-cell .py { position: absolute; }

/* ---------- 打印 ---------- */
@media print {
    @page { size: A4 portrait; margin: 12mm 10mm; }
    body { background: #fff !important; }
    .yw-head, .yw-hero, .brand-footer, .tz-controls, .tz-note { display: none !important; }
    .tz-container { width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .tz-sheetwrap { display: block; }
    .tz-sheet {
        max-width: none; width: 100%; box-shadow: none; border: none; border-radius: 0;
        padding: 0; background: #fff;
    }
    .tz-cell { border-color: #b9a87c !important; }
    .tz-cell.trace .ch { color: #c8bfa6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .tz-cell .ch { color: #000 !important; }
    .tz-cell .py { color: #9a927c !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .tz-sheet-head, .tz-sheet-foot { color: #333 !important; }
}

@media (max-width: 640px) {
    .tz-panel { padding: 18px 16px 16px; }
    .tz-field { flex: 1 1 100%; }
    .tz-sheet { padding: 16px 14px 12px; }
    .tz-sheet-title { font-size: 17px; letter-spacing: 4px; }
    .tz-cell .py { font-size: 7.5px; }
}
