:root {
    --device-font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    --calligraphy-font: "Kaiti SC", STKaiti, KaiTi, "KaiTi_GB2312", "楷体", "楷体_GB2312", "DFKai-SB", BiauKai, "LXGW WenKai Lite", serif;
    --worksheet-font: var(--calligraphy-font);
    --primary-color: #2563eb;
    --sidebar-bg: #f8fafc;
    --border-color: #e2e8f0;
    --grid-border-color: #ef4444;
    /* Standard Red for grids */
    --grid-guide-color: rgba(239, 68, 68, 0.3);
    /* Fainter red for internal lines */
    --paper-width: 210mm;
    --paper-height: 297mm;
    --cell-size: 24mm;
    /* Adjusted for A4 capacity */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

body {
    font-family: var(--device-font);
    background-color: #eef2f6;
    min-height: 100vh;
    /* Allow scrolling by default */
    overflow-y: auto;
}

.app-container {
    display: flex;
    height: 100vh;
    /* Lock height for the app view */
    overflow: hidden;
    /* Prevent body scroll in app mode */
}

/* Sidebar Styling */
.sidebar {
    width: clamp(340px, 25vw, 460px);
    background: white;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 10;
    overflow-y: auto;
}

.sidebar>* {
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--device-font);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    object-fit: contain;
}

.sidebar-header h1 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.sidebar-nav {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin-top: 0.1rem;
}

.sidebar-nav a {
    color: #94a3b8;
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

/* Sidebar Actions */
.actions {
    position: sticky;
    bottom: -2rem;
    /* Cancel out .sidebar's own 2rem padding on the sides/bottom so this
       reaches the true edge of the scrollport with no gap while stuck,
       then re-add matching padding so its content still lines up with
       every other control-group above it. */
    margin: auto -2rem -2rem;
    padding: 1rem 2rem 2rem;
    background: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -6px 12px -6px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    z-index: 5;
}

textarea {
    width: 100%;
    height: 120px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Accordion */
.accordion-group {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.accordion-group summary {
    padding: 1rem;
    font-weight: 600;
    color: #1e293b;
    background-color: #f8fafc;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-group summary::-webkit-details-marker {
    display: none;
}

.accordion-group summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    transition: transform 0.2s;
    margin-right: 4px;
}

.accordion-group[open] summary::after {
    transform: rotate(225deg);
    margin-top: 4px;
}

.accordion-content {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.accordion-group.nested {
    margin: 0.25rem 0 0;
    box-shadow: none;
    border-color: #e2e8f0;
}

.accordion-group.nested summary {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    background-color: #f8fafc;
}

.accordion-group.nested .accordion-content {
    padding: 1.25rem 0.85rem;
}

/* Radio Cards */
.radio-group {
    display: flex;
    gap: 0.75rem;
}

.radio-card {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    position: relative;
}

.radio-card:hover {
    background-color: #f1f5f9;
}

.radio-card.active {
    border-color: var(--primary-color);
    background-color: #eff6ff;
    color: var(--primary-color);
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

/* Template Chips — one horizontally scrolling row per mode instead of
   wrapping, so adding more examples per age group doesn't blow up the
   sidebar's vertical space. */
.template-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    /* room for the scrollbar without it overlapping the chips */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.template-age-label {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

.template-age-label:first-child {
    padding-left: 0;
    border-left: none;
}

.template-chip {
    flex-shrink: 0;
    white-space: nowrap;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    border-radius: 16px;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.template-chip:hover {
    background: #e5e7eb;
}

.template-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.cell-size-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.8rem;
}

.size-preset-group {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.size-preset-chip {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.size-preset-chip:hover {
    background: #eef2f7;
    border-color: #94a3b8;
}

/* Tab Cards specifically for Mode selection */
.tab-card {
    padding: 0.6rem 0.25rem;
    gap: 0.25rem;
    font-size: 0.8rem;
    text-align: center;
}

.tab-card.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-card.active svg {
    stroke: white;
}

.preview-icon {
    width: 60px;
    height: 60px;
    border: 1px solid #94a3b8;
}

.mi-grid {
    background:
        linear-gradient(90deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%),
        linear-gradient(0deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%),
        linear-gradient(45deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%);
}

.tian-grid {
    background:
        linear-gradient(90deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%),
        linear-gradient(0deg, transparent 49%, #cbd5e1 49%, #cbd5e1 51%, transparent 51%);
}

.square-grid {
    background: transparent;
}

/* Color Options */
.color-options {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.color-btn {
    flex: 1;
    height: 36px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    color: transparent;
    overflow: hidden;
    text-indent: -9999px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.color-btn.active {
    transform: none;
    border-color: transparent;
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
}

/* Custom Color Wrapper */
.custom-color-wrapper {
    flex: 1.5;
    height: 36px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    border: 1px dashed #94a3b8;
}

.custom-color-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.custom-color-wrapper.active {
    transform: none;
    border-style: solid;
    border-color: transparent;
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
}

/* Custom Color Picker */
.custom-color-picker {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    cursor: pointer;
}

.custom-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-picker::-webkit-color-swatch {
    border: none;
}

.custom-color-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 20px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked+.slider:before {
    transform: translateX(16px);
}

/* Layout Icons */
.layout-icon {
    width: 48px;
    height: 48px;
    border: 2px solid #94a3b8;
    border-radius: 4px;
    position: relative;
    background: white;
}

.layout-full::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px dashed #cbd5e1;
}

.layout-split2::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    top: 50%;
    margin-top: -1px;
    border-top: 2px solid #94a3b8;
}

.layout-quadrant::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    top: 50%;
    margin-top: -1px;
    border-top: 2px solid #94a3b8;
}

.layout-quadrant::before {
    content: '';
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 50%;
    margin-left: -1px;
    border-left: 2px solid #94a3b8;
}

/* Action Buttons */
.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-btn:hover {
    background-color: #1d4ed8;
}

/* Preview Area */
.preview-area {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem;
    background-color: #64748b;
    /* Dark backdrop for contrast */
    position: relative;
    /* For loading overlay positioning */
    transition: opacity 0.2s ease-in-out;
}

.preview-area.fade-out {
    opacity: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(237, 240, 236, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(24, 119, 101, 0.16);
    border-top-color: #187765;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 1rem;
    color: #31594b;
    font-size: 1rem;
    font-weight: 500;
}

.a4-paper {
    width: var(--paper-width);
    height: var(--paper-height);
    min-height: var(--paper-height);
    flex-shrink: 0;
    background: white;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12mm;
    /* Same physical margins in the preview, PDF and print layout. */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Center the wrapper in the page */
    align-content: center;
    overflow: hidden;
    /* Ensure no overflow */
}

/* Internal Grid Wrapper for Borders */
.grid-container {
    display: grid;
    gap: 1px;
    /* The gap creates the internal borders */
    background-color: var(--grid-border-color);
    /* The color of the gap/border */
    border: 1px solid var(--grid-border-color);
    /* Correct outer border */
    /* Ensure exact columns */
    flex: none;
    grid-template-columns: repeat(var(--col-count, 7), var(--cell-size));
    grid-auto-rows: var(--cell-size);
}

/* Removed hardcoded .portrait/.landscape columns rules */

/* Cell & Grid Styles */
.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: white;
    /* Overlay the container red bg */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cell-content {
    /* Practice glyphs favor the configured Kai-style writing font. */
    font-family: var(--calligraphy-font);
    font-size: calc(var(--cell-size) * 0.74);
    /* Keep enough breathing room for wide Kai-style glyphs. */
    line-height: 1;
    z-index: 2;
    pointer-events: none;
}

/* Grid Patterns */
.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

/* Tian Ge */
.type-tian .grid-bg {
    /* Solid gradients removed to show dashed lines from pseudo-elements */
    border: none;
}

/* Fix for gradients repeating: we need a single cross */
.type-tian .grid-bg::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1px dashed var(--grid-guide-color);
}

.type-tian .grid-bg::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    border-left: 1px dashed var(--grid-guide-color);
}

/* Mi Ge */
.type-mi .grid-bg::after {
    /* Horizontal */
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1px dashed var(--grid-guide-color);
}

.type-mi .grid-bg::before {
    /* Vertical */
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    border-left: 1px dashed var(--grid-guide-color);
}

.type-mi .grid-diagonals {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.type-mi .grid-diagonals::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 1px;
    border-top: 1px dashed var(--grid-guide-color);
    transform: translate(-50%, -50%) rotate(45deg);
    transform-origin: center;
}

.type-mi .grid-diagonals::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 1px;
    border-top: 1px dashed var(--grid-guide-color);
    transform: translate(-50%, -50%) rotate(-45deg);
    /* -45deg is easier to reason about than 135deg */
    transform-origin: center;
}


/* Square */
.type-square .grid-bg {
    display: none;
}

/* Landscape Mode */
.a4-paper.landscape {
    width: var(--paper-height);
    min-height: var(--paper-width);
    /* Swapped */
    height: var(--paper-width);
    /* Grid handling moved to .grid-container */
}

/* Print Styles */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
        height: auto;
        overflow: visible;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide UI elements */
    .sidebar,
    .loading-overlay,
    .control-group,
    header,
    footer,
    .breadcrumbs,
    .btn-generate,
    .action-area,
    #shareBtn,
    .preview-toolbar,
    .seo-content,
    .custom-color-picker {
        display: none !important;
    }

    .app-container {
        display: block;
        height: auto;
    }

    .preview-area {
        padding: 0;
        margin: 0;
        background: white;
        overflow: visible;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        height: auto;
    }

    /* updateZoom() writes inline width/height/transform onto these for the
       on-screen preview. Those inline styles outrank plain print rules, and
       paper.offsetHeight rounds 297mm (1122.52px) UP to 1123px — half a pixel
       taller than the page box, which is enough to spill onto a blank second
       sheet. A leftover scale() would also shrink the printout to whatever
       zoom the preview happened to be at. Neutralize both with !important. */
    #paper-wrapper {
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        transform: none !important;
    }

    .a4-paper {
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        transform: none !important;
        transform-origin: top left !important;
        width: 210mm;
        height: 297mm;
        min-height: 0;
        padding: 12mm;
        /* Match screen padding */
    }

    .a4-paper.landscape {
        width: 297mm;
        height: 210mm;
        min-height: 0;
    }
}

/* Named page for landscape, referenced by the `page: landscape` rule below.
   Without this declaration that reference is inert and landscape worksheets
   print onto portrait sheets. */
@page landscape {
    size: A4 landscape;
    margin: 0;
}

@media print {

    .a4-paper.landscape {
        page: landscape;
    }
}

/* --- Poetry Mode Styles --- */

.poetry-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
}

.poetry-row {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 3mm;
}

.poetry-row.title-row {
    margin-bottom: 8mm;
}

/* Cell Group for Pinyin + Grid */
.cell-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: -1px;
    /* Collapse adjacent borders */
}

.cell-group:last-child {
    margin-right: 0;
}

.pinyin-box {
    width: 100%;
    height: 8mm;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: var(--device-font);
    font-size: 14px;
    padding-bottom: 2px;
    color: #333;
}

/* Add borders to cells in poetry mode (since not in grid-container) */
.cell-group .cell {
    border: 1px solid var(--grid-border-color);
}

/* --- Quadrant Layout Styles --- */

.quadrant-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Horizontal Cutting Line */
.quadrant-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1px dashed #94a3b8;
    /* Slate-400 for visibility */
    pointer-events: none;
}

