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

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

.motion-math-output {
    min-width: 0;
    overflow-x: auto;
    color: #172554;
    font-size: 11px;
    line-height: 1.5;
}

.motion-math-output mjx-container {
    margin: 0;
}

.motion-math-output--block,
.motion-math-output--matrix {
    border: 1px solid #dbeafe;
    border-radius: 9px;
    padding: 8px;
    background: #eff6ff;
}

.motion-hero {
    border: 1px solid rgba(191, 219, 254, 0.78);
    box-shadow: 0 16px 34px rgba(8, 145, 178, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

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

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

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

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

.motion-control-panel .vision-field {
    gap: 4px;
}

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

.motion-toggle-grid {
    display: grid;
    gap: 6px;
}

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

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

.motion-button-row button:hover {
    border-color: #67e8f9;
    background: #ecfeff;
    transform: translateY(-1px);
}

.motion-stage-panel {
    min-height: 620px;
}

.motion-lk-workbench .motion-stage-panel {
    min-height: 0;
}

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

.motion-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: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.motion-frame-grid,
.motion-lk-stage-grid,
.motion-pyramid-stage-grid {
    display: grid;
    gap: 12px;
    padding: 14px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.45) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.45) 1px, transparent 1px),
        #f5f8fc;
    background-size: 26px 26px;
}

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

.motion-lk-stage-grid {
    grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1fr) minmax(190px, 0.72fr);
    align-items: start;
}

.motion-pyramid-stage-grid {
    grid-template-columns: minmax(220px, 0.95fr) minmax(210px, 0.78fr) minmax(210px, 0.82fr);
}

.motion-view-card,
.motion-patch-card,
.motion-flow-preview,
.motion-solve-panel,
.motion-result-panel {
    overflow: hidden;
    min-width: 0;
    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);
}

.motion-lab .geometry-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 3px;
    min-height: 52px;
    padding: 12px 14px 9px;
}

.motion-lab .geometry-section-head strong {
    overflow-wrap: anywhere;
    color: #0f172a;
    font-size: 15px;
    font-weight: 950;
    line-height: 1.25;
}

.motion-lab .geometry-section-head span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    color: #0e7490;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.32;
}

.motion-lab .geometry-section-head mjx-container {
    display: inline-block;
    margin: 0;
    vertical-align: -0.18em;
}

.motion-svg-frame {
    position: relative;
    display: grid;
    min-height: 230px;
    overflow: hidden;
    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),
        #f8fafc;
    background-size: 22px 22px;
}

.motion-svg-frame svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

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

.motion-detail-grid {
    display: grid;
    grid-template-columns: minmax(230px, 0.62fr) minmax(0, 1fr);
    gap: 12px;
    padding: 0 14px 14px;
    background: #f5f8fc;
}

.motion-flow-preview {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 134px;
    padding: 12px;
}

.motion-flow-preview article {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 9px;
    background: #ffffff;
    transition: border-color 0.22s var(--motion-ease), background 0.22s var(--motion-ease), transform 0.22s var(--motion-ease);
}

.motion-flow-preview article span {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    color: #0e7490;
    background: #ecfeff;
    font-size: 10px;
    font-weight: 950;
}

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

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

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

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

.motion-patch-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 12px;
}

.motion-patch-cell {
    display: grid;
    min-height: 36px;
    place-items: center;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    color: #1e3a8a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    font-weight: 800;
    background: #f8fbff;
    transition: background 0.24s var(--motion-ease), border-color 0.24s var(--motion-ease), transform 0.24s var(--motion-ease);
}

.motion-patch-cell.is-center {
    border-color: #7c3aed;
    color: #5b21b6;
    background: #f5f3ff;
    transform: scale(1.04);
}

.motion-patch-cell.is-x-pair {
    border-color: #f59e0b;
    background: #fff7ed;
}

.motion-patch-cell.is-y-pair {
    border-color: #0891b2;
    background: #ecfeff;
}

