e.stopPropagation()}
>
+ {compact && (
+
+ )}
{/* Only the front face can be horizontal (Battles) — a transformed
Battle's back face is always a normal, correctly-oriented
diff --git a/src/styles.css b/src/styles.css
index 72b0ba4..7da7c7d 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -2018,10 +2018,19 @@ tbody tr:hover {
.preview-modal-faces {
position: relative;
}
+/* Sized explicitly (Scryfall "normal" images are 488x680) rather than from
+ the image's intrinsic size, so the box is already its final size before the
+ image loads — ClickPreviewModal measures the layout on mount to decide on
+ compact mode. Same result as the old intrinsic sizing capped at 90vw/90vh;
+ `--preview-img-h` is the height budget, shrunk in compact mode. */
+.preview-modal {
+ --preview-img-h: 90vh;
+}
.preview-modal-img {
display: none;
+ width: min(488px, 90vw, calc(var(--preview-img-h) * 488 / 680));
+ aspect-ratio: 488 / 680;
max-width: min(720px, 90vw);
- max-height: 90vh;
border-radius: 18px;
box-shadow: var(--shadow-lg);
border: 1px solid rgba(255, 255, 255, 0.08);
@@ -2075,6 +2084,43 @@ tbody tr:hover {
display: none;
}
}
+/* Compact mode (see ClickPreviewModal): the full layout would be taller than
+ the viewport, so a toolbar (pane toggle + close) shows one pane at a time —
+ a single face, or the info tile — with the art shrunk to fit the height
+ left over after the backdrop padding, toolbar and gap. */
+.preview-modal-compact {
+ /* A column (not the base wrapping row) so the toolbar stretches to exactly
+ the visible pane's width instead of the row's full 96vw. */
+ flex-direction: column;
+ flex-wrap: nowrap;
+ align-items: stretch;
+ --preview-img-h: calc(
+ 100vh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 36px - 16px
+ );
+}
+.preview-modal-bar {
+ flex-basis: 100%;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+}
+.preview-modal-compact .preview-modal-faces {
+ display: block;
+}
+.preview-modal-compact .preview-modal-img:not(.active) {
+ display: none;
+}
+.preview-modal-compact .preview-modal-img:not(.preview-modal-img-rotated) {
+ max-width: min(720px, 90vw);
+}
+.preview-modal-compact .preview-modal-close,
+.preview-modal-compact .preview-modal-flip,
+.preview-modal-compact:not(.preview-modal-show-info) .preview-info,
+.preview-modal-show-info .preview-modal-faces {
+ display: none;
+}
.preview-modal-close {
position: absolute;
top: -14px;