/* Vertical Cutting Line */
.quadrant-grid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    border-left: 1px dashed #94a3b8;
    pointer-events: none;
}

.quadrant-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5mm;
    overflow: hidden;
}

/* --- Split-2 Layout Styles --- */

.split2-grid {
    display: grid;
    /* Default is portrait (stacked rows) */
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Horizontal Cutting Line (Portrait) */
.split2-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10mm;
    right: 10mm;
    height: 1px;
    border-top: 1px dashed #94a3b8;
    pointer-events: none;
}

/* Landscape Split-2: Side-by-Side Columns */
.a4-paper.landscape .split2-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

/* Vertical Cutting Line (Landscape) */
.a4-paper.landscape .split2-grid::after {
    top: 10mm;
    bottom: 10mm;
    left: 50%;
    width: 1px;
    height: auto;
    border-top: none;
    border-left: 1px dashed #94a3b8;
}

.split2-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10mm;
    /* Slightly more padding than quadrant */
    overflow: hidden;
}

/* Mobile Responsiveness */
@media (max-width: 768px), (max-width: 1024px) and (pointer: coarse) {
    :root { --mobile-editor-height: 62vh; }
    @supports (height: 1dvh) {
        :root { --mobile-editor-height: 62dvh; }
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: var(--mobile-editor-height);
        border-right: none;
        border-top: 1px solid var(--border-color);
        order: 2;
        position: fixed;
        bottom: 0;
        z-index: 50;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .preview-area {
        flex: 0 0 auto;
        min-height: 0;
        height: calc(100vh - var(--mobile-editor-height));
        height: calc(100dvh - var(--mobile-editor-height));
        padding: 1rem;
        order: 1;
        padding-bottom: 1rem;
    }

    .sidebar .actions {
        bottom: 0;
        margin-bottom: 0;
        padding-top: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .preview-toolbar {
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
}

/* --- SEO/GEO Content Section (below the tool) --- */
.seo-content {
    background: #f9fafb;
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 4rem;
}

.seo-content .container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.seo-content .breadcrumbs {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.seo-content .breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.seo-content h2 {
    font-family: var(--device-font);
    font-size: 1.5rem;
    color: #111827;
    margin: 2.5rem 0 1rem;
}

.seo-content h2:first-of-type {
    margin-top: 0;
}

.seo-content p {
    color: #374151;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.seo-content .howto-list {
    padding-left: 1.5rem;
    color: #374151;
    line-height: 1.8;
}

.seo-content .howto-list li {
    margin-bottom: 0.5rem;
}

.seo-content .faq-item {
    margin-bottom: 1.5rem;
}

.seo-content .faq-item h3 {
    font-size: 1.05rem;
    color: #111827;
    margin-bottom: 0.4rem;
}

.seo-content .faq-item p {
    color: #4b5563;
    margin-bottom: 0;
}

.seo-content .related-links {
    list-style: none;
    padding: 0;
    color: #374151;
    line-height: 2;
}

.seo-content .related-links a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.seo-content .related-links a:hover {
    text-decoration: underline;
}

/* --- Info Trigger Button (opens the modal below) --- */
.info-trigger-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 2rem;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s, box-shadow 0.15s;
}

.info-trigger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px -2px rgba(0, 0, 0, 0.2);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* --- Info Modal --- */
.info-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.info-modal[hidden] {
    display: none;
}

.info-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.info-modal-panel {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.info-modal-close {
    position: sticky;
    top: 0;
    float: right;
    margin: 0.75rem 0.75rem 0 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.info-modal-close:hover {
    background: #e2e8f0;
    color: #1f2937;
}

.info-modal .seo-content {
    background: transparent;
    border-top: none;
    padding: 0.5rem 2rem 2rem;
}

.info-modal .seo-content .container {
    max-width: none;
    padding: 0;
}

.info-modal .seo-content .breadcrumbs {
    display: none;
}

@media (max-width: 768px), (max-width: 1024px) and (pointer: coarse) {
    .info-trigger-btn {
        /* Keep help above the taller editor drawer. */
        bottom: calc(var(--mobile-editor-height) + 1rem);
        right: 1rem;
        padding: 0.45rem 0.8rem;
        font-size: 0.8rem;
    }

    .info-trigger-btn.avoid-reprint {
        transform: translateY(-8rem);
    }

    .info-trigger-btn.avoid-reprint:hover {
        transform: translateY(calc(-8rem - 1px));
    }

    .info-modal-panel {
        max-height: 90vh;
    }

    .info-modal .seo-content {
        padding: 0.5rem 1.25rem 1.5rem;
    }
}

@media print {

    .info-trigger-btn,
    .info-modal {
        display: none !important;
    }
}

/* ==========================================================================
   Name Practice Worksheet Styles (姓名练习字帖)
   ========================================================================== */

.name-worksheet-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    font-family: var(--device-font);
    color: #1f2937;
    --worksheet-border-color: #ef4444;
}

/* 1. Header */
.name-worksheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 3.5mm;
    margin-bottom: 2mm;
    border-bottom: 1px solid transparent;
}

.name-header-fields {
    display: flex;
    gap: 7mm;
    font-size: 13.5px;
    font-weight: 500;
    color: #333333;
}

.name-header-item {
    display: inline-flex;
    align-items: baseline;
}

.name-header-item .header-label {
    font-weight: 600;
}

.name-header-item .header-line {
    display: inline-block;
    min-width: 25mm;
    border-bottom: 1px solid #333333;
    text-align: center;
    padding: 0 4px;
    font-weight: 600;
}

.name-header-stars {
    font-size: 13.5px;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 2px;
}

.name-header-stars .stars-label {
    color: #4b5563;
    font-weight: 600;
}

.name-header-stars .stars-icons {
    font-size: 16px;
    letter-spacing: 2px;
}

/* 2. Hero Section: 大字音义精析卡片 */
.name-hero-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 12mm;
    margin: 3mm 0 6mm 0;
}

.name-hero-section.count-2 {
    gap: 20mm;
}

.name-hero-section.count-4 {
    gap: 6mm;
}

.name-hero-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32mm;
}

.name-hero-pinyin {
    font-size: 20px;
    font-weight: bold;
    color: #4b5563;
    margin-bottom: 2mm;
    height: 6mm;
    line-height: 6mm;
    text-align: center;
    font-family: var(--device-font);
}

.name-big-cell {
    width: 32mm !important;
    height: 32mm !important;
    position: relative;
    background: #ffffff;
    border: 1.5px solid var(--worksheet-border-color) !important;
    box-sizing: border-box;
}

.name-big-cell .cell-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25mm !important;
    line-height: 1 !important;
    font-family: var(--calligraphy-font);
    font-weight: bold;
    color: #111111;
    z-index: 2;
}

.name-hero-meta {
    margin-top: 2.5mm;
    font-size: 11.5px;
    color: #374151;
    text-align: center;
    line-height: 1.45;
    font-family: var(--device-font);
    font-weight: 500;
}

.name-hero-meta .meta-row {
    margin: 1px 0;
}

/* 3. Single Character Stroke Rows: 逐字笔顺与描红行 */
.name-stroke-section {
    display: flex;
    flex-direction: column;
    gap: 3.5mm;
    margin-bottom: 5mm;
}

.name-stroke-row-wrapper {
    display: flex;
    flex-direction: column;
}

.name-stroke-step-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5mm;
    height: 5.5mm;
}

.stroke-row-pinyin {
    font-size: 16px;
    font-weight: bold;
    color: #374151;
    min-width: 15mm;
    font-family: var(--device-font);
}

.name-micro-steps {
    display: flex;
    align-items: center;
    gap: 2.8mm;
    flex-wrap: nowrap;
}

.name-micro-step-item {
    width: 4.5mm;
    height: 4.5mm;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.name-micro-step-item svg {
    width: 100%;
    height: 100%;
    display: block;
}

.name-stroke-cells-row {
    display: grid;
    grid-template-columns: repeat(var(--row-cols, 9), 1fr);
    width: 100%;
    aspect-ratio: 9 / 1;
    border: 1.4px solid var(--worksheet-border-color);
    background: #ffffff;
    box-sizing: border-box;
}

.name-stroke-cells-row .name-grid-cell {
    position: relative;
    width: 100%;
    height: 100%;
    border-right: 1px solid var(--worksheet-border-color);
    box-sizing: border-box;
}

.name-stroke-cells-row .name-grid-cell:last-child {
    border-right: none;
}

.name-stroke-cells-row .name-grid-cell .cell-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5mm;
    line-height: 1;
    font-family: var(--calligraphy-font);
    z-index: 2;
}

/* 4. Full Name Practice Matrix: 整名连写矩阵 */
.name-matrix-section {
    margin-top: auto;
    width: 100%;
}

.name-matrix-grid {
    display: grid;
    grid-template-columns: repeat(var(--matrix-cols, 9), 1fr);
    grid-template-rows: repeat(var(--matrix-rows, 6), 1fr);
    width: 100%;
    aspect-ratio: 9 / 6;
    border: 1.4px solid var(--worksheet-border-color);
    background: #ffffff;
    box-sizing: border-box;
}

.name-matrix-grid[style*="--matrix-rows: 4"] {
    aspect-ratio: 8 / 4;
}

.name-matrix-grid[style*="--matrix-rows: 5"] {
    aspect-ratio: 9 / 5;
}

.name-matrix-cell {
    position: relative;
    width: 100%;
    height: 100%;
    border-right: 1px solid var(--worksheet-border-color);
    border-bottom: 1px solid var(--worksheet-border-color);
    box-sizing: border-box;
}

/* Remove right border on last column in matrix */
.name-matrix-grid[style*="--matrix-cols: 9"] .name-matrix-cell:nth-child(9n),
.name-matrix-grid[style*="--matrix-cols: 8"] .name-matrix-cell:nth-child(8n) {
    border-right: none;
}

/* Remove bottom border on last row in matrix */
.name-matrix-grid[style*="--matrix-cols: 9"][style*="--matrix-rows: 6"] .name-matrix-cell:nth-child(n+46),
.name-matrix-grid[style*="--matrix-cols: 9"][style*="--matrix-rows: 5"] .name-matrix-cell:nth-child(n+37),
.name-matrix-grid[style*="--matrix-cols: 8"][style*="--matrix-rows: 6"] .name-matrix-cell:nth-child(n+41),
.name-matrix-grid[style*="--matrix-cols: 8"][style*="--matrix-rows: 4"] .name-matrix-cell:nth-child(n+25) {
    border-bottom: none;
}

