.geometry-lab {
    --geo-blue: #2563eb;
    --geo-cyan: #0891b2;
    --geo-purple: #7c3aed;
    --geo-ink: #0f172a;
    --geo-muted: #64748b;
    --geo-line: #dbe5f1;
    --geo-soft: #eff6ff;
    --geo-purple-soft: #f5f3ff;
    --geo-motion: cubic-bezier(.22,.61,.36,1);
}

.geometry-hero {
    border: 1px solid rgba(191, 219, 254, 0.75);
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.geometry-hero-actions {
    flex-wrap: wrap;
}

.geometry-state {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border: 1px solid #c4b5fd;
    border-radius: 999px;
    padding: 0 13px;
    color: #5b21b6;
    background: #f5f3ff;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.geometry-workbench {
    grid-template-columns: minmax(228px, 258px) minmax(0, 1fr) minmax(268px, 304px);
    gap: 12px;
}

.geometry-control-panel,
.geometry-notes-panel {
    gap: 10px;
}

.geometry-control-panel {
    gap: 7px;
    padding: 11px;
}

.geometry-control-panel .vision-panel-heading {
    padding-bottom: 8px;
}

.geometry-control-panel .vision-panel-index {
    width: 31px;
    height: 31px;
    border-radius: 9px;
}

.geometry-control-panel .vision-panel-heading h3 {
    font-size: 15px;
}

.geometry-control-panel .vision-panel-heading p {
    margin-top: 1px;
    font-size: 9.6px;
    line-height: 1.08;
}

.geometry-control-group {
    display: grid;
    gap: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 7px 8px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.geometry-control-group > strong {
    color: #1e40af;
    font-size: 10.7px;
    line-height: 1.12;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.geometry-control-panel .vision-field {
    gap: 2px;
}

.geometry-control-panel .vision-field > span {
    font-size: 11px;
    line-height: 1.12;
}

.geometry-control-panel .vision-field select {
    min-height: 29px !important;
    border-radius: 8px;
    padding: 0 8px !important;
    font-size: 11.5px !important;
}

.geometry-control-panel .vision-field input[type="range"] {
    height: 14px;
}

.geometry-control-panel .vision-field input[type="range"] {
    accent-color: var(--geo-purple);
}

.geometry-control-panel .vision-field:has(input[type="range"]) {
    grid-template-columns: minmax(86px, 0.56fr) minmax(0, 1fr);
    align-items: center;
    gap: 5px;
}

.geometry-control-panel .vision-field:has(input[type="range"]) > span {
    min-width: 0;
    align-items: center;
    gap: 4px;
}

.geometry-control-panel .vision-field:has(input[type="range"]) > span :first-child {
    min-width: 0;
}

.geometry-control-panel .vision-field:has(input[type="range"]) output {
    margin-left: auto;
    white-space: nowrap;
}

.geometry-toggle-grid {
    display: grid;
    gap: 4px;
}

.geometry-control-panel .vision-toggle-row {
    min-height: 30px !important;
    border-radius: 9px !important;
    padding: 5px 7px !important;
    font-size: 11px !important;
    line-height: 1.12 !important;
}

.geometry-button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.geometry-button-row button {
    min-height: 29px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.18s var(--geo-motion), background 0.18s var(--geo-motion), border-color 0.18s var(--geo-motion);
}

.geometry-control-panel .vision-kv-grid {
    gap: 3px !important;
    margin: 2px 0 !important;
    padding: 6px !important;
}

.geometry-control-panel .vision-kv-grid > div {
    min-height: 24px;
    border-radius: 7px;
    padding: 4px 7px;
    font-size: 10.8px;
    line-height: 1.12;
}

.geometry-button-row button:hover {
    border-color: #93c5fd;
    background: #dbeafe;
    transform: translateY(-1px);
}

.geometry-stage-panel {
    min-height: 0;
}

.geometry-stage-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.geometry-stage-chips span {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 0 9px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 10.8px;
    line-height: 1.05;
    font-weight: 900;
    white-space: nowrap;
}

.geometry-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border-bottom: 1px solid #e8eef6;
}

.geometry-section-head strong {
    color: #172554;
    font-size: 13.5px;
    font-weight: 950;
}

.geometry-section-head span {
    overflow: hidden;
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.08;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.geometry-svg-frame {
    position: relative;
    height: 230px;
    min-height: 0;
    overflow: hidden;
    border-radius: 0 0 14px 14px;
    background:
        linear-gradient(90deg, rgba(191, 219, 254, 0.38) 1px, transparent 1px),
        linear-gradient(180deg, rgba(191, 219, 254, 0.38) 1px, transparent 1px),
        radial-gradient(circle at 80% 18%, rgba(124, 58, 237, 0.08), transparent 24%),
        #f8fafc;
    background-size: 24px 24px, 24px 24px, 100% 100%, 100% 100%;
}

.geometry-svg-frame svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.geometry-projection-window .geometry-svg-frame {
    height: 276px;
}

.geometry-svg-frame text {
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.geometry-lab mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.geometry-lab mjx-container[display="true"] {
    margin: 0;
}

.geo-matrix-card code mjx-container,
.vision-output-schema code mjx-container,
.geo-status-cell mjx-container,
.camera-micro-grid mjx-container,
.calibration-results-panel mjx-container,
.vision-formula-card mjx-container {
    margin: 0;
}

.geo-matrix-card code mjx-container,
.calibration-results-panel code mjx-container {
    font-size: 0.94em;
}

.vision-output-schema code mjx-container[display="true"] {
    text-align: left !important;
}

.vision-output-schema code mjx-container[display="true"] svg {
    display: inline-block;
}

.geometry-pipeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    padding: 12px;
    background: linear-gradient(180deg, #fbfdff, #f5f8fc);
}

.geometry-projection-workbench .geometry-pipeline {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.geometry-pipeline::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 26px;
    right: 26px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.28), rgba(124, 58, 237, 0.28), transparent);
}

.geo-matrix-card {
    position: relative;
    z-index: 1;
    display: grid;
    align-content: start;
    gap: 5px;
    min-height: 104px;
    min-width: 0;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 9px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: transform 0.26s var(--geo-motion), border-color 0.26s var(--geo-motion), box-shadow 0.26s var(--geo-motion);
}

.geo-matrix-card::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -9px;
    width: 9px;
    height: 2px;
    background: #93c5fd;
}

.geo-matrix-card:last-child::after {
    display: none;
}

.geo-matrix-card span {
    color: var(--geo-cyan);
    font-size: 9.7px;
    line-height: 1.08;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.geo-matrix-card strong {
    color: #172554;
    font-size: 14.5px;
    font-weight: 950;
}

.geo-matrix-card code {
    overflow-wrap: anywhere;
    color: #334155;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10.5px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.geometry-projection-workbench .geo-matrix-card {
    gap: 4px;
    min-height: 144px;
    padding: 8px;
}

.geometry-projection-workbench .geo-matrix-card span {
    font-size: 9.6px;
}

.geometry-projection-workbench .geo-matrix-card strong {
    font-size: 14.2px;
}

.geometry-projection-workbench .geo-matrix-card code {
    max-height: 6em;
    overflow: hidden;
    font-size: 10.4px;
    line-height: 1.14;
}

.geo-matrix-card.is-active {
    border-color: #8b5cf6;
    box-shadow: 0 14px 28px rgba(124, 58, 237, 0.16), inset 0 0 0 1px rgba(124, 58, 237, 0.12);
    transform: translateY(-3px);
}

.geo-matrix-card:not(.is-active):not(.is-context) {
    opacity: 0.68;
}

.geo-matrix-card.is-context {
    border-color: #67e8f9;
    background: #ecfeff;
    box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.08);
}

.geo-matrix-card.is-pulsing,
.geometry-notes-panel.is-pulsing,
.calibration-results-panel.is-pulsing {
    animation: geoPulse 0.68s var(--geo-motion);
}

@keyframes geoPulse {
    0% { box-shadow: 0 0 0 rgba(37, 99, 235, 0); }
    45% { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.13), 0 16px 32px rgba(124, 58, 237, 0.16); }
    100% { box-shadow: 0 0 0 rgba(37, 99, 235, 0); }
}