.motion-patch-cell.is-temporal {
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.22);
}

.motion-mini-card {
    display: grid;
    gap: 6px;
    margin: 0 12px 12px;
    border: 1px solid #dbeafe;
    border-radius: 11px;
    padding: 9px;
    background: #ffffff;
}

.motion-mini-card span {
    color: #0e7490;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.motion-mini-card code {
    overflow: auto;
    color: #334155;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    line-height: 1.45;
    white-space: pre-wrap;
}

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

.motion-reference-card,
.motion-code-card {
    display: grid;
    gap: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 13px;
    padding: 10px;
    background: linear-gradient(145deg, #ffffff, #f8fbff);
}

.motion-reference-card > span,
.motion-code-card > span {
    color: #0e7490;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.motion-reference-card article {
    display: grid;
    gap: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    background: #ffffff;
}

.motion-reference-card strong {
    color: #172554;
    font-size: 11px;
    font-weight: 950;
}

.motion-reference-card small,
.motion-code-card small {
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.motion-reference-grid {
    display: grid;
    gap: 7px;
}

.motion-assumption-card {
    gap: 7px;
}

.motion-code-card code {
    overflow: auto;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    padding: 8px;
    color: #1e3a8a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    line-height: 1.45;
    white-space: pre;
    background: #eff6ff;
}

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

.motion-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: 9px;
    font-weight: 950;
}

.motion-notes-body strong {
    color: #172554;
    font-size: 12px;
}

.motion-notes-body p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.5;
}

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

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

.motion-stepper li {
    cursor: pointer;
}

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

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

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

.motion-frame-bg {
    fill: rgba(255, 255, 255, 0.82);
    stroke: #bfdbfe;
}

.motion-object {
    fill: #60a5fa;
    stroke: #1d4ed8;
    stroke-width: 2;
    filter: drop-shadow(0 10px 14px rgba(37, 99, 235, 0.12));
}

.motion-object--accent {
    fill: #a78bfa;
    stroke: #7c3aed;
}

.motion-object--teal {
    fill: #67e8f9;
    stroke: #0891b2;
}

.motion-patch-box {
    fill: rgba(245, 243, 255, 0.3);
    stroke: #7c3aed;
    stroke-width: 2;
    stroke-dasharray: 5 4;
    animation: motionPatchPulse 1.2s var(--motion-ease) infinite;
}

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

.motion-diff-zone {
    fill: rgba(14, 165, 233, 0.18);
    stroke: #0891b2;
    stroke-width: 1.4;
    animation: motionDiffFlash 0.9s var(--motion-ease) infinite;
}

@keyframes motionDiffFlash {
    0%, 100% { opacity: 0.28; }
    50% { opacity: 0.88; }
}

.motion-vector-line,
.motion-flow-line {
    stroke: #0891b2;
    stroke-width: 2.8;
    marker-end: url(#motion-arrow-cyan);
    stroke-dasharray: 180;
    stroke-dashoffset: 180;
    animation: motionLineExtend 0.72s var(--motion-ease) forwards;
}

.motion-vector-truth {
    stroke: #7c3aed;
    stroke-width: 3;
    marker-end: url(#motion-arrow-purple);
    stroke-dasharray: 180;
    stroke-dashoffset: 180;
    animation: motionLineExtend 0.72s var(--motion-ease) forwards;
}

.motion-vector-truth.is-unstable {
    stroke: #f97316;
    opacity: 0.46;
    stroke-dasharray: 6 5;
}

.motion-constraint-line {
    stroke: #7c3aed;
    stroke-width: 2.2;
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
    animation: motionLineExtend 0.78s var(--motion-ease) forwards;
}

.motion-gradient-line {
    stroke: #f59e0b;
    stroke-width: 2;
    marker-end: url(#motion-arrow-amber);
}

.motion-pixel-probe {
    fill: rgba(255, 255, 255, 0.72);
    stroke-width: 2;
    animation: motionNodePulse 1.05s var(--motion-ease) infinite;
}

.motion-pixel-probe--x {
    stroke: #f59e0b;
}

.motion-pixel-probe--y {
    stroke: #0891b2;
}

.motion-pixel-probe--t {
    fill: rgba(251, 113, 133, 0.16);
    stroke: #fb7185;
}

.motion-candidate-point {
    fill: #ffffff;
    stroke: #0891b2;
    stroke-width: 2;
}

.motion-candidate-label {
    fill: #0f172a;
    font-size: 10px;
    font-weight: 950;
}

.motion-fail-line {
    stroke: #f97316;
    stroke-width: 2.2;
    stroke-dasharray: 7 5;
    opacity: 0.68;
}

.motion-fail-point {
    fill: #fff7ed;
    stroke: #f97316;
    stroke-width: 2;
}

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

.motion-point,
.motion-feature-point {
    fill: #7c3aed;
    stroke: #ffffff;
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.45));
    animation: motionNodePulse 1.25s var(--motion-ease) infinite;
}

@keyframes motionNodePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.12); opacity: 0.72; }
}

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

