diff --git a/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift b/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift index fdcf16f..4a81684 100644 --- a/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift +++ b/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift @@ -95,6 +95,17 @@ struct AskUserQuestionCardView: View { } .padding() .glassSurface(cornerRadius: 20) + // A hard ceiling on the whole card so it can never exceed the screen; `nil` (before the + // height is measured) leaves it unconstrained. + .frame(maxHeight: availableHeight > 0 ? availableHeight - 12 : nil, alignment: .bottom) + } + + /// The height the scrolling question region may take before it starts scrolling — the screen + /// minus a reserve for the header and the button row, so those always have room. Falls back to + /// a roomy default before the height is measured. + private var middleMaxHeight: CGFloat { + let base = availableHeight > 0 ? availableHeight - 12 : 640 + return max(160, base - 170) } // MARK: - Wizard state