.geometry-projection-lower {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 0 12px 12px;
    background: #f5f8fc;
}

.geometry-projection-window,
.geometry-flow-preview,
.camera-view-card,
.calibration-card {
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.045);
}

.geometry-flow-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: start;
    gap: 8px;
    min-height: 0;
    padding: 8px;
}

.geo-status-cell {
    position: relative;
    display: grid;
    gap: 4px;
    min-height: 76px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 9px 10px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
    transition: border-color 0.28s var(--geo-motion), background 0.28s var(--geo-motion), transform 0.28s var(--geo-motion);
}

.geo-status-cell span {
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.08;
    font-weight: 950;
}

.geo-status-cell strong {
    overflow-wrap: anywhere;
    color: #172554;
    font-family: Consolas, "Courier New", "Microsoft YaHei", monospace;
    font-size: 12.4px;
    line-height: 1.18;
}

.geo-status-cell small {
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.2;
}

.geo-status-cell i {
    position: absolute;
    right: 8px;
    bottom: -8px;
    color: rgba(37, 99, 235, 0.1);
    font-size: 44px;
    font-style: normal;
    font-weight: 950;
    line-height: 1;
}

.geo-status-cell.is-active {
    border-color: #8b5cf6;
    background: linear-gradient(180deg, #ffffff, #f5f3ff);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.1), inset 0 0 0 1px rgba(124, 58, 237, 0.1);
}

.geometry-flow-preview article {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 7px;
    align-items: start;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 7px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.22s var(--geo-motion), background 0.22s var(--geo-motion), transform 0.22s var(--geo-motion);
}

.geometry-flow-preview article:hover,
.geometry-flow-preview article:focus-visible {
    border-color: #93c5fd;
    background: #eff6ff;
    outline: none;
    transform: translateY(-1px);
}

.geometry-flow-preview article span {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 50%;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 10.8px;
    font-weight: 950;
}

.geometry-flow-preview article strong {
    color: #172554;
    font-size: 12px;
}

.geometry-flow-preview article small {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.2;
}

.geometry-flow-preview article.is-active {
    border-color: #8b5cf6;
    background: #f5f3ff;
    transform: translateX(2px);
}

.geometry-flow-preview article.is-active span {
    color: #ffffff;
    background: #7c3aed;
}

.geometry-notes-body {
    display: grid;
    gap: 9px;
}

.geometry-notes-body article {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 9px;
}

.geometry-notes-body article > span {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 9.8px;
    font-weight: 950;
}

.geometry-notes-body strong {
    color: #172554;
    font-size: 12.4px;
}

.geometry-notes-body p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.38;
}