.motion-constraint-label {
    fill: #334155;
    font-size: 11px;
    font-weight: 850;
}

.motion-equation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
}

.motion-matrix-card {
    display: grid;
    gap: 6px;
    min-height: 96px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 10px;
    background: #ffffff;
    transition: transform 0.24s var(--motion-ease), border-color 0.24s var(--motion-ease), box-shadow 0.24s var(--motion-ease);
}

.motion-matrix-card span {
    color: #0e7490;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

.motion-matrix-card.is-active {
    border-color: #8b5cf6;
    box-shadow: 0 12px 24px rgba(124, 58, 237, 0.14);
    transform: translateY(-2px);
}

.motion-row-card code {
    color: #1d4ed8;
}

.motion-lk-window-cell {
    fill: rgba(239, 246, 255, 0.74);
    stroke: #bfdbfe;
}

.motion-lk-window-cell.is-active {
    fill: #fef3c7;
    stroke: #f59e0b;
    stroke-width: 1.7;
}

.motion-trackability-card,
.motion-failure-card {
    display: grid;
    gap: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 13px;
    padding: 10px;
    background: linear-gradient(145deg, #ffffff, #f8fbff);
}

.motion-trackability-card > span,
.motion-failure-card > span {
    color: #0e7490;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.motion-eigen-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 54px;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 10px;
    font-weight: 900;
}

.motion-eigen-row div {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: #e2e8f0;
}

.motion-eigen-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0891b2, #7c3aed);
    transition: width 0.36s var(--motion-ease);
}

.motion-eigen-row em {
    color: #172554;
    font-style: normal;
    text-align: right;
}

.motion-confidence-readout,
.motion-failure-card article {
    display: grid;
    gap: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    background: #ffffff;
}

.motion-confidence-readout strong,
.motion-failure-card strong {
    color: #172554;
    font-size: 12px;
}

.motion-confidence-readout small,
.motion-failure-card small {
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.motion-lk-image-stage,
.motion-lk-result,
.motion-pyramid-original,
.motion-pyramid-result {
    min-height: 355px;
}

.motion-lk-workbench .motion-lk-image-stage,
.motion-lk-workbench .motion-lk-result {
    min-height: 292px;
}

.motion-lk-workbench .motion-lk-image-stage svg,
.motion-lk-workbench .motion-lk-result svg {
    min-height: 292px;
}

.motion-lk-workbench .motion-equation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
}

.motion-lk-workbench .motion-matrix-card {
    align-content: start;
    min-height: 118px;
    padding: 9px;
}

.motion-lk-workbench .motion-matrix-card code {
    font-size: 9.5px;
    line-height: 1.34;
}

.motion-lk-workbench .motion-math-output--matrix {
    padding: 6px;
    font-size: 10px;
}

.motion-lk-workbench .motion-math-output--matrix mjx-container {
    font-size: 82% !important;
}

.motion-lk-workbench .motion-matrix-card[data-motion-lk-matrix-card="normal"] {
    grid-column: 1 / -1;
    min-height: 118px;
}

.motion-lk-workbench .motion-row-card {
    grid-column: 1 / -1;
    min-height: 58px;
}

.motion-lk-flow-preview {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    min-height: 0;
    padding: 10px;
}

.motion-lk-flow-preview article {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 6px;
    min-height: 58px;
    padding: 7px;
    border-radius: 10px;
}

.motion-lk-flow-preview article span {
    width: 22px;
    height: 22px;
    font-size: 9px;
}

.motion-lk-flow-preview article strong {
    font-size: 10.5px;
    line-height: 1.2;
}

.motion-lk-flow-preview article small {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 2px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 9px;
    line-height: 1.25;
}

.motion-lk-flow-preview article.is-active {
    transform: translateY(-1px);
}

.motion-lk-support-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr 1fr;
    gap: 9px;
    padding: 0 12px 12px;
    background: #f5f8fc;
}

