*,.a4-page {
    box-sizing: border-box
}

.a4-page,.app-layout,.meta-item,.page-meta,body {
    display: flex
}

.a4-page,.sidebar {
    background-color: #fff
}

* {
    margin: 0;
    padding: 0
}

body {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    flex-direction: column;
    min-height: 100vh
}

.app-layout {
    flex: 1;
    width: 100%
}

.preview-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center
}

.a4-page {
    width: 210mm;
    min-height: 297mm;
    padding: 15mm;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);
    margin-bottom: .5rem;
    position: relative;
    flex-direction: column;
}

.page-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #374151;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #111827;
    margin-bottom: 12px;
}

.page-meta {
    justify-content: space-between;
    font-size: 14px;
    color: #4b5563;
    padding: 0 10px;
}

.meta-item {
    align-items: flex-end;
}

.underline-space {
    display: inline-block;
    border-bottom: 1px solid #4b5563;
    min-width: 80px;
    height: 18px;
    margin-left: 4px;
}

.math-grid {
    display: grid;
    width: 100%;
    gap: 20px 20px;
    flex-grow: 1
}
/* 3列网格（适合较短题目） */
    .grid-col-3 {
      grid-template-columns: repeat(3, 1fr);
    }

    /* 2列网格（适合项数较多、长度较长的题目） */
    .grid-col-2 {
      grid-template-columns: repeat(2, 1fr);
    }
	
.grid-col-3 span {
    padding-right: 3px !important;
}

.grid-standard {
    grid-template-columns: repeat(4,1fr);
    align-content: start
}

.grid-fill {
    grid-template-columns: repeat(3,1fr);
    align-content: start
}

.problem-item {
    font-size: 18px;
    font-family: "Courier New",Courier,monospace;
    font-weight: 600;
    padding: 8px 1px;
    display: flex;
    align-items: center;
    white-space: nowrap
}
.problem-item span {
    padding-right: 4px;
}


.problem-no {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #9ca3af;
    margin-right: 0;
    user-select: none;
    min-width: 22px;
    display: inline-block
}

.blank-box {
    display: inline-block;
    width: 36px;
    height: 28px;
    border: 1.5px solid #4b5563;
    border-radius: 4px;
    vertical-align: middle;
    margin: 0 2px;
    text-align: center;
    line-height: 26px;
    font-size: 16px
}

.answer-text {
    padding-left: 5px;
    color: #dc2626;
    font-weight: 700
}

.grid-vertical {
    grid-template-columns: repeat(5,1fr);
    gap: 24px 15px;
    align-content: start
}

.vertical-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: "Courier New",Courier,monospace;
    font-size: 20px;
    font-weight: 700;
    width: 85px;
    margin: 0 auto;
    padding: 5px;
    position: relative
}

.vertical-item .problem-no {
    position: absolute;
    top: -2px;
    left: -8px;
    font-size: 12px
}

.vertical-row {
    width: 100%;
    text-align: right;
    line-height: 1.2
}

.vertical-operator-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #000;
    padding-bottom: 2px;
    line-height: 1.2
}

.vertical-answer {
    width: 100%;
    text-align: right;
    padding-top: 4px;
    min-height: 28px;
    color: #dc2626
}


.sidebar {
    width: 340px;
    border-left: 1px solid #e2e8f0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: -2px 0 10px rgba(0,0,0,.03);
    z-index: 10
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .75rem;
    border-bottom: 2px solid #f1f5f9
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a
}

.btn,.form-label,.lang-btn {
    font-weight: 600
}

.lang-switcher-container {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 3px
}

.lang-btn {
    border: none;
    background: 0 0;
    padding: 4px 10px;
    font-size: .75rem;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: .2s
}

.btn,.form-label,.input-number {
    font-size: .875rem
}

.lang-btn.active {
    background-color: #2563eb;
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,.3)
}

.checkbox-group,.form-group,.radio-group {
    display: flex;
    flex-direction: column;
    gap: .5rem
}

.form-label {
    color: #334155
}

.checkbox-label,.radio-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: #475569;
    cursor: pointer;
    user-select: none
}

.checkbox-label input,.radio-label input {
    width: 1rem;
    height: 1rem;
    accent-color: #2563eb;
    cursor: pointer
}

.input-number {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #cbd5e1;
    border-radius: .375rem;
    outline: 0;
    transition: border-color .2s
}

.input-number:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,.2)
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: .5rem
}

.btn {
    width: 100%;
    padding: .625rem 1rem;
    border-radius: .375rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: .2s
}

.btn-primary {
    background-color: #2563eb;
    color: #fff
}

.btn-primary:hover {
    background-color: #1d4ed8
}

.btn-success {
    background-color: #059669;
    color: #fff
}

.btn-success:hover {
    background-color: #047857
}
.paper-footer {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: auto;
    padding-top: 10px;
    letter-spacing: 1px;
}
.footer-copyright {
    text-align: center;
    padding: 16px 0;
    margin-top: auto;
    font-size: 13px;
    color: #64748b;
    background-color: #fff;
    border-top: 1px solid #e2e8f0;
    width: 100%
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction:column-reverse
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-bottom: 1px solid #e2e8f0
    }

    .preview-container {
        padding: 1rem;
        overflow-x: auto
    }
}

@media print {
    body {
        background-color: #fff;
        display: block
    }

    .footer-copyright,.sidebar {
        display: none!important
    }

    .preview-container {
        padding: 0;
        overflow: visible
    }

    .a4-page {
        box-shadow: none;
        margin: 0;
        width: 210mm;
        height: 297mm;
        page-break-after: always
    }

    .answer-text,.vertical-answer {
        color: #000!important
    }

    .problem-no {
        color: #a1a1aa!important
    }
}
