diff --git a/web/src/spa/components/MermaidDiagram.tsx b/web/src/spa/components/MermaidDiagram.tsx
index a67fdcc..12e94b8 100644
--- a/web/src/spa/components/MermaidDiagram.tsx
+++ b/web/src/spa/components/MermaidDiagram.tsx
@@ -187,11 +187,15 @@ export function MermaidDiagram({ chart, mode = 'dark' }: MermaidDiagramProps) {
borderColor: 'divider',
overflow: 'auto',
cursor: 'zoom-in',
- // Use width (layout-affecting) instead of zoom/transform:scale so
- // the card expands correctly in all browsers including Firefox.
+ // scale=1 → fit container (100%). scale≠1 → explicit pixel width
+ // so the card scrolls when zoomed in. Always layout-affecting (no
+ // zoom/transform:scale) so it works in Firefox too.
'& .mermaid-svg-wrap svg': {
display: 'block',
- width: naturalWidth ? `${naturalWidth * scale}px` : '100%',
+ width: scale === 1
+ ? '100%'
+ : naturalWidth ? `${naturalWidth * scale}px` : `${scale * 100}%`,
+ maxWidth: scale === 1 ? '100%' : 'none',
height: 'auto',
},
}}
@@ -222,27 +226,31 @@ export function MermaidDiagram({ chart, mode = 'dark' }: MermaidDiagramProps) {
}}
>
-
-
-
+
+
+
+
+
- = INLINE_MAX_SCALE}
- >
-
-
+
+ = INLINE_MAX_SCALE}
+ >
+
+
+
@@ -257,15 +265,17 @@ export function MermaidDiagram({ chart, mode = 'dark' }: MermaidDiagramProps) {
- { e.stopPropagation(); setScale(1); }}
- sx={{ color: pillColor, p: 0.5 }}
- disabled={scale === 1}
- >
-
-
+
+ { e.stopPropagation(); setScale(1); }}
+ sx={{ color: pillColor, p: 0.5 }}
+ disabled={scale === 1}
+ >
+
+
+
@@ -380,15 +390,17 @@ export function MermaidDiagram({ chart, mode = 'dark' }: MermaidDiagramProps) {
- = MAX_SCALE}
- >
-
-
+
+ = MAX_SCALE}
+ >
+
+
+
{/* Row 2: [left] [reset] [right] */}
@@ -416,15 +428,17 @@ export function MermaidDiagram({ chart, mode = 'dark' }: MermaidDiagramProps) {
-
-
-
+
+
+
+
+