.motion-lk-support-grid .motion-reference-card,
.motion-lk-support-grid .motion-code-card {
    min-height: 138px;
    align-content: start;
    background: rgba(255, 255, 255, 0.96);
}

.motion-lk-support-grid .motion-reference-card > span,
.motion-lk-support-grid .motion-code-card > span {
    font-size: 10px;
}

.motion-lk-support-grid .motion-reference-card article {
    padding: 5px 7px;
}

.motion-lk-support-grid .motion-code-card code {
    max-height: 70px;
}

.motion-lk-support-grid .motion-notes-body {
    gap: 6px;
}

.motion-lk-support-grid .motion-notes-body article:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.motion-lk-workbench .motion-control-panel,
.motion-lk-workbench .motion-notes-panel {
    gap: 8px;
    padding: 12px;
}

.motion-lk-workbench .vision-panel-heading {
    padding-bottom: 9px;
}

.motion-lk-workbench .motion-toggle-grid {
    gap: 5px;
}

.motion-lk-workbench .vision-formula-card,
.motion-lk-workbench .vision-output-schema,
.motion-lk-workbench .motion-trackability-card,
.motion-lk-workbench .motion-reference-card,
.motion-lk-workbench .motion-code-card {
    gap: 6px;
    padding: 8px;
}

.motion-lk-workbench .motion-notes-panel .vision-formula-card,
.motion-lk-workbench .motion-notes-panel .vision-output-schema {
    margin-top: 0;
}

.motion-lk-workbench .motion-reference-card article {
    padding: 6px 7px;
}

.motion-lk-workbench .motion-code-card code {
    max-height: 88px;
    padding: 7px;
    font-size: 9.5px;
    line-height: 1.34;
}

.motion-lk-workbench .motion-code-card small,
.motion-lk-workbench .motion-reference-card small,
.motion-lk-workbench .motion-confidence-readout small {
    font-size: 9.5px;
    line-height: 1.34;
}

.motion-lk-workbench .motion-notes-body {
    gap: 6px;
}

.motion-lk-workbench .motion-notes-body article {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 7px;
    padding-bottom: 7px;
}

.motion-lk-workbench .motion-notes-body article > span {
    width: 22px;
    height: 22px;
    font-size: 8.5px;
}

.motion-lk-workbench .motion-notes-body p {
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.35;
}

.motion-pyramid-workbench .motion-notes-panel {
    gap: 8px;
    padding: 12px;
}

.motion-pyramid-workbench .vision-panel-heading {
    padding-bottom: 9px;
}

.motion-pyramid-workbench .vision-formula-card,
.motion-pyramid-workbench .vision-output-schema,
.motion-pyramid-workbench .motion-failure-card,
.motion-pyramid-workbench .motion-reference-card,
.motion-pyramid-workbench .motion-code-card {
    gap: 6px;
    padding: 8px;
}