.name-matrix-cell .cell-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5mm;
    line-height: 1;
    font-family: var(--calligraphy-font);
    z-index: 2;
}

/* Print Specific Rules for Name Worksheet */
@media print {
    .name-worksheet-wrapper {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
/* One SVG guide per cell, shared by preview and canvas capture. */
.cell > .grid-guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* The output area progresses in place: generate -> ready -> save / preview. */
.actions [hidden] { display: none !important; }
.output-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.output-button svg, .output-close svg { flex: none; }
.output-button-primary { background: #059669; color: #fff; }
.output-button-primary:hover { background: #047857; color: #fff; }
.output-button-secondary { background: #fff; border-color: #cbd5e1; color: #334155; }
.output-button-secondary:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.output-button:focus-visible, .output-close:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.output-button:disabled { cursor: wait; opacity: 0.75; }
.output-generate { width: 100%; }
.export-result { display: flex; flex-direction: column; gap: 14px; }
.export-ready-heading { display: flex; align-items: center; gap: 10px; }
.export-ready-mark { display: grid; place-items: center; width: 34px; height: 34px; background: #ecfdf5; color: #047857; border-radius: 50%; flex: none; }
#exportReadyTitle { color: #1e293b; font-size: 0.9375rem; font-weight: 600; line-height: 1.4; }
.export-ready-meta { margin-top: 2px; color: #64748b; font-size: 0.75rem; line-height: 1.4; }
.output-main-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.output-share-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.output-share-copy { min-width: 0; }
.output-share-copy strong { display: block; color: #334155; font-size: 0.8125rem; font-weight: 600; line-height: 1.45; }
.output-share-copy span { display: block; margin-top: 2px; color: #64748b; font-size: 0.75rem; line-height: 1.45; }
.output-link-button { flex: none; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #047857; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.output-link-button:hover { background: #ecfdf5; }
.output-link-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.output-close { display: inline-flex; align-items: center; justify-content: center; flex: none; margin-left: auto; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #64748b; cursor: pointer; }
.output-close:hover { background: #f1f5f9; color: #0f172a; }
.export-status { margin-top: 10px; font-size: 0.75rem; line-height: 1.55; color: #64748b; }
.export-status[role="alert"] { color: #b91c1c; }
.output-spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.actions[aria-busy="true"] .output-spinner { display: block; }
.actions[aria-busy="true"] .output-file-icon { display: none; }
/* Export progress rides on the button itself: on mobile it is the only output UI. */
.output-generate { position: relative; overflow: hidden; }
.output-generate::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.9); transform-origin: left center; transform: scaleX(var(--export-progress, 0)); opacity: 0; transition: transform 0.4s ease, opacity 0.2s ease; pointer-events: none; }
.actions[aria-busy="true"] .output-generate::after { opacity: 1; }
.actions[aria-busy="true"] .output-generate:disabled { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .output-button, .output-generate::after { transition: none; } .output-spinner { animation-duration: 1.6s; } }
@media print {
    .info-trigger-btn, .info-modal, .export-status, .export-result { display: none !important; }
    html, body { width: auto; min-height: 0; }
    .a4-paper { break-inside: avoid; break-after: auto; }
}

/* Fixed sections must not shrink while calculating remaining practice rows. */
.name-worksheet-wrapper > * { flex-shrink: 0; }
.name-matrix-cell:nth-child(n) { border-right: 1px solid var(--worksheet-border-color); border-bottom: 1px solid var(--worksheet-border-color); }

/* Compact optional page furniture: reuse 6mm of the existing bottom margin. */
.a4-paper.has-reprint,.worksheet-page.has-reprint-page { flex-direction: column; justify-content: flex-start; gap: 0; }
.worksheet-body { width: 100%; height: calc(100% - var(--note-height) + 6mm); flex: none; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.worksheet-note { width: 100%; max-width: 100%; height: var(--note-height); margin-bottom: -6mm; margin-left: auto; margin-right: auto; flex: none; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 5mm; padding-top: 2mm; color: #787878; font-family: var(--device-font); }
.worksheet-note-copy { min-width: 0; flex: 1; }
.worksheet-note-heading { display: flex; align-items: baseline; gap: 3mm; margin-bottom: 1.5mm; }
.worksheet-note-label { font-size: 7.5pt; font-weight: 600; letter-spacing: 0.08em; color: #6e6e6e; }
.worksheet-note-copy p { margin: 0; font-size: 8.5pt; line-height: 1.45; max-height: 28pt; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; letter-spacing: 0.02em; font-weight: 400; color: #575757; }
.worksheet-reprint { flex: none; display: inline-flex; align-items: center; gap: 1.8mm; color: #858585; text-decoration: none; line-height: 1; }
.worksheet-reprint-vertical-label { writing-mode: vertical-rl; text-orientation: upright; font-size: 6.5pt; letter-spacing: 0.18em; color: #8c8c8c; line-height: 1; user-select: none; font-family: var(--device-font); }
.worksheet-reprint img { display: block; width: var(--qr-size); height: var(--qr-size); border-radius: 2px; }
.worksheet-reprint-caption { display: none; }
@media print { .worksheet-note { display: flex !important; } }

/* Short, spacious beginner exercises retain A4 geometry in preview and PDF. */
.beginner-name h2,.foundation-sheet h2{font-size:24px;margin:0 0 8mm}.beginner-name p,.foundation-sheet p{font-size:14px;margin:0 0 8mm}.practice-row.grid-container{width:max-content;margin:0 auto 7mm;grid-template-columns:repeat(var(--col-count),var(--cell-size))}.stroke-model{position:absolute;inset:0;width:100%;height:100%}
.stroke-animation-panel{width:min(240px,calc(100vw - 40px));height:auto;box-sizing:border-box}
.stroke-animation-drawing{display:grid;place-items:center;width:180px;max-width:100%;height:180px;margin:0 auto;overflow:hidden}
.stroke-animation-drawing>div{display:grid!important;place-items:center;width:100%!important;height:100%!important}
.stroke-animation-drawing svg{display:block;width:100%!important;height:100%!important;max-width:100%;max-height:100%}
#worksheetShareTitle:focus{outline:none}
#worksheetShareDialog{width:min(480px,calc(100vw - 32px));max-width:none;margin:auto;border:0;border-radius:18px;padding:0;background:#fff;color:#1e293b;box-shadow:0 24px 80px rgba(15,23,42,.28);overflow:hidden}
#worksheetShareDialog::backdrop{background:rgba(15,23,42,.52);backdrop-filter:blur(2px)}
.share-dialog-header{display:flex;align-items:flex-start;gap:12px;padding:22px 22px 14px}
.share-dialog-mark{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:50%;background:#ecfdf5;color:#047857}
.share-dialog-title{margin:0;font-size:1.125rem;line-height:1.45;color:#0f172a}
.share-dialog-intro{margin:4px 0 0;color:#475569;font-size:.875rem;line-height:1.6}
.share-dialog-body{padding:0 22px 22px}
.share-dialog-privacy{margin:0 0 16px;padding:11px 12px;border-radius:10px;background:#fff7ed;color:#9a3412;font-size:.8125rem;line-height:1.55}
.share-dialog-label{display:block;color:#334155;font-size:.8125rem;font-weight:600}
#worksheetShareUrl{display:block;width:100%;height:44px;margin-top:7px;padding:0 11px;border:1px solid #cbd5e1;border-radius:9px;background:#f8fafc;color:#334155;font:400 .8125rem/1.4 var(--device-font)}
#worksheetShareUrl:focus{outline:3px solid #bfdbfe;border-color:#60a5fa}
.share-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
.share-dialog-button{min-height:44px;padding:9px 16px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#334155;font:600 .875rem/1.4 var(--device-font);cursor:pointer}
.share-dialog-button-primary{border-color:#047857;background:#047857;color:#fff}
.share-dialog-button:focus-visible{outline:3px solid #93c5fd;outline-offset:2px}
#shareMessage{min-height:1.4em;margin:8px 0 0;color:#047857;font-size:.8125rem;text-align:right}
@media(max-width:768px),(pointer:coarse){.output-main-actions{grid-template-columns:1fr 1fr}.output-share-link{align-items:center}.output-link-button{max-width:none;white-space:nowrap;text-align:right}.share-dialog-header{padding:20px 18px 12px}.share-dialog-body{padding:0 18px 18px}.share-dialog-actions{display:grid;grid-template-columns:1fr 1fr}.share-dialog-button{width:100%}}

/* Canonical worksheet renderer: teaching roles own appearance, never raw text-color switches. */
.worksheet-poetry .worksheet-poetry-panel .worksheet-block{--worksheet-columns:8}
.name-learning-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(28mm,1fr));gap:2mm;margin-bottom:3mm}.name-learning-card{display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:auto auto;align-items:center;gap:0 2mm;padding:1.5mm 2mm;border:1px solid #e5e7eb;border-radius:2mm}.name-learning-card .name-big-cell .cell-content{font:600 17pt/1 var(--calligraphy-font)}.name-learning-card>span{font:9pt/1.2 var(--device-font);color:#555}.name-learning-card>small{grid-column:1/3;font:7.5pt/1.2 var(--device-font);color:#666}.name-stroke-preview{grid-column:3;grid-row:1/3;width:12mm;height:12mm}.name-stroke-preview path{fill:#555}.name-stroke-preview-fallback{grid-column:3;grid-row:1/3;font:16pt/1 var(--calligraphy-font);color:#555}
.worksheet-cell .worksheet-grid-guide path{stroke:var(--grid-guide-color,rgba(239,68,68,.3))}.worksheet-pinyin>.pinyin-guide-line{border-top-color:rgba(239,68,68,.18)}
.worksheet-document,.worksheet-page,.worksheet-section{width:100%;min-width:0}.worksheet-document{height:100%}.worksheet-page{height:100%;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-start}.worksheet-section{display:flex;flex-direction:column;gap:0}.worksheet-block{display:grid;grid-template-columns:repeat(var(--worksheet-columns),minmax(0,1fr));grid-auto-rows:auto;gap:0;direction:ltr}.worksheet-cell-group{min-width:0;display:flex;flex-direction:column}.worksheet-cell{position:relative;width:100%;height:auto;display:grid;place-items:center;aspect-ratio:1;border:1px solid var(--grid-color);box-sizing:border-box;overflow:hidden;container-type:inline-size}.worksheet-grid-guide{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.worksheet-grid-guide path{fill:none;stroke:var(--grid-guide-color,rgba(239,68,68,.3));stroke-width:1;stroke-dasharray:3 3;vector-effect:non-scaling-stroke}.worksheet-character{position:relative;z-index:1;font-family:var(--worksheet-font,var(--calligraphy-font));font-size:74cqw;line-height:1;color:var(--master-color)}.role-trace .worksheet-character{color:var(--trace-color)}.role-trace.trace-light .worksheet-character{opacity:.72}.role-trace.trace-normal .worksheet-character{opacity:.86}.role-trace.trace-dark .worksheet-character{opacity:1}.role-trace.trace-hollow .worksheet-character{color:transparent;-webkit-text-stroke:1.1px var(--trace-color);paint-order:stroke fill}.role-copy .worksheet-character{display:none}.worksheet-pinyin{position:relative;height:7mm;flex:none;display:grid;place-items:center;overflow:hidden;color:#2f3f38;font:600 10pt/1 var(--device-font);background:#fff}.worksheet-pinyin b{position:relative;z-index:1;font-weight:600;background:rgba(255,255,255,.9);padding:0 .8mm}.pinyin-guide-line{position:absolute;left:0;right:0;border-top:.35px solid rgba(239,68,68,.18)}.pinyin-guide-line:nth-child(1){top:0}.pinyin-guide-line:nth-child(2){top:33.333%}.pinyin-guide-line:nth-child(3){top:66.667%}.pinyin-guide-line:nth-child(4){top:100%}.worksheet-stroke-svg,.worksheet-foundation-path{position:absolute;inset:0;width:100%;height:100%;z-index:1}.worksheet-stroke-svg path{fill:#333}.worksheet-foundation-path path{fill:none;stroke:currentColor;stroke-width:5;stroke-linecap:round}.role-guide .worksheet-foundation-path{color:var(--master-color)}.role-trace .worksheet-foundation-path{color:var(--trace-color)}.role-copy .worksheet-foundation-path{display:none}.worksheet-foundation-path circle{fill:#b45309}.worksheet-name-header{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:5mm;padding-bottom:2mm;border-bottom:1px solid #ddd}.worksheet-name-header strong{font:600 13pt/1.3 var(--device-font)}.worksheet-name-header span{font:16pt/1.3 var(--calligraphy-font)}.worksheet-poetry{display:grid;grid-template-columns:1fr;grid-template-rows:1fr;height:100%;gap:5mm}.worksheet-poetry.poetry-split2{grid-template-rows:repeat(2,minmax(0,1fr))}.worksheet-poetry.poetry-quadrant{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}.worksheet-poetry-panel{min-height:0;overflow:hidden;display:flex;flex-direction:column;justify-content:center;padding:3mm;border:1px solid #eee}.worksheet-poetry-panel h2{margin:0 0 3mm;text-align:center;font:600 14pt/1.3 var(--device-font)}

/* A paginated preview is a vertical stack of real A4 sheets. */
.worksheet-block{background:#fff;border:0;grid-template-columns:repeat(var(--worksheet-block-columns,var(--worksheet-columns)),minmax(0,1fr))}
.name-big-cell .cell-content{font-family:var(--calligraphy-font)}
.worksheet-stroke-svg path{fill:#3f4642}.worksheet-stroke-svg .current-stroke{fill:#dc3f3f}
.worksheet-cell-group{container-type:inline-size}
.worksheet-cell{container-type:normal}
/* Adjacent cells share a single edge. Pinyin and poetry rows have real spacing. */
.worksheet-cell-group:not(.worksheet-row-start) > .worksheet-cell{border-left:0}
.worksheet-block:not(:has(.worksheet-pinyin)) .worksheet-cell-group:not(.worksheet-first-row) > .worksheet-cell{border-top:0}
.worksheet-section:not(.worksheet-poetry) > .worksheet-block + .worksheet-block:not(:has(.worksheet-pinyin)) .worksheet-cell{border-top:0}
.worksheet-pinyin{color:var(--master-color)}
.worksheet-pinyin[data-role="trace"] b{color:var(--trace-color)}
.worksheet-pinyin[data-role="trace"][data-trace-density="light"] b{opacity:.72}
.worksheet-pinyin[data-role="trace"][data-trace-density="normal"] b{opacity:.86}
.worksheet-pinyin[data-role="trace"][data-trace-density="dark"] b{opacity:1}
.worksheet-poetry .worksheet-block{width:var(--worksheet-block-width);align-self:center}
.worksheet-poetry{position:relative;gap:0}
.worksheet-poetry-panel{border:0;padding:0}
.worksheet-poetry-panel>.worksheet-block{margin-bottom:calc(3mm * var(--poetry-content-scale,1));flex-shrink:0}
.worksheet-poetry-panel>.worksheet-block:last-child{margin-bottom:0}
.worksheet-poetry-panel>.worksheet-poetry-title{margin-bottom:calc(8mm * var(--poetry-content-scale,1))}
.worksheet-poetry.poetry-quadrant .worksheet-poetry-panel{padding:5mm}
.worksheet-poetry.poetry-split2 .worksheet-poetry-panel{padding:10mm}
.worksheet-poetry .worksheet-pinyin{height:calc(7mm * var(--poetry-content-scale,1));font-size:calc(10pt * var(--poetry-content-scale,1))}
.worksheet-poetry.poetry-split2 .worksheet-pinyin{height:calc(5mm * var(--poetry-content-scale,1));font-size:calc(8pt * var(--poetry-content-scale,1))}
.worksheet-poetry.poetry-quadrant::after,.worksheet-poetry.poetry-split2::after{content:"";position:absolute;pointer-events:none;border-top:1px dashed #94a3b8;top:50%;height:1px}
.worksheet-poetry.poetry-quadrant::after{left:0;width:100%}
.worksheet-poetry.poetry-quadrant::before{content:"";position:absolute;pointer-events:none;border-left:1px dashed #94a3b8;left:50%;top:0;height:100%;width:1px}
.worksheet-poetry.poetry-split2::after{left:10mm;right:10mm}
.worksheet-page.landscape .worksheet-poetry.poetry-split2{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:1fr}
.worksheet-page.landscape .worksheet-poetry.poetry-split2::after{top:10mm;bottom:10mm;left:50%;right:auto;width:1px;height:auto;border-top:0;border-left:1px dashed #94a3b8}
.pinyin-guide-line:nth-child(4){top:auto;bottom:0}
.a4-paper.has-multiple-pages{height:auto;min-height:0;padding:0;background:transparent;box-shadow:none;border-radius:0;display:block;overflow:visible}
.a4-paper.has-multiple-pages .worksheet-document{height:auto;display:flex;flex-direction:column;gap:8mm}
.a4-paper.has-multiple-pages .worksheet-page{width:var(--paper-width);height:var(--paper-height);padding:12mm;background:#fff;box-shadow:0 4px 24px rgba(0,0,0,.16);border-radius:12px;flex:none}
.a4-paper.has-multiple-pages.landscape .worksheet-page{width:var(--paper-height);height:var(--paper-width)}
@media print{
    .a4-paper.has-multiple-pages .worksheet-document{gap:0}
    .a4-paper.has-multiple-pages .worksheet-page{box-shadow:none;border-radius:0;break-after:page}
    .a4-paper.has-multiple-pages .worksheet-page:last-child{break-after:auto}
}

/* 生字综合练习：左侧识字信息，上方笔顺，下方描红与自写。 */
.character-study-row{display:grid;grid-template-columns:repeat(var(--study-columns),minmax(0,1fr));grid-template-rows:7mm auto;flex:none;color:var(--master-color);--grid-guide-color:var(--grid-color)}
.study-model{grid-column:1;grid-row:1/3;display:flex;flex-direction:column;min-width:0}
.study-model>.worksheet-cell-group{width:100%}
.study-model .worksheet-pinyin{border:1px solid var(--grid-color);border-bottom:0;box-sizing:border-box;font-size:8pt}
.study-model .worksheet-pinyin b{padding:0;font-weight:400}
.study-model .pinyin-guide-line{border-top-color:var(--grid-color);opacity:.3}
.study-stroke-strip{grid-column:2/-1;grid-row:1;display:flex;align-items:center;min-width:0;height:7mm;border-top:1px solid var(--grid-color);border-right:1px solid var(--grid-color);box-sizing:border-box;overflow:hidden;padding:0 1mm;gap:.4mm}
.study-stroke-step{flex:0 1 7mm;min-width:0;height:6mm}
.study-stroke-step .completed-stroke{fill:var(--master-color)}
.study-stroke-step .current-stroke{fill:#dc3f3f}
.study-resource-missing{font:7pt/1.2 var(--device-font);color:#777}
.study-facts{grid-column:2;grid-row:2;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;min-width:0;border:1px solid var(--grid-color);border-left:0;box-sizing:border-box;font:8pt/1.1 var(--worksheet-font);text-align:center}
.study-facts>span{display:grid;place-items:center;min-width:0}
.study-facts>span:first-child{border-right:1px solid var(--grid-color)}
.study-structure{grid-column:1/3;border-top:1px solid var(--grid-color);font-size:7pt;padding:0 .2mm}
.study-practice{grid-column:3/-1;grid-row:2;display:grid;grid-template-columns:repeat(calc(var(--study-columns) - 2),minmax(0,1fr));min-width:0}
.study-practice .worksheet-cell{border-left:0}
.study-practice .worksheet-character,.study-model .worksheet-character{font-size:80cqw}
.character-study-row:has(+.character-study-row) .worksheet-cell,.character-study-row:has(+.character-study-row) .study-facts{border-bottom:0}

/* 认字描写：独立认字卡与三行书写区，使用同一网格颜色。 */
.worksheet-character-cards{gap:3mm;--grid-guide-color:var(--grid-color)}
.card-sheet-header{height:5mm;flex:none;display:flex;align-items:center;justify-content:space-between;font:9pt/1 var(--device-font);color:var(--grid-color)}
.card-sheet-header>span{display:flex;align-items:center;gap:1.3mm}
.card-sheet-header i{display:inline-block;min-width:8mm;min-height:3.5mm;border-bottom:1px solid var(--grid-color);color:var(--master-color);font-style:normal}
.card-sheet-header>span:first-child i{min-width:30mm}
.character-card-row{width:min(100%,var(--card-width));align-self:center;min-height:42mm;display:grid;grid-template-columns:30mm minmax(0,1fr);gap:3mm;flex:none;break-inside:avoid;color:var(--master-color);min-width:0}
.card-model{display:flex;flex-direction:column;min-width:0;min-height:0;border:1px solid var(--grid-color);border-radius:2.2mm;overflow:hidden;box-sizing:border-box}
.card-pinyin{display:flex;justify-content:center;align-items:center;height:7mm;flex:none;border-bottom:1px solid var(--grid-color);background:linear-gradient(rgba(255,255,255,.88),rgba(255,255,255,.88)),var(--grid-color);font:12pt/1 var(--device-font);color:var(--master-color)}
.card-master{flex:1;min-height:0;display:grid;place-items:center}
.card-master .worksheet-cell-group{width:19mm;max-width:100%}
.card-master .worksheet-cell{border:0}
.card-master .worksheet-grid-guide{display:none}
.card-master .worksheet-character{font-size:86cqw}
.card-facts{flex:none;margin:0;border-top:1px solid var(--grid-color);font:7.5pt/1.25 var(--device-font)}
.card-facts>div{display:flex;align-items:center;min-height:4.5mm;padding:0 1.4mm;gap:1.5mm}
.card-facts>div+div{border-top:1px dotted var(--grid-color)}
.card-facts dt{flex:none;color:#64766b}
.card-facts dd{margin:0;overflow-wrap:anywhere}
.card-practice{display:grid;grid-template-columns:repeat(var(--card-columns),minmax(0,1fr));align-content:start;min-width:0}
.card-practice .worksheet-cell{border:0;border-right:1px solid var(--grid-color);border-bottom:1px solid var(--grid-color)}
.card-practice .worksheet-row-start .worksheet-cell{border-left:1px solid var(--grid-color)}
.card-practice .worksheet-first-row .worksheet-cell{border-top:1px solid var(--grid-color)}
.card-practice .worksheet-character{font-size:80cqw}
.card-practice .worksheet-grid-guide{opacity:.5}
.card-practice .card-stroke-trace .worksheet-stroke-svg path{fill:var(--trace-color)}
.card-practice .card-stroke-trace.trace-light .worksheet-stroke-svg{opacity:.72}
.card-practice .card-stroke-trace.trace-normal .worksheet-stroke-svg{opacity:.86}
.card-practice .card-stroke-trace.trace-hollow .worksheet-stroke-svg path{fill:none;stroke:var(--trace-color);stroke-width:12;stroke-linejoin:round}
.card-resource-missing{padding:1mm;color:#8b8b8b;text-align:center;font:7pt/1.4 var(--device-font)}

/* Full models and tracing use the same geometry as the stroke sequence. */
.worksheet-glyph-svg{position:absolute;inset:0;width:100%;height:100%;z-index:1}
.worksheet-glyph-svg path{fill:var(--master-color)}
.role-trace .worksheet-glyph-svg path{fill:var(--trace-color)}
.role-trace.trace-light .worksheet-glyph-svg{opacity:.72}
.role-trace.trace-normal .worksheet-glyph-svg{opacity:.86}
.role-trace.trace-hollow .worksheet-glyph-svg path{fill:none;stroke:var(--trace-color);stroke-width:12;stroke-linejoin:round}

/* Numeric writing uses original centerline paths, shared by all teaching roles. */
.worksheet-numbers{gap:0}
.number-exercise{flex:none;min-width:0;width:100%}
.number-exercise+.number-exercise{margin-top:var(--number-row-gap,.8mm)}
.number-caption{height:4mm;box-sizing:border-box;font:8pt/3.5mm var(--device-font);color:var(--grid-color);padding-left:.5mm;white-space:nowrap}
.number-sheet-header{height:22mm;flex:none;box-sizing:border-box;color:#243d30}
.number-sheet-header h2{margin:0 0 2mm;text-align:center;font:600 19pt/1.25 var(--device-font)}
.number-sheet-header>div{display:flex;align-items:baseline;justify-content:space-between;gap:8mm;font:10pt/1.4 var(--device-font)}
.number-sheet-header>div>span{display:flex;align-items:baseline;white-space:nowrap}
.number-sheet-header i{display:inline-block;flex:none;min-height:7mm;box-sizing:border-box;border-bottom:.3mm solid #52685a;font-style:normal;font-family:var(--calligraphy-font)}
.number-name-line{width:50mm}
.number-year-line{width:20mm}
.number-month-line,.number-day-line{width:12mm}
.number-date-field i{margin:0 1mm}
.worksheet-numbers .number-row{flex:none;width:100%;grid-template-columns:repeat(var(--worksheet-columns),minmax(0,1fr))}
.number-row .worksheet-cell{aspect-ratio:1;border-top:1px solid var(--grid-color)!important}
.number-path{position:absolute;top:0;left:0;width:50%;height:100%;z-index:1;color:var(--master-color)}
.number-path path{fill:none;stroke:currentColor;stroke-width:2.1px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.role-trace .number-path,.role-dotted .number-path{color:var(--trace-color)}
.role-dotted .number-path path{stroke-width:2.2px;stroke-dasharray:.1 5;stroke-linecap:round}
.role-trace.trace-light .number-path{opacity:.7}
.role-trace.trace-dark .number-path{opacity:1}
#numberInputError{font-size:13px;color:#a12f26;margin:8px 0}
.number-row .worksheet-grid-guide path{stroke:var(--grid-color);opacity:.65}
.role-dotted .number-path{color:var(--grid-color)}

/* Compact dot-guided training, matching the exercise-book reference layout. */
.dot-training-sheet{gap:0;font-family:var(--calligraphy-font);flex:none}
.dot-sheet-header{height:var(--dot-heading);flex:none;box-sizing:border-box;padding:0 0 2mm;display:flex;flex-direction:column;justify-content:space-between}
.dot-sheet-header h2{margin:0;text-align:center;font:600 18pt/1.1 var(--calligraphy-font);color:#222}
.dot-sheet-header>div{display:flex;justify-content:space-between;font:9pt/1.2 var(--device-font);color:#566d62}
.dot-sheet-header i{display:inline-block;min-width:11mm;min-height:3mm;border-bottom:.3px solid #78968a;font-style:normal}
.dot-sheet-header span:first-child i{min-width:34mm}
.dot-training-panels{display:grid;grid-template-columns:repeat(var(--dot-panels),minmax(0,1fr));gap:var(--dot-gap);width:100%}
.dot-training-panel{min-width:0}
.dot-training-row{display:grid;grid-template-columns:var(--dot-label) repeat(var(--dot-columns),minmax(0,1fr));height:var(--dot-cell);break-inside:avoid}
.dot-label{display:flex;align-items:center;justify-content:center;writing-mode:vertical-rl;font:10pt/1.1 var(--calligraphy-font);border:1px solid var(--grid-color);color:#243d32;background:#f7faf7;letter-spacing:.5mm;overflow:hidden}
.dot-training-cell{position:relative;min-width:0;height:100%;border:1px solid var(--grid-color);overflow:hidden;background:white}
.dot-training-svg.worksheet-foundation-path{position:absolute;inset:0;width:100%;height:100%;color:#222}
.dot-training-svg .dot-trajectory{fill:none;stroke:#292e2b;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.dot-training-svg.dot-trace .dot-trajectory{stroke:#848e87;stroke-width:1.25;stroke-dasharray:.1 2.25;stroke-linecap:round}
.dot-training-svg .dot-grid-guide{fill:none;stroke:var(--grid-color);stroke-width:.55;stroke-dasharray:2 3;opacity:.4}
.dot-training-svg .dot-direction path{fill:none;stroke:#35725b;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.dot-training-svg .dot-direction circle{fill:#35725b}
@media print{.dot-label{background:white}.dot-training-row{break-inside:avoid}}

.dot-grid-none .dot-training-cell{border-color:transparent}

.dot-training-svg .dot-font-outline{fill:inherit;stroke:none;stroke-width:0}
.dot-training-svg .dot-font-pattern circle{fill:#89978d}

.dot-label{position:relative}.dot-label:has(.dot-label-code){padding-top:2.2mm;font-size:8pt}.dot-label-code{position:absolute;left:0;right:0;top:.5mm;writing-mode:horizontal-tb;text-align:center;font:4.5pt/1 var(--device-font);letter-spacing:0;color:#5c7668}.dot-label:has(.dot-label-code)>span{max-height:calc(100% - 1mm);font-size:7pt;line-height:1;letter-spacing:0;white-space:nowrap}

.radical-picker{margin-top:12px}.radical-group-bar{display:flex;align-items:end;gap:8px}.radical-group-select{display:grid;gap:6px;min-width:0;flex:1;font-size:12px;color:#4b6255}.radical-picker select,.radical-picker input{width:100%;min-width:0;border:1px solid #d6dfd8;border-radius:8px;background:white;padding:9px;font:inherit;font-size:12px;color:#293b30}.radical-group-bar>button,.radical-add-selection{flex:none;border:1px solid #9cb7a5;border-radius:8px;padding:9px 10px;background:#eef5ee;color:#31563c;font-size:12px;cursor:pointer}.radical-library{margin-top:12px;border:1px solid #dce5de;border-radius:9px;padding:10px}.radical-library summary{font-size:12px;cursor:pointer;color:#425d4c}.radical-filters{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:10px}.radical-filters input{grid-column:1/-1}.radical-result-count{font-size:11px;color:#6a7a6e;margin:8px 0}.radical-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;max-height:320px;overflow:auto;overscroll-behavior:contain;padding:1px}.radical-choice{display:grid;justify-items:center;gap:2px;padding:5px 2px;border:1px solid #dce4dd;border-radius:7px;background:white;min-width:0;cursor:pointer;color:#304c39}.radical-choice[aria-pressed=true]{border-color:#5b8a68;background:#edf5ea}.radical-choice small{font:9px/1.4 var(--device-font);color:#6d7d70}.radical-choice svg{width:30px;height:30px;fill:currentColor}.radical-choice span{font:10px/1.4 var(--device-font)}.radical-add-selection{width:100%;margin-top:8px}.radical-add-selection:disabled{opacity:.45;cursor:default}.radical-group-select select{max-width:100%}

/* English four-line handwriting templates (words, boxed letters, stroke-order cards, blank paper). */
.worksheet-english{width:100%;min-width:0;flex:none;gap:0}
.english-sheet-header{height:var(--english-heading,16mm);flex:none;box-sizing:border-box;padding:0 0 2.5mm;display:flex;align-items:flex-end;justify-content:space-between;gap:8mm;font:10pt/1.3 var(--device-font);color:#243d30}
.english-sheet-header span{display:flex;align-items:baseline;white-space:nowrap}
.english-sheet-header i{display:inline-block;min-width:13mm;min-height:6mm;margin:0 1mm;border-bottom:.3mm solid #52685a;font-style:normal}
.english-sheet-header span:first-child i{min-width:44mm}
.english-line-svg,.english-cell-svg,.english-model-svg{display:block;width:100%;height:100%;overflow:hidden}
.english-line-list{display:flex;flex-direction:column;gap:var(--english-strip-gap,2.5mm);width:100%}
.english-line-row{height:var(--english-strip-height,10.2mm);width:100%;flex:none;box-sizing:border-box;break-inside:avoid}
.english-line-outer{stroke:var(--grid-color);stroke-width:1.15px;vector-effect:non-scaling-stroke}
.english-line-mid{stroke:var(--grid-color);stroke-opacity:.38;stroke-width:.9px;vector-effect:non-scaling-stroke}
.english-line-mid.english-line-dashed{stroke-opacity:.62;stroke-width:.95px;stroke-dasharray:4.5 3.2}
.english-line-rail{stroke:var(--grid-color);stroke-opacity:.72;stroke-width:1.05px;vector-effect:non-scaling-stroke}
.english-line-base{stroke:#ee9a9a;stroke-width:.95px;vector-effect:non-scaling-stroke}
.radio-card[hidden]{display:none!important}
.four-line-grid,.three-line-grid,.two-line-grid,.single-line-grid{width:56px;height:38px;border:none;position:relative}
.four-line-grid{background:linear-gradient(180deg,transparent 10%,#94a3b8 10%,#94a3b8 14%,transparent 14%,transparent 37%,#cbd5e1 37%,#cbd5e1 41%,transparent 41%,transparent 63%,#ee9a9a 63%,#ee9a9a 67%,transparent 67%,transparent 88%,#94a3b8 88%,#94a3b8 92%,transparent 92%)}
.three-line-grid{background:linear-gradient(180deg,transparent 14%,#94a3b8 14%,#94a3b8 19%,transparent 19%,transparent 76%,#94a3b8 76%,#94a3b8 81%,transparent 81%),repeating-linear-gradient(90deg,#94a3b8 0 5px,transparent 5px 9px) 0 47.5%/100% 1.5px no-repeat}
.two-line-grid{background:linear-gradient(180deg,transparent 35%,#94a3b8 35%,#94a3b8 40%,transparent 40%,transparent 67%,#64748b 67%,#64748b 72%,transparent 72%)}
.single-line-grid{background:linear-gradient(180deg,transparent 72%,#64748b 72%,#64748b 78%,transparent 78%)}
.english-word-item path{fill:none;stroke:var(--master-color);stroke-width:1.95px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.english-word-item.role-trace path{stroke:var(--trace-color)}
.english-word-item.role-trace.trace-light,.english-letter-cell.role-trace.trace-light .english-glyph{opacity:.72}
.english-word-item.role-trace.trace-normal,.english-letter-cell.role-trace.trace-normal .english-glyph{opacity:.88}
.english-word-item.role-trace.trace-dark,.english-letter-cell.role-trace.trace-dark .english-glyph{opacity:1}
.english-letter-list{display:flex;flex-direction:column;gap:var(--english-row-gap,1.5mm);width:100%}
.english-letter-row{display:grid;grid-template-columns:repeat(var(--english-columns,7),minmax(0,1fr));height:var(--english-cell-height,8.86mm);border-top:1px solid var(--grid-color);border-bottom:1px solid var(--grid-color);border-left:1px solid var(--grid-color);box-sizing:border-box;background:#fff;break-inside:avoid}
.english-letter-cell{position:relative;width:100%;min-width:0;height:100%;box-sizing:border-box;border-right:1px solid var(--grid-color);background:transparent}
.english-cell-guide{fill:none;stroke:var(--grid-color);stroke-opacity:.75;stroke-width:.85px;stroke-dasharray:3.5 2.5;vector-effect:non-scaling-stroke}
.english-letter-cell .english-glyph path{fill:none;stroke:var(--master-color);stroke-width:1.9px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.english-letter-cell.role-trace .english-glyph path{stroke:var(--trace-color)}
.english-stroke-list{display:flex;flex-direction:column;gap:var(--english-card-gap,3mm);width:100%}
.english-stroke-card{display:grid;grid-template-columns:var(--english-model-width,63mm) minmax(0,1fr);height:var(--english-card-height,35mm);border:1.15px solid var(--grid-color);box-sizing:border-box;background:#fff;break-inside:avoid}
.english-stroke-model{position:relative;width:100%;min-width:0;height:100%;box-sizing:border-box;border-right:1.15px solid var(--grid-color);background:transparent}
.english-model-ink path{fill:none;stroke:var(--master-color);stroke-width:5.2px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.english-guide-line,.english-guide-head{fill:none;stroke:#ec4899;stroke-width:1.55px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.english-guide-num{fill:none;stroke:#db2777;stroke-width:1.4px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round}
.english-stroke-practice{display:grid;grid-template-columns:repeat(var(--english-practice-cols,2),minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));min-width:0;height:100%}
.english-stroke-practice .english-letter-cell.stroke-last-col{border-right:none}
.english-stroke-practice .english-letter-cell.stroke-top-row{border-bottom:1.15px solid var(--grid-color)}
.english-stroke-practice .english-letter-cell .english-glyph path{stroke-width:2.2px}
/* Screen-only editor chrome: never change the A4 paper or exported content. */
@media screen {
.worksheet-shell-pending .app-container { visibility:hidden; }
.live-editor { --primary-color:#187765; background:#f1f3f0; color:#253a35; overflow:hidden; }
.live-editor [hidden] { display:none !important; }
.live-editor button,.live-editor input,.live-editor textarea { font:inherit; }
.live-editor button { cursor:pointer; }
.live-editor button:disabled { cursor:wait; }
.live-editor :is(button,input,textarea,select,summary,a):focus-visible { outline:3px solid #58a695; outline-offset:3px; }
.visually-hidden { position:absolute!important; width:1px; height:1px; clip-path:inset(50%); overflow:hidden; }
/* AdSense may set an inline height:auto!important on its ancestor. Keep the
   editor viewport bounded so only the controls scroll, never the export bar. */
.live-editor .app-container { height:100dvh; min-height:100vh; max-height:100vh; min-height:100dvh; max-height:100dvh; }
.live-editor .sidebar { width:360px; min-width:360px; padding:0; gap:0; overflow:hidden; box-shadow:none; border-right:1px solid #dfe6e1; }
.live-editor .sidebar-header { padding:22px 24px 18px; gap:5px; border-bottom:1px solid #e7ece8; }
.live-editor .sidebar-logo { font-size:20px; letter-spacing:.08em; color:#187765; }
.live-editor .sidebar-header h1 { font-size:12px; font-weight:400; color:#78847e; }
.live-editor .sidebar-nav { position:absolute; top:27px; left:210px; gap:12px; font-size:12px; }
.live-editor .sidebar-nav a { color:#53675f; }
.editor-scroll { flex:1 1 auto!important; min-height:0; overflow-y:auto; padding:22px 24px; overscroll-behavior:contain; scrollbar-width:thin; }
.editor-modes { margin-bottom:24px; }
.editor-modes>label { font-size:12px; color:#718178; }
.live-editor .tab-card { padding:10px 5px; min-height:62px; gap:5px; border-radius:8px; }
.live-editor .tab-card span { font-size:13px; }
.live-editor .radio-card.active { background:#edf6f1; border-color:#187765; color:#126653; }
.editor-section { margin-bottom:24px; }
.editor-section h2 { font-size:14px; font-weight:650; margin:0; }
.section-heading { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.section-heading h2 { margin-right:auto; }
.text-action { padding:7px 0; border:0; background:transparent; color:#187765; font-size:12px!important; font-weight:600!important; }
.current-scheme { display:flex; width:100%; gap:14px; padding:14px; border:1px solid #dce7df; background:#f6f9f5; border-radius:10px; align-items:center; color:inherit; text-align:left; appearance:none; }
.current-scheme:hover { border-color:#82b09b; background:#f1f8f2; }
.current-scheme strong { font-size:14px; }
.current-scheme p { font-size:11px; line-height:1.7; color:#708176; margin-top:4px; }
.scheme-grid { display:grid; grid-template-columns:repeat(2,26px); width:52px; border-top:1px solid #dca59c; border-left:1px solid #dca59c; background:white; }
.scheme-grid span { width:26px; height:26px; display:grid; place-items:center; border-right:1px solid #dca59c; border-bottom:1px solid #dca59c; background:linear-gradient(90deg,transparent 49%,#efdcd7 50%,transparent 51%),linear-gradient(transparent 49%,#efdcd7 50%,transparent 51%); font-family:var(--device-font); font-size:20px; color:#333; }
.scheme-grid .trace-char { color:#bdbdbd; }
.live-editor textarea { height:106px; min-height:90px; resize:vertical; font-size:16px; background:#fff; border-color:#dce4de; line-height:1.7; }
#editorPractice { display:flex; flex-direction:column; gap:14px; border-top:1px solid #e7ece8; padding-top:20px; }
.live-editor .control-group { gap:10px; }
.live-editor .control-group label { font-size:12px; font-weight:500; }
.live-editor .radio-card { min-height:42px; font-size:12px; border-radius:7px; }
.live-editor .radio-group { gap:6px; }
.live-editor .radio-card span { font-size:12px; }
.editor-hint { color:#74827a; font-size:12px; line-height:1.6; }
.live-editor .accordion-group { border:0; border-bottom:1px solid #e3e9e4; border-radius:0; margin:0; }
.live-editor .accordion-group summary { padding:17px 0; background:transparent; font-size:13px; gap:8px; }
.live-editor .accordion-group summary small { margin-left:auto; font-size:11px; font-weight:400; color:#74827a; }
.live-editor .accordion-content { padding:4px 0 18px; border:0; gap:18px; }
.live-editor .size-preset-chip { font-size:11px; padding:8px 5px; }
.editor-footer { display:flex; justify-content:flex-end; padding-top:8px; }
.editor-footer #resetBtn { min-height:36px; color:#78847e!important; border:0!important; background:transparent!important; }
.live-editor .actions { position:relative; bottom:auto; margin:0; padding:16px 24px; border-top:1px solid #e1e7e2; background:#fff; box-shadow:0 -8px 24px #263b3105; }
.live-editor .output-button-primary { background:#187765; border-color:#187765; }
.live-editor .output-button-primary:hover { background:#126653; }
.live-editor .preview-area { background:#edf0ec; position:relative; padding:76px 32px 54px; overflow:auto; }
.workspace-title { position:absolute; top:25px; left:32px; display:flex; flex-direction:column; gap:3px; }
.workspace-eyebrow { font-size:14px; font-weight:600; }
.live-editor .preview-toolbar { top:25px!important; right:28px!important; gap:5px!important; }
.live-editor .preview-toolbar button,.live-editor #zoomLevel { border-color:#dce4de!important; box-shadow:none!important; border-radius:6px!important; color:#576b60; }
.fit-page { font-size:12px!important; padding:0 10px; height:32px; }
.live-editor #paper { box-shadow:0 4px 8px #253a3510,0 20px 55px #253a3512; }
.preview-summary { display:none; position:fixed; bottom:23px; left:calc(360px + (100vw - 360px)/2); transform:translateX(-50%); color:#708176; font-size:12px; white-space:nowrap; pointer-events:none; }
.live-editor .info-trigger-btn { bottom:20px; }
.mobile-editor-tools { display:none; }
.editor-dialog { color:#253a35; border:1px solid #dde6df; border-radius:18px; padding:0; width:min(720px,calc(100vw - 40px)); max-width:none; max-height:85dvh; margin:auto; box-shadow:0 28px 100px #17382b30; background:#fff; }
.editor-dialog[open] { display:flex; flex-direction:column; }
.editor-dialog::backdrop { background:#1b30284d; backdrop-filter:blur(3px); }
.editor-dialog-heading { flex:none; display:flex; align-items:center; gap:16px; justify-content:space-between; padding:22px 24px; border-bottom:1px solid #e5eae6; }
.editor-dialog-heading h2 { font-size:19px; font-weight:650; }
.editor-dialog-heading .editor-hint { margin-top:6px; }
.dialog-done { color:#187765; border:1px solid #d4e4d9; background:#f3f8f4; border-radius:8px; padding:0 18px; min-height:44px; flex-shrink:0; }
.editor-dialog-body { padding:24px; overflow-y:auto; min-height:0; overscroll-behavior:contain; }
.scheme-catalog { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.scheme-card { background:white; border:1px solid #dfe6df; border-radius:10px; padding:10px; display:flex; flex-direction:column; align-items:stretch; text-align:left; gap:9px; min-width:0; transition:border-color .15s,background .15s; }
.scheme-card:hover { border-color:#82b09b; }
.scheme-card[aria-pressed=true] { background:#f1f8f2; border:2px solid #187765; padding:9px; }
.scheme-card strong { font-size:14px; }
.scheme-check { font-size:11px; color:#187765; margin-top:auto; }
.scheme-visual { height:170px; overflow:hidden; background:#edf0ec; border-radius:6px; display:flex; justify-content:center; position:relative; pointer-events:none; }
.scheme-miniature.a4-paper { position:absolute; top:6px; width:210mm; height:297mm; transform:scale(.14); transform-origin:top center; flex-shrink:0; box-shadow:none; }
.material-search { width:100%; padding:12px 14px; border:1px solid #dce4de; border-radius:8px; font-size:16px!important; margin-bottom:20px; }
#materialDialog #resetBtn,#materialDialog #saveTemplateBtn { display:none; }
#materialDialog .template-list { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
#materialDialog .template-chip { text-align:left; white-space:normal; padding:14px; font-size:14px; border:1px solid #dfe6df; border-radius:8px; background:#fff; line-height:1.5; color:#253a35; min-width:0; }
#materialDialog .template-chip:hover,#materialDialog .template-chip.active { border-color:#187765; background:#f1f8f2; }
.material-excerpt { display:block; font-size:12px; color:#75837b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:6px; pointer-events:none; }
.editor-dialog .editor-section { margin-bottom:0; }
#editorPanel .editor-dialog-body>.editor-section>h2,#editorPanel .section-heading h2 { display:none; }
}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
.live-editor .sidebar { position:static; width:0; min-width:0; height:0; border:0; overflow:visible; padding:0; }
.live-editor .sidebar-header { position:fixed; top:0; left:0; height:66px; width:100%; padding:16px 18px; background:#fff; border-bottom:1px solid #e1e7e2; z-index:20; }
.live-editor .sidebar-header h1,.live-editor .sidebar-nav { display:none; }
.live-editor .sidebar-logo { font-size:18px; width:max-content; }
.live-editor .sidebar-logo img { width:32px; height:32px; }
.live-editor .editor-scroll { display:none; }
.live-editor .actions { position:fixed; z-index:25; top:9px; right:12px; bottom:auto; width:148px; padding:0; border:0; box-shadow:none; border-radius:12px; }
.live-editor .actions .output-generate { min-height:46px; font-size:13px; }
.live-editor .actions>.export-status { display:none; }
.live-editor .actions:has(.export-status[role=alert])>.export-status { display:block; padding:8px; background:#fff4f0; border-radius:8px; }
.live-editor .actions[data-output-state=ready] { top:72px; left:12px; right:12px; width:auto; padding:16px; box-shadow:0 12px 40px #193a2926; border:1px solid #dce4de; }
.live-editor .preview-area { width:100%; height:calc(100dvh - 66px - 74px - env(safe-area-inset-bottom)); flex:0 0 auto; margin-top:66px; padding:70px 16px 40px; }
.workspace-title { top:16px; left:18px; }
.workspace-title .editor-hint { display:none; }
.live-editor .preview-toolbar { top:10px!important; right:12px!important; gap:2px!important; }
.live-editor .preview-toolbar button { min-width:38px; min-height:44px; }
.live-editor #zoomInBtn,.live-editor #zoomOutBtn,.live-editor #zoomLevel { display:none!important; }
.live-editor .preview-toolbar { max-width:calc(100% - 24px); flex-wrap:nowrap; z-index:12!important; }
.live-editor .fit-page { min-width:74px; }
.preview-summary { display:block; position:fixed; left:50%; bottom:calc(92px + env(safe-area-inset-bottom)); font-size:11px; }
.mobile-editor-tools { display:grid; grid-template-columns:repeat(4,1fr); position:fixed; bottom:0; left:0; right:0; height:calc(74px + env(safe-area-inset-bottom)); padding:6px 12px calc(6px + env(safe-area-inset-bottom)); background:#fff; border-top:1px solid #dfe6e1; z-index:30; }
.mobile-editor-tools button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; border:0; border-radius:8px; background:transparent; color:#53675f; font-size:11px; min-height:44px; }
.mobile-editor-tools button:active { background:#edf6f1; color:#187765; }
.tool-symbol { font-family:var(--device-font); font-size:20px; line-height:25px; }
.live-editor .info-trigger-btn { bottom:calc(88px + env(safe-area-inset-bottom)); right:12px; min-height:36px; font-size:11px; }
.editor-dialog { width:100%; max-height:var(--editor-viewport-height,100dvh); border:0; border-radius:18px 18px 0 0; position:fixed; inset:auto 0 0; margin:0; }
#editorPanel { height:min(66dvh,var(--editor-viewport-height,100dvh)); }
#editorPanel[data-panel=内容],#schemeDialog,#materialDialog { height:var(--editor-viewport-height,100dvh); border-radius:0; }
.editor-dialog-heading { padding:16px 18px; }
.editor-dialog-heading h2 { font-size:18px; }
.editor-dialog-heading .editor-hint { font-size:11px; }
.editor-dialog-body { padding:20px 18px max(24px,env(safe-area-inset-bottom)); }
.scheme-catalog { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
#materialDialog .template-list { grid-template-columns:1fr; }
#editorPanel textarea { min-height:180px; font-size:16px; }
.editor-dialog input[type=text] { font-size:16px!important; }
.editor-dialog .radio-card,.editor-dialog .size-preset-chip,.editor-dialog .color-btn { min-height:44px; }
.editor-dialog .text-action { min-height:44px; font-size:13px!important; }
.editor-dialog .control-group label { font-size:14px; }
.editor-dialog .editor-modes { margin-bottom:20px; }
}
@media screen and (max-height:500px) and (max-width:1024px) {
#editorPanel { height:var(--editor-viewport-height,100dvh); border-radius:0; }
.editor-dialog-heading .editor-hint { display:none; }
}
@media (prefers-reduced-motion:reduce) {
.live-editor *, .live-editor *::before,.live-editor *::after { transition:none!important; animation:none!important; }
}
@media print {
.editor-dialog,.mobile-editor-tools,.workspace-title,.preview-summary { display:none!important; }
}
@media screen {
.live-editor .tab-card.active svg { color:#187765; }
.live-editor .fit-page { border:1px solid #dce4de; background:#fff; }
}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
.editor-dialog { bottom:var(--editor-viewport-bottom,0px); }
.live-editor .info-trigger-btn { font-size:0; padding:8px; width:36px; height:36px; }
.live-editor .info-trigger-btn svg { width:18px; height:18px; }
}
@media screen {
#editorPanel::backdrop { background:rgba(27,48,40,.08); backdrop-filter:none; }
}

/* Color choices share one compact, labelled treatment across mouse and touch. */
@media screen {
.live-editor .tab-card.active svg { stroke:currentColor; }
.live-editor .radio-card { position:relative; box-shadow:none; }
.live-editor .radio-card.active { background:#f0f6f3; border-color:#187765; box-shadow:inset 0 0 0 1px #187765; }
.live-editor .color-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; gap:8px; }
.live-editor :is(.color-btn,.custom-color-wrapper) {
    position:relative; display:flex; align-items:center; gap:9px; min-width:0;
    height:44px; min-height:44px; padding:0 28px 0 12px; margin:0;
    border:1px solid #d9e3dc; border-radius:8px; background:#fff;
    color:#40574c; font-size:12px; font-weight:500; line-height:1.3;
    text-indent:0; text-align:left; overflow:hidden;
    box-shadow:none; transform:none; transition:background .15s,border-color .15s;
}
.live-editor :is(.color-btn,.custom-color-wrapper)::before {
    content:''; width:18px; height:18px; flex:0 0 18px; border-radius:50%;
    background:var(--swatch); border:1px solid #0002; pointer-events:none;
}
.live-editor :is(.color-btn,.custom-color-wrapper):hover { background:#f6f9f7; border-color:#9fb5a8; box-shadow:none; transform:none; }
.live-editor :is(.color-btn,.custom-color-wrapper).active { background:#edf5f0; border-color:#187765; box-shadow:none; transform:none; }
.live-editor :is(.color-btn,.custom-color-wrapper).active::after {
    content:'✓'; position:absolute; right:10px; top:50%; transform:translateY(-50%);
    font-size:14px; font-weight:700; color:#187765; pointer-events:none;
}
.live-editor .custom-color-wrapper:last-child:nth-child(odd) { grid-column:1/-1; }
.live-editor .custom-color-hint { position:static; display:block; color:inherit; font:inherit; text-shadow:none; pointer-events:none; }
.live-editor .custom-color-picker {
    position:absolute; inset:0; z-index:1; display:block;
    width:100%; height:100%; min-width:0; padding:0; margin:0; border:0;
    opacity:0; cursor:pointer;
}
.live-editor .custom-color-wrapper:focus-within,.live-editor .color-btn:focus-visible {
    outline:2px solid #187765; outline-offset:-3px;
}
}

/* Keep mode switching visible even when all mobile editing panels are closed. */
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
.live-editor .sidebar>.editor-modes { position:fixed; top:66px; left:0; right:0; z-index:20; margin:0; padding:6px 12px; height:56px; background:#fff; border-bottom:1px solid #dfe6e1; }
.live-editor .sidebar>.editor-modes>label,.live-editor .sidebar>.editor-modes svg { display:none; }
.live-editor .sidebar>.editor-modes .tab-card { min-height:44px; height:44px; padding:0 3px; justify-content:center; }
.live-editor .sidebar>.editor-modes .tab-card span { font-size:12px; white-space:nowrap; }
.live-editor .preview-area { margin-top:122px; height:calc(100dvh - 122px - 74px - env(safe-area-inset-bottom)); }
.live-editor .actions[data-output-state=ready] { top:128px; }
.mobile-editor-tools { gap:8px; }
.mobile-editor-tools button { background:#f2f7f4; border:1px solid #d7e5dc; color:#275f4b; font-size:12px; font-weight:600; gap:3px; }
.mobile-editor-tools button:active { background:#dcefe3; border-color:#187765; }
.mobile-editor-tools .tool-symbol { display:flex; align-items:center; justify-content:center; height:23px; }
}
@media screen {
.quick-materials { margin-top:16px; }
.quick-material-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:10px; }
.quick-material { min-height:40px; padding:8px 5px; border:1px solid #dce6df; border-radius:7px; background:#f6f9f7; color:#365e4b; font-size:12px!important; line-height:1.4; }
.quick-material:hover,.quick-material[aria-pressed=true] { border-color:#187765; background:#eaf4ee; }
.material-applied { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; color:#187765; margin-top:8px; }
.ai-practice-guide { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:42px; margin-top:10px; padding:10px 12px; border:1px solid #d5e5dc; border-radius:8px; background:#eef6f1; color:#176b56; font-size:12px; font-weight:600; line-height:1.5; text-decoration:none; }
.ai-practice-guide:hover { border-color:#82b09b; background:#e4f1e9; }
.scheme-current-summary { margin:20px 0 14px; font-size:13px; line-height:1.7; color:#496453; }
.scheme-fine-tune { border-top:1px solid #dce6df; }
.scheme-fine-tune>summary { padding:18px 0; cursor:pointer; font-size:14px; font-weight:600; color:#275f4b; }
.scheme-fine-tune #editorPractice { border-top:0; padding-top:0; }

}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
.mobile-editor-tools { grid-template-columns:repeat(3,minmax(0,1fr)); }
#editorPanel[data-panel=内容] { height:var(--editor-viewport-height,100dvh); border-radius:0; }
#editorPanel[data-panel=内容]:has(textarea:focus,input:focus) { height:var(--editor-viewport-height,100dvh); border-radius:0; }
#editorPanel textarea { min-height:90px; height:100px; }
.quick-material { min-height:44px; }
}

/* Separate choosing a layout from fine adjustment of the live page. */
@media screen {
.live-editor button { -webkit-appearance:none; }
.scheme-card { color:#253a35; gap:10px; padding:12px; border-radius:12px; }
.scheme-card[aria-pressed=true] { padding:11px; }
.scheme-card strong { color:#253a35; font-size:15px; }
.scheme-card .editor-hint { font-size:12px; }
.scheme-visual { height:190px; background:#edf1ee; }
.scheme-miniature.a4-paper { top:8px; transform-origin:top left; border-radius:0; }
.scheme-miniature .worksheet-document,.scheme-miniature .worksheet-page { height:100%; }
.scheme-miniature .worksheet-page { min-height:0; }
.scheme-miniature .worksheet-character { font-size:44px; }
.scheme-miniature .worksheet-poetry { height:auto; grid-template-rows:auto; }
.scheme-miniature .worksheet-poetry.poetry-split2 { grid-template-rows:repeat(2,auto); }
.scheme-miniature .worksheet-poetry.poetry-split2 .worksheet-block { width:72%; }
.scheme-miniature .worksheet-poetry.poetry-quadrant { grid-template-rows:repeat(2,auto); }
.scheme-footer { display:flex; align-items:center; gap:16px; justify-content:space-between; padding:18px 24px; border-top:1px solid #e1e8e3; background:#f7faf8; flex-shrink:0; }
#schemeDialog .editor-dialog-body { flex:1 1 auto; }
.scheme-footer .scheme-current-summary { margin:0; font-size:12px; }
.tune-action { min-height:44px; white-space:nowrap; padding:0 18px; border:1px solid #187765; border-radius:8px; background:#187765; color:#fff; font-size:13px; font-weight:650; }
.tune-action:hover { background:#126653; border-color:#126653; }
#fineTuneDialog { width:min(460px,calc(100vw - 32px)); }
#fineTuneDialog::backdrop { background:#1b302808; backdrop-filter:none; }
#fineTuneDialog #editorPractice { padding:0; margin:0; border:0; }
.preview-summary { border:1px solid #d6e3da; border-radius:20px; padding:7px 12px; background:#f7faf8; pointer-events:auto; color:#436b56; }
.editor-dialog-heading h2:focus { outline:none; }
}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
.live-editor .sidebar-header { border-bottom:0; }
#editorPanel[data-panel=内容] { height:var(--editor-viewport-height,100dvh); border-radius:0; }
#editorPanel[data-panel=内容] textarea { height:148px; }
.scheme-footer { padding:14px 18px max(14px,env(safe-area-inset-bottom)); gap:12px; }
.scheme-footer .scheme-current-summary { max-width:210px; line-height:1.6; }
#schemeDialog .editor-dialog-body { padding:14px; }
.scheme-catalog { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.scheme-card { padding:9px; gap:8px; }
.scheme-card[aria-pressed=true] { padding:8px; }
.scheme-card strong { font-size:14px; }
.scheme-card .editor-hint { font-size:11px; line-height:1.45; }
.scheme-visual { height:150px; }
.tune-action { min-width:132px; }
#fineTuneDialog { width:100%; height:min(320px,42dvh); max-height:var(--editor-viewport-height,100dvh); border-radius:18px 18px 0 0; }
#fineTuneDialog .editor-dialog-heading { padding:12px 18px; }
#fineTuneDialog .editor-dialog-heading .editor-hint { display:none; }
#fineTuneDialog .editor-dialog-body { padding:16px 18px max(20px,env(safe-area-inset-bottom)); }
.live-editor.fine-tuning .preview-area { height:calc(100dvh - 122px - min(320px,42dvh)); padding-top:56px; padding-bottom:12px; }
.live-editor.fine-tuning .preview-summary,.live-editor.fine-tuning .info-trigger-btn { visibility:hidden; }
}

/* Optional printed footer, alongside other page appearance settings. */
.reprint-setting { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0 4px; cursor: pointer; }
.reprint-setting input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: #476556; }
.reprint-setting strong { display: block; font-size: 13px; font-weight: 500; color: #39473f; }
.reprint-setting small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; line-height: 1.6; color: #7c837e; }

.reprint-tip-editor label { display: block; font-size: 12px; color: #59665e; margin-bottom: 8px; }
.reprint-tip-editor textarea { width: 100%; box-sizing: border-box; min-height: 76px; resize: vertical; padding: 10px 12px; border: 1px solid #dce4de; border-radius: 8px; font: inherit; font-size: 13px; line-height: 1.6; background: #fff; }
.reprint-tip-editor small { display: block; margin-top: 6px; color: #7c837e; font-size: 11px; line-height: 1.6; }

.editor-modes .radio-group{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}

.semantic-tune{display:grid;gap:10px;margin:12px 0}.semantic-tune-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(150px,1.2fr);align-items:center;gap:12px;min-height:44px;color:#39473f;font-size:13px}.semantic-tune-row select{width:100%;min-height:44px;padding:8px 34px 8px 10px;border:1px solid #d4dfd8;border-radius:8px;background:#fff;color:#243a31;font:inherit}.semantic-tune-row select:focus-visible{outline:3px solid #b9ddcb;outline-offset:2px}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse){
.editor-modes .radio-group{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px!important;overflow:visible}
.semantic-tune-row{grid-template-columns:1fr;gap:5px}.semantic-tune-row select{min-height:44px}
}

.practice-settings #editorPractice{border-top:0;padding-top:4px;margin:0;padding-bottom:18px}
@media(max-width:768px),(max-width:1024px) and (pointer:coarse){.practice-settings{display:none}}

/* Extra practice types live in a compact mobile sheet. */
@media screen {
.live-editor .more-mode-button{display:none;appearance:none;-webkit-appearance:none;background:transparent;color:#334155;-webkit-text-fill-color:currentColor;-webkit-tap-highlight-color:transparent}
.live-editor .more-mode-button:active{background:#edf6f1}
.mode-catalog{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.mode-choice{display:flex;flex-direction:column;align-items:flex-start;gap:10px;min-width:0;min-height:154px;padding:18px;border:1px solid #dbe6df;border-radius:12px;background:#fff;color:#253a35;text-align:left}
.mode-choice svg{width:24px;height:24px;color:#187765}
.mode-choice strong{font-size:15px;font-weight:600}
.mode-choice-description{font-size:12px;line-height:1.7;color:#718178}
.mode-choice-status{font-size:11px;color:#187765;margin-top:auto}
.mode-choice[aria-pressed=true]{border-color:#187765;background:#f0f7f2;box-shadow:inset 0 0 0 1px #187765}
#modeDialog .editor-dialog-body{padding-top:6px}
}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse){
.live-editor .sidebar>.editor-modes .tab-card[data-mobile-secondary]{display:none}
.live-editor .sidebar>.editor-modes .more-mode-button{display:flex;flex-direction:row;gap:2px;padding:0;min-width:0;font-weight:500}
.more-mode-arrow{font-size:10px!important;color:inherit;opacity:.75}
#modeDialog{max-height:min(70dvh,var(--editor-viewport-height,100dvh));padding-bottom:env(safe-area-inset-bottom)}
}
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse){.live-editor .sidebar>.editor-modes .more-mode-arrow svg{display:block;width:10px;height:10px}.more-mode-arrow{display:flex;align-items:center}}
@media screen and (max-width:360px){
.live-editor .output-main-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.live-editor .output-main-actions .output-button{font-size:13px;padding:12px 8px;gap:6px}
.live-editor .sidebar>.editor-modes .tab-card .more-mode-label{font-size:11px}
.live-editor .sidebar>.editor-modes .more-mode-button{gap:1px}
.live-editor .sidebar>.editor-modes .more-mode-arrow svg{width:8px;height:8px}
}
.promotion-mobile { display:none; }
.promotion-desktop { flex:0 0 300px; width:300px; padding:20px 12px; background:#fff; border-left:1px solid #e6ebe7; overflow-y:auto; }
.promotion-label { margin-bottom:12px; font-size:11px; line-height:16px; color:#78847e; text-align:center; }
.promotion-desktop .adsbygoogle { width:100%; }
.live-editor .preview-area { min-width:0; }
@media screen and (max-width:768px), screen and (max-width:1024px) and (pointer:coarse) {
    .promotion-desktop { display:none; }
    .promotion-mobile { display:block; width:100%; min-width:0; max-width:100%; contain:inline-size; border-top:1px solid #e6ebe7; padding-top:20px; margin-top:6px; }
    .live-editor .actions[data-output-state=ready] { min-width:0; max-width:calc(100% - 24px); max-height:calc(100dvh - 216px - env(safe-area-inset-bottom)); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
    .promotion-mobile .adsbygoogle { min-width:0; }
    .live-editor .actions .export-result { min-width:0; max-width:100%; }
}
@media print { .promotion-mobile,.promotion-desktop { display:none!important; } }
/* Decorative interface icons inherit the text color and keep fixed vector geometry. */
.ui-icon{display:inline-block;width:1.1em;height:1.1em;vertical-align:-.15em;flex-shrink:0;pointer-events:none}
