@layer muxin-legacy {
:root {
            --primary: #d61f1f;
            --primary-strong: #9f1111;
            --accent: #151515;
            --panel-span-width: 1040px;
            --viewer-dock-width: clamp(560px, 42vw, 760px);
            --bg: #ece6e1;
            --surface: rgba(255, 252, 249, 0.92);
            --surface-strong: #fffdfa;
            --surface-soft: #f8f2ee;
            --text: #1c1714;
            --muted: #75675f;
            --success: #0f766e;
            --border: #e0d5cd;
            --border-strong: #cdbdb2;
            --wall-color: #1c1714;
            --label-color: #1c1714;
            --guide-color: #d61f1f;
            --guide-text-color: #d61f1f;
            --angle-color: #9a6b3e;
        }
        body {
            font-family: 'Segoe UI Variable Text', 'Microsoft YaHei UI', 'PingFang SC', sans-serif;
            background:
                linear-gradient(rgba(214, 31, 31, 0.04) 1px, transparent 1px),
                linear-gradient(90deg, rgba(214, 31, 31, 0.04) 1px, transparent 1px),
                radial-gradient(circle at top, rgba(214, 31, 31, 0.1), transparent 34%),
                linear-gradient(180deg, #f8f4ef 0%, #ece6e1 100%);
            background-size: 28px 28px, 28px 28px, auto, auto;
            color: var(--text);
            margin: 0;
            padding: 20px 14px 30px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 100vh;
            transition: padding-right 0.28s ease, justify-content 0.28s ease;
        }
        body.reference-dock-open {
            justify-content: flex-start;
            padding-right: calc(var(--viewer-dock-width) + 14px);
        }
        .container {
            background: rgba(255, 252, 249, 0.95);
            width: 100%;
            max-width: 1140px;
            border-radius: 22px;
            border: 1px solid rgba(255,255,255,0.88);
            box-shadow: 0 24px 60px rgba(46, 29, 20, 0.12);
            overflow: hidden;
            padding-bottom: 16px;
            backdrop-filter: blur(8px);
            transition: max-width 0.28s ease, box-shadow 0.28s ease;
        }
        body.reference-dock-open .container {
            width: 100%;
            max-width: min(1140px, calc(100vw - var(--viewer-dock-width) - 24px));
        }
        body.reference-dock-open .diagram-workbench {
            grid-template-columns: 1fr;
        }
        body.reference-dock-open .reference-panel {
            display: none;
        }
        header {
            position: relative;
            display: grid;
            grid-template-columns: minmax(170px, 204px) 1fr;
            gap: 10px;
            align-items: center;
            background:
                radial-gradient(circle at top right, rgba(214, 31, 31, 0.12), transparent 42%),
                linear-gradient(180deg, rgba(255,252,249,0.98) 0%, rgba(248,242,238,0.98) 100%);
            color: var(--text);
            padding: 10px 12px 9px;
            text-align: left;
            border-bottom: 1px solid #e4d8d0;
        }
        header::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(90deg, var(--primary) 0%, #f36b55 58%, #1c1714 100%);
        }
        header h1 {
            margin: 0;
            padding-top: 0;
            font-size: 1.26rem;
            letter-spacing: 0.04em;
            font-family: 'Bahnschrift SemiCondensed', 'Segoe UI Variable Display', 'Microsoft YaHei UI', sans-serif;
        }
        header p {
            margin: 3px 0 0;
            color: var(--muted);
            font-size: 0.75rem;
            letter-spacing: 0.03em;
            opacity: 1;
        }
        .brand-lockup {
            display: flex;
            gap: 8px;
            align-items: center;
            justify-content: flex-start;
            padding: 5px 7px;
            background: rgba(255, 255, 255, 0.66);
            border: 1px solid rgba(214, 31, 31, 0.12);
            border-radius: 15px;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
            user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
        }
        .brand-mark {
            width: 58px;
            aspect-ratio: 1;
            flex: 0 0 auto;
        }
        .brand-mark img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            max-width: none;
            display: block;
            -webkit-user-drag: none;
            user-drag: none;
            pointer-events: none;
        }
        .brand-copy {
            display: block;
            text-align: left;
        }
        .brand-name {
            font-size: 1.16rem;
            font-weight: 800;
            letter-spacing: 0.1em;
            color: var(--accent);
            line-height: 1;
        }
        .brand-subtitle {
            margin-top: 2px;
            font-size: 0.48rem;
            font-weight: 700;
            letter-spacing: 0.18em;
            color: var(--muted);
        }
        .brand-meta {
            padding-top: 0;
        }
        .brand-developer {
            margin-top: 4px;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            color: var(--muted);
        }
        .brand-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-bottom: 5px;
            padding: 4px 8px;
            border-radius: 999px;
            background: rgba(214, 31, 31, 0.09);
            color: var(--primary-strong);
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }
        .brand-badge::before {
            content: "";
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: var(--primary);
            box-shadow: 0 0 0 4px rgba(214, 31, 31, 0.12);
        }
        .content { padding: 16px 18px 18px; }
        .filter-row {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px;
            margin-bottom: 10px;
        }
        .filter-row,
        .control-row,
        .control-note,
        .diagram-workbench,
        #diamond-inputs,
        #lshape-inputs,
        .action-row,
        .glass-data-input-row,
        .result-area {
            width: 100%;
            max-width: var(--panel-span-width);
            margin-left: auto;
            margin-right: auto;
        }
        .form-group {
            display: flex;
            flex-direction: column;
            position: relative;
            min-width: 0;
            gap: 5px;
        }
        .filter-row > .form-group {
            padding: 9px 10px 10px;
            background: rgba(255,255,255,0.72);
            border: 1px solid #dde6ee;
            border-radius: 15px;
            box-shadow: 0 8px 16px rgba(15, 23, 42, 0.03);
        }
        label {
            display: block;
            margin-bottom: 0;
            font-weight: 700;
            font-size: 0.72rem;
            color: var(--muted);
            letter-spacing: 0.06em;
            line-height: 1.25;
        }
        input, select {
            width: 100%;
            padding: 9px 10px;
            border: 1px solid var(--border);
            border-radius: 11px;
            font-size: 0.89rem;
            box-sizing: border-box;
            transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
            background: rgba(255,255,255,0.98);
            color: var(--text);
            box-shadow: none;
        }
        input:hover, select:hover {
            border-color: var(--border-strong);
        }
        input:focus, select:focus {
            border-color: rgba(11, 101, 127, 0.62);
            outline: none;
            box-shadow: 0 0 0 3px rgba(11, 101, 127, 0.10);
            transform: translateY(-1px);
        }
        .searchable-select {
            position: relative;
            z-index: 2;
        }
        .options-list {
            position: absolute;
            top: calc(100% + 6px);
            left: 12px;
            right: 12px;
            background: rgba(255,255,255,0.98);
            border: 1px solid rgba(11, 101, 127, 0.16);
            border-radius: 14px;
            max-height: 220px;
            overflow-y: auto;
            z-index: 100;
            display: none;
            box-shadow: 0 18px 30px rgba(15, 23, 42, 0.10);
            backdrop-filter: blur(8px);
        }
        .options-list.show { display: block; }
        .option-item {
            padding: 9px 12px;
            cursor: pointer;
            font-size: 0.89rem;
            border-bottom: 1px solid #edf2f7;
        }
        .option-item:hover {
            background-color: #eef6f8;
            color: var(--primary);
        }
        .option-item.active {
            background-color: #dceef3;
            color: var(--primary-strong);
            font-weight: 700;
        }
        .option-item:last-child { border-bottom: none; }
        .input-row { display: flex; gap: 8px; margin-bottom: 12px; }
        .input-row > .form-group {
            flex: 1 1 0;
        }

        .btn-calc {
            width: 100%;
            padding: 10px 12px;
            background: linear-gradient(135deg, #0e728d 0%, #0a596f 100%);
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 0.91rem;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
            margin-top: 4px;
            letter-spacing: 0.03em;
            box-shadow: 0 12px 22px rgba(11, 101, 127, 0.16);
        }
        .btn-calc:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 15px 28px rgba(11, 101, 127, 0.20);
        }
        .btn-calc:disabled {
            background: #edf3f7;
            color: #788696;
            border: 1px dashed #c7d2dd;
            box-shadow: none;
            cursor: not-allowed;
        }
        .action-row {
            display: flex;
            gap: 8px;
            margin-top: 4px;
        }
        .glass-data-input-row {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }
        .glass-data-input-row > .form-group {
            flex: 1 1 0;
        }
        .glass-data-input-row--inside {
            margin-top: 0;
            margin-bottom: 10px;
        }
        .action-row .btn-calc {
            flex: 1;
            margin-top: 0;
        }
        .capture-host {
            display: none !important;
        }
        .capture-toolbar {
            display: grid;
            grid-template-columns: max-content max-content minmax(148px, 1fr);
            align-items: center;
            gap: 6px;
            width: 100%;
            margin: 0;
        }
        .diagram-stage {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .diagram-stage-footer {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            flex-wrap: wrap;
            gap: 8px;
            min-height: 54px;
        }
        .diagram-view-toggle {
            flex: 0 1 228px;
            width: min(100%, 228px);
            margin-right: auto;
        }
        .capture-host-stage {
            width: min(100%, 336px);
            margin-left: auto;
        }
        .diagram-warning {
            margin: 2px 0 0;
            padding: 8px 14px;
            border: 1px solid #fecaca;
            background: #fef2f2;
            color: #dc2626;
            font-weight: 700;
            font-size: 15px;
            border-radius: 6px;
            text-align: center;
            letter-spacing: 0.5px;
        }
        .diagram-warning[hidden] { display: none; }
        .capture-btn {
            width: auto;
            min-width: 0;
            padding: 9px 14px;
            border: none;
            border-radius: 12px;
            background: linear-gradient(135deg, #d61f1f 0%, #a81212 100%);
            color: #ffffff;
            font-size: 0.85rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            cursor: pointer;
            box-shadow: 0 12px 22px rgba(168, 18, 18, 0.18);
            transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
        }
        .capture-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 15px 28px rgba(168, 18, 18, 0.24);
        }
        .capture-btn--edit {
            background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
            box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
        }
        .capture-btn--edit:hover:not(:disabled) {
            box-shadow: 0 15px 28px rgba(37, 99, 235, 0.24);
        }
        .capture-btn:disabled {
            opacity: 0.65;
            cursor: wait;
            transform: none;
            box-shadow: none;
        }
        .capture-signature {
            display: grid;
            grid-template-columns: auto minmax(118px, 1fr);
            align-items: center;
            gap: 4px;
            min-width: 0;
            width: 100%;
        }
        .capture-signature label {
            margin: 0;
            color: var(--muted);
            font-size: 0.68rem;
            font-weight: 700;
            white-space: nowrap;
        }
        .capture-signature input {
            width: 100%;
            min-width: 0;
            padding: 7px 8px;
            border-radius: 9px;
            border: 1px solid #d6dee6;
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--text);
            background: #ffffff;
        }
        .capture-signature input:focus {
            outline: none;
            border-color: rgba(214, 31, 31, 0.32);
            box-shadow: 0 0 0 3px rgba(214, 31, 31, 0.12);
        }
        .capture-status {
            grid-column: 1 / -1;
            min-height: 1.15em;
            margin-top: 2px;
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--muted);
            letter-spacing: 0.02em;
            text-align: left;
        }
        .capture-status.success {
            color: #15803d;
        }
        .capture-status.error {
            color: #b91c1c;
        }
        .snapshot-editor {
            position: fixed;
            inset: 0;
            z-index: 1200;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 0 12px;
            background: rgba(15, 23, 42, 0.42);
            backdrop-filter: blur(6px);
        }
        .snapshot-editor[hidden] {
            display: none;
        }
        .snapshot-editor__panel {
            width: 100vw;
            height: clamp(560px, 72vh, 780px);
            display: grid;
            grid-template-rows: auto minmax(0, 1fr);
            gap: 10px;
            padding: 10px 12px 12px;
            border-radius: 0 0 20px 20px;
            background: #f8fafc;
            box-shadow: 0 32px 64px rgba(15, 23, 42, 0.28);
        }
        .snapshot-editor__toolbar {
            display: grid;
            gap: 10px;
            min-width: 0;
        }
        .snapshot-editor__topbar {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            min-width: 0;
        }
        .snapshot-editor__heading {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding-top: 2px;
        }
        .snapshot-editor__title {
            color: #0f172a;
            font-size: 1rem;
            font-weight: 900;
            letter-spacing: 0.04em;
        }
        .snapshot-editor__controls {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
            gap: 10px;
            min-width: 0;
        }
        .snapshot-editor__group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 0;
            padding: 10px 12px;
            border: 1px solid #dbe5ef;
            border-radius: 16px;
            background: rgba(255,255,255,0.9);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
        }
        .snapshot-editor__group--tools {
            min-width: 212px;
        }
        .snapshot-editor__group--palette {
            min-width: 168px;
        }
        .snapshot-editor__group--zoom {
            min-width: 220px;
        }
        .snapshot-editor__group--arrow {
            min-width: 220px;
        }
        .snapshot-editor__group-label {
            color: #64748b;
            font-size: 0.72rem;
            font-weight: 900;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }
        .snapshot-editor__range-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            gap: 10px;
        }
        .snapshot-editor__range {
            width: 100%;
            accent-color: #2563eb;
            cursor: pointer;
        }
        .snapshot-editor__range-value {
            min-width: 42px;
            text-align: right;
            color: #334155;
            font-size: 0.8rem;
            font-weight: 800;
            letter-spacing: 0.02em;
        }
        .snapshot-editor__tools,
        .snapshot-editor__palette,
        .snapshot-editor__zoom,
        .snapshot-editor__actions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
        }
        .snapshot-editor__actions {
            justify-content: flex-end;
            align-self: flex-start;
        }
        .snapshot-editor__tool,
        .snapshot-editor__action {
            border: none;
            border-radius: 11px;
            padding: 8px 13px;
            font-size: 0.8rem;
            font-weight: 800;
            cursor: pointer;
            transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background-color 0.18s ease, color 0.18s ease;
        }
        .snapshot-editor__tool {
            background: #e2e8f0;
            color: #1e293b;
        }
        .snapshot-editor__tool.is-active {
            background: #2563eb;
            color: #ffffff;
            box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
        }
        .snapshot-editor__action {
            background: #ffffff;
            color: #0f172a;
            box-shadow: 0 8px 16px rgba(15, 23, 42, 0.07);
        }
        .snapshot-editor__action--primary {
            background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
            color: #ffffff;
            box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
        }
        .snapshot-editor__tool:hover,
        .snapshot-editor__action:hover {
            transform: translateY(-1px);
        }
        .snapshot-editor__status {
            min-height: 1.1em;
            color: #64748b;
            font-size: 0.76rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            line-height: 1.45;
        }
        .snapshot-editor__zoom-value {
            min-width: 56px;
            text-align: center;
            color: #475569;
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.03em;
        }
        .snapshot-editor__color {
            width: 24px;
            height: 24px;
            padding: 0;
            border-radius: 999px;
            border: 2px solid rgba(255,255,255,0.92);
            box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45);
            cursor: pointer;
        }
        .snapshot-editor__color.is-active {
            transform: scale(1.08);
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.42);
        }
        .snapshot-editor__status.error {
            color: #b91c1c;
        }
        .snapshot-editor__status.success {
            color: #15803d;
        }
        .snapshot-editor__viewport {
            min-width: 0;
            min-height: 0;
            overflow: auto;
            border-radius: 18px;
            border: 1px solid #dbe2ea;
            background: linear-gradient(180deg, #edf2f8 0%, #f8fafc 100%);
            padding: 8px;
        }
        .snapshot-editor__canvas-wrap {
            width: max-content;
            min-width: 100%;
            min-height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .snapshot-editor__canvas {
            display: block;
            max-width: none;
            max-height: none;
            border-radius: 16px;
            background: #ffffff;
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
            touch-action: none;
            cursor: crosshair;
        }
        .snapshot-editor__viewport.is-panning,
        .snapshot-editor__viewport.is-panning .snapshot-editor__canvas {
            cursor: grabbing;
        }

        .diagram-workbench {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 312px;
            gap: 12px;
            align-items: stretch;
            margin: 14px auto 16px;
        }
        .diagram-box {
            width: 100%;
            height: 284px;
            background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
            border: 1px solid var(--border);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 12px 24px rgba(15, 23, 42, 0.045);
        }
        .reference-panel {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .reference-dropzone {
            flex: 1;
            min-height: 284px;
            height: 284px;
            border: 1px dashed #c9d5df;
            border-radius: 16px;
            background:
                linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(245,248,251,0.96) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
            cursor: pointer;
            transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, height 0.3s ease, min-height 0.3s ease;
            outline: none;
        }
        .reference-dropzone:hover,
        .reference-dropzone:focus,
        .reference-dropzone.is-active {
            border-color: rgba(11, 101, 127, 0.35);
            box-shadow: 0 0 0 3px rgba(11, 101, 127, 0.08);
        }
        .reference-placeholder {
            width: 66px;
            height: 66px;
            border-radius: 18px;
            border: 2px dashed #d8e2ea;
            background:
                linear-gradient(135deg, rgba(214, 31, 31, 0.05) 0%, rgba(11, 101, 127, 0.05) 100%);
            position: relative;
        }
        .reference-placeholder::before,
        .reference-placeholder::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            background: #c0ccd7;
            border-radius: 999px;
            transform: translate(-50%, -50%);
        }
        .reference-placeholder::before {
            width: 28px;
            height: 2px;
        }
        .reference-placeholder::after {
            width: 2px;
            height: 28px;
        }
        .reference-preview {
            width: 100%;
            height: 100%;
            object-fit: contain;
            background: #ffffff;
        }
        .reference-actions {
            display: flex;
            gap: 8px;
        }
        .reference-btn {
            flex: 1;
            padding: 9px 12px;
            border-radius: 12px;
            border: none;
            background: linear-gradient(135deg, #0e728d 0%, #0a596f 100%);
            color: #ffffff;
            font-size: 0.82rem;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
            box-shadow: 0 10px 20px rgba(11, 101, 127, 0.16);
        }
        .reference-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 13px 24px rgba(11, 101, 127, 0.2);
        }
        .reference-btn--ghost {
            background: #edf3f7;
            color: #516272;
            border: 1px solid #d1dbe4;
            box-shadow: none;
        }
        .reference-btn--ghost:hover {
            box-shadow: none;
        }
        .reference-status {
            min-height: 1.2em;
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--muted);
        }
        .reference-status.success {
            color: #15803d;
        }
        .reference-status.error {
            color: #b91c1c;
        }
        .reference-dropzone.has-image,
        .reference-preview {
            cursor: zoom-in;
        }
        .reference-viewer {
            position: fixed;
            top: 14px;
            right: 14px;
            bottom: 14px;
            width: var(--viewer-dock-width);
            z-index: 1000;
            display: flex;
            align-items: stretch;
            justify-content: flex-end;
        }
        .reference-viewer[hidden] {
            display: none;
        }
        .reference-viewer__panel {
            position: relative;
            width: 100%;
            height: 100%;
            padding: 54px 8px 8px;
            border-radius: 24px;
            background: rgba(255, 255, 255, 0.98);
            border: 1px solid rgba(219, 229, 238, 0.95);
            box-shadow: 0 26px 54px rgba(15, 23, 42, 0.22);
            overflow: hidden;
        }
        .reference-viewer__viewport {
            width: 100%;
            height: 100%;
            overflow: auto;
            border-radius: 16px;
            background: #ffffff;
            cursor: grab;
            touch-action: none;
            user-select: none;
            position: relative;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .reference-viewer__viewport::-webkit-scrollbar {
            width: 0;
            height: 0;
        }
        .reference-viewer__viewport.is-dragging {
            cursor: grabbing;
        }
        .reference-viewer__stage {
            position: relative;
        }
        .reference-viewer__image {
            width: auto;
            height: auto;
            min-height: 0;
            max-width: none;
            max-height: none;
            display: block;
            background: #ffffff;
            border-radius: 14px;
            position: absolute;
            top: 0;
            left: 0;
            image-rendering: auto;
            backface-visibility: hidden;
            pointer-events: none;
            user-select: none;
            -webkit-user-drag: none;
        }
        .reference-viewer__close {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 38px;
            height: 38px;
            border: none;
            border-radius: 999px;
            background: rgba(21, 21, 21, 0.82);
            color: #ffffff;
            font-size: 1.15rem;
            line-height: 1;
            cursor: pointer;
            box-shadow: 0 12px 22px rgba(15, 23, 42, 0.24);
        }
        .reference-viewer__close:hover {
            background: rgba(21, 21, 21, 0.94);
        }
        @media (max-width: 1180px) {
            :root {
                --viewer-dock-width: clamp(420px, 44vw, 620px);
            }
        }
        .force-edit-menu {
            position: fixed;
            z-index: 1200;
            min-width: 132px;
            padding: 6px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            border-radius: 14px;
            border: 1px solid rgba(209, 219, 228, 0.96);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
            backdrop-filter: blur(10px);
        }
        .force-edit-menu[hidden] {
            display: none;
        }
        .force-edit-menu__item {
            display: block;
            width: 100%;
            padding: 9px 10px;
            border: none;
            border-radius: 10px;
            background: transparent;
            color: var(--text);
            font-size: 0.82rem;
            font-weight: 700;
            text-align: left;
            cursor: pointer;
        }
        .force-edit-menu__item:hover {
            background: rgba(239, 68, 68, 0.08);
            color: var(--primary-strong);
        }
        .force-edit-menu__field {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 7px 9px;
            border-radius: 10px;
            color: var(--text);
            font-size: 0.82rem;
            font-weight: 700;
        }
        .force-edit-menu__field[hidden] {
            display: none;
        }
        .force-edit-menu__field input {
            width: 78px;
            padding: 5px 7px;
            border-radius: 8px;
            font-size: 0.82rem;
        }
        #style-label,
        #install-label {
            position: absolute;
            pointer-events: none;
            font-size: 12px;
            line-height: 18px;
            color: #263747;
            font-weight: 600;
            letter-spacing: 0.02em;
            white-space: nowrap;
            background: none;
            border: 0;
            border-radius: 0;
            padding: 0;
            box-shadow: none;
        }
        #style-label::before,
        #install-label::before {
            content: attr(data-caption);
            display: inline-block;
            margin-right: 8px;
            padding-right: 8px;
            border-right: 1px solid #cbd2d8;
            color: #73808b;
            font-size: 10px;
            font-weight: 400;
            line-height: 12px;
        }
        #style-label {
            top: 14px !important;
            left: 14px !important;
        }
        #install-label {
            bottom: 14px !important;
            left: 14px !important;
        }
        svg { width: 100%; height: 100%; max-width: 632px; }

        .svg-wall { stroke: var(--wall-color); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
        .svg-guide { stroke: var(--guide-color); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 4 2; opacity: 0.95; }
        .svg-angle-arc { fill: none; stroke: var(--angle-color); stroke-width: 2; }
        .svg-text, .svg-guide-text, .svg-angle-text { fill: var(--label-color); font-weight: 800; font-family: monospace; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: #ffffff; stroke-width: 3.5px; }
        .svg-text, .svg-guide-text { font-size: 17px; }
        .svg-guide-text { fill: var(--guide-text-color); }
        .svg-angle-text { font-size: 18px; fill: var(--angle-color); }
        .svg-custom-field { fill: #0f172a; font-size: 18px; font-weight: 700; font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif; dominant-baseline: hanging; pointer-events: auto; user-select: none; cursor: grab; touch-action: none; }
        .svg-custom-field[data-selected="true"] { fill: #b91c1c; }
        text[data-force-editable="true"] { cursor: context-menu; }
        text[data-force-active="true"][data-force-scope="base"] { fill: #92400e !important; }
        text[data-force-active="true"][data-force-scope="guide"] { fill: #b91c1c !important; }
        text[data-force-active="true"][data-force-scope="angle"] { fill: #b45309 !important; }

        .result-area {
            margin-top: 14px;
            background: linear-gradient(180deg, #fbfefc 0%, #f2fbf7 100%);
            border-radius: 15px;
            padding: 14px;
            border: 1px solid #d3e9dd;
            display: block;
            box-shadow: 0 10px 20px rgba(15, 118, 110, 0.05);
        }
        .result-area[hidden] { display: none !important; }
        .glass-data-placeholder {
            padding: 4px 2px 2px;
            color: #5b6b61;
            font-size: 0.78rem;
            text-align: center;
        }
        .result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
        .res-item {
            background: white;
            padding: 10px 8px;
            border-radius: 11px;
            border: 1px solid #d9ece3;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
        }
        .res-label { font-size: 0.75rem; color: #166534; margin-bottom: 4px; font-weight: bold; }
        .res-value { font-size: 1.2rem; font-weight: bold; color: #15803d; font-family: monospace; }
        .res-cad-ref { font-size: 0.65rem; color: #666; margin-top: 2px; }

        .control-row {
            display: grid;
            grid-template-columns: minmax(0, 1.45fr) minmax(0, 1.18fr) minmax(118px, 0.72fr) minmax(118px, 0.82fr);
            gap: 10px;
            margin-bottom: 8px;
            background: linear-gradient(180deg, rgba(244,248,251,0.82) 0%, rgba(250,252,253,0.82) 100%);
            padding: 9px 10px 8px;
            border-radius: 15px;
            border: 1px solid #d7e0e8;
            align-items: start;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
        }
        .control-card,
        .control-card--mode,
        .control-card--direction,
        .control-card--field {
            grid-column: auto;
            display: flex;
            flex-direction: column;
            gap: 5px;
            min-width: 0;
            padding: 0;
            background: transparent;
            border: none;
            border-radius: 0;
            box-shadow: none;
        }
        .control-card-label {
            display: block;
            margin: 0;
            padding-left: 8px;
            border-left: 2px solid rgba(11, 101, 127, 0.18);
            font-size: 0.68rem;
            color: #627486;
            font-weight: 700;
            line-height: 1.15;
            letter-spacing: 0.05em;
        }
        .control-row input[type="number"],
        .control-row input[data-numeric-expression="true"] {
            width: 100%;
            min-height: 36px;
        }
        .control-note {
            font-size: 0.73rem;
            color: #5f7082;
            width: 100%;
            margin-top: 0;
            padding: 9px 10px;
            border-radius: 11px;
            border: 1px solid #d9e2ea;
            background: rgba(247,250,252,0.86);
        }

        .mode-selector {
            display: flex;
            align-items: stretch;
            background: rgba(238, 243, 247, 0.92);
            border-radius: 13px;
            padding: 3px;
            gap: 3px;
            width: 100%;
            min-width: 0;
            border: 1px solid #d7e0e8;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
        }
        .mode-btn {
            position: relative;
            flex: 1;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 0;
            border: 1px solid transparent;
            background: transparent;
            padding: 7px 8px;
            color: #425262;
            border-radius: 9px;
            cursor: pointer;
            transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
            text-align: center;
            line-height: 1.2;
            min-height: 36px;
            box-shadow: none;
        }
        .mode-btn-title {
            display: block;
            font-size: 0.77rem;
            font-weight: 700;
            letter-spacing: 0.015em;
            font-family: 'Bahnschrift SemiBold', 'Segoe UI Variable Text', 'Microsoft YaHei UI', sans-serif;
        }
        .mode-btn-subtitle {
            display: none;
        }
        .mode-btn--single {
            align-items: center;
            text-align: center;
        }
        .mode-btn--single .mode-btn-subtitle:empty {
            display: none;
        }
        .mode-btn.active {
            background: var(--surface-strong);
            color: var(--primary-strong);
            border-color: #d1dbe4;
            box-shadow: inset 0 -2px 0 var(--primary), 0 3px 8px rgba(15, 23, 42, 0.04);
        }
        .mode-btn:hover:not(.active) {
            background: rgba(255,255,255,0.72);
            border-color: #dde5ec;
        }

        @media (max-width: 1120px) {
            .diagram-workbench {
                grid-template-columns: 1fr;
            }
            .reference-dropzone {
                min-height: 240px;
            }
        }

        @media (max-width: 760px) {
            body {
                padding: 18px 12px 26px;
            }
            header {
                grid-template-columns: 1fr;
            }
            .brand-lockup {
                max-width: 360px;
                margin: 0 auto;
            }
            .brand-meta {
                padding-top: 0;
                text-align: center;
            }
            .content {
                padding: 16px;
            }
            .filter-row {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .control-row {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .control-card,
            .control-card--mode,
            .control-card--direction {
                grid-column: span 2;
            }
            .control-card--field {
                grid-column: span 1;
            }
        }

        @media (max-width: 600px) {
            header {
                padding: 12px 12px 10px;
                gap: 10px;
            }
            header::before {
                left: 0;
            }
            header h1 {
                font-size: 1.2rem;
                padding-top: 0;
            }
            .brand-lockup {
                flex-direction: column;
                justify-content: center;
            }
            .brand-mark {
                width: 84px;
            }
            .brand-copy {
                text-align: center;
            }
            .brand-name {
                font-size: 1.32rem;
            }
            .brand-subtitle {
                font-size: 0.55rem;
                letter-spacing: 0.18em;
            }
            .capture-toolbar {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .diagram-stage-footer {
                justify-content: stretch;
            }
            .diagram-view-toggle {
                width: 100%;
                margin-right: 0;
            }
            .capture-host-stage {
                width: 100%;
            }
            .capture-signature {
                grid-column: 1 / -1;
                grid-template-columns: auto minmax(0, 1fr);
            }
            .snapshot-editor {
                padding: 0;
            }
            .snapshot-editor__panel {
                width: 100vw;
                height: min(calc(100vh - 12px), 760px);
                grid-template-rows: auto minmax(0, 1fr);
                padding: 10px;
                border-radius: 0 0 18px 18px;
            }
            .snapshot-editor__topbar,
            .snapshot-editor__controls {
                flex-direction: column;
                align-items: stretch;
            }
            .snapshot-editor__group,
            .snapshot-editor__group--tools,
            .snapshot-editor__group--palette,
            .snapshot-editor__group--zoom,
            .snapshot-editor__group--arrow {
                min-width: 0;
            }
            .snapshot-editor__actions {
                justify-content: flex-start;
            }
            .filter-row { grid-template-columns: 1fr; }
            .form-group { width: 100%; }
            .filter-row > .form-group {
                padding: 10px;
            }
            .input-row { flex-wrap: wrap; }
            .input-row .form-group { flex: 1 1 45%; }
            .control-row {
                grid-template-columns: 1fr;
                padding: 10px;
            }
            .control-card,
            .control-card--mode,
            .control-card--direction,
            .control-card--field { grid-column: span 1; }
            .mode-selector { width: 100%; }
            .diagram-box {
                height: 272px;
            }
            .action-row {
                flex-direction: column;
            }
            .glass-data-input-row {
                flex-wrap: wrap;
            }
        }
        .glass-diagram-wrap {
            margin-top: 14px;
            padding-top: 10px;
            border-top: 1px solid #d3e9dd;
        }
        .glass-diagram-title {
            text-align: center;
            font-weight: 800;
            font-size: 0.82rem;
            color: #166534;
            letter-spacing: 0.03em;
            margin-bottom: 8px;
        }
        .glass-diagram-frame {
            position: relative;
            width: 100%;
            max-width: 720px;
            margin: 0 auto;
            border-radius: 8px;
            border: 1px solid #d3e9dd;
            background: #fff;
            overflow: hidden;
        }
        .glass-diagram-canvas {
            display: block;
            width: 100%;
            height: auto;
            border-radius: 8px;
        }

        /* === Three.js 3D 立体渲染（覆盖原 SVG 3D） === */
        #diagram-view-selector { display: none !important; }
        .diagram-box { position: relative; }
        #three-canvas {
            position: absolute; inset: 0;
            width: 100%; height: 100%;
            display: none;
            border-radius: 8px;
            z-index: 2;
            cursor: grab;
        }
        #three-canvas:active { cursor: grabbing; }
        .diagram-box[data-view="3d"] #main-svg { display: none !important; }
        .diagram-box[data-view="3d"] #iso3d-svg { display: none !important; }
        .diagram-box[data-view="3d"] #three-canvas { display: block; }
        .diagram-box[data-view="3d"] #three-labels { display: block; }
        .diagram-box[data-debug3d-panel="1"] #three-debug-state { display: block; }
        .diagram-box[data-view="3d"] {
            height: clamp(420px, 52vh, 560px) !important;
            min-height: 420px;
        }
        .three-labels {
            position: absolute; inset: 0; z-index: 3;
            pointer-events: none;
            display: none;
            font-family: 'Bahnschrift SemiCondensed','Microsoft YaHei UI',sans-serif;
        }
        .three-label {
            position: absolute;
            transform: translate(-50%, -100%);
            color: #1f2937;
            font-size: 0.82rem;
            font-weight: 800;
            letter-spacing: 0.02em;
            white-space: nowrap;
            text-shadow:
                0 1px 0 rgba(255,255,255,0.95),
                0 -1px 0 rgba(255,255,255,0.95),
                1px 0 0 rgba(255,255,255,0.95),
                -1px 0 0 rgba(255,255,255,0.95);
        }
        #three-debug-state {
            position: absolute;
            top: 14px;
            right: 14px;
            z-index: 4;
            display: none;
            pointer-events: none;
            width: min(420px, 44%);
            max-height: 62%;
            overflow: auto;
            margin: 0;
            padding: 10px 12px;
            border-radius: 10px;
            background: rgba(15,23,42,0.78);
            color: #e2e8f0;
            font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            box-shadow: 0 12px 32px rgba(15,23,42,0.18);
            white-space: pre-wrap;
            word-break: break-word;
            backdrop-filter: blur(8px);
        }
        .view-switcher {
            position: absolute;
            top: 8px; right: 8px;
            z-index: 4;
            display: inline-flex;
            align-items: center; justify-content: center;
            width: 52px; height: 32px;
            border-radius: 8px;
            border: 1px solid #e5e7eb;
            background: rgba(255,255,255,0.94);
            backdrop-filter: blur(6px);
            color: #1f2937;
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            cursor: pointer;
            user-select: none;
            box-shadow: 0 4px 10px rgba(15,23,42,0.08);
            transition: background .18s, color .18s, transform .12s;
            font-family: 'Bahnschrift SemiCondensed','Segoe UI Variable Text','Microsoft YaHei UI',sans-serif;
        }
        .view-switcher:hover { background: #ffffff; transform: translateY(-1px); }
        .view-switcher[data-view="3d"] {
            background: linear-gradient(180deg, #d61f1f 0%, #a81212 100%);
            color: #fff;
            border-color: transparent;
            box-shadow: 0 4px 10px rgba(168,18,18,0.32);
        }
        .three-hint {
            position: absolute;
            left: 12px; bottom: 10px;
            z-index: 3;
            background: rgba(15,23,42,0.55);
            color: #f8fafc;
            font-size: 0.7rem;
            padding: 3px 9px;
            border-radius: 999px;
            letter-spacing: 0.04em;
            pointer-events: none;
            font-family: 'Bahnschrift','Segoe UI Variable Text',sans-serif;
        }
        .diagram-box[data-view="3d"] .three-hint { display: block; }
        @media (max-width: 760px) {
            .diagram-box[data-view="3d"] { height: 380px !important; min-height: 360px; }
        }
        .diagram-box[data-view="2d"] .three-hint { display: none; }

}
