/* Viewer information follows one bottom stack; engagement belongs to its author. */
.instagram-viewer[open] .instagram-post-header{position:relative;inset:auto;order:2;flex:none;width:calc(100% - 76px);height:auto;min-height:60px;margin-top:auto;padding:10px 0 7px 16px;gap:10px;align-items:center;text-shadow:0 1px 5px #0009}
.instagram-viewer[open] .instagram-post-header>img,.instagram-viewer[open] .instagram-avatar{width:36px;height:36px;flex-basis:36px;border:1px solid #ffffff40}
.instagram-viewer[open] .instagram-post-header>div{min-width:0}
.instagram-viewer[open] .instagram-post-header strong{min-width:0;font-size:14px;line-height:21px;font-weight:650;letter-spacing:-.3px}
.instagram-viewer[open] .instagram-verified{flex:none;width:13px;height:13px;font-size:9px}
.instagram-viewer[open] .instagram-post-header>div>.clip-engagement{display:flex;flex-wrap:wrap;gap:1px 11px;margin-top:4px;overflow:visible;white-space:normal;font-size:11px;line-height:17px;color:#ffffffb8;font-variant-numeric:tabular-nums}
.clip-engagement>span{white-space:nowrap}
.clip-engagement b{font-weight:550;color:#ffffffe0}
.instagram-viewer[open] .instagram-post-caption:not(.expanded){position:relative;inset:auto;order:3;flex:none;margin:0;padding:1px 80px 0 16px;font-size:14px;line-height:21px;font-weight:500;letter-spacing:-.2px}
.instagram-viewer[open] .instagram-post-caption:not(.expanded)>span{-webkit-line-clamp:2;word-break:keep-all;overflow-wrap:anywhere}
.instagram-viewer[open] .instagram-post-caption>button{display:inline-flex;align-items:center;min-height:32px;padding:0;color:#ffffffad;font-size:11px;font-weight:400}
.instagram-viewer[open] .instagram-post-footer{position:relative;inset:auto;order:4;flex:none;min-height:52px;padding:0 12px env(safe-area-inset-bottom,0px) 16px}
.instagram-viewer[open] .instagram-post-footer>a{font-size:11px;line-height:18px;color:#ffffffb8;font-weight:400}
.instagram-viewer[open] .feed-page-buttons{gap:2px}
.instagram-viewer[open] .feed-page-buttons button{width:40px;height:44px;font-size:23px;color:#ffffffe6}
.instagram-viewer[open] .instagram-post-actions{right:12px;bottom:calc(126px + env(safe-area-inset-bottom,0px));gap:12px;align-items:center;max-width:52px}
.instagram-viewer[open] .instagram-post-actions>button{display:flex;align-items:center;justify-content:center;gap:5px;width:48px;min-width:48px;min-height:52px;padding:0;color:#fff;font-size:11px;line-height:16px;font-weight:500}
.instagram-viewer[open] .instagram-post-actions svg{width:27px;height:27px;flex:none}
.instagram-viewer[open] .instagram-post-actions .nocan-save-button{width:48px;height:52px;min-height:52px;max-height:52px;margin:0}
.instagram-viewer[open] .instagram-post:after{height:43%;background:linear-gradient(transparent,#0003 30%,#000b 80%,#000d)}
@media(max-width:360px){.instagram-viewer[open] .instagram-post-header{width:calc(100% - 68px);padding-left:14px;gap:8px}.instagram-viewer[open] .instagram-post-header strong{font-size:13px}.instagram-viewer[open] .instagram-post-header>div>.clip-engagement{font-size:10px;gap:1px 8px}.instagram-viewer[open] .instagram-post-caption:not(.expanded){padding-left:14px;padding-right:72px;font-size:13px;line-height:20px}.instagram-viewer[open] .instagram-post-actions{right:8px;gap:10px}}
@media(max-height:500px){.instagram-viewer[open] .instagram-post-header{min-height:45px;padding-top:4px;padding-bottom:4px}.instagram-viewer[open] .instagram-post-header>img{width:28px;height:28px;flex-basis:28px}.instagram-viewer[open] .instagram-post-caption:not(.expanded)>span{-webkit-line-clamp:1}.instagram-viewer[open] .instagram-post-caption>button{min-height:25px}.instagram-viewer[open] .instagram-post-actions{bottom:82px;gap:2px}.instagram-viewer[open] .instagram-post-actions>button{min-height:44px}.instagram-viewer[open] .instagram-post-footer{min-height:44px}}
.clip-channel-name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto}

.instagram-viewer[open] .instagram-post-header>div{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 7px;align-items:center}
.instagram-viewer[open] .instagram-post-header strong{grid-column:1;grid-row:1}
.instagram-viewer[open] .instagram-post-header>div>span:not(.clip-engagement){grid-column:2;grid-row:1;font-size:10px;line-height:18px;color:#ffffff9c}
.instagram-viewer[open] .instagram-post-header>div>.clip-engagement{grid-column:1/-1;grid-row:2;margin-top:1px}

/* A tap/click outside the central playback control reveals the whole image. */
.instagram-viewer .instagram-chrome-toggle{position:absolute;inset:0;width:100%;height:100%;z-index:1;border:0;background:transparent;color:inherit;cursor:pointer;touch-action:pan-x pinch-zoom}
.instagram-viewer .instagram-chrome-toggle:focus-visible{outline:2px solid #fff;outline-offset:-5px}
.instagram-viewer .instagram-video-toggle{inset:50% auto auto 50%;transform:translate(-50%,-50%);width:72px;height:72px;z-index:2}
.instagram-viewer .instagram-play-hint{left:50%;right:auto;transform:translateX(-50%);width:160px;pointer-events:none}
.instagram-viewer.is-media-only :is(.instagram-viewer-header,.instagram-post-header,.instagram-post-caption,.instagram-post-actions,.instagram-post-footer,.instagram-sound,.instagram-slide-count,.instagram-gallery-controls,.instagram-video-progress){visibility:hidden;pointer-events:none}
.instagram-viewer.is-media-only .instagram-post:before,.instagram-viewer.is-media-only .instagram-post:after{opacity:0}
.instagram-viewer.is-media-only .instagram-slide.is-playing .instagram-video-toggle:not(:focus-visible){opacity:0}

.instagram-viewer .instagram-slide>video[data-rotated]{position:absolute;left:50%;top:50%;max-width:none;max-height:none;object-fit:contain;transform:translate(-50%,-50%) rotate(var(--media-rotation))}
.instagram-viewer .instagram-rotate{position:absolute;right:16px;top:74px;z-index:4;display:grid;place-items:center;width:40px;height:40px;border:1px solid #ffffff40;border-radius:50%;background:#080a0970;color:#fff}
.instagram-viewer .instagram-rotate svg{width:20px;height:20px}
.instagram-viewer.is-media-only .instagram-rotate{visibility:hidden;pointer-events:none}

/* The viewer handles horizontal tab swipes; photo arrows retain gallery access. */
.instagram-viewer,.instagram-viewer .instagram-viewer-scroll,.instagram-viewer .instagram-media-wrap,.instagram-viewer .instagram-media-rail,.instagram-viewer .instagram-chrome-toggle{touch-action:pinch-zoom}
.instagram-viewer:has(.instagram-post-caption.expanded),.instagram-viewer .instagram-viewer-scroll:has(.instagram-post-caption.expanded){touch-action:pan-y pinch-zoom}

/* Reveal the real destination tab while the outgoing modal slides away. */
dialog.instagram-viewer.is-tab-transition::backdrop{background:transparent;backdrop-filter:none}

/* Instagram-style text controls retain generous invisible touch targets. */
.instagram-viewer[open] .instagram-post-header strong{font-size:17px;line-height:25px}
.instagram-viewer[open] .instagram-post-header>div>span:not(.clip-engagement){font-size:12px;line-height:20px;color:#ffffffd9}
.instagram-viewer[open] .instagram-post-header>div>.clip-engagement{font-size:14px;line-height:22px;color:#ffffffe6}
.instagram-viewer[open] .instagram-post-caption:not(.expanded){font-size:15px;line-height:23px;font-weight:400;padding-top:4px}
.instagram-viewer[open] .instagram-post-caption>button{min-height:44px;min-width:64px;padding:8px 12px 8px 0;margin:0;border:0;border-radius:0;background:transparent;color:#ffffffb8;font-size:14px;line-height:22px;font-weight:400;cursor:pointer;touch-action:manipulation}
.instagram-viewer[open] .instagram-post-footer{min-height:48px;gap:10px}
.instagram-viewer[open] .instagram-post-footer>a{display:inline-flex;align-items:center;justify-content:flex-start;min-height:44px;padding:8px 12px 8px 0;border:0;border-radius:0;background:transparent;color:#ffffffe6;font-size:14px;line-height:22px;font-weight:500;touch-action:manipulation}
.instagram-viewer[open] .instagram-post-caption.expanded{position:absolute;left:0;right:0;bottom:calc(48px + env(safe-area-inset-bottom,0px));z-index:6;margin:0;padding:20px 80px 0 16px;border:0;border-radius:0;box-shadow:none;backdrop-filter:none;font-size:15px;line-height:1.6;font-weight:400;background:linear-gradient(transparent,#000c 24px,#000e);color:#fff;text-shadow:0 1px 3px #0008}
.instagram-viewer[open] .instagram-post-caption.expanded>span{display:block;max-height:min(55dvh,520px);overflow-y:auto;white-space:pre-line;word-break:normal;overflow-wrap:anywhere;overscroll-behavior:contain;touch-action:pan-y pinch-zoom}
.instagram-viewer[open] .instagram-post-actions>button{font-size:13px;line-height:20px}
.instagram-viewer[open] .instagram-post-actions{bottom:calc(142px + env(safe-area-inset-bottom,0px))}
.instagram-viewer[open] :is(.instagram-post-caption>button,.instagram-post-footer>a):focus-visible{outline:3px solid #fff;outline-offset:3px}
@media(max-height:500px){.instagram-viewer[open] .instagram-post-caption:not(.expanded){font-size:15px;line-height:23px}.instagram-viewer[open] .instagram-post-caption.expanded>span{max-height:40dvh}}
