/* Independent of the viewer row drawer, so Refresh remains reachable when collapsed. */
#cvb-app-actions{position:fixed;top:calc(env(safe-area-inset-top,0px) + 64px);right:max(8px,env(safe-area-inset-right));z-index:12000;display:flex;gap:4px;align-items:center;pointer-events:auto}
#cvb-app-actions button{box-sizing:border-box;min-width:44px;min-height:44px;padding:6px 9px;border:1px solid rgba(100,100,100,.6);border-radius:6px;background:rgba(247,245,240,.8);color:#404040;font:12px/1.2 Arial,sans-serif;touch-action:manipulation}

html.dark #cvb-app-actions button,html[data-theme="dark"] #cvb-app-actions button{background:rgba(25,25,25,.85);color:#ddd}
#cvb-app-actions button:focus-visible{outline:2px solid currentColor;outline-offset:2px}
#cvb-app-actions [hidden]{display:none!important}
#cvb-app-help{box-sizing:border-box;max-width:min(400px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #888;border-radius:8px;padding:18px;background:#f7f5f0;color:#333;font:14px/1.5 Arial,sans-serif}
#cvb-app-help h2{font-size:17px;margin-top:0}#cvb-app-help::backdrop{background:rgba(0,0,0,.3)}
@media(max-width:950px),(pointer:coarse){#cvb-app-actions .cvb-install-action{display:none}}

html[data-theme="dark"] #cvb-app-help{background:#191919;color:#ddd}

/* Refresh belongs to the existing footer, not a floating toolbar. */
html[data-theme] body :is(footer,#full-view,.immersive-controls) button.cvb-refresh-action{display:inline-flex!important;align-items:center;justify-content:center;flex:0 0 auto!important;width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;padding:6px!important;box-sizing:border-box;border:1px solid var(--footer-glass-line,#888);border-radius:4px;background:var(--footer-button-glass)!important;color:var(--footer-glass-ink)!important;touch-action:manipulation;vertical-align:middle}
html[data-theme] .cvb-refresh-action svg{display:block;width:16px;height:16px;pointer-events:none}
html[data-theme] .cvb-refresh-action:focus-visible{outline:2px solid currentColor;outline-offset:2px}

#viewer-controls-drawer-handlebar:has(.cvb-refresh-action){max-width:100%;box-sizing:border-box}
#full-view.viewer-controls-drawer-enabled #viewer-controls-drawer-handlebar:has(.cvb-refresh-action) #viewer-controls-drawer-handle{min-width:100px;flex:1 1 auto}

/* Icon-only Refresh matches adjacent phone/touch buttons, including the drawer handle. */
html.phone-layout[data-theme] body :is(footer,#full-view,.immersive-controls) button.cvb-refresh-action{height:44px!important;min-height:44px!important;max-height:44px!important;width:44px!important;min-width:44px!important;max-width:44px!important}
@media(any-pointer:coarse){html[data-theme] body :is(footer,#full-view,.immersive-controls) button.cvb-refresh-action{height:44px!important;min-height:44px!important;max-height:44px!important;width:44px!important;min-width:44px!important;max-width:44px!important}}

/* One stable revision/reload pair; normal counters and controls retain their layout. */
html[data-theme] .cvb-revision-refresh{display:inline-flex!important;align-items:center;justify-content:flex-end;gap:4px;flex:0 0 auto;min-width:0;max-width:100%;box-sizing:border-box}
html[data-theme] :is(body>footer,#image-viewer-footer)>.collection-status>.cvb-revision-refresh{grid-column:3;grid-row:1/span 2;justify-self:end;align-self:center}
html[data-theme] .cvb-revision-refresh #build-badge{flex:0 0 auto!important;min-width:0!important;max-width:none!important;white-space:nowrap!important}
html[data-theme] .cvb-revision-refresh .cvb-refresh-action{margin:0!important;flex:0 0 auto!important}
html[data-theme] #viewer-controls-drawer-handlebar>.cvb-revision-refresh{margin-left:auto;padding-right:env(safe-area-inset-right,0px)}
html[data-theme] .cvb-revision-refresh #build-badge{font-size:0!important;line-height:16px!important;padding:4px!important;min-height:32px!important}
html[data-theme] .cvb-revision-refresh #build-badge::after{content:attr(data-phone-version);font-size:12px!important;line-height:16px;white-space:nowrap}
html.phone-layout[data-theme] .cvb-revision-refresh #build-badge{min-height:44px!important}
@media(any-pointer:coarse){html[data-theme] .cvb-revision-refresh #build-badge{min-height:44px!important}}
html[data-theme] .cvb-revision-refresh[data-floating="true"]{position:fixed;right:max(8px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom));z-index:12000;background:var(--footer-glass);border-radius:4px;padding:2px 4px}

/* Desktop only: equal Reload-sized faces, attached as a single compact piece. */
html.desktop-cvb-refinement[data-theme] .cvb-revision-refresh{gap:0!important}
html.desktop-cvb-refinement[data-theme] :is(body,#full-view) .cvb-revision-refresh #build-badge#build-badge{display:inline-flex!important;align-items:center;justify-content:center;width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;max-height:32px!important;padding:0!important;box-sizing:border-box;border:1px solid var(--footer-glass-line,#888);border-radius:4px 0 0 4px;background:var(--footer-button-glass)!important;color:var(--footer-glass-ink)!important}
html.desktop-cvb-refinement[data-theme] :is(body,#full-view) .cvb-revision-refresh #build-badge#build-badge::after{font-size:10px!important;line-height:14px!important}
html.desktop-cvb-refinement[data-theme] :is(body,#full-view) .cvb-revision-refresh .cvb-refresh-action{width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;max-height:32px!important;border-radius:0 4px 4px 0!important;border-left:0!important}