.geometry-stepper--5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.geometry-stepper--6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.geometry-stepper li {
    cursor: pointer;
}

.geometry-stepper li.is-complete > span {
    border-color: #67e8f9;
    color: #0e7490;
    background: #ecfeff;
}

.geometry-stepper li.is-active strong {
    color: #1d4ed8;
}

.geo-grid-line {
    stroke: #dbeafe;
    stroke-width: 1;
}

.geo-axis-line {
    stroke: #94a3b8;
    stroke-width: 1.4;
}

.geo-point {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 2;
    transition: transform 0.38s var(--geo-motion);
}

.geo-point-ghost {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 1.5;
    stroke-dasharray: 3 4;
    opacity: 0.55;
}

.geo-point-ghost.is-active {
    stroke: #7c3aed;
    opacity: 0.78;
}

.geo-point.is-active,
.camera-point.is-active,
.camera-pixel.is-active,
.calib-corner.is-active {
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.55));
    animation: geoNodePulse 1.2s var(--geo-motion) infinite;
}

@keyframes geoNodePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.58; }
}

.geo-point.is-outside {
    fill: #94a3b8;
    opacity: 0.55;
}

.geo-principal {
    fill: none;
    stroke: #7c3aed;
    stroke-width: 1.6;
    stroke-dasharray: 4 4;
}