.motion-pyramid-workbench .motion-failure-card article,
.motion-pyramid-workbench .motion-reference-card article {
    padding: 6px 7px;
}

.motion-pyramid-workbench .motion-code-card code {
    max-height: 76px;
    padding: 7px;
    font-size: 9.3px;
    line-height: 1.28;
}

.motion-pyramid-workbench .motion-reference-card small,
.motion-pyramid-workbench .motion-code-card small,
.motion-pyramid-workbench .motion-failure-card small {
    font-size: 9.5px;
    line-height: 1.34;
}

.motion-pyramid-workbench .motion-notes-body {
    gap: 6px;
}

.motion-pyramid-workbench .motion-notes-body article {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 7px;
    padding-bottom: 7px;
}

.motion-pyramid-workbench .motion-notes-body article > span {
    width: 22px;
    height: 22px;
    font-size: 8.5px;
}

.motion-pyramid-workbench .motion-notes-body p {
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.35;
}

.motion-confidence-card {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.motion-confidence-bar {
    position: relative;
    overflow: hidden;
    height: 14px;
    border-radius: 999px;
    background: #e2e8f0;
}

.motion-confidence-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #0891b2, #7c3aed);
    transition: width 0.36s var(--motion-ease);
}

.motion-confidence-card strong {
    color: #172554;
    font-size: 16px;
}

.motion-confidence-card span {
    color: #64748b;
    font-size: 11px;
    line-height: 1.45;
}

.motion-pyramid-stack {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 355px;
    padding: 16px;
    background:
        linear-gradient(90deg, rgba(191, 219, 254, 0.32) 1px, transparent 1px),
        linear-gradient(180deg, rgba(191, 219, 254, 0.32) 1px, transparent 1px),
        #f8fafc;
    background-size: 22px 22px;
}

.motion-pyramid-layer {
    position: relative;
    display: grid;
    gap: 4px;
    box-sizing: border-box;
    max-width: 100%;
    justify-self: center;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 9px 12px;
    color: #334155;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.045);
    transition: border-color 0.24s var(--motion-ease), transform 0.24s var(--motion-ease), background 0.24s var(--motion-ease);
}

.motion-pyramid-layer strong {
    color: #172554;
    font-size: 13px;
}

.motion-pyramid-layer span {
    overflow-wrap: anywhere;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
}

.motion-pyramid-layer.is-active {
    border-color: #8b5cf6;
    background: #f5f3ff;
    transform: translateX(4px);
}

.motion-pyramid-layer.is-complete {
    border-color: #67e8f9;
    background: #ecfeff;
}

.motion-pyramid-layer::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: -11px;
    width: 2px;
    height: 10px;
    background: #93c5fd;
}

.motion-pyramid-layer:last-child::after {
    display: none;
}

.motion-residual-list {
    display: grid;
    gap: 8px;
    padding: 16px;
}

.motion-residual-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 10px;
    font-weight: 850;
}

.motion-residual-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.motion-residual-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #0891b2);
    transition: width 0.34s var(--motion-ease);
}

.motion-real-workbench {
    grid-template-columns: minmax(228px, 260px) minmax(0, 1fr) minmax(274px, 318px);
}

.motion-real-stage-panel {
    min-height: 660px;
}

.motion-vector-microscope {
    display: grid;
    grid-template-columns: 1.25fr repeat(4, minmax(80px, 1fr));
    gap: 8px;
    border-top: 1px solid #dbeafe;
    padding: 10px 14px;
    background: #ffffff;
}

.motion-vector-microscope > span {
    align-self: center;
    color: #0e7490;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.motion-vector-microscope div {
    display: grid;
    gap: 2px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 7px 8px;
    background: #f8fbff;
}

.motion-vector-microscope strong {
    overflow: hidden;
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.motion-vector-microscope em {
    overflow: hidden;
    color: #172554;
    font-size: 11px;
    font-style: normal;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.motion-real-stage-grid {
    display: grid;
    grid-template-columns: minmax(220px, 0.78fr) minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 12px;
    padding: 14px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.45) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.45) 1px, transparent 1px),
        #f5f8fc;
    background-size: 26px 26px;
}

