/* Spring positions are written only while moving; normal scrolling stays native. */
.saved-cards{--library-columns:3;--library-gap:22px;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.saved-cards.is-spring-grid{display:block;position:relative;overflow-anchor:none}
.is-spring-grid>.saved-card{position:absolute;left:0;top:0;transform-origin:center 35%;width:100%;z-index:1}
.is-spring-grid>.saved-card[data-dragging]{z-index:10;will-change:transform}
.saved-card-open{cursor:grab;touch-action:pan-y pinch-zoom;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.is-dragging .saved-card-open{cursor:grabbing}
.saved-card-open img{-webkit-user-drag:none;pointer-events:none}
.saved-card-frame{border-radius:14px;padding:8px;box-shadow:0 5px 18px #54432c24;transition:box-shadow .18s}
.saved-card[data-dragging] .saved-card-frame{box-shadow:0 18px 40px #402c2945}
.saved-card-open img{border-radius:8px;background:#f3e7cf}
.saved-card h2{font-size:1.15rem;margin:12px 2px 0;min-height:2.5em;line-height:1.25}
.saved-card-options{justify-content:flex-start;margin:0 2px}
.saved-card-options button{font-size:.95rem;min-height:44px}
.saved-card-heart{width:44px;height:44px;top:14px;right:14px}
.library-drag-hint{font-size:18px;line-height:1.45;color:#65544d;margin:16px 0 0}
body.extra-large .saved-card h2{font-size:24px}
body.extra-large .saved-card-options button,body.extra-large .library-drag-hint{font-size:21px}
@media(min-width:1450px){.saved-cards{--library-columns:4;grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:1100px){.saved-cards{--library-columns:2;grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.saved-cards{--library-gap:16px;gap:16px}.library-view{padding-left:16px;padding-right:16px}.saved-card-frame{padding:6px}.saved-card h2{font-size:18px}.saved-card-heart{top:10px;right:10px}.saved-card-options button{font-size:17px}}

/* Full-screen photo, fixed controls and safe-area padding on phones. */
body.library-photo-open{overflow:hidden}
.library-photo-dialog{inset:0;box-sizing:border-box;margin:0;width:100%;height:100dvh;max-width:none;max-height:none;padding:0;border:0;border-radius:0;overflow:hidden;background:#fffaf1;color:#402c29;animation:none}
.library-photo-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto auto}
.library-photo-dialog::backdrop{background:#241b16}
.photo-viewer-toolbar{display:grid;grid-template-columns:56px minmax(0,1fr) 56px;align-items:center;gap:16px;padding:max(12px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) 12px max(18px,env(safe-area-inset-left));border-bottom:1px solid #dbcdb6}
.photo-viewer-toolbar button{display:grid;place-items:center;width:56px;height:56px;min-height:56px;padding:12px;border-radius:50%;cursor:pointer}
.photo-viewer-back{background:#eee7da;border:1px solid #c6baa6;color:#285a54}
.photo-viewer-back svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.photo-viewer-delete{background:#b52b35;color:#fffaf1}
.photo-viewer-delete:hover{background:#97212a}
.photo-viewer-delete img{display:block;width:30px;height:30px;filter:brightness(0) invert(1)}
.library-photo-dialog .photo-viewer-toolbar h2{margin:0;text-align:center;font:700 clamp(20px,3vw,30px)/1.2 var(--display);letter-spacing:-.02em;overflow-wrap:anywhere;max-height:3.6em;overflow:hidden}
body.extra-large .library-photo-dialog .photo-viewer-toolbar h2{font-size:26px}
.library-photo-dialog .library-photo-stage{display:grid;place-items:center;min-width:0;min-height:0;overflow:hidden;padding:16px}
.library-photo-dialog .library-photo-stage>#library-photo{display:block;width:auto;height:auto;max-width:100%;max-height:100%;min-height:0;object-fit:contain;margin:0;transform-origin:center;box-shadow:0 4px 18px #402c2920}
.library-photo-dialog #library-photo-actions{box-sizing:border-box;display:grid;grid-template-columns:1fr 1fr;gap:16px;width:min(100%,780px);max-width:780px;margin:0 auto;padding:12px max(20px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left))}
.library-photo-dialog .saved-card-actions .primary,.library-photo-dialog .saved-card-actions .secondary{font-size:24px;min-height:72px;gap:14px;padding:16px;line-height:1.25}
.photo-action-icon{display:grid;place-items:center;flex:0 0 auto}
.photo-action-icon svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#library-photo-status{margin:0;padding:0 20px max(12px,env(safe-area-inset-bottom));text-align:center;font-size:18px;line-height:1.4}
#library-photo-status:empty{display:none}
#remove-card-warning{margin:18px 0 26px;font-size:20px;line-height:1.5}
#confirm-remove{background:#b52b35;box-shadow:none}
.icon-credit{font-size:13px;color:#65544d;text-underline-offset:3px;max-width:100%;overflow-wrap:anywhere}
@media(max-width:540px){.photo-viewer-toolbar{grid-template-columns:50px minmax(0,1fr) 50px;gap:10px;padding-left:12px;padding-right:12px}.photo-viewer-toolbar button{width:50px;height:50px;min-height:50px}.library-photo-dialog .library-photo-stage{padding:8px}.library-photo-dialog #library-photo-actions{gap:12px;padding-left:12px;padding-right:12px}.library-photo-dialog .saved-card-actions .primary,.library-photo-dialog .saved-card-actions .secondary{font-size:22px;min-height:86px;flex-direction:column;gap:7px;padding:12px 8px}body.extra-large .library-photo-dialog .saved-card-actions .primary,body.extra-large .library-photo-dialog .saved-card-actions .secondary{font-size:26px}}
@media(prefers-reduced-motion:reduce){.saved-card-frame{transition:none}}