.geo-principal-line {
    stroke: rgba(124, 58, 237, 0.72);
    stroke-width: 1.2;
    stroke-linecap: round;
}

.geo-flow-line,
.camera-ray,
.calib-pair-line,
.calib-error-vector {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    animation: geoExtend 0.72s var(--geo-motion) forwards;
}

@keyframes geoExtend {
    to { stroke-dashoffset: 0; }
}

.camera-model-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 10px;
    padding: 12px;
    background: #f5f8fc;
}

.camera-3d-frame,
.camera-plane-frame {
    height: 300px;
    min-height: 0;
}

.camera-flow-preview {
    min-height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 12px 12px;
    padding: 8px;
}

.camera-flow-preview article,
.calibration-flow-preview article {
    min-height: 54px;
}

.camera-flow-preview article.is-active,
.calibration-flow-preview article.is-active {
    transform: translateY(-1px);
}

.camera-flow-preview article small,
.calibration-flow-preview article small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.camera-center {
    fill: #7c3aed;
    stroke: #ffffff;
    stroke-width: 2.5;
}

.camera-axis {
    stroke: #0891b2;
    stroke-width: 2;
    stroke-dasharray: 6 5;
}

.camera-plane {
    fill: rgba(219, 234, 254, 0.65);
    stroke: #60a5fa;
    stroke-width: 1.8;
}

.camera-plane-grid {
    stroke: rgba(37, 99, 235, 0.32);
    stroke-width: 0.8;
}

.camera-ray {
    stroke: #7c3aed;
    stroke-width: 1.5;
    opacity: 0.62;
}

.camera-ray:not(.is-active) {
    opacity: 0.22;
}

.camera-ray--projection {
    fill: none;
    stroke: #5b21b6;
    stroke-width: 2.4;
    opacity: 0.88;
}

.camera-point {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 2;
}

.camera-point:not(.is-active),
.camera-pixel:not(.is-active) {
    opacity: 0.48;
}

.camera-pixel {
    fill: #0891b2;
    stroke: #ffffff;
    stroke-width: 2;
    transition: transform 0.36s var(--geo-motion);
}

.camera-frustum {
    fill: rgba(124, 58, 237, 0.05);
    stroke: rgba(124, 58, 237, 0.34);
    stroke-width: 1.2;
}

.geometry-observation-list {
    display: grid;
    gap: 8px;
}

.geometry-observation-list article {
    display: grid;
    gap: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 9px;
    background: #ffffff;
}

.geometry-observation-list strong {
    color: #1d4ed8;
    font-size: 12.4px;
}

.geometry-observation-list span {
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.34;
}

.camera-microscope-panel {
    overflow: hidden;
    margin: 0 12px 10px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.045);
}

.camera-micro-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
}

.camera-micro-grid section {
    display: grid;
    gap: 4px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 8px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.camera-micro-grid section.is-wide {
    grid-column: span 2;
}

.camera-micro-grid span {
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.08;
    font-weight: 950;
}

.camera-micro-grid strong {
    overflow-wrap: anywhere;
    color: #172554;
    font-family: Consolas, "Courier New", "Microsoft YaHei", monospace;
    font-size: 11.5px;
    line-height: 1.24;
}

.calibration-stage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    background: #f5f8fc;
}

.calibration-card .geometry-svg-frame {
    height: 220px;
    min-height: 0;
}

.calibration-results-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0 12px 12px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.045);
}

.calibration-results-panel section {
    display: grid;
    gap: 4px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 7px;
    background: #f8fafc;
}

.calibration-results-panel span {
    color: #64748b;
    font-size: 10.8px;
    line-height: 1.08;
    font-weight: 900;
}