.motion-real-stage-grid[data-flow-mode="dense"],
.motion-real-stage-grid[data-flow-mode="sparse"] {
    grid-template-columns: minmax(220px, 0.78fr) minmax(320px, 2fr);
}

.motion-real-video-shell {
    position: relative;
    display: grid;
    min-height: 270px;
    overflow: hidden;
    border-top: 1px solid #e0edff;
    background: #0f172a;
}

.motion-real-video-shell video {
    width: 100%;
    height: 100%;
    min-height: 270px;
    object-fit: cover;
}

.motion-real-video-shell canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    pointer-events: none;
}

.motion-real-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 270px;
    border-top: 1px solid #e0edff;
    background:
        linear-gradient(90deg, rgba(191, 219, 254, 0.22) 1px, transparent 1px),
        linear-gradient(180deg, rgba(191, 219, 254, 0.22) 1px, transparent 1px),
        #f8fafc;
    background-size: 18px 18px;
}

.motion-real-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.motion-real-metrics strong {
    font-size: 13px;
}

.motion-real-log {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 0;
    margin: 0 14px 14px;
}

.motion-real-log article {
    min-height: 62px;
}

.motion-real-notes article.is-active,
.motion-real-log article.is-active {
    border-color: #7c3aed;
    background: #f5f3ff;
}

.motion-real-source-card {
    background: #ffffff;
}

.motion-real-source-card .geometry-section-head {
    border-bottom: 0;
}

.motion-notes-panel.is-pulsing,
.motion-matrix-card.is-pulsing,
.motion-flow-preview.is-pulsing {
    animation: motionPanelPulse 0.68s var(--motion-ease);
}

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

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

    .motion-real-workbench {
        grid-template-columns: minmax(218px, 240px) minmax(0, 1fr) minmax(250px, 286px);
    }

    .motion-real-stage-grid {
        grid-template-columns: minmax(210px, 0.8fr) minmax(250px, 1fr);
    }

    .motion-vector-microscope {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .motion-vector-microscope > span {
        grid-column: 1 / -1;
    }

    .motion-real-stage-grid .motion-view-card:last-child {
        grid-column: 1 / -1;
    }

    .motion-svg-frame,
    .motion-lk-image-stage,
    .motion-lk-result,
    .motion-pyramid-original,
    .motion-pyramid-result,
    .motion-pyramid-stack {
        min-height: 288px;
    }
}

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

    .motion-real-workbench {
        grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
    }

    .motion-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;
    }

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

@media (max-width: 1080px) {
    .motion-frame-grid,
    .motion-lk-stage-grid,
    .motion-pyramid-stage-grid,
    .motion-real-stage-grid,
    .motion-real-log {
        grid-template-columns: 1fr;
    }

    .motion-real-stage-grid[data-flow-mode="dense"],
    .motion-real-stage-grid[data-flow-mode="sparse"] {
        grid-template-columns: 1fr;
    }

    .motion-real-stage-grid .motion-view-card:last-child {
        grid-column: auto;
    }

    .motion-vector-microscope,
    .motion-real-log {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .motion-vector-microscope > span {
        grid-column: 1 / -1;
    }

    .motion-lk-workbench .motion-equation-grid,
    .motion-lk-flow-preview,
    .motion-lk-support-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

@media (max-width: 820px) {
    .station-tabs.motion-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .station-tabs.motion-tabs a {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        justify-content: center;
        text-align: center;
    }

    .motion-workbench,
    .motion-detail-grid {
        grid-template-columns: 1fr;
    }

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

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

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

    .motion-vector-microscope,
    .motion-real-log,
    .motion-lk-workbench .motion-equation-grid,
    .motion-lk-flow-preview,
    .motion-lk-support-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .motion-lab *,
    .motion-lab *::before,
    .motion-lab *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
