* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
    background: #f0f2f5;
    color: #222;
}

header {
    background: linear-gradient(135deg, #1a3a6b, #2b5ea7);
    color: #fff;
    padding: 18px 32px;
}
header h1 { font-size: 22px; }
.subtitle { font-size: 13px; opacity: .85; margin-top: 4px; }

main {
    display: grid;
    grid-template-columns: 300px 1fr 340px;
    gap: 16px;
    padding: 16px;
    align-items: start;
}

.panel {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.panel h2 {
    font-size: 15px;
    color: #1a3a6b;
    margin: 16px 0 8px;
    border-left: 4px solid #2b5ea7;
    padding-left: 8px;
}
.panel h2:first-child { margin-top: 0; }

select, input[type="number"], input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 8px;
}
input[type="number"] { width: 80px; display: inline-block; }

.param-row { margin-bottom: 8px; font-size: 13px; }
.param-row label { display: block; margin-bottom: 4px; color: #555; }

button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
}
.btn-primary { background: #2b5ea7; color: #fff; }
.btn-primary:hover { background: #1f4a87; }
.btn-secondary { background: #e8ebf0; color: #333; }
.btn-secondary:hover { background: #d8dce3; }

/* 图像区 */
.image-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.img-box h3 {
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
    color: #444;
}
.img-wrap {
    border: 1px dashed #bbb;
    border-radius: 8px;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #fafafa;
}
canvas { max-width: 100%; height: auto; }
.img-box p { font-size: 12px; color: #888; text-align: center; margin-top: 6px; }

/* 矩阵区 */
.matrix-step {
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fcfdff;
}
.matrix-step h3 {
    font-size: 13px;
    color: #1a3a6b;
    margin-bottom: 8px;
}
.formula {
    font-size: 13px;
    line-height: 1.8;
    text-align: center;
    font-family: "Cambria Math", serif;
}
.step-note {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 6px;
}
.substitution {
    font-size: 12px;
    color: #b26a00;
    background: #fff8e6;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 8px;
    font-family: Consolas, monospace;
}
.matrix-table {
    border-collapse: collapse;
    margin: 6px auto;
    border-left: 3px solid #333;
    border-right: 3px solid #333;
}
.matrix-table td {
    width: 64px;
    height: 40px;
    text-align: center;
    font-size: 14px;
    font-family: Consolas, monospace;
    border: 1px solid #e0e0e0;
}
.symbolic-table td { color: #555; font-size: 13px; }
.matrix-table tr td:first-child { border-left: none; }
.matrix-table tr td:last-child { border-right: none; }

.matrix-info {
    background: #f5f8fc;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.9;
}
.matrix-info span { color: #2b5ea7; font-family: Consolas, monospace; }

.point-demo { font-size: 13px; line-height: 1.8; }
.point-demo label { margin-right: 8px; }
#pointResult {
    margin-top: 6px;
    background: #fff8e6;
    padding: 8px;
    border-radius: 6px;
    font-family: Consolas, monospace;
    font-size: 12px;
    min-height: 32px;
}

.knowledge {
    margin-top: 16px;
    background: #f0f7f0;
    border-radius: 8px;
    padding: 12px;
}
.knowledge h3 { font-size: 13px; color: #2e7d32; margin-bottom: 6px; }
.knowledge ul { padding-left: 18px; font-size: 12px; line-height: 1.9; color: #444; }
.knowledge em { color: #c62828; font-style: normal; }

/* 复合变换序列 */
.sequence-list {
    list-style: none;
    margin: 8px 0;
    max-height: 220px;
    overflow-y: auto;
}
.sequence-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f8fc;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 12px;
}
.step-text { flex: 1; }
.del-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0 0 0 6px;
    background: #e53935;
    color: #fff;
    font-size: 14px;
    line-height: 1;
}
.del-btn:hover { background: #c62828; }

/* 复合矩阵标题与紧凑矩阵 */
.combo-title {
    font-size: 11px;
    color: #555;
    margin: 8px 0 4px;
}
.mini-matrix td { width: 56px; height: 34px; font-size: 12px; }
.combo-matrix td { width: 52px; height: 30px; font-size: 11px; }
.combo-matrix { margin-bottom: 4px; }