.calibration-results-panel code,
.calibration-results-panel strong {
    overflow-wrap: anywhere;
    color: #1e3a8a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10.6px;
    line-height: 1.22;
}

.calibration-flow-preview {
    min-height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 12px 12px;
    padding: 8px;
}

.calib-residual-section {
    grid-column: span 2;
}

.calib-residual-bars {
    display: grid;
    gap: 4px;
}

.calib-residual-bar {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 5px;
}

.calib-residual-bar span,
.calib-residual-bar strong {
    color: #334155;
    font-family: Consolas, "Courier New", monospace;
    font-size: 9.8px;
    line-height: 1.05;
}

.calib-residual-bar i {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #8b5cf6);
}

.calib-residual-bar.is-hot i {
    background: linear-gradient(90deg, #fb923c, #ef4444);
}

.calib-board-light {
    fill: #f8fafc;
}

.calib-board-dark {
    fill: #1f2937;
}

.calibration-real-board .calib-board-light,
.calibration-real-board .calib-board-dark {
    stroke: rgba(37, 99, 235, 0.16);
    stroke-width: 0.38;
}

.calibration-real-board .calib-board-light {
    fill: #f8fafc;
    fill-opacity: 1;
}

.calibration-real-board .calib-board-dark {
    fill: #242424;
    fill-opacity: 0.94;
}

.calib-board-outline {
    fill: none;
    stroke: #2563eb;
    stroke-width: 1.6;
}

.calibration-real-board {
    background: linear-gradient(145deg, rgba(239, 246, 255, 0.68), rgba(255, 255, 255, 0.86));
}

.calib-generated-board {
    transform-origin: center;
}

.calib-generated-board.is-primary {
    opacity: 0.98;
}

.calib-generated-board.is-ghost {
    opacity: 0.34;
}

.calib-generated-board.is-ghost .calib-board-cell {
    stroke: rgba(124, 58, 237, 0.16);
}

.calib-board-probe {
    pointer-events: none;
}

.calibration-real-board--noise .calib-generated-board.is-primary {
    opacity: 0.9;
}

.calibration-real-board--noise::after {
    content: "";
}

.calib-image-fallback {
    display: none;
}

.calibration-real-board.is-board-image-failed .calib-image-fallback {
    display: block;
}

.calib-image-fallback div {
    display: grid;
    height: 100%;
    place-content: center;
    gap: 6px;
    border: 1px dashed #93c5fd;
    border-radius: 14px;
    color: #1d4ed8;
    text-align: center;
    background: rgba(239, 246, 255, 0.92);
    font: 12px Arial, "Microsoft YaHei", sans-serif;
}

.calib-image-fallback strong {
    font-size: 14px;
}

.calib-image-fallback span {
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.25;
}

.calib-corner {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 1.8;
    filter: drop-shadow(0 1px 3px rgba(30, 64, 175, 0.28));
}

.calib-corner.is-hot,
.calib-reprojected.is-hot {
    animation: geoNodePulse 0.9s var(--geo-motion) infinite;
    filter: drop-shadow(0 0 7px rgba(239, 68, 68, 0.42));
}

.calib-corner.is-detected {
    animation: calibCornerRise 0.62s var(--geo-motion) both;
    animation-delay: var(--corner-delay, 0ms);
}

@keyframes calibCornerRise {
    from { opacity: 0; transform: scale(0.62); }
    to { opacity: 1; transform: scale(1); }
}

.calib-reprojected {
    fill: #7c3aed;
    stroke: #ffffff;
    stroke-width: 1.8;
    filter: drop-shadow(0 1px 3px rgba(91, 33, 182, 0.26));
}

.calib-error-vector {
    stroke: #ef4444;
    stroke-width: 1.3;
}

.calib-error-vector.is-hot {
    stroke: #f97316;
    stroke-width: 1.8;
}

.calib-pair-line {
    stroke: rgba(8, 145, 178, 0.58);
    stroke-width: 1.1;
}

.calib-camera-pose {
    fill: rgba(124, 58, 237, 0.08);
    stroke: #7c3aed;
    stroke-width: 1.6;
}

.calib-error-loupe rect {
    fill: rgba(255, 255, 255, 0.9);
    stroke: #bfdbfe;
    stroke-width: 1.2;
    filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.08));
}

.calibration-step-list {
    display: grid;
    gap: 6px;
}

.calibration-step-list article {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 7px;
    background: #ffffff;
}

.calibration-step-list article span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 10.8px;
    font-weight: 950;
}

.calibration-step-list article strong {
    color: #334155;
    font-size: 11.5px;
    line-height: 1.18;
}

.calibration-step-list article.is-active {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.calibration-step-list article.is-active span {
    color: #ffffff;
    background: #7c3aed;
}

.calibration-known-grid {
    display: grid;
    gap: 8px;
}

.calibration-known-grid section {
    display: grid;
    gap: 4px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 9px;
    background: #f8fbff;
}

.calibration-known-grid span {
    color: #1d4ed8;
    font-size: 10.8px;
    line-height: 1.08;
    font-weight: 950;
    letter-spacing: 0.06em;
}

.calibration-known-grid strong {
    color: #334155;
    font-size: 11.5px;
    line-height: 1.3;
}

@media (max-width: 1380px) {
    .geometry-workbench {
        grid-template-columns: minmax(218px, 238px) minmax(0, 1fr) minmax(250px, 284px);
        gap: 10px;
    }

    .geometry-pipeline {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .geo-matrix-card::after {
        display: none;
    }
}

@media (max-width: 1100px) {
    .geometry-projection-lower,
    .camera-model-stage {
        grid-template-columns: 1fr;
    }

    .camera-3d-frame,
    .camera-plane-frame {
        height: 270px;
    }

    .calibration-stage-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .calibration-card--reprojection {
        grid-column: 1 / -1;
    }

    .calibration-card .geometry-svg-frame {
        height: 220px;
    }

    .calibration-results-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .camera-flow-preview,
    .calibration-flow-preview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .camera-micro-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1220px) {
    .geometry-workbench {
        grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
    }

    .geometry-notes-panel {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr) minmax(230px, 0.8fr);
        align-items: start;
    }

    .geometry-notes-panel .vision-panel-heading {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    body:has(.geometry-lab) .ai-assistant-fab {
        display: none;
    }
}

@media (max-width: 820px) {

    .geometry-workbench,
    .geometry-projection-lower,
    .camera-model-stage,
    .calibration-stage-grid {
        grid-template-columns: 1fr;
    }

    .geometry-stage-panel {
        order: 1;
    }

    .geometry-control-panel {
        order: 2;
    }

    .geometry-notes-panel {
        order: 3;
    }

    .geometry-stage-panel {
        min-height: 0;
    }

    .geometry-notes-panel {
        grid-column: auto;
        display: flex;
    }

    .geometry-pipeline,
    .calibration-results-panel {
        grid-template-columns: 1fr;
    }

    .geometry-projection-workbench .geometry-pipeline {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .geometry-projection-workbench .geo-matrix-card {
        min-height: 106px;
        padding: 7px;
    }

    .geometry-projection-workbench .geo-matrix-card span {
        font-size: 8.4px;
    }

    .geometry-projection-workbench .geo-matrix-card code {
        max-height: 3.9em;
        font-size: 9px;
        line-height: 1.18;
    }

    .camera-flow-preview,
    .calibration-flow-preview {
        grid-template-columns: 1fr;
    }

    .geometry-flow-preview,
    .camera-micro-grid {
        grid-template-columns: 1fr;
    }

    .camera-micro-grid section.is-wide,
    .calib-residual-section {
        grid-column: auto;
    }

    .calibration-card--reprojection {
        grid-column: auto;
    }

    .geometry-stepper--5,
    .geometry-stepper--6 {
        grid-template-columns: 1fr;
    }